@hongmaple0820/scale-engine 0.40.2 → 0.44.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.
- package/README.md +30 -2
- package/dist/api/cli.js +43 -2
- package/dist/api/cli.js.map +1 -1
- package/dist/api/quickstart.d.ts +11 -0
- package/dist/api/quickstart.js +98 -1
- package/dist/api/quickstart.js.map +1 -1
- package/dist/artifact/fsmDefinitions.js +15 -2
- package/dist/artifact/fsmDefinitions.js.map +1 -1
- package/dist/artifact/types.d.ts +1 -1
- package/dist/artifact/types.js.map +1 -1
- package/dist/cache/ScanCache.d.ts +41 -0
- package/dist/cache/ScanCache.js +120 -0
- package/dist/cache/ScanCache.js.map +1 -0
- package/dist/capabilities/BrowserQACapability.d.ts +14 -0
- package/dist/capabilities/BrowserQACapability.js +94 -0
- package/dist/capabilities/BrowserQACapability.js.map +1 -1
- package/dist/cli/autofixCommands.d.ts +22 -0
- package/dist/cli/autofixCommands.js +32 -0
- package/dist/cli/autofixCommands.js.map +1 -0
- package/dist/cli/cortexCommands.d.ts +71 -0
- package/dist/cli/cortexCommands.js +335 -0
- package/dist/cli/cortexCommands.js.map +1 -0
- package/dist/cli/costCommands.d.ts +13 -0
- package/dist/cli/costCommands.js +48 -0
- package/dist/cli/costCommands.js.map +1 -0
- package/dist/cli/orchCommands.d.ts +43 -0
- package/dist/cli/orchCommands.js +135 -0
- package/dist/cli/orchCommands.js.map +1 -0
- package/dist/cli/phaseCommands.js +1 -2
- package/dist/cli/phaseCommands.js.map +1 -1
- package/dist/cli/qaCommands.d.ts +22 -0
- package/dist/cli/qaCommands.js +84 -0
- package/dist/cli/qaCommands.js.map +1 -0
- package/dist/cli/quickstartCommands.d.ts +17 -0
- package/dist/cli/quickstartCommands.js +47 -0
- package/dist/cli/quickstartCommands.js.map +1 -0
- package/dist/cli/shieldCommands.d.ts +30 -0
- package/dist/cli/shieldCommands.js +212 -0
- package/dist/cli/shieldCommands.js.map +1 -0
- package/dist/cli/tuiCommands.d.ts +7 -0
- package/dist/cli/tuiCommands.js +33 -0
- package/dist/cli/tuiCommands.js.map +1 -0
- package/dist/codegraph/CodeIntelligence.d.ts +27 -0
- package/dist/codegraph/CodeIntelligence.js +316 -3
- package/dist/codegraph/CodeIntelligence.js.map +1 -1
- package/dist/config/profiles.js +26 -0
- package/dist/config/profiles.js.map +1 -1
- package/dist/cortex/GovernanceMetrics.d.ts +66 -0
- package/dist/cortex/GovernanceMetrics.js +230 -0
- package/dist/cortex/GovernanceMetrics.js.map +1 -0
- package/dist/cortex/InstinctExtractor.d.ts +61 -0
- package/dist/cortex/InstinctExtractor.js +184 -0
- package/dist/cortex/InstinctExtractor.js.map +1 -0
- package/dist/cortex/InstinctStore.d.ts +54 -0
- package/dist/cortex/InstinctStore.js +266 -0
- package/dist/cortex/InstinctStore.js.map +1 -0
- package/dist/cortex/ReflexionEngine.d.ts +34 -0
- package/dist/cortex/ReflexionEngine.js +157 -0
- package/dist/cortex/ReflexionEngine.js.map +1 -0
- package/dist/cortex/SessionInjector.d.ts +44 -0
- package/dist/cortex/SessionInjector.js +127 -0
- package/dist/cortex/SessionInjector.js.map +1 -0
- package/dist/cortex/adapters/ClaudeAdapter.d.ts +17 -0
- package/dist/cortex/adapters/ClaudeAdapter.js +61 -0
- package/dist/cortex/adapters/ClaudeAdapter.js.map +1 -0
- package/dist/cortex/adapters/CodexAdapter.d.ts +10 -0
- package/dist/cortex/adapters/CodexAdapter.js +52 -0
- package/dist/cortex/adapters/CodexAdapter.js.map +1 -0
- package/dist/cortex/adapters/CursorAdapter.d.ts +10 -0
- package/dist/cortex/adapters/CursorAdapter.js +46 -0
- package/dist/cortex/adapters/CursorAdapter.js.map +1 -0
- package/dist/cortex/adapters/GeminiAdapter.d.ts +11 -0
- package/dist/cortex/adapters/GeminiAdapter.js +48 -0
- package/dist/cortex/adapters/GeminiAdapter.js.map +1 -0
- package/dist/dashboard/DashboardServer.d.ts +33 -13
- package/dist/dashboard/DashboardServer.js +314 -182
- package/dist/dashboard/DashboardServer.js.map +1 -1
- package/dist/dashboard/index.d.ts +2 -2
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/server.d.ts +8 -22
- package/dist/dashboard/server.js +2 -83
- package/dist/dashboard/server.js.map +1 -1
- package/dist/eval/BenchmarkPublisher.d.ts +25 -0
- package/dist/eval/BenchmarkPublisher.js +27 -0
- package/dist/eval/BenchmarkPublisher.js.map +1 -0
- package/dist/guardrails/DependencyAuditor.js +10 -1
- package/dist/guardrails/DependencyAuditor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestrator/OrchestratorDaemon.d.ts +44 -0
- package/dist/orchestrator/OrchestratorDaemon.js +150 -0
- package/dist/orchestrator/OrchestratorDaemon.js.map +1 -0
- package/dist/orchestrator/PolicyLoader.d.ts +80 -0
- package/dist/orchestrator/PolicyLoader.js +229 -0
- package/dist/orchestrator/PolicyLoader.js.map +1 -0
- package/dist/orchestrator/ReconciliationLoop.d.ts +71 -0
- package/dist/orchestrator/ReconciliationLoop.js +266 -0
- package/dist/orchestrator/ReconciliationLoop.js.map +1 -0
- package/dist/orchestrator/TrackerAdapter.d.ts +60 -0
- package/dist/orchestrator/TrackerAdapter.js +147 -0
- package/dist/orchestrator/TrackerAdapter.js.map +1 -0
- package/dist/orchestrator/WorkspaceManager.d.ts +66 -0
- package/dist/orchestrator/WorkspaceManager.js +257 -0
- package/dist/orchestrator/WorkspaceManager.js.map +1 -0
- package/dist/qa/BrowserDaemon.d.ts +23 -0
- package/dist/qa/BrowserDaemon.js +79 -0
- package/dist/qa/BrowserDaemon.js.map +1 -0
- package/dist/qa/E2ETestOrchestrator.d.ts +14 -0
- package/dist/qa/E2ETestOrchestrator.js +19 -0
- package/dist/qa/E2ETestOrchestrator.js.map +1 -0
- package/dist/review/CrossModelReviewer.d.ts +35 -0
- package/dist/review/CrossModelReviewer.js +75 -0
- package/dist/review/CrossModelReviewer.js.map +1 -0
- package/dist/review/ReviewAggregator.d.ts +13 -0
- package/dist/review/ReviewAggregator.js +28 -0
- package/dist/review/ReviewAggregator.js.map +1 -0
- package/dist/review/reviewCommands.d.ts +15 -0
- package/dist/review/reviewCommands.js +24 -0
- package/dist/review/reviewCommands.js.map +1 -0
- package/dist/routing/LocalModelProvider.d.ts +11 -0
- package/dist/routing/LocalModelProvider.js +21 -0
- package/dist/routing/LocalModelProvider.js.map +1 -0
- package/dist/routing/ModelRouter.d.ts +12 -0
- package/dist/routing/ModelRouter.js +31 -4
- package/dist/routing/ModelRouter.js.map +1 -1
- package/dist/runtime/AiOsRuntime.d.ts +1 -0
- package/dist/runtime/AiOsRuntime.js +15 -0
- package/dist/runtime/AiOsRuntime.js.map +1 -1
- package/dist/runtime/CostAnalyzer.d.ts +53 -0
- package/dist/runtime/CostAnalyzer.js +160 -0
- package/dist/runtime/CostAnalyzer.js.map +1 -0
- package/dist/runtime/CostOptimizer.d.ts +11 -0
- package/dist/runtime/CostOptimizer.js +21 -0
- package/dist/runtime/CostOptimizer.js.map +1 -0
- package/dist/shield/PolicyCompiler.d.ts +70 -0
- package/dist/shield/PolicyCompiler.js +540 -0
- package/dist/shield/PolicyCompiler.js.map +1 -0
- package/dist/shield/ProtectedPaths.d.ts +39 -0
- package/dist/shield/ProtectedPaths.js +179 -0
- package/dist/shield/ProtectedPaths.js.map +1 -0
- package/dist/shield/ShieldProtocol.d.ts +50 -0
- package/dist/shield/ShieldProtocol.js +103 -0
- package/dist/shield/ShieldProtocol.js.map +1 -0
- package/dist/skills/SkillMdStandard.d.ts +33 -0
- package/dist/skills/SkillMdStandard.js +88 -0
- package/dist/skills/SkillMdStandard.js.map +1 -0
- package/dist/skills/SkillRegistry.d.ts +9 -1
- package/dist/skills/SkillRegistry.js +20 -0
- package/dist/skills/SkillRegistry.js.map +1 -1
- package/dist/skills/interop/GStackInterop.d.ts +15 -0
- package/dist/skills/interop/GStackInterop.js +34 -0
- package/dist/skills/interop/GStackInterop.js.map +1 -0
- package/dist/skills/interop/OMCInterop.d.ts +15 -0
- package/dist/skills/interop/OMCInterop.js +34 -0
- package/dist/skills/interop/OMCInterop.js.map +1 -0
- package/dist/topology/DomainMapper.d.ts +23 -0
- package/dist/topology/DomainMapper.js +179 -0
- package/dist/topology/DomainMapper.js.map +1 -0
- package/dist/topology/LayerClassifier.d.ts +8 -0
- package/dist/topology/LayerClassifier.js +109 -0
- package/dist/topology/LayerClassifier.js.map +1 -0
- package/dist/topology/TourGenerator.d.ts +18 -0
- package/dist/topology/TourGenerator.js +120 -0
- package/dist/topology/TourGenerator.js.map +1 -0
- package/dist/topology/index.d.ts +3 -0
- package/dist/topology/index.js +4 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/tui/TuiDashboard.d.ts +3 -0
- package/dist/tui/TuiDashboard.js +120 -0
- package/dist/tui/TuiDashboard.js.map +1 -0
- package/dist/workflow/GateCatalog.d.ts +2 -0
- package/dist/workflow/GateCatalog.js +59 -3
- package/dist/workflow/GateCatalog.js.map +1 -1
- package/dist/workflow/GovernanceTemplatePacks.d.ts +1 -1
- package/dist/workflow/GovernanceTemplatePacks.js +15 -0
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/TddLoop.d.ts +2 -0
- package/dist/workflow/TddLoop.js +2 -0
- package/dist/workflow/TddLoop.js.map +1 -1
- package/dist/workflow/UpgradeManager.d.ts +10 -1
- package/dist/workflow/UpgradeManager.js +55 -0
- package/dist/workflow/UpgradeManager.js.map +1 -1
- package/dist/workflow/VerificationProfile.d.ts +8 -0
- package/dist/workflow/VerificationProfile.js +61 -0
- package/dist/workflow/VerificationProfile.js.map +1 -1
- package/dist/workflow/VerificationSchema.d.ts +46 -0
- package/dist/workflow/VerificationSchema.js +97 -0
- package/dist/workflow/VerificationSchema.js.map +1 -0
- package/dist/workflow/autofix/AutoFixEngine.d.ts +37 -0
- package/dist/workflow/autofix/AutoFixEngine.js +169 -0
- package/dist/workflow/autofix/AutoFixEngine.js.map +1 -0
- package/dist/workflow/execution/RalphEngine.d.ts +18 -0
- package/dist/workflow/execution/RalphEngine.js +22 -0
- package/dist/workflow/execution/RalphEngine.js.map +1 -1
- package/dist/workflow/gates/EnhancedGates.d.ts +74 -0
- package/dist/workflow/gates/EnhancedGates.js +653 -0
- package/dist/workflow/gates/EnhancedGates.js.map +1 -0
- package/dist/workflow/gates/GateSystem.d.ts +3 -0
- package/dist/workflow/gates/GateSystem.js +94 -1
- package/dist/workflow/gates/GateSystem.js.map +1 -1
- package/dist/workflow/types.d.ts +1 -1
- package/docs/README.md +3 -0
- package/docs/guides/DEVELOPMENT_WORKFLOW.md +28 -9
- package/docs/guides/GETTING_STARTED.md +19 -0
- package/docs/guides/MIGRATION.md +119 -0
- package/docs/workflow/GATES_AND_SCORE.md +34 -1
- package/docs/workflow/README.md +58 -10
- package/package.json +7 -17
- package/docs/ACTIVE_SECURITY_VISUAL_GATES.md +0 -87
- package/docs/AI_ENGINEERING_OS_POSITIONING.md +0 -607
- package/docs/BACKGROUND_HUNTER.md +0 -62
- package/docs/CODE_INTELLIGENCE.md +0 -180
- package/docs/CONTEXT_BUDGET.md +0 -165
- package/docs/DEPENDENCY_AUDIT.md +0 -118
- package/docs/EVOLUTION_SHADOW_MODE.md +0 -63
- package/docs/GITLAB_FLOW.md +0 -125
- package/docs/GOVERNANCE_DASHBOARD.md +0 -92
- package/docs/MEMORY_BRAIN.md +0 -104
- package/docs/MEMORY_FABRIC.md +0 -161
- package/docs/RESOURCE_GOVERNANCE.md +0 -92
- package/docs/RUNTIME_EVIDENCE.md +0 -101
- package/docs/WORKFLOW_EVAL.md +0 -151
- package/image/wechat-public.jpg +0 -0
- package/image/wxPay.jpg +0 -0
- package/image/zfb.jpg +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
You can inspect the same model-usage ledger directly without opening the HTML dashboard:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
scale token report --since-days 7
|
|
61
|
-
scale token report --day 2026-05-23 --json
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Status Model
|
|
65
|
-
|
|
66
|
-
- Runtime evidence failures are blocking.
|
|
67
|
-
- Memory contradictions are blocking.
|
|
68
|
-
- Resource Governance failures are blocking.
|
|
69
|
-
- Open eval failure replays are warnings, because they may be intentional baseline failures or pending improvement work.
|
|
70
|
-
- Missing task HTML artifacts are informational.
|
|
71
|
-
|
|
72
|
-
This keeps the dashboard useful as a review surface without turning every observation into a hard gate.
|
|
73
|
-
|
|
74
|
-
## Recommended Use
|
|
75
|
-
|
|
76
|
-
For M/L/CRITICAL work:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
scale verify <task-id>
|
|
80
|
-
scale eval run --suite workflow-baseline
|
|
81
|
-
scale memory dream --json
|
|
82
|
-
scale artifact dashboard --task-id <task-id>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
For release review:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
scale artifact dashboard
|
|
89
|
-
scale artifact open --artifact-dir .scale/reports --type governance-dashboard --print-only
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
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.
|
package/docs/MEMORY_BRAIN.md
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
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.
|
package/docs/MEMORY_FABRIC.md
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# Memory Fabric
|
|
2
|
-
|
|
3
|
-
Memory Fabric 是 SCALE 用来降低长会话 token 消耗、提升 Agent 记忆质量的上下文压缩层。它不会把所有历史文档都塞回提示词,而是按任务范围生成一个可审计的 context pack。
|
|
4
|
-
|
|
5
|
-
它聚合四类信息:
|
|
6
|
-
|
|
7
|
-
- Runtime Evidence:真实运行过的命令、工具、浏览器、skill、MCP 和人工验证证据。
|
|
8
|
-
- Session Events:当前会话的阶段、工具使用和证据写入事件。
|
|
9
|
-
- Knowledge Recall:从项目知识库召回已验证经验、规则和历史教训。
|
|
10
|
-
- Project Graph:检测 `graphify-out/graph.json`、`graphify-out/GRAPH_REPORT.md` 或 `.scale/graph/manifest.json`,只引用图谱状态和摘要,不把大型图谱全文塞进上下文。
|
|
11
|
-
|
|
12
|
-
## 基本命令
|
|
13
|
-
|
|
14
|
-
生成上下文包:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
scale memory pack \
|
|
18
|
-
--task-id 2026-05-18-runtime-evidence \
|
|
19
|
-
--session-id 2026-05-18-runtime-evidence \
|
|
20
|
-
--task "继续实现 runtime evidence 与最终交付检查" \
|
|
21
|
-
--level M \
|
|
22
|
-
--files src/runtime,src/api/cli.ts \
|
|
23
|
-
--budget 4000
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
输出 JSON,便于其他 Agent、CLI 或评审工具读取:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
scale memory pack \
|
|
30
|
-
--task "修复 OAuth callback state 过期处理" \
|
|
31
|
-
--level M \
|
|
32
|
-
--budget 4000 \
|
|
33
|
-
--json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
检查上下文预算:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
scale memory doctor \
|
|
40
|
-
--task "跨模块权限重构" \
|
|
41
|
-
--level L \
|
|
42
|
-
--budget 3000
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
把完成任务后的运行证据沉淀成学习候选:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
scale memory settle \
|
|
49
|
-
--task-id 2026-05-18-runtime-evidence \
|
|
50
|
-
--session-id 2026-05-18-runtime-evidence \
|
|
51
|
-
--task "继续实现 runtime evidence 与最终交付检查" \
|
|
52
|
-
--level M \
|
|
53
|
-
--budget 4000
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
`settle` 会写入:
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
.scale/memory/learning-candidates/<candidate-id>.json
|
|
60
|
-
.scale/memory/learning-candidates/<candidate-id>.md
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
这些文件是本地运行时学习候选,默认不应该直接提交到 Git。它们的作用是让人类或评审 Agent 判断“这条经验是否值得进入长期知识库、工程规范或模块文档”。
|
|
64
|
-
|
|
65
|
-
## 预算策略
|
|
66
|
-
|
|
67
|
-
Memory Fabric 使用估算 token 预算控制上下文规模。优先级从高到低:
|
|
68
|
-
|
|
69
|
-
1. Runtime Evidence:失败证据和通过证据优先保留。
|
|
70
|
-
2. Session Events:最近会话事件优先保留。
|
|
71
|
-
3. Knowledge Recall:按任务描述和文件范围召回 Top K 知识。
|
|
72
|
-
4. Project Graph:只保留图谱报告路径和短摘要。
|
|
73
|
-
|
|
74
|
-
当预算不足时,低优先级 section 会被标记为 omitted,并写入原因。这样 Agent 能知道哪些上下文被刻意裁剪,而不是误以为项目没有相关信息。
|
|
75
|
-
|
|
76
|
-
## 与知识库和自我进化的关系
|
|
77
|
-
|
|
78
|
-
Memory Fabric 不替代知识库。它是知识库、运行证据和图谱之间的读取层:
|
|
79
|
-
|
|
80
|
-
- Runtime Evidence 记录“这次实际做过什么”。
|
|
81
|
-
- Knowledge Base 记录“长期可复用的经验和规则”。
|
|
82
|
-
- Graphify 或项目图谱记录“模块之间的结构关系”。
|
|
83
|
-
- Memory Fabric 在每次任务开始、恢复、评审或发版前,生成本次最相关的上下文包。
|
|
84
|
-
|
|
85
|
-
任务完成后,应该把真正稳定的经验沉淀到知识库或长期维护文档中;`.scale/events/` 和 `.scale/evidence/` 仍然是本地运行时产物,不应默认提交到 Git。
|
|
86
|
-
|
|
87
|
-
新的推荐闭环是:
|
|
88
|
-
|
|
89
|
-
```text
|
|
90
|
-
runtime evidence -> memory pack -> memory settle -> 人审 -> knowledge/docs/rules
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
也就是说,Memory Fabric 先把证据和上下文压缩成候选,不会自动把一次会话里的判断升级成长期规则。存在失败证据时,候选会标记为 `resolve-failures-first`,避免把未闭环问题沉淀成“经验”。
|
|
94
|
-
|
|
95
|
-
## 推荐使用场景
|
|
96
|
-
|
|
97
|
-
- 长会话恢复前:先生成 context pack,避免重复读大量文档。
|
|
98
|
-
- 多 Agent 协作前:把 context pack 交给审查 Agent 或测试 Agent。
|
|
99
|
-
- 发版前:用 runtime evidence 和 session events 检查是否存在未闭环失败。
|
|
100
|
-
- 任务结束后:用 `memory settle` 生成学习候选,再决定是否进入知识库、模块文档或工程规范。
|
|
101
|
-
- 大型项目治理:结合 service matrix、resource governance 和 engineering standards,生成任务相关而不是全仓库噪声上下文。
|
|
102
|
-
|
|
103
|
-
## 当前边界
|
|
104
|
-
|
|
105
|
-
- 当前版本不内置向量数据库;如果项目配置了 SQLite knowledge base,会使用现有召回接口。
|
|
106
|
-
- 当前版本只检测 Graphify 产物是否存在并生成摘要,不主动运行 Graphify。
|
|
107
|
-
- HTML 可视化报告适合后续加在 context pack 之上;Memory Fabric 的核心产物先保持 JSON/Markdown,方便 diff、测试和 CLI 集成。
|
|
108
|
-
|
|
109
|
-
## Memory Provider Router
|
|
110
|
-
|
|
111
|
-
SCALE now treats strong memory systems as providers instead of rebuilding them inside the workflow engine.
|
|
112
|
-
|
|
113
|
-
Default provider order:
|
|
114
|
-
|
|
115
|
-
```text
|
|
116
|
-
gbrain -> agentmemory -> scale-local
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Commands:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
scale memory provider init
|
|
123
|
-
scale memory provider status --json
|
|
124
|
-
scale memory provider use gbrain --json
|
|
125
|
-
scale tool doctor --tools gbrain --json
|
|
126
|
-
scale memory provider recall "OAuth callback Redis state" --json
|
|
127
|
-
scale ai-os plan --task "Fix OAuth callback Redis state" --files src/auth/oauth.ts --json
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Provider rules:
|
|
131
|
-
|
|
132
|
-
- `gbrain` is the default external-first provider. SCALE treats CLI existence as insufficient: `scale memory provider status --json` requires a configured brain with working connection/schema checks before marking it available. Full `gbrain doctor --json` warnings that are unrelated to recall, such as local skill resolver issues, are reported as degraded health but do not block read-only recall. If the CLI exists but no brain is configured, the status remains unavailable and points to `gbrain init --pglite`.
|
|
133
|
-
- The preferred remote production path is the official thin-client flow: run `gbrain serve --http` on the host, then configure the local CLI with `gbrain init --mcp-only` so SCALE can keep calling `gbrain query` through the thin client instead of inventing a separate ad-hoc REST contract.
|
|
134
|
-
- `agentmemory` remains optional and can be added as a second provider when teams want cross-agent shared memory.
|
|
135
|
-
- `memory provider use <id>` is the fast path for switching the default route without hand-editing `.scale/memory-providers.json`.
|
|
136
|
-
- External providers are read-only by default. Writes require an explicit provider policy change.
|
|
137
|
-
- `scale-local` remains the fallback provider through Memory Brain and only promotes reviewed, evidence-backed memory.
|
|
138
|
-
- `memory pack` automatically includes a `provider-memory` section when provider recall returns relevant active memories.
|
|
139
|
-
- `ai-os plan` includes both the provider recall summary and the Memory Fabric context pack, so agents can route memory before planning without pretending external memory is always available.
|
|
140
|
-
|
|
141
|
-
This keeps agents flexible: they can ask the router for memory before planning, verification, review, or release, while SCALE still records which provider was used and why fallback was required.
|
|
142
|
-
|
|
143
|
-
Setup shortcut:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
scale setup --pack memory
|
|
147
|
-
scale setup --pack memory --memory-provider scale-local --json
|
|
148
|
-
scale setup --pack memory --memory-provider gbrain --memory-mode external-first --json
|
|
149
|
-
scale memory provider status --json
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
`setup --memory-provider` is the preferred UX for provider switching during onboarding. It writes the same routing file as `scale memory provider use`, returns `memoryProviderSwitch` in JSON, and keeps external writes disabled unless `--allow-external-write` is explicitly passed.
|
|
153
|
-
|
|
154
|
-
Remote replay validation:
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
npm run smoke:gbrain
|
|
158
|
-
node scripts/workflow/provider-rehearsal.mjs --skip-graphify --require-gbrain
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
This is intentionally stronger than `scale memory provider status --json`: it requires a real configured gbrain, writes a temporary page, then reads and queries it through separate CLI processes. If no remote/thin-client brain is configured, the rehearsal must report `blocked` or fail under `--require-gbrain`; falling back to `scale-local` is not a valid substitute for cross-session provider validation.
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Resource Governance
|
|
2
|
-
|
|
3
|
-
SCALE now treats project outputs as governed resources instead of undifferentiated files.
|
|
4
|
-
|
|
5
|
-
## Problem
|
|
6
|
-
|
|
7
|
-
Engineering agents generate many useful but noisy assets:
|
|
8
|
-
|
|
9
|
-
- maintained product and architecture docs
|
|
10
|
-
- task plans and verification notes
|
|
11
|
-
- E2E reports, screenshots, videos, logs, and coverage output
|
|
12
|
-
- temporary scripts and scratch files
|
|
13
|
-
- reusable automation scripts
|
|
14
|
-
- API contracts and ADRs
|
|
15
|
-
|
|
16
|
-
Without lifecycle rules these files drift, conflict with the real codebase, or get committed to Git when they should be local evidence only.
|
|
17
|
-
|
|
18
|
-
## Model
|
|
19
|
-
|
|
20
|
-
`scale assets scan` classifies resources into:
|
|
21
|
-
|
|
22
|
-
| Type | Default Git policy | Lifecycle |
|
|
23
|
-
| --- | --- | --- |
|
|
24
|
-
| canonical-doc | commit | maintained |
|
|
25
|
-
| decision-record | commit | immutable |
|
|
26
|
-
| contract | commit | maintained |
|
|
27
|
-
| reusable-script | commit | maintained |
|
|
28
|
-
| task-artifact | review | task-scoped |
|
|
29
|
-
| evidence-report | ignore | generated |
|
|
30
|
-
| generated-media | review/external | generated or review-required |
|
|
31
|
-
| temporary | ignore | temporary |
|
|
32
|
-
|
|
33
|
-
`.scale/resource-policy.json` owns defaults such as owners, module mapping, runtime directories, and maximum Git file size.
|
|
34
|
-
|
|
35
|
-
`.scale/assets.json` is the explicit catalog for long-lived project assets and source-of-truth declarations.
|
|
36
|
-
Declared source-of-truth assets are checked by `assets doctor`; if the file disappears, the doctor fails. Maintained assets can also declare `lastReviewedAt` and `reviewIntervalDays` so product, architecture, workflow, and standards documents are rechecked against the current implementation instead of drifting silently:
|
|
37
|
-
|
|
38
|
-
```json
|
|
39
|
-
{
|
|
40
|
-
"assets": [
|
|
41
|
-
{
|
|
42
|
-
"path": "docs/modules/auth/architecture.md",
|
|
43
|
-
"type": "canonical-doc",
|
|
44
|
-
"owner": "auth-team",
|
|
45
|
-
"module": "auth",
|
|
46
|
-
"sourceOfTruth": true,
|
|
47
|
-
"lifecycle": "maintained",
|
|
48
|
-
"gitPolicy": "commit",
|
|
49
|
-
"lastReviewedAt": "2026-05-15",
|
|
50
|
-
"reviewIntervalDays": 90
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Commands
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
scale assets scan --json
|
|
60
|
-
scale assets doctor --json
|
|
61
|
-
scale assets settle --task-id <task-id> --artifact-dir .planning/tasks/<task>
|
|
62
|
-
scale init --governance-pack resource-governance
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`assets doctor` fails when runtime evidence or external media is already tracked by Git, or when a declared source-of-truth asset is missing. It warns on large tracked files, expired temporary outputs, ownerless canonical documentation, missing non-source catalog entries, and stale maintained assets.
|
|
66
|
-
|
|
67
|
-
`assets settle` runs the same checks and appends a settlement section to `resource-impact.md` when a task artifact directory is provided.
|
|
68
|
-
|
|
69
|
-
## Finish Rule
|
|
70
|
-
|
|
71
|
-
Before finishing M/L/CRITICAL work:
|
|
72
|
-
|
|
73
|
-
1. Promote final product, API, or architecture truth into maintained docs.
|
|
74
|
-
2. Keep task-scoped planning, runtime contracts, reality checks, cleanup notes, raw reports, logs, screenshots, videos, and scratch scripts out of long-lived `docs/` unless deliberately promoted.
|
|
75
|
-
3. Run `scale assets scan --json`.
|
|
76
|
-
4. Run `scale assets doctor --json`.
|
|
77
|
-
5. Run `scale assets settle --task-id <task-id> --artifact-dir <task-dir>`.
|
|
78
|
-
6. Delete or archive temporary resources that are no longer needed.
|
|
79
|
-
|
|
80
|
-
## Task Artifact Boundary
|
|
81
|
-
|
|
82
|
-
New SCALE task artifacts default to `.planning/tasks/<task>/`, not `docs/worklog/tasks/<task>/`.
|
|
83
|
-
|
|
84
|
-
Every M/L/CRITICAL task should keep these three evidence files alongside the normal explore/plan/verification/review/summary set:
|
|
85
|
-
|
|
86
|
-
| File | Purpose |
|
|
87
|
-
| --- | --- |
|
|
88
|
-
| `runtime.md` | Records configuration source, topology, auth mode, and verification boundary. |
|
|
89
|
-
| `reality-check.md` | Separates confirmed behavior from not verified, stub/partial, credential-gated, and environment-gated claims. |
|
|
90
|
-
| `resource-cleanup.md` | Records which outputs stay task-scoped, which are promoted, and which should be deleted or archived. |
|
|
91
|
-
|
|
92
|
-
`docs/worklog/tasks/` remains a legacy-recognized task-artifact location for existing projects, but generated guidance now points new work to `.planning/tasks/`.
|
package/docs/RUNTIME_EVIDENCE.md
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# Runtime Evidence
|
|
2
|
-
|
|
3
|
-
Runtime Evidence 是 SCALE 用来记录 Agent 实际做过什么的运行时证据层。它的目标很直接:没有真实命令、工具、浏览器、skill 或人工验证证据时,Agent 不能声称任务已经完成。
|
|
4
|
-
|
|
5
|
-
它和现有证据层的关系:
|
|
6
|
-
|
|
7
|
-
- Gate evidence:回答 build、lint、test、security、review 等门禁是否通过。
|
|
8
|
-
- Tool evidence:回答必需的 skill、MCP、浏览器、桌面自动化或 CLI 工具是否执行过。
|
|
9
|
-
- Runtime evidence:回答当前会话是否具备可信的最终交付证据。
|
|
10
|
-
|
|
11
|
-
## 存储位置
|
|
12
|
-
|
|
13
|
-
Runtime 数据写入 SCALE 已忽略的本地运行时目录:
|
|
14
|
-
|
|
15
|
-
```text
|
|
16
|
-
.scale/
|
|
17
|
-
├── events/
|
|
18
|
-
│ ├── current-session.json
|
|
19
|
-
│ └── sessions/<session-id>.jsonl
|
|
20
|
-
└── evidence/
|
|
21
|
-
└── runtime/<evidence-id>.json
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
这些文件默认是本地运行时产物,不应该提交到 Git。需要长期保留时,应把摘要沉淀到任务 summary、ADR、README 或模块文档中,而不是直接提交原始日志。
|
|
25
|
-
|
|
26
|
-
## 基本流程
|
|
27
|
-
|
|
28
|
-
启动会话:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
scale runtime start \
|
|
32
|
-
--session-id 2026-05-18-runtime-evidence \
|
|
33
|
-
--task-id 2026-05-18-runtime-evidence \
|
|
34
|
-
--level M \
|
|
35
|
-
--agent codex
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
在真实命令、门禁、浏览器验证、skill 执行、MCP 调用或人工检查之后记录证据:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
scale runtime record \
|
|
42
|
-
--title "build" \
|
|
43
|
-
--kind command \
|
|
44
|
-
--status passed \
|
|
45
|
-
--command "npm run build" \
|
|
46
|
-
--exit-code 0 \
|
|
47
|
-
--summary "TypeScript build passed"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
检查是否允许最终交付:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
scale runtime final-check \
|
|
54
|
-
--task-id 2026-05-18-runtime-evidence \
|
|
55
|
-
--session-id 2026-05-18-runtime-evidence \
|
|
56
|
-
--level M
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
检查运行时健康状态:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
scale runtime doctor --level M
|
|
63
|
-
scale doctor
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## 完成规则
|
|
67
|
-
|
|
68
|
-
M、L、CRITICAL 任务在最终交付前必须满足:
|
|
69
|
-
|
|
70
|
-
- 当前 task/session 范围内至少有一条 `passed` runtime evidence。
|
|
71
|
-
- 当前 task/session 范围内不能存在 `failed` runtime evidence。
|
|
72
|
-
|
|
73
|
-
S 级任务可以保持轻量,但一旦存在失败证据,仍然不能声称完成。
|
|
74
|
-
|
|
75
|
-
## 脱敏规则
|
|
76
|
-
|
|
77
|
-
Runtime evidence 复用 tool evidence 的脱敏模型。写入 JSON 前会处理命令、摘要、artifact 路径和 metadata 中的敏感字段:
|
|
78
|
-
|
|
79
|
-
- password
|
|
80
|
-
- token
|
|
81
|
-
- secret
|
|
82
|
-
- authorization
|
|
83
|
-
- cookie
|
|
84
|
-
- credential
|
|
85
|
-
- api key
|
|
86
|
-
- private key
|
|
87
|
-
|
|
88
|
-
这样可以保留有用证据,同时避免把 token、cookie、密钥等内容写进运行时文件。
|
|
89
|
-
|
|
90
|
-
## 推荐使用场景
|
|
91
|
-
|
|
92
|
-
适合记录 runtime evidence 的场景:
|
|
93
|
-
|
|
94
|
-
- 最终交付检查。
|
|
95
|
-
- 长会话或多阶段任务。
|
|
96
|
-
- 跨 Agent 或外部 CLI review。
|
|
97
|
-
- 浏览器、桌面自动化、MCP、skill 验证。
|
|
98
|
-
- 发版前 preflight。
|
|
99
|
-
- 需要进入后续学习闭环的失败、修复和重试记录。
|
|
100
|
-
|
|
101
|
-
不要用 runtime evidence 替代长期维护文档。Runtime evidence 是“操作证明”,PRD、ADR、架构文档、README、模块文档才是长期项目契约。
|