@hongmaple0820/scale-engine 0.25.0 → 0.27.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 (171) hide show
  1. package/LICENSE +15 -15
  2. package/README.en.md +384 -346
  3. package/README.md +564 -529
  4. package/dist/adapters/AiderAdapter.js +52 -52
  5. package/dist/adapters/AntigravityAdapter.d.ts +4 -0
  6. package/dist/adapters/AntigravityAdapter.js +21 -0
  7. package/dist/adapters/AntigravityAdapter.js.map +1 -0
  8. package/dist/adapters/ClaudeCodeAdapter.d.ts +4 -1
  9. package/dist/adapters/ClaudeCodeAdapter.js +34 -34
  10. package/dist/adapters/ClaudeCodeAdapter.js.map +1 -1
  11. package/dist/adapters/ClineAdapter.d.ts +4 -0
  12. package/dist/adapters/ClineAdapter.js +20 -0
  13. package/dist/adapters/ClineAdapter.js.map +1 -0
  14. package/dist/adapters/CodexAdapter.js +28 -28
  15. package/dist/adapters/CursorAdapter.js +26 -26
  16. package/dist/adapters/DeepSeekTuiAdapter.js +97 -97
  17. package/dist/adapters/DoubaoAdapter.js +33 -33
  18. package/dist/adapters/GeminiAdapter.js +26 -26
  19. package/dist/adapters/GenericProjectAgentAdapter.d.ts +29 -0
  20. package/dist/adapters/GenericProjectAgentAdapter.js +204 -0
  21. package/dist/adapters/GenericProjectAgentAdapter.js.map +1 -0
  22. package/dist/adapters/HermesAdapter.js +26 -26
  23. package/dist/adapters/JCodeAdapter.d.ts +4 -0
  24. package/dist/adapters/JCodeAdapter.js +19 -0
  25. package/dist/adapters/JCodeAdapter.js.map +1 -0
  26. package/dist/adapters/KiloCodeAdapter.d.ts +4 -0
  27. package/dist/adapters/KiloCodeAdapter.js +20 -0
  28. package/dist/adapters/KiloCodeAdapter.js.map +1 -0
  29. package/dist/adapters/KimiAdapter.js +32 -32
  30. package/dist/adapters/KiroAdapter.js +26 -26
  31. package/dist/adapters/OpenClawAdapter.js +26 -26
  32. package/dist/adapters/OpenCodeAdapter.js +26 -26
  33. package/dist/adapters/QCoderAdapter.js +26 -26
  34. package/dist/adapters/QoderAdapter.d.ts +4 -0
  35. package/dist/adapters/QoderAdapter.js +21 -0
  36. package/dist/adapters/QoderAdapter.js.map +1 -0
  37. package/dist/adapters/TraeAdapter.js +26 -26
  38. package/dist/adapters/VSCAdapter.js +26 -26
  39. package/dist/adapters/WindsurfAdapter.js +32 -32
  40. package/dist/adapters/WorkBuddyAdapter.js +26 -26
  41. package/dist/adapters/index.d.ts +5 -0
  42. package/dist/adapters/index.js +15 -0
  43. package/dist/adapters/index.js.map +1 -1
  44. package/dist/api/cli.js +190 -56
  45. package/dist/api/cli.js.map +1 -1
  46. package/dist/api/doctor.js +10 -3
  47. package/dist/api/doctor.js.map +1 -1
  48. package/dist/api/quickstart.js +7 -1
  49. package/dist/api/quickstart.js.map +1 -1
  50. package/dist/artifact/sqliteStore.js +89 -89
  51. package/dist/artifact/types.d.ts +1 -1
  52. package/dist/cli/phaseCommands.js +53 -53
  53. package/dist/cli/phaseCommands.js.map +1 -1
  54. package/dist/context/AntiPatternRegistry.js +20 -20
  55. package/dist/context/ContextBudget.d.ts +14 -0
  56. package/dist/context/ContextBudget.js +50 -14
  57. package/dist/context/ContextBudget.js.map +1 -1
  58. package/dist/context/ContextBuilder.js +155 -155
  59. package/dist/context/ContextCompiler.d.ts +34 -0
  60. package/dist/context/ContextCompiler.js +120 -0
  61. package/dist/context/ContextCompiler.js.map +1 -0
  62. package/dist/eval/WorkflowEval.js +4 -6
  63. package/dist/eval/WorkflowEval.js.map +1 -1
  64. package/dist/evolution/EvolutionEngine.js +31 -31
  65. package/dist/evolution/EvolutionEvaluator.d.ts +2 -0
  66. package/dist/evolution/EvolutionEvaluator.js +7 -1
  67. package/dist/evolution/EvolutionEvaluator.js.map +1 -1
  68. package/dist/fsm/FSMAgentBridge.js +11 -11
  69. package/dist/governance/GovernanceRoi.d.ts +6 -1
  70. package/dist/governance/GovernanceRoi.js +32 -0
  71. package/dist/governance/GovernanceRoi.js.map +1 -1
  72. package/dist/guardrails/DependencyAuditor.js +38 -0
  73. package/dist/guardrails/DependencyAuditor.js.map +1 -1
  74. package/dist/hooks/HookGeneratorEnhanced.js +218 -218
  75. package/dist/index.d.ts +2 -1
  76. package/dist/index.js +3 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/knowledge/SQLiteKnowledgeBase.js +28 -28
  79. package/dist/memory/MemoryBrain.js +52 -52
  80. package/dist/output/GovernanceDashboard.js +44 -44
  81. package/dist/output/HTMLArtifactLayer.js +31 -31
  82. package/dist/prompts/VibeTemplateGallery.js +121 -121
  83. package/dist/runtime/AiOsRuntime.d.ts +53 -0
  84. package/dist/runtime/AiOsRuntime.js +142 -0
  85. package/dist/runtime/AiOsRuntime.js.map +1 -0
  86. package/dist/runtime/index.d.ts +1 -0
  87. package/dist/runtime/index.js +1 -0
  88. package/dist/runtime/index.js.map +1 -1
  89. package/dist/skills/SkillDiscovery.js +12 -1
  90. package/dist/skills/SkillDiscovery.js.map +1 -1
  91. package/dist/skills/routing/SkillPlanner.js +128 -40
  92. package/dist/skills/routing/SkillPlanner.js.map +1 -1
  93. package/dist/skills/routing/SkillRoutingTypes.d.ts +17 -0
  94. package/dist/tools/SafeCommandRunner.d.ts +16 -0
  95. package/dist/tools/SafeCommandRunner.js +83 -0
  96. package/dist/tools/SafeCommandRunner.js.map +1 -0
  97. package/dist/workflow/EngineeringStandards.js +62 -62
  98. package/dist/workflow/GovernanceTemplatePacks.d.ts +1 -1
  99. package/dist/workflow/GovernanceTemplatePacks.js +1990 -162
  100. package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
  101. package/dist/workflow/GovernanceTemplates.d.ts +2 -0
  102. package/dist/workflow/GovernanceTemplates.js +1012 -1001
  103. package/dist/workflow/GovernanceTemplates.js.map +1 -1
  104. package/dist/workflow/ResourceGovernance.js +16 -16
  105. package/dist/workflow/TaskArtifactScaffolder.js +10 -10
  106. package/dist/workflow/UpgradeManager.d.ts +3 -2
  107. package/dist/workflow/UpgradeManager.js +134 -49
  108. package/dist/workflow/UpgradeManager.js.map +1 -1
  109. package/dist/workflow/WorkspaceTopology.js +18 -15
  110. package/dist/workflow/WorkspaceTopology.js.map +1 -1
  111. package/dist/workflow/gates/GateSystem.js +3 -9
  112. package/dist/workflow/gates/GateSystem.js.map +1 -1
  113. package/docs/ACTIVE_SECURITY_VISUAL_GATES.md +87 -87
  114. package/docs/AI_ENGINEERING_OS_POSITIONING.md +462 -0
  115. package/docs/BACKGROUND_HUNTER.md +62 -62
  116. package/docs/CODE_INTELLIGENCE.md +138 -138
  117. package/docs/CONTEXT_BUDGET.md +155 -113
  118. package/docs/DEPENDENCY_AUDIT.md +118 -89
  119. package/docs/EVOLUTION_SHADOW_MODE.md +63 -63
  120. package/docs/EXTERNAL_REFERENCES.md +63 -58
  121. package/docs/GITLAB_FLOW.md +125 -125
  122. package/docs/GOVERNANCE_DASHBOARD.md +85 -85
  123. package/docs/MEMORY_BRAIN.md +104 -104
  124. package/docs/MEMORY_FABRIC.md +136 -134
  125. package/docs/README.md +102 -92
  126. package/docs/RUNTIME_EVIDENCE.md +101 -101
  127. package/docs/SKILL-REPOSITORY.md +57 -57
  128. package/docs/SKILL_RADAR.md +135 -122
  129. package/docs/THIRD_PARTY_SKILLS.md +57 -57
  130. package/docs/WORKFLOW_EVAL.md +151 -151
  131. package/docs/guides/DEVELOPMENT_WORKFLOW.md +80 -0
  132. package/docs/guides/GETTING_STARTED.md +50 -0
  133. package/docs/start/README.md +78 -72
  134. package/docs/start/agent-governance-demo.md +107 -107
  135. package/docs/start/quickstart.md +137 -127
  136. package/docs/start/workflow-upgrade.md +32 -8
  137. package/docs/workflow/README.md +67 -0
  138. package/docs/workflow/node-library.md +52 -0
  139. package/docs/workflow/templates/api-contract.md +29 -0
  140. package/docs/workflow/templates/architecture-review.md +23 -0
  141. package/docs/workflow/templates/db-change-plan.md +20 -0
  142. package/docs/workflow/templates/docs-impact.md +17 -0
  143. package/docs/workflow/templates/e2e-plan.md +20 -0
  144. package/docs/workflow/templates/explore.md +16 -0
  145. package/docs/workflow/templates/github-actions-scale-preflight.yml +32 -0
  146. package/docs/workflow/templates/mini-prd.md +16 -0
  147. package/docs/workflow/templates/plan.md +37 -0
  148. package/docs/workflow/templates/pre-push-scale-preflight.sh +8 -0
  149. package/docs/workflow/templates/product-smoke.md +61 -0
  150. package/docs/workflow/templates/reality-check.md +28 -0
  151. package/docs/workflow/templates/resource-cleanup.md +17 -0
  152. package/docs/workflow/templates/resource-impact.md +25 -0
  153. package/docs/workflow/templates/review.md +12 -0
  154. package/docs/workflow/templates/runtime.md +23 -0
  155. package/docs/workflow/templates/security-review.md +26 -0
  156. package/docs/workflow/templates/skill-evidence.md +33 -0
  157. package/docs/workflow/templates/skill-plan.md +39 -0
  158. package/docs/workflow/templates/spec.md +17 -0
  159. package/docs/workflow/templates/standards-impact.md +28 -0
  160. package/docs/workflow/templates/summary.md +16 -0
  161. package/docs/workflow/templates/tasks.md +8 -0
  162. package/docs/workflow/templates/ui-spec.md +29 -0
  163. package/docs/workflow/templates/verification.md +20 -0
  164. package/docs/workflow/templates/visual-review.md +20 -0
  165. package/examples/demo-projects/agent-governance-demo/CONTEXT.md +14 -14
  166. package/examples/demo-projects/agent-governance-demo/README.md +48 -48
  167. package/examples/demo-projects/agent-governance-demo/docs/CONTEXT-MAP.md +14 -14
  168. package/examples/demo-projects/agent-governance-demo/package.json +22 -21
  169. package/examples/demo-projects/agent-governance-demo/src/oauth-state.ts +39 -39
  170. package/examples/demo-projects/agent-governance-demo/tests/oauth-state.test.ts +52 -52
  171. package/package.json +95 -78
@@ -1,125 +1,125 @@
1
- # GitLab Flow Branch and Worktree Policy
2
-
3
- SCALE Engine uses a GitLab Flow variant for this repository:
4
-
5
- ```text
6
- feat/* / fix/* / chore/* / docs/* / codex/*
7
- -> dev
8
- -> master
9
- -> vX.Y.Z tag
10
- -> npm publish
11
-
12
- hotfix:
13
- fix forward on dev first when possible
14
- -> cherry-pick to hotfix/*
15
- -> master
16
- -> vX.Y.Z tag
17
- -> sync master back to dev
18
-
19
- selective release, only when dev contains work that must not ship:
20
- master
21
- -> release/vX.Y.Z
22
- -> cherry-pick selected commits
23
- -> master
24
- -> vX.Y.Z tag
25
- -> sync master back to dev
26
- ```
27
-
28
- ## Branch Roles
29
-
30
- | Branch | Role | Rule |
31
- | --- | --- | --- |
32
- | `dev` | Integration and test branch | Merge reviewed short branches here. Do not create direct governed commits on `dev`. |
33
- | `master` | Production branch | Only verified release/hotfix results land here. Publish from user-created `vX.Y.Z` tags on `master`. |
34
- | `feat/*`, `feature/*` | Feature branches | Start from current `dev`, merge back to `dev`, then delete. |
35
- | `fix/*` | Normal bug fix branches | Start from current `dev`, merge back to `dev`, then delete. |
36
- | `chore/*`, `docs/*`, `codex/*` | Maintenance branches | Short-lived work branches that merge back to `dev`. |
37
- | `hotfix/*` | Production patch branches | Use only for production fixes. Fix forward to `dev` first when possible, then cherry-pick to hotfix/master. |
38
- | `release/*` | Selective release branch | Use only when `dev` contains work that must not ship. Start from `master` and cherry-pick the release list. |
39
-
40
- ## Required Checks
41
-
42
- Run the release-grade verification set before merging to `master` or tagging:
43
-
44
- ```bash
45
- npm run build
46
- npx vitest run
47
- git diff --check
48
- npm pack --dry-run
49
- ```
50
-
51
- Every merge request should run the relevant build/lint/test checks before review is accepted. Do not wait until `master` to discover broken tests.
52
-
53
- ## Merge and Conflict Rules
54
-
55
- - Public branches are not rebased: `dev`, `master`, `release/*`, and `hotfix/*` keep realistic history.
56
- - Personal short branches may be rebased before merge, but only with `--force-with-lease` and only before review is accepted.
57
- - Prefer squash merge from short branches into `dev` when one logical change should be easy to revert.
58
- - Resolve conflicts on the source branch, rerun verification, then merge. Do not resolve release conflicts directly on `master`.
59
- - Fix bugs forward first: land the fix on `dev` when possible, then cherry-pick the same commit to `hotfix/*` or the selected patch release branch.
60
- - Commit messages should explain intent and why the chosen path was selected when the decision is not obvious.
61
-
62
- ## Ship Gate Rules
63
-
64
- `scale ship <task-id>` now enforces the branch lifecycle:
65
-
66
- - blocked on `dev`, `master`, `main`, and detached HEAD
67
- - allowed on configured short branches such as `feat/*`, `fix/*`, `chore/*`, `docs/*`, `codex/*`, `release/*`, and `hotfix/*`
68
- - still requires verification evidence, passing review evidence, and reviewed-file-only staging
69
- - still blocks dirty or unsafe child repositories in MOE/submodule workspaces
70
-
71
- Use:
72
-
73
- ```bash
74
- scale workspace status --summary
75
- scale workspace finish --summary
76
- scale workspace finish --json
77
- ```
78
-
79
- The report includes branch role, whether governed shipping is allowed, and cleanup blockers.
80
-
81
- ## Worktree Lifecycle
82
-
83
- Temporary agent worktrees are safe to remove only when all of these are true:
84
-
85
- - root worktree is clean
86
- - child repositories are clean and pushed when required
87
- - the temporary branch has no unpushed commits
88
- - a branch with no upstream is already merged into `dev`/`master`, or it contains no unique work
89
-
90
- Cleanup remains dry-run by default:
91
-
92
- ```bash
93
- scale workspace cleanup --dir <temporary-worktree> --dry-run --json
94
- scale workspace cleanup --dir <temporary-worktree> --apply --confirm <branch-or-head> --json
95
- ```
96
-
97
- If cleanup is blocked, push the branch, merge it, cherry-pick it into the selected release, or explicitly discard it before removing the worktree.
98
-
99
- ## Repository Bootstrap
100
-
101
- This repository currently treats `dev` as the integration branch and `master` as production. If `dev` falls behind `master` and has no unique commits, fast-forward `dev` to `master` before starting new feature work:
102
-
103
- ```bash
104
- git fetch --all --prune
105
- git switch dev
106
- git merge --ff-only master
107
- git push origin dev
108
- git push github dev
109
- ```
110
-
111
- After that, normal work should start from `dev`:
112
-
113
- ```bash
114
- git switch dev
115
- git pull --ff-only origin dev
116
- git switch -c feat/<short-name>
117
- ```
118
-
119
- Before creating a normal release from `dev`, inspect the release delta:
120
-
121
- ```bash
122
- git log --oneline master..dev
123
- ```
124
-
125
- If every listed commit is intended for the next production release, merge `dev` through the normal release path. If any commit must be excluded, create `release/vX.Y.Z` from `master` and cherry-pick only the approved release list.
1
+ # GitLab Flow Branch and Worktree Policy
2
+
3
+ SCALE Engine uses a GitLab Flow variant for this repository:
4
+
5
+ ```text
6
+ feat/* / fix/* / chore/* / docs/* / codex/*
7
+ -> dev
8
+ -> master
9
+ -> vX.Y.Z tag
10
+ -> npm publish
11
+
12
+ hotfix:
13
+ fix forward on dev first when possible
14
+ -> cherry-pick to hotfix/*
15
+ -> master
16
+ -> vX.Y.Z tag
17
+ -> sync master back to dev
18
+
19
+ selective release, only when dev contains work that must not ship:
20
+ master
21
+ -> release/vX.Y.Z
22
+ -> cherry-pick selected commits
23
+ -> master
24
+ -> vX.Y.Z tag
25
+ -> sync master back to dev
26
+ ```
27
+
28
+ ## Branch Roles
29
+
30
+ | Branch | Role | Rule |
31
+ | --- | --- | --- |
32
+ | `dev` | Integration and test branch | Merge reviewed short branches here. Do not create direct governed commits on `dev`. |
33
+ | `master` | Production branch | Only verified release/hotfix results land here. Publish from user-created `vX.Y.Z` tags on `master`. |
34
+ | `feat/*`, `feature/*` | Feature branches | Start from current `dev`, merge back to `dev`, then delete. |
35
+ | `fix/*` | Normal bug fix branches | Start from current `dev`, merge back to `dev`, then delete. |
36
+ | `chore/*`, `docs/*`, `codex/*` | Maintenance branches | Short-lived work branches that merge back to `dev`. |
37
+ | `hotfix/*` | Production patch branches | Use only for production fixes. Fix forward to `dev` first when possible, then cherry-pick to hotfix/master. |
38
+ | `release/*` | Selective release branch | Use only when `dev` contains work that must not ship. Start from `master` and cherry-pick the release list. |
39
+
40
+ ## Required Checks
41
+
42
+ Run the release-grade verification set before merging to `master` or tagging:
43
+
44
+ ```bash
45
+ npm run build
46
+ npx vitest run
47
+ git diff --check
48
+ npm pack --dry-run
49
+ ```
50
+
51
+ Every merge request should run the relevant build/lint/test checks before review is accepted. Do not wait until `master` to discover broken tests.
52
+
53
+ ## Merge and Conflict Rules
54
+
55
+ - Public branches are not rebased: `dev`, `master`, `release/*`, and `hotfix/*` keep realistic history.
56
+ - Personal short branches may be rebased before merge, but only with `--force-with-lease` and only before review is accepted.
57
+ - Prefer squash merge from short branches into `dev` when one logical change should be easy to revert.
58
+ - Resolve conflicts on the source branch, rerun verification, then merge. Do not resolve release conflicts directly on `master`.
59
+ - Fix bugs forward first: land the fix on `dev` when possible, then cherry-pick the same commit to `hotfix/*` or the selected patch release branch.
60
+ - Commit messages should explain intent and why the chosen path was selected when the decision is not obvious.
61
+
62
+ ## Ship Gate Rules
63
+
64
+ `scale ship <task-id>` now enforces the branch lifecycle:
65
+
66
+ - blocked on `dev`, `master`, `main`, and detached HEAD
67
+ - allowed on configured short branches such as `feat/*`, `fix/*`, `chore/*`, `docs/*`, `codex/*`, `release/*`, and `hotfix/*`
68
+ - still requires verification evidence, passing review evidence, and reviewed-file-only staging
69
+ - still blocks dirty or unsafe child repositories in MOE/submodule workspaces
70
+
71
+ Use:
72
+
73
+ ```bash
74
+ scale workspace status --summary
75
+ scale workspace finish --summary
76
+ scale workspace finish --json
77
+ ```
78
+
79
+ The report includes branch role, whether governed shipping is allowed, and cleanup blockers.
80
+
81
+ ## Worktree Lifecycle
82
+
83
+ Temporary agent worktrees are safe to remove only when all of these are true:
84
+
85
+ - root worktree is clean
86
+ - child repositories are clean and pushed when required
87
+ - the temporary branch has no unpushed commits
88
+ - a branch with no upstream is already merged into `dev`/`master`, or it contains no unique work
89
+
90
+ Cleanup remains dry-run by default:
91
+
92
+ ```bash
93
+ scale workspace cleanup --dir <temporary-worktree> --dry-run --json
94
+ scale workspace cleanup --dir <temporary-worktree> --apply --confirm <branch-or-head> --json
95
+ ```
96
+
97
+ If cleanup is blocked, push the branch, merge it, cherry-pick it into the selected release, or explicitly discard it before removing the worktree.
98
+
99
+ ## Repository Bootstrap
100
+
101
+ This repository currently treats `dev` as the integration branch and `master` as production. If `dev` falls behind `master` and has no unique commits, fast-forward `dev` to `master` before starting new feature work:
102
+
103
+ ```bash
104
+ git fetch --all --prune
105
+ git switch dev
106
+ git merge --ff-only master
107
+ git push origin dev
108
+ git push github dev
109
+ ```
110
+
111
+ After that, normal work should start from `dev`:
112
+
113
+ ```bash
114
+ git switch dev
115
+ git pull --ff-only origin dev
116
+ git switch -c feat/<short-name>
117
+ ```
118
+
119
+ Before creating a normal release from `dev`, inspect the release delta:
120
+
121
+ ```bash
122
+ git log --oneline master..dev
123
+ ```
124
+
125
+ If every listed commit is intended for the next production release, merge `dev` through the normal release path. If any commit must be excluded, create `release/vX.Y.Z` from `master` and cherry-pick only the approved release list.
@@ -1,85 +1,85 @@
1
- # Governance Dashboard
2
-
3
- Status: implemented baseline
4
- Since: v0.25 development branch
5
-
6
- Governance Dashboard turns existing SCALE evidence into a single reviewable HTML page. It does not replace Markdown, JSON, runtime evidence, eval records, or memory. It is a human-facing view over those sources.
7
-
8
- ## Command
9
-
10
- ```bash
11
- scale artifact dashboard
12
- scale artifact dashboard --task-id <task-id>
13
- scale artifact dashboard --dir /path/to/project
14
- scale artifact dashboard --output docs/worklog/tasks/<task-id>/artifacts/governance-dashboard.html
15
- scale artifact dashboard --json
16
- ```
17
-
18
- Default output:
19
-
20
- ```text
21
- .scale/reports/governance-dashboard.html
22
- .scale/reports/governance-dashboard-manifest.json
23
- ```
24
-
25
- The default lifecycle is `generated-report` and the default Git policy is `ignore`. Promote or commit only dashboards that are intentionally used as reviewed task evidence or release evidence.
26
-
27
- When `--dir` is used and `SCALE_DIR` is not set, the default `.scale` directory is resolved inside the target project directory, not inside the shell's current working directory. This matters for scaffold and multi-repo validation runs.
28
-
29
- ## Inputs
30
-
31
- The dashboard reads existing local evidence:
32
-
33
- | Area | Source |
34
- | --- | --- |
35
- | Runtime evidence | `.scale/evidence/runtime/` |
36
- | Workflow eval | `.scale/evals/runs/` and `.scale/evals/failures/` |
37
- | Workflow metrics | `.scale/metrics/tasks.jsonl` |
38
- | Gate evidence | `.scale/evidence/GATE-*.json` |
39
- | Command runs | `.scale/evidence/command-runs/` |
40
- | Model usage | `.scale/model-usage/usage.jsonl` |
41
- | Memory Brain | `.scale/memory/brain.sqlite` |
42
- | Resource Governance | workspace files plus `.scale/resource-policy.json` and `.scale/assets.json` |
43
- | HTML artifacts | task artifact manifests and rendered HTML files |
44
-
45
- ## Aggregated Metrics
46
-
47
- V2.0 adds `MetricsAggregator` as the dashboard aggregation layer. It keeps the dashboard read-only and derives the following metrics from existing evidence:
48
-
49
- - recent task count and first-pass rate
50
- - average fix iterations
51
- - gate failure distribution
52
- - command output compression token savings
53
- - model usage and prompt-cache savings
54
-
55
- Each number must trace back to local JSON/JSONL evidence. If a source is absent, the dashboard reports zero rather than inventing values.
56
-
57
- ## Status Model
58
-
59
- - Runtime evidence failures are blocking.
60
- - Memory contradictions are blocking.
61
- - Resource Governance failures are blocking.
62
- - Open eval failure replays are warnings, because they may be intentional baseline failures or pending improvement work.
63
- - Missing task HTML artifacts are informational.
64
-
65
- This keeps the dashboard useful as a review surface without turning every observation into a hard gate.
66
-
67
- ## Recommended Use
68
-
69
- For M/L/CRITICAL work:
70
-
71
- ```bash
72
- scale verify <task-id>
73
- scale eval run --suite workflow-baseline
74
- scale memory dream --json
75
- scale artifact dashboard --task-id <task-id>
76
- ```
77
-
78
- For release review:
79
-
80
- ```bash
81
- scale artifact dashboard
82
- scale artifact open --artifact-dir .scale/reports --type governance-dashboard --print-only
83
- ```
84
-
85
- The dashboard should be attached to a release or PR only when it is deliberately selected as a review artifact. Routine generated dashboards should stay local.
1
+ # Governance Dashboard
2
+
3
+ Status: implemented baseline
4
+ Since: v0.25 development branch
5
+
6
+ Governance Dashboard turns existing SCALE evidence into a single reviewable HTML page. It does not replace Markdown, JSON, runtime evidence, eval records, or memory. It is a human-facing view over those sources.
7
+
8
+ ## Command
9
+
10
+ ```bash
11
+ scale artifact dashboard
12
+ scale artifact dashboard --task-id <task-id>
13
+ scale artifact dashboard --dir /path/to/project
14
+ scale artifact dashboard --output docs/worklog/tasks/<task-id>/artifacts/governance-dashboard.html
15
+ scale artifact dashboard --json
16
+ ```
17
+
18
+ Default output:
19
+
20
+ ```text
21
+ .scale/reports/governance-dashboard.html
22
+ .scale/reports/governance-dashboard-manifest.json
23
+ ```
24
+
25
+ The default lifecycle is `generated-report` and the default Git policy is `ignore`. Promote or commit only dashboards that are intentionally used as reviewed task evidence or release evidence.
26
+
27
+ When `--dir` is used and `SCALE_DIR` is not set, the default `.scale` directory is resolved inside the target project directory, not inside the shell's current working directory. This matters for scaffold and multi-repo validation runs.
28
+
29
+ ## Inputs
30
+
31
+ The dashboard reads existing local evidence:
32
+
33
+ | Area | Source |
34
+ | --- | --- |
35
+ | Runtime evidence | `.scale/evidence/runtime/` |
36
+ | Workflow eval | `.scale/evals/runs/` and `.scale/evals/failures/` |
37
+ | Workflow metrics | `.scale/metrics/tasks.jsonl` |
38
+ | Gate evidence | `.scale/evidence/GATE-*.json` |
39
+ | Command runs | `.scale/evidence/command-runs/` |
40
+ | Model usage | `.scale/model-usage/usage.jsonl` |
41
+ | Memory Brain | `.scale/memory/brain.sqlite` |
42
+ | Resource Governance | workspace files plus `.scale/resource-policy.json` and `.scale/assets.json` |
43
+ | HTML artifacts | task artifact manifests and rendered HTML files |
44
+
45
+ ## Aggregated Metrics
46
+
47
+ V2.0 adds `MetricsAggregator` as the dashboard aggregation layer. It keeps the dashboard read-only and derives the following metrics from existing evidence:
48
+
49
+ - recent task count and first-pass rate
50
+ - average fix iterations
51
+ - gate failure distribution
52
+ - command output compression token savings
53
+ - model usage and prompt-cache savings
54
+
55
+ Each number must trace back to local JSON/JSONL evidence. If a source is absent, the dashboard reports zero rather than inventing values.
56
+
57
+ ## Status Model
58
+
59
+ - Runtime evidence failures are blocking.
60
+ - Memory contradictions are blocking.
61
+ - Resource Governance failures are blocking.
62
+ - Open eval failure replays are warnings, because they may be intentional baseline failures or pending improvement work.
63
+ - Missing task HTML artifacts are informational.
64
+
65
+ This keeps the dashboard useful as a review surface without turning every observation into a hard gate.
66
+
67
+ ## Recommended Use
68
+
69
+ For M/L/CRITICAL work:
70
+
71
+ ```bash
72
+ scale verify <task-id>
73
+ scale eval run --suite workflow-baseline
74
+ scale memory dream --json
75
+ scale artifact dashboard --task-id <task-id>
76
+ ```
77
+
78
+ For release review:
79
+
80
+ ```bash
81
+ scale artifact dashboard
82
+ scale artifact open --artifact-dir .scale/reports --type governance-dashboard --print-only
83
+ ```
84
+
85
+ The dashboard should be attached to a release or PR only when it is deliberately selected as a review artifact. Routine generated dashboards should stay local.
@@ -1,104 +1,104 @@
1
- # Memory Brain
2
-
3
- Memory Brain is SCALE's project-scoped long-term memory layer. It is separate from Memory Fabric:
4
-
5
- - Memory Fabric builds a compact context pack for the current task.
6
- - Memory Brain stores reviewed project knowledge with evidence, confidence, scope, and contradiction checks.
7
-
8
- The first version is local-first and uses SQLite:
9
-
10
- ```text
11
- .scale/memory/brain.sqlite
12
- .scale/memory/brain-manifest.json
13
- ```
14
-
15
- ## Commands
16
-
17
- ```bash
18
- scale memory ingest --from evidence --task-id <task-id>
19
- scale memory ingest --from candidate --candidate-id <candidate-id>
20
- scale memory ingest --from failure --failure-id <failure-replay-id>
21
- scale memory query "OAuth callback state design"
22
- scale memory contradictions
23
- scale memory dream
24
- scale memory promote <memory-node-id-or-candidate-id>
25
- scale memory export --output .scale/memory/export.jsonl
26
- scale memory import .scale/memory/export.jsonl
27
- ```
28
-
29
- ## Node Contract
30
-
31
- ```ts
32
- interface MemoryNode {
33
- id: string
34
- type: 'fact' | 'decision' | 'incident' | 'relation' | 'contradiction'
35
- title: string
36
- summary: string
37
- entities: string[]
38
- source: 'runtime-evidence' | 'task-artifact' | 'docs' | 'git' | 'manual'
39
- evidencePaths: string[]
40
- confidence: number
41
- scope: 'project' | 'workspace' | 'global-candidate'
42
- status: 'candidate' | 'active' | 'stale' | 'rejected'
43
- createdAt: string
44
- updatedAt: string
45
- lastVerifiedAt?: string
46
- }
47
- ```
48
-
49
- ## Evidence Rule
50
-
51
- Active memory must have at least one evidence path. SCALE blocks promotion when this is not true.
52
-
53
- Runtime evidence and learning candidates are ingested as `candidate` records first. `scale memory promote` is the explicit boundary where reviewed memory becomes active.
54
-
55
- Failure replay records can also be ingested as `incident` candidates:
56
-
57
- ```bash
58
- scale eval run --suite workflow-baseline
59
- scale eval failures --since 30d
60
- scale memory ingest --from failure --failure-id <failure-replay-id>
61
- scale memory promote <memory-node-id>
62
- ```
63
-
64
- This connects Eval Harness failures to long-term memory without automatically rewriting project standards. A failure becomes active memory only after promotion and only if the replay artifact is present as evidence.
65
-
66
- ## Scope Rule
67
-
68
- Project memory stays project-scoped by default. `global-candidate` is allowed for export and review, but it cannot be activated inside a project brain. This prevents one project's temporary truth from becoming a global rule.
69
-
70
- ## Contradiction Rule
71
-
72
- `scale memory contradictions` reports conflicts instead of resolving them automatically. Examples:
73
-
74
- - one memory says a provider is enabled, another says it is disabled
75
- - one memory says a route exists, another says it is missing
76
- - one memory says an operation is allowed, another says it is blocked
77
-
78
- The command exits non-zero when active contradictions exist.
79
-
80
- ## Dream Maintenance
81
-
82
- `scale memory dream` is a maintenance pass. It reports:
83
-
84
- - promotion candidates
85
- - stale active memories
86
- - duplicate groups
87
- - contradictions
88
- - suggested docs to update
89
- - active memories missing evidence
90
-
91
- It does not auto-promote standards, rewrite docs, or delete memories.
92
-
93
- ## Resource Lifecycle
94
-
95
- Memory Brain files under `.scale/memory/` are local runtime state by default. Commit only curated exports, documented decisions, or task artifacts that were intentionally reviewed.
96
-
97
- Recommended flow:
98
-
99
- ```text
100
- runtime evidence -> memory settle -> memory ingest -> memory promote -> docs/standards update when stable
101
- eval failure replay -> memory ingest --from failure -> memory promote -> workflow rule update when stable
102
- ```
103
-
104
- This keeps memory useful without turning every session observation into permanent project truth.
1
+ # Memory Brain
2
+
3
+ Memory Brain is SCALE's project-scoped long-term memory layer. It is separate from Memory Fabric:
4
+
5
+ - Memory Fabric builds a compact context pack for the current task.
6
+ - Memory Brain stores reviewed project knowledge with evidence, confidence, scope, and contradiction checks.
7
+
8
+ The first version is local-first and uses SQLite:
9
+
10
+ ```text
11
+ .scale/memory/brain.sqlite
12
+ .scale/memory/brain-manifest.json
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ scale memory ingest --from evidence --task-id <task-id>
19
+ scale memory ingest --from candidate --candidate-id <candidate-id>
20
+ scale memory ingest --from failure --failure-id <failure-replay-id>
21
+ scale memory query "OAuth callback state design"
22
+ scale memory contradictions
23
+ scale memory dream
24
+ scale memory promote <memory-node-id-or-candidate-id>
25
+ scale memory export --output .scale/memory/export.jsonl
26
+ scale memory import .scale/memory/export.jsonl
27
+ ```
28
+
29
+ ## Node Contract
30
+
31
+ ```ts
32
+ interface MemoryNode {
33
+ id: string
34
+ type: 'fact' | 'decision' | 'incident' | 'relation' | 'contradiction'
35
+ title: string
36
+ summary: string
37
+ entities: string[]
38
+ source: 'runtime-evidence' | 'task-artifact' | 'docs' | 'git' | 'manual'
39
+ evidencePaths: string[]
40
+ confidence: number
41
+ scope: 'project' | 'workspace' | 'global-candidate'
42
+ status: 'candidate' | 'active' | 'stale' | 'rejected'
43
+ createdAt: string
44
+ updatedAt: string
45
+ lastVerifiedAt?: string
46
+ }
47
+ ```
48
+
49
+ ## Evidence Rule
50
+
51
+ Active memory must have at least one evidence path. SCALE blocks promotion when this is not true.
52
+
53
+ Runtime evidence and learning candidates are ingested as `candidate` records first. `scale memory promote` is the explicit boundary where reviewed memory becomes active.
54
+
55
+ Failure replay records can also be ingested as `incident` candidates:
56
+
57
+ ```bash
58
+ scale eval run --suite workflow-baseline
59
+ scale eval failures --since 30d
60
+ scale memory ingest --from failure --failure-id <failure-replay-id>
61
+ scale memory promote <memory-node-id>
62
+ ```
63
+
64
+ This connects Eval Harness failures to long-term memory without automatically rewriting project standards. A failure becomes active memory only after promotion and only if the replay artifact is present as evidence.
65
+
66
+ ## Scope Rule
67
+
68
+ Project memory stays project-scoped by default. `global-candidate` is allowed for export and review, but it cannot be activated inside a project brain. This prevents one project's temporary truth from becoming a global rule.
69
+
70
+ ## Contradiction Rule
71
+
72
+ `scale memory contradictions` reports conflicts instead of resolving them automatically. Examples:
73
+
74
+ - one memory says a provider is enabled, another says it is disabled
75
+ - one memory says a route exists, another says it is missing
76
+ - one memory says an operation is allowed, another says it is blocked
77
+
78
+ The command exits non-zero when active contradictions exist.
79
+
80
+ ## Dream Maintenance
81
+
82
+ `scale memory dream` is a maintenance pass. It reports:
83
+
84
+ - promotion candidates
85
+ - stale active memories
86
+ - duplicate groups
87
+ - contradictions
88
+ - suggested docs to update
89
+ - active memories missing evidence
90
+
91
+ It does not auto-promote standards, rewrite docs, or delete memories.
92
+
93
+ ## Resource Lifecycle
94
+
95
+ Memory Brain files under `.scale/memory/` are local runtime state by default. Commit only curated exports, documented decisions, or task artifacts that were intentionally reviewed.
96
+
97
+ Recommended flow:
98
+
99
+ ```text
100
+ runtime evidence -> memory settle -> memory ingest -> memory promote -> docs/standards update when stable
101
+ eval failure replay -> memory ingest --from failure -> memory promote -> workflow rule update when stable
102
+ ```
103
+
104
+ This keeps memory useful without turning every session observation into permanent project truth.