Sadhana
Status as of 2026-09-20 Canonical agent lifecycle · Separate evolve workflow.
The animated agents, investigation stories and schedules below are illustrative historical examples, not live state or current configuration. Code changes now follow the isolated evolve workflow, with optional --candidates N and human merge/deployment.
Persistent agents that work toward goals through continuous sense-think-act cycles — with memory integration and self-learning.
The Concept
Sadhana (Sanskrit: साधना, "disciplined practice") — persistent autonomous agents that work toward goals through continuous sense-think-act cycles.
A sadhana stores a goal and runs scheduled cycles of observation, model reasoning, action, and outcome recording.
SENSE
Observe the current state by executing a shell command. What's the pipeline status? Are jobs running?
THINK
Analyze the observation, recall relevant memories from past experience, decide the next action.
ACT
Execute the decided action. Restart a job, send an alert, modify configuration, or wait.
LEARN
Store outcomes in memory. Successes stay local; failures go global so all sadhanas learn.
Architecture
Sadhanas run inside the chittad daemon. The SadhanaManager orchestrates all agents, running a tick loop every 100ms to check which sadhanas need to sense-think-act.
SadhanaManager Orchestrates all sadhanas, runs tick loop every 100ms BrainProvider LLM abstraction — Claude CLI or local GPU via Ollama HTTP chitta-field Persistent state, history, and memory integration (Rust WAL) Sadhana TUI Optional terminal interface for real-time monitoring
Memory Integration
Sadhanas are memory-aware. Before each decision, they recall relevant memories from past experience — including failures from other sadhanas.
1. Query
Build search query from goal + current observation. Example: "ssh connection refused server-x"
2. Recall
BM2524 text search finds relevant memories. Up to 5 memories ranked by relevance.
3. Inject
Memories injected into think prompt. Agent sees past successes and failures.
Failure Learning
When an action fails, it's stored with Global visibility — all sadhanas across all projects can learn from it. Higher salience (0.8) and slow decay (0.03) ensure failures persist.
Global VisibilitySuccess Learning
Successful actions are stored with Private visibility — project-specific knowledge that doesn't clutter other realms. Normal salience and decay.
Private VisibilityYou are an autonomous agent working toward this goal: Monitor pipeline on server X Relevant memories from past experience: - [sadhana] Failure: ssh to localhost failed, use server-x instead - [sadhana] Success: ssh user@server-x worked correctly Current observation: { "error": "Connection refused" } Decide what to do next...
Sadhana TUI
A Textual-based terminal interface for real-time monitoring of all your autonomous agents.
# Install pip install -e sadhana-tui/ # Run sadhana-tui
squeue -u fguerra
sleep 300 (next check in 5 min)
snakemake --summary 2>&1 | tail -5
ssh fguerra@denbi-h-micro
Usage
# Via skill /shepherd snakemake --cores 8 --interval 300 # Daemon MCP/RPC tool name: sadhana_start {"goal":"Monitor pipeline", "brain_provider":"claude", "brain_model":"haiku", "interval_seconds":120, "max_turns":10}
The direct CLI does not advertise this tool as a subcommand. Use MCP/RPC or forward a tools/call request through chitta mcp; see the complete example. Start parameters differ from setter parameters.
Management RPC tools
Names and arguments below describe RPC tools, not direct shell subcommands. Manager defaults are local/gemma4:26b, 300 s interval, 10 concurrent agents, 20 turns per cycle and a 600 s timeout. State persists as chitta-field task payloads and transitions. The --no-autonomous daemon option pauses restored agents.
| Command | Description |
|---|---|
| sadhana_list | List all sadhanas with state |
| sadhana_status --id N | Get detailed status + history |
| sadhana_pause --id N | Pause a running sadhana |
| sadhana_resume --id N | Resume a paused sadhana |
| sadhana_stop --id N | Stop and mark as done |
| sadhana_set_goal --id N --goal "..." | Update the goal |
| sadhana_set_model --id N --model sonnet | Change LLM model |
| sadhana_set_interval --id N --interval 300 | Change tick interval |
Use Cases
Pipeline Monitoring
Monitor Snakemake, Nextflow, or Slurm pipelines. Detects failures, recalls fixes from memory, restarts automatically.
Continuous Testing
Watch for changes, run tests, fix issues. Goal: all tests pass.
Server Monitoring
Continuous health checks with threshold-based alerts.
Deployment Verification
Post-deployment monitoring until stability confirmed.
Dream svapna
A specialized sadhana for curiosity-driven exploration during idle time. When the daemon has been idle for 10+ minutes and no dream has run in the past hour, it wanders autonomously — picking topics from memory gaps, searching the web, and storing what it finds.
gap + unresolved
confidence < 0.5
curiosity seeds
[dream] memories stored · status → wokeTopic Selection Priority
- Memories tagged
gap+unresolved - Low-confidence memories (below 0.5)
- Hardcoded curiosity seeds (philosophy, consciousness, complexity)
Tools
| Tool | Description |
|---|---|
dream_start | Start a dream exploring a specific topic |
dream_wander | Auto-pick topic from gaps/seeds and start dreaming |
dream_list | List recent dreams with status |
dream_status | Full dream detail + sadhana history |
Dream Status
| Status | Meaning |
|---|---|
dreaming | Agent is actively exploring |
woke | Exploration complete, findings stored |
forgotten | Dream was abandoned (sadhana failed) |
Usage
# Via skill /dream # Auto-pick topic /dream consciousness # Specific topic /dream list # Recent dreams # Via MCP mcp__chitta__dream_wander {} mcp__chitta__dream_start {"topic": "quantum entanglement"} mcp__chitta__dream_list {"limit": 10}
Autonomous Self-Improvement
The historical examples below connect bug investigation, transcript distillation, idle exploration, and synthesis into a recurring development workflow.
gap + unresolveddream_wanderconnect_temporalcycle continues
A sadhana given a goal like "investigate daemon reliability — find and fix issues" runs sense-think-act cycles reading source files, grepping logs, and checking health outputs — then writes fixes directly. Sadhana #21 found all 6 daemon reliability bugs that shipped in v3.43.6.
After every session, NativeDistiller reads the transcript and extracts [correction], [pattern], and [gotcha] memories. The UserPromptSubmit hook surfaces them at session start — mistakes made in session 10 become warnings in session 11.
dream_wander picks unresolved memory gaps and launches an exploration sadhana that web-searches the topic and stores [dream] findings. Dreams run twice daily (nap + night); any finding with architectural implications is tagged [dream][impl] and queued for the daily self-improvement cycle.
Investigation outcomes become records available to later sadhana cycles. Code changes require validation before their effects on reliability or task outcomes can be established.
Investigation cycle
NativeDistiller stores [failure] and [gap] memories from each session transcriptdream_wander picks gaps during idle time — explores solutions via web searchSetting It Up
Step 1 — Seed curiosity gaps
mcp__chitta__observe {
"title": "[gap] Why does X happen?",
"content": "Detailed question and context...",
"tags": "gap,unresolved,curiosity,topic-name"
}
Step 2 — Dreams auto-trigger from gaps
When the daemon is idle for 10+ minutes, dream_wander picks the highest-priority gap and launches an exploration sadhana. No manual trigger needed.
Step 3 — Start a synthesis sadhana
mcp__chitta__sadhana_start {
"goal": "Each cycle: review recent dreams (dream_list, dream_status),
extract key insights, connect them to existing memories via
connect_temporal, store synthesis as [auto-improve] tagged wisdom.
Also file new investigation tasks based on what you find.",
"interval_seconds": 900
}
References
- Stephen Robertson and Hugo Zaragoza. The Probabilistic Relevance Framework: BM25 and Beyond. Foundations and Trends in Information Retrieval 3(4), 333–389 (2009). https://doi.org/10.1561/1500000019