The lightweight AI coding agent SDK extracted from Claude Code.
Built by extracting Claude Code's production architecture. All the power, none of the bloat. Open source, fully customizable, production-ready.
💡 Based on Claude Code — The same battle-tested engine that powers Anthropic's official coding assistant, now available as a standalone SDK.
- 5,500 lines of pure, focused code
- Claude Code: 150,000+ lines (IDE integration, UI, etc.)
- Same agent engine, zero overhead
npm install codenanoBuild your own Claude Code in 60 seconds. No IDE required. No restrictions.
Extracted from Claude Code's production engine. Proven at scale, optimized for developers.
Get your first agent running in 3 lines:
import { createAgent, coreTools } from 'codenano'
const agent = createAgent({
model: 'claude-sonnet-4-6',
tools: coreTools(), // Read, Edit, Write, Glob, Grep, Bash
})
const result = await agent.ask('Read package.json and summarize it')
console.log(result.text)That's it. No complex setup. No configuration hell. Just pure productivity.
for await (const event of agent.stream('What files are here?')) {
if (event.type === 'text') process.stdout.write(event.text)
}const session = agent.session()
await session.send('Read main.ts')
await session.send('Now explain what it does')import { defineTool } from 'codenano'
import { z } from 'zod'
const readFile = defineTool({
name: 'ReadFile',
description: 'Read a file from disk',
input: z.object({ path: z.string() }),
execute: async ({ path }) => fs.readFileSync(path, 'utf-8'),
isReadOnly: true,
})
const agent = createAgent({
model: 'claude-sonnet-4-6',
tools: [readFile],
})Same engine. Different philosophy.
| Feature | codenano | Claude Code |
|---|---|---|
| Based On | Claude Code core | Official Anthropic product |
| Lines of Code | 5,500 (core only) | 150,000+ (full app) |
| What's Included | Agent engine | Engine + IDE + UI |
| Setup Time | < 1 minute | Install IDE extension |
| Use Case | Build custom agents | Use as-is in IDE |
| Customizable | ✅ Fully open | |
| Standalone | ✅ Yes | ❌ Requires IDE |
| Production Ready | ✅ Yes | ✅ Yes |
| Open Source | ✅ MIT License | ❌ Proprietary |
Think of it this way:
- Claude Code = Complete car (engine + body + interior)
- codenano = Just the engine (build your own car)
When to use codenano:
- Building custom AI coding tools
- Integrating agents into your product
- Need full control over behavior
- Want to understand how it works
When to use Claude Code:
- Just want to code with AI assistance
- Prefer official Anthropic support
- Happy with IDE integration
Ready to use, zero configuration:
- File Operations: Read, Edit, Write
- Code Search: Glob (pattern matching), Grep (regex search)
- Execution: Bash commands
- Advanced: Web search, web fetch, notebooks, LSP, and more
coreTools() // Essential 6 tools
extendedTools() // Core + 5 more
allTools() // All 17 tools- ✅ Auto-compact (handles context overflow)
- ✅ Retry & fallback (resilient API calls)
- ✅ Token budgeting (cost control)
- ✅ Permission system (security)
- ✅ Hook system (lifecycle events)
- ✅ Streaming support (real-time output)
Clean, modular architecture:
codenano/
src/
agent.ts # Core agent loop
session.ts # Multi-turn conversations
tools/ # 17 built-in tools
prompt/ # System prompt builder
provider.ts # Anthropic SDK + Bedrock
compact.ts # Auto-compact logic
tests/ # 191 tests
examples/ # Ready-to-run demos
docs/ # Comprehensive guides
191 tests. 100% production-ready.
| Doc | What You'll Learn |
|---|---|
| Architecture | Agent loop, interaction modes, stream events |
| Tools | Built-in tools, custom tools, permissions |
| Configuration | Full config reference, CLAUDE.md support |
| Reliability | Auto-compact, retry, fallback, budgeting |
| Prompt System | System prompt architecture |
| Gap Analysis | SDK vs Claude Code comparison |
# Unit tests (191 tests)
npm test
# With coverage
npx vitest run --coverage
# Integration tests (requires API key)
ANTHROPIC_API_KEY=sk-xxx npm run test:integrationComing Soon:
- Hook system (16 event types)
- Sub-agent spawning
- Memory system (cross-session persistence)
- MCP protocol support
- Session persistence
- Git integration
- Cost tracking
Ship your AI coding product faster. Stop wrestling with bloated frameworks. Get to market in days, not months.
Production-ready from day one. Battle-tested architecture, comprehensive testing, full control over your stack.
Actually enjoyable to use. Clean APIs, great docs, zero magic. Build what you want, how you want.
MIT License.
npm install codenanoQuestions? Check the docs or open an issue.
Ready to build? See examples/ for inspiration.