Initial commit: Ajarbot with optimizations

Features:
- Multi-platform bot (Slack, Telegram)
- Memory system with SQLite FTS
- Tool use capabilities (file ops, commands)
- Scheduled tasks system
- Dynamic model switching (/sonnet, /haiku)
- Prompt caching for cost optimization

Optimizations:
- Default to Haiku 4.5 (12x cheaper)
- Reduced context: 3 messages, 2 memory results
- Optimized SOUL.md (48% smaller)
- Automatic caching when using Sonnet (90% savings)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 19:06:28 -07:00
commit a99799bf3d
58 changed files with 11434 additions and 0 deletions

71
docs/QUICKSTART.md Normal file
View File

@@ -0,0 +1,71 @@
# Quick Start
## Setup (30 seconds)
```bash
pip install anthropic requests watchdog
export ANTHROPIC_API_KEY="sk-ant-..." # Your Claude API key
export GLM_API_KEY="..." # Optional: z.ai GLM key
```
## Usage
### Basic Agent
```python
from agent import Agent
# Initialize with Claude
agent = Agent(provider="claude")
# Chat (auto-loads SOUL + user context + relevant memory)
response = agent.chat("What should I work on?", username="alice")
# Switch to GLM
agent.switch_model("glm")
response = agent.chat("Explain SQLite FTS5")
```
### Memory Operations
```python
# Update personality
agent.memory.update_soul("## New trait\n- Be concise", append=True)
# User preferences
agent.memory.update_user("alice", "## Preference\n- Likes Python")
# Write memory
agent.memory.write_memory("Completed task X", daily=True)
# Search
results = agent.memory.search("python")
```
### Task Tracking
```python
# Add task
task_id = agent.memory.add_task(
"Implement API endpoint",
"Details: REST API for user auth"
)
# Update
agent.memory.update_task(task_id, status="in_progress")
# Get tasks
pending = agent.memory.get_tasks(status="pending")
all_tasks = agent.memory.get_tasks()
```
## Files Created
- `llm_interface.py` - Claude/GLM integration
- `agent.py` - Main agent class
- `memory_workspace/MEMORY.md` - Instructions for future sessions
- Task system added to memory_system.py
## Context Retrieval
Agent automatically loads:
1. SOUL.md (personality)
2. users/{username}.md (user prefs)
3. Search results (top 3 relevant chunks)
4. Recent conversation (last 5 messages)
All indexed in SQLite for fast retrieval.