Sema代码:将AI编程代理解耦为可编程、可嵌入的基础设施
Sema Code: Decoupling AI Coding Agents into Programmable, Embeddable Infrastructure
April 13, 2026
作者: Huacan Wang, Jie Zhou, Ningyan Zhu, Shuo Zhang, Feiyu Chen, Jiarou Wu, Ge Chen, Chen Liu, Wangyi Chen, Xiaofeng Mou, Yi Xu
cs.AI
摘要
AI编程助手已成为开发者工作流的核心,然而现有解决方案均将其推理能力局限于特定交付形态中,如命令行工具、IDE插件或网页应用。这种限制在企业尝试跨异构工程环境复用这些能力时形成了系统性障碍。为解决这一挑战,我们推出Sema Code——一个基于可嵌入、可插拔、框架优先原则构建的开放式AI编程框架。Sema Code将核心智能体引擎与所有客户端层完全解耦,将其作为独立npm库发布,可供任何运行时环境编程驱动。围绕该架构,我们设计了八大核心机制:多租户引擎隔离、支持安全会话重建的FIFO输入队列、自适应上下文压缩、多智能体协作调度、基于智能任务清单的流程管理、四层异步权限控制、覆盖MCP协议/技能/插件的三级生态集成体系,以及执行与观察权限分离的后台任务框架。这些机制共同解决了将复杂智能体引擎转化为可共享、可编程核心的工程挑战。为展现其架构灵活性,同一Sema Core引擎同时驱动着VSCode扩展插件与被命名为SemaClaw的多通道消息网关,后者可统一处理Telegram、飞书等平台的智能体交互。这展示了两种根本不同的产品形态共享同一推理内核,仅在最外层客户端产生差异的设计理念。
English
AI coding agents have become central to developer workflows, yet every existing solution locks its reasoning capabilities within a specific delivery form, such as a CLI, IDE plugin, or web application. This limitation creates systemic barriers when enterprises attempt to reuse these capabilities across heterogeneous engineering environments. To address this challenge, we present Sema Code, an open AI coding framework built on the principle of being embeddable, pluggable, and framework-first. Sema Code completely decouples the core agent engine from all client layers, publishing it as a standalone npm library that any runtime can drive programmatically. Built around this architecture, we designed eight key mechanisms: multi-tenant engine isolation, FIFO input queuing with safe session reconstruction, adaptive context compression, multi-agent collaborative scheduling, intelligent Todo-based process management, four-layer asynchronous permission control, three-tier ecosystem integration spanning MCP, Skills, and Plugins, and a background task framework with separated execution and observation privileges. These mechanisms collectively address the engineering challenges of transforming a complex agent engine into a shared, programmable core. Demonstrating its architectural versatility, the same Sema Core engine simultaneously powers a VSCode extension and a multi-channel messaging gateway, which we name SemaClaw, to unify agent interactions across platforms such as Telegram and Feishu. These represent two fundamentally different product forms sharing an identical reasoning kernel, differing only at the client layer.