harness-everything 0.2.1 โ†’ 0.2.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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/build-multi-agent-system/SKILL.md +68 -68
  3. package/create-agent-launcher/SKILL.md +48 -48
  4. package/docs/architecture.md +2 -2
  5. package/docs/workflows/build-multi-agent-system.md +62 -62
  6. package/docs/workflows/create-agent-launcher.md +62 -62
  7. package/docs/workflows/environment-detection.md +63 -63
  8. package/docs/workflows/eval-harness.md +57 -57
  9. package/docs/workflows/fable-discipline.md +59 -59
  10. package/docs/workflows/fable-mode.md +32 -32
  11. package/docs/workflows/git-commit.md +62 -62
  12. package/docs/workflows/grill-me.md +62 -62
  13. package/docs/workflows/grill-with-docs.md +62 -62
  14. package/docs/workflows/improve-codebase-architecture.md +60 -60
  15. package/docs/workflows/repo-docs.md +59 -59
  16. package/docs/workflows/rewrite-commits.md +60 -60
  17. package/docs/workflows/security-review.md +58 -58
  18. package/docs/workflows/self-evolve.md +59 -59
  19. package/docs/workflows/tdd.md +39 -39
  20. package/docs/workflows/todo-driven-workflow.md +36 -36
  21. package/docs/workflows/using-git-worktrees.md +63 -63
  22. package/docs/workflows/verification-loop.md +69 -69
  23. package/docs/workflows/verify-before-claim.md +60 -60
  24. package/docs/workflows/zoom-out.md +62 -62
  25. package/environment-detection/SKILL.md +77 -77
  26. package/eval-framework/behavioral-test.js +105 -105
  27. package/eval-framework/mechanism-test.js +251 -251
  28. package/eval-harness/SKILL.md +59 -59
  29. package/fable-discipline/SKILL.md +38 -38
  30. package/fable-mode/SKILL.md +51 -51
  31. package/git-commit/SKILL.md +55 -55
  32. package/grill-me/SKILL.md +36 -36
  33. package/grill-with-docs/SKILL.md +99 -99
  34. package/harness-everything/SKILL.md +141 -141
  35. package/harness-everything/examples/README.md +9 -9
  36. package/harness-everything/examples/todo-workflow.md +22 -22
  37. package/harness-everything/scripts/todo-cli.js +157 -157
  38. package/harness-everything/scripts/verify-gate.js +31 -31
  39. package/hooks/scripts/atomic-commit-check.js +68 -68
  40. package/hooks/scripts/context-compact.js +114 -114
  41. package/hooks/scripts/lib/platforms/claude.js +132 -42
  42. package/hooks/scripts/lib/platforms/codex.js +96 -46
  43. package/hooks/scripts/lib/platforms/continue.js +73 -41
  44. package/hooks/scripts/lib/platforms/copilot.js +91 -41
  45. package/hooks/scripts/lib/platforms/cursor.js +71 -41
  46. package/hooks/scripts/lib/platforms/hermes.js +25 -0
  47. package/hooks/scripts/rule-of-3.js +176 -176
  48. package/improve-codebase-architecture/SKILL.md +44 -44
  49. package/install-cognitive-os/SKILL.md +95 -95
  50. package/package.json +1 -1
  51. package/repo-docs/SKILL.md +45 -45
  52. package/rewrite-commits/SKILL.md +32 -32
  53. package/scripts/installer.js +57 -200
  54. package/scripts/lib/advisory-text.js +163 -163
  55. package/scripts/lib/claude-hooks.js +71 -71
  56. package/scripts/lib/manifest.js +82 -82
  57. package/scripts/lib/prompts.js +241 -241
  58. package/scripts/lib/skills.js +174 -172
  59. package/scripts/lib/workspace.js +28 -28
  60. package/security-review/SKILL.md +510 -510
  61. package/self-evolve/SKILL.md +54 -54
  62. package/skill-creator/SKILL.md +91 -91
  63. package/skill-creator/references/testing-workflow.md +32 -32
  64. package/skill-style/SKILL.md +48 -48
  65. package/tdd/SKILL.md +53 -53
  66. package/todo-driven-workflow/SKILL.md +54 -54
  67. package/using-git-worktrees/SKILL.md +161 -161
  68. package/verification-loop/SKILL.md +138 -138
  69. package/verify-before-claim/SKILL.md +86 -86
  70. 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.");