@slowdini/slow-powers-opencode 0.4.1 → 0.4.2
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 +2 -6
- package/opencode/plugins/slow-powers.js +9 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,12 +60,8 @@ You can also browse and install it interactively: run `codex`, open
|
|
|
60
60
|
|
|
61
61
|
### OpenCode
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"plugin": ["@slowdini/slow-powers-opencode"]
|
|
68
|
-
}
|
|
63
|
+
```bash
|
|
64
|
+
opencode plugin @slowdini/slow-powers-opencode -g
|
|
69
65
|
```
|
|
70
66
|
|
|
71
67
|
## The skills
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Intercepts plan file writes in plan mode and triggers hardening-plans skill.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { createHash } from "node:crypto";
|
|
10
9
|
import fs from "node:fs";
|
|
11
10
|
import path from "node:path";
|
|
12
11
|
import { fileURLToPath } from "node:url";
|
|
@@ -24,10 +23,9 @@ const bootstrapLeadingPhrase = "<EXTREMELY-IMPORTANT>";
|
|
|
24
23
|
// once eliminates redundant fs work on every agent step.
|
|
25
24
|
let _bootstrapCache; // undefined = not yet loaded, null = file missing
|
|
26
25
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
const
|
|
30
|
-
const HARDENED_MARKER = "<!-- hardened-plans -->";
|
|
26
|
+
// Tracks plan files we've already sent the hardening prompt for.
|
|
27
|
+
// Once we ask the agent to harden a plan, we never ask again for that file.
|
|
28
|
+
const hardeningPromptSentFor = new Set();
|
|
31
29
|
|
|
32
30
|
export const SlowPowersPlugin = async ({ client, directory: _directory }) => {
|
|
33
31
|
// Helper to load bootstrap content (cached after first call)
|
|
@@ -44,11 +42,6 @@ export const SlowPowersPlugin = async ({ client, directory: _directory }) => {
|
|
|
44
42
|
return _bootstrapCache;
|
|
45
43
|
};
|
|
46
44
|
|
|
47
|
-
const hashContent = (content) =>
|
|
48
|
-
createHash("sha256").update(content).digest("hex");
|
|
49
|
-
|
|
50
|
-
const isPlanHardened = (content) => content.includes(HARDENED_MARKER);
|
|
51
|
-
|
|
52
45
|
const handlePlanFileEdit = async (event) => {
|
|
53
46
|
const filePath = event.properties.file;
|
|
54
47
|
const sessionID = event.properties.sessionID;
|
|
@@ -65,20 +58,11 @@ export const SlowPowersPlugin = async ({ client, directory: _directory }) => {
|
|
|
65
58
|
}
|
|
66
59
|
if (session.agent !== "plan") return;
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} catch {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (isPlanHardened(content)) return;
|
|
76
|
-
|
|
77
|
-
const contentHash = hashContent(content);
|
|
78
|
-
const previousHash = processedPlanHashes.get(filePath);
|
|
79
|
-
if (previousHash === contentHash) return;
|
|
61
|
+
// Only prompt once per plan file. After we've asked the agent to harden
|
|
62
|
+
// it, we trust them to do so or not; re-prompting causes loops.
|
|
63
|
+
if (hardeningPromptSentFor.has(filePath)) return;
|
|
80
64
|
|
|
81
|
-
|
|
65
|
+
hardeningPromptSentFor.add(filePath);
|
|
82
66
|
|
|
83
67
|
try {
|
|
84
68
|
await client.session.prompt({
|
|
@@ -88,13 +72,13 @@ export const SlowPowersPlugin = async ({ client, directory: _directory }) => {
|
|
|
88
72
|
parts: [
|
|
89
73
|
{
|
|
90
74
|
type: "text",
|
|
91
|
-
text: `The plan at ${filePath} has been written.
|
|
75
|
+
text: `The plan at ${filePath} has been written. If not already done, please run the hardening-plans skill on this plan file to review it before presentation.`,
|
|
92
76
|
},
|
|
93
77
|
],
|
|
94
78
|
},
|
|
95
79
|
});
|
|
96
80
|
} catch (err) {
|
|
97
|
-
|
|
81
|
+
hardeningPromptSentFor.delete(filePath);
|
|
98
82
|
console.error("[slow-powers] Failed to trigger hardening-plans:", err);
|
|
99
83
|
}
|
|
100
84
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slowdini/slow-powers-opencode",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Slow-powers — structured development workflows for coding agents (TDD, debugging, verification, git hygiene)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./opencode/plugins/slow-powers.js",
|