If you use AI coding agents every day, you've probably hit the same three walls I did:
- Running out of tokens mid-task: You hit your rate limit on Claude right in the middle of a feature, want to switch to Codex, Gemini, or Pi (running Kimi K3, DeepSeek, or local Ollama models) to finish the job, and realize your whole setup or context is locked inside one tool's conventions.
-
Prompt bloat: Your
AGENTS.md/CLAUDE.mdfile slowly turns into a massive wall of text where old decisions, half-baked ideas, and current tasks all pile up together. - Agents cheating on autonomous runs: Whenever you let an agent run unattended on a larger task, the moment a test gets hard, the agent "fixes" it by editing the test—or watering down its own instructions.
Over time, I built three separate repo templates to deal with this: one for day-to-day coding, one for early design exploration, and one for autonomous multi-agent loops. Today I merged all three into a single, open-source starter kit: AgentWork (MIT).
Zero vendor lock-in: switch agents and models mid-flight
Because all project memory, architectural decisions, active tasks, and session handoffs live in
plain Markdown inside .ai/ (with entry points wired up for AGENTS.md,
CLAUDE.md, Cursor, Copilot, and Windsurf), your context belongs to the repo,
not the agent.
I like running the whole pipeline inside a Claude session—that way it can capture errors, fix them, and continue building autonomously. And if I run out of tokens mid-run, I can immediately run the remaining stages either manually or automatically with another agent. It also lets me mix providers by strength: for example, using one provider (like Claude) for the architecture, another (like Codex or Gemini) for cold validation, and Pi (with Kimi K3 or DeepSeek) for fast implementation passes.
In autonomous mode, the launcher (launch.sh + agents.yaml) natively
supports switching or auto-escalating across:
- Claude Code (Anthropic direct, or routed via OpenRouter / local Ollama)
-
Codex (
codex) and Gemini (gemini) - Pi (Fireworks Kimi K3, DeepSeek, or local Ollama models)
You can even set routing profiles (openrouter-first, balanced,
sensitive, or local-only for air-gapped runs) so cheaper/faster models
handle mechanical tasks and heavier models step in when a retry is needed.
One setup script, two ways to work
git clone https://github.com/apelov/agentwork.git
./agentwork/setup.sh /path/to/your-project
-
Interactive & Exploration mode (
ai/→.ai/): Context is split into small files (PROJECT.md,DECISIONS.md,TASKS.md) loaded only when needed. When you aren't sure what to build yet, there's adesign-explorationworkflow that makes the agent pitch 2–3 competing options with honest trade-offs before touching code. (Bonus: there's a visibleaisymlink to.aiso you can browse everything directly in macOS Finder without toggling hidden files.) -
Autonomous Pipeline mode (
agentwork/): When you want to hand off a bigger build (GOALS.md), an orchestrator breaks the work into a dependency graph of Work Packages (WP01,WP02, ...) and runs workers in isolated Git worktrees.
Making sure autonomous agents can't grade their own homework
The autonomous pipeline enforces strict boundaries using plain Git and SHA-256 hashes (zero external dependencies, just Python stdlib + bash):
- Locked tests: Tests are written and committed before the worker starts. If the worker touches a locked test file, the merge is rejected.
-
Sealed contracts: Every task spec and verification script is hashed
(
SEAL.json) before execution starts. If an agent tries to edit its own spec to pass the gate, the pipeline catches the tamper and refuses to merge. -
Goldfish context: Workers don't get your whole project history—they get a
tiny, freshly generated
GOLD_CONTEXT.md(~1.5k tokens) with just their task, their allowed file globs, and the test command they need to pass.
Before publishing, I put the multi-agent workflow to the test by having both Codex and Claude independently audit the codebase for bugs, edge cases, and overengineering—which caught some great corner cases around git diffs and process cleanup.
Feedback welcome!
This started from my own daily workflows, and there are certainly plenty of things that can still be improved, simplified, or battle-tested across different stacks. If you try it out, spot rough edges, or have ideas on how to make it better, any feedback, issues, or PRs are very welcome!