MUSE
Interactive LeaderSpawn and coordinate multiple AI subagents for complex task decomposition
Best Way to Use MUSE
The easiest way to use MUSE is by asking Claude Code or another AI coding agent to run the TRIBE CLI commands for you. Simply describe what you want to accomplish.
Example Prompt
"Use the tribe CLI to start a MUSE session and break down this task into subtasks: [your task description]. Spawn subagents for each subtask and coordinate the work."Claude will run tribe muse start, tribe muse spawn, and other commands automatically.
What is MUSE?
MUSE (Multi-agent Unified System for Execution) provides an interactive "leader agent" that can spawn and coordinate multiple subagents. The leader understands high-level objectives and delegates tasks to isolated workers, each running in their own git worktree.
Core Commands
Leader Management
tribe muse start # Start leader agent
tribe muse attach # Attach to leader session
tribe muse stop # Stop leaderSubagent Operations
tribe muse spawn "<task>" [name] # Spawn subagent for task
tribe muse status # Show all subagent status
tribe muse output <session> [lines] # View subagent output
tribe muse prompt <session> "<msg>" # Send message to subagentIterative Refinement (Negotiate)
tribe muse negotiate "<objective>" # Start negotiation loop
tribe muse negotiate-refine <s> "<q>" # Send follow-up question
tribe muse negotiate-accept <session> # Approve and completeAgent & System Management
tribe muse agents # List all agents with status
tribe muse review <session> # Review agent work
tribe muse kill <session> # Kill specific session
tribe muse monitor # Health monitoring
tribe muse watchdog # Stuck agent recovery
tribe muse cleanup --daemon # Auto-cleanup daemon
tribe muse autoscale on|off|status # Warm pool managementSession Lifecycle
Create Worktree & Branch
Creates isolated directory at .muse-worktrees/{name}/ with branch muse/{name}
Create Session & Start Agent
Launches tmux session muse-agent-{name} and starts Claude with the task prompt
Working State
Agent works on the task in isolation. For negotiate mode, enters AWAITING_REVIEW state for iterative refinement.
Completion & Cleanup
Upon CHANGES_COMPLETE, auto-cleanup removes session and worktree
Negotiation Protocol
The negotiate feature enables multi-cycle context gathering with iterative refinement:
Example Workflow
# Phase 1: Initial dispatch
tribe muse negotiate \
--queries "current auth;pain points;tech debt" \
--name auth-research \
"Decide whether to refactor or extend auth system"
# Phase 2: View response (agent outputs AWAITING_REVIEW)
tribe muse output auth-research
# Phase 3: Refine if needed (can repeat up to max-cycles)
tribe muse negotiate-refine auth-research \
"What does the custom middleware do? Quote the TODO comments."
# Phase 4: Accept when satisfied (sends APPROVED)
tribe muse negotiate-accept auth-researchState Tracking
Negotiation state is persisted at logs/negotiate-{session}.json including objective, queries, cycle count, and refinements.
Warm Pool (Pre-spawned Agents)
Reduces latency by maintaining idle agents ready for tasks:
Configuration
# In circuit.yaml
muse:
warm_pool:
enabled: true
pool_size: 3 # Agents to keep warm
idle_timeout: "30m" # Recycle after inactivity
auto_replenish: true # Auto-refill poolWarm Hit
Agent ready instantly - no startup delay
Cold Start
New agent spawned - typical 5-10s startup
Worktree Isolation
Each agent works in an isolated git worktree, preventing conflicts:
Repository Root/
βββ .muse-worktrees/
β βββ fix-login/ # muse-agent-fix-login
β β βββ .git -> ...
β β βββ CLAUDE.md # Copied from root
β β βββ (full codebase)
β βββ add-tests/ # muse-agent-add-tests
βββ (main codebase)Quick Reference
Starting Work
tribe muse start
tribe muse spawn "Fix the login bug" fix-login
tribe muse negotiate "Understand caching" \
--queries "current;issues"Monitoring
tribe muse status
tribe muse agents
tribe muse output <session>Recovery
tribe muse watchdog --once
tribe muse kill <session>Cleanup
tribe muse clean --force --all
tribe muse cleanup --daemonOrchestrator Integrations
TRIBE integrates with other AI orchestration systems to provide tribal knowledge retrieval. By using MUSE as a "librarian" or integrating the TRIBE APIs directly, you can significantly improve performance for any orchestrator by leveraging past session context.
MUSE as Librarian
Use MUSE as a dedicated research agent that retrieves relevant past sessions and knowledge before your primary orchestrator begins work. This "librarian" pattern significantly reduces context-building time and prevents repeated mistakes.
# Spawn MUSE as librarian before main task
tribe muse negotiate \
--queries "authentication patterns;past bugs;code conventions" \
--name librarian-auth \
"Gather all relevant context about our auth system"
# View gathered context
tribe muse output librarian-auth
# Accept and use context in your orchestrator
tribe muse negotiate-accept librarian-auth
# The session summary is now available via API for other toolsWhy Use MUSE as Librarian?
- β’ Specialized for context retrieval with negotiate protocol
- β’ Iterative refinement until context is sufficient
- β’ Results automatically stored in tribal knowledge
- β’ 40-60% reduction in primary agent context-building time
Sessions & Search APIs
Integrate tribal knowledge directly into your orchestrator's skills using the TRIBE CLI or REST APIs. This enables any agent system to leverage past session context.
CLI Commands for Skills
# Search sessions by keyword
tribe search "authentication bug"
tribe search --project myapp "login flow"
# Recall a specific session's summary
tribe recall <session-id>
# Search the knowledge base
tribe kb search "how to fix CORS"
tribe kb list --category pattern
# List recent sessions
tribe sessions list
tribe sessions search --since 7dREST API Endpoints
# Search sessions via API
GET /api/sessions/search?q=keyword&project=myapp&since=7d
# Get session summary
GET /api/sessions/{session-id}/summary
# Search knowledge base
GET /api/knowledge?category=pattern&tags=cors
# Filter by subagent type (muse/circuit)
GET /api/tribes/sessions?subagent_type=museExample Skill Definition
# Example skill that queries tribal knowledge
name: tribe-recall
description: Recall context from past TRIBE sessions
# Skill implementation
invoke: |
# Search for relevant past sessions
RESULTS=$(tribe search "$QUERY" --limit 5 --json)
# Recall specific session if found
if [ -n "$SESSION_ID" ]; then
tribe recall "$SESSION_ID"
fi
# Return context for orchestrator
echo "$RESULTS"Claude Code Stop Hooks
When using Claude Code, configure stop hooks to automatically trigger TRIBE lookups at key moments. This injects tribal knowledge into the agent's context without manual intervention.
Recommended Hook Configuration
# In your .claude/settings.json or hooks configuration
{
"hooks": {
"stop": [
{
"name": "tribe-context-lookup",
"trigger": "before_response",
"command": "tribe search \"$CURRENT_TASK\" --limit 3 --json"
},
{
"name": "tribe-pattern-check",
"trigger": "before_code_change",
"command": "tribe kb search \"$FILE_TYPE patterns\" --limit 5"
}
]
}
}Stop Hook Examples
Before Task Start
tribe search "$TASK_DESC" \
--since 30d \
--project $PROJECTFind related past work before starting
Before Code Commit
tribe kb search \
"commit conventions" \
--category patternApply team conventions automatically
On Error
tribe search "$ERROR_MSG" \
--category debuggingFind past solutions to similar errors
Session End
tribe kb save \
--session-id $SESSION \
--auto-extractAuto-extract patterns on completion
Integration Best Practices
Do
- β’ Use MUSE librarian for complex research tasks
- β’ Configure stop hooks for automatic context injection
- β’ Cache frequently-used session lookups
- β’ Filter by project and date range for relevance
- β’ Save useful patterns to knowledge base
Don't
- β’ Overload context with too many session results
- β’ Skip the librarian step for complex domains
- β’ Ignore subagent_type filtering for relevant results
- β’ Forget to sync local knowledge base periodically
- β’ Use raw session output without summary extraction