|
| 1 | +# elizacp |
| 2 | + |
| 3 | +A classic Eliza chatbot implemented as an ACP (Agent-Client Protocol) agent. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Elizacp provides a simple, predictable agent implementation that's useful for: |
| 8 | + |
| 9 | +- **Testing ACP clients** - Lightweight agent with deterministic pattern-based responses |
| 10 | +- **Protocol development** - Verify ACP implementations without heavy AI infrastructure |
| 11 | +- **Learning ACP** - Clean example of implementing the Agent-Client Protocol |
| 12 | + |
| 13 | +## Features |
| 14 | + |
| 15 | +- **Classic Eliza patterns** - Pattern matching and reflection-based responses |
| 16 | +- **Full ACP support** - Session management, initialization, and prompt handling |
| 17 | +- **Per-session state** - Each session maintains its own Eliza instance |
| 18 | +- **Extensible patterns** - Easy to add new response patterns (including future tool use triggers) |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +### Running the agent |
| 23 | + |
| 24 | +```bash |
| 25 | +# Build and run |
| 26 | +cargo run -p elizacp |
| 27 | + |
| 28 | +# With debug logging |
| 29 | +cargo run -p elizacp -- --debug |
| 30 | +``` |
| 31 | + |
| 32 | +The agent communicates over stdin/stdout using JSON-RPC, following the ACP specification. |
| 33 | + |
| 34 | +### Testing with an ACP client |
| 35 | + |
| 36 | +Elizacp responds to: |
| 37 | + |
| 38 | +1. **Initialize requests** - Returns capabilities |
| 39 | +2. **New/Load session requests** - Creates session state |
| 40 | +3. **Prompt requests** - Responds with Eliza-style conversational replies |
| 41 | + |
| 42 | +Example conversation: |
| 43 | +``` |
| 44 | +User: Hello |
| 45 | +Eliza: Hello. How are you feeling today? |
| 46 | +
|
| 47 | +User: I am sad |
| 48 | +Eliza: Do you often feel sad? |
| 49 | +
|
| 50 | +User: I feel worried about my father |
| 51 | +Eliza: Tell me more about your family. |
| 52 | +``` |
| 53 | + |
| 54 | +## Implementation |
| 55 | + |
| 56 | +- `eliza.rs` - Pattern matching engine with classic Eliza responses |
| 57 | +- `main.rs` - ACP agent implementation over stdio |
| 58 | + |
| 59 | +## Architecture |
| 60 | + |
| 61 | +The agent maintains a `HashMap<SessionId, Eliza>` to track per-session state. Each session gets its own Eliza instance with independent conversation state. |
| 62 | + |
| 63 | +## Future Extensions |
| 64 | + |
| 65 | +The pattern database structure is designed to support: |
| 66 | +- Tool use triggers (e.g., "what's the weather" → tool call) |
| 67 | +- Custom response patterns |
| 68 | +- Conversation history tracking |
| 69 | +- Multi-turn context awareness |
0 commit comments