A tiny coding agent. One loop, multiple models, six tools, zero config.
- Overview — executive presentation (space-bar to navigate)
- Architecture — how the agent loop, providers, tools, and sessions work
- Style guide — coding conventions and lint config
./olStarts an interactive REPL. Type your message and press Enter.
Commands:
/clear— wipe context and start a fresh sessionCtrl+C— stop a running requestCtrl+D— exit
./ol "your prompt here"Runs a single prompt and exits.
git diff | ./ol "summarise these changes"
cat error.log | ./ol "what is causing this?"When stdin is a pipe, its content is prepended to the prompt and the agent runs non-interactively.
./ol login openrouter
./ol login openai
./ol login anthropicStores API keys in ~/.oneloop/auth.json.
./ol is a thin wrapper that runs OneLoop via nix develop. The agent is purely model-driven: you talk to it in natural language, and the model decides whether to use read, write, edit, bash, or web_search.
Directives use #!directive words#! followed by the user message:
#!openrouter#! explain this file— route to OpenRouter#!openrouter model:deepseek/deepseek-v3-0324#! refactor this— specific model#!model:anthropic/claude-opus-4#! hard problem— model override, default provider#!anthropic openai#! should we do X?— consensus (2+ providers defaults to consensus)#!consensus anthropic openai judge:openai#! question— explicit consensus with judge#!debate anthropic openai rounds:2 judge:anthropic#! question— debate with 2 rounds#!anthropic format:md#! summarize— single provider with markdown output
Tokens between #!...#! are space-separated: provider names, mode keywords
(consensus, debate), and key:value modifiers (model:provider/name,
judge:openai, rounds:2, tools:none, format:md, format:html). No #!
at all means plain prompt with default provider. model: is only valid in
single-provider mode.
Default order:
- OpenRouter (if credentials available)
- OpenAI (if credentials available)
- Anthropic (if credentials available)
Override with environment variables:
ONELOOP_PROVIDER=openrouter|openai|anthropic— force a specific providerONELOOP_OPENROUTER_MODEL— OpenRouter model (default:anthropic/claude-sonnet-4-5)ONELOOP_OPENROUTER_BASE_URL— OpenRouter base URL overrideONELOOP_ANTHROPIC_MODEL— Anthropic model overrideONELOOP_OPENAI_MODEL— OpenAI model overrideONELOOP_OPENAI_BASE_URL— OpenAI base URL overrideONELOOP_OPENAI_REASONING_EFFORT— reasoning effort for o-series models
Credentials are resolved from ~/.oneloop/auth.json first, then from environment variables (OPENROUTER_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY).
nix develop
cargo checkThis project is personal software that I maintain for my own use. I do not accept pull requests.
If it's useful to you: fork it, copy the code, adapt it freely. The only ask is that you keep the copyright notice intact (MIT license).
MIT — see LICENSE.