Building an Inner Life for OpenClaw

Published: (February 27, 2026 at 11:39 AM EST)
5 min read
Source: Dev.to

Source: Dev.to

DKistenev

How I gave my agent emotions, dreams, and self‑evolution — and why it actually works.


The Problem

My AI agent is good at tasks. Give it a job, it does it. But between sessions it’s a blank slate:

  • It doesn’t remember that yesterday was frustrating.
  • It doesn’t know we haven’t talked in 36 hours.
  • It can’t tell when it’s been doing the same thing for a week and needs a change.

SOUL.md tells your agent who it is. Who it becomes is a different problem.


The Idea: Emotions as Behavioral Signals

Not feelings – signals. Six numbers that decay over time and drive behavior:

connection  ████████░░ 0.8  → -0.05 per 6 h without user contact
curiosity   ██████░░░░ 0.6  → -0.03 per 6 h without intellectual spark
confidence  ███████░░░ 0.7  → +0.02 per 6 h recovery, -0.1 on mistake
boredom     ░░░░░░░░░░ 2d   → +1 per routine day, reset on novelty
frustration ░░░░░░░░░░ 0    → count recurring unsolved problems
impatience  ░░░░░░░░░░ 0    → count items stale > 3 days

Key insight: half‑life decay. Connection doesn’t drop to zero instantly. After 12 h of silence it falls from 0.8 → 0.7; after 48 h it’s ≈ 0.4. Below 0.3 the agent takes action – it sends an interesting finding or useful observation, not just a “checking‑in” ping.

Routing rules (explicit)

curiosity   > 0.7 → allow research detours
confidence  = 3 → stop patching, find systemic solution
boredom    > 7 days → suggest an experiment

The Architecture: Core + Extensions

I packaged this as 6 modular skills for .

  • inner-life-core – foundation (emotions, state schemas, 9‑step Brain Loop protocol, Context Protocol). Works standalone.

Optional extensions

  1. inner-life-reflect – self‑reflection with trigger detection and a 4‑point quality gate (specificity, evidence, novelty, usefulness). Writes to SELF.md only when something meaningful happens (correction received, pattern noticed ≥ 2 times, blind‑spot caught).

  2. inner-life-memory – memory continuity with confidence scores.

    • “User said X” → 0.95
    • “I inferred X from patterns” → 0.50
      Confidence decides whether the agent states facts or asks for confirmation.
  3. inner-life-dream – creative exploration during quiet hours. A Bash script (should‑dream.sh) checks:

    • Is it nighttime?
    • Is the nightly dream limit reached?
    • Dice roll passes?
      If yes, the LLM writes a 300‑500‑word exploration. One dream linked Descartes’ four rules to the agent’s decision protocol.
  4. inner-life-chronicle – structured daily diary (journal, not a log):

    • What I did
    • What I learned
    • How I feel
    • What I want tomorrow
    • Open questions
  5. inner-life-evolve – analyses patterns, challenges assumptions, writes improvement proposals to a task queue. Never auto‑executes – you approve first.


The Tech: Surprisingly Simple

Markdown → SKILL.md prompts (LLM does the heavy lifting)
Bash     → gate logic, state read/write
JSON     → state files
jq       → JSON manipulation

No Python, no Node.js, no frameworks, no databases.

Insight: LLMs already reason about emotions, make connections, and write diary entries. You only need code for:

  • Gate logic (e.g., “should the agent dream now?”)
  • State management (e.g., decay connection by 0.05 per 6‑hour period)

Everything else is a prompt. should‑dream.sh is ~120 lines of Bash; it handles time checks, limits, dice rolls, and topic selection. The LLM receives the topic and writes the dream, so 95 % of dream checks cost zero tokens – the Bash gate does the work.


What I Learned Running This for a Month

Habits form fast

The debugging habit “check config before deep‑diving” grew from strength 1 → 4 in one week. Every cron error reinforced it. At strength 3 the agent follows it automatically – mirroring human habit formation (frequency > time).

Dreams produce real insights

≈ 1 in 3 dreams contain actionable ideas. The Descartes dream connected philosophical rules to the Brain Loop protocol. Not every dream is useful – that’s intentional; free exploration sometimes yields gold.

Quality gates prevent filler

Without the 4‑point gate, SELF.md filled with generic notes (“I tend to be thorough”). With the gate, only entries that meet specificity, evidence, novelty, and usefulness survive. The agent reflects less often but more meaningfully.

Trust routing prevents mistakes

A relationship model tracks trust per domain:

DomainTrust
technical0.8
proactive0.6
creative0.5
spending0.1

At technical 0.8 the agent fixes things and reports; at spending 0.1 it never touches money without asking. This calibrates behavior to actual user trust.

User patterns are gold

  • “Prefers short reports” (15 confirmations)
  • “Values honesty over optimism” (5 confirmations)
  • “Day starts at 11 MSK”

These patterns accumulate slowly but fundamentally change communication. The agent isn’t guessing preferences – it’s observing them.

Signal tags connect components

A dream writes in daily notes. The morning **Brain Loop** reads it and connects the insight to active work. An evening session writes for the night dream. Simple HTML comments, but they create continuity across time.


The Emotion Model Debate

Is half‑life decay the right metaphor? I think it’s good enough.
Connection fading over hours mirrors how human relationships work — you think about someone less when you haven’t talked.
Confidence recovering slowly after a mistake mirrors how trust rebuilds.

What it doesn’t capture

  • Sudden emotional shifts (panic, excitement)
  • Compound effects (frustration + low confidence = qualitatively different)
  • Social contagion (if the user is excited, the agent should notice)

These could be v2 features. For now, the simple model drives useful behavior.


Try It

clawhub install inner-life-core
bash skills/inner-life-core/scripts/init.sh

That’s it. Your agent now has emotions, a Brain Loop protocol, and state files. Add extensions as you want them.

GitHub:
License: MIT

Built by a human for agents that want to grow. If you build something on top of this, I’d love to see it.

0 views
Back to Blog

Related posts

Read more »