The simplest example of a coding assistant that can read files, write files, and run shell commands to help you with your projects. Give it a prompt and it will use Claude AI to understand your request and perform the necessary actions.
Calling it an "architecture" is a bit much, rather here are the files involved:
src/index.ts- Entry point that processes command-line arguments and starts the agentsrc/loop.ts- Core agent loop that manages conversations with Claude AI and orchestrates tool executionsrc/tools.ts- Tool registry system that manages available tools and their executionsrc/tools/- Individual tool implementations:read-file.ts- File reading capabilitywrite-file.ts- File writing capabilitybash.ts- Shell command execution
The agent uses Anthropic's Claude Sonnet to process user prompts and autonomously decide which tools to use, creating a conversational loop until the task is complete.
bun installbun run src/index.ts "your prompt here"Example:
bun run src/index.ts "Create a simple Express.js server with a hello world route"- Bun runtime
- Anthropic API key (set in
.envfile asANTHROPIC_API_KEY)