How openlair/nano-claude-code works
Nano-Claude-Code is a lightweight Python coding agent. A user submits a coding task through the CLI; the agent builds context and prompts, calls a configured model, dispatches tool requests under permission rules, and returns results through the interactive or stream-json interface. The graph also preserves the documented sub-agent, skill, memory, session, and multi-provider capabilities. Some internal links rely on README descriptions or SOURCE INDEX references; unsampled behavior is not inferred beyond those links.
Main entry points: agent.py Agent loop · tools_impl.py Coding tools · cli.py CLI and REPL · prompts.py Prompt builder
Components 17
CLI and runtime
- CLI and REPL
nano_claude_code/cli.py - Stream events
nano_claude_code/stream_json.py
Agent orchestration
- Agent loop
nano_claude_code/agent.py - Sub-agents
nano_claude_code/agents.py
Context and extensions
- Prompt builder
nano_claude_code/prompts.py - Memory hierarchy
nano_claude_code/memory.py - Skills
nano_claude_code/skills.py - Frontmatter parser
nano_claude_code/frontmatter.py
Tools and safety
- Coding tools
nano_claude_code/tools_impl.py - Permission rules
nano_claude_code/permissions.py
Providers and state
- Configuration
nano_claude_code/config.py - OpenAI-compatible backend
nano_claude_code/openai_compat.py - Session persistence
nano_claude_code/session.py
Other components
- User
- Project workspace
- Anthropic API
- Compatible API endpoint
Connections 25
- User → CLI and REPL: submits task
README.md - CLI and REPL → Agent loop: starts agent
nano_claude_code/cli.py - CLI and REPL → Configuration: loads settings
nano_claude_code/cli.py - CLI and REPL → Session persistence: saves and resumes
nano_claude_code/cli.py - CLI and REPL → Skills: handles skill commands
nano_claude_code/cli.py - Agent loop → Prompt builder: builds prompt
nano_claude_code/agent.py - Prompt builder → Memory hierarchy: loads context
nano_claude_code/prompts.py - Prompt builder → Sub-agents: lists agents
nano_claude_code/prompts.py - Prompt builder → Skills: lists skills
nano_claude_code/prompts.py - Skills → Frontmatter parser: parses metadata
nano_claude_code/skills.py - Sub-agents → Frontmatter parser: parses agent files
nano_claude_code/agents.py - Agent loop → Coding tools: dispatches tool calls
nano_claude_code/agent.py - Agent loop → Permission rules: checks permissions
nano_claude_code/agent.py - Agent loop → Configuration: resolves provider
nano_claude_code/agent.py - Agent loop → Session persistence: persists conversation
nano_claude_code/agent.py - Agent loop → Stream events: emits harness output
nano_claude_code/agent.py - Agent loop → OpenAI-compatible backend: selects compatible backend
nano_claude_code/agent.py - Agent loop → Anthropic API: sends model requests
README.md - OpenAI-compatible backend → Compatible API endpoint: sends chat requests
nano_claude_code/openai_compat.py - Coding tools → Project workspace: reads and edits files
nano_claude_code/tools_impl.py - Coding tools → Project workspace: runs shell commands
nano_claude_code/tools_impl.py - Coding tools → Sub-agents: spawns agents
README.md - Coding tools → Skills: loads skills
README.md - Coding tools → Compatible API endpoint: fetches and searches web
- Stream events → User: returns events
nano_claude_code/stream_json.py