# codebuff | Codebuff | Knowledge Base | Instagit

Generate code from the terminal!

GitHub Stars: 4.1k

Repository: https://github.com/CodebuffAI/codebuff

---

## Articles

### [How to Optimize Agent Performance and Token Usage in Codebuff: 9 Production Techniques](/CodebuffAI/codebuff/how-to-optimize-agent-performance-and-token-usage)

Discover 9 production techniques to optimize agent performance and token usage in Codebuff. Learn budget-aware tooling, file-tree pruning, and cached token counting for fast, relevant results within LLM limits.

- Tags: best-practices
- Published: 2026-03-09

### [How to Use the set_output Function for Inter-Agent Communication in Codebuff](/CodebuffAI/codebuff/how-to-use-set_output-for-agent-communication)

Learn to use Codebuff's set_output function for inter-agent communication. Store structured data in agent states for validated parent retrieval.

- Tags: how-to-guide
- Published: 2026-03-09

### [Codebuff MAX, FAST, and FREE Modes: Agent Behavior and Performance Implications](/CodebuffAI/codebuff/how-different-modes-max-fast-free-affect-behavior)

Explore Codebuff MAX FAST and FREE modes Understand how they impact agent behavior and performance Choose the right mode for complex tasks or quick edits to optimize your workflow

- Tags: performance
- Published: 2026-03-09

### [How to Write Effective Unit and Integration Tests for Custom Agents in Codebuff](/CodebuffAI/codebuff/how-to-write-tests-for-custom-agents)

Learn to write effective unit and integration tests for custom Codebuff agents. Isolate agent logic with unit tests and verify end-to-end behavior with integration tests for robust applications.

- Tags: best-practices
- Published: 2026-03-09

### [Debugging Agent Execution Flow in Codebuff: Recommended Strategies](/CodebuffAI/codebuff/how-to-debug-agent-execution-flow)

Debug agent execution flow in Codebuff effectively. Learn strategies: enable full logging, use structured logger, and inspect JSONL logs with comparison scripts.

- Tags: how-to-guide
- Published: 2026-03-09

### [How Base2 Orchestration Coordinates Multiple Subagents in Codebuff](/CodebuffAI/codebuff/how-base2-orchestration-coordinates-subagents)

Learn how Base2 orchestration coordinates multiple subagents in Codebuff by breaking down requests, delegating steps to specialized agents, and aggregating results for efficient task completion.

- Tags: internals
- Published: 2026-03-09

### [What Are spawnableAgents in Codebuff? A Complete Guide to Agent Composition](/CodebuffAI/codebuff/how-to-use-spawnableagents-for-agent-composition)

Discover spawnableAgents in Codebuff AI. Learn how this declarative composition mechanism enables modular, reusable agent workflows by programmatically launching other agents during execution without code duplication.

- Tags: deep-dive
- Published: 2026-03-09

### [How Codebuff Manages Tool Permissions Using toolNames: A Complete Technical Guide](/CodebuffAI/codebuff/how-tool-permissions-are-defined-with-toolnames)

Discover how Codebuff manages tool permissions using toolNames. Learn about its two-layer system that blocks unauthorized tool calls for enhanced security and control.

- Tags: how-to-guide
- Published: 2026-03-09

### [How to Use inheritParentSystemPrompt in Codebuff: System Prompt Inheritance and Caching](/CodebuffAI/codebuff/how-to-override-system-prompts-with-inheritparentsystemprompt)

Learn how to override system prompts with inheritParentSystemPrompt in Codebuff. Reuse parent prompts for caching efficient token use and consistent agent behavior. Discover prompt inheritance basics.

- Tags: how-to-guide
- Published: 2026-03-09

### [How the Codebuff Multi-Prompt Editor Generates Better Code Through Parallel Strategy Exploration](/CodebuffAI/codebuff/how-multi-prompt-editor-generates-better-code)

Discover how Codebuff's multi-prompt editor enhances code generation. It explores parallel strategies, objectively ranks diffs, and applies the best solution for superior results.

- Tags: deep-dive
- Published: 2026-03-09

### [How to Configure Reasoning Options for Different Models in Codebuff](/CodebuffAI/codebuff/how-to-configure-reasoning-options-for-models)

Configure reasoning options in Codebuff for different models. Control chain-of-thought data, token budgets, and reasoning depth using the reasoningOptions block.

- Tags: how-to-guide
- Published: 2026-03-09

### [How the Code-Reviewer Agent Validates Code Changes in Codebuff](/CodebuffAI/codebuff/how-code-reviewer-validates-changes)

Learn how the code-reviewer agent validates code changes in Codebuff using client-side hooks and structured results for efficient feedback.

- Tags: deep-dive
- Published: 2026-03-09

### [How the File-Picker Agent in Codebuff Identifies and Selects Relevant Files](/CodebuffAI/codebuff/how-file-picker-agent-finds-relevant-files)

Discover how the Codebuff file-picker agent efficiently identifies and selects relevant files. Learn about its process of file discovery, path parsing, and content reading.

- Tags: internals
- Published: 2026-03-09

### [How to Implement File Editing Using the str_replace Tool in Codebuff](/CodebuffAI/codebuff/how-to-implement-file-editing-with-str_replace)

Learn how to implement file editing using Codebuff's str_replace tool. Apply exact-match string replacements programmatically with JSON or the TypeScript SDK and get unified diffs.

- Tags: how-to-guide
- Published: 2026-03-09

### [Agent Versioning and Publishing in Codebuff: A Complete Technical Guide](/CodebuffAI/codebuff/how-agent-versioning-and-publishing-works)

Automate agent versioning and publishing in Codebuff using the CLI. Discover how the publish command increments versions and uploads definitions to the registry.

- Tags: deep-dive
- Published: 2026-03-09

### [How to Use Structured Output Modes in Codebuff Agents: A Complete Guide](/CodebuffAI/codebuff/how-to-use-structured-output-modes)

Learn to use structured output modes in Codebuff agents with our complete guide. Easily generate JSON-compatible objects by defining output schemas and setting the correct output mode for your agent.

- Tags: how-to-guide
- Published: 2026-03-08

### [How to Add Custom MCP Servers to Agents in Codebuff: A Complete Guide](/CodebuffAI/codebuff/how-to-add-custom-mcp-servers-to-agents)

Easily add custom MCP servers to your Codebuff agents. Learn how to configure mcp.json files or AgentDefinitions for seamless integration and enhanced agent capabilities.

- Tags: how-to-guide
- Published: 2026-03-08

### [How the Codebuff Context-Pruner Mechanism Manages Token Limits](/CodebuffAI/codebuff/how-context-pruner-manages-token-limits)

Discover how the Codebuff context-pruner manages token limits with its two-phase compression approach, keeping crucial context within your budget.

- Tags: internals
- Published: 2026-03-08

### [How Agent State and Message History Management Works in Codebuff](/CodebuffAI/codebuff/how-agent-state-and-message-history-work)

Understand how Codebuff manages agent state and message history with its immutable AgentState object and serializable messageHistory array for seamless conversation tracking.

- Tags: internals
- Published: 2026-03-08

### [Codebuff SDK Production Best Practices: Secure Integration and Observability Guide](/CodebuffAI/codebuff/how-to-use-the-codebuff-sdk-in-production)

Discover Codebuff SDK production best practices for secure integration. Learn environment variable API key management, file filtering, step limits, and event handling for optimal observability and safety.

- Tags: best-practices
- Published: 2026-03-08

### [How to Spawn Subagents Using the spawn_agents Tool in Codebuff](/CodebuffAI/codebuff/how-to-spawn-subagents-with-spawn_agents-tool)

Learn to spawn subagents in Codebuff using the spawn_agents tool. Effortlessly launch child agents in parallel with built-in permission checks, schema validation, and cost tracking.

- Tags: how-to-guide
- Published: 2026-03-08

### [handleSteps Generator Function in Codebuff: A Complete Guide to Programmatic Agent Control](/CodebuffAI/codebuff/how-to-use-the-handlesteps-generator-function)

Master the handleSteps generator function in Codebuff for programmatic agent control. Script tool calls, commands, and directives for precise LLM execution.

- Tags: deep-dive
- Published: 2026-03-08

### [How to Configure OpenRouter Models and Provider Routing in Codebuff](/CodebuffAI/codebuff/how-to-configure-openrouter-models-and-provider-routing)

Learn to configure OpenRouter models and provider routing in Codebuff. Centralize AI model management, enable automatic routing, and control fallbacks with Codebuff's SDK.

- Tags: how-to-guide
- Published: 2026-03-08

### [How to Create Custom Agents Using AgentDefinition in Codebuff: A Complete Guide](/CodebuffAI/codebuff/how-to-create-custom-agents-with-agentdefinition)

Learn to create custom agents in Codebuff using AgentDefinition. Export, load, and run your own agents with this complete guide.

- Tags: how-to-guide
- Published: 2026-03-08

