scene-capability-engine
v3.6.67
Published
SCE (Scene Capability Engine) - A CLI tool and npm package for spec-driven development with AI coding assistants.
Downloads
2,270
Maintainers
Readme
SCE - Scene Capability Engine
SCE 是面向 AI 原生软件交付的场景治理与执行引擎。
它把开放式的 Agent 工作,收敛为一条可治理的路径:goal -> scene -> spec -> task -> patch -> verify -> release。
English | 简体中文
SCE 解决什么问题
AI Agent 可以很快生成代码,但也很容易出现这些问题:
- 上下文漂移,越聊越散
- 需求、设计、任务混在会话里,难以治理
- 过程资产只存在本地会话中,没推 Git 就容易丢
- 自动执行虽然快,但缺少稳定门禁和发布证据
SCE 提供的就是这一层控制能力:
Scene 主导上下文:scene是稳定语义边界,一个项目可并行存在多条channel/session,每条通道各自维护当前scene + spec焦点Spec 先行治理:需求、设计、任务、门禁都绑定到 spec,而不是散落在聊天记录里自动闭环可控:close-loop、close-loop-program、close-loop-controller都能在边界内自动收敛本地历史可恢复:timeline、task ref、SQLite 状态让过程资产可回看、可恢复、可重跑发布级治理:handoff 证据、git 管理门禁、errorbook 学习闭环,让“看起来完成”变成“可验证完成”
核心对象模型
SCE 用一条稳定的“语义链 + 协作链”来管理 Agent 工作:
project -> scene -> specproject -> channel/session -> (scene + spec focus) -> task -> eventscene是业务连续性的主边界channel/session是协作线程,不是问题域本身spec是被治理的工作包task是面向人的最小执行单元event保留原始审计流,作为 task 背后的底层记录
这让长周期 Agent 执行不再依赖脆弱的聊天上下文,而是依赖可治理的结构化对象。
主要能力
1. Scene + Spec 治理
studio plan自动做目标 intake,并绑定或创建 spec- scene 维度的 spec 组合治理与历史 spec 回填
- 场景/规格/任务契约统一落在
.sce/下 - 支持按 scene 组织长期连续交付
2. Studio 执行流
studio plan -> generate -> apply -> verify -> release- 面向 IDE / 前端的结构化 task 流
- 层级任务引用(
scene.spec.task/SS.PP.TT),支持查询、受控重跑与按原project + channel焦点生成重跑提示 - 写操作支持 auth lease 保护
3. 自动闭环交付
sce auto close-loopsce auto close-loop-batchsce auto close-loop-programsce auto close-loop-controller- 内建 retry、fallback-chain、governance replay、异常感知调度
4. 问题闭环与 Errorbook
- problem-domain map / chain / contract / closure gate
- incident staging,先保留试错过程,再沉淀高价值错题
- 本地错题本 + 远程注册表联动
- 默认规则:重复失败后必须补充 debug 证据
5. 时间线与 SQLite 状态
- timeline save/list/show/restore/push
- SQLite 持久化 task/event/session 状态
- task ref 与 rerun 具备可追踪性和可重放性
- 支持文件到 SQLite 的渐进迁移与对账
6. 能力资产化与场景化能力
- scene/capability inventory 与治理视图
- 能力抽取、评估、发布闭环
- 支持语义观测、replay 评估、本地推广、共享 delta 导出与 native 回流重排
- 支持 shared-library mirror 发布,把合格能力从
publish_pending推进到published-shared semantic promote默认按 adopt-implied 模型立即自动共享发布合格能力- 支持 shared-sync handoff bundle 导出,把本地 semantic mirror 打包成 spec 内受治理的 bundle/index/shards/receipt
- 支持 shared-sync intake,把其他终端导出的受治理 bundle 同步回本地 semantic mirror
- 支持 scene runtime 与 ontology 驱动执行
- 支持面向 Moqui 的能力校验与 handoff 基线
快速开始
安装
npm install -g scene-capability-engine在项目中启用
sce adopt启动一个 scene 治理流程
sce studio plan --scene scene.demo --from-chat session-demo --goal "bootstrap first feature" --json
sce spec bootstrap --name 01-00-first-feature --scene scene.demo --non-interactive
sce spec pipeline run --spec 01-00-first-feature --scene scene.demo自动闭环推进
sce auto close-loop "deliver customer + order + inventory baseline"推荐使用路径
功能交付
sce studio plan --scene scene.customer-order --from-chat session-20260308 --goal "optimize checkout" --json
sce spec bootstrap --name 02-00-checkout-optimization --scene scene.customer-order --non-interactive
sce spec gate run --spec 02-00-checkout-optimization --scene scene.customer-order --json程序级自动交付
sce auto close-loop-program "stabilize order lifecycle and release governance" --program-govern-until-stable --json时间线保护
sce timeline save --summary "before risky refactor"
sce timeline list --limit 20
sce timeline restore <snapshot-id>受保护写入
sce auth grant --scope studio:* --reason "apply approved patch" --auth-password <password> --json
sce auth status --json默认治理行为
SCE 默认是强治理的。
studio plan默认执行 intake 与 scene/spec 治理,除非策略显式允许绕过- 缺少业务场景/模块/页面/实体上下文时,SCE 必须先进入澄清,而不是把未知业务范围直接变成一刀切禁用
- 连续两轮以上仍未成功定位问题时,SCE 默认要求先补
errorbookincident,再用二分式 debug 日志快速收敛范围 - 单 spec 的
spec pipeline和spec gate现在都会附带只读策略建议;当问题已经更适合multi-spec-program/research-program时,SCE 会显式提示,而不是继续把复杂问题盲目压进同一个 spec - 当 spec 绑定时,
verify和release默认执行 problem-closure 等相关门禁 close-loop-program默认带 gate 评估、fallback-chain、governance replay、auto-remediation- co-work 基线默认开启:初始化或接管后的 SCE 项目会落地
.sce/config/multi-agent.json且enabled=true,但中央 coordinator 仍保持按需开启 - 状态持久化默认优先走 SQLite,而不是零散本地缓存
CORE_PRINCIPLES.md的最高原则层默认只保留“四句教 + 小九条”;四句教先判断该不该做,小九条再判断如何把正确的事做对;治理基线进入RULES_GUIDE.md,执行经验与案例进入docs/steering-governance.md或.sce/knowledge/lessons/studio plan/studio intake/native ask默认先经过“四句教”判定闸门;对失范目标会执行clarify / rewrite / narrow / refuse,并把判定结果写入 session/job/spec 证据链- Agent 生成的脚本、报告、调试日志、测试脚本和临时分析默认进入当前 Spec 子目录;没有明确 Spec 时先用通用 Spec 承接
- 默认遵守“小九条”执行姿态:勤奋推进、先领会真实意图、先看事实、维护项目活地图、想透问题、证据足够时敢下判断、统筹 Spec/错题本/测试/现状代码/关注点、先拆解定位阻塞、持续收敛直到闭环
- 超大源文件必须定期触发重构评估;SCE 优先建议按项目给出阈值,若项目尚未设定,则默认参考
2000 / 4000 / 10000 - 发布默认验证走 integration gate:
npm run test:release
关键集成点
如果你要对接 IDE、AI 助手或前端,优先关注这些接口面:
sce studio plan|generate|apply|verify|releasesce studio eventssce task ref|show|rerunsce timeline save|list|show|restoresce capability inventorysce auth grant|status|revoke- SQLite 状态库:
.sce/state/sce-state.sqlite
面向 MagicBall 的当前关键接口还包括:
sce device currentsce device override show|upsertsce app bundle list|show|registersce app collection list|show|applysce app install-state listsce scene delivery showsce scene workspace list|show|applysce app registry status|configure|sync*sce app runtime show|releases|install|activate|uninstallsce app engineering preview|ownership|open|import|show|attach|hydrate|scaffold|activatesce project portfolio show|candidate inspect|onboarding import|target resolve|supervision showsce mode application|ontology|engineering homesce pm requirement|tracking|planning|change|issue ... --jsonsce ontology er|br|dl ... --jsonsce ontology triad summary --jsonsce assurance resource|logs|backup|config ... --json
远端示例 registry:
magicball-app-bundle-registrymagicball-app-service-catalog- 示例 app key:
customer-order-demo
面向场景的安装管理参考:
- 示例:
docs/examples/app-intent-phase1/.sce/app/... - apply JSON 契约:
docs/app-intent-apply-contract.md
文档入口
建议先看:
Moqui 与能力矩阵相关:
社区
扫码添加微信并备注 sce 入群。
License
MIT,见 LICENSE。
版本:3.6.67 最后更新:2026-03-29
