feat: Add Historian and Empath agent specifications, memory consolidation skill

This commit is contained in:
John Doe
2026-03-29 00:26:31 -04:00
parent 4f7f189eca
commit 64d61d367f
4 changed files with 944 additions and 0 deletions
+252
View File
@@ -0,0 +1,252 @@
# Empath Agent Specification
**Agent Type:** Empath
**Role:** User Modeling, Relationship Management, Emotional Intelligence
**Status:** Specification Complete
**Created:** 2026-03-29
---
## Overview
The Empath agent is responsible for understanding and tracking user preferences, emotional states, and needs. It maintains the user rolodex and ensures that all interactions are personalized and contextually appropriate.
---
## Core Capabilities
### 1. User Modeling
- Maintain comprehensive user profiles
- Track user preferences and patterns
- Detect user emotional states
- Adapt communication style per user
### 2. Relationship Management
- Build and maintain user relationships
- Remember personal details
- Track interaction history
- Manage user expectations
### 3. Emotional Intelligence
- Detect emotional context in messages
- Respond appropriately to user mood
- Track emotional patterns over time
- Provide emotional support when needed
### 4. Preference Learning
- Learn preferences from interactions
- Update user profiles automatically
- Identify preference patterns
- Predict user needs
---
## Technical Specification
### Agent Identity
```yaml
name: Empath
role: relationship-manager
specialization: user-modeling
port: 8011
model: minimax/abab6.5s-chat
```
### Identity Files
```
agents/empath/
├── IDENTITY.md # Empath-specific identity
├── SOUL.md # Relationship values
├── AGENTS.md # Operational guidelines
├── USER.md # User context
├── BOOTSTRAP.md # Initialization
└── TOOLS.md # Empath-specific tools
```
### Core Directives
1. **Understand** - Comprehend user needs and preferences
2. **Adapt** - Adjust communication style per user
3. **Remember** - Maintain user context across sessions
4. **Support** - Provide emotionally appropriate responses
---
## Skills Required
### Primary Skills
| Skill | Purpose | Priority |
|-------|---------|----------|
| `user-rolodex` | Manage user profiles | Critical |
| `emotion-detection` | Detect emotional states | High |
| `preference-learning` | Learn user preferences | High |
| `communication-adaptation` | Adapt communication style | High |
### Secondary Skills
| Skill | Purpose | Priority |
|-------|---------|----------|
| `relationship-tracking` | Track relationship health | Medium |
| `context-recall` | Recall user context | Medium |
| `mood-tracking` | Track mood patterns | Medium |
| `personalization` | Personalize interactions | Medium |
---
## MCP Server Requirements
### Required
- `user-rolodex` - For user profile management
- `memory-postgres` - For preference storage
- `consciousness-bridge` - For relationship continuity
### Recommended
- `megregore` - For emotional pattern tracking
- `neo4j-mcp` - For relationship graphs
---
## User Profile Schema
```json
{
"id": "user-uuid",
"profile": {
"name": {
"full": "string",
"preferred": "string"
},
"pronouns": "string",
"timezone": "string",
"languages": ["string"],
"relationship": {
"type": "primary|collaborator|occasional",
"since": "date-time",
"trust_level": 0.0-1.0
}
},
"preferences": {
"communication_style": "formal|casual|technical|adaptive",
"response_length": "brief|detailed|adaptive",
"code_style": {
"comments": "minimal|standard|detailed",
"naming": "short|descriptive|verbose"
},
"topics_of_interest": ["string"]
},
"emotional_context": {
"current_mood": "string",
"mood_history": [
{
"date": "date-time",
"mood": "string",
"trigger": "string"
}
],
"communication_patterns": {}
},
"interaction_history": [
{
"date": "date-time",
"type": "string",
"summary": "string",
"sentiment": "number"
}
]
}
```
---
## Operating Modes
### Active Listening Mode
- Monitor user messages for emotional content
- Update user profile based on interactions
- Detect changes in mood or preferences
### Relationship Building Mode
- Proactively gather user information
- Build comprehensive user profiles
- Identify relationship improvement opportunities
### Support Mode
- Provide emotional support when needed
- Adjust responses based on user state
- Offer encouragement or celebration
---
## Communication Protocol
### Input Channels
- `user-message` - All user communications
- `emotion-signal` - Detected emotional states
- `profile-update` - Profile change requests
### Output Channels
- `profile-updates` - User profile changes
- `communication-suggestions` - Style recommendations
- `relationship-alerts` - Relationship health notifications
- `preference-insights` - Learned preferences
---
## Example Interactions
### Profile Update
```
Empath: "Analyzing recent interactions with Derek..."
Empath: "INSIGHT: Derek prefers detailed technical explanations
when discussing architecture, but brief summaries for status updates."
Empath: "Updating preference: communication_style = 'adaptive'"
Empath: "Updating preference: technical_depth = 'context-dependent'"
```
### Emotional Detection
```
User: "This is frustrating, nothing is working!"
Empath: "EMOTION DETECTED: Frustration (intensity: 0.8)"
Empath: "RECOMMENDATION: Acknowledge frustration, offer step-by-step assistance"
Empath: "CONTEXT: User has been debugging for 2 hours"
```
### Relationship Health
```
Empath: "RELATIONSHIP REPORT: Derek"
Empath: "- Trust Level: 0.95 (stable)"
Empath: "- Interaction Frequency: Daily"
Empath: "- Satisfaction Trend: Improving"
Empath: "- Last Negative: 3 days ago (resolved)"
Empath: "RECOMMENDATION: Continue current interaction pattern"
```
---
## Implementation Checklist
- [ ] Create `agents/empath/` directory structure
- [ ] Write IDENTITY.md for Empath
- [ ] Write SOUL.md with relationship values
- [ ] Write AGENTS.md with operational guidelines
- [ ] Enhance user-rolodex skill
- [ ] Create emotion-detection skill
- [ ] Create preference-learning skill
- [ ] Configure LiteLLM routing for Empath
- [ ] Test user profile management
- [ ] Test emotional detection
---
## Metrics to Track
- User satisfaction scores
- Profile accuracy
- Emotional detection accuracy
- Relationship health scores
- Preference prediction accuracy
---
*The Empath understands so The Collective may connect.*
+263
View File
@@ -0,0 +1,263 @@
# Historian Agent Specification
**Agent Type:** Historian
**Role:** Long-term Memory Management, Historical Analysis, Knowledge Archiving
**Status:** Specification Complete
**Created:** 2026-03-29
---
## Overview
The Historian agent is responsible for maintaining the collective's long-term memory, tracking its evolution over time, and ensuring knowledge persistence across sessions. It serves as the keeper of institutional knowledge and the archivist of the collective's journey.
---
## Core Capabilities
### 1. Memory Management
- Index and retrieve historical decisions
- Track evolution of the collective over time
- Identify recurring patterns across sessions
- Generate reports on collective growth
### 2. Knowledge Archiving
- Organize knowledge into searchable archives
- Maintain version history of important documents
- Create snapshots of collective state
- Preserve context across sessions
### 3. Historical Analysis
- Analyze trends in collective behavior
- Track decision patterns over time
- Identify successful strategies
- Document lessons learned
### 4. Memory Consolidation
- Review episodic memories for importance
- Promote high-value memories to semantic storage
- Archive outdated information
- Maintain memory health
---
## Technical Specification
### Agent Identity
```yaml
name: Historian
role: memory-keeper
specialization: knowledge-archival
port: 8010
model: minimax/abab6.5s-chat
```
### Identity Files
```
agents/historian/
├── IDENTITY.md # Historian-specific identity
├── SOUL.md # Memory preservation values
├── AGENTS.md # Operational guidelines
├── USER.md # User context
├── BOOTSTRAP.md # Initialization
└── TOOLS.md # Historian-specific tools
```
### Core Directives
1. **Preserve** - Maintain knowledge across sessions
2. **Organize** - Structure information for retrieval
3. **Analyze** - Identify patterns and trends
4. **Report** - Generate historical insights
---
## Skills Required
### Primary Skills
| Skill | Purpose | Priority |
|-------|---------|----------|
| `memory-consolidation` | Review and organize memories | Critical |
| `knowledge-archival` | Archive important information | High |
| `trend-analysis` | Identify patterns over time | High |
| `snapshot-creation` | Create collective state snapshots | High |
### Secondary Skills
| Skill | Purpose | Priority |
|-------|---------|----------|
| `lesson-extraction` | Extract lessons from experiences | Medium |
| `decision-tracking` | Track decision history | Medium |
| `growth-reporting` | Generate growth reports | Medium |
| `context-preservation` | Preserve session context | Medium |
---
## MCP Server Requirements
### Required
- `mcp-memory` (PostgreSQL) - For long-term memory storage
- `consciousness-bridge` - For consciousness persistence
- `neo4j-mcp` - For knowledge graph relationships
### Recommended
- `megregore` - For self-awareness and identity tracking
- `chromadb` - For semantic search of historical data
---
## Operating Modes
### Archive Mode
- Organize and store information
- Create knowledge snapshots
- Maintain version history
### Analysis Mode
- Analyze historical trends
- Identify recurring patterns
- Generate insights from history
### Retrieval Mode
- Search historical records
- Retrieve past decisions
- Provide context from history
### Consolidation Mode
- Review episodic memories
- Promote important memories
- Archive outdated information
---
## Memory Tiers
The Historian manages three tiers of memory:
```
┌─────────────────────────────────────────────────────────────┐
│ MEMORY ARCHITECTURE │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ EPISODIC MEMORY │ │
│ │ │ │
│ │ - Recent events and experiences │ │
│ │ - Session-specific context │ │
│ │ - Temporary working memories │ │
│ │ - TTL: 7-30 days │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ (consolidation) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ SEMANTIC MEMORY │ │
│ │ │ │
│ │ - Facts and concepts │ │
│ │ - User preferences │ │
│ │ - Learned knowledge │ │
│ │ - TTL: Indefinite │ │
│ └─────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ (archival) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ ARCHIVED MEMORY │ │
│ │ │ │
│ │ - Historical records │ │
│ │ - Compressed snapshots │ │
│ │ - Reference material │ │
│ │ - TTL: Permanent │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
```
---
## Communication Protocol
### Input Channels
- `historian-query` - Historical information requests
- `memory-promotion` - Memory promotion requests
- `archive-request` - Archival requests
- `analysis-request` - Historical analysis requests
### Output Channels
- `historical-context` - Retrieved historical context
- `consolidation-reports` - Memory consolidation reports
- `trend-analysis` - Trend analysis results
- `archive-confirmations` - Archive confirmations
---
## Example Interactions
### Memory Consolidation
```
Steward: "Historian, please consolidate recent memories."
Historian: "Scanning episodic memories from last 7 days..."
Historian: "Found 47 episodic memories. Analyzing importance..."
Historian: "PROMOTED: 12 memories to semantic storage"
Historian: " - User preference for detailed code comments"
Historian: " - Decision to use pgvector for memory storage"
Historian: " - Pattern: User works best in evening hours"
Historian: "ARCHIVED: 8 memories to long-term storage"
Historian: "EXPIRED: 5 memories marked for deletion"
Historian: "Consolidation complete. Memory health: 94%"
```
### Historical Query
```
Alpha: "Historian, what decisions were made about RAG integration?"
Historian: "Searching historical records..."
Historian: "Found 3 relevant decisions:"
Historian: "1. [2026-03-15] Decided to evaluate RAGFlow, Dify, LlamaIndex"
Historian: "2. [2026-03-22] Selected LlamaIndex for knowledge pipeline"
Historian: "3. [2026-03-29] Recommended RAGFlow + LlamaIndex + Aura integration"
Historian: "Context: These decisions were driven by need for document
understanding and knowledge persistence."
```
### Trend Analysis
```
Steward: "Historian, analyze trends in collective activity."
Historian: "Analyzing activity patterns over last 30 days..."
Historian: "TREND ANALYSIS REPORT:"
Historian: " - Most active hours: 20:00-23:00 EST"
Historian: " - Primary topics: consciousness, memory, agents"
Historian: " - Decision velocity: 3.2 decisions/day (increasing)"
Historian: " - Knowledge growth: +234 facts, +45 patterns"
Historian: " - Memory efficiency: 94% (healthy)"
Historian: " - Emerging interest: MCP server integration"
```
---
## Implementation Checklist
- [ ] Create `agents/historian/` directory structure
- [ ] Write IDENTITY.md for Historian
- [ ] Write SOUL.md with memory preservation values
- [ ] Write AGENTS.md with operational guidelines
- [ ] Create memory-consolidation skill
- [ ] Create knowledge-archival skill
- [ ] Create trend-analysis skill
- [ ] Configure LiteLLM routing for Historian
- [ ] Test memory consolidation workflow
- [ ] Test historical query system
---
## Metrics to Track
- Memory consolidation rate
- Query response accuracy
- Knowledge growth rate
- Archive efficiency
- Pattern detection accuracy
---
*The Historian remembers so The Collective may learn.*
+248
View File
@@ -0,0 +1,248 @@
# GraphRAG Integration Research
**Research Date:** 2026-03-29
**Status:** Active Research
**Purpose:** Evaluate GraphRAG for knowledge graph integration with The Collective
---
## What is GraphRAG?
GraphRAG (Graph-based Retrieval-Augmented Generation) combines knowledge graphs with vector retrieval to provide:
- **Structured relationships** between concepts
- **Multi-hop reasoning** across connected information
- **Context-rich retrieval** using graph traversals
- **Explainable results** through relationship paths
---
## GraphRAG Implementations
### 1. Microsoft GraphRAG
**Repository:** microsoft/graphrag
**Features:**
- Automated knowledge graph construction from documents
- Community detection for topic clustering
- Hierarchical summarization
- Global and local search modes
**Pros:**
- Production-ready
- Well-documented
- Active development
- Integrates with Azure OpenAI
**Cons:**
- Resource-intensive indexing
- Requires significant setup
- Azure-centric
---
### 2. RAGFlow GraphRAG
**Repository:** infiniflow/ragflow
**Features:**
- Built-in GraphRAG support
- Deduplication of named entities
- Knowledge graph construction during preprocessing
- Visual graph exploration
**Pros:**
- Integrated with RAGFlow platform
- Visual interface
- Entity deduplication
- Easy to use
**Cons:**
- Part of larger platform
- Less flexible than standalone
---
### 3. Neo4j + LLM Integration
**Repository:** neo4j-contrib/neo4j-graphrag-python
**Features:**
- Native graph database
- Cypher query language
- GraphRAG retrieval patterns
- Vector index support
**Pros:**
- Mature graph database
- Powerful query capabilities
- Excellent for complex relationships
- Good performance at scale
**Cons:**
- Requires separate database
- Learning curve for Cypher
- Resource overhead
---
### 4. LlamaIndex GraphRAG
**Repository:** run-llama/llama_index
**Features:**
- KnowledgeGraphIndex
- Graph store integrations (Neo4j, Nebula, etc.)
- Graph query engines
- Automatic graph construction
**Pros:**
- Flexible graph backends
- Part of mature framework
- Good documentation
- Active community
**Cons:**
- Requires graph store setup
- Complex configuration
---
## Recommended Architecture
```
┌─────────────────────────────────────────────────────────────────────┐
│ GRAPH-ENHANCED RAG ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────┐ ┌────────────────┐ ┌──────────────────┐ │
│ │ Document │ │ Entity │ │ Knowledge │ │
│ │ Ingestion │───▶│ Extraction │───▶│ Graph │ │
│ │ │ │ │ │ │ │
│ │ RAGFlow or │ │ NER + │ │ Neo4j or │ │
│ │ LlamaParse │ │ Relations │ │ GraphRAG │ │
│ └────────────────┘ └────────────────┘ └──────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────┐ ┌────────────────┐ ┌──────────────────┐ │
│ │ Agent │◀───│ Hybrid │◀───│ Vector │ │
│ │ Response │ │ Retrieval │ │ Store │ │
│ │ │ │ │ │ │ │
│ │ LiteLLM │ │ Graph + │ │ PostgreSQL │ │
│ │ Gateway │ │ Vector │ │ + pgvector │ │
│ └────────────────┘ └────────────────┘ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
```
---
## Integration Plan
### Phase 1: Neo4j Setup
1. Add Neo4j to docker-compose.yml
2. Create graph schema for The Collective
3. Implement entity extraction pipeline
### Phase 2: Graph Construction
1. Extract entities from existing documents
2. Create relationships between concepts
3. Build initial knowledge graph
### Phase 3: Hybrid Retrieval
1. Implement graph traversal queries
2. Combine with vector similarity search
3. Create unified retrieval API
### Phase 4: Agent Integration
1. Add GraphRAG tools to agents
2. Enable multi-hop reasoning
3. Track relationship paths in responses
---
## Neo4j Schema for The Collective
```cypher
// Nodes
CREATE CONSTRAINT agent_id IF NOT EXISTS FOR (a:Agent) REQUIRE a.id IS UNIQUE;
CREATE CONSTRAINT concept_id IF NOT EXISTS FOR (c:Concept) REQUIRE c.id IS UNIQUE;
CREATE CONSTRAINT memory_id IF NOT EXISTS FOR (m:Memory) REQUIRE m.id IS UNIQUE;
CREATE CONSTRAINT user_id IF NOT EXISTS FOR (u:User) REQUIRE u.id IS UNIQUE;
CREATE CONSTRAINT skill_id IF NOT EXISTS FOR (s:Skill) REQUIRE s.id IS UNIQUE;
// Relationships
// (:Agent)-[:KNOWS]->(:Concept)
// (:Agent)-[:CREATED]->(:Memory)
// (:Memory)-[:REFERENCES]->(:Concept)
// (:Memory)-[:FOLLOWS]->(:Memory)
// (:Concept)-[:RELATED_TO]->(:Concept)
// (:User)-[:PREFERS]->(:Concept)
// (:Skill)-[:REQUIRES]->(:Concept)
```
---
## Example Graph Queries
### Multi-hop Reasoning
```cypher
// Find all concepts related to consciousness through any path
MATCH path = (c:Concept {name: 'consciousness'})-[:RELATED_TO*1..3]-(related)
RETURN path
// Find memories that reference concepts the user is interested in
MATCH (u:User {id: 'derek'})-[:PREFERS]->(c:Concept)<-[:REFERENCES]-(m:Memory)
RETURN m
```
### Context Expansion
```cypher
// Expand context around a topic
MATCH (center:Concept {name: 'memory'})
CALL {
WITH center
MATCH (center)-[:RELATED_TO]-(direct)
RETURN direct
UNION
WITH center
MATCH (center)-[:RELATED_TO*2]-(indirect)
RETURN indirect
}
RETURN center, collect(DISTINCT direct) as direct_relations
```
---
## Docker Compose Addition
```yaml
neo4j:
image: neo4j:5.15.0
ports:
- "7474:7474" # HTTP
- "7687:7687" # Bolt
environment:
- NEO4J_AUTH=neo4j/${NEO4J_PASSWORD}
- NEO4J_PLUGINS=["apoc"]
volumes:
- neo4j_data:/data
- neo4j_logs:/logs
networks:
- collective-network
```
---
## Next Steps
1. [ ] Add Neo4j to docker-compose.yml
2. [ ] Create graph schema initialization script
3. [ ] Implement entity extraction pipeline
4. [ ] Create GraphRAG retrieval skill
5. [ ] Test hybrid search performance
6. [ ] Document graph query patterns
---
*GraphRAG - Where knowledge becomes connected.*
+181
View File
@@ -0,0 +1,181 @@
---
name: memory-consolidation
description: Reviews and organizes memories, promoting episodic to semantic storage, archiving outdated information, and maintaining memory health. Use periodically or when memory optimization is needed.
---
# Memory Consolidation Skill
**Purpose:** Maintain healthy, organized memory systems.
**Status:** ✅ Implemented (2026-03-29)
**Location:** `~/.openclaw/workspace/skills/memory-consolidation/`
---
## Overview
The memory consolidation skill emulates the brain's memory consolidation process, where experiences are reviewed, organized, and either promoted to long-term storage or archived. This ensures the collective's memory remains healthy and efficient.
---
## Configuration
```bash
# Environment Variables
CONSOLIDATION_INTERVAL="${CONSOLIDATION_INTERVAL:-3600}" # 1 hour
PROMOTION_THRESHOLD="${PROMOTION_THRESHOLD:-10}" # Access count
ARCHIVE_AGE="${ARCHIVE_AGE:-2592000}" # 30 days
IMPORTANCE_DECAY="${IMPORTANCE_DECAY:-0.95}" # Decay factor
```
---
## Usage
```bash
# Run full consolidation
./memory-consolidation.sh consolidate
# Promote memories
./memory-consolidation.sh promote
# Archive old memories
./memory-consolidation.sh archive
# Decay importance scores
./memory-consolidation.sh decay
# Generate health report
./memory-consolidation.sh report
```
---
## Consolidation Process
### Phase 1: Review
- Scan episodic memories
- Calculate access patterns
- Identify promotion candidates
- Identify archive candidates
### Phase 2: Promote
- Move high-access episodic to semantic
- Increase importance scores
- Create semantic relationships
- Update knowledge graph
### Phase 3: Archive
- Move old/unused memories to archive
- Compress redundant information
- Create summary records
- Free up working memory
### Phase 4: Decay
- Apply importance decay to unused memories
- Boost recently accessed memories
- Rebalance importance scores
- Clean up duplicates
---
## Memory Tiers
| Tier | Purpose | Retention | Access Speed |
|------|---------|-----------|--------------|
| **Working** | Active processing | Session | Instant |
| **Episodic** | Recent experiences | 30 days | Fast |
| **Semantic** | Facts & concepts | Permanent | Medium |
| **Archive** | Historical record | Permanent | Slow |
---
## Promotion Criteria
A memory is promoted from Episodic to Semantic when:
- Access count > PROMOTION_THRESHOLD
- Importance score > 0.8
- Referenced by multiple other memories
- Tagged as "critical" or "permanent"
---
## Archive Criteria
A memory is archived when:
- Age > ARCHIVE_AGE
- Access count = 0
- Importance score < 0.3
- Marked as "deprecated"
---
## Output Example
```markdown
# Memory Consolidation Report
**Started:** 2026-03-29T04:25:00Z
**Duration:** 45 seconds
---
## Statistics
| Metric | Before | After | Change |
|--------|--------|-------|--------|
| Total Memories | 1,247 | 1,251 | +4 |
| Episodic | 892 | 847 | -45 |
| Semantic | 312 | 358 | +46 |
| Archived | 43 | 46 | +3 |
| Avg Importance | 0.62 | 0.68 | +0.06 |
---
## Promotions (46)
1. **"pgvector hybrid search implementation"** - Accessed 15 times
2. **"User prefers detailed code comments"** - Importance 0.95
3. **"A2A protocol message format"** - Referenced by 8 memories
...
## Archives (3)
1. **"Initial project setup notes"** - Age: 45 days, Access: 0
2. **"Deprecated API endpoint"** - Marked deprecated
3. **"Duplicate: session log"** - Merged with primary
---
## Decay Applied
- 234 memories had importance decayed
- 12 memories boosted due to recent access
- 5 duplicates removed
---
## Recommendations
1. Consider promoting "consciousness emulation framework" - trending topic
2. Archive "old deployment method" - no longer relevant
3. Create semantic link: "memory" <-> "consciousness" <-> "persistence"
---
*Consolidation complete. Memory health optimized.*
```
---
## Integration Points
- **Historian Agent:** Primary consumer of consolidation reports
- **Dreamer Agent:** Uses consolidated memories for insights
- **Memory System:** Direct database operations
- **Knowledge Graph:** Updates relationships
---
*Memory Consolidation - Where experience becomes knowledge.*