Sentdex/minion
A tiny single-file coding agent for self-hosted models (llama.cpp / vLLM / SGLang).
What it solves
Minion addresses the issue of "context bloat" in AI coding agents. Many frameworks consume tens of thousands of tokens for basic interactions because they load extensive features and tools into the LLM's context. This bloat slows down responses, reduces the model's effective intelligence (as attention is best in the early context), increases API costs, and makes it difficult to run agents on local models with limited context windows.
How it works
Minion is a lightweight, single-file coding agent (minion.py) that communicates with OpenAI-compatible endpoints (local servers like llama.cpp or remote APIs). It minimizes the system prompt and tool schemas to keep the initial token count low (around 625 tokens for a simple greeting).
Key technical features include:
- Graceful Degradation: If a server doesn't support native tool-calling, it falls back to parsing specific text delimiters (
[minion_tool_call]). - Context Management: It automatically compresses older conversation turns into summaries when the context window reaches a defined threshold (default 85%).
- Risk Classification: Every write, edit, or bash command is risk-classified (low, medium, high) by a cheap model call to determine if user approval is required based on the selected approval mode.
- Session Persistence: Conversations are automatically saved as human-readable JSON files for easy resumption.
Who it’s for
Developers who want a minimal, no-nonsense coding agent that is efficient enough to run on local LLMs or cost-effective on remote APIs, and those who prefer a transparent, single-file codebase they can easily understand or modify.
Highlights
- Ultra-low overhead: Uses significantly fewer tokens per turn than feature-heavy agent frameworks.
- Tool capabilities: Can read, write, edit, and execute shell commands within a project.
- Flexible Backend: Compatible with any OpenAI-compatible endpoint, including local servers and providers like Together AI and OpenRouter.
- Safety Controls: Multiple approval levels (from
alltoyolo) to control when the model can execute commands without prompting. - Single-file architecture: The entire logic is contained in one Python file for maximum simplicity.
Related
- Project
- Project
- Project
- Dispatch
- Project