company-skill 3.1.3 → 3.2.1
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/hooks/stop-guard.js +23 -13
- package/package.json +1 -1
- package/skill/SKILL.md +16 -11
package/hooks/stop-guard.js
CHANGED
|
@@ -8,15 +8,7 @@ const companyDir = path.join(cwd, '.company');
|
|
|
8
8
|
const criteriaPath = path.join(companyDir, 'criteria.json');
|
|
9
9
|
const goalPath = path.join(companyDir, 'GOAL.md');
|
|
10
10
|
const cancelPath = path.join(companyDir, 'CANCEL');
|
|
11
|
-
|
|
12
|
-
// Read stdin for stop_hook_active flag
|
|
13
|
-
let stdinData = '';
|
|
14
|
-
try { stdinData = fs.readFileSync('/dev/stdin', 'utf8'); } catch (e) {}
|
|
15
|
-
let hookActive = false;
|
|
16
|
-
try { hookActive = JSON.parse(stdinData).stop_hook_active === true; } catch (e) {}
|
|
17
|
-
|
|
18
|
-
// If hook already fired once and Claude is trying to stop again, let it
|
|
19
|
-
if (hookActive) process.exit(0);
|
|
11
|
+
const lockPath = path.join(companyDir, '.stop-lock');
|
|
20
12
|
|
|
21
13
|
// No company running
|
|
22
14
|
if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) process.exit(0);
|
|
@@ -24,9 +16,21 @@ if (!fs.existsSync(goalPath) && !fs.existsSync(criteriaPath)) process.exit(0);
|
|
|
24
16
|
// Cancel signal
|
|
25
17
|
if (fs.existsSync(cancelPath)) {
|
|
26
18
|
try { fs.unlinkSync(cancelPath); } catch (e) {}
|
|
19
|
+
try { fs.unlinkSync(lockPath); } catch (e) {}
|
|
27
20
|
process.exit(0);
|
|
28
21
|
}
|
|
29
22
|
|
|
23
|
+
// If lock file exists and is recent (< 60s), this is a repeat stop. Allow it.
|
|
24
|
+
if (fs.existsSync(lockPath)) {
|
|
25
|
+
try {
|
|
26
|
+
const age = Date.now() - fs.statSync(lockPath).mtimeMs;
|
|
27
|
+
if (age < 60000) {
|
|
28
|
+
fs.unlinkSync(lockPath);
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
} catch (e) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
// Check criteria
|
|
31
35
|
if (fs.existsSync(criteriaPath)) {
|
|
32
36
|
try {
|
|
@@ -34,12 +38,17 @@ if (fs.existsSync(criteriaPath)) {
|
|
|
34
38
|
const all = data.criteria || [];
|
|
35
39
|
const failing = all.filter(c => !c.passes || !c.evidence);
|
|
36
40
|
|
|
37
|
-
if (all.length > 0 && failing.length === 0)
|
|
41
|
+
if (all.length > 0 && failing.length === 0) {
|
|
42
|
+
try { fs.unlinkSync(lockPath); } catch (e) {}
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
38
45
|
|
|
46
|
+
// Write lock, block this stop
|
|
47
|
+
fs.writeFileSync(lockPath, String(Date.now()));
|
|
39
48
|
const failList = failing.map(c => c.description).join(', ');
|
|
40
49
|
console.log(JSON.stringify({
|
|
41
50
|
decision: "block",
|
|
42
|
-
reason: "[COMPANY] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY.
|
|
51
|
+
reason: "[COMPANY] " + failing.length + "/" + all.length + " criteria not met: " + failList + ". Continue THINK > EXECUTE > VERIFY."
|
|
43
52
|
}));
|
|
44
53
|
process.exit(0);
|
|
45
54
|
} catch (e) {
|
|
@@ -47,8 +56,9 @@ if (fs.existsSync(criteriaPath)) {
|
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
// No criteria but goal exists
|
|
59
|
+
// No criteria but goal exists — block once
|
|
60
|
+
fs.writeFileSync(lockPath, String(Date.now()));
|
|
51
61
|
console.log(JSON.stringify({
|
|
52
62
|
decision: "block",
|
|
53
|
-
reason: "[COMPANY] Goal not achieved.
|
|
63
|
+
reason: "[COMPANY] Goal not achieved. Create criteria.json and start THINK > EXECUTE > VERIFY."
|
|
54
64
|
}));
|
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -23,11 +23,13 @@ Give it a goal. Run every employee. Loop until verified done.
|
|
|
23
23
|
|
|
24
24
|
## Preamble
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
Print this as plain text (NOT Bash):
|
|
27
|
+
|
|
28
|
+
════════════════════════════════════════════════
|
|
29
|
+
🏢 COMPANY SKILL ACTIVE
|
|
30
|
+
════════════════════════════════════════════════
|
|
31
|
+
|
|
32
|
+
Then check if COMPANY.md exists and report how many roles found. Check if playbook.md exists.
|
|
31
33
|
|
|
32
34
|
## Parse
|
|
33
35
|
|
|
@@ -45,9 +47,11 @@ Read `.company/playbook.md` if it exists (accumulated knowledge from past sessio
|
|
|
45
47
|
|
|
46
48
|
## Loop
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
Print as plain text (NOT Bash):
|
|
51
|
+
|
|
52
|
+
════════════════════════════════════════════════
|
|
53
|
+
🏢 CYCLE {N} - THINK > EXECUTE > VERIFY
|
|
54
|
+
════════════════════════════════════════════════
|
|
51
55
|
|
|
52
56
|
### THINK (Opus, all leads parallel)
|
|
53
57
|
|
|
@@ -85,9 +89,10 @@ Internal Reviewer reads criteria.json + all findings. For each criterion:
|
|
|
85
89
|
|
|
86
90
|
Devil's Advocate attacks anything marked as passing.
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
Print as plain text (NOT Bash):
|
|
93
|
+
|
|
94
|
+
📋 CYCLE {N} VERDICT: {DONE or NOT DONE}
|
|
95
|
+
{reason}
|
|
91
96
|
|
|
92
97
|
ALL criteria pass + Advocate accepts = EXIT.
|
|
93
98
|
Otherwise = loop with feedback.
|