72 lines
1.6 KiB
Markdown
72 lines
1.6 KiB
Markdown
|
|
# 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.
|