A transparent layer between your AI coding tools and your models: smart routing, token savings, durable execution, and continuous learning. All local, fully open source.
A six-step pipeline: adaptive routing, retries, and per-task learning.
Keyword scan identifies task type without an extra model call.
Rank models by skill, learned task weights, availability, and cooldowns.
Strip stale context, dedupe file contents, keep the most relevant history.
A self-healing loop with format enforcement and automatic escalation.
Save project state and history to the OS-native data folder.
Record outcomes so routing improves over time for each task type and model.
One layer for multi-model agentic work, with Ollama-native and OpenAI-compatible tools.
Ranks models by task type, skill, and difficulty. Easy requests go to free local models; hard ones to the strongest available.
A 3-attempt retry loop with model escalation and a quality gate, for fewer broken responses.
Detects provider failures and defers cooldown, quota, and rate-limit errors automatically.
Tracks outcomes per model and task type, so routing keeps improving every session.
Strips stale metadata, dedupes files, and trims history, with token savings shown inline.
The stable Anthropic prefix is served from cache at ~0.1× input price on repeat steps. Automatic.
Local models constrain decoding to a schema at generation time. Valid JSON by construction.
API keys and tokens are scrubbed before prompts reach a cloud provider. Local models stay untouched.
All state stays in your OS-native data folder. Runs fully offline on local models.
Durability and privacy built into the execution layer, not bolted on.
Step results are checkpointed as they complete, then replayed from the journal on resume, continuing where it stopped.
Remote provisioning auto-destroys an instance on any failure or Ctrl-C, with a --reconcile backstop. A crash never leaves a billing instance behind.
A local eval harness scores prompt and routing changes against a baseline, so regressions are caught before they ship.
Drop-in for both Ollama-native and OpenAI-compatible clients.
POST /api/chat for Cline, Continue, crewAI, and LangChain.
POST /v1/chat/completions for Aider, AutoGen, and smolagents.
Running locally in under two minutes.
git clone https://github.com/selfopt/selfopt.git
cd selfopt
pip install -e ".[dev]"
ollama pull qwen3-coder:30b # primary code model
ollama pull gemma4 # fast analysis model
selfopt start --port 8001
# Ollama-native endpoint (Cline, Continue, crewAI, LangChain)
http://localhost:8001 model: selfopt
# OpenAI-compatible endpoint (Aider, AutoGen, smolagents)
http://localhost:8001/v1 model: openai/selfopt
Local and remote providers, with optional cloud failover.