Files
boshu2__agentops/docs/workflows/meta-observer/README.md
T

523 lines
14 KiB
Markdown
Raw Normal View History

# Meta-Observer Pattern - Complete Workflow Package
**Version:** 1.0.0
**Status:** Production-ready ✅
**Discovered:** 2025-11-09
**Pattern Type:** Autonomous multi-session coordination via stigmergy
---
## Overview
The **Meta-Observer Pattern** enables N autonomous workers to coordinate through shared memory (Memory MCP) without central orchestration.
**Core Principle:** Emergent coordination > Central control
**Inspiration:** Ant colonies coordinate via pheromones (stigmergy), not military command structures.
---
## Quick Start
### 3 Ways to Use Meta-Observer Pattern
#### Option 1: Full Launch (Best for New Projects)
```bash
# In workspace root or neutral location
/launch-meta-observer
# Follow prompts:
# - How many workers? 3
# - Domain 1: 12-factor-agentops
# - Domain 2: agentops-showcase
# - Domain 3: launch-content
# - Goal: Q1 2025 public launch prep
# Creates:
# - Meta-Observer session (this session)
# - 3 worker briefs in .agents/briefs/
# - 3 Memory MCP entities
# - Full monitoring protocol
# Open 3 new Claude Code sessions and read their briefs
# Workers work autonomously, you synthesize
```
#### Option 2: Ad-Hoc Workers (Simplest) ⭐ RECOMMENDED
```bash
# Session 1 (workspace root) - Meta-Observer
# You manually observe via Memory MCP queries
# Or use meta-observer agent
# Session 2 (any directory/repo)
/start-worker
# Interactive prompts: Worker 1, domain, goal
# Immediately start autonomous work
# Session 3 (another directory/repo)
/start-worker
# Worker 2, different domain
# Work autonomously
# Add more sessions as needed
/start-worker
# Worker N, scale infinitely
```
#### Option 3: Generate Briefs Separately
```bash
# Generate worker brief document
/worker-brief --domain "agentops-showcase" --number 2
# Creates: .agents/briefs/worker-2-agentops-showcase.md
# Worker reads brief and starts work
```
---
## What's Included
### Slash Commands (3)
Located in `.claude/commands/`
1. **`/launch-meta-observer`** (13.4 KB)
- Initialize full pattern (observer + N workers)
- Interactive or quick mode
- Creates all entities and briefs
- *(Full pattern initialization with interactive or quick mode)*
2. **`/start-worker`** (7.2 KB)
- Transform THIS session into autonomous worker
- Interactive setup
- Creates Memory MCP entity
- Provides operating protocol
- *(Transform current session into autonomous worker with Memory MCP entity)*
3. **`/worker-brief`** (9.1 KB)
- Generate detailed worker brief document
- Save to `.agents/briefs/`
- Customized for specific domain
- *(Generate detailed worker brief document for specific domain)*
### Agents (2)
Located in `.claude/agents/`
1. **`meta-observer.md`** (12.8 KB)
- Meta-Observer agent protocol
- Monitors N workers via Memory MCP
- Synthesizes discoveries
- Intervenes minimally
- *(Monitors N workers via Memory MCP, synthesizes discoveries, minimal intervention)*
2. **`autonomous-worker.md`** (13.8 KB)
- Autonomous worker template
- Domain expert protocol
- Memory MCP coordination
- Context management
- *(Domain expert protocol with Memory MCP coordination and context management)*
### Documentation (4 files)
Located in `.claude/workflows/meta-observer/`
1. **`README.md`** (this file)
- Complete workflow overview
- Quick start guides
- All included artifacts
2. **`../meta-observer-pattern.md`**
- Full pattern documentation
- Architecture, principles, usage
- Examples, troubleshooting
- [View guide →](../meta-observer-pattern.md)
3. **`example-today.md`**
- Today's experiment (2025-11-09)
- Real usage showing pattern in action
- 3 workers, launch prep work
- Learnings and validation
- [View example →](./example-today.md)
4. **`SHOWCASE.md`**
- Showcase-ready documentation
- For demonstrating pattern publicly
- Clean narrative, proof points
- [View showcase →](./SHOWCASE.md)
---
## Architecture
```
┌─────────────────────────────────────────────────────────┐
│ AUTONOMOUS WORKERS (N sessions) │
│ • Work independently in assigned domains │
│ • Update Memory MCP when completing major work │
│ • Self-organize via shared knowledge │
│ • NO central coordination needed │
│ • Each has unique Memory MCP entity │
└─────────────────────────────────────────────────────────┘
↓ Stigmergy via Memory MCP ↓
┌─────────────────────────────────────────────────────────┐
│ MEMORY MCP (Shared Knowledge Graph) │
│ • Worker observations and discoveries │
│ • Cross-worker insights │
│ • Blocker notifications │
│ • Persistent state (survives /clear) │
└─────────────────────────────────────────────────────────┘
↓ Observer monitors ↓
┌─────────────────────────────────────────────────────────┐
│ META-OBSERVER (1 session) │
│ • Watches worker Memory MCP updates │
│ • Synthesizes discoveries into coherent narrative │
│ • Documents learnings and emergent patterns │
│ • Intervenes ONLY if blocking conflicts │
└─────────────────────────────────────────────────────────┘
```
### Key Properties
**Autonomous Workers:**
- Domain experts who self-organize
- Make independent decisions
- Update shared memory when ready
- Use sub-agents to stay lean (<40% context)
- Coordinate only if blocking
**Memory MCP (Stigmergy):**
- Coordination through environment
- Like ant pheromone trails
- Persistent across sessions
- Structured data (entities + observations)
- Enables emergent patterns
**Meta-Observer:**
- Watches, doesn't command
- Synthesizes N worker streams
- Documents emergent insights
- Minimal intervention (only blocking)
- Stays lean (~20-30% context)
**Scaling:**
- O(1) coordination overhead
- Add workers without slowing down
- Works from N=2 to N=unlimited
- Each worker has unique entity (no conflicts)
---
## Usage Patterns
### Pattern 1: Repository Parallelization
**Scenario:** Work spans multiple repos
**Example:**
```bash
/launch-meta-observer --workers 3 \
--domains "backend-api,frontend-ui,infrastructure" \
--goal "Implement authentication feature"
```
**Workers:**
- Worker 1 (backend): Auth endpoints, JWT
- Worker 2 (frontend): Login UI, protected routes
- Worker 3 (infra): Database, secrets
**Result:** Complete feature developed in parallel, synthesized by observer
### Pattern 2: Domain Specialization
**Scenario:** Different expertise areas
**Example:**
```bash
/launch-meta-observer --workers 4 \
--domains "docs,tests,deploy,monitoring" \
--goal "Production-ready release"
```
**Workers:**
- Worker 1: Documentation and guides
- Worker 2: Test suites
- Worker 3: CI/CD and deployment
- Worker 4: Observability
**Result:** All quality gates completed autonomously
### Pattern 3: Launch Preparation (Today's Example)
**Scenario:** Multi-domain launch readiness
**Example:**
```bash
/launch-meta-observer --workers 3 \
--domains "framework,website,marketing" \
--goal "Q1 2025 public launch"
```
**Workers:**
- Worker 1: Framework docs, factor-mapping
- Worker 2: VitePress build, deployment
- Worker 3: SEO content, launch strategy
**Result:** 80% launch-ready in one day, zero coordination overhead
---
## Success Metrics
**Pattern succeeds when:**
- ✅ Workers complete work autonomously (no constant guidance)
- ✅ Emergent insights arise (worker combinations create value)
- ✅ Observer synthesis valuable (coherent narrative)
- ✅ Intervention minimal (only blocking conflicts)
- ✅ Faster than serial (parallelization helps)
- ✅ No context collapse (all sessions <40%)
- ✅ Scales naturally (adding workers doesn't slow down)
**Pattern validated through:**
- Real experiment (2025-11-09)
- 3 workers completed complex work independently
- Zero active coordination needed
- Emergent insights discovered
- Observer synthesis highly valuable
- Pattern immediately productized
---
## Memory MCP Integration
### Worker Update Pattern
```typescript
// After major work completion
mcp__memory__add_observations({
observations: [{
entityName: "Worker Session: {your-domain}",
contents: [
"Completed: {what you did}",
"Discoveries: {insights}",
"Impact: {on overall goal}",
"Blockers: {any issues}",
"Context: {current %}",
"Next: {steps}"
]
}]
})
```
### Observer Query Pattern
```typescript
// Check all workers
mcp__memory__search_nodes({
query: "Worker Session completed discoveries"
})
// Get specific worker
mcp__memory__open_nodes({
names: ["Worker Session: agentops-showcase"]
})
// Check for blockers
mcp__memory__search_nodes({
query: "BLOCKER Worker Session"
})
```
### Coordination Pattern (Rare)
```typescript
// Worker reports blocker
mcp__memory__add_observations({
observations: [{
entityName: "Worker Session: domain-1",
contents: [
"BLOCKER: {description}",
"Affects: Worker 2",
"Need: {what to unblock}"
]
}]
})
// Worker 2 sees blocker and resolves
mcp__memory__search_nodes({ query: "BLOCKER Worker 2" })
```
---
## Integration with 12-Factor AgentOps
This pattern validates and uses:
**Factor II (JIT Context Loading):**
- Workers stay <40% via sub-agents
- Observer stays <30% (just reading/synthesizing)
- Memory MCP eliminates full context loading
- Bundle protocol at threshold
**Factor VI (Session Continuity):**
- Memory MCP persists across /clear
- Workers bundle and resume seamlessly
- Work continues despite interruptions
- Observer synthesizes across restarts
**Factor VII (Intelligent Routing):**
- Observer synthesizes, doesn't command
- Workers self-route based on expertise
- Memory MCP routes information
- Emergent routing from stigmergy
**Factor IX (Pattern Extraction):**
- Observer captures emergent patterns
- Workers document discoveries
- Learnings extracted automatically
- This workflow itself was extracted!
---
## Files Structure
```
.claude/
├── commands/
│ ├── launch-meta-observer.md # Initialize full pattern
│ ├── start-worker.md # Transform session to worker
│ └── worker-brief.md # Generate worker brief doc
├── agents/
│ ├── meta-observer.md # Observer agent protocol
│ └── autonomous-worker.md # Worker template
└── workflows/
├── meta-observer-pattern.md # Full pattern documentation
└── meta-observer/
├── README.md # This file - overview
├── example-today.md # Real experiment example
└── SHOWCASE.md # Public demonstration doc
```
---
## Advantages
**vs Central Orchestration:**
- ✅ No bottleneck (workers don't wait)
- ✅ Domain expertise (workers know their domain)
- ✅ Scales naturally (O(1) not O(N²))
- ✅ Resilient (no single point of failure)
- ✅ Emergent insights (novel patterns arise)
**vs No Coordination:**
- ✅ Shared knowledge (Memory MCP context)
- ✅ Conflict detection (observer watches blockers)
- ✅ Synthesis (coherent narrative)
- ✅ Learning capture (patterns documented)
---
## When to Use
**Use Meta-Observer when:**
- ✅ Work spans multiple domains/repos
- ✅ Tasks can be parallelized
- ✅ Want emergent insights
- ✅ Need synthesis of distributed work
- ✅ Avoiding coordination bottlenecks
**Don't use when:**
- ❌ Single session work
- ❌ Tightly coupled tasks requiring constant sync
- ❌ Simple linear workflow
- ❌ Real-time coordination required
---
## Getting Started
**Step 1: Choose your approach**
- Full launch: `/launch-meta-observer`
- Ad-hoc workers: `/start-worker` in each session
- Generate briefs: `/worker-brief` then read
**Step 2: Let workers work**
- They know their domains
- They'll update Memory MCP
- Trust their autonomy
**Step 3: Observer synthesizes**
- Query Memory MCP every 2-4 hours
- Create synthesis documents
- Document learnings
**Step 4: Learn and iterate**
- What emergent patterns arose?
- What would improve the pattern?
- Document for next time
---
## Support
**Questions?**
- Read: `../meta-observer-pattern.md` (comprehensive)
- Example: `example-today.md` (real usage)
- Showcase: `SHOWCASE.md` (for presentations)
**Issues?**
- Check Memory MCP entities created correctly
- Verify workers updating Memory MCP
- Ensure observer monitoring (not micromanaging)
- Review context % (workers <40%, observer <30%)
**Contributions:**
- Pattern is open for community input
- Report what works / doesn't work
- Share your usage examples
- Suggest improvements
---
## Version History
**v1.0.0 (2025-11-09)**
- ✅ Initial release
- ✅ Pattern discovered through experiment
- ✅ Full infrastructure created
- ✅ 3 slash commands, 2 agents
- ✅ Complete documentation
- ✅ Validated in production use
- ✅ Ready for community use
---
## What's Next
**For You:**
- Use pattern for real multi-session work
- Document your experience
- Share insights via Memory MCP
- Improve pattern based on learnings
**For Community:**
- Public launch with showcase website
- Community examples and case studies
- Pattern variations and improvements
- Scale validation (10+, 100+ workers)
---
**Pattern:** Meta-Observer
**Principle:** Emergent coordination > Central control
**Status:** Production-ready ✅
**Scales to:** N autonomous workers
**Discovered:** 2025-11-09 through experiment
---
**Welcome to the Meta-Observer Pattern. Work autonomously. Coordinate emergently. Synthesize insights.**