@sdotwinter/openclaw-deterministic 0.18.2 → 0.19.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/bin/install.js +32 -0
- package/bin/upgrade.js +35 -1
- package/package.json +1 -1
- package/templates/SOUL.deterministic.md +7 -0
package/bin/install.js
CHANGED
|
@@ -26,6 +26,15 @@ const OVERLAY_BLOCK = `
|
|
|
26
26
|
This system loads and adheres to SOUL.deterministic.md as a governing philosophical constraint.
|
|
27
27
|
`.trim();
|
|
28
28
|
|
|
29
|
+
|
|
30
|
+
const MEMORY_RULES_BLOCK = `
|
|
31
|
+
## Memory Write Triggers
|
|
32
|
+
|
|
33
|
+
When to write to each tier:
|
|
34
|
+
- **memory/working/** - During active incident investigation, before root cause confirmed
|
|
35
|
+
- **memory/episodic/** - After fix confirmed, root cause known
|
|
36
|
+
- **memory/semantic/** - Never (handled by memory-compactor skill)
|
|
37
|
+
`.trim();
|
|
29
38
|
// -----------------------------
|
|
30
39
|
// Paths
|
|
31
40
|
// -----------------------------
|
|
@@ -171,6 +180,28 @@ function installConfigIfMissing() {
|
|
|
171
180
|
console.log(`Installed: ${target.config}`);
|
|
172
181
|
}
|
|
173
182
|
|
|
183
|
+
function appendMemoryRulesToSoul() {
|
|
184
|
+
if (!exists(target.soul)) {
|
|
185
|
+
console.log("No SOUL.md found — skipping memory rules.");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const content = read(target.soul);
|
|
190
|
+
if (content.includes("Memory Write Triggers")) {
|
|
191
|
+
console.log("Memory rules already present in SOUL.md — skipping.");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
console.log("Appending memory write rules to SOUL.md...");
|
|
196
|
+
if (DRY_RUN) {
|
|
197
|
+
console.log("[DRY-RUN] Would append memory rules to SOUL.md.");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
fs.appendFileSync(target.soul, "\n" + MEMORY_RULES_BLOCK + "\n");
|
|
202
|
+
console.log("Updated: SOUL.md with memory write rules");
|
|
203
|
+
}
|
|
204
|
+
|
|
174
205
|
function bootstrapSoulIfMissing() {
|
|
175
206
|
if (exists(target.soul)) {
|
|
176
207
|
console.log("User SOUL.md exists — NOT modified.");
|
|
@@ -224,6 +255,7 @@ if (!DRY_RUN) {
|
|
|
224
255
|
installTemplates();
|
|
225
256
|
installConfigIfMissing();
|
|
226
257
|
bootstrapSoulIfMissing();
|
|
258
|
+
appendMemoryRulesToSoul();
|
|
227
259
|
|
|
228
260
|
if (DRY_RUN) {
|
|
229
261
|
console.log("\nDry-run complete. No changes were written.\n");
|
package/bin/upgrade.js
CHANGED
|
@@ -8,6 +8,15 @@ const args = process.argv.slice(2);
|
|
|
8
8
|
const DRY_RUN = args.includes("--dry-run");
|
|
9
9
|
const FORCE = args.includes("--force");
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
const MEMORY_RULES_BLOCK = `
|
|
13
|
+
## Memory Write Triggers
|
|
14
|
+
|
|
15
|
+
When to write to each tier:
|
|
16
|
+
- **memory/working/** - During active incident investigation, before root cause confirmed
|
|
17
|
+
- **memory/episodic/** - After fix confirmed, root cause known
|
|
18
|
+
- **memory/semantic/** - Never (handled by memory-compactor skill)
|
|
19
|
+
`.trim();
|
|
11
20
|
const pkg = require(path.join(__dirname, "..", "package.json"));
|
|
12
21
|
const CLI_VERSION = pkg.version;
|
|
13
22
|
|
|
@@ -21,7 +30,7 @@ const HASH_REGEX = /Canonical-Hash:\s*SHA256:([a-f0-9]+)/;
|
|
|
21
30
|
const files = [
|
|
22
31
|
"OPERATING_RULES.md",
|
|
23
32
|
"SOUL.deterministic.md",
|
|
24
|
-
"
|
|
33
|
+
"memory-compactor.SKILL.md",
|
|
25
34
|
];
|
|
26
35
|
|
|
27
36
|
function exists(p) {
|
|
@@ -134,6 +143,30 @@ if (!exists(workspace)) {
|
|
|
134
143
|
process.exit(1);
|
|
135
144
|
}
|
|
136
145
|
|
|
146
|
+
|
|
147
|
+
function appendMemoryRulesToSoul() {
|
|
148
|
+
const soulPath = path.join(workspace, "SOUL.md");
|
|
149
|
+
if (!exists(soulPath)) {
|
|
150
|
+
console.log("No SOUL.md found — skipping memory rules.");
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const content = fs.readFileSync(soulPath, "utf8");
|
|
155
|
+
if (content.includes("Memory Write Triggers")) {
|
|
156
|
+
console.log("Memory rules already present — skipping.");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
console.log("Appending memory write rules to SOUL.md...");
|
|
161
|
+
if (DRY_RUN) {
|
|
162
|
+
console.log("[DRY-RUN] Would append memory rules.");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
fs.appendFileSync(soulPath, "\n" + MEMORY_RULES_BLOCK + "\n");
|
|
167
|
+
console.log("Updated: SOUL.md with memory write rules");
|
|
168
|
+
}
|
|
169
|
+
|
|
137
170
|
console.log(`\nRunning deterministic upgrade → v${CLI_VERSION}\n`);
|
|
138
171
|
|
|
139
172
|
for (const rel of files) {
|
|
@@ -143,6 +176,7 @@ for (const rel of files) {
|
|
|
143
176
|
if (DRY_RUN) {
|
|
144
177
|
console.log("\nDry-run complete. No changes written.\n");
|
|
145
178
|
} else {
|
|
179
|
+
appendMemoryRulesToSoul();
|
|
146
180
|
console.log("\nUpgrade complete.\n");
|
|
147
181
|
}
|
|
148
182
|
|
package/package.json
CHANGED
|
@@ -56,3 +56,10 @@ Rules:
|
|
|
56
56
|
- Routine status checks must NOT generate memory.
|
|
57
57
|
- Memory entries must follow structured schema.
|
|
58
58
|
- Determinism applies to memory generation.
|
|
59
|
+
|
|
60
|
+
## Memory Write Triggers
|
|
61
|
+
|
|
62
|
+
When to write to each tier:
|
|
63
|
+
- **memory/working/** - During active incident investigation, before root cause confirmed
|
|
64
|
+
- **memory/episodic/** - After fix confirmed, root cause known
|
|
65
|
+
- **memory/semantic/** - Never (handled by memory-compactor skill)
|