My TypeScript implementation of an AI agent powered by Claude, inspired by Thorsten Ball's Amp blog post.
- File Operations: Read, list, edit, and create files in your working directory
- Interactive Chat: Natural language interface with Claude (Aura)
- Tool System: Extensible architecture for adding new capabilities
- Type Safety: Full TypeScript support with runtime validation
- Bun (JavaScript runtime & package manager)
- Anthropic API key
bun install
Set your Anthropic API key as an environment variable:
export ANTHROPIC_API_KEY="your-api-key-here"
bun run dev
bun start
bun run build
The agent comes with four core tools:
Read the contents of any file in the working directory.
List files and directories at a given path.
Make edits to text files by replacing specific text strings.
Create new files with specified content.
You: what files are in this directory?
tool: list_directory({"dir_path":"."})
Aura: I can see several files in the current directory:
- README.md
- package.json
- tsconfig.json
- agent.ts - Main agent implementation
- toolRegistry.ts - Tool definitions
- fileUtils.ts - File operation utilities
You: create a hello.js file that prints hello world
tool: create_file({"file_path":"hello.js","content":"console.log('Hello, World!');"})
Aura: I've created a hello.js file that prints "Hello, World!" when run with Node.js.
You:
- agent.ts - Main agent implementation with conversation loop
- toolRegistry.ts - Tool definitions and registry
- fileUtils.ts - File system utility functions
- Add your tool definition to
toolRegistry.ts
:
{
name: "my_tool",
description: "Description of what the tool does",
args: z.object({
param: z.string(),
}),
execute: myToolFunction,
}
- Implement the tool function in
fileUtils.ts
or create a new utility file