@sdotwinter/openclaw-deterministic 0.17.6 → 0.17.9

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 CHANGED
@@ -1,8 +1,8 @@
1
- # OpenClaw Deterministic
1
+ # OpenClaw Deterministic (OCD)
2
2
 
3
- A deterministic execution, memory governance, and integrity enforcement framework for OpenClaw.
3
+ Deterministic governance, memory discipline, and integrity enforcement framework for OpenClaw.
4
4
 
5
- OpenClaw Deterministic enforces canonical template integrity, semantic memory limits, and execution discipline to transform OpenClaw into a predictable, auditable system suitable for long-running agent deployments.
5
+ OpenClaw Deterministic transforms OpenClaw into a predictable, auditable execution system suitable for long-running agent deployments and CI environments.
6
6
 
7
7
  This is not an assistant plugin.
8
8
 
@@ -14,32 +14,69 @@ It is a governance layer.
14
14
 
15
15
  Install globally:
16
16
 
17
+ ```bash
17
18
  npm install -g @sdotwinter/openclaw-deterministic
19
+ ```
18
20
 
19
- Then initialize governance inside your OpenClaw workspace:
21
+ Add to your PATH (optional but recommended):
20
22
 
23
+ ```bash
24
+ export PATH="$PATH:$(npm root -g)/@sdotwinter/openclaw-deterministic/bin"
25
+ ```
26
+
27
+ Or create a symlink:
28
+
29
+ ```bash
30
+ sudo ln -s $(npm root -g)/@sdotwinter/openclaw-deterministic/bin/oc-deterministic /usr/local/bin/
31
+ ```
32
+
33
+ Apply deterministic governance to an existing OpenClaw workspace:
34
+
35
+ ```bash
21
36
  oc-deterministic install
37
+ ```
22
38
 
23
39
  Verify installation:
24
40
 
41
+ ```bash
25
42
  oc-deterministic doctor
43
+ ```
26
44
 
27
- Concise health summary:
45
+ Concise health summary (CI-friendly):
28
46
 
47
+ ```bash
29
48
  oc-deterministic status
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Safety Guarantees
54
+
55
+ OpenClaw Deterministic enforces execution discipline with explicit safety guarantees:
56
+
57
+ - Does not overwrite an existing SOUL.md
58
+ - Verifies canonical integrity before upgrade
59
+ - Refuses to upgrade drifted files (unless --force)
60
+ - Creates deterministic backup snapshots before mutation
61
+ - Supports structured revert to previous snapshot
62
+ - Exposes machine-readable health status
63
+ - Blocks silent structural mutation
64
+
65
+ This system assumes drift is inevitable.
66
+
67
+ It makes drift visible.
30
68
 
31
69
  ---
32
70
 
33
71
  ## What This Solves
34
72
 
35
- AI systems drift.
73
+ AI systems drift over time:
36
74
 
37
- They drift in:
38
- - Memory usage
39
- - Execution classification
40
- - File modification behavior
41
- - Configuration alignment
42
- - Contract integrity
75
+ - Memory growth
76
+ - File mutation
77
+ - Execution misclassification
78
+ - Configuration divergence
79
+ - Contract ambiguity
43
80
 
44
81
  OpenClaw Deterministic enforces:
45
82
 
@@ -48,9 +85,9 @@ OpenClaw Deterministic enforces:
48
85
  - Semantic memory limits
49
86
  - Config-driven thresholds
50
87
  - Governance event logging
51
- - Structured machine-readable health reporting
88
+ - Structured health reporting
52
89
 
53
- The goal:
90
+ The objective:
54
91
 
55
92
  Predictable execution under defined constraints.
56
93
 
@@ -60,14 +97,15 @@ Predictable execution under defined constraints.
60
97
 
61
98
  ### Deterministic Execution Tiers
62
99
 
63
- Execution is classified into three tiers:
100
+ Execution is classified into:
64
101
 
65
102
  Tier A — Safe
66
103
  Tier B — Governed Modification
67
104
  Tier C — Destructive / Structural
68
105
 
69
106
  Each tier defines:
70
- - Whether diffs are required
107
+
108
+ - Whether a diff preview is required
71
109
  - Whether confirmation is required
72
110
  - Whether auto-execution is allowed
73
111
 
@@ -79,7 +117,7 @@ This prevents silent behavioral drift.
79
117
 
80
118
  Deterministic templates embed canonical SHA256 hashes.
81
119
 
82
- `doctor` verifies:
120
+ doctor verifies:
83
121
 
84
122
  - Template presence
85
123
  - Version alignment
@@ -87,7 +125,39 @@ Deterministic templates embed canonical SHA256 hashes.
87
125
 
88
126
  If a file is manually edited outside deterministic flow, the system detects it.
89
127
 
90
- This enables tamper visibility.
128
+ Tamper visibility is enforced.
129
+
130
+ ---
131
+
132
+ ### Upgrade Integrity Gate
133
+
134
+ oc-deterministic upgrade:
135
+
136
+ - Verifies canonical integrity before applying changes
137
+ - Refuses overwrite if drift is detected
138
+ - Supports --force override
139
+ - Supports --dry-run
140
+
141
+ Upgrade is governed mutation — not blind overwrite.
142
+
143
+ ---
144
+
145
+ ### Deterministic Backup + Revert
146
+
147
+ Before template mutation:
148
+
149
+ Snapshots are stored at:
150
+
151
+ ~/.openclaw/backups/deterministic/<timestamp>/
152
+
153
+ Revert commands:
154
+
155
+ oc-deterministic revert --list
156
+ oc-deterministic revert --to <timestamp>
157
+
158
+ Revert restores deterministic files from snapshot.
159
+
160
+ This enables safe experimentation without state loss.
91
161
 
92
162
  ---
93
163
 
@@ -100,22 +170,23 @@ Semantic memory is:
100
170
  - Evaluated against risk thresholds
101
171
  - Logged on violation
102
172
 
103
- Configuration:
173
+ Configuration file:
104
174
 
105
175
  ~/.openclaw/.deterministic.json
106
176
 
107
177
  Example:
108
178
 
179
+ ```json
109
180
  {
110
181
  "semantic": {
111
182
  "HARD_LIMIT": 1200,
112
183
  "RISK_THRESHOLD_PERCENT": 85
113
184
  },
114
185
  "governance": {
115
- "strict_mode": false,
116
186
  "violation_logging": true
117
187
  }
118
188
  }
189
+ ```
119
190
 
120
191
  This prevents uncontrolled memory expansion.
121
192
 
@@ -140,21 +211,7 @@ Supports:
140
211
  - Machine-readable JSON output
141
212
  - Deterministic backup snapshots
142
213
  - Governance event logging
143
- - CI integration
144
-
145
- ---
146
-
147
- ## Upgrade Model
148
-
149
- Templates are version-stamped.
150
-
151
- Upgrade flow preserves:
152
-
153
- - Backups
154
- - Deterministic config
155
- - User SOUL.md
156
-
157
- Future releases include safe merge flows for template upgrades.
214
+ - CI integration via exit codes
158
215
 
159
216
  ---
160
217
 
@@ -181,9 +238,9 @@ Designed for:
181
238
  - CI-integrated governance
182
239
  - Environments requiring auditability
183
240
 
184
- If you need experimentation, use OpenClaw alone.
241
+ If you want experimentation, use OpenClaw alone.
185
242
 
186
- If you need discipline, use Deterministic.
243
+ If you want discipline, use OpenClaw Deterministic.
187
244
 
188
245
  ---
189
246
 
package/ROADMAP.md ADDED
@@ -0,0 +1,81 @@
1
+ # OpenClaw Deterministic (OCD) — Roadmap
2
+
3
+ This roadmap outlines the next phases of deterministic governance evolution.
4
+
5
+ The goal is not feature growth.
6
+
7
+ The goal is stronger guarantees.
8
+
9
+ ---
10
+
11
+ ## Governance & Integrity
12
+
13
+ - Safe template merge flow inside upgrade
14
+ - Cooldown state visibility in doctor
15
+ - Semantic shard suggestion automation
16
+
17
+ ---
18
+
19
+ ## Observability & Automation
20
+
21
+ - Structured logging mode
22
+ - Centralized governance event log (beyond episodic markdown)
23
+ - Compaction activity log
24
+ - Drift detection alerting mode
25
+
26
+ (Status command complete)
27
+
28
+ ---
29
+
30
+ ## Memory System Enhancements
31
+
32
+ - Deterministic shard splitting
33
+ - Automatic semantic pressure warnings
34
+ - Episodic summarization quality check
35
+ - Manual compaction preview mode
36
+ - Token estimation normalization
37
+ - Memory integrity checksum tracking
38
+
39
+ ---
40
+
41
+ ## Install & Bootstrap
42
+
43
+ - Fresh-install auto-enable refinement
44
+ - Install confirmation summary report
45
+ - Rollback preview mode
46
+ - Backup pruning policy
47
+ - Multi-workspace support
48
+
49
+ ---
50
+
51
+ ## CLI Improvements
52
+
53
+ - enable --dry-run
54
+ - revert --preview
55
+ - Help polish
56
+ - Command aliases
57
+
58
+ (Exit codes already formalized via doctor/status)
59
+
60
+ ---
61
+
62
+ ## Architecture & Distribution
63
+
64
+ - Governance flow diagram
65
+ - Memory tier diagram
66
+ - Upgrade policy documentation
67
+ - Integration guide
68
+ - Public positioning statement
69
+
70
+ ---
71
+
72
+ ## Advanced (Future)
73
+
74
+ - Expanded governance config surface (.deterministic.json)
75
+ - Policy enforcement plugin system
76
+ - Multi-agent compatibility layer
77
+ - External monitoring hook
78
+ - Remote health reporting
79
+ - Immutable governance lock mode
80
+ - Strict mode blocking Tier B auto-execution
81
+ - Deterministic sandbox testing mode
package/bin/audit.js CHANGED
@@ -34,6 +34,14 @@ function exists(p) {
34
34
  }
35
35
  }
36
36
 
37
+ function read(p) {
38
+ return fs.readFileSync(p, "utf8");
39
+ }
40
+
41
+ function stripHeaders(content) {
42
+ return content.replace(/<!--[\s\S]*?-->/g, "").trim();
43
+ }
44
+
37
45
  console.log("\nRunning deterministic audit...\n");
38
46
 
39
47
  let driftFound = false;
@@ -52,11 +60,27 @@ for (const file of files) {
52
60
  }
53
61
 
54
62
  try {
63
+ const templateContent = stripHeaders(read(file.template));
64
+ const installedContent = stripHeaders(read(file.installed));
65
+
66
+ // Write stripped content to temp files for diff
67
+ const tmpDir = fs.mkdtempSync(path.join(require("os").tmpdir(), "audit-"));
68
+ const tmpTemplate = path.join(tmpDir, "template");
69
+ const tmpInstalled = path.join(tmpDir, "installed");
70
+
71
+ fs.writeFileSync(tmpTemplate, templateContent);
72
+ fs.writeFileSync(tmpInstalled, installedContent);
73
+
55
74
  const diff = execSync(
56
- `diff -u "${file.template}" "${file.installed}"`,
75
+ `diff -u "${tmpTemplate}" "${tmpInstalled}"`,
57
76
  { stdio: "pipe" }
58
77
  ).toString();
59
78
 
79
+ // Cleanup temp files
80
+ fs.unlinkSync(tmpTemplate);
81
+ fs.unlinkSync(tmpInstalled);
82
+ fs.rmdirSync(tmpDir);
83
+
60
84
  if (diff.trim().length === 0) {
61
85
  console.log(`✅ ${file.name} matches template.`);
62
86
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdotwinter/openclaw-deterministic",
3
- "version": "0.17.6",
3
+ "version": "0.17.9",
4
4
  "description": "Deterministic governance and memory compaction layer for OpenClaw",
5
5
  "keywords": [
6
6
  "openclaw",
@@ -4,7 +4,6 @@
4
4
  "RISK_THRESHOLD_PERCENT": 85
5
5
  },
6
6
  "governance": {
7
- "strict_mode": false,
8
7
  "violation_logging": true
9
8
  }
10
9
  }