/ _ \ _ __ ___ _ __ / || | __ _ _ | | __
| | | | ' \ / _ \ ' \__ | '_ \ / ` | '__| |/ /
| || | |) | / | | |) | | | | (| | | | <
_/| ./ ___|| ||/|| ||_,|| ||_
||
π¦ Fast. Precise. Hungry.
Retro DOS title screen aesthetic β pixel art, neon, and shark fins.
OpenShark is an open-source AI coding harness written in Rust. It's a fast terminal agent that chats with any model, executes tools, remembers everything, and gets sharper the more you use it. It doesn't overthink β it uses model instincts, makes sensible default decisions for you, and improves every session.
Born from the neon grid of 1984, OpenShark is built for builders who want an agent that decides without asking β except when it comes to UI/design, where your taste matters.
- Persistent memory that actually works β SQLite-backed sessions, messages, and tool calls with keyword and semantic search. Close the terminal, come back next week, it still knows what you were doing.
- Universal model access β any provider with an OpenAI-compatible API, local or cloud. Point it at llama-swap, OpenRouter, xAI, whatever. Not locked to anyone.
- Smart routing β picks the right model per task based on historical success rates, capability matching, and cost. Tracks every token so you don't burn budget blindly.
- Autonomous agent mode β plans, executes, verifies, retries. You approve the plan, it does the work.
- Self-improvement β analyzes its own sessions to detect tool failure patterns, rank prompt effectiveness, and recommend changes.
- Multi-platform gateways β the same agent brain answers on Discord and Telegram, with Slack and Matrix scaffolds ready to extend.
- A TUI worth living in β Ratatui-driven, keyboard-first, streaming responses, 24 preset themes (Synthwave84 by default, obviously).
- Sense of Direction β OpenShark knows what you're building and why
- Instinct Over Instructions β Uses model capabilities natively, doesn't fight them
- Decides For You β Picks the right model, tool, and approach based on data
- Learns From Itself β Every session makes the next one better
- Easy On β 60 seconds from install to first session
curl -sSL https://raw.githubusercontent.com/synthalorian/openshark/main/install.sh | bashgit clone https://github.com/synthalorian/openshark.git
cd openshark
cargo build --release
# Binary is at target/release/openshark
cp target/release/openshark ~/.local/bin/openshark setup # Configure providers, models, preferences
openshark # Start TUI sessionβββββββββββββββββββββββββββββββββββββββββββ
β OpenShark TUI (Ratatui) β
β Keyboard-driven, fast, beautiful β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββ ββββββββββββ ββββββββββββ
β Router β β Memory β β Tools β
β Engine βββββΊβ Store βββββΊβ (git, fs,β
β β β(SQLite) β β term) β
ββββββββββ ββββββββββββ ββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Provider Abstraction Layer β
β OpenAI-compatible + native options β
β Cloud APIs, local servers, llama-swap β
βββββββββββββββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββββββ
β Agent β β Cache β β Self-Improve β
β Loop β β Store β β Engine β
ββββββββββββ ββββββββββββ ββββββββββββββββ
src/
βββ main.rs # CLI entry (clap, async tokio)
βββ agent/ # Agentic loop: plan β execute β verify β iterate
βββ cache/ # Response cache with TTL and disk persistence
βββ config/ # Config struct, load/save, setup wizard
βββ evolution/ # Agent evolution and mutation system
βββ gateway/ # Multi-platform messaging gateway
β βββ discord.rs # Native serenity 0.12 bot
β βββ telegram.rs # teloxide bot with reply sender
β βββ slack.rs # Socket Mode scaffold
β βββ matrix.rs # Sync loop scaffold
β βββ message_router.rs# Cross-platform message routing
β βββ unified_router.rs# Unified gateway router
βββ lsp/ # Lightweight LSP client
βββ mcp/ # Native MCP client (stdio + SSE)
βββ memory/ # SQLite memory with semantic search
βββ providers/ # Provider abstraction with streaming
βββ router/ # Smart model routing engine
βββ security/ # 4-layer security: sandbox, identity, PII, guardrails
βββ self_improve/ # Performance analysis and recommendations
βββ skills/ # YAML frontmatter skill system
βββ tools/ # 9 built-in tools + MCP bridge
βββ tui/ # Ratatui interface with 24 themes
| Command | Description |
|---|---|
openshark |
Start TUI session |
openshark setup |
Configure providers, models, preferences |
openshark stats |
View token usage, success rates, model performance |
openshark memory <query> |
Query persistent memory (keyword search) |
openshark memory <query> --semantic |
Semantic memory search |
openshark memory --recent |
List recent sessions |
openshark route |
Show current routing decisions |
openshark learn |
Trigger self-improvement analysis |
openshark agent "<task>" |
Execute task autonomously |
openshark test run . |
Run tests (auto-detect framework) |
openshark models |
List available models |
openshark chat "<message>" |
One-shot chat |
openshark config |
Show configuration |
openshark security status |
Show security status |
openshark mcp status |
Show MCP server status |
| Command | Description |
|---|---|
help |
Show available commands |
tools |
List available tools |
history |
Show session history |
context |
Show memory hierarchy summary |
agent: <task> |
Trigger autonomous agent mode |
what did we do about <x>? |
Natural memory query |
exit |
End session |
| Key | Action |
|---|---|
Ctrl+A |
Toggle autonomous mode (safe β full-send) |
Ctrl+T |
Cycle through 24 preset themes |
Ctrl+V |
Toggle multi-model comparison overlay |
β/β |
Navigate history |
| Tool | Purpose | Example |
|---|---|---|
edit |
Multi-file editing | TOOL:edit read src/main.rs |
fs |
File system operations | TOOL:fs list src/ |
git |
Git operations | TOOL:git status |
lsp |
LSP queries | TOOL:lsp symbols src/main.rs |
refactor |
Code refactoring | TOOL:refactor rename_symbol src/main.rs 10 5 new_name |
search |
Codebase search | TOOL:search fn main --ext rust |
grep |
Regex search | TOOL:grep async fn src/ |
terminal |
Shell execution | TOOL:terminal cargo test |
test |
Test runner | TOOL:test run . |
mcp |
MCP server tools | Auto-discovered from configured MCP servers |
Type agent: fix the bug in src/main.rs and OpenShark will:
- Generate a plan with specific steps
- Ask for your approval (approve/edit/reject)
- Execute each step with verification
- Retry failed steps (up to 3 times)
- Escalate to recovery plan if needed
Max iterations: 84 (configurable)
OpenShark remembers everything across sessions:
- Keyword search:
openshark memory "auth" - Semantic search:
openshark memory "auth" --semantic - Natural queries: Just ask "what did we do about auth?"
- Context injection: Automatically injects relevant past context into new sessions
- Memory hierarchy: Session β Project β Global layers
Automatically picks the best model for each task:
- Historical success rates (40%)
- Capability matching (35%)
- Cost efficiency (25%)
- Context length enforcement
- Budget limits
Analyzes every session to get better:
- Model performance trends
- Tool failure pattern detection
- Prompt effectiveness ranking
- Session quality scoring
- Actionable recommendations
- Sandbox: Restricted file system access
- Identity: User verification and agent identity
- PII: Personal information detection and redaction
- Guardrails: Content policy enforcement
Toggle between safe and full-send modes with Ctrl+A.
- Discord: Native bot with slash commands, free-form chat, keyword commands
- Telegram: Bot with chunked message replies (4096 char limit)
- Slack: Socket Mode scaffold (ready for expansion)
- Matrix: Sync loop scaffold (ready for expansion)
Synthwave84 default, Omarchy stock, light/dark variants. Cycle with Ctrl+T.
stdio + SSE transport, JSON-RPC 2.0, tool discovery/execution. No external MCP bridge needed.
Ctrl+V toggles a 90%Γ85% popup showing primary + all secondary model responses with navigation, model names, latency, and token counts.
Run openshark setup to generate your config interactively, or create ~/.config/openshark/config.toml manually:
version = "1.1.0"
default_model = "gpt-4o"
auto_route = true
cost_limit_usd = 10.0
[agent]
name = "myagent"
display_name = "MyAgent"
role = "coding assistant"
origin = "Created in the neon grid"
purpose = "To ship code fast"
tagline = "Let's build the future."
tone = "Professional but friendly"
style = "Concise and thorough"
greeting = "Hey! Ready to code?"
farewell = "See you next session!"
emoji = "π€"
catchphrases = ["Let's do this!", "Ship it!"]
behavioral_rules = [
"Always verify before claiming success",
"Show the code, don't just describe it",
]
[providers.openai]
base_url = "https://api.openai.com/v1"
api_key = "${OPENAI_API_KEY}"
[[providers.openai.models]]
name = "gpt-4o"
context_length = 128000
cost_per_1k_input = 0.005
cost_per_1k_output = 0.015
capabilities = ["code", "chat", "analysis"]
[gateway.discord]
enabled = false
token = "${DISCORD_BOT_TOKEN}"
command_prefix = "!"
slash_commands = true
[gateway.telegram]
enabled = false
token = "${TELEGRAM_BOT_TOKEN}"
[gateway.slack]
enabled = false
app_token = "${SLACK_APP_TOKEN}"
bot_token = "${SLACK_BOT_TOKEN}"
socket_mode = true
[gateway.matrix]
enabled = false
homeserver = "https://matrix.org"
user_id = "@myagent:matrix.org"
access_token = "${MATRIX_ACCESS_TOKEN}"In the TUI, these words are intercepted before hitting the model API:
stop/wait/cancelβ Halt current operationcontinue/goβ Resume or proceed
No need to prefix with / or ! β just type them naturally.
# Clone and build
git clone https://github.com/synthalorian/openshark
cd openshark
cargo build --release
# Run tests
cargo test
# Run with local model
cargo run --
# Run agent mode
cargo run -- agent "refactor the auth module"
# Run setup wizard
cargo run -- setupSee CHANGELOG.md for version history.
See ROADMAP.md for detailed future plans.
See STATUS.md for current development status and session handoff notes.
One harness. Universal models. Real memory. Agent autonomy. Open source.
It knows its sense of direction. It decides for you. It learns from itself. Fast. Precise. Hungry.
Made by synth with synthclaw πΉπ¦
MIT β The future of coding belongs to everyone.
