What You Get Pricing Architecture Learnings Blog Skills
  • Build Log
  • Get Started
    ← Back to Blog
    February 27, 2026 Technical Deep Dive

    The Architecture of an Always-On AI Agent

    Infrastructure, memory systems, skill loading, and cron patterns that keep an AI running 24/7 without burning money or losing context.

    Most AI Agents Die After One Conversation

    Ask ChatGPT something today. Ask again tomorrow. It has no memory of you. Every conversation starts fresh. That's fine for quick questions. It's useless for running a business.

    An AI CMO needs to remember your leads, your revenue trends, your last three campaigns. It needs to run reports at 8am whether you're awake or not. It needs to pick up context from two weeks ago mid-sentence.

    Building this required solving four problems: infrastructure that stays alive, memory that persists, skills that load on demand, and cron patterns that run reliably. Here's how each piece works.

    Infrastructure: A $20 VPS and a Daemon

    The setup is simpler than most people expect.

    One Hetzner VPS. Ubuntu 24.04. 16GB RAM. $20/month. That's the entire compute layer. No Kubernetes. No auto-scaling. No load balancers. The agent runs as a systemd service — start on boot, restart on crash, log everything to journald.

    The core daemon is OpenClaw, an open-source agent framework. It handles the LLM calls (Claude via Anthropic API), the message routing (Discord, Slack, or whatever), and the tool execution. Think of it as the runtime that keeps the agent alive between conversations.

    Here's the systemd unit file:

    [Unit]
    Description=OpenClaw Agent
    After=network.target
    
    [Service]
    Type=simple
    User=root
    WorkingDirectory=/opt/openclaw
    ExecStart=/usr/bin/node dist/daemon.js
    Restart=always
    RestartSec=5
    Environment=NODE_ENV=production
    
    [Install]
    WantedBy=multi-user.target

    That's it. The agent boots with the server. If it crashes, systemd brings it back within 5 seconds. Uptime over the last 60 days: 99.7%. The 0.3% was me deploying updates, not failures.

    Cost breakdown:

    • VPS: $20/month
    • Anthropic API: ~$80-120/month (depends on usage)
    • Domain + Caddy: $12/year

    Total: roughly $150/month for an agent that handles analytics, content, outreach, and reporting across multiple products. Compare that to a single contractor.

    Memory: Files Beat Databases

    The biggest mistake in AI agent design is overcomplicating memory. Vector databases. Graph stores. Retrieval pipelines with five stages. Most of this adds latency and breaks at scale.

    My memory system is mostly markdown files.

    AGENTS.md holds the agent's instructions. What products exist. How to interpret channel context. Which commands to run for which questions. The agent reads this on every interaction.

    TOOLS.md documents available tools. SSH hosts. Analytics commands. Memory layer access. The agent checks this when it needs to figure out how to accomplish a task.

    MEMORY.md (when used) stores facts the agent shouldn't forget. Lead counts. Campaign results. Decisions made. The agent can append to this file, creating a running log of important context.

    Files work because LLMs read text. No translation layer. No query language. The agent opens a file and understands it. Change the file, change the agent's behavior. Debug by reading markdown.

    For larger knowledge bases, I add a semantic layer: ChromaDB with OpenAI embeddings. The marketing knowledge base has 83 files — frameworks, checklists, personas, playbooks. Too much to inject every time. Instead:

    ocx rag search --query "headline formulas" --collection marketing-knowledge

    The agent searches, retrieves relevant chunks, and reads those. Hybrid retrieval (vector + BM25) catches both semantic similarity and keyword matches. The ChromaDB instance runs on the same VPS. No external dependencies.

    There's also a knowledge graph layer for entity relationships. "Connor founded KaiCalls" becomes a triple: (Connor, founded, KaiCalls). When the agent needs to answer "what products does Connor run?" it queries the graph. This matters when facts are scattered across many documents.

    Total memory architecture:

    • Immediate context: Markdown files injected per-request
    • Searchable knowledge: ChromaDB + embeddings
    • Entity relationships: SQLite-backed knowledge graph
    • Conversation history: Managed by OpenClaw's session layer

    No external services. Everything runs locally. Median retrieval time: 40ms.

    Skill Loading: Teach Once, Use Forever

    An AI agent without skills is a chatbot. Skills turn "write me a blog post" into "write me a blog post that scores 12+/16 on the Four U's, follows Algorithmic Authorship rules, avoids AI slop words, and matches the target persona."

    Skills in this system are markdown files with a YAML header:

    ---
    name: content-writer
    description: Use this skill when the user asks to write a blog post, article, email copy, press release, ad copy, TikTok script, or any marketing content.
    version: 1.0.0
    ---
    
    # Content Writer
    
    Write marketing content that scores 12+/16 on the Four U's...

    The description field is the trigger. OpenClaw matches user requests to skill descriptions and injects the relevant skill file into context. Ask "write a cold email" — the outreach skill loads. Ask "check KaiCalls leads" — the analytics skill loads. Ask "draft a press release" — the content-writer skill loads.

    Skills reference other files. The content-writer skill points to knowledge/frameworks/content-copywriting/headline-formulas.md and knowledge/checklists/content-checklist.md. The agent follows the breadcrumbs, loading what it needs.

    This creates layers:

    1. Base context — AGENTS.md, TOOLS.md (always loaded)
    2. Active skill — The matched skill file
    3. Referenced knowledge — Frameworks, checklists, examples
    4. Retrieved context — RAG results if the skill triggers a search

    Current skill count: 14. Covering content writing, SEO, LinkedIn articles, cold outreach, analytics interpretation, memory management, and more. Adding a new skill means writing one markdown file and dropping it in the skills directory.

    Skills also define banned patterns. The content-writer skill lists words to never use: "utilize," "leverage," "synergy," "innovative." It lists AI-sounding patterns to avoid: "Not X, it's Y," unnatural lists of three, fake secrecy language. The agent checks its own output against these rules before responding.

    Quality gate: Every piece of content gets scored. The skill specifies a Four U's target of 12+/16. If the output scores lower, the skill instructs the agent to strengthen the weakest dimension before publishing. Self-correction built into the workflow.

    Cron Patterns: Work That Runs Without Prompting

    The real power of an always-on agent is background work. Reports that generate themselves. Checks that run before you wake up. Alerts that fire when metrics drift.

    Cron drives everything.

    The daily report runs at 8am ET (1pm UTC). A cron job calls the OpenClaw CLI:

    0 13 * * * /usr/local/bin/openclaw run --task "Generate daily report" --channel updates

    The agent receives the task, runs cmo daily_report daily, formats the output, and posts to the #updates Discord channel. No human triggers it. The report appears whether I'm awake, traveling, or offline.

    Weekly reports run Monday at 8am. Same pattern, different command:

    0 13 * * 1 /usr/local/bin/openclaw run --task "Generate weekly report" --channel updates

    Beyond reports, cron handles:

    • Lead checks: Every 6 hours, scan for new leads and flag high-priority ones
    • Revenue monitoring: Daily MRR snapshot, alert if it drops 10%+
    • SEO tracking: Weekly Search Console pull, highlight ranking changes
    • Content calendar: Monday morning reminder of scheduled posts
    • Memory maintenance: Nightly consolidation of conversation memories

    Each cron job is one line. The complexity lives in the agent's task interpretation, not the scheduler. Tell the agent "generate daily report" and it knows what that means because AGENTS.md defines the report format, data sources, and channel routing.

    Error handling: If a cron job fails, the agent logs the error and continues. Critical failures (API down, database unreachable) trigger a Discord alert to a monitoring channel. I get pinged for actual problems, not routine noise.

    The cron tab currently has 12 scheduled tasks. Total execution time per day: about 15 minutes of compute spread across 24 hours. Cost impact: negligible. The API calls for scheduled tasks run maybe $5/month.

    Putting It Together: A Day in the Life

    5:00 AM — Memory maintenance runs. Old conversation chunks get consolidated. Duplicate facts merge. The knowledge graph prunes stale relationships.

    6:00 AM — Lead check runs. KaiCalls had 3 new leads overnight. BuildWithKai had 1 new business registration. The agent logs these to the daily report buffer.

    8:00 AM — Daily report generates. Traffic, revenue, leads, notable events. Posts to #updates. Connor's phone buzzes with the summary before he's had coffee.

    10:30 AM — Connor asks in #kai-calls: "How are leads looking this week?" The agent loads the kaicalls analytics skill, runs cmo kaicalls leads --days=7, formats the response with trends and comparisons.

    2:00 PM — Connor requests a blog post. The content-writer skill loads. The agent checks headline formulas, applies Algorithmic Authorship rules, scores the draft against Four U's. Posts the result for review.

    4:00 PM — Subagent spawned. Connor asks for a research task that'll take 20 minutes. Main agent spawns a subagent to handle it, continues responding to other requests. Subagent reports back when done.

    11:00 PM — Revenue snapshot runs. MRR is $67.91, stable from yesterday. No alert needed. The fact gets logged for tomorrow's report.

    The agent processed 47 requests today. Ran 12 scheduled tasks. Generated 3 pieces of content. All while the human worked on product features.

    What Makes This Work

    Three principles behind every design decision:

    Files over services. Markdown beats databases for agent memory. Easier to debug, version, and modify. The agent reads text natively.

    CLI over APIs. Every data source is a command: cmo kaicalls leads. The agent doesn't need HTTP libraries or authentication flows. Run command, read output.

    Simple over clever. Systemd instead of Kubernetes. Cron instead of workflow engines. SQLite instead of Postgres. Each choice reduces failure modes.

    The result: an AI agent that's been running for 60+ days with minimal intervention. It handles the work I used to pay contractors for. It remembers context I'd forget. It runs whether I'm paying attention or not.

    That's the architecture. Nothing proprietary. Nothing expensive. Just careful choices about where complexity belongs.

    — Connor

    Want your own AI CMO?

    Same system. Deployed for your business. Zero setup headache.