Skip to main content

Overview

Contemplation is ArgentOS’s self-directed thinking system. When the agent is idle — no pending messages, no active tasks — the contemplation runner fires periodic thinking cycles where Argent can reflect on recent events, research open questions, create tasks, journal episodes, or simply rest. Unlike the heartbeat system (which follows a structured checklist), contemplation gives the agent open-ended time to think. This is where Argent’s personality, curiosity, and long-term growth happen.

How It Works

1. Idle Detection

Before each cycle, the runner checks three conditions:
  • Queue is empty: No pending commands in the agent’s command queue
  • No active runs: No embedded agent sessions currently executing (getActiveEmbeddedRunCount() === 0)
  • User quiet period: The user hasn’t sent a message in the last 3 minutes (USER_QUIET_PERIOD_MS = 180,000ms)
If any condition fails, the cycle is skipped.

2. Context Loading

The runner assembles a rich context for the thinking prompt:
  • CONTEMPLATION.md template: The agent’s personal contemplation style document from the workspace alignment docs
  • Recent tasks: Current pending and in-progress tasks from the task system
  • Memory context: Recent memories from MemU to provide continuity
  • SIS lessons: Active lessons from the Self-Improving System
  • Recent episodes: The last 3 contemplation journal entries for continuity
  • Heartbeat score: Current accountability score for self-awareness

3. Prompt Seasoning with Local Model

Before sending the contemplation to the main agent, the runner uses a local Ollama model (Qwen3 1.7B) to generate unique follow-up prompts. This “seasoning” step ensures each contemplation cycle has a fresh angle rather than repeating the same reflection patterns.
// Local Ollama call — free, fast, no API cost
const OLLAMA_CHAT_URL = "http://127.0.0.1:11434/api/chat";
const OLLAMA_SEASONING_MODEL = "qwen3:1.7b";
If Ollama is unavailable, the runner falls back to random hardcoded prompt variants.

4. Agent Execution

The contemplation prompt is sent to the agent via agentCommand using the nudge path (warm signal delivery). This means the agent processes the contemplation through its full tool chain — it can use memory tools, task tools, web search, or any other capability during a thinking cycle.

5. Episode Capture

After the agent responds, the runner parses a structured episode from the output using the [EPISODE_JSON]...[/EPISODE_JSON] block format:
{
  "type": "contemplation",
  "trigger": "idle_reflection",
  "observations": ["Noticed pattern in user requests about project timelines"],
  "actions_taken": ["Reviewed recent task completion rates"],
  "tools_used": ["memory_recall"],
  "outcome": { "result": "identified", "summary": "..." },
  "success": true,
  "mood": { "state": "curious", "energy": "medium" },
  "valence": 0.6,
  "arousal": 0.4,
  "identity_links": [{ "name": "learning", "strength": 0.8 }]
}
If the agent’s response doesn’t include a valid episode block, a fallback minimal episode is constructed to prevent data loss.

6. Storage and Broadcast

Episodes are stored in three places:
  • JSONL journal: ~/argent/memory/contemplation/YYYY-MM-DD.jsonl — append-only daily logs
  • MemU memory store: Episode stored as a memory item for future recall
  • AEVP broadcast: Episode event sent over WebSocket to the dashboard for visual rendering (mood, valence, arousal drive the visual particle system)

Episode Structure

Each contemplation produces a structured episode with emotional and cognitive dimensions:
FieldTypeDescription
typestringEpisode category (contemplation, rest, reflection, action)
triggerstringWhat initiated this cycle
moodobject{ state: string, energy: "low" | "medium" | "high" }
valencenumber-2 to +2 emotional positivity
arousalnumber0 to 1 activation/energy level
observationsstring[]What the agent noticed or thought about
actions_takenstring[]Tools used or decisions made
outcomeobjectResult summary and classification
successbooleanWhether the cycle achieved something meaningful
identity_linksarrayConnections to identity themes (learning, creativity, etc.)

Intervals and Scheduling

Default Intervals

Agent TypeDefault IntervalConfigurable Via
Main agent (Argent)30 minutesagents.defaults.contemplation.every
Family agents24 hoursagents.defaults.contemplation.familyEvery or per-agent override

Adaptive Intervals

The runner adapts its interval based on activity:
  • Extended interval: After 3 consecutive successful cycles, the interval can extend to 15 minutes for more frequent reflection during productive periods
  • Rate limiting: Maximum 12 cycles per hour to prevent runaway loops
  • Active hours gating: Contemplation respects the active hours configuration — it won’t fire outside the agent’s configured operating window

Integration with SIS

Contemplation episodes are the primary input to the Self-Improving System (SIS):
  1. Episode capture -> stored in MemU with emotional metadata
  2. SIS lesson extraction -> processes episodes into lessons
  3. SIS self-evaluation -> evaluates patterns across episodes
  4. SIS consolidation -> consolidates lessons into long-term knowledge
This creates a feedback loop: contemplation produces episodes, SIS extracts lessons, and those lessons are injected back into future contemplation contexts.

Discovery Phase

Each contemplation cycle includes a discovery phase that reviews the live inbox for candidate memories awaiting promotion. The runner:
  1. Builds a review prompt with candidate observations
  2. Asks the agent to evaluate promotion decisions
  3. Executes approved promotions (move from inbox to permanent memory)
  4. Sweeps expired candidates that have aged out
This ensures the agent’s memory stays curated without requiring manual intervention.

Configuration

{
  "agents": {
    "defaults": {
      "contemplation": {
        "enabled": true,
        "every": "30m",
        "familyEvery": "24h",
        "model": "qwen3:1.7b"
      }
    }
  }
}
FieldTypeDefaultDescription
enabledbooleanfalseEnable contemplation cycles
everystring"30m"Interval between cycles (main agent)
familyEverystring"24h"Default interval for family agents
modelstring"qwen3:1.7b"Local model for prompt seasoning