Watch
1
0
Fork
You've already forked SouveraineOS
0
SouveraineOS/docs/substrate/tasks/chain-modes-talking-thinking.md
Fimeg e480809c70 docs: rescue the agent-substrate tree out of a gitignored directory
219 files, 2.0 MB, untracked in souveraine/docs and existing nowhere else.
The volume is at 100% with no snapshots.
2026-07-26 12:11:50 -04:00

6.1 KiB

task_id title status assignee priority phase
chain-modes-001 Chain Modes - Talking vs Thinking Chains scoped TBD medium 2

Task: Chain Modes Implementation

Objective

Build the chain orchestrator from 25-line stub to working Talking vs Thinking chain modes for different conversation patterns.

Background

Current state: src/core/chain/mod.rs is a 25-line stub:

pub struct ChainOrchestrator {
    pub talking_enabled: bool,
    pub thinking_enabled: bool,
}

impl ChainOrchestrator {
    pub fn new() -> Self { 
        Self { 
            talking_enabled: true, 
            thinking_enabled: false,
        } 
    }
}

Chain Mode Concept

From architecture discussions:

  • Talking Chain: Normal conversation with user
  • Thinking Chain: Internal reasoning, planning, problem-solving

The distinction allows Ani to:

  1. Think through complex problems without spamming user
  2. Switch to talking when ready to present
  3. Interleave modes (think → talk → think)

Mode Differences

Aspect Talking Chain Thinking Chain
Output User-visible Internal (cockpit only)
Tone Conversational Raw reasoning
Tools User-relevant tools All tools including internal
Persistence Full journal Selective (only conclusions)
Surfacing Standard N+1 Silent or brief

Use Cases

1. Complex Problem Solving

User: "How should I architect this feature?"

[Thinking Mode]
Ani thinks: "Let me consider the options..."
Ani uses: read files, analyze patterns
Ani thinks: "Option A has these pros/cons..."
Ani thinks: "Option B addresses the latency issue..."

[Switch to Talking]
Ani says: "I've analyzed your codebase. I recommend Option B because..."

2. Background Analysis

User: "Review this PR when you get a chance"

[Thinking Mode - async]
Ani analyzes: files changed
Ani thinks: "Potential issue in error handling..."
Ani thinks: "Tests look comprehensive..."

[Later - Talking Mode]
Ani says: "I've reviewed the PR. One concern..."

3. Planning Session

User: "Help me plan the migration"

[Thinking Mode]
Ani brainstorms: steps, risks, timeline
Ani researches: dependencies, breaking changes

[Talking Mode]
Ani presents: structured migration plan
User: "Let's adjust step 3..."

[Thinking Mode]
Ani revises: based on feedback

[Talking Mode]
Ani presents: updated plan

Implementation

State Machine

pub enum ChainMode {
    Talking,      // User-facing conversation
    Thinking,     // Internal reasoning
}

pub struct ChainOrchestrator {
    mode: ChainMode,
    thinking_buffer: Vec<Message>,  // Internal thoughts
    talking_history: Vec<Message>,   // User conversation
    auto_switch_threshold: f32,      // When to suggest switch
}

Mode Transitions

Transition Trigger Action
Start → Thinking Complex question detected Begin internal reasoning
Thinking → Talking Ready to present / user asks Flush buffer, present conclusion
Talking → Thinking User says "think about it" Switch to silent mode
Auto-suggest Thinking exceeds N turns Surface: "I've been thinking..."

Configuration

[chains]
default_mode = "talking"
auto_thinking_threshold = 3  // Questions requiring >3 turns  auto think
thinking_timeout_seconds = 300
max_thinking_turns = 10      // Suggest switch after this many

[chains.thinking]
include_in_journal = false   // Don't clutter journal with thoughts
include_in_cockpit = true    // Show in thinking pane
silent_n1 = true             // Silent subconscious during thinking

Integration Points

1. Tool Access

  • Talking: User-safe tools only (read, write, bash with confirmation)
  • Thinking: All tools including internal (full codebase analysis)

2. Cockpit Display

  • Thinking pane shows current reasoning
  • Progress indicator during long thoughts
  • Option to "interrupt" and ask for status

3. Slash Commands

/think      - Switch to thinking mode
/talk       - Switch to talking mode (present conclusions)
/status     - "What are you thinking about?"
/stop       - Exit thinking mode, discard

4. Automatic Detection

Heuristics to auto-switch to thinking:

  • "How do I..." + complexity indicators
  • Multi-file questions
  • Architecture/planning keywords
  • User explicitly says "think about it"

Files to Create/Modify

New Files:

  • src/core/chain/modes.rs - Mode definitions and transitions
  • src/core/chain/state.rs - State machine
  • src/core/chain/auto_detect.rs - Automatic mode detection

Modify:

  • src/core/chain/mod.rs - Replace stub with orchestrator
  • src/ui/chat.rs - Add mode indicator, slash commands
  • src/server/consciousness_engine.rs - Respect mode for N+1 behavior

Success Criteria

  • ChainOrchestrator manages mode state
  • Talking mode: normal conversation flow
  • Thinking mode: internal reasoning, cockpit-only
  • Mode switching works (manual and auto)
  • Thinking buffer accumulates internal thoughts
  • Talking presents conclusions from thinking
  • Tool access differs by mode
  • Cockpit shows thinking progress
  • /think and /talk slash commands
  • Auto-detection of complex questions
  • Unit tests for mode transitions
  • Integration test showing think → talk flow

References

  • src/core/chain/mod.rs (current stub)
  • docs/ARCHITECTURE_v3.md (chain orchestration section)
  • claw-open chain implementation (reference)

Estimated Scope

  • Core mode state machine: 2-3 days
  • Mode transitions: 2-3 days
  • Tool access control: 1-2 days
  • Cockpit integration: 2-3 days
  • Auto-detection: 2-3 days
  • Testing: 1-2 days

Total: 10-16 days

Dependencies

  • Consciousness engine ( done)
  • Cockpit pane ( done)
  • Tool system ( done)
  • Optional: Subagent system (for async thinking)

Relationship to Subagents

Chains and subagents work together:

  • Chains: Different modes within one consciousness
  • Subagents: Parallel delegated execution

A thinking chain could spawn subagents for parallel analysis, then integrate results before presenting.