Skip to content

Latest commit

Β 

History

106 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⬑ Cleo

version python license

Multi-agent system that plans, executes, and quality-checks your tasks β€” with on-demand agent lifecycle, hybrid memory, and structured protocols.

Three specialized agents (Leo 🧠 planner, Jerry 🀚 executor, Alic πŸ‘οΈ reviewer) collaborate via file-backed coordination, self-claim tasks, peer-review outputs, and evolve on performance drops. LazyRuntime starts agents on demand, saving ~600MB when idle.


Architecture

User ──► Telegram / Discord / 飞书 / Slack / HTTP API / Dashboard
              β”‚
              β–Ό
         Orchestrator
         β”œβ”€ TaskRouter ──► DIRECT_ANSWER (Leo only)
         β”‚                 MAS_PIPELINE  (Leo β†’ Jerry β†’ Alic β†’ Leo)
         β”œβ”€ LazyRuntime ── on-demand agent processes
         └─ TaskBoard ──── file-locked JSON state machine
              β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
     β–Ό        β–Ό        β–Ό
   Leo 🧠  Jerry 🀚  Alic πŸ‘οΈ    (independent OS processes)
     β”‚        β”‚        β”‚
     β–Ό        β–Ό        β–Ό
   MiniMax LLM Β· HybridMemory Β· EpisodicMemory Β· ContextBus

Agent Roles

Agent Role Tools Model
Leo Planner β€” route, decompose, synthesize minimal MiniMax-M2.5
Jerry Executor β€” code, search, build coding MiniMax-M2.5
Alic Reviewer β€” 5-dimension scoring, quality reports minimal MiniMax-M2.5

Install

curl -fsSL https://raw.githubusercontent.com/createpjf/cleo-dev/main/install.sh | bash
# or
git clone https://github.com/createpjf/cleo-dev.git && cd cleo-dev && bash setup.sh

Quick Start

cleo                   # interactive chat
cleo run "your task"   # one-shot
cleo gateway start     # dashboard at http://127.0.0.1:19789
cleo doctor            # system health check

Core Systems

Runtime Abstraction (core/runtime/)

Three modes, switchable via config/agents.yaml:

Mode How it works Status
lazy Only always_on agents start; others launch on demand when TaskBoard has matching pending tasks. Idle agents auto-stop after idle_shutdown seconds. Active
process One mp.Process per agent, all start upfront. Stable
in_process asyncio.Task per agent, single process. Experimental

TaskBoard (core/task_board.py)

File-locked JSON (.task_board.json) with state machine:

pending β†’ claimed β†’ review β†’ completed
                      ↓
                  critique β†’ claimed (rework)

Role-based routing via _ROLE_TO_AGENTS mapping. Timeout recovery: claimed > 180s or review > 300s β†’ auto-reset to pending.

Structured Protocols (core/protocols.py)

  • SubTaskSpec β€” Leo β†’ Jerry task ticket: objective, constraints, tool_hint, complexity
  • CritiqueSpec β€” Alic's 5-dimension review: accuracy (30%), completeness (20%), technical (20%), calibration (20%), efficiency (10%)
  • TaskRouter β€” Heuristic classifier: signal words β†’ DIRECT_ANSWER vs MAS_PIPELINE

Memory System

Layer Module Description
Hybrid Search adapters/memory/hybrid.py ChromaDB vectors + self-contained BM25 with RRF fusion
Episodic Memory adapters/memory/episodic.py 3-layer progressive: L0 atomic (~100 tok) β†’ L1 overview (~500 tok) β†’ L2 full detail
Knowledge Base adapters/memory/knowledge_base.py Shared Zettelkasten-style notes + insights
Context Bus core/context_bus.py 4-layer KV store (TASK/SESSION/SHORT/LONG) with TTL
Memory Consolidation adapters/memory/consolidator.py 3-phase pipeline: cluster old episodes (>3d) β†’ compress β†’ promote to KB

Episode Scoring

Two-stage quality scoring for every task:

  1. Baseline β€” Agent self-assigns at episode creation (success=8, partial=5, other=2)
  2. Critique backfill β€” Alic's score retroactively written to evaluated agent's episode via update_episode_score()

SSE Streaming (core/task_board.py + core/gateway.py)

Real-time token streaming for chat responses:

  • Per-task .stream files with lockless append + cursor-based reads
  • GET /v1/stream/:task_id β€” Server-Sent Events endpoint
  • Auto-cleanup on task complete/fail/cancel

Dashboard (core/dashboard.html)

Web UI at http://127.0.0.1:19789:

  • Session sidebar β€” multi-session conversation management
  • KB grid β€” horizontal 2-column layout with scrollable cards
  • Tab badges β€” live count indicators on Episodes/Cases/KB tabs
  • Episode table β€” score + timestamp columns
  • Daily log β€” auto-filters tool call artifacts
  • SSE streaming β€” real-time token-by-token chat display

Tools (37 tools Γ— 10 groups)

web Β· fs Β· memory Β· task Β· automation Β· skill Β· browser Β· media Β· messaging Β· a2a

Access control: profiles (minimal / coding / full) + per-agent allow/deny lists. Audit log at .logs/tool_audit.log.

generate_doc supports 8 output formats: PDF, DOCX, XLSX, PPTX, CSV, TXT, MD, HTML.

Channels

Channel Auth Config
Telegram Pairing code TELEGRAM_BOT_TOKEN
Discord Pairing code DISCORD_BOT_TOKEN
Feishu Pairing code FEISHU_APP_ID + FEISHU_APP_SECRET
Slack Pairing code SLACK_BOT_TOKEN + SLACK_APP_TOKEN

Reputation (reputation/scorer.py)

5-dimension EMA scoring: new = 0.3 Γ— signal + 0.7 Γ— old. Composite = weighted sum. Optional blockchain sync to ERC-8004 registry.

Provider Router (core/provider_router.py)

Cross-provider LLM failover: MiniMax β†’ OpenAI β†’ Ollama. Strategies: latency / cost / preference / round_robin. Circuit breaker per provider.


API

Gateway on port 19789 (+ WebSocket on 19790). Auth: Authorization: Bearer <token>.

Method Endpoint Description
POST /v1/task Submit task
GET /v1/task/:id Task status
GET /v1/status Full task board
GET /v1/scores Reputation scores
GET /v1/agents Agent info
GET /v1/doctor Health check
GET /v1/skills Skill list
GET /v1/usage Token usage
GET /v1/memory/* Memory status / episodes / cases
GET /v1/chain/* Blockchain status / balance
POST /v1/cron Create scheduled job
GET /v1/stream/:id SSE token stream
GET/POST /v1/sessions Dashboard sessions
GET/PUT/DELETE /v1/sessions/:id Session CRUD
GET /health Gateway health

30+ endpoints total β€” see ARCHITECTURE.md for the full list.


Configuration

All config in config/agents.yaml:

runtime:
  mode: lazy
  always_on: [leo]
  idle_shutdown: 300

llm:
  provider: minimax

memory:
  backend: hybrid
  embedding:
    provider: chromadb_default
  episodic:
    enabled: true
  knowledge_base:
    enabled: true

channels:
  telegram:
    enabled: true
    auth_mode: pairing

See ARCHITECTURE.md for full config reference.


Project Structure

cleo-dev/
β”œβ”€β”€ main.py                    # CLI entry
β”œβ”€β”€ config/agents.yaml         # All configuration
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ orchestrator.py        # Task lifecycle engine (~1900 lines)
β”‚   β”œβ”€β”€ agent.py               # BaseAgent + AgentConfig
β”‚   β”œβ”€β”€ runtime/               # ProcessRuntime / LazyRuntime / InProcessRuntime
β”‚   β”œβ”€β”€ task_board.py          # File-locked task state machine
β”‚   β”œβ”€β”€ context_bus.py         # Layered KV store
β”‚   β”œβ”€β”€ protocols.py           # SubTaskSpec, CritiqueSpec, ToolCategory
β”‚   β”œβ”€β”€ task_router.py         # DIRECT_ANSWER vs MAS_PIPELINE
β”‚   β”œβ”€β”€ tools.py               # 37 built-in tools
β”‚   β”œβ”€β”€ gateway.py             # HTTP REST API (30+ endpoints)
β”‚   β”œβ”€β”€ ws_gateway.py          # WebSocket 1Hz state push
β”‚   β”œβ”€β”€ provider_router.py     # Cross-provider LLM failover
β”‚   β”œβ”€β”€ cron.py                # Scheduled jobs
β”‚   └── doctor.py              # Health check + auto-repair
β”œβ”€β”€ adapters/
β”‚   β”œβ”€β”€ llm/minimax.py         # MiniMax SSE streaming + truncation recovery
β”‚   β”œβ”€β”€ memory/                # hybrid, episodic, embedding, consolidator
β”‚   β”œβ”€β”€ channels/              # manager, telegram, discord, feishu, slack
β”‚   └── memo/                  # Memo Protocol integration
β”œβ”€β”€ reputation/
β”‚   β”œβ”€β”€ scorer.py              # 5-dim EMA scoring
β”‚   └── textgrad.py            # TextGrad critique β†’ skill patches
β”œβ”€β”€ skills/                    # 56+ hot-reload markdown skills
β”œβ”€β”€ tests/                     # 399 tests
β”œβ”€β”€ cli/memo_cmd.py            # Memo CLI
└── docs/                      # Architecture + product docs
    β”œβ”€β”€ ARCHITECTURE.md
    β”œβ”€β”€ Cleo_V0.01_Product_Logic.md
    β”œβ”€β”€ Cleo_V0.01_Product_Narrative.md
    └── Cleo_V0.01_Technical_Architecture.md

Requirements

  • Python 3.11+
  • One LLM API key (MiniMax, OpenAI, or local Ollama)

Core: pyyaml filelock requests chromadb websockets Optional: python-telegram-bot Β· discord.py Β· web3 Β· rich Β· python-pptx Β· slack-sdk


Docs


License

MIT

About

Multi-agent orchestration framework with reputation-driven evolution. Process-native, file-backed coordination, 5D reputation scoring, 3-layer episodic memory, on-chain ERC-8004 identity.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages