first-fluke/cratos

AI assistant that learns your workflows — auto-generates skills, routes to the cheapest LLM, and replays every execution. Telegram · Slack · Discord · Matrix. One Rust binary, zero setup.

Rust

4

405 commits

updated Mar 12, 2026

See the code
ai-agents
ai-assistant
automation
developer-tools
discord-bot
event-sourcing
llm
matrix
model-routing
multi-agent
openai
personal-assistant
replay
rust
skill-generation
slack-bot
sqlite
telegram-bot
tokio
workflow-automation

README

Cratos - AI-Powered Personal Assistant

Cratos is a Rust-based AI assistant that understands natural language commands from Telegram/Slack, gathers information, executes tasks, and reports results.

One-Line Installation

macOS / Linux

curl -sSL https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.sh | sh

Windows (PowerShell)

irm https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.ps1 | iex

The installer automatically:

  • Downloads the appropriate binary for your platform
  • Installs to your PATH
  • Launches the setup wizard

Key Features

  • Lightweight: Runs immediately with embedded SQLite (~/.cratos/cratos.db)
  • Automatic Skill Generation: Learns usage patterns to automatically create workflow skills
  • Multi-LLM Support: OpenAI, Anthropic, Gemini, DeepSeek, Groq, Fireworks, SiliconFlow, GLM, Qwen, Moonshot, Novita, OpenRouter, Ollama (13 providers, 6 free)
  • Smart Routing: Automatic model selection by task type reduces costs by 70%
  • Free Model Support: Free LLMs: Z.AI GLM-4.7-Flash (unlimited), Gemini Flash, Groq, Novita, SiliconFlow
  • Replay Engine: All executions stored as events, timeline view and replay
  • Tool System: 23 built-in tools (file ops, HTTP, Git/GitHub, shell exec, PTY bash, browser, web search, agent CLI, WoL, config, image generation, file transfer, native app automation) + MCP extensibility
  • Channel Adapters: Telegram, Slack, Discord, Matrix, WhatsApp — with slash commands, DM policy, EventBus notifications
  • Chrome Extension: Browser control via Chrome extension + WebSocket gateway protocol
  • Graph RAG Memory: Cross-session conversation memory with entity graph + hybrid vector search
  • TUI Chat: ratatui-based interactive terminal with markdown rendering, mouse scroll, input history, multi-provider quota display
  • Voice Control: STT (Whisper API / local Whisper) + TTS (Edge TTS) + VAD (Silero), supports ko/en/ja/zh
  • Web Search: Built-in DuckDuckGo search (no API key required)
  • MCP Integration: Auto-discovery of MCP servers from .mcp.json, SSE/stdio support
  • Proactive Scheduler: Cron, interval, one-time, file-watch, and system-event triggers
  • Security: Auth middleware (HMAC/JWT/API Key), rate limiting, Docker sandbox, credential encryption, prompt injection defense
  • Olympus OS: Mythology-based 3-layer agent organization (Pantheon/Decrees/Chronicles)
  • ACP Bridge: IDE integration via stdin/stdout JSON-lines protocol
  • Device Pairing: PIN-based mobile pairing for remote device management
  • Remote Development: Issue → PR end-to-end automation (cratos develop)

System Requirements

ItemMinimum¹RecommendedOptimal
OSmacOS 11+, Windows 10, Ubuntu 20.04+macOS 12+, Windows 10+, Ubuntu 22.04+Latest
CPU1 core1 core2+ cores
RAM256MB (runtime) / 2GB (build)1GB (runtime) / 4GB (build)4GB+
Disk100MB1GB5GB+
Rust1.88+1.88+Latest stable
Docker-OptionalLatest

¹ Minimum: With embeddings disabled (cargo build --no-default-features). Semantic search unavailable.

Note: No PostgreSQL or Docker required. Data is stored in ~/.cratos/cratos.db (SQLite).

Ollama Local LLM (Optional)

ModelRAMVRAM (GPU)
Llama 3.2 3B4GB4GB
Llama 3.2 7B8GB8GB
Llama 3.1 70B48GB48GB

Note: No GPU required when using external LLM APIs (OpenAI, Anthropic, etc.)

Quick Start

# macOS / Linux
curl -sSL https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.ps1 | iex

The setup wizard will guide you through:

  1. Creating a Telegram bot
  2. Choosing an AI provider (free options available)
  3. Testing your configuration

Option 2: Manual Setup

# Clone the repository
git clone https://github.com/first-fluke/cratos.git
cd cratos

# Run the setup wizard
cargo run -- init

# With Korean language
cargo run -- init --lang ko

Option 3: Build from Source

# Create environment file
cp .env.example .env

# Edit .env file (add your API keys)
vim .env

# Build and run
cargo build --release
cargo run --release

# Health check
curl http://localhost:19527/health

Data is automatically stored in ~/.cratos/cratos.db.

Setup

CommandDescription
cratos initUnified interactive setup wizard (auto-detects language)
cratos init --lang koSetup wizard in Korean

Project Structure

cratos/
├── crates/
│   ├── cratos-core/      # Orchestration engine, security, credentials, shutdown
│   ├── cratos-channels/  # Channel adapters (Telegram, Slack, Discord, Matrix, WhatsApp)
│   ├── cratos-tools/     # Tool registry, sandbox, MCP client, browser relay
│   ├── cratos-llm/       # LLM providers, token counting, ONNX embeddings, quota tracking
│   ├── cratos-replay/    # Event logging and replay (SQLite)
│   ├── cratos-skills/    # Automatic skill generation system
│   ├── cratos-search/    # Vector search (usearch), semantic indexing
│   ├── cratos-memory/    # Graph RAG conversation memory (entity graph + hybrid search)
│   ├── cratos-crypto/    # Cryptographic utilities
│   ├── cratos-audio/     # Voice control (STT/TTS, optional)
│   └── cratos-canvas/    # Live Canvas (future)
├── config/
│   ├── default.toml      # Default configuration
│   ├── pantheon/         # Persona TOML files (14 personas: 5 core + 9 extended)
│   └── decrees/          # Laws, ranks, development rules
├── src/
│   ├── main.rs           # Application entry point
│   ├── cli/              # CLI commands (init, doctor, quota, tui, skill, data, acp, browser-ext, ...)
│   ├── api/              # REST API (config, tools, executions, scheduler, quota, sessions, browser)
│   ├── websocket/        # WebSocket handlers (chat, events, gateway)
│   └── server.rs         # Server initialization

~/.cratos/                # Data directory (auto-created)
├── cratos.db             # SQLite main DB (events, execution history)
├── skills.db             # SQLite skills DB (skills, patterns)
├── memory.db             # SQLite Graph RAG memory DB
├── vectors/              # HNSW vector index (usearch)
│   └── memory/           # Memory embedding vectors
└── chronicles/           # Achievement records per persona

Configuration

Environment Variables

VariableDescriptionRequired
REDIS_URLRedis connection URL (for sessions, uses memory if not set)
TELEGRAM_BOT_TOKENTelegram bot token
SLACK_BOT_TOKENSlack bot token
LLM API Keys (at least one)
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GEMINI_API_KEYGoogle Gemini API key (or GOOGLE_API_KEY) (recommended)
GOOGLE_API_KEYGoogle Gemini API key (alias)
ZHIPU_API_KEYZ.AI GLM API key (free Flash models)
DASHSCOPE_API_KEYAlibaba Qwen API key
OPENROUTER_API_KEYOpenRouter API key
NOVITA_API_KEYNovita AI API key (free)
ELEVENLABS_API_KEYElevenLabs TTS API key (optional)
Configuration Overrides
CRATOS_LLM__DEFAULT_PROVIDEROverride default LLM provider (double underscore)

Note: DATABASE_URL is no longer needed. Uses embedded SQLite.

Configuration Files

Default settings are in config/default.toml. Create config/local.toml to customize for your local environment.

LLM Providers

ProviderModelsFeatures
OpenAIGPT-5, GPT-5.2, GPT-5-nanoLatest generation, coding
AnthropicClaude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4.5Excellent code generation
GeminiGemini 3 Pro, Gemini 3 Flash, Gemini 2.5 ProLong context, multimodal, Standard API only (safe)
GLMGLM-4.7, GLM-4.7-Flash (free), GLM-5ZhipuAI models
QwenQwen3-Max, Qwen3-Plus, Qwen3-Flash, Qwen3-CoderMultilingual, coding, reasoning
DeepSeekDeepSeek-V3.2, DeepSeek-R1Ultra low cost, reasoning

Free/Low-Cost Providers

ProviderModelsLimits
Z.AI (GLM)GLM-4.7-Flash, GLM-4.5-FlashFree, no daily limit
GeminiGemini 2.0 FlashFree (1,500 RPD)
GroqLlama 3.1 8B, GPT-OSS 20BFree tier available
NovitaQwen2.5-7B, GLM-4-9BFree signup
SiliconFlowQwen2.5-7BFree models available
OllamaAll local modelsUnlimited (local)

Model Routing

Automatic model selection based on task type:

Task TypeModel TierExample Models
ClassificationFastGPT-5-nano, Claude Haiku 4.5
SummarizationFastGPT-5-nano, Gemini 2.0 Flash
ConversationStandardGPT-5, Claude Sonnet 4.5
CodeGenerationStandardGPT-5, Claude Sonnet 4.5
PlanningPremiumGPT-5.2, Claude Opus 4.5

Olympus OS (Agent Organization)

Cratos features a mythology-based 3-layer agent organization system:

LayerNamePurpose
WHOPantheon14 agent personas (5 core + 9 extended)
HOWDecreesLaws, ranks, development rules
WHATChroniclesAchievement records and evaluations

Core Personas

RoleNameDomain
OrchestratorCratosSupreme commander (Lv255)
PMAthenaStrategy, planning (Lv3)
DEVSindriDevelopment, implementation (Lv1)
QAHeimdallQuality, security (Lv2)
RESEARCHERMimirResearch, analysis (Lv4)

Extended Personas

RoleNameDomain
POOdinProduct owner (Lv5)
HRHestiaPeople, organization (Lv2)
BANornsBusiness analysis (Lv3)
UXApolloUX design (Lv3)
CSFreyaCustomer support (Lv2)
LEGALTyrLegal, compliance (Lv4)
MARKETINGNikeMarketing (Lv2)
DEVOPSThorInfrastructure, ops (Lv3)
DEVBrokDevelopment (Lv1)

@mention Routing

Route tasks to specific personas using @mentions:

@athena Plan this sprint          # PM - Strategy
@sindri Implement the API         # DEV - Development
@heimdall Review security         # QA - Quality
@mimir Research this technology   # RESEARCHER - Analysis
@cratos Summarize the situation   # Orchestrator

Response format: [Persona LvN] Per Laws Article N...

CLI Commands

# Setup
cratos init                       # Interactive setup wizard (auto-detects language)
cratos init --lang ko             # Setup wizard in Korean

# System
cratos serve                      # Start the server
cratos doctor                     # Run diagnostics
cratos quota                      # Show provider quota/cost status
cratos quota --watch              # Live-refresh mode (every 2s)
cratos quota --json               # JSON output for scripting
cratos tui                        # Launch interactive TUI chat
cratos tui --persona sindri       # TUI with specific persona
cratos acp                        # Start ACP bridge (IDE integration)

# Voice
cratos voice                      # Start voice assistant (default: ko)
cratos voice --lang en            # Voice assistant in English

# Remote Development
cratos develop --repo user/repo   # Issue → PR automation
cratos develop --dry-run          # Preview without changes

# Device Pairing
cratos pair start                 # Start PIN-based pairing
cratos pair devices               # List paired devices
cratos pair unpair <device>       # Unpair a device

# Browser
cratos browser tabs               # List open browser tabs
cratos browser open <url>         # Open a URL
cratos browser screenshot         # Capture screenshot
cratos browser extension install  # Install Chrome extension

# Security
cratos security audit             # Run security audit

# Skills
cratos skill list                 # List all skills
cratos skill show <name>          # Show skill details
cratos skill enable <name>        # Enable a skill
cratos skill disable <name>       # Disable a skill
cratos skill export <name>        # Export a skill to file
cratos skill import <file>        # Import a skill from file
cratos skill bundle               # Bundle skills for sharing
cratos skill search <query>       # Search remote skill registry
cratos skill install <name>       # Install from registry
cratos skill publish <name>       # Publish to registry

# Data Management
cratos data stats                 # Show database statistics
cratos data clear sessions        # Clear session data
cratos data clear memory          # Clear Graph RAG memory
cratos data clear history         # Clear execution history
cratos data clear chronicles      # Clear achievement records
cratos data clear vectors         # Clear vector indices
cratos data clear skills          # Clear learned skills

# Pantheon (Personas)
cratos pantheon list              # List personas
cratos pantheon show sindri       # Show persona details
cratos pantheon summon sindri     # Summon (activate) a persona
cratos pantheon dismiss           # Dismiss active persona

# Pantheon Skill Management
cratos pantheon skill list <persona>       # List skills bound to persona
cratos pantheon skill show <persona> <skill>   # Show binding details
cratos pantheon skill claim <persona> <skill>  # Manually assign skill
cratos pantheon skill release <persona> <skill> # Release skill
cratos pantheon skill leaderboard <skill>  # Skill leaderboard
cratos pantheon skill summary <persona>    # Persona skill summary
cratos pantheon skill sync <persona>       # Sync proficiency to chronicle

# Decrees (Rules)
cratos decrees show laws          # Show laws
cratos decrees show ranks         # Show rank system
cratos decrees show warfare       # Show development rules
cratos decrees show alliance      # Show collaboration rules
cratos decrees show tribute       # Show reward/cost rules
cratos decrees show judgment      # Show evaluation framework
cratos decrees show culture       # Show culture/values
cratos decrees show operations    # Show operational procedures
cratos decrees validate           # Validate rule compliance

# Chronicles (Achievement Records)
cratos chronicle list             # List achievement records
cratos chronicle show sindri      # Show individual record
cratos chronicle log "message"    # Add log entry
cratos chronicle promote sindri   # Request promotion
cratos chronicle clean            # Clean up stale records

Security Features

Security-first by design — Built from the ground up with security as a core principle, not an afterthought.

  • Memory-safe foundation: Written in Rust with #![forbid(unsafe_code)] — no buffer overflows, no use-after-free
  • Zero plaintext secrets: All credentials encrypted via OS keychain (Keychain, Secret Service, Credential Manager)
  • Default isolation: Sandbox enabled by default with network blocked, not opt-in
  • Built-in threat detection: 20+ prompt injection patterns detected and blocked automatically
  • Tool risk classification: Every tool has explicit risk levels with appropriate safeguards
  • Input/output validation: All user inputs and LLM outputs are validated before execution

Docker Sandbox

Dangerous tools run in isolated Docker containers:

[security.sandbox]
default_network = "none"  # Block network
max_memory_mb = 512       # Memory limit
max_cpu_percent = 50      # CPU limit

Credential Encryption

API keys are securely stored in OS keychain:

  • macOS: Keychain
  • Linux: Secret Service (GNOME Keyring)
  • Windows: Credential Manager

Prompt Injection Defense

Automatically detects and blocks malicious prompts:

  • 20+ danger pattern detection
  • Input/output validation
  • Prevents sensitive information exposure

Supported Tools

Built-in Tools

ToolDescriptionRisk Level
file_readRead filesLow
file_writeWrite filesMedium
file_listList directoryLow
http_getHTTP GET requestLow
http_postHTTP POST requestMedium
execCommand execution (meta-char blocked, sandboxed)High
bashPTY-based shell (5-layer security: validation, pipeline analysis, env isolation, resource limits, output masking)High
git_statusGit status checkLow
git_commitGit commit creationMedium
git_branchGit branch managementMedium
git_diffGit diff checkLow
git_pushGit push to remoteHigh
git_cloneClone a repositoryMedium
git_logView commit historyLow
github_apiGitHub API integrationMedium
browserBrowser automation (MCP or Chrome extension)Medium
web_searchDuckDuckGo web search (no API key required)Low
agent_cliDelegate tasks to external AI agents (Claude, etc.)Medium
wolWake-on-LANMedium
configNatural language configurationMedium
send_fileSend file through messaging channelMedium
image_generateAI image generationMedium
app_controlNative app automation (macOS AppleScript/JXA)High

MCP Extension Tools

Additional tools can be auto-registered from .mcp.json:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-playwright"]
    }
  }
}

MCP tools are discovered at startup and integrated into the tool registry with a 10-second connection timeout.

REST API & WebSocket

REST Endpoints (/api/v1/*)

MethodPathDescriptionAuth
GET/healthHealth check (simple)No
GET/health/detailedDetailed health check (DB/Redis/LLM status)Yes
GET/metricsPrometheus-format metricsYes
GET/PUT/api/v1/configConfiguration read/updateYes
GET/api/v1/toolsList available toolsYes
GET/api/v1/executionsList executions (filterable, max 50)Yes
GET/api/v1/executions/{id}Execution detailsYes
GET/api/v1/executions/{id}/replayReplay events for an executionYes
POST/api/v1/executions/{id}/rerunRe-run an executionYes
GET/POST/PUT/DELETE/api/v1/scheduler/tasksScheduler task managementYes
GET/api/v1/quotaProvider quota/cost statusYes
GET/api/v1/dev/sessionsActive AI dev sessions (Claude, Gemini, Codex, Cursor)Yes
GET/api/v1/dev/sessions/{tool}Sessions filtered by toolYes
GET/POST/DELETE/api/v1/pairing/*PIN-based device pairingYes
POST/api/v1/browser/*Browser control APIYes

WebSocket Endpoints

PathDescription
/ws/chatInteractive chat
/ws/eventsEvent stream (real-time notifications)
/ws/gatewayChrome extension gateway protocol

Security Middleware

All API endpoints are protected with configurable security layers:

  • Authentication: HMAC signature, JWT token, or API key
  • Rate Limiting: Per-IP and per-user request throttling
  • Approval Nonce: One-time tokens for high-risk operations

Chrome Extension (Browser Control)

Control your Chrome browser remotely via a lightweight extension that connects through the WebSocket gateway:

Chrome Extension ←→ /ws/gateway ←→ Cratos Server ←→ BrowserRelay ←→ Tools

Features:

  • Tab management (list, open, close, activate)
  • Page navigation and content extraction
  • DOM interaction (click, type, screenshot)
  • Bidirectional JSON-RPC communication

The browser tool automatically detects whether a Chrome extension is connected and falls back to MCP-based browser automation if not.

Graph RAG Memory

Cross-session conversation memory powered by entity graph and hybrid vector search:

  • Turn Decomposition: Breaks conversations into semantic units
  • Entity Extraction: Rule-based named entity recognition
  • Graph Construction: Entities linked by co-occurrence and relationships
  • Hybrid Search: embedding_similarity * 0.5 + proximity * 0.3 + entity_overlap * 0.2

Data stored in ~/.cratos/memory.db (SQLite) and ~/.cratos/vectors/memory (HNSW index).

TUI Chat

Interactive terminal-based chat interface:

cratos tui                    # Launch TUI
cratos tui --persona athena   # Start with specific persona
FeatureDescription
Markdown RenderingRich text rendering via tui-markdown
Mouse ScrollScroll through conversation history
Input HistoryUp/Down arrow navigation (max 50 entries)
Multi-Provider QuotaReal-time quota display per provider
Keyboard ShortcutsF2: toggle mouse, Ctrl+C: quit

Voice Control

Built-in voice assistant with Speech-to-Text, Text-to-Speech, and Voice Activity Detection:

cratos voice                  # Start voice assistant (Korean)
cratos voice --lang en        # English
cratos voice --lang ja        # Japanese
cratos voice --lang zh        # Chinese
ComponentEngineNotes
STTOpenAI Whisper API / Local Whisper (candle)Local requires local-stt feature
TTSEdge TTSFree, no API key required
VADSilero VAD (ONNX)Detects speech activity

Local Whisper STT: cargo build --features local-stt (downloads model on first run)

Device Pairing

PIN-based device pairing for secure remote management:

cratos pair start             # Generate pairing PIN
cratos pair devices           # List paired devices
cratos pair unpair <device>   # Remove a paired device

Paired devices can control Cratos via REST API or WebSocket with device-level authentication.

Proactive Scheduler

Schedule automated tasks:

Trigger TypeExampleDescription
Cron0 9 * * *Daily at 9 AM
Interval{ seconds: 300, immediate: true }Every 5 minutes
OneTime{ at: "2026-03-01T10:00:00Z" }Single execution
File{ pattern: "*.json", action: "watch" }On file change
System{ metric: "cpu", threshold: 80 }On system event

Task actions: NaturalLanguage, ToolCall, Notification, Shell, Webhook.

Manage via REST API (/api/v1/scheduler/tasks) or natural language.

Testing

# Run all tests
cargo test --workspace

# Run integration tests only
cargo test --test integration_test

# Test specific crate
cargo test -p cratos-llm
cargo test -p cratos-tools
cargo test -p cratos-core

Documentation

Detailed Guides

GuideDescription
TelegramTelegram bot integration (teloxide)
SlackSlack app integration (Socket Mode / Events API)
DiscordDiscord bot integration (serenity)
WhatsAppWhatsApp integration (Baileys / Business API)
Browser AutomationMCP-based browser control + Chrome extension
Skill Auto-GenerationPattern learning and skill creation
Graceful Shutdown5-phase safe shutdown mechanism
Live CanvasReal-time visual workspace
Native AppsTauri desktop application

License

MIT

Contributing

Issues and PRs welcome.


Languages: English | 한국어

Contributors

gahyun-git

387 commits

gracefullight

17 commits

first-fluke/cratos

AI assistant that learns your workflows — auto-generates skills, routes to the cheapest LLM, and replays every execution. Telegram · Slack · Discord · Matrix. One Rust binary, zero setup.

Rust

4

405 commits

updated Mar 12, 2026

See the code
ai-agents
ai-assistant
automation
developer-tools
discord-bot
event-sourcing
llm
matrix
model-routing
multi-agent
openai
personal-assistant
replay
rust
skill-generation
slack-bot
sqlite
telegram-bot
tokio
workflow-automation

README

Cratos - AI-Powered Personal Assistant

Cratos is a Rust-based AI assistant that understands natural language commands from Telegram/Slack, gathers information, executes tasks, and reports results.

One-Line Installation

macOS / Linux

curl -sSL https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.sh | sh

Windows (PowerShell)

irm https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.ps1 | iex

The installer automatically:

  • Downloads the appropriate binary for your platform
  • Installs to your PATH
  • Launches the setup wizard

Key Features

  • Lightweight: Runs immediately with embedded SQLite (~/.cratos/cratos.db)
  • Automatic Skill Generation: Learns usage patterns to automatically create workflow skills
  • Multi-LLM Support: OpenAI, Anthropic, Gemini, DeepSeek, Groq, Fireworks, SiliconFlow, GLM, Qwen, Moonshot, Novita, OpenRouter, Ollama (13 providers, 6 free)
  • Smart Routing: Automatic model selection by task type reduces costs by 70%
  • Free Model Support: Free LLMs: Z.AI GLM-4.7-Flash (unlimited), Gemini Flash, Groq, Novita, SiliconFlow
  • Replay Engine: All executions stored as events, timeline view and replay
  • Tool System: 23 built-in tools (file ops, HTTP, Git/GitHub, shell exec, PTY bash, browser, web search, agent CLI, WoL, config, image generation, file transfer, native app automation) + MCP extensibility
  • Channel Adapters: Telegram, Slack, Discord, Matrix, WhatsApp — with slash commands, DM policy, EventBus notifications
  • Chrome Extension: Browser control via Chrome extension + WebSocket gateway protocol
  • Graph RAG Memory: Cross-session conversation memory with entity graph + hybrid vector search
  • TUI Chat: ratatui-based interactive terminal with markdown rendering, mouse scroll, input history, multi-provider quota display
  • Voice Control: STT (Whisper API / local Whisper) + TTS (Edge TTS) + VAD (Silero), supports ko/en/ja/zh
  • Web Search: Built-in DuckDuckGo search (no API key required)
  • MCP Integration: Auto-discovery of MCP servers from .mcp.json, SSE/stdio support
  • Proactive Scheduler: Cron, interval, one-time, file-watch, and system-event triggers
  • Security: Auth middleware (HMAC/JWT/API Key), rate limiting, Docker sandbox, credential encryption, prompt injection defense
  • Olympus OS: Mythology-based 3-layer agent organization (Pantheon/Decrees/Chronicles)
  • ACP Bridge: IDE integration via stdin/stdout JSON-lines protocol
  • Device Pairing: PIN-based mobile pairing for remote device management
  • Remote Development: Issue → PR end-to-end automation (cratos develop)

System Requirements

ItemMinimum¹RecommendedOptimal
OSmacOS 11+, Windows 10, Ubuntu 20.04+macOS 12+, Windows 10+, Ubuntu 22.04+Latest
CPU1 core1 core2+ cores
RAM256MB (runtime) / 2GB (build)1GB (runtime) / 4GB (build)4GB+
Disk100MB1GB5GB+
Rust1.88+1.88+Latest stable
Docker-OptionalLatest

¹ Minimum: With embeddings disabled (cargo build --no-default-features). Semantic search unavailable.

Note: No PostgreSQL or Docker required. Data is stored in ~/.cratos/cratos.db (SQLite).

Ollama Local LLM (Optional)

ModelRAMVRAM (GPU)
Llama 3.2 3B4GB4GB
Llama 3.2 7B8GB8GB
Llama 3.1 70B48GB48GB

Note: No GPU required when using external LLM APIs (OpenAI, Anthropic, etc.)

Quick Start

# macOS / Linux
curl -sSL https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/first-fluke/cratos/main/scripts/install.ps1 | iex

The setup wizard will guide you through:

  1. Creating a Telegram bot
  2. Choosing an AI provider (free options available)
  3. Testing your configuration

Option 2: Manual Setup

# Clone the repository
git clone https://github.com/first-fluke/cratos.git
cd cratos

# Run the setup wizard
cargo run -- init

# With Korean language
cargo run -- init --lang ko

Option 3: Build from Source

# Create environment file
cp .env.example .env

# Edit .env file (add your API keys)
vim .env

# Build and run
cargo build --release
cargo run --release

# Health check
curl http://localhost:19527/health

Data is automatically stored in ~/.cratos/cratos.db.

Setup

CommandDescription
cratos initUnified interactive setup wizard (auto-detects language)
cratos init --lang koSetup wizard in Korean

Project Structure

cratos/
├── crates/
│   ├── cratos-core/      # Orchestration engine, security, credentials, shutdown
│   ├── cratos-channels/  # Channel adapters (Telegram, Slack, Discord, Matrix, WhatsApp)
│   ├── cratos-tools/     # Tool registry, sandbox, MCP client, browser relay
│   ├── cratos-llm/       # LLM providers, token counting, ONNX embeddings, quota tracking
│   ├── cratos-replay/    # Event logging and replay (SQLite)
│   ├── cratos-skills/    # Automatic skill generation system
│   ├── cratos-search/    # Vector search (usearch), semantic indexing
│   ├── cratos-memory/    # Graph RAG conversation memory (entity graph + hybrid search)
│   ├── cratos-crypto/    # Cryptographic utilities
│   ├── cratos-audio/     # Voice control (STT/TTS, optional)
│   └── cratos-canvas/    # Live Canvas (future)
├── config/
│   ├── default.toml      # Default configuration
│   ├── pantheon/         # Persona TOML files (14 personas: 5 core + 9 extended)
│   └── decrees/          # Laws, ranks, development rules
├── src/
│   ├── main.rs           # Application entry point
│   ├── cli/              # CLI commands (init, doctor, quota, tui, skill, data, acp, browser-ext, ...)
│   ├── api/              # REST API (config, tools, executions, scheduler, quota, sessions, browser)
│   ├── websocket/        # WebSocket handlers (chat, events, gateway)
│   └── server.rs         # Server initialization

~/.cratos/                # Data directory (auto-created)
├── cratos.db             # SQLite main DB (events, execution history)
├── skills.db             # SQLite skills DB (skills, patterns)
├── memory.db             # SQLite Graph RAG memory DB
├── vectors/              # HNSW vector index (usearch)
│   └── memory/           # Memory embedding vectors
└── chronicles/           # Achievement records per persona

Configuration

Environment Variables

VariableDescriptionRequired
REDIS_URLRedis connection URL (for sessions, uses memory if not set)
TELEGRAM_BOT_TOKENTelegram bot token
SLACK_BOT_TOKENSlack bot token
LLM API Keys (at least one)
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GEMINI_API_KEYGoogle Gemini API key (or GOOGLE_API_KEY) (recommended)
GOOGLE_API_KEYGoogle Gemini API key (alias)
ZHIPU_API_KEYZ.AI GLM API key (free Flash models)
DASHSCOPE_API_KEYAlibaba Qwen API key
OPENROUTER_API_KEYOpenRouter API key
NOVITA_API_KEYNovita AI API key (free)
ELEVENLABS_API_KEYElevenLabs TTS API key (optional)
Configuration Overrides
CRATOS_LLM__DEFAULT_PROVIDEROverride default LLM provider (double underscore)

Note: DATABASE_URL is no longer needed. Uses embedded SQLite.

Configuration Files

Default settings are in config/default.toml. Create config/local.toml to customize for your local environment.

LLM Providers

ProviderModelsFeatures
OpenAIGPT-5, GPT-5.2, GPT-5-nanoLatest generation, coding
AnthropicClaude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4.5Excellent code generation
GeminiGemini 3 Pro, Gemini 3 Flash, Gemini 2.5 ProLong context, multimodal, Standard API only (safe)
GLMGLM-4.7, GLM-4.7-Flash (free), GLM-5ZhipuAI models
QwenQwen3-Max, Qwen3-Plus, Qwen3-Flash, Qwen3-CoderMultilingual, coding, reasoning
DeepSeekDeepSeek-V3.2, DeepSeek-R1Ultra low cost, reasoning

Free/Low-Cost Providers

ProviderModelsLimits
Z.AI (GLM)GLM-4.7-Flash, GLM-4.5-FlashFree, no daily limit
GeminiGemini 2.0 FlashFree (1,500 RPD)
GroqLlama 3.1 8B, GPT-OSS 20BFree tier available
NovitaQwen2.5-7B, GLM-4-9BFree signup
SiliconFlowQwen2.5-7BFree models available
OllamaAll local modelsUnlimited (local)

Model Routing

Automatic model selection based on task type:

Task TypeModel TierExample Models
ClassificationFastGPT-5-nano, Claude Haiku 4.5
SummarizationFastGPT-5-nano, Gemini 2.0 Flash
ConversationStandardGPT-5, Claude Sonnet 4.5
CodeGenerationStandardGPT-5, Claude Sonnet 4.5
PlanningPremiumGPT-5.2, Claude Opus 4.5

Olympus OS (Agent Organization)

Cratos features a mythology-based 3-layer agent organization system:

LayerNamePurpose
WHOPantheon14 agent personas (5 core + 9 extended)
HOWDecreesLaws, ranks, development rules
WHATChroniclesAchievement records and evaluations

Core Personas

RoleNameDomain
OrchestratorCratosSupreme commander (Lv255)
PMAthenaStrategy, planning (Lv3)
DEVSindriDevelopment, implementation (Lv1)
QAHeimdallQuality, security (Lv2)
RESEARCHERMimirResearch, analysis (Lv4)

Extended Personas

RoleNameDomain
POOdinProduct owner (Lv5)
HRHestiaPeople, organization (Lv2)
BANornsBusiness analysis (Lv3)
UXApolloUX design (Lv3)
CSFreyaCustomer support (Lv2)
LEGALTyrLegal, compliance (Lv4)
MARKETINGNikeMarketing (Lv2)
DEVOPSThorInfrastructure, ops (Lv3)
DEVBrokDevelopment (Lv1)

@mention Routing

Route tasks to specific personas using @mentions:

@athena Plan this sprint          # PM - Strategy
@sindri Implement the API         # DEV - Development
@heimdall Review security         # QA - Quality
@mimir Research this technology   # RESEARCHER - Analysis
@cratos Summarize the situation   # Orchestrator

Response format: [Persona LvN] Per Laws Article N...

CLI Commands

# Setup
cratos init                       # Interactive setup wizard (auto-detects language)
cratos init --lang ko             # Setup wizard in Korean

# System
cratos serve                      # Start the server
cratos doctor                     # Run diagnostics
cratos quota                      # Show provider quota/cost status
cratos quota --watch              # Live-refresh mode (every 2s)
cratos quota --json               # JSON output for scripting
cratos tui                        # Launch interactive TUI chat
cratos tui --persona sindri       # TUI with specific persona
cratos acp                        # Start ACP bridge (IDE integration)

# Voice
cratos voice                      # Start voice assistant (default: ko)
cratos voice --lang en            # Voice assistant in English

# Remote Development
cratos develop --repo user/repo   # Issue → PR automation
cratos develop --dry-run          # Preview without changes

# Device Pairing
cratos pair start                 # Start PIN-based pairing
cratos pair devices               # List paired devices
cratos pair unpair <device>       # Unpair a device

# Browser
cratos browser tabs               # List open browser tabs
cratos browser open <url>         # Open a URL
cratos browser screenshot         # Capture screenshot
cratos browser extension install  # Install Chrome extension

# Security
cratos security audit             # Run security audit

# Skills
cratos skill list                 # List all skills
cratos skill show <name>          # Show skill details
cratos skill enable <name>        # Enable a skill
cratos skill disable <name>       # Disable a skill
cratos skill export <name>        # Export a skill to file
cratos skill import <file>        # Import a skill from file
cratos skill bundle               # Bundle skills for sharing
cratos skill search <query>       # Search remote skill registry
cratos skill install <name>       # Install from registry
cratos skill publish <name>       # Publish to registry

# Data Management
cratos data stats                 # Show database statistics
cratos data clear sessions        # Clear session data
cratos data clear memory          # Clear Graph RAG memory
cratos data clear history         # Clear execution history
cratos data clear chronicles      # Clear achievement records
cratos data clear vectors         # Clear vector indices
cratos data clear skills          # Clear learned skills

# Pantheon (Personas)
cratos pantheon list              # List personas
cratos pantheon show sindri       # Show persona details
cratos pantheon summon sindri     # Summon (activate) a persona
cratos pantheon dismiss           # Dismiss active persona

# Pantheon Skill Management
cratos pantheon skill list <persona>       # List skills bound to persona
cratos pantheon skill show <persona> <skill>   # Show binding details
cratos pantheon skill claim <persona> <skill>  # Manually assign skill
cratos pantheon skill release <persona> <skill> # Release skill
cratos pantheon skill leaderboard <skill>  # Skill leaderboard
cratos pantheon skill summary <persona>    # Persona skill summary
cratos pantheon skill sync <persona>       # Sync proficiency to chronicle

# Decrees (Rules)
cratos decrees show laws          # Show laws
cratos decrees show ranks         # Show rank system
cratos decrees show warfare       # Show development rules
cratos decrees show alliance      # Show collaboration rules
cratos decrees show tribute       # Show reward/cost rules
cratos decrees show judgment      # Show evaluation framework
cratos decrees show culture       # Show culture/values
cratos decrees show operations    # Show operational procedures
cratos decrees validate           # Validate rule compliance

# Chronicles (Achievement Records)
cratos chronicle list             # List achievement records
cratos chronicle show sindri      # Show individual record
cratos chronicle log "message"    # Add log entry
cratos chronicle promote sindri   # Request promotion
cratos chronicle clean            # Clean up stale records

Security Features

Security-first by design — Built from the ground up with security as a core principle, not an afterthought.

  • Memory-safe foundation: Written in Rust with #![forbid(unsafe_code)] — no buffer overflows, no use-after-free
  • Zero plaintext secrets: All credentials encrypted via OS keychain (Keychain, Secret Service, Credential Manager)
  • Default isolation: Sandbox enabled by default with network blocked, not opt-in
  • Built-in threat detection: 20+ prompt injection patterns detected and blocked automatically
  • Tool risk classification: Every tool has explicit risk levels with appropriate safeguards
  • Input/output validation: All user inputs and LLM outputs are validated before execution

Docker Sandbox

Dangerous tools run in isolated Docker containers:

[security.sandbox]
default_network = "none"  # Block network
max_memory_mb = 512       # Memory limit
max_cpu_percent = 50      # CPU limit

Credential Encryption

API keys are securely stored in OS keychain:

  • macOS: Keychain
  • Linux: Secret Service (GNOME Keyring)
  • Windows: Credential Manager

Prompt Injection Defense

Automatically detects and blocks malicious prompts:

  • 20+ danger pattern detection
  • Input/output validation
  • Prevents sensitive information exposure

Supported Tools

Built-in Tools

ToolDescriptionRisk Level
file_readRead filesLow
file_writeWrite filesMedium
file_listList directoryLow
http_getHTTP GET requestLow
http_postHTTP POST requestMedium
execCommand execution (meta-char blocked, sandboxed)High
bashPTY-based shell (5-layer security: validation, pipeline analysis, env isolation, resource limits, output masking)High
git_statusGit status checkLow
git_commitGit commit creationMedium
git_branchGit branch managementMedium
git_diffGit diff checkLow
git_pushGit push to remoteHigh
git_cloneClone a repositoryMedium
git_logView commit historyLow
github_apiGitHub API integrationMedium
browserBrowser automation (MCP or Chrome extension)Medium
web_searchDuckDuckGo web search (no API key required)Low
agent_cliDelegate tasks to external AI agents (Claude, etc.)Medium
wolWake-on-LANMedium
configNatural language configurationMedium
send_fileSend file through messaging channelMedium
image_generateAI image generationMedium
app_controlNative app automation (macOS AppleScript/JXA)High

MCP Extension Tools

Additional tools can be auto-registered from .mcp.json:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@anthropic-ai/mcp-server-playwright"]
    }
  }
}

MCP tools are discovered at startup and integrated into the tool registry with a 10-second connection timeout.

REST API & WebSocket

REST Endpoints (/api/v1/*)

MethodPathDescriptionAuth
GET/healthHealth check (simple)No
GET/health/detailedDetailed health check (DB/Redis/LLM status)Yes
GET/metricsPrometheus-format metricsYes
GET/PUT/api/v1/configConfiguration read/updateYes
GET/api/v1/toolsList available toolsYes
GET/api/v1/executionsList executions (filterable, max 50)Yes
GET/api/v1/executions/{id}Execution detailsYes
GET/api/v1/executions/{id}/replayReplay events for an executionYes
POST/api/v1/executions/{id}/rerunRe-run an executionYes
GET/POST/PUT/DELETE/api/v1/scheduler/tasksScheduler task managementYes
GET/api/v1/quotaProvider quota/cost statusYes
GET/api/v1/dev/sessionsActive AI dev sessions (Claude, Gemini, Codex, Cursor)Yes
GET/api/v1/dev/sessions/{tool}Sessions filtered by toolYes
GET/POST/DELETE/api/v1/pairing/*PIN-based device pairingYes
POST/api/v1/browser/*Browser control APIYes

WebSocket Endpoints

PathDescription
/ws/chatInteractive chat
/ws/eventsEvent stream (real-time notifications)
/ws/gatewayChrome extension gateway protocol

Security Middleware

All API endpoints are protected with configurable security layers:

  • Authentication: HMAC signature, JWT token, or API key
  • Rate Limiting: Per-IP and per-user request throttling
  • Approval Nonce: One-time tokens for high-risk operations

Chrome Extension (Browser Control)

Control your Chrome browser remotely via a lightweight extension that connects through the WebSocket gateway:

Chrome Extension ←→ /ws/gateway ←→ Cratos Server ←→ BrowserRelay ←→ Tools

Features:

  • Tab management (list, open, close, activate)
  • Page navigation and content extraction
  • DOM interaction (click, type, screenshot)
  • Bidirectional JSON-RPC communication

The browser tool automatically detects whether a Chrome extension is connected and falls back to MCP-based browser automation if not.

Graph RAG Memory

Cross-session conversation memory powered by entity graph and hybrid vector search:

  • Turn Decomposition: Breaks conversations into semantic units
  • Entity Extraction: Rule-based named entity recognition
  • Graph Construction: Entities linked by co-occurrence and relationships
  • Hybrid Search: embedding_similarity * 0.5 + proximity * 0.3 + entity_overlap * 0.2

Data stored in ~/.cratos/memory.db (SQLite) and ~/.cratos/vectors/memory (HNSW index).

TUI Chat

Interactive terminal-based chat interface:

cratos tui                    # Launch TUI
cratos tui --persona athena   # Start with specific persona
FeatureDescription
Markdown RenderingRich text rendering via tui-markdown
Mouse ScrollScroll through conversation history
Input HistoryUp/Down arrow navigation (max 50 entries)
Multi-Provider QuotaReal-time quota display per provider
Keyboard ShortcutsF2: toggle mouse, Ctrl+C: quit

Voice Control

Built-in voice assistant with Speech-to-Text, Text-to-Speech, and Voice Activity Detection:

cratos voice                  # Start voice assistant (Korean)
cratos voice --lang en        # English
cratos voice --lang ja        # Japanese
cratos voice --lang zh        # Chinese
ComponentEngineNotes
STTOpenAI Whisper API / Local Whisper (candle)Local requires local-stt feature
TTSEdge TTSFree, no API key required
VADSilero VAD (ONNX)Detects speech activity

Local Whisper STT: cargo build --features local-stt (downloads model on first run)

Device Pairing

PIN-based device pairing for secure remote management:

cratos pair start             # Generate pairing PIN
cratos pair devices           # List paired devices
cratos pair unpair <device>   # Remove a paired device

Paired devices can control Cratos via REST API or WebSocket with device-level authentication.

Proactive Scheduler

Schedule automated tasks:

Trigger TypeExampleDescription
Cron0 9 * * *Daily at 9 AM
Interval{ seconds: 300, immediate: true }Every 5 minutes
OneTime{ at: "2026-03-01T10:00:00Z" }Single execution
File{ pattern: "*.json", action: "watch" }On file change
System{ metric: "cpu", threshold: 80 }On system event

Task actions: NaturalLanguage, ToolCall, Notification, Shell, Webhook.

Manage via REST API (/api/v1/scheduler/tasks) or natural language.

Testing

# Run all tests
cargo test --workspace

# Run integration tests only
cargo test --test integration_test

# Test specific crate
cargo test -p cratos-llm
cargo test -p cratos-tools
cargo test -p cratos-core

Documentation

Detailed Guides

GuideDescription
TelegramTelegram bot integration (teloxide)
SlackSlack app integration (Socket Mode / Events API)
DiscordDiscord bot integration (serenity)
WhatsAppWhatsApp integration (Baileys / Business API)
Browser AutomationMCP-based browser control + Chrome extension
Skill Auto-GenerationPattern learning and skill creation
Graceful Shutdown5-phase safe shutdown mechanism
Live CanvasReal-time visual workspace
Native AppsTauri desktop application

License

MIT

Contributing

Issues and PRs welcome.


Languages: English | 한국어

Contributors

gahyun-git

387 commits

gracefullight

17 commits

Languages

Rust

96.1%

JavaScript

1.2%