Complete ETCLOVG framework for AI Agent workflows - DAG+FSM orchestration, Ebbinghaus memory, discipline routing, skill evolution, trace system, governance. 80+ tests, zero deps, 7/7 layers.
SoloFlow โก
The Brain Behind AI Workflow Orchestration
Turn chaotic multi-step AI tasks into structured, observable, retryable workflows โ with cognitive memory, discipline-aware routing, and automatic skill evolution.
Why SoloFlow?
AI Agents fail in predictable ways:
| Problem | SoloFlow Solution | |---------|-------------------| | No Observability โ 8-step chain fails at step 5, no trace, no resume | Trace System โ nested spans, token tracking, JSON export | | Amnesiac Agents โ every invocation starts from zero | Ebbinghaus Memory โ three-tier memory with forgetting curve | | One-Size-Fits-All โ simple tasks waste deep reasoning | Discipline Routing โ auto-classify to quick/deep/visual/ultrabrain | | No Learning โ repeated patterns stay manual | Skill Evolution โ observe โ detect โ package โ install |
Four Pillars
1. DAG + FSM Hybrid Architecture
expressiveness(DAG) + rigor(FSM) = reliability
- Kahn algorithm for topological sorting
- Parallel execution where possible, sequential where required
- Automatic retry with exponential backoff
2. Cognitive Memory System
R(t) = base ร e^(-t / stability)
- Working Memory โ LRU cache for current context
- Episodic Memory โ SQLite + FTS5 for event history
- Semantic Memory โ pattern extraction and template storage
- Ebbinghaus Forgetting Curve โ automatic memory consolidation
3. Discipline-Aware Routing
quick (~2s) โ deep (~30s) โ visual (~30s) โ ultrabrain (~120s)
- Auto-classify tasks by complexity
- Route to appropriate agent discipline
- Fallback to default when uncertain
4. Skill Auto-Evolution
observe โ fingerprint โ detect โ package โ install
- Passive observation via
hermes.on("tool_call")event hooks - Multi-step workflow aggregation โ consecutive tool calls grouped automatically
- Rich step descriptions โ extracts key args into human-readable steps
- 4-dimension quality scoring โ reliability, efficiency, maturity, reusability
- Auto-generate SKILL.md + plugin.py and install to
~/.hermes/skills/
Quick Start
git clone https://github.com/SonicBotMan/SoloFlow.git
cd SoloFlow
Pure Python, zero dependencies
Create and Execute a Workflow
import asyncio
from pathlib import Path
from hermesplugin.store.sqlitestore import SQLiteStore
from hermesplugin.services.workflowservice import WorkflowService
from hermes_plugin.services.scheduler import Scheduler
async def main(): store = SQLiteStore(Path("soloflow.db")) store.initialize() ws = WorkflowService(store) ws.set_scheduler(Scheduler(store, ws))
# Create a DAG workflow with parallel branches wf = await ws.create_workflow( name="research-report", description="่กไธ่ฐ็ ๆฅๅ", steps=[ {"id": "topic", "name": "้้ข", "discipline": "deep", "prompt": "็กฎๅฎ็ ็ฉถๆนๅ"}, {"id": "search_a", "name": "ๅญฆๆฏๆ็ดข", "discipline": "quick", "prompt": "ๆ็ดขๅญฆๆฏ่ตๆ"}, {"id": "search_b", "name": "่กไธๆ็ดข", "discipline": "quick", "prompt": "ๆ็ดข่กไธๆฅๅ"}, {"id": "outline", "name": "ๅคง็บฒ", "discipline": "deep", "prompt": "ๆด็ๅคง็บฒ"}, {"id": "write", "name": "ๆฐๅ", "discipline": "deep", "prompt": "ๅๆญฃๆ"}, {"id": "review", "name": "ๅฎกๆ ก", "discipline": "quick", "prompt": "ๅฎกๆ กๅๅธ"}, ], edges=[ ("topic", "searcha"), ("topic", "searchb"), # parallel branches ("searcha", "outline"), ("searchb", "outline"), # merge ("outline", "write"), ("write", "review"), ], )
await ws.start_workflow(wf["id"]) status = await ws.get_status(wf["id"]) print(f"State: {status['state']}, Progress: {status['progress']}")
asyncio.run(main())
SoloFlow Plugin โ Automatic Skill Detection
SoloFlow includes a Hermes plugin that watches your workflows and automatically generates reusable skills.
Install
bash install.sh
Or manually:
cp plugins/soloflow.py ~/.hermes/plugins/
cp -r skills/meta/soloflow ~/.hermes/skills/meta/
cp -r evolution ~/.hermes/plugins/
hermes skills reload
How It Works
tool_call events โ WorkflowBuilder (aggregate) โ PatternDetector (fingerprint)
โ
Pattern (2+ occurrences)
โ
SkillPackager โ SKILL.md + plugin.py
โ
QualityScorer โ grade (A-F)
- WorkflowBuilder accumulates consecutive
tool_callevents into multi-step workflows (auto-flushes after 60s idle) - PatternDetector fingerprints workflow structure (step names + edges + tools) and groups identical executions
- SkillPackager generates Hermes-native SKILL.md and plugin.py with rich step descriptions
- QualityScorer rates skills on 4 dimensions: reliability, efficiency, maturity, reusability
Commands
| Command | Description | |---------|-------------| | /soloflow begin [name] | Mark workflow start | | /soloflow end [name] | Mark workflow end, record pattern | | /soloflow propose | Analyze session, propose top skill | | /soloflow generate [name] | Generate and install a skill | | /soloflow list | List detected patterns | | /soloflow skills | List generated skills | | /soloflow status | Show tracking status | | /soloflow queue | Show pending proposals | | /soloflow clear | Clear session log |
Natural Language Triggers
Tell Hermes naturally โ no commands needed:
- "Save this as a skill"
- "Remember how to do this"
- "Turn this workflow into a reusable skill"
- "I always do this manually..."
- "Let's automate this"
DAG Engine Integration
When a workflow completes through the DAG engine, SoloFlow automatically feeds the execution data to PatternDetector:
from hermesplugin.services.workflowservice import WorkflowService
ws = WorkflowService(store) ws.setoncomplete(lambda wfid, success, duration, wfdef: ...)
Completed workflows are automatically recorded for pattern detection
MCP Tools
5 MCP tools for integration with AI agents:
| Tool | Description | |------|-------------| | soloflow_create | Create a new workflow with steps and DAG edges | | soloflow_run | Execute a workflow with DAG parallelism | | soloflow_status | Get workflow status and progress | | soloflow_list | List workflows with optional state filter | | soloflow_cancel | Cancel a running workflow |
# config.yaml
tools:
mcp:
servers:
soloflow:
command: python
args: ["-m", "mcp.server"]
Trace System
Track every workflow execution with nested spans:
from trace.collector import TraceCollector
from trace.exporter import TraceExporter
from trace.span import SpanStatus, TokenUsage
collector = TraceCollector(db_path=Path("traces.db")) exporter = TraceExporter(collector)
span = collector.startspan(operation="workflow", nodename="research") step = collector.start_span( operation="step", node_name="search", parentid=span.spanid, traceid=span.traceid, ) collector.finish_span( step.span_id, status=SpanStatus.SUCCESS, tokenusage=TokenUsage(prompttokens=100, completion_tokens=200), ) print(exporter.formattracetree(span.trace_id))
Ebbinghaus Memory
Memory system with automatic consolidation:
from memory.forgetting.consolidation import MemoryConsolidator
consolidator = MemoryConsolidator(db_path=Path("memory.db"))
await consolidator.add_memory( key="user_preference", content={"theme": "dark"}, tier="episodic", stability=1.0, )
entry = await consolidator.getmemory("userpreference") stats = await consolidator.consolidate_all()
Human-in-the-Loop
Approval system for sensitive workflow steps:
from hermes_plugin.human import HumanApprovalManager
manager = HumanApprovalManager() request = manager.create_request( workflowid="wf123", step_id="review", prompt="Please review and approve", ) result = await manager.waitforapproval(request.request_id)
Governance
Role-based permissions, audit logging, and policy enforcement:
from hermes_plugin.governance import GovernanceManager, Permission
governance = GovernanceManager() governance.grantpermission("user1", Permission.EXECUTE) hasperm = governance.checkpermission("user_1", Permission.EXECUTE) governance.log_audit( action=AuditAction.WORKFLOW_STARTED, workflowid="wf123", userid="user1", )
Architecture
SoloFlow/
โโโ hermes-plugin/ # Core engine
โ โโโ core/ # DAG + FSM
โ โโโ services/ # WorkflowService + Scheduler
โ โโโ memory/ # Three-tier memory
โ โโโ store/ # SQLite persistence
โ โโโ checkpoint/ # LangGraph: resumable execution
โ โโโ dispatch/ # DeerFlow: sub-agent dispatch
โ โโโ roles/ # CrewAI: permission boundaries
โ โโโ output/ # PydanticAI: typed contracts
โ โโโ boundary/ # Mastra: workflow vs agent control
โ โโโ handoff/ # OpenAI Agents SDK: control transfer
โ โโโ session/ # Google ADK: session + context budget
โ โโโ hooks/ # Claude Agent SDK: lifecycle hooks
โ โโโ pipeline/ # Haystack: component orchestration
โ โโโ context/ # Microsoft: pluggable context providers
โ โโโ governance/ # Permissions + audit
โ โโโ human/ # Human approval
โ โโโ visualization/ # Mermaid diagrams
โโโ plugins/ # Hermes plugins
โ โโโ soloflow.py # Skill detection plugin
โโโ skills/ # Hermes skills
โ โโโ meta/soloflow/ # AI behavior guidance
โโโ evolution/ # Skill auto-evolution
โ โโโ pattern_detector.py # Fingerprint + detect
โ โโโ skill_packager.py # Generate SKILL.md + plugin.py
โ โโโ quality_scorer.py # 4-dimension scoring
โโโ mcp/ # MCP Tool Layer
โโโ trace/ # Observability
โโโ memory/forgetting/ # Ebbinghaus forgetting curve
โโโ routing/ # Discipline-aware routing
โโโ install.sh # One-command installer
โโโ tests/ # Test suite (68 tests)
ETCLOVG Coverage
| Layer | Component | Status | |-------|-----------|--------| | T | MCP Tool Layer | โ 5 tools | | C | Ebbinghaus Memory + Context Providers | โ Forgetting curve + pluggable context | | L | DAG + FSM Engine + Pipeline | โ Core + Haystack-style components | | O | Trace System + Hooks | โ Nested spans + lifecycle hooks | | V | Quality Scorer + Output Validation | โ 4-dimension scoring + typed contracts | | E | Execution + Dispatch + Handoff | โ Sub-agent dispatch + control transfer | | G | Governance + Roles + Session + Boundary | โ Role permissions + session mgmt |
Coverage: 7/7 layers (100%)
Testing
# Run all tests
python3.11 -m pytest tests/ -v
Run specific module
python3.11 -m pytest tests/evolution/ -v
python3.11 -m pytest tests/hermes-plugin/ -v
python3.11 -m pytest tests/mcp/ -v
68 tests, all passing.
Contributing
See CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE
Acknowledgments
- Inspired by LangGraph, AutoGen, and the Agent Harness Engineering research
- Built with โค๏ธ for the AI Agent community