Overview
TheAgent class is the main entry point for building ClarkOS agents. It wraps the tick system, plugin management, and backend access.
Reference: src/core/agent.ts
Creating an Agent
Constructor Options
| Option | Type | Description |
|---|---|---|
backend | Backend | Required. Convex or in-memory backend |
config | AgentConfig | Optional. Override defaults |
plugins | Plugin[] | Optional. Plugins to register |
Configuration
| Option | Default | Description |
|---|---|---|
name | ”Agent” | Agent identifier |
tick.interval | 60000 | Milliseconds between ticks |
tick.auto | false | Start ticking automatically |
tick.maxRetries | 3 | Retry attempts on failure |
memory.maxShortTerm | 50 | Short-term memory limit |
verbose | false | Enable debug logging |
src/core/config.ts
Lifecycle Methods
Plugin Methods
Memory Access
src/memory/store.ts
Knowledge Access
Types
AgentState
| Field | Type | Description |
|---|---|---|
mood | Mood | neutral, expressive, curious, excited, reflective, concerned |
health | number | 0-100 |
routine | Routine | morning, day, evening, overnight |
volatility | number | 0-1 |
counters | object | |
lastTick | string | ISO timestamp |
cryo | boolean | Hibernation mode |
MemoryType
episodic | semantic | emotional | procedural | reflection
MemoryScope
short_term | working | long_term