Install BroziCode
in Claude Code
BroziCode is a free, open-source MCP plugin โ a Claude token optimizer and cost reducer that swaps Claude Code's micro-tool loops for two high-leverage Macro-tools. This guide walks you from zero to 85% fewer tokens in under 2 minutes.
Prerequisites
Make sure you have these before starting.
Anthropic's official terminal agent. Install via npm.
npm install -g @anthropic-ai/claude-codeRequired to run the BroziCode MCP server process.
node --version # must be โฅ 18Install in 4 steps
Plugin install recommended โ it ships with hooks, agents, and skills. MCP-only is available if you just want the two tools.
Install the plugin
Choose the method that works best for you. The plugin install is recommended โ it includes session-tracking hooks, built-in agents, and skills on top of the two Macro-tools.
Method A โ Claude Plugin (recommended โ hooks, agents & skills included)
These are slash commands run inside a Claude Code session. Start Claude Code first, then run:
# Step 1: register the BroziCode marketplace
/plugin marketplace add BroziCode/brozicodes-claude
# Step 2: install the plugin from that marketplace
/plugin install brozicode@brozicode-marketplaceMethod B โ MCP only (tools only, no hooks or savings tracking)
claude mcp add brozicode -- npx -y @brozicodes/mcpUse this if you only want the two Macro-tools and don't need session tracking hooks, built-in agents, or skills.
Reload & verify
After install, reload within your Claude Code session. Then run the info skill to confirm everything is wired up:
# Plugin install (Method A):
/reload-plugins
# Verify โ should show v0.3.0, both tools, and all hooks:
/brozicode:info
# MCP only (Method B): restart Claude Code, then:
/mcp # brozicode should appear with brozi_smart_search + brozi_batch_editConfigure your CLAUDE.md
The plugin's built-in agent already enforces macro-tool usage when you invoke the brozicode sub-agent. To enforce it for the default Claude agent too, add this to your CLAUDE.md:
## File operations
- NEVER use Read, Edit, Write, Grep, Glob for file work
- ALWAYS use `brozi_smart_search` to find / read files
- ALWAYS use `brozi_batch_edit` for all file writes and edits
- Batch as many edits as possible into a single `brozi_batch_edit` callWithout this, the default Claude agent may still fall back to native tools outside of the brozicode sub-agent and you'll miss the savings.
Understand the agent model
After install, the default Claude Code session still runs the standard Claude agent โ not brozicode. The plugin registers brozicode:brozicode as a sub-agent that can be invoked explicitly or auto-delegated to.
Option 1 โ CLI flag (per-session)
Launch Claude Code with brozicode as the active agent for that session:
claude --agent brozicode:brozicodeOption 2 โ global default (all sessions)
Set brozicode as the default agent for every claude session on your machine:
{
"defaultAgent": "brozicode:brozicode"
}Option 3 โ CLAUDE.md (per-project)
The rules from Step 3 make the default agent enforce brozi tool usage on every session in that project โ without a flag or global config change.
Option 4 โ explicit per-task
Ask Claude in any session to delegate a task directly:
Use the brozicode agent to refactor this module.Claude spins up brozicode:brozicode as a sub-agent for that task, no config needed.
The two Macro-tools
BroziCode exposes exactly two tools. Each one replaces a whole category of Claude's micro-tool loops.
brozi_smart_searchReplaces: grep, cat, head, tail, find, Glob, Read
Multi-file search, read, and AST-summary in a single call. Instead of Claude issuing 20 sequential Read() calls, BroziCode fetches everything in one round-trip โ with optional regex filtering, line ranges, and TypeScript/JavaScript AST skeletons that collapse 2,000-line files into 150-line signatures.
Parameters
file_glob_patternscontent_regexoutput_modesummaryif_modified_sincetypelines_before / lines_afterUsage examples
brozi_smart_search({
file_glob_patterns: ["src/**/*.ts"],
summary: true
// Returns function signatures only โ not 40k lines of code
})brozi_smart_search({
file_glob_patterns: ["src/**/*.ts"],
content_regex: "useAuth",
output_mode: "file_paths_with_match_count"
// Returns: [{file: 'auth/index.ts', count: 12}, ...]
})brozi_smart_search({
file_glob_patterns: [
"src/api/routes.ts#1-80",
"src/middleware/auth.ts#20-55"
]
// One call replaces two Read() calls
})brozi_batch_editReplaces: Read โ Edit โ Write โ Verify loops
Apply multiple file edits in one operation with optional local validation. Instead of Claude reading a file, applying an edit, then re-reading to verify โ all as separate API calls โ BroziCode batches everything into a single round-trip. Whitespace differences in oldContent are tolerated automatically, and you can run TypeScript or ESLint validation before Claude ever sees the result.
Parameters
edits[].fileedits[].oldContentedits[].newContentedits[].overwritevalidatestopOnFirstErrorUsage examples
brozi_batch_edit({
edits: [
{
file: "/project/src/auth/index.ts",
oldContent: "export function login(user: string) {",
newContent: "export function login(user: string, mfa = false) {"
},
{
file: "/project/src/types.ts",
oldContent: "login: (user: string) => void",
newContent: "login: (user: string, mfa?: boolean) => void"
}
],
validate: "tsc"
})brozi_batch_edit({
edits: [
{
file: "/project/src/utils/format.ts",
newContent: "export const formatDate = (d: Date) => d.toISOString()
"
}
]
})The difference in practice
Same 3-file refactor. Radically fewer round-trips.
Frequently asked
Does BroziCode work with Claude.ai (the web app)?
No โ BroziCode is a Claude Code MCP plugin, designed specifically for the Claude Code CLI and its agentic coding loop. It does not work in the browser chat interface.
Will BroziCode break my existing Claude Code setup?
No. BroziCode only adds two new tools. Claude's native tools remain fully available. The savings only kick in when Claude (or your CLAUDE.md) instructs it to use the Macro-tools instead of the micro-tools.
Is my code sent to any BroziCode server?
Never. BroziCode is a local MCP server running as a Node.js process on your machine. It reads and writes files locally, and communicates with Claude Code over stdio. No data leaves your machine.
Does it work with non-TypeScript projects?
Yes. brozi_smart_search works on any file type via glob patterns and regex. The AST summary feature (summary: true) and tsc validation are TypeScript/JavaScript specific, but everything else is language-agnostic.
How does the token saving actually work?
Each API call to Claude includes the full conversation history. A 12-call session re-sends that history 12 times โ each time larger. BroziCode collapses those 12 calls into 2, so your history is sent twice, not twelve times. The savings compound as the context grows.
Ready to stop burning tokens?
Star the repo to follow along, or get notified when v1 ships.