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.

↻ repeat until goal achieved ↻

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.

Sadhana TUI (Optional)
Dashboard
Agent List
Event Stream
Controls
Unix Socket
chittad Daemon
SadhanaManager
tick() loop
BrainProvider
Claude API
Local GPU (Ollama)
chitta-field Storage
sadhana table
history table
memories (recall)
triplets (graph)
Components
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 Visibility

Success Learning

Successful actions are stored with Private visibility — project-specific knowledge that doesn't clutter other realms. Normal salience and decay.

Private Visibility
Memory-Aware Think Prompt
You 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.

Installation & Usage
# Install
pip install -e sadhana-tui/

# Run
sadhana-tui
sadhana-tui — 3 agents
live
Agents
#22 running
Monitor pipeline
cycles 24 300s
#21 done
Reliability audit
cycles 3
#20 paused
Run test suite
cycles 8
#22 haiku · claude
Monitor denbi pipeline until ALL jobs finished. Alert on failure.
cycles 24
interval 300s
next tick 4:58
memories 12
Event Stream
01:23 sense squeue -u fguerra
01:23 think 47 jobs pending, 12 running — waiting
01:18 act sleep 300 (next check in 5 min)
01:13 learn Stored: ssh pattern for denbi-h-micro
01:13 sense snakemake --summary 2>&1 | tail -5
01:08 act ssh fguerra@denbi-h-micro
›
NORMAL #22 · running
3 agents 1 active sadhana-tui v1.0
nnew ppause rresume sstop j/knavigate gset-goal mmodel qquit

Usage

Starting a Sadhana
# 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.

CommandDescription
sadhana_listList all sadhanas with state
sadhana_status --id NGet detailed status + history
sadhana_pause --id NPause a running sadhana
sadhana_resume --id NResume a paused sadhana
sadhana_stop --id NStop and mark as done
sadhana_set_goal --id N --goal "..."Update the goal
sadhana_set_model --id N --model sonnetChange LLM model
sadhana_set_interval --id N --interval 300Change tick interval

Use Cases

 

Pipeline Monitoring

/shepherd snakemake --cores 8

Monitor Snakemake, Nextflow, or Slurm pipelines. Detects failures, recalls fixes from memory, restarts automatically.

 

Continuous Testing

sadhana_start --goal "Run tests on file change"

Watch for changes, run tests, fix issues. Goal: all tests pass.

 

Server Monitoring

sadhana_start --goal "Monitor health. Alert if CPU > 90%"

Continuous health checks with threshold-based alerts.

 

Deployment Verification

sadhana_start --goal "Verify deployment succeeded"

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.

⏱
Idle > 10 min
+
 
Cooldown > 1 hr
→
✦
Auto-trigger
1
 
dream_wander()
Auto-select topic from memory
① priority
gap + unresolved
memory gaps
② fallback
confidence < 0.5
low confidence
③ default
curiosity seeds
philosophy, etc
2
✦
dream_start(topic)
Spawn sadhana with kind=dream
Claude Agent
WebSearch WebFetch chitta recall chitta remember
 
[dream] memories stored · status → woke

Topic Selection Priority

  1. Memories tagged gap + unresolved
  2. Low-confidence memories (below 0.5)
  3. Hardcoded curiosity seeds (philosophy, consciousness, complexity)

Tools

ToolDescription
dream_startStart a dream exploring a specific topic
dream_wanderAuto-pick topic from gaps/seeds and start dreaming
dream_listList recent dreams with status
dream_statusFull dream detail + sadhana history

Dream Status

StatusMeaning
dreamingAgent is actively exploring
wokeExploration complete, findings stored
forgottenDream 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.

↻
perpetual
1
 
Seed
Curiosity gaps
gap + unresolved
2
 
Dream
Web exploration
dream_wander
3
 
Synthesize
Bridge findings
connect_temporal
4
 
Emerge
New gaps surface
cycle continues
1
Investigation sadhanas

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.

2
SSL distillation

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.

3
Dream → synthesis loop

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.

4
Outcome feedback

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

Code runs — bugs and gaps surface naturally
NativeDistiller stores [failure] and [gap] memories from each session transcript
dream_wander picks gaps during idle time — explores solutions via web search
Synthesis sadhana connects dream findings to existing code knowledge, files investigation tasks
Investigation sadhana reads source, implements fix, builds and tests
Release — subsequent runs use the reviewed changes
↻   cycle outcomes are stored for later retrieval

Setting 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

  1. 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