ChatPaper.aiChatPaper

构建终端AI编程助手:脚手架设计、工具链集成、上下文工程与实践心得

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

March 5, 2026
作者: Nghi D. Q. Bui
cs.AI

摘要

人工智能编程辅助的格局正经历根本性转变:从复杂的IDE插件转向多功能、终端原生的智能体。基于命令行的智能体直接运行于开发者管理源代码控制、执行构建和部署环境的核心场景,为长周期开发任务提供了前所未有的自主性。本文提出OPENDEV——一个专为此新范式设计的开源命令行编程智能体。有效的自主辅助需要严格的安全控制和高效率的上下文管理,以防止上下文膨胀和推理能力衰减。OPENDEV通过复合式AI系统架构攻克了这些挑战:采用工作负载专用模型路由策略,将规划与执行分离的双智能体架构,惰性工具发现机制,以及逐步压缩历史观察的自适应上下文精简技术。此外,该系统通过自动化记忆机制积累跨会话的项目专属知识,并利用事件驱动的系统提醒机制抵消指令衰减效应。通过强制显式推理阶段和优先保障上下文效率,OPENDEV为终端优先的AI辅助提供了安全可扩展的基础框架,为健壮的自主软件工程实践提供了蓝图。
English
The landscape of AI coding assistance is undergoing a fundamental shift from complex IDE plugins to versatile, terminal-native agents. Operating directly where developers manage source control, execute builds, and deploy environments, CLI-based agents offer unprecedented autonomy for long-horizon development tasks. In this paper, we present OPENDEV, an open-source, command-line coding agent engineered specifically for this new paradigm. Effective autonomous assistance requires strict safety controls and highly efficient context management to prevent context bloat and reasoning degradation. OPENDEV overcomes these challenges through a compound AI system architecture with workload-specialized model routing, a dual-agent architecture separating planning from execution, lazy tool discovery, and adaptive context compaction that progressively reduces older observations. Furthermore, it employs an automated memory system to accumulate project-specific knowledge across sessions and counteracts instruction fade-out through event-driven system reminders. By enforcing explicit reasoning phases and prioritizing context efficiency, OPENDEV provides a secure, extensible foundation for terminal-first AI assistance, offering a blueprint for robust autonomous software engineering.
PDF62March 16, 2026