polyclaw v5.0.0

State Management

Polyclaw uses a file-based state system with JSON stores. All state files live under POLYCLAW_DATA_DIR (default: ~/.polyclaw/).

State Modules

Session Store

File: sessions/<session_id>.json

Each chat session is persisted as a separate JSON file containing message history, metadata, and timestamps.

FeatureDescription
One file per sessionEasy inspection and backup
Archival policies24h, 7d, 30d, never
Session resumeLast 20 messages loaded as context
MetadataModel used, message count, timestamps

Memory Store

Directory: memory/

The memory system consolidates chat interactions into long-term memories:

  • daily/ – Daily log files summarizing interactions
  • topics/ – Topic-specific notes extracted from conversations

Memory formation is triggered after MEMORY_IDLE_MINUTES (default: 5) of inactivity. The MEMORY_MODEL LLM generates structured summaries from buffered chat turns.

Profile Store

File: profile.json

Tracks the agent’s identity and behavioral state:

FieldDescription
nameAgent display name
emojiVisual identity
locationTimezone context
emotional_stateCurrent mood (affects responses)
preferencesCommunication style preferences
skill_usageUsage counts per skill
interaction_logRecent interaction timestamps
contribution_heatmapActivity by hour/day

MCP Config

File: mcp_servers.json

Stores MCP server definitions. Supports four server types:

TypeDescription
localSpawned as a subprocess
stdioCommunicates via stdin/stdout
httpRemote HTTP endpoint
sseServer-Sent Events endpoint

Proactive State

File: proactive.json

Manages autonomous proactive messaging:

FieldDescription
enabledWhether proactive messaging is active
pendingSingle pending message awaiting delivery
sentLast 100 sent messages
preferencesTiming, frequency, and topic constraints
daily_countMessages sent today

Other State Files

FilePurpose
SOUL.mdAgent personality definition
scheduler.jsonScheduled task definitions
deploy_state.jsonDeployment records
infra_config.jsonInfrastructure configuration
plugin_config.jsonPlugin enabled/disabled state
sandbox_config.jsonSandbox configuration
foundry_iq_config.jsonAzure AI Foundry IQ settings
conversation_references.jsonBot Framework conversation references

Design Principles

  • No database required – everything is flat files for simplicity and portability
  • Human-readable – JSON and Markdown files can be inspected and edited manually
  • Docker-friendly – mount ~/.polyclaw as a volume for persistence
  • Atomic writes – state modules use write-then-rename for crash safety