harness-everything 0.2.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/AGENTS.md +2 -0
- package/BENCHMARK_SOP.md +62 -0
- package/CHANGELOG.md +107 -0
- package/Dockerfile +18 -0
- package/LICENSE +201 -0
- package/README.md +197 -0
- package/VERIFICATION.md +347 -0
- package/bin/cli.js +97 -0
- package/build-multi-agent-system/AGENTS.md +50 -0
- package/build-multi-agent-system/README.md +63 -0
- package/build-multi-agent-system/SKILL.md +68 -0
- package/create-agent-launcher/SKILL.md +48 -0
- package/create-agent-launcher/examples/csharp-monorepo.md +123 -0
- package/create-agent-launcher/examples/typescript-cli.md +126 -0
- package/create-agent-launcher/guidelines/platform-claude.md +77 -0
- package/create-agent-launcher/guidelines/platform-codex.md +146 -0
- package/create-agent-launcher/guidelines/platform-copilot.md +74 -0
- package/create-agent-launcher/guidelines/platform-gemini.md +101 -0
- package/create-agent-launcher/guidelines/role-capabilities.md +108 -0
- package/create-agent-launcher/templates/README.md +17 -0
- package/create-agent-launcher/templates/agent-launcher.md +68 -0
- package/create-agent-launcher/templates/backend-developer-csharp.md +56 -0
- package/create-agent-launcher/templates/backend-developer-polyglot.md +62 -0
- package/create-agent-launcher/templates/backend-developer-ts.md +57 -0
- package/create-agent-launcher/templates/memory-keeper.md +37 -0
- package/create-agent-launcher/templates/requirement-analyzer.md +66 -0
- package/create-agent-launcher/templates/specialist-agent.md +34 -0
- package/create-agent-launcher/templates/task-verifier.md +56 -0
- package/create-agent-launcher/templates/tool-maker.md +33 -0
- package/create-agent-launcher/workflows/01-init.md +22 -0
- package/create-agent-launcher/workflows/02-analysis.md +26 -0
- package/create-agent-launcher/workflows/03-generation.md +29 -0
- package/create-agent-launcher/workflows/04-launcher.md +20 -0
- package/docker-verify.sh +266 -0
- package/docs/architecture.md +95 -0
- package/docs/philosophy.md +45 -0
- package/docs/reflection.md +34 -0
- package/docs/routing.md +45 -0
- package/docs/workflows/build-multi-agent-system.md +62 -0
- package/docs/workflows/create-agent-launcher.md +62 -0
- package/docs/workflows/environment-detection.md +63 -0
- package/docs/workflows/eval-harness.md +57 -0
- package/docs/workflows/fable-discipline.md +59 -0
- package/docs/workflows/fable-mode.md +32 -0
- package/docs/workflows/git-commit.md +62 -0
- package/docs/workflows/grill-me.md +62 -0
- package/docs/workflows/grill-with-docs.md +62 -0
- package/docs/workflows/harness-everything.md +92 -0
- package/docs/workflows/improve-codebase-architecture.md +60 -0
- package/docs/workflows/install-cognitive-os.md +60 -0
- package/docs/workflows/repo-docs.md +59 -0
- package/docs/workflows/rewrite-commits.md +60 -0
- package/docs/workflows/security-review.md +58 -0
- package/docs/workflows/self-evolve.md +59 -0
- package/docs/workflows/skill-creator.md +75 -0
- package/docs/workflows/skill-style.md +64 -0
- package/docs/workflows/tdd.md +39 -0
- package/docs/workflows/todo-driven-workflow.md +36 -0
- package/docs/workflows/using-git-worktrees.md +63 -0
- package/docs/workflows/verification-loop.md +69 -0
- package/docs/workflows/verify-before-claim.md +60 -0
- package/docs/workflows/zoom-out.md +62 -0
- package/environment-detection/SKILL.md +77 -0
- package/environment-detection/scripts/preflight.js +93 -0
- package/eval-framework/behavioral-test.js +105 -0
- package/eval-framework/cases/case1.json +5 -0
- package/eval-framework/cases/case2.json +5 -0
- package/eval-framework/cases/case3.json +5 -0
- package/eval-framework/cases/case4-zh-tier2.json +5 -0
- package/eval-framework/cases/case5-zh-tier3.json +5 -0
- package/eval-framework/mechanism-test.js +251 -0
- package/eval-framework/runner.js +56 -0
- package/eval-harness/SKILL.md +59 -0
- package/eval-harness/scripts/evaluate.js +61 -0
- package/fable-discipline/SKILL.md +38 -0
- package/fable-mode/CONTRACT-FORMAT.md +51 -0
- package/fable-mode/SKILL.md +51 -0
- package/fable-mode/agents/fable-orchestrator.md +92 -0
- package/fable-mode/agents/fable-verifier.md +32 -0
- package/fable-mode/agents/fable-worker-haiku.md +48 -0
- package/fable-mode/agents/fable-worker-sonnet.md +49 -0
- package/fable-mode/execution-guardrails/SKILL.md +87 -0
- package/fable-mode/fable-haiku/SKILL.md +48 -0
- package/git-commit/SKILL.md +55 -0
- package/git-commit/guides/ANGULAR_STYLE.md +61 -0
- package/git-commit/guides/COMMIT_GENERATION.md +24 -0
- package/git-commit/guides/LANGUAGE_DETECTION.md +16 -0
- package/git-commit/guides/MAIN_REPO.md +15 -0
- package/git-commit/guides/SUBMODULES.md +27 -0
- package/grill-me/SKILL.md +36 -0
- package/grill-with-docs/ADR-FORMAT.md +47 -0
- package/grill-with-docs/CONTEXT-FORMAT.md +63 -0
- package/grill-with-docs/SKILL.md +99 -0
- package/harness-everything/SKILL.md +141 -0
- package/harness-everything/examples/README.md +9 -0
- package/harness-everything/examples/todo-workflow.md +22 -0
- package/harness-everything/scripts/bootstrap.js +140 -0
- package/harness-everything/scripts/self-heal.js +189 -0
- package/harness-everything/scripts/tier-router.js +219 -0
- package/harness-everything/scripts/todo-cli.js +157 -0
- package/harness-everything/scripts/verify-gate.js +31 -0
- package/hooks/hooks.json +155 -0
- package/hooks/scripts/atomic-commit-check.js +68 -0
- package/hooks/scripts/boundary-guard.js +55 -0
- package/hooks/scripts/context-compact.js +114 -0
- package/hooks/scripts/contract-test.js +79 -0
- package/hooks/scripts/depth-guard.js +65 -0
- package/hooks/scripts/lib/harness-state.js +202 -0
- package/hooks/scripts/lib/platforms/claude.js +42 -0
- package/hooks/scripts/lib/platforms/codex.js +46 -0
- package/hooks/scripts/lib/platforms/continue.js +41 -0
- package/hooks/scripts/lib/platforms/copilot.js +41 -0
- package/hooks/scripts/lib/platforms/cursor.js +41 -0
- package/hooks/scripts/lib/platforms/hermes.js +32 -0
- package/hooks/scripts/lib/platforms/index.js +17 -0
- package/hooks/scripts/lib/platforms/worktrees.js +20 -0
- package/hooks/scripts/reset-circuit-breaker.js +30 -0
- package/hooks/scripts/rule-of-3-tracker.js +91 -0
- package/hooks/scripts/rule-of-3.js +176 -0
- package/hooks/scripts/state-persist.js +99 -0
- package/hooks/scripts/stop-gate.js +80 -0
- package/hooks/scripts/subagent-scope-guard.js +88 -0
- package/improve-codebase-architecture/SKILL.md +44 -0
- package/improve-codebase-architecture/guides/DEEPENING.md +37 -0
- package/improve-codebase-architecture/guides/HTML-REPORT.md +123 -0
- package/improve-codebase-architecture/guides/INTERFACE-DESIGN.md +44 -0
- package/improve-codebase-architecture/guides/LANGUAGE.md +53 -0
- package/install-cognitive-os/SKILL.md +95 -0
- package/package.json +22 -0
- package/repo-docs/SKILL.md +45 -0
- package/repo-docs/templates/agents-template.md +264 -0
- package/repo-docs/templates/knowledge-agents-template.md +50 -0
- package/repo-docs/templates/knowledge-readme-template.md +83 -0
- package/repo-docs/templates/manual-recon.md +117 -0
- package/repo-docs/templates/multi-skills-readme-template.md +72 -0
- package/repo-docs/templates/product-agents-template.md +78 -0
- package/repo-docs/templates/product-readme-template.md +95 -0
- package/repo-docs/templates/readme-template.md +136 -0
- package/repo-docs/templates/single-skill-readme-template.md +70 -0
- package/repo-docs/templates/skills-agents-template.md +60 -0
- package/rewrite-commits/SKILL.md +32 -0
- package/scripts/installer.js +649 -0
- package/scripts/lib/advisory-text.js +163 -0
- package/scripts/lib/claude-hooks.js +71 -0
- package/scripts/lib/gitignore.js +58 -0
- package/scripts/lib/manifest.js +82 -0
- package/scripts/lib/prompts.js +241 -0
- package/scripts/lib/skills.js +172 -0
- package/scripts/lib/workspace.js +28 -0
- package/security-review/SKILL.md +511 -0
- package/self-evolve/SKILL.md +54 -0
- package/self-evolve/scripts/persist-memory.js +40 -0
- package/self-evolve/scripts/self-regression.js +113 -0
- package/skill-creator/SKILL.md +91 -0
- package/skill-creator/references/quality-principles.md +81 -0
- package/skill-creator/references/testing-workflow.md +32 -0
- package/skill-style/SKILL.md +48 -0
- package/skill-style/STYLE.md +37 -0
- package/tdd/SKILL.md +53 -0
- package/tdd/guides/deep-modules.md +33 -0
- package/tdd/guides/interface-design.md +31 -0
- package/tdd/guides/mocking.md +59 -0
- package/tdd/guides/refactoring.md +10 -0
- package/tdd/guides/tests.md +61 -0
- package/todo-driven-workflow/SKILL.md +54 -0
- package/using-git-worktrees/SKILL.md +161 -0
- package/verification-loop/SKILL.md +138 -0
- package/verify-before-claim/SKILL.md +86 -0
- package/zoom-out/SKILL.md +90 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Workflow: Todo-Driven Workflow
|
|
2
|
+
|
|
3
|
+
> The fundamental execution loop. Driven entirely by terminal state machines (`todo-cli.js`).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Skill Behavior Workflow
|
|
8
|
+
|
|
9
|
+
This section visualizes the rigid state constraints. Transitioning state is blocked unless verification gates pass.
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
Start([Initialize Checklist]) --> Plan["Define 3-7 Verifiable Sub-tasks"]
|
|
14
|
+
Plan --> SaveTodo["Try: node todo-cli.js init ..."]
|
|
15
|
+
|
|
16
|
+
SaveTodo --> ChooseTask["Choose ONE pending task"]
|
|
17
|
+
ChooseTask --> MarkInProgress["Try: node todo-cli.js start <id>"]
|
|
18
|
+
|
|
19
|
+
MarkInProgress --> CheckStart{Gate: Exit Code?}
|
|
20
|
+
CheckStart -->|Exit 1: Multitasking Blocked| ReflectStart["Reflect: Must complete previous task first"]
|
|
21
|
+
ReflectStart --> Execute
|
|
22
|
+
|
|
23
|
+
CheckStart -->|Exit 0| Execute["Execute code changes"]
|
|
24
|
+
|
|
25
|
+
Execute --> GatherEvidence["Try: node verify-gate.js"]
|
|
26
|
+
GatherEvidence --> VerifySuccess{Gate: Exit Code?}
|
|
27
|
+
|
|
28
|
+
VerifySuccess -->|Exit 1: Code is broken| ReflectCode["Reflect: Read Error Log & Fix"]
|
|
29
|
+
ReflectCode --> Execute
|
|
30
|
+
|
|
31
|
+
VerifySuccess -->|Exit 0: Code works| MarkCompleted["Try: node todo-cli.js complete <id>"]
|
|
32
|
+
|
|
33
|
+
MarkCompleted --> CheckRemaining{All tasks completed?}
|
|
34
|
+
CheckRemaining -->|No| ChooseTask
|
|
35
|
+
CheckRemaining -->|Yes| Finish([Signal Task Completion])
|
|
36
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Workflow: Using Git Worktrees
|
|
2
|
+
|
|
3
|
+
> Manages isolated workspace environments in parallel using native Git Worktrees, enabling developers to switch contexts safely without stashing or losing unsaved progress.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Skill Behavior Workflow
|
|
8
|
+
|
|
9
|
+
This section visualizes how the `using-git-worktrees` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
Start([Switch Context Needed]) --> CheckClean["Assess if main branch has uncommitted changes"]
|
|
14
|
+
CheckClean --> CreateWorktree["Run git worktree add to a sibling directory"]
|
|
15
|
+
CreateWorktree --> CheckoutTarget["Checkout target branch or create a hotfix branch"]
|
|
16
|
+
CheckoutTarget --> OpenWorkspace["Open the sibling directory as a separate isolated workspace"]
|
|
17
|
+
OpenWorkspace --> RunDev["Perform isolated edits, tests, and debugging"]
|
|
18
|
+
RunDev --> CommitIsolated["Commit changes in the isolated workspace"]
|
|
19
|
+
CommitIsolated --> RemoveWorktree["Prune and clean up the worktree path"]
|
|
20
|
+
RemoveWorktree --> Return([Return to original workspace with pristine unsaved state intact])
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Triggering and Routing Path
|
|
26
|
+
|
|
27
|
+
This diagram illustrates how the `using-git-worktrees` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
|
|
28
|
+
|
|
29
|
+
```mermaid
|
|
30
|
+
graph LR
|
|
31
|
+
Router["harness-everything / tier-router.js"] -->|Keyword: worktree / isolate / checkout| WT["using-git-worktrees / SKILL.md"]
|
|
32
|
+
WT -->|Maintains isolation before running tests in| TDDSkill["tdd / SKILL.md"]
|
|
33
|
+
WT -->|Protects terminal environment testing in| EnvSkill["environment-detection / SKILL.md"]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 3. Real-World Use Case Flowchart
|
|
39
|
+
|
|
40
|
+
Here we model concrete real-world scenarios and use cases of the `using-git-worktrees` skill, illustrating standard success paths, error handling, or recovery loops.
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
graph TD
|
|
44
|
+
Start["Working on deep feature 'feat-billing' (unstaged edits)"] --> Interrupt["Urgent production hotfix required!"]
|
|
45
|
+
Interrupt --> Trigger["using-git-worktrees skill invoked"]
|
|
46
|
+
Trigger --> CreateWT["Add worktree: 'git worktree add ../hotfix-auth hotfix-branch'"]
|
|
47
|
+
CreateWT --> OpenWT["Open separate workspace editor in ../hotfix-auth"]
|
|
48
|
+
OpenWT --> FixBug["Fix auth bug & run verification test"]
|
|
49
|
+
FixBug --> CommitWT["Commit fix and push branch"]
|
|
50
|
+
CommitWT --> CloseWT["Close editor, run 'git worktree prune'"]
|
|
51
|
+
CloseWT --> Resume["Return to original billing workspace with all unsaved files exactly where they were"]
|
|
52
|
+
Resume --> Done([Context switched safely with zero stashing friction])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 4. Verification Check
|
|
58
|
+
|
|
59
|
+
To ensure that the `using-git-worktrees` skill is operating in strict compliance with Harness OS design laws, verify the following:
|
|
60
|
+
|
|
61
|
+
- [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
|
|
62
|
+
- [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
|
|
63
|
+
- [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Workflow: Verification Loop
|
|
2
|
+
|
|
3
|
+
> Comprehensive pre-PR quality gate executing builds, linting, type-checking, test suites, and security scans before claiming a task complete.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Skill Behavior Workflow
|
|
8
|
+
|
|
9
|
+
This section visualizes how the `verification-loop` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
Start([Pre-PR Quality Check Triggered]) --> RunBuild["Execute compilation / project build"]
|
|
14
|
+
RunBuild --> CheckBuild{Build succeeded?}
|
|
15
|
+
CheckBuild -->|No| FixBuild["Debug and fix build errors"]
|
|
16
|
+
CheckBuild -->|Yes| RunTypeCheck["Execute language type-checking compiler"]
|
|
17
|
+
RunTypeCheck --> CheckTypes{Typecheck green?}
|
|
18
|
+
CheckTypes -->|No| FixTypes["Correct type-definition errors"]
|
|
19
|
+
CheckTypes -->|Yes| RunLint["Execute code linter checks"]
|
|
20
|
+
RunLint --> CheckLint{Lint clean?}
|
|
21
|
+
CheckLint -->|No| FixLint["Correct code-style and syntax errors"]
|
|
22
|
+
CheckLint -->|Yes| RunTests["Execute complete automated test suite"]
|
|
23
|
+
RunTests --> CheckTests{Tests passed?}
|
|
24
|
+
CheckTests -->|No| FixTests["Debug and correct failing tests"]
|
|
25
|
+
CheckTests -->|Yes| End([Pre-PR verification gate cleared successfully])
|
|
26
|
+
FixBuild & FixTypes & FixLint & FixTests --> RunBuild
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 2. Triggering and Routing Path
|
|
32
|
+
|
|
33
|
+
This diagram illustrates how the `verification-loop` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
|
|
34
|
+
|
|
35
|
+
```mermaid
|
|
36
|
+
graph LR
|
|
37
|
+
Router["harness-everything / tier-router.js"] -->|Pre-PR checks / gate| VerLoop["verification-loop / SKILL.md"]
|
|
38
|
+
VerLoop -->|Guards finalize step in| Todo["todo-driven-workflow / SKILL.md"]
|
|
39
|
+
VerLoop -->|Requires test environment setup from| Env["environment-detection / SKILL.md"]
|
|
40
|
+
VerLoop -->|Precedes safe commit push in| GitCommit["git-commit / SKILL.md"]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 3. Real-World Use Case Flowchart
|
|
46
|
+
|
|
47
|
+
Here we model concrete real-world scenarios and use cases of the `verification-loop` skill, illustrating standard success paths, error handling, or recovery loops.
|
|
48
|
+
|
|
49
|
+
```mermaid
|
|
50
|
+
graph TD
|
|
51
|
+
Start["Feature code written; ready to claim task complete"] --> Trigger["verification-loop skill runs"]
|
|
52
|
+
Trigger --> Build["Run 'npm run build' -> Succeeded"]
|
|
53
|
+
Build --> Type["Run 'npm run typecheck' -> Found 2 type mismatches in routes.ts"]
|
|
54
|
+
Type --> FixT["Fix incorrect type casting in routes.ts"]
|
|
55
|
+
FixT --> Recheck["Re-run typecheck -> Succeeded"]
|
|
56
|
+
Recheck --> Lint["Run 'npm run lint' -> Clean"]
|
|
57
|
+
Lint --> Tests["Run 'npm run test' -> 24 tests passed"]
|
|
58
|
+
Tests --> Done([Verification loop complete; safe to open PR])
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 4. Verification Check
|
|
64
|
+
|
|
65
|
+
To ensure that the `verification-loop` skill is operating in strict compliance with Harness OS design laws, verify the following:
|
|
66
|
+
|
|
67
|
+
- [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
|
|
68
|
+
- [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
|
|
69
|
+
- [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Workflow: Verify Before Claim
|
|
2
|
+
|
|
3
|
+
> Fact-audit discipline requiring empirical verification of external claims, SDK configurations, defaults, and unmeasured performance estimates.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Skill Behavior Workflow
|
|
8
|
+
|
|
9
|
+
This section visualizes how the `verify-before-claim` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
Start([Claim or Estimate Proposed]) --> IdentifyAssumptions["Isolate any claim or performance assumption"]
|
|
14
|
+
IdentifyAssumptions --> QueryAuthoritative["Execute WebSearch or read local code sources"]
|
|
15
|
+
QueryAuthoritative --> CrossVerify["Cross-verify details with authoritative documentation"]
|
|
16
|
+
CrossVerify --> RunLocalExperiment["Run quick script to empirically test the assumption"]
|
|
17
|
+
RunLocalExperiment --> CaptureResult["Log actual measured results and exit-codes"]
|
|
18
|
+
CaptureResult --> AssertFact["Assert verified fact based on objective data"]
|
|
19
|
+
AssertFact --> End([Hypothesis replaced with empirical truth])
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Triggering and Routing Path
|
|
25
|
+
|
|
26
|
+
This diagram illustrates how the `verify-before-claim` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
graph LR
|
|
30
|
+
Router["harness-everything / tier-router.js"] -->|Requires fact checking or estimates| VBC["verify-before-claim / SKILL.md"]
|
|
31
|
+
VBC -->|Empirical verification helper| RunCode["mcp_provides_tool_pylanceRunCodeSnippet / run_in_terminal"]
|
|
32
|
+
VBC -->|Secures quality of decisions in| GWD["grill-with-docs / SKILL.md"]
|
|
33
|
+
VBC -->|Verifies assertions in testing suite| TDD["tdd / SKILL.md"]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 3. Real-World Use Case Flowchart
|
|
39
|
+
|
|
40
|
+
Here we model concrete real-world scenarios and use cases of the `verify-before-claim` skill, illustrating standard success paths, error handling, or recovery loops.
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
graph TD
|
|
44
|
+
Start["Developer assumes: 'Node.js fs.rmSync returns boolean upon success'"] --> Trigger["verify-before-claim skill triggered"]
|
|
45
|
+
Trigger --> ReadDocs["Checks Node.js documentation via WebSearch"]
|
|
46
|
+
ReadDocs --> FindTrue["Discovers fs.rmSync returns 'undefined' on success, and throws on failure"]
|
|
47
|
+
FindTrue --> TestCode["Executes quick Node snippet to confirm empirical behavior"]
|
|
48
|
+
TestCode --> UpdateCode["Refactors proposed catch-blocks to handle exceptions instead of checking booleans"]
|
|
49
|
+
UpdateCode --> Done([Potential production runtime crash prevented])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 4. Verification Check
|
|
55
|
+
|
|
56
|
+
To ensure that the `verify-before-claim` skill is operating in strict compliance with Harness OS design laws, verify the following:
|
|
57
|
+
|
|
58
|
+
- [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
|
|
59
|
+
- [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
|
|
60
|
+
- [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Workflow: Zoom Out
|
|
2
|
+
|
|
3
|
+
> High-level reflection report generation to break out of error loops, analyze failure patterns, and backtrack to alternative paths.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Skill Behavior Workflow
|
|
8
|
+
|
|
9
|
+
This section visualizes how the `zoom-out` skill executes internally, detailing the sequence of operations, state transitions, and evaluation steps.
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
Start([3 Consecutive Errors Triggered]) --> Tripped{Rule of 3 Tripped?}
|
|
14
|
+
Tripped -->|No| Backtrack["Review code change and retry"]
|
|
15
|
+
Tripped -->|Yes| LockWork["Lock all file edit capabilities"]
|
|
16
|
+
LockWork --> GatherState["Analyze current working directory, file states, and errors"]
|
|
17
|
+
GatherState --> GenReport["Compile formal Reflection Report: what failed, assumptions, backtracking options"]
|
|
18
|
+
GenReport --> PresentReport["Present report to human partner and request guidance"]
|
|
19
|
+
PresentReport --> End([Workforce unlocked after human direction received])
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Triggering and Routing Path
|
|
25
|
+
|
|
26
|
+
This diagram illustrates how the `zoom-out` skill is triggered through user requests or developer actions, and how it integrates or chains together with other companion skills in the Harness OS ecosystem to form unified workflows.
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
graph LR
|
|
30
|
+
RuleOf3["Rule of 3 Circuit Breaker"] -->|Tripped!| ZoomOut["zoom-out / SKILL.md"]
|
|
31
|
+
ZoomOut -->|Halts execution for| ActiveWork["Active workspace edits"]
|
|
32
|
+
ZoomOut -->|Asks for human direction via| AskQuestions["vscode_askQuestions"]
|
|
33
|
+
ZoomOut -->|Unlocks workspace state after| HumanReset["Human Partner Response"]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 3. Real-World Use Case Flowchart
|
|
39
|
+
|
|
40
|
+
Here we model concrete real-world scenarios and use cases of the `zoom-out` skill, illustrating standard success paths, error handling, or recovery loops.
|
|
41
|
+
|
|
42
|
+
```mermaid
|
|
43
|
+
graph TD
|
|
44
|
+
Start["Attempting to fix Python import error; fails 3 times consecutively with same trace"] --> Trigger["Rule of 3 circuit breaker trips"]
|
|
45
|
+
Trigger --> Lock["Workspace writes locked"]
|
|
46
|
+
Trigger --> Collect["Collect error traces and diff history"]
|
|
47
|
+
Collect --> WriteReport["Create docs/reflection/zoom-out-report.md detailing the import cyclic dependency"]
|
|
48
|
+
WriteReport --> Present["Present options to human: Option A - Merge imports, Option B - Extract shared modules"]
|
|
49
|
+
Present --> UserChoice["User select: 'Option B'"]
|
|
50
|
+
UserChoice --> Unlock["Unlock workspace and execute Option B"]
|
|
51
|
+
Unlock --> Done([Error loop successfully broken and resolved])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. Verification Check
|
|
57
|
+
|
|
58
|
+
To ensure that the `zoom-out` skill is operating in strict compliance with Harness OS design laws, verify the following:
|
|
59
|
+
|
|
60
|
+
- [ ] **Physical Boundary Verification**: The skill boundaries are respected and do not leak context.
|
|
61
|
+
- [ ] **State Checkpoint Verification**: The active state is established, validated, and recorded at the beginning and end of each execution branch.
|
|
62
|
+
- [ ] **Cognitive Alignment**: The skill conforms to the **Think > Try > Summarize > Record** cognitive loop.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: environment-detection
|
|
3
|
+
description: Use at the very beginning of the session (Discover phase) to automatically detect and align with the operating system, terminal shell (e.g. Git Bash vs PowerShell vs Command Prompt), package managers, and development tools. Prevents blind command execution and repetitive tool-related errors.
|
|
4
|
+
author: Miya Daniel | Harness Core Team
|
|
5
|
+
version: 0.2.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Environment Detection & Shell Alignment
|
|
9
|
+
|
|
10
|
+
## 📋 Skill Contract
|
|
11
|
+
|
|
12
|
+
| Component | Specification |
|
|
13
|
+
| :--- | :--- |
|
|
14
|
+
| **Trigger / Input** | Session Start (Discover Phase), or before executing a complex terminal command sequence. |
|
|
15
|
+
| **Expected Output** | Terminal execution of `node <this-skill-dir>/scripts/preflight.js`. Output of the detected OS and Shell. |
|
|
16
|
+
| **State Mutations** | Context is updated with the correct path separator (`/` vs `\`) and environment variable syntax (`$VAR` vs `%VAR%`). |
|
|
17
|
+
| **Enforcement Gate** | You MUST read the terminal output of `preflight.js`. If you use the wrong syntax (e.g. `%VAR%` in bash), the terminal will naturally Exit 1 and block your progress. |
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
- **MUST** operate using the cognitive loop: Think > Try > Summarize > Record.
|
|
21
|
+
- **[Think]**: Before running any terminal commands, check your environment. Blind execution is the primary source of agent step waste.
|
|
22
|
+
- **[Try]**: Run the automated preflight check script to determine exact platform properties.
|
|
23
|
+
- **[Summarize]**: Output the detected terminal, OS, and toolchains so the session context retains these bounds.
|
|
24
|
+
- **[Record]**: Adopt the corresponding command syntax rules for the rest of the conversation.
|
|
25
|
+
|
|
26
|
+
## Strict Workspace Boundary (僅偵測與操作當前工作區)
|
|
27
|
+
- **Current Workspace Only**: 必須僅偵測與操作當前活動工作區目錄(即當前專案根目錄,亦為 `process.cwd()`)。
|
|
28
|
+
- **Ignore Other Workspaces**: 即使 VS Code 內容或歷史記錄中暴露了其他工作區、暫存路徑或最近開啟的專案(例如 `d:\super.h2o.sbom`、`d:\DeveloperDocs`、`c:\Users\DanielCH.Chang\Desktop\XinputDxe_V0.0.5` 等),你也 **必須完全忽略它們**。絕對不要對這些非當前專案之路徑進行結構分析、工具檢查,更不能在其中執行任何終端機指令。
|
|
29
|
+
- **Single-Workspace Execution**: 所有終端機指令、工具可用性檢查、路徑解析均必須嚴格限制在當前專案根目錄內。嚴格禁止跨越邊界操作鄰近或無關的資料夾。
|
|
30
|
+
|
|
31
|
+
## [State Checkpoint]
|
|
32
|
+
- Verify your environment details *before* executing commands or writing files.
|
|
33
|
+
- If you just started a session, run the preflight script immediately.
|
|
34
|
+
|
|
35
|
+
## [Discovery Phase: Environment Audit]
|
|
36
|
+
1. Run the preflight script that lives at `scripts/preflight.js` **inside this skill's own directory** — resolve the path from wherever this SKILL.md was loaded (do not guess a hard-coded location):
|
|
37
|
+
```bash
|
|
38
|
+
node "<this-skill-dir>/scripts/preflight.js"
|
|
39
|
+
```
|
|
40
|
+
2. Parse the output and understand:
|
|
41
|
+
- Operating System (Windows vs. macOS vs. Linux)
|
|
42
|
+
- Active Shell (Git Bash vs. PowerShell vs. Command Prompt)
|
|
43
|
+
- Available CLI Tools (node, pnpm, docker, python, etc.)
|
|
44
|
+
3. **Toolchain Self-Heal (工欲善其事,必先利其器)**: The harness itself is part of the environment. Audit whether this workspace's integration touchpoints (`.claude/settings.json` hooks, `.cursorrules`, `.github/copilot-instructions.md`, `AGENTS.md`) are installed, and repair any missing ones — e.g., installed via Claude Code but now opened in Copilot:
|
|
45
|
+
```bash
|
|
46
|
+
node "<skills-repo-root>/harness-everything/scripts/self-heal.js"
|
|
47
|
+
```
|
|
48
|
+
The script is idempotent (it delegates to the installer, which merges hooks by id and never duplicates advisory text), so running it on an already-healthy workspace is a no-op. Skip only if the user intentionally removed a touchpoint file.
|
|
49
|
+
|
|
50
|
+
## [Execution Phase: Syntax and Command Alignment]
|
|
51
|
+
Choose the correct syntax matching your active shell:
|
|
52
|
+
|
|
53
|
+
### 1. Git Bash on Windows (User's Preferred Terminal)
|
|
54
|
+
- **Path Slashes**: Always use forward slashes `/` (e.g., `scripts/lib/utils.js`). Never use raw backslashes `\` because they act as escape characters in Bash.
|
|
55
|
+
- **Env Variables**: Use `$VARIABLE_NAME` syntax. Do NOT use `%VARIABLE_NAME%` or `$env:VARIABLE_NAME`.
|
|
56
|
+
- **Command Set**: Standard Unix commands are fully supported (`ls`, `rm -rf`, `mkdir -p`, `cp`, `mv`). Do NOT run CMD native commands like `dir`, `del`, or `copy`.
|
|
57
|
+
- **No PowerShell syntax**: Do not run PowerShell-specific scripts or syntax.
|
|
58
|
+
|
|
59
|
+
### 2. PowerShell on Windows
|
|
60
|
+
- **Path Slashes**: Forward slashes `/` or backslashes `\\` are both acceptable.
|
|
61
|
+
- **Env Variables**: Use `$env:VARIABLE_NAME` syntax.
|
|
62
|
+
- **Command Set**: Use standard PowerShell commands or common aliases (e.g., `New-Item`, `Remove-Item`).
|
|
63
|
+
|
|
64
|
+
### 3. Windows Command Prompt (CMD)
|
|
65
|
+
- **Path Slashes**: Use backslashes `\` for file paths.
|
|
66
|
+
- **Env Variables**: Use `%VARIABLE_NAME%` syntax.
|
|
67
|
+
- **Command Set**: Use `dir`, `del`, `copy`, `mkdir`. Do NOT use `ls`, `rm`, `cp`, `mkdir -p`.
|
|
68
|
+
|
|
69
|
+
## [Verification & Reflection Phase]
|
|
70
|
+
3. If any shell command fails, do **not** blindly retry the exact same command.
|
|
71
|
+
4. Stop and ask yourself: "Did I use the wrong syntax for this terminal? Is this a Git Bash vs. PowerShell syntax issue?"
|
|
72
|
+
5. If you fail 3 times on the same command, trigger the `zoom-out` circuit breaker.
|
|
73
|
+
|
|
74
|
+
## Red Flags & Common Errors
|
|
75
|
+
- ❌ **CMD commands in Git Bash**: Attempting to run `dir` or `del` when the terminal is actually running Git Bash.
|
|
76
|
+
- ❌ **PowerShell commands in Bash**: Attempting to run `$env:PATH` or `.ps1` files in a Bash environment.
|
|
77
|
+
- ❌ **Path escape failures**: Sending raw Windows paths like `scripts\run.js` inside a Bash terminal, which interprets `\r` as a carriage return or escapes characters.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function checkCmd(cmd) {
|
|
8
|
+
try {
|
|
9
|
+
if (os.platform() === 'win32') {
|
|
10
|
+
execSync(`where ${cmd}`, { stdio: 'ignore' });
|
|
11
|
+
} else {
|
|
12
|
+
execSync(`which ${cmd}`, { stdio: 'ignore' });
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
} catch (e) {
|
|
16
|
+
try {
|
|
17
|
+
execSync(`${cmd} --version`, { stdio: 'ignore' });
|
|
18
|
+
return true;
|
|
19
|
+
} catch (e2) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
console.log("# [Environment Preflight Report]");
|
|
26
|
+
console.log(`- **Operating System**: ${os.platform()} (${os.release()} ${os.arch()})`);
|
|
27
|
+
|
|
28
|
+
// Shell Detection
|
|
29
|
+
let shell = process.env.SHELL || process.env.COMSPEC || "Unknown";
|
|
30
|
+
let shellName = "Unknown Shell";
|
|
31
|
+
|
|
32
|
+
if (shell.toLowerCase().includes("bash")) {
|
|
33
|
+
shellName = "Git Bash / Bash";
|
|
34
|
+
} else if (shell.toLowerCase().includes("powershell") || shell.toLowerCase().includes("pwsh") || process.env.PSModulePath) {
|
|
35
|
+
shellName = "PowerShell";
|
|
36
|
+
} else if (shell.toLowerCase().includes("cmd.exe")) {
|
|
37
|
+
shellName = "Windows Command Prompt (CMD)";
|
|
38
|
+
} else {
|
|
39
|
+
shellName = shell;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log(`- **Active Shell**: ${shellName} (Path: \`${shell}\`)`);
|
|
43
|
+
console.log(`- **Terminal Program**: ${process.env.TERM_PROGRAM || "Standard Terminal"}`);
|
|
44
|
+
|
|
45
|
+
// CLI Tools Check
|
|
46
|
+
const tools = ['git', 'docker', 'docker-compose', 'node', 'pnpm', 'npm', 'python', 'pip'];
|
|
47
|
+
const availableTools = [];
|
|
48
|
+
for (const tool of tools) {
|
|
49
|
+
if (checkCmd(tool)) {
|
|
50
|
+
availableTools.push(tool);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
console.log(`- **Available CLI Tools**: ${availableTools.join(', ') || 'None'}`);
|
|
54
|
+
|
|
55
|
+
// Sandbox Capabilities Detection
|
|
56
|
+
const hasDocker = availableTools.includes('docker');
|
|
57
|
+
const hasSandboxExec = checkCmd('sandbox-exec');
|
|
58
|
+
const sandboxCapabilities = [];
|
|
59
|
+
if (hasSandboxExec) sandboxCapabilities.push('macOS Seatbelt (sandbox-exec)');
|
|
60
|
+
if (hasDocker) sandboxCapabilities.push('Docker Containers');
|
|
61
|
+
if (os.platform() === 'win32') {
|
|
62
|
+
sandboxCapabilities.push('Windows AppContainer (Native)');
|
|
63
|
+
}
|
|
64
|
+
console.log(`- **Sandbox Capabilities**: ${sandboxCapabilities.join(', ') || 'No isolation sandbox detected'}`);
|
|
65
|
+
|
|
66
|
+
// Repo Status
|
|
67
|
+
try {
|
|
68
|
+
const branch = execSync('git branch --show-current', { encoding: 'utf8' }).trim();
|
|
69
|
+
console.log(`- **Git Workspace**: Detected (Branch: \`${branch}\`)`);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.log(`- **Git Workspace**: No git repository detected in ${process.cwd()}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Recommended Syntax Guardrails
|
|
75
|
+
console.log("\n## [Syntax & Command Guardrails for this Environment]");
|
|
76
|
+
if (os.platform() === 'win32') {
|
|
77
|
+
if (shellName.includes("Bash")) {
|
|
78
|
+
console.log("- **Path Handling**: ALWAYS use `/` slashes for directory paths in commands (e.g., `scripts/run.js`). Avoid raw backslashes `\\` as they act as escape chars.");
|
|
79
|
+
console.log("- **Environment Variables**: Use `$VAR` syntax. Do NOT use `%VAR%` or `$env:VAR`.");
|
|
80
|
+
console.log("- **Command Chaining**: Use `&&` for sequence, `|` for piping.");
|
|
81
|
+
console.log("- **Avoid Native Windows Commands**: Do NOT use `dir`, `copy`, or `del`. Use bash standard equivalents `ls`, `cp`, `rm`.");
|
|
82
|
+
} else if (shellName.includes("PowerShell")) {
|
|
83
|
+
console.log("- **Path Handling**: Slashes `/` or `\\` are generally acceptable.");
|
|
84
|
+
console.log("- **Environment Variables**: Use `$env:VAR` syntax.");
|
|
85
|
+
console.log("- **Command Chaining**: Use `;` or `&&` (if PowerShell 7+). Avoid bash-specific commands like `grep`, `awk`, `sed` unless explicitly piping.");
|
|
86
|
+
} else {
|
|
87
|
+
console.log("- **Path Handling**: Use `\\` for directories.");
|
|
88
|
+
console.log("- **Environment Variables**: Use `%VAR%`.");
|
|
89
|
+
console.log("- **Chaining**: Use `&`.");
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
console.log("- **Unix Native**: Standard Bash/Zsh syntax applies. Use relative paths, pipeline chaining, and standard utilities.");
|
|
93
|
+
}
|
|
@@ -0,0 +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.");
|