SonicBotMan
SoloFlow
Python

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.

Last updated Jun 17, 2026
100
Stars
7
Forks
1
Issues
0
Stars/day
Attention Score
33
Language breakdown
No language data available.
โ–ธ Files click to expand
README

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.

MIT License Tests Python Dependencies


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_call events 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

ยฉ 2026 GitRepoTrend ยท SonicBotMan/SoloFlow ยท Updated daily from GitHub