OpenDev is an open-source command-line coding agent for software engineering, described by its author as written in Rust and published with a technical report, Building Effective AI Coding Agents for the Terminal: Scaffolding, Harness, Context Engineering, and Lessons Learned, documenting its architecture. It is built for terminal-native operation — where source control, build systems, remote sessions and headless environments already live — rather than as an IDE plugin, and offers two frontends over a shared UI contract, a terminal interface and a web interface, so that the agent layer itself stays interface-agnostic.

Architecture

The system is organised into four layers: entry and UI, agent, tool and context, and persistence. Its central design choice is to be a compound AI system rather than a single model call: work is arranged as a hierarchy of session, agent, workflow and LLM, with five specialised model roles assigned to distinct models, so that a workflow can be bound to whichever model suits its cost, latency and capability needs. The report presents this as making the system model-agnostic by construction — changing provider is a configuration change rather than a code change.

Reasoning runs through an extended ReAct loop that adds phases to the standard cycle: automatic context compaction when the token budget nears exhaustion, an optional thinking phase at configurable depth, an optional self-critique phase, and then the action phase. The report’s architecture overview describes two operating modes, a normal mode with full read-write tool access and a plan mode restricted to read-only tools; a later section instead says the main agent stays in normal mode throughout and delegates planning to a Planner subagent, the earlier mode having been removed.

Context Engineering

Context management is treated as a first-class concern rather than an optimisation. Adaptive compaction moves observations through active, faded and archived states instead of compacting everything once a hard limit is reached; the report attributes a roughly 54% reduction in the peak context consumption of observations to it. Tool results beyond a size threshold are written to a scratch file and returned as a short preview plus a file reference. External tools reached over MCP are what the report calls lazily discovered rather than eagerly loaded, an instance of Progressive Disclosure: a search_tools call scores registered tool names and descriptions against a keyword query, and only discovered schemas enter the context. The report says this cut baseline overhead from 40% of the context budget to under 5%. Event-driven system reminders inject short, targeted guidance at the point of decision to counteract instructions being violated late in long sessions, and an automated memory system accumulates project-specific knowledge across sessions.

Safety

Because the agent can run arbitrary shell commands, overwrite files and spawn persistent processes, the system uses five independent safety layers rather than one mechanism: prompt-level guardrails, Schema Gating through plan-mode whitelists and per-subagent tool restrictions, a runtime approval system with persistent permissions, tool-level validation such as a dangerous pattern blocklist and stale-read detection, and user-defined lifecycle hooks that can block a tool call or mutate its arguments. Each layer is designed to prevent a class of harm independently, so that failure of one does not compromise the rest. Filesystem changes are made reversible through an operation log and snapshot-based undo.