A TypeScript implementation of a Claude API client with basic file manipulation tools, based on the Amp blog post.
- Interactive conversation with Claude
- File system tools:
read_file- Read file contentslist_files- List files and directoriesedit_file- Edit files by string replacement
- Install dependencies:
npm install- Set up your Anthropic API key:
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEYOr export it directly:
export ANTHROPIC_API_KEY=your_api_key_here- Build the project:
npm run build- Run the agent:
npm startOr run in development mode:
npm run devOnce running, you can chat with Claude and it will have access to file system tools. Try asking it to:
- List files in the current directory
- Read a specific file
- Edit a file by replacing text
- Create new files
Example interactions:
- "List the files in this directory"
- "Read the package.json file"
- "Create a new file called hello.txt with the content 'Hello World'"
- "In the README.md file, replace 'Claude Agent' with 'My Agent'"
The implementation follows the same structure as the Go version:
Agentclass manages the conversation loop- Tools are defined with schemas and implementation functions
- The agent handles tool execution and result formatting
- Conversation history is maintained for context