@sdotwinter/openclaw-deterministic 0.9.0 → 0.10.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 (2) hide show
  1. package/bin/doctor.js +57 -4
  2. package/package.json +1 -1
package/bin/doctor.js CHANGED
@@ -12,6 +12,9 @@ const HOME = process.env.HOME;
12
12
  const openclawRoot = path.join(HOME, ".openclaw");
13
13
  const workspace = path.join(openclawRoot, "workspace");
14
14
 
15
+ const DEFAULT_HARD_LIMIT = 1200;
16
+ const DEFAULT_RISK_THRESHOLD = 1020;
17
+
15
18
  const files = {
16
19
  operating: path.join(workspace, "OPERATING_RULES.md"),
17
20
  detSoul: path.join(workspace, "SOUL.deterministic.md"),
@@ -77,6 +80,28 @@ function evaluateVersion(filePath) {
77
80
  return { status: "mismatch", version };
78
81
  }
79
82
 
83
+ function parseHardLimit() {
84
+ if (!exists(files.compactor)) return null;
85
+
86
+ const content = read(files.compactor);
87
+
88
+ const match = content.match(/HARD_LIMIT[^0-9]*([0-9]+)/);
89
+ if (!match) return null;
90
+
91
+ return parseInt(match[1], 10);
92
+ }
93
+
94
+ function parseRiskThreshold() {
95
+ if (!exists(files.compactor)) return null;
96
+
97
+ const content = read(files.compactor);
98
+
99
+ const match = content.match(/RISK_THRESHOLD[^0-9]*([0-9]+)/);
100
+ if (!match) return null;
101
+
102
+ return parseInt(match[1], 10);
103
+ }
104
+
80
105
  function evaluate() {
81
106
  const result = {
82
107
  cliVersion: pkg.version,
@@ -86,6 +111,13 @@ function evaluate() {
86
111
  overlayEnabled: false,
87
112
  semanticTokens: 0,
88
113
  semanticStatus: "safe",
114
+ limits: {
115
+ hardLimitConfigured: null,
116
+ riskThresholdConfigured: null,
117
+ hardLimitDefault: DEFAULT_HARD_LIMIT,
118
+ riskThresholdDefault: DEFAULT_RISK_THRESHOLD,
119
+ coherent: true,
120
+ },
89
121
  };
90
122
 
91
123
  if (!result.openclawDetected || !result.workspaceDetected) {
@@ -101,9 +133,26 @@ function evaluate() {
101
133
  const tokens = estimateSemanticTokens();
102
134
  result.semanticTokens = tokens;
103
135
 
104
- if (tokens > 1200) {
136
+ const hardLimit = parseHardLimit();
137
+ const riskThreshold = parseRiskThreshold();
138
+
139
+ result.limits.hardLimitConfigured = hardLimit;
140
+ result.limits.riskThresholdConfigured = riskThreshold;
141
+
142
+ if (hardLimit && hardLimit !== DEFAULT_HARD_LIMIT) {
143
+ result.limits.coherent = false;
144
+ }
145
+
146
+ if (riskThreshold && riskThreshold !== DEFAULT_RISK_THRESHOLD) {
147
+ result.limits.coherent = false;
148
+ }
149
+
150
+ const effectiveHardLimit = hardLimit || DEFAULT_HARD_LIMIT;
151
+ const effectiveRiskThreshold = riskThreshold || DEFAULT_RISK_THRESHOLD;
152
+
153
+ if (tokens > effectiveHardLimit) {
105
154
  result.semanticStatus = "hard-limit-exceeded";
106
- } else if (tokens > 1020) {
155
+ } else if (tokens > effectiveRiskThreshold) {
107
156
  result.semanticStatus = "risk-threshold";
108
157
  } else {
109
158
  result.semanticStatus = "safe";
@@ -153,12 +202,16 @@ function printHuman(result) {
153
202
  : "⚠ Deterministic overlay NOT enabled in SOUL.md."
154
203
  );
155
204
 
205
+ if (!result.limits.coherent) {
206
+ console.log("⚠ Threshold configuration drift detected in SKILL.md.");
207
+ }
208
+
156
209
  console.log(`\nSemantic memory tokens (est): ${result.semanticTokens}`);
157
210
 
158
211
  if (result.semanticStatus === "hard-limit-exceeded") {
159
- console.log("❌ Semantic memory exceeds HARD_LIMIT (1200).");
212
+ console.log("❌ Semantic memory exceeds HARD_LIMIT.");
160
213
  } else if (result.semanticStatus === "risk-threshold") {
161
- console.log("⚠ Semantic memory above risk threshold (1020).");
214
+ console.log("⚠ Semantic memory above risk threshold.");
162
215
  } else {
163
216
  console.log("✅ Semantic memory within safe bounds.");
164
217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdotwinter/openclaw-deterministic",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Deterministic governance and memory compaction layer for OpenClaw",
5
5
  "keywords": [
6
6
  "openclaw",