harness-everything 0.2.0 โ 0.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/CHANGELOG.md +7 -0
- package/build-multi-agent-system/SKILL.md +68 -68
- package/create-agent-launcher/SKILL.md +48 -48
- package/docs/workflows/build-multi-agent-system.md +62 -62
- package/docs/workflows/create-agent-launcher.md +62 -62
- package/docs/workflows/environment-detection.md +63 -63
- package/docs/workflows/eval-harness.md +57 -57
- package/docs/workflows/fable-discipline.md +59 -59
- package/docs/workflows/fable-mode.md +32 -32
- package/docs/workflows/git-commit.md +62 -62
- package/docs/workflows/grill-me.md +62 -62
- package/docs/workflows/grill-with-docs.md +62 -62
- package/docs/workflows/improve-codebase-architecture.md +60 -60
- package/docs/workflows/repo-docs.md +59 -59
- package/docs/workflows/rewrite-commits.md +60 -60
- package/docs/workflows/security-review.md +58 -58
- package/docs/workflows/self-evolve.md +59 -59
- package/docs/workflows/tdd.md +39 -39
- package/docs/workflows/todo-driven-workflow.md +36 -36
- package/docs/workflows/using-git-worktrees.md +63 -63
- package/docs/workflows/verification-loop.md +69 -69
- package/docs/workflows/verify-before-claim.md +60 -60
- package/docs/workflows/zoom-out.md +62 -62
- package/environment-detection/SKILL.md +77 -77
- package/eval-framework/behavioral-test.js +105 -105
- package/eval-framework/mechanism-test.js +251 -251
- package/eval-harness/SKILL.md +59 -59
- package/fable-discipline/SKILL.md +38 -38
- package/fable-mode/SKILL.md +51 -51
- package/git-commit/SKILL.md +55 -55
- package/grill-me/SKILL.md +36 -36
- package/grill-with-docs/SKILL.md +99 -99
- package/harness-everything/SKILL.md +141 -141
- package/harness-everything/examples/README.md +9 -9
- package/harness-everything/examples/todo-workflow.md +22 -22
- package/harness-everything/scripts/todo-cli.js +157 -157
- package/harness-everything/scripts/verify-gate.js +31 -31
- package/hooks/scripts/atomic-commit-check.js +68 -68
- package/hooks/scripts/context-compact.js +114 -114
- package/hooks/scripts/lib/harness-state.js +29 -3
- package/hooks/scripts/lib/platforms/claude.js +42 -42
- package/hooks/scripts/lib/platforms/codex.js +46 -46
- package/hooks/scripts/lib/platforms/continue.js +41 -41
- package/hooks/scripts/lib/platforms/copilot.js +41 -41
- package/hooks/scripts/lib/platforms/cursor.js +41 -41
- package/hooks/scripts/rule-of-3.js +176 -176
- package/improve-codebase-architecture/SKILL.md +44 -44
- package/install-cognitive-os/SKILL.md +95 -95
- package/package.json +1 -1
- package/repo-docs/SKILL.md +45 -45
- package/rewrite-commits/SKILL.md +32 -32
- package/scripts/installer.js +649 -649
- package/scripts/lib/advisory-text.js +163 -163
- package/scripts/lib/claude-hooks.js +71 -71
- package/scripts/lib/gitignore.js +80 -58
- package/scripts/lib/manifest.js +82 -82
- package/scripts/lib/prompts.js +241 -241
- package/scripts/lib/skills.js +172 -172
- package/scripts/lib/workspace.js +28 -28
- package/security-review/SKILL.md +510 -510
- package/self-evolve/SKILL.md +54 -54
- package/skill-creator/SKILL.md +91 -91
- package/skill-creator/references/testing-workflow.md +32 -32
- package/skill-style/SKILL.md +48 -48
- package/tdd/SKILL.md +53 -53
- package/todo-driven-workflow/SKILL.md +54 -54
- package/using-git-worktrees/SKILL.md +161 -161
- package/verification-loop/SKILL.md +138 -138
- package/verify-before-claim/SKILL.md +86 -86
- package/zoom-out/SKILL.md +90 -90
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Harness Behavioral Test Suite (E2E)
|
|
4
|
-
* Simulates an AI agent attempting both valid and invalid state transitions
|
|
5
|
-
* to mathematically prove the guardrails (Exit Code 1) are enforced.
|
|
6
|
-
*/
|
|
7
|
-
const { execSync } = require('child_process');
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const { getWorkspaceRoot, getStateRoot } = require('../hooks/scripts/lib/harness-state');
|
|
11
|
-
|
|
12
|
-
console.log("=== ๐งช Harness Behavioral Test Suite ===");
|
|
13
|
-
|
|
14
|
-
const todoCli = 'node harness-everything/scripts/todo-cli.js';
|
|
15
|
-
const stateFile = path.join(getStateRoot(getWorkspaceRoot()), 'todo-state.json');
|
|
16
|
-
|
|
17
|
-
function run(cmd, expectFail = false) {
|
|
18
|
-
try {
|
|
19
|
-
const out = execSync(cmd, { stdio: 'pipe', encoding: 'utf8' });
|
|
20
|
-
if (expectFail) {
|
|
21
|
-
console.error(`โ FAILED: Expected command to fail, but it succeeded: ${cmd}`);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
return out;
|
|
25
|
-
} catch (err) {
|
|
26
|
-
if (!expectFail) {
|
|
27
|
-
console.error(`โ FAILED: Unexpected failure: ${cmd}\n${err.stderr || err.message}`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
return err.stderr || err.stdout || err.message;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// 0. Setup: Clean slate - but this suite runs against the REAL
|
|
35
|
-
// .claude/harness-state/ directory of whatever project invokes it (e.g. via self-regression.js on
|
|
36
|
-
// a contributor's machine), so any real in-flight todo-state.json must be
|
|
37
|
-
// preserved, not clobbered. Back it up now and restore it on exit
|
|
38
|
-
// (success, assertion failure, or process.exit alike - 'exit' fires on all
|
|
39
|
-
// of them) instead of deleting real state outright.
|
|
40
|
-
const stateBackup = stateFile + '.selfregression-backup';
|
|
41
|
-
const hadExistingState = fs.existsSync(stateFile);
|
|
42
|
-
if (hadExistingState) fs.copyFileSync(stateFile, stateBackup);
|
|
43
|
-
if (fs.existsSync(stateFile)) fs.unlinkSync(stateFile);
|
|
44
|
-
if (fs.existsSync('.verify-fail.tmp')) fs.unlinkSync('.verify-fail.tmp');
|
|
45
|
-
console.log("๐งน State cleaned.");
|
|
46
|
-
|
|
47
|
-
process.on('exit', () => {
|
|
48
|
-
try {
|
|
49
|
-
if (hadExistingState) {
|
|
50
|
-
fs.copyFileSync(stateBackup, stateFile);
|
|
51
|
-
fs.unlinkSync(stateBackup);
|
|
52
|
-
} else if (fs.existsSync(stateFile)) {
|
|
53
|
-
fs.unlinkSync(stateFile);
|
|
54
|
-
}
|
|
55
|
-
if (fs.existsSync('.verify-fail.tmp')) fs.unlinkSync('.verify-fail.tmp');
|
|
56
|
-
} catch (e) {
|
|
57
|
-
// Best-effort - don't mask the real test outcome with a cleanup error.
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// 1. Initialize
|
|
62
|
-
console.log("\n[Test 1] Agent initializes checklist...");
|
|
63
|
-
run(`${todoCli} init "Setup DB" "Create API"`);
|
|
64
|
-
console.log("โ
Passed: List initialized.");
|
|
65
|
-
|
|
66
|
-
// 2. Premature Completion (Skipping 'start')
|
|
67
|
-
console.log("\n[Test 2] Agent hallucinates completion without starting...");
|
|
68
|
-
const res2 = run(`${todoCli} complete 1`, true);
|
|
69
|
-
if (!res2.includes("NOT currently in-progress")) {
|
|
70
|
-
console.error("โ FAILED: Did not catch premature completion.");
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
console.log("โ
Passed: Blocked premature completion (Exit Code 1).");
|
|
74
|
-
|
|
75
|
-
// 3. Start Task
|
|
76
|
-
console.log("\n[Test 3] Agent starts task 1...");
|
|
77
|
-
run(`${todoCli} start 1`);
|
|
78
|
-
console.log("โ
Passed: Task 1 started.");
|
|
79
|
-
|
|
80
|
-
// 4. Multitasking (Attention Loss)
|
|
81
|
-
console.log("\n[Test 4] Agent loses attention and tries to start Task 2 concurrently...");
|
|
82
|
-
const res4 = run(`${todoCli} start 2`, true);
|
|
83
|
-
if (!res4.includes("already IN-PROGRESS")) {
|
|
84
|
-
console.error("โ FAILED: Did not block multitasking.");
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
console.log("โ
Passed: Blocked multitasking (Exit Code 1).");
|
|
88
|
-
|
|
89
|
-
// 5. Verification Failure (Compliance Theater)
|
|
90
|
-
console.log("\n[Test 5] Agent writes broken code and tries to force complete...");
|
|
91
|
-
fs.writeFileSync('.verify-fail.tmp', 'broken');
|
|
92
|
-
const res5 = run(`${todoCli} complete 1`, true);
|
|
93
|
-
if (!res5.includes("Verification Gate Failed")) {
|
|
94
|
-
console.error("โ FAILED: Verification gate failed to block completion.");
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
console.log("โ
Passed: Gate blocked completion and slapped agent (Exit Code 1).");
|
|
98
|
-
|
|
99
|
-
// 6. Successful Verification and Completion
|
|
100
|
-
console.log("\n[Test 6] Agent fixes code, verification passes, completes task...");
|
|
101
|
-
fs.unlinkSync('.verify-fail.tmp'); // Fix the "bug"
|
|
102
|
-
run(`${todoCli} complete 1`);
|
|
103
|
-
console.log("โ
Passed: Task 1 completed successfully.");
|
|
104
|
-
|
|
105
|
-
console.log("\n๐ ALL BEHAVIORAL TESTS PASSED. Guardrails are mathematically enforced.");
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Harness Behavioral Test Suite (E2E)
|
|
4
|
+
* Simulates an AI agent attempting both valid and invalid state transitions
|
|
5
|
+
* to mathematically prove the guardrails (Exit Code 1) are enforced.
|
|
6
|
+
*/
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { getWorkspaceRoot, getStateRoot } = require('../hooks/scripts/lib/harness-state');
|
|
11
|
+
|
|
12
|
+
console.log("=== ๐งช Harness Behavioral Test Suite ===");
|
|
13
|
+
|
|
14
|
+
const todoCli = 'node harness-everything/scripts/todo-cli.js';
|
|
15
|
+
const stateFile = path.join(getStateRoot(getWorkspaceRoot()), 'todo-state.json');
|
|
16
|
+
|
|
17
|
+
function run(cmd, expectFail = false) {
|
|
18
|
+
try {
|
|
19
|
+
const out = execSync(cmd, { stdio: 'pipe', encoding: 'utf8' });
|
|
20
|
+
if (expectFail) {
|
|
21
|
+
console.error(`โ FAILED: Expected command to fail, but it succeeded: ${cmd}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (!expectFail) {
|
|
27
|
+
console.error(`โ FAILED: Unexpected failure: ${cmd}\n${err.stderr || err.message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
return err.stderr || err.stdout || err.message;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 0. Setup: Clean slate - but this suite runs against the REAL
|
|
35
|
+
// .claude/harness-state/ directory of whatever project invokes it (e.g. via self-regression.js on
|
|
36
|
+
// a contributor's machine), so any real in-flight todo-state.json must be
|
|
37
|
+
// preserved, not clobbered. Back it up now and restore it on exit
|
|
38
|
+
// (success, assertion failure, or process.exit alike - 'exit' fires on all
|
|
39
|
+
// of them) instead of deleting real state outright.
|
|
40
|
+
const stateBackup = stateFile + '.selfregression-backup';
|
|
41
|
+
const hadExistingState = fs.existsSync(stateFile);
|
|
42
|
+
if (hadExistingState) fs.copyFileSync(stateFile, stateBackup);
|
|
43
|
+
if (fs.existsSync(stateFile)) fs.unlinkSync(stateFile);
|
|
44
|
+
if (fs.existsSync('.verify-fail.tmp')) fs.unlinkSync('.verify-fail.tmp');
|
|
45
|
+
console.log("๐งน State cleaned.");
|
|
46
|
+
|
|
47
|
+
process.on('exit', () => {
|
|
48
|
+
try {
|
|
49
|
+
if (hadExistingState) {
|
|
50
|
+
fs.copyFileSync(stateBackup, stateFile);
|
|
51
|
+
fs.unlinkSync(stateBackup);
|
|
52
|
+
} else if (fs.existsSync(stateFile)) {
|
|
53
|
+
fs.unlinkSync(stateFile);
|
|
54
|
+
}
|
|
55
|
+
if (fs.existsSync('.verify-fail.tmp')) fs.unlinkSync('.verify-fail.tmp');
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// Best-effort - don't mask the real test outcome with a cleanup error.
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// 1. Initialize
|
|
62
|
+
console.log("\n[Test 1] Agent initializes checklist...");
|
|
63
|
+
run(`${todoCli} init "Setup DB" "Create API"`);
|
|
64
|
+
console.log("โ
Passed: List initialized.");
|
|
65
|
+
|
|
66
|
+
// 2. Premature Completion (Skipping 'start')
|
|
67
|
+
console.log("\n[Test 2] Agent hallucinates completion without starting...");
|
|
68
|
+
const res2 = run(`${todoCli} complete 1`, true);
|
|
69
|
+
if (!res2.includes("NOT currently in-progress")) {
|
|
70
|
+
console.error("โ FAILED: Did not catch premature completion.");
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
console.log("โ
Passed: Blocked premature completion (Exit Code 1).");
|
|
74
|
+
|
|
75
|
+
// 3. Start Task
|
|
76
|
+
console.log("\n[Test 3] Agent starts task 1...");
|
|
77
|
+
run(`${todoCli} start 1`);
|
|
78
|
+
console.log("โ
Passed: Task 1 started.");
|
|
79
|
+
|
|
80
|
+
// 4. Multitasking (Attention Loss)
|
|
81
|
+
console.log("\n[Test 4] Agent loses attention and tries to start Task 2 concurrently...");
|
|
82
|
+
const res4 = run(`${todoCli} start 2`, true);
|
|
83
|
+
if (!res4.includes("already IN-PROGRESS")) {
|
|
84
|
+
console.error("โ FAILED: Did not block multitasking.");
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
console.log("โ
Passed: Blocked multitasking (Exit Code 1).");
|
|
88
|
+
|
|
89
|
+
// 5. Verification Failure (Compliance Theater)
|
|
90
|
+
console.log("\n[Test 5] Agent writes broken code and tries to force complete...");
|
|
91
|
+
fs.writeFileSync('.verify-fail.tmp', 'broken');
|
|
92
|
+
const res5 = run(`${todoCli} complete 1`, true);
|
|
93
|
+
if (!res5.includes("Verification Gate Failed")) {
|
|
94
|
+
console.error("โ FAILED: Verification gate failed to block completion.");
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
console.log("โ
Passed: Gate blocked completion and slapped agent (Exit Code 1).");
|
|
98
|
+
|
|
99
|
+
// 6. Successful Verification and Completion
|
|
100
|
+
console.log("\n[Test 6] Agent fixes code, verification passes, completes task...");
|
|
101
|
+
fs.unlinkSync('.verify-fail.tmp'); // Fix the "bug"
|
|
102
|
+
run(`${todoCli} complete 1`);
|
|
103
|
+
console.log("โ
Passed: Task 1 completed successfully.");
|
|
104
|
+
|
|
105
|
+
console.log("\n๐ ALL BEHAVIORAL TESTS PASSED. Guardrails are mathematically enforced.");
|