Skip to main content

Overview

This example shows a minimal ClarkOS agent that ticks autonomously, maintains state, and logs activity. It demonstrates the core patterns without extra complexity.

View Source

See the complete example agent implementation on GitHub

What It Does

  • Ticks every 5 minutes via Convex cron
  • Maintains mood, health, and routine state
  • Logs each tick for historical reference
  • Exposes HTTP endpoints for monitoring

Project Structure

Schema

Define three tables: state (singleton), logs (history), and memories. Reference: See convex/schema.ts in the example agent.

Tick Logic

The tick function:
  1. Loads current state
  2. Calculates routine from time
  3. Calls LLM with context
  4. Commits new state
  5. Logs the result
Reference: See src/core/tick.ts in the example agent. Key functions:
  • getState — Query to fetch current state
  • runTick — Action that orchestrates the tick
  • commit — Mutation to persist results

Scheduled Execution

Use Convex crons for automatic ticking:

HTTP Endpoints

Expose monitoring and control endpoints: Reference: See convex/http.ts in the example agent.

Running

Extending

Add memory storage:
Add plugins:

Next Steps

Trading Agent

Add market data and paper trading.

Your First Agent

Comprehensive walkthrough.