Workflow · Production

OpenDev: Building Effective AI Coding Agents for the Terminal — Scaffolding, Harness, Context Engineering, and Lessons Learned

The problem

Terminal-native AI coding agents face three fundamental engineering challenges: managing finite context windows over sessions that routinely exceed the model's token budget, preventing destructive operations when the agent can execute arbitrary shell commands, and extending capabilities without overwhelming the agent's prompt budget. Most production systems are closed-source with undocumented architectural decisions, leaving open questions unanswered.

First attempt

Multiple early design iterations of OpenDev revealed concrete failure modes: an agent class hierarchy created a diamond problem when subagents needed mixed capabilities; lazy prompt building caused first-call latency and race conditions with MCP server discovery; and a four-tool state machine for plan mode was brittle with the agent sometimes failing to exit plan mode.

Workflow diagram · grounded in source
1
User prompt received at CLI
trigger
“A user query flows through this pipeline sequentially, from the entry point through agent reasoning and tool execution, before results are persisted and rendered.”
2
Route to plan or execute
routing
“When a user prompt arrives, the MainAgent checks whether it should enter Plan Mode or proceed directly in Normal Mode. Two triggers activate Plan Mode: an explicit /plan command from the user, or a heuristic that detects planning intent …”
3
Planner subagent explores codebase
ai_action
“it explores the codebase using read-only tools: reading files, searching code, listing directory contents, and resolving symbol definitions”
4
Structured plan written to file
output
“it writes a structured plan to a file in the scratch directory, containing seven sections: goal, context, files to modify, new files to create, implementation steps, verification criteria, and risks”
5
User reviews and approves plan
human_review
“the main agent then calls present_plan(plan_file_path), which displays the plan to the user for review. The user has two choices: revise (the main agent can spawn the Planner again with feedback) or approve (the agent proceeds to executi…”
6
Normal Mode full execution
ai_action
“Normal Mode is the default and only operating state. The agent has full access to all tools, including file reading, file writing, code editing, command execution, and subagent spawning. After a plan is approved via present_plan, the age…”
7
Adaptive context compaction
ai_action
“automatic context compaction when the token budget nears exhaustion”
8
Cross-session memory persistence
feedback_loop
“an automated memory system to accumulate project-specific knowledge across sessions”
Reported outcome

OpenDev is presented as the first comprehensive technical report for an open-source, terminal-native, interactive coding agent, providing a secure, extensible foundation for terminal-first AI assistance and a blueprint for robust autonomous software engineering.

Reported metrics
GitHub Copilot developer count (industry context)15 million developers
Reported stack
OpenDevRustMCPTextualFastAPIWebSocketsDocker
Source
https://arxiv.org/html/2603.05344v3
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

OpenDev is presented as the first comprehensive technical report for an open-source, terminal-native, interactive coding agent, providing a secure, extensible foundation for terminal-first AI assistance and a blueprin…

What tools did this team use?

OpenDev, Rust, MCP, Textual, FastAPI, WebSockets, Docker.

What results were reported?

GitHub Copilot developer count (industry context): 15 million developers (source-reported, not independently verified).

What failed first in this deployment?

Multiple early design iterations of OpenDev revealed concrete failure modes: an agent class hierarchy created a diamond problem when subagents needed mixed capabilities; lazy prompt building caused first-call latency…

How is this workflow AI workflow structured?

User prompt received at CLI → Route to plan or execute → Planner subagent explores codebase → Structured plan written to file → User reviews and approves plan → Normal Mode full execution → Adaptive context compaction → Cross-session memory persistence.