@hongmaple0820/scale-engine 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.en.md +17 -3
  2. package/README.md +143 -9
  3. package/dist/api/cli.js +1187 -30
  4. package/dist/api/cli.js.map +1 -1
  5. package/dist/codegraph/CodeIntelligence.d.ts +135 -0
  6. package/dist/codegraph/CodeIntelligence.js +460 -0
  7. package/dist/codegraph/CodeIntelligence.js.map +1 -0
  8. package/dist/context/ContextBudget.d.ts +90 -0
  9. package/dist/context/ContextBudget.js +322 -0
  10. package/dist/context/ContextBudget.js.map +1 -0
  11. package/dist/eval/WorkflowEval.d.ts +161 -0
  12. package/dist/eval/WorkflowEval.js +379 -0
  13. package/dist/eval/WorkflowEval.js.map +1 -0
  14. package/dist/governance/GovernanceRoi.d.ts +25 -0
  15. package/dist/governance/GovernanceRoi.js +70 -0
  16. package/dist/governance/GovernanceRoi.js.map +1 -0
  17. package/dist/governance/ProgressiveGovernance.d.ts +22 -0
  18. package/dist/governance/ProgressiveGovernance.js +159 -0
  19. package/dist/governance/ProgressiveGovernance.js.map +1 -0
  20. package/dist/memory/MemoryBrain.d.ts +135 -0
  21. package/dist/memory/MemoryBrain.js +635 -0
  22. package/dist/memory/MemoryBrain.js.map +1 -0
  23. package/dist/memory/index.d.ts +1 -0
  24. package/dist/memory/index.js +1 -0
  25. package/dist/memory/index.js.map +1 -1
  26. package/dist/output/GovernanceDashboard.d.ts +57 -0
  27. package/dist/output/GovernanceDashboard.js +250 -0
  28. package/dist/output/GovernanceDashboard.js.map +1 -0
  29. package/dist/output/index.d.ts +2 -0
  30. package/dist/output/index.js +1 -0
  31. package/dist/output/index.js.map +1 -1
  32. package/dist/skills/SkillRadar.d.ts +83 -0
  33. package/dist/skills/SkillRadar.js +384 -0
  34. package/dist/skills/SkillRadar.js.map +1 -0
  35. package/dist/workflow/GovernanceTemplates.js +220 -194
  36. package/dist/workflow/GovernanceTemplates.js.map +1 -1
  37. package/dist/workflow/UpgradeManager.d.ts +140 -0
  38. package/dist/workflow/UpgradeManager.js +434 -0
  39. package/dist/workflow/UpgradeManager.js.map +1 -0
  40. package/docs/CODE_INTELLIGENCE.md +138 -0
  41. package/docs/CONTEXT_BUDGET.md +87 -0
  42. package/docs/GOVERNANCE_DASHBOARD.md +69 -0
  43. package/docs/MEMORY_BRAIN.md +104 -0
  44. package/docs/README.md +17 -8
  45. package/docs/SKILL_RADAR.md +115 -0
  46. package/docs/WORKFLOW_EVAL.md +151 -0
  47. package/docs/start/README.md +5 -1
  48. package/examples/demo-projects/agent-governance-demo/CONTEXT.md +14 -0
  49. package/examples/demo-projects/agent-governance-demo/README.md +32 -21
  50. package/examples/demo-projects/agent-governance-demo/docs/CONTEXT-MAP.md +14 -0
  51. package/examples/demo-projects/agent-governance-demo/package.json +6 -1
  52. package/package.json +7 -1
package/README.en.md CHANGED
@@ -1,14 +1,14 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/version-0.18.0-orange?style=flat-square" alt="version" />
2
+ <img src="https://img.shields.io/badge/version-0.20.0-orange?style=flat-square" alt="version" />
3
3
  <img src="https://img.shields.io/badge/platforms-16-blue?style=flat-square" alt="platforms" />
4
4
  <img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
5
5
  <img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
6
6
  <img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
7
7
  <img src="https://img.shields.io/badge/tests-verified-brightgreen?style=flat-square" alt="tests" />
8
- <img src="https://img.shields.io/badge/npm-0.18.0-cb3837?style=flat-square&logo=npm" alt="npm" />
8
+ <img src="https://img.shields.io/badge/npm-0.20.0-cb3837?style=flat-square&logo=npm" alt="npm" />
9
9
  </p>
10
10
 
11
- # SCALE Engine v0.18.0
11
+ # SCALE Engine v0.20.0
12
12
 
13
13
  SCALE Engine makes AI coding agents follow engineering rules through executable workflow gates, evidence files, and review constraints instead of relying on prompt discipline alone. It helps humans see what the agent explored, planned, verified, skipped, and why a task is or is not ready to ship.
14
14
 
@@ -241,6 +241,20 @@ npx vitest run tests/workflow/reviewAnalyzer.test.ts tests/workflow/reviewStore.
241
241
 
242
242
  ## Release Notes
243
243
 
244
+ ### v0.20.0
245
+
246
+ - Added Context Budget and Progressive Governance so low-risk S tasks stay lightweight while auth, data, security, deployment, and cross-module changes escalate automatically.
247
+ - Added Code Intelligence with adapter-first CodeGraph / Graphify support, explicit fallback, impact analysis, context recommendations, and exploration ROI.
248
+ - Added Workflow Eval, Failure Replay, and improvement candidates with pass@k, fix iterations, tool-call counts, token estimates, and human-correction metrics.
249
+ - Added Skill Radar for intent-based skills, MCP, browser, desktop automation, and external CLI recommendations with confidence, safety level, and evidence requirements.
250
+ - Added Memory Brain for evidence-backed long-term memory candidates, contradiction detection, dream maintenance, explicit promotion, and failure replay ingestion.
251
+ - Added Governance Dashboard to summarize runtime, eval, memory, resource, and HTML artifact evidence in a local HTML review surface.
252
+ - Fixed new `--dir` aware commands so relative `.scale` state resolves inside the target project instead of the caller workspace.
253
+
254
+ ### v0.19.0
255
+
256
+ - Added product smoke gates, runtime evidence learning settlement, memory context packs, workspace conflict blockers, and release-readiness demo coverage.
257
+
244
258
  ### v0.18.0
245
259
 
246
260
  - Governed HTML artifacts: `scale artifact render/doctor/settle/open`.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/version-0.18.0-orange?style=flat-square" alt="version" />
2
+ <img src="https://img.shields.io/badge/version-0.20.0-orange?style=flat-square" alt="version" />
3
3
  <img src="https://img.shields.io/badge/platforms-16-blue?style=flat-square" alt="platforms" />
4
4
  <img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
5
5
  <img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
6
6
  <img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
7
7
  <img src="https://img.shields.io/badge/tests-verified-brightgreen?style=flat-square" alt="tests" />
8
- <img src="https://img.shields.io/badge/npm-0.18.0-cb3837?style=flat-square&logo=npm" alt="npm" />
8
+ <img src="https://img.shields.io/badge/npm-0.20.0-cb3837?style=flat-square&logo=npm" alt="npm" />
9
9
  </p>
10
10
 
11
- # SCALE Engine v0.18.0
11
+ # SCALE Engine v0.20.0
12
12
 
13
13
  SCALE Engine 让 AI Agent 不再只靠“自觉”遵守工程规范。它把探索、规划、实现、验证、评审、发版这些要求变成可执行的命令、门禁和证据文件,让人类可以看见 Agent 做了什么、跳过了什么、为什么不能交付。
14
14
 
@@ -17,6 +17,18 @@ SCALE Engine 让 AI Agent 不再只靠“自觉”遵守工程规范。它把探
17
17
  npm:https://www.npmjs.com/package/@hongmaple0820/scale-engine
18
18
  语言:[中文](README.md) | [English](README.en.md)
19
19
 
20
+ ## 🌐 社区与推广
21
+
22
+ ### 链接
23
+
24
+ | 平台 | 链接 | 说明 |
25
+ |------|------|------|
26
+ | 🌐 **官网** | [https://scale-os.vercel.app](https://scale-os.vercel.app) | 在线配置器 + 完整文档 |
27
+ | 📦 **GitHub** | [https://github.com/hongmaple0820/scale-os](https://github.com/hongmaple0820/scale-os) | 源码 + Issues + PR |
28
+ | 🔧 **Gitee** | [https://gitee.com/hongmaple/scale-engine](https://gitee.com/hongmaple/scale-engine) | 国内镜像 |
29
+ | 📦 **npm** | [https://www.npmjs.com/package/@hongmaple0820/scale-engine](https://www.npmjs.com/package/@hongmaple0820/scale-engine) | 包下载 |
30
+ | 🧰 **项目脚手架** | [https://github.com/hongmaple0820/project-scaffold](https://github.com/hongmaple0820/project-scaffold) | 工程化工作流实践脚手架 |
31
+
20
32
  ## 它解决什么问题
21
33
 
22
34
  AI 编码真正难的不是“写代码”,而是持续稳定地遵守工程纪律:
@@ -90,6 +102,30 @@ scale --version
90
102
 
91
103
  需要 Node.js 20 或更高版本。
92
104
 
105
+ ## 更新工作流
106
+
107
+ SCALE 把升级分成三层:CLI 自身、已生成到项目里的 governance pack 文件、第三方 skills/MCP/CLI 能力。默认只检查和生成计划,不自动覆盖用户改过的文件,也不自动安装第三方工具。
108
+
109
+ ```bash
110
+ scale upgrade check --dir .
111
+ scale upgrade plan --dir . --html
112
+ scale upgrade apply --dir . --confirm
113
+ scale upgrade rollback --dir .
114
+ scale tools outdated --dir .
115
+ scale skill outdated --dir .
116
+ ```
117
+
118
+ 升级原则:
119
+
120
+ - `scale upgrade check` 读取 `.scale/governance.lock.json`,判断当前项目是干净、缺文件、模板过期,还是存在本地改动。
121
+ - `scale upgrade plan` 生成非破坏性计划;遇到用户改过的生成文件时标记 `manual-review`。
122
+ - `scale upgrade apply --confirm` 只恢复缺失生成文件和刷新锁文件,先写 `.scale/backups/upgrade-*` 回滚点。
123
+ - `scale upgrade rollback` 只撤回最近一次 SCALE 管理的安全应用。
124
+ - `scale tools outdated` 和 `scale skill outdated` 只列出更新面、来源、信任等级和安全策略,不做自动安装。
125
+ - 第三方社区来源默认人工评审,高权限桌面自动化默认阻断自动升级。
126
+
127
+ 详细说明见 [升级管理](docs/UPGRADE_MANAGEMENT.md)。
128
+
93
129
  ## Governance Pack
94
130
 
95
131
  在已有项目中安装治理工作流:
@@ -190,6 +226,102 @@ scale memory settle --task "Fix OAuth callback state lookup" --task-id <task-id>
190
226
 
191
227
  详见 [Memory Fabric](docs/MEMORY_FABRIC.md)。
192
228
 
229
+ ## Context Budget 与 Progressive Governance
230
+
231
+ Context Budget 会把 always-loaded、on-demand、evidence、archive、generated 上下文分开统计,避免 Agent 把所有规则、历史方案、报告和生成物一次性塞进提示词。
232
+
233
+ ```bash
234
+ scale context budget --json
235
+ scale context doctor --max-always 2500 --max-task 8000
236
+ scale context pack --task "Review frontend route with browser evidence" --level L --budget 4000 --json
237
+ ```
238
+
239
+ Progressive Governance 会根据任务文本和变更文件自动推荐 `minimal`、`standard`、`expanded` 或 `critical` 治理模式,并用 ROI 报告解释治理收益和开销:
240
+
241
+ ```bash
242
+ scale governance mode --task "Change auth permissions" --files src/auth/user.ts --requested-mode minimal --json
243
+ scale governance roi --task-id <task-id> --task "Review frontend route" --files src/routes/upload.tsx --json
244
+ ```
245
+
246
+ 详见 [Context Budget And Progressive Governance](docs/CONTEXT_BUDGET.md)。
247
+
248
+ ## Code Intelligence 与探索 ROI
249
+
250
+ Code Intelligence 是 adapter-first 的代码理解层:优先消费外部 CodeGraph 或 Graphify 产物,缺失时明确降级到内部 source scan,不静默假装已经完成代码图谱分析。
251
+
252
+ ```bash
253
+ scale codegraph init
254
+ scale codegraph status --json
255
+ scale codegraph query "UserService.create" --json
256
+ scale codegraph impact --symbol UserService.create --json
257
+ scale codegraph context --symbol UserService.create --budget 2000 --json
258
+ scale codegraph roi --symbol UserService.create --json
259
+ ```
260
+
261
+ 它会输出 provider、fallback 状态、相关文件、confidence,以及 `fileReadsSaved` / `toolCallsSaved` 等探索收益指标。`scale governance roi` 也可以通过 `--symbol` 或 `--code-query` 把代码智能纳入治理 ROI。
262
+
263
+ 详见 [Code Intelligence](docs/CODE_INTELLIGENCE.md)。
264
+
265
+ ## Workflow Eval 与 Failure Replay
266
+
267
+ Workflow Eval 用轻量套件衡量工作流是否真的减少返工、工具调用、token 消耗和人类纠偏。失败时会保留 Failure Replay,而不是只留下一个失败状态。
268
+
269
+ ```bash
270
+ scale eval init
271
+ scale eval run --suite workflow-baseline --json
272
+ scale eval compare --baseline <run-id> --candidate <run-id> --json
273
+ scale eval failures --since 30d --json
274
+ scale eval promote-failure <failure-id>
275
+ ```
276
+
277
+ 默认产物写入 `.scale/evals/`,属于本地运行时证据。长期提交到 Git 的应是经过整理的报告、基准 fixture 或明确要沉淀的改进项。
278
+
279
+ 详见 [Workflow Eval Harness](docs/WORKFLOW_EVAL.md)。
280
+
281
+ ## Skill Radar
282
+
283
+ Skill Radar chooses skills, MCP, browser automation, desktop automation, and external CLIs by task intent instead of relying on a static prompt list. It returns confidence, safety level, evidence requirements, and fallback behavior so agents can actively use tools without silently crossing safety boundaries.
284
+
285
+ ```bash
286
+ scale skill radar --task "Design upload UI and run browser E2E checks" --files src/pages/upload.tsx
287
+ scale skill radar --task "Automate WPS desktop workflow with CUA" --json
288
+ scale skill doctor --supply-chain
289
+ ```
290
+
291
+ Desktop CUA and external agent CLIs are blocked by default through Tool Policy until deliberately enabled. Third-party skills stay review-required until source, scripts, license, and pinned revision are checked.
292
+
293
+ See [Skill Radar](docs/SKILL_RADAR.md).
294
+
295
+ ## Memory Brain
296
+
297
+ Memory Brain stores long-term project knowledge separately from the short context pack. Runtime evidence and learning candidates enter as candidates first; active memory requires evidence paths, project scope, confidence, and explicit promotion.
298
+
299
+ ```bash
300
+ scale memory ingest --from evidence --task-id <task-id>
301
+ scale memory ingest --from failure --failure-id <failure-replay-id>
302
+ scale memory query "OAuth callback state design"
303
+ scale memory contradictions --json
304
+ scale memory dream --json
305
+ scale memory promote <candidate-id>
306
+ ```
307
+
308
+ The point is not to remember everything. The point is to keep useful, reviewed project facts while reporting contradictions instead of silently overwriting them.
309
+
310
+ See [Memory Brain](docs/MEMORY_BRAIN.md).
311
+
312
+ ## Governance Dashboard
313
+
314
+ Governance Dashboard renders a local HTML health view from runtime evidence, Workflow Eval, Memory Brain, Resource Governance, and task HTML artifacts:
315
+
316
+ ```bash
317
+ scale artifact dashboard
318
+ scale artifact dashboard --task-id <task-id> --json
319
+ ```
320
+
321
+ Default output is `.scale/reports/governance-dashboard.html`. Markdown and JSON remain the maintainable source of truth; the dashboard is a review surface for humans.
322
+
323
+ See [Governance Dashboard](docs/GOVERNANCE_DASHBOARD.md).
324
+
193
325
  ## Runtime Evidence
194
326
 
195
327
  M/L/CRITICAL 任务在最终交付前应留下运行时证据,避免 Agent 没有真实验证就声称完成:
@@ -297,13 +429,15 @@ npx vitest run tests/workflow/phaseCli.test.ts
297
429
  npx vitest run tests/workflow/reviewAnalyzer.test.ts tests/workflow/reviewStore.test.ts tests/workflow/gateSystem.test.ts
298
430
  ```
299
431
 
300
- ## Unreleased
432
+ ## v0.20.0 Updates
301
433
 
302
- - 新增 Runtime Evidence + Memory Fabric:`scale runtime start/end/record/doctor/final-check` `scale memory pack/doctor/settle`。
303
- - `memory settle` 会把真实运行证据沉淀为本地学习候选,默认需要人审后才能进入长期知识库或工程规范。
304
- - 官方 demo 已加入 runtime evidence、memory settle HTML artifact 的完整闭环 smoke 测试。
305
- - 修复绝对 `SCALE_DIR` resource governance engineering standards 中被错误拼到项目目录下的问题。
306
- - 发版前质量门槛见 [Release Readiness](docs/RELEASE_READINESS.md),官方 demo 必须跑通完整闭环后再发版。
434
+ - Added Context Budget and Progressive Governance so low-risk S tasks stay lightweight while auth, data, security, deployment, and cross-module changes escalate automatically.
435
+ - Added Code Intelligence with adapter-first CodeGraph / Graphify support, explicit fallback, impact analysis, context recommendations, and exploration ROI.
436
+ - Added Workflow Eval, Failure Replay, and improvement candidates with pass@k, fix iterations, tool-call counts, token estimates, and human-correction metrics.
437
+ - Added Skill Radar for intent-based skills, MCP, browser, desktop automation, and external CLI recommendations with confidence, safety level, and evidence requirements.
438
+ - Added Memory Brain for evidence-backed long-term memory candidates, contradiction detection, dream maintenance, explicit promotion, and failure replay ingestion.
439
+ - Added Governance Dashboard to summarize runtime, eval, memory, resource, and HTML artifact evidence in a local HTML review surface.
440
+ - Fixed new --dir-aware commands so relative .scale state resolves inside the target project instead of the caller workspace.
307
441
 
308
442
  ## v0.18.0 更新
309
443