A clean, simple AI assistant built with TypeScript that supports conversation memory and tool calling.
- 🧠 Conversation Memory - Remembers your chat history across sessions
- 🛠️ Tool Calling - Can perform calculations, get time, generate UUIDs
- 🎨 Multiple Assistant Types - General, Coding, or Creative focused
- 🔒 Secure System Prompts - Built-in protection against prompt injection
- 💬 Beautiful CLI - Powered by @clack/prompts
-
Set up your OpenAI API key:
Create a
.env
file in the root directory and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here
-
Install and run:
npm install npm start
src/
├── agent.ts # Core agent logic (simple functions)
├── llm.ts # OpenAI integration (async/await)
├── memory.ts # Conversation persistence
├── systemPrompt.ts # Security & personality
├── tools.ts # Built-in tools (time, math, uuid)
└── ai.ts # OpenAI client
types.ts # Basic type definitions
index.ts # CLI interface
get_current_time
- Get current time in any timezonecalculate
- Perform mathematical calculationsgenerate_uuid
- Generate random UUIDs
🤖 AI Assistant - Chat Mode
What type of assistant would you like?
❯ 🤖 General Assistant
What would you like to talk about?
❯ What time is it in Tokyo?
🧠 AI is thinking...
💬 AI Response:
🔧 Using tools...
✅ get_current_time: Current time in Asia/Tokyo: Wednesday, August 11, 2025 at 6:30:45 PM Japan Standard Time
💬 AI Follow-up:
The current time in Tokyo is Wednesday, August 11, 2025 at 6:30:45 PM Japan Standard Time.
Simply add your tool to the tools
array in src/tools.ts
:
{
type: 'function' as const,
function: {
name: 'your_tool',
description: 'What your tool does',
parameters: {
type: 'object',
properties: {
// Your parameters here
},
},
},
}
Then add the execution logic in the executeToolCall
function.