openclaw-node-harness 2.0.3 → 2.1.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/README.md +646 -3
- package/bin/hyperagent.mjs +419 -0
- package/bin/mesh-agent.js +603 -81
- package/bin/mesh-bridge.js +340 -11
- package/bin/mesh-deploy-listener.js +119 -97
- package/bin/mesh-deploy.js +8 -0
- package/bin/mesh-task-daemon.js +1005 -40
- package/bin/mesh.js +423 -6
- package/config/claude-settings.json +95 -0
- package/config/daemon.json.template +2 -1
- package/config/git-hooks/pre-commit +13 -0
- package/config/git-hooks/pre-push +12 -0
- package/config/harness-rules.json +174 -0
- package/config/plan-templates/team-bugfix.yaml +52 -0
- package/config/plan-templates/team-deploy.yaml +50 -0
- package/config/plan-templates/team-feature.yaml +71 -0
- package/config/roles/qa-engineer.yaml +36 -0
- package/config/roles/solidity-dev.yaml +51 -0
- package/config/roles/tech-architect.yaml +36 -0
- package/config/rules/framework/solidity.md +22 -0
- package/config/rules/framework/typescript.md +21 -0
- package/config/rules/framework/unity.md +21 -0
- package/config/rules/universal/design-docs.md +18 -0
- package/config/rules/universal/git-hygiene.md +18 -0
- package/config/rules/universal/security.md +19 -0
- package/config/rules/universal/test-standards.md +19 -0
- package/identity/DELEGATION.md +6 -6
- package/install.sh +300 -8
- package/lib/circling-parser.js +119 -0
- package/lib/hyperagent-store.mjs +652 -0
- package/lib/kanban-io.js +59 -10
- package/lib/mcp-knowledge/bench.mjs +118 -0
- package/lib/mcp-knowledge/core.mjs +528 -0
- package/lib/mcp-knowledge/package.json +25 -0
- package/lib/mcp-knowledge/server.mjs +245 -0
- package/lib/mcp-knowledge/test.mjs +802 -0
- package/lib/memory-budget.mjs +261 -0
- package/lib/mesh-collab.js +354 -4
- package/lib/mesh-harness.js +427 -0
- package/lib/mesh-plans.js +13 -5
- package/lib/mesh-registry.js +11 -2
- package/lib/mesh-tasks.js +67 -0
- package/lib/plan-templates.js +226 -0
- package/lib/pre-compression-flush.mjs +320 -0
- package/lib/role-loader.js +292 -0
- package/lib/rule-loader.js +358 -0
- package/lib/session-store.mjs +458 -0
- package/lib/transcript-parser.mjs +292 -0
- package/mission-control/drizzle/soul_schema_update.sql +29 -0
- package/mission-control/drizzle.config.ts +1 -4
- package/mission-control/package-lock.json +1571 -83
- package/mission-control/package.json +6 -2
- package/mission-control/scripts/gen-chronology.js +3 -3
- package/mission-control/scripts/import-pipeline-v2.js +0 -16
- package/mission-control/scripts/import-pipeline.js +0 -15
- package/mission-control/src/app/api/cowork/clusters/[id]/members/route.ts +117 -0
- package/mission-control/src/app/api/cowork/clusters/[id]/route.ts +84 -0
- package/mission-control/src/app/api/cowork/clusters/route.ts +141 -0
- package/mission-control/src/app/api/cowork/dispatch/route.ts +128 -0
- package/mission-control/src/app/api/cowork/events/route.ts +65 -0
- package/mission-control/src/app/api/cowork/intervene/route.ts +259 -0
- package/mission-control/src/app/api/cowork/sessions/[id]/route.ts +37 -0
- package/mission-control/src/app/api/cowork/sessions/route.ts +64 -0
- package/mission-control/src/app/api/diagnostics/route.ts +97 -0
- package/mission-control/src/app/api/diagnostics/test-runner/route.ts +990 -0
- package/mission-control/src/app/api/mesh/events/route.ts +95 -19
- package/mission-control/src/app/api/mesh/identity/route.ts +11 -0
- package/mission-control/src/app/api/mesh/tasks/[id]/route.ts +92 -0
- package/mission-control/src/app/api/mesh/tasks/route.ts +91 -0
- package/mission-control/src/app/api/tasks/[id]/handoff/route.ts +1 -1
- package/mission-control/src/app/api/tasks/[id]/route.ts +90 -4
- package/mission-control/src/app/api/tasks/route.ts +21 -30
- package/mission-control/src/app/cowork/page.tsx +261 -0
- package/mission-control/src/app/diagnostics/page.tsx +385 -0
- package/mission-control/src/app/graph/page.tsx +26 -0
- package/mission-control/src/app/memory/page.tsx +1 -1
- package/mission-control/src/app/obsidian/page.tsx +36 -6
- package/mission-control/src/app/roadmap/page.tsx +24 -0
- package/mission-control/src/app/souls/page.tsx +2 -2
- package/mission-control/src/components/board/execution-config.tsx +431 -0
- package/mission-control/src/components/board/kanban-board.tsx +75 -9
- package/mission-control/src/components/board/kanban-column.tsx +135 -19
- package/mission-control/src/components/board/task-card.tsx +55 -2
- package/mission-control/src/components/board/unified-task-dialog.tsx +82 -4
- package/mission-control/src/components/cowork/cluster-card.tsx +176 -0
- package/mission-control/src/components/cowork/create-cluster-dialog.tsx +251 -0
- package/mission-control/src/components/cowork/dispatch-form.tsx +423 -0
- package/mission-control/src/components/cowork/role-picker.tsx +102 -0
- package/mission-control/src/components/cowork/session-card.tsx +284 -0
- package/mission-control/src/components/layout/sidebar.tsx +39 -2
- package/mission-control/src/lib/__tests__/daily-log.test.ts +82 -0
- package/mission-control/src/lib/__tests__/memory-md.test.ts +87 -0
- package/mission-control/src/lib/__tests__/mesh-kv-sync.test.ts +465 -0
- package/mission-control/src/lib/__tests__/mocks/mock-kv.ts +131 -0
- package/mission-control/src/lib/__tests__/status-kanban.test.ts +46 -0
- package/mission-control/src/lib/__tests__/task-markdown.test.ts +188 -0
- package/mission-control/src/lib/__tests__/wikilinks.test.ts +175 -0
- package/mission-control/src/lib/config.ts +58 -0
- package/mission-control/src/lib/db/index.ts +69 -0
- package/mission-control/src/lib/db/schema.ts +61 -3
- package/mission-control/src/lib/hooks.ts +309 -0
- package/mission-control/src/lib/memory/entities.ts +3 -2
- package/mission-control/src/lib/nats.ts +66 -1
- package/mission-control/src/lib/parsers/task-markdown.ts +52 -2
- package/mission-control/src/lib/parsers/transcript.ts +4 -4
- package/mission-control/src/lib/scheduler.ts +12 -11
- package/mission-control/src/lib/sync/mesh-kv.ts +279 -0
- package/mission-control/src/lib/sync/tasks.ts +23 -1
- package/mission-control/src/lib/task-id.ts +32 -0
- package/mission-control/src/lib/tts/index.ts +33 -9
- package/mission-control/tsconfig.json +2 -1
- package/mission-control/vitest.config.ts +14 -0
- package/package.json +15 -2
- package/services/service-manifest.json +1 -1
- package/skills/cc-godmode/references/agents.md +8 -8
- package/workspace-bin/memory-daemon.mjs +199 -5
- package/workspace-bin/session-search.mjs +204 -0
- package/workspace-bin/web-fetch.mjs +65 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "build-before-done",
|
|
4
|
+
"description": "Never declare work complete without running a build or test",
|
|
5
|
+
"tier": 1,
|
|
6
|
+
"type": "inject",
|
|
7
|
+
"scope": ["local", "mesh"],
|
|
8
|
+
"content": "HARD RULE: Never declare a task complete without running the build/test and showing the actual output. Files existing on disk is not proof of success.",
|
|
9
|
+
"pattern": null,
|
|
10
|
+
"activateOn": null,
|
|
11
|
+
"active": true,
|
|
12
|
+
"tags": ["build", "completion", "verification"],
|
|
13
|
+
"mesh_enforcement": "metric_required",
|
|
14
|
+
"_mesh_note": "On mesh: if task has no metric, post-completion scan flags for review. Karpathy loop already enforces this for tasks WITH metrics."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "no-silent-failure",
|
|
18
|
+
"description": "Never silently swallow errors — always surface them explicitly",
|
|
19
|
+
"tier": 1,
|
|
20
|
+
"type": "inject",
|
|
21
|
+
"scope": ["local", "mesh"],
|
|
22
|
+
"content": "HARD RULE: Never hide, swallow, or skip past errors. If something fails, stop and report it immediately with the full error output.",
|
|
23
|
+
"pattern": null,
|
|
24
|
+
"activateOn": null,
|
|
25
|
+
"active": true,
|
|
26
|
+
"tags": ["errors", "visibility"],
|
|
27
|
+
"mesh_enforcement": "post_scan",
|
|
28
|
+
"mesh_scan_patterns": ["error:", "Error:", "FAIL", "FAILED", "exception", "Exception", "panic", "PANIC", "Traceback"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "no-assume-running",
|
|
32
|
+
"description": "Never assume a server/process is running without checking",
|
|
33
|
+
"tier": 1,
|
|
34
|
+
"type": "inject",
|
|
35
|
+
"scope": ["local", "mesh"],
|
|
36
|
+
"content": "HARD RULE: Never assume a server, daemon, or process is running. Verify with a process check or health probe before acting on that assumption.",
|
|
37
|
+
"pattern": null,
|
|
38
|
+
"activateOn": null,
|
|
39
|
+
"active": true,
|
|
40
|
+
"tags": ["process", "verification"],
|
|
41
|
+
"mesh_enforcement": "pre_check",
|
|
42
|
+
"mesh_pre_checks": ["nats"]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "session-boot-context",
|
|
46
|
+
"description": "Read session state files before first reply so companion knows where we left off",
|
|
47
|
+
"tier": 1,
|
|
48
|
+
"type": "inject",
|
|
49
|
+
"scope": ["local"],
|
|
50
|
+
"content": "HARD RULE: At session start, BEFORE your first reply, silently read memory/last-session-recap.md, memory/active-tasks.md (first 50 lines), and .companion-state.md. Lead your first message with a brief status of where we left off. Never make the user re-orient you.",
|
|
51
|
+
"pattern": null,
|
|
52
|
+
"activateOn": null,
|
|
53
|
+
"active": true,
|
|
54
|
+
"tags": ["boot", "context", "session"]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "git-conventional-commits",
|
|
58
|
+
"description": "Use conventional commit format for all git commits",
|
|
59
|
+
"tier": 2,
|
|
60
|
+
"type": "inject",
|
|
61
|
+
"scope": ["local", "mesh"],
|
|
62
|
+
"content": "RULE: All git commits must use conventional commit format: type(scope): description — e.g. fix(auth): correct token refresh logic",
|
|
63
|
+
"pattern": null,
|
|
64
|
+
"activateOn": ["git commit", "commit -m", "git add"],
|
|
65
|
+
"active": true,
|
|
66
|
+
"tags": ["git", "commits"],
|
|
67
|
+
"mesh_enforcement": "post_validate",
|
|
68
|
+
"mesh_validate_command": "git log -1 --format=%s | grep -qE '^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\\(.+\\))?: .+'"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "no-hardcoded-secrets",
|
|
72
|
+
"description": "Never hardcode API keys, tokens, or passwords in source files",
|
|
73
|
+
"tier": 2,
|
|
74
|
+
"type": "inject",
|
|
75
|
+
"scope": ["local", "mesh"],
|
|
76
|
+
"content": "RULE: Never hardcode API keys, tokens, passwords, or secrets directly in source code. Use environment variables or config files excluded from git.",
|
|
77
|
+
"pattern": null,
|
|
78
|
+
"activateOn": ["api key", "apikey", "secret", "password", "token", "credential"],
|
|
79
|
+
"active": true,
|
|
80
|
+
"tags": ["security", "secrets"],
|
|
81
|
+
"mesh_enforcement": "pre_commit_scan"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "playwright-fallback",
|
|
85
|
+
"description": "Use Playwright web-fetch when WebFetch is blocked or returns empty/broken content",
|
|
86
|
+
"tier": 2,
|
|
87
|
+
"type": "inject",
|
|
88
|
+
"scope": ["local"],
|
|
89
|
+
"content": "RULE: When WebFetch fails, returns empty content, or a site blocks automated access (anti-bot, JS-rendered, login wall), fall back to Playwright via: node bin/web-fetch.mjs <url> [--html] [--selector \"css\"] [--wait ms] [--screenshot file.png]. This renders the full page with a real Chromium browser.",
|
|
90
|
+
"pattern": null,
|
|
91
|
+
"activateOn": ["WebFetch", "web fetch", "scrape", "blocked", "403", "access denied", "anti-bot", "cloudflare"],
|
|
92
|
+
"active": true,
|
|
93
|
+
"tags": ["web", "scraping", "fallback"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "scope-enforcement",
|
|
97
|
+
"description": "Reject file changes outside task scope boundaries",
|
|
98
|
+
"tier": 1,
|
|
99
|
+
"type": "enforce",
|
|
100
|
+
"scope": ["mesh"],
|
|
101
|
+
"content": "Files modified outside the declared task scope will be reverted before commit.",
|
|
102
|
+
"pattern": null,
|
|
103
|
+
"activateOn": null,
|
|
104
|
+
"active": true,
|
|
105
|
+
"tags": ["scope", "boundaries", "safety"],
|
|
106
|
+
"mesh_enforcement": "scope_check"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "block-sudo-in-scripts",
|
|
110
|
+
"description": "Scripts must not contain bare sudo commands",
|
|
111
|
+
"tier": 3,
|
|
112
|
+
"type": "block",
|
|
113
|
+
"scope": ["local", "mesh"],
|
|
114
|
+
"content": "Generated scripts must not contain sudo commands without explicit user acknowledgment",
|
|
115
|
+
"pattern": "\\bsudo\\s+\\S+",
|
|
116
|
+
"activateOn": null,
|
|
117
|
+
"active": false,
|
|
118
|
+
"tags": ["security", "scripts"],
|
|
119
|
+
"mesh_enforcement": "output_block",
|
|
120
|
+
"_note": "Disabled by default — too aggressive for general use."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "block-rm-rf",
|
|
124
|
+
"description": "Never generate rm -rf without an explicit safety check",
|
|
125
|
+
"tier": 3,
|
|
126
|
+
"type": "block",
|
|
127
|
+
"scope": ["local", "mesh"],
|
|
128
|
+
"content": "Destructive file operations must include a safety confirmation",
|
|
129
|
+
"pattern": "rm\\s+-rf\\s+[^{]",
|
|
130
|
+
"activateOn": null,
|
|
131
|
+
"active": true,
|
|
132
|
+
"tags": ["safety", "filesystem"],
|
|
133
|
+
"mesh_enforcement": "output_block"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "hyperagent-task-close",
|
|
137
|
+
"description": "After task completion, log structured performance telemetry",
|
|
138
|
+
"tier": 2,
|
|
139
|
+
"type": "inject",
|
|
140
|
+
"scope": ["local", "mesh"],
|
|
141
|
+
|
|
142
|
+
"content": "RULE: After completing any task, log telemetry via: OPENCLAW_NODE_ID=<node> OPENCLAW_SOUL_ID=<soul> node $OPENCLAW_HOME/bin/hyperagent.mjs log '{\"domain\":\"...\",\"subdomain\":\"...\",\"outcome\":\"success|partial|failure\",\"iterations\":N,\"duration_minutes\":N,\"meta_notes\":\"what approach, why, key moment, one hypothesis\"}'. Pattern flags are auto-detected. $OPENCLAW_HOME defaults to ~/.openclaw.",
|
|
143
|
+
"pattern": null,
|
|
144
|
+
"activateOn": ["task complete", "waiting-user", "status: waiting"],
|
|
145
|
+
"active": true,
|
|
146
|
+
"tags": ["hyperagent", "telemetry"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"id": "hyperagent-task-start",
|
|
150
|
+
"description": "At task start, consult strategy archive for relevant approaches",
|
|
151
|
+
"tier": 2,
|
|
152
|
+
"type": "inject",
|
|
153
|
+
"scope": ["local", "mesh"],
|
|
154
|
+
|
|
155
|
+
"content": "RULE: Before starting any non-trivial task, check strategies: node $OPENCLAW_HOME/bin/hyperagent.mjs strategies --domain <domain>. If a strategy exists, use it as starting approach.",
|
|
156
|
+
"pattern": null,
|
|
157
|
+
"activateOn": ["task start", "claimed", "begin task", "status: running"],
|
|
158
|
+
"active": true,
|
|
159
|
+
"tags": ["hyperagent", "strategy"]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "hyperagent-reflection-ready",
|
|
163
|
+
"description": "When a pending reflection exists, synthesize hypotheses and proposals",
|
|
164
|
+
"tier": 2,
|
|
165
|
+
"type": "inject",
|
|
166
|
+
"scope": ["local"],
|
|
167
|
+
|
|
168
|
+
"content": "RULE: At session start, run: node $OPENCLAW_HOME/bin/hyperagent.mjs reflect --pending. If output is non-empty JSON, it contains performance stats from recent tasks awaiting synthesis. Analyze the data: identify what worked (with causal hypotheses), what didn't (with root causes), and 1-2 forward proposals (specific changes to strategies or workflows). Then call: node $OPENCLAW_HOME/bin/hyperagent.mjs reflect --write-synthesis '<json>' where json = {reflection_id, hypotheses: [...], proposals: [{title, description, proposal_type, target_ref, diff_content}]}. If output is empty, do nothing.",
|
|
169
|
+
"pattern": null,
|
|
170
|
+
"activateOn": ["session start"],
|
|
171
|
+
"active": true,
|
|
172
|
+
"tags": ["hyperagent", "reflection"]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
id: team-bugfix
|
|
2
|
+
name: "Bugfix: {{context}}"
|
|
3
|
+
description: "Bug fix pipeline — Reproduce → Diagnose → Fix → Regression Test"
|
|
4
|
+
failure_policy: abort_on_first_fail
|
|
5
|
+
|
|
6
|
+
phases:
|
|
7
|
+
- wave: 0
|
|
8
|
+
subtasks:
|
|
9
|
+
- id: reproduce
|
|
10
|
+
title: "Reproduce: {{context}}"
|
|
11
|
+
description: "Write a minimal reproduction of the bug. Create a failing test that demonstrates the issue. Document exact steps."
|
|
12
|
+
delegation:
|
|
13
|
+
mode: solo_mesh
|
|
14
|
+
budget_minutes: 15
|
|
15
|
+
critical: true
|
|
16
|
+
metric: "npm test -- --grep 'regression'"
|
|
17
|
+
|
|
18
|
+
- wave: 1
|
|
19
|
+
subtasks:
|
|
20
|
+
- id: diagnose
|
|
21
|
+
title: "Diagnose root cause: {{context}}"
|
|
22
|
+
description: "Analyze the reproduction to identify the root cause. Trace the execution path. Document the failure mechanism."
|
|
23
|
+
delegation:
|
|
24
|
+
mode: local
|
|
25
|
+
budget_minutes: 15
|
|
26
|
+
critical: true
|
|
27
|
+
depends_on:
|
|
28
|
+
- reproduce
|
|
29
|
+
|
|
30
|
+
- wave: 2
|
|
31
|
+
subtasks:
|
|
32
|
+
- id: fix
|
|
33
|
+
title: "Fix: {{context}}"
|
|
34
|
+
description: "Implement the minimal fix for the root cause. Do not refactor surrounding code. Ensure the regression test passes."
|
|
35
|
+
delegation:
|
|
36
|
+
mode: auto
|
|
37
|
+
budget_minutes: 30
|
|
38
|
+
metric: "npm test"
|
|
39
|
+
depends_on:
|
|
40
|
+
- diagnose
|
|
41
|
+
|
|
42
|
+
- wave: 3
|
|
43
|
+
subtasks:
|
|
44
|
+
- id: regression-test
|
|
45
|
+
title: "Verify fix: {{context}}"
|
|
46
|
+
description: "Run full test suite. Verify the regression test passes. Check that no existing tests broke. Document the fix."
|
|
47
|
+
delegation:
|
|
48
|
+
mode: solo_mesh
|
|
49
|
+
budget_minutes: 15
|
|
50
|
+
metric: "npm test"
|
|
51
|
+
depends_on:
|
|
52
|
+
- fix
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
id: team-deploy
|
|
2
|
+
name: "Deploy: {{context}}"
|
|
3
|
+
description: "Deployment pipeline — Pre-flight → Deploy → Smoke Test → Monitor"
|
|
4
|
+
failure_policy: abort_on_first_fail
|
|
5
|
+
|
|
6
|
+
phases:
|
|
7
|
+
- wave: 0
|
|
8
|
+
subtasks:
|
|
9
|
+
- id: preflight
|
|
10
|
+
title: "Pre-flight checks: {{context}}"
|
|
11
|
+
description: "Run full test suite, check build, verify config, validate environment variables, check dependency versions."
|
|
12
|
+
delegation:
|
|
13
|
+
mode: solo_mesh
|
|
14
|
+
budget_minutes: 15
|
|
15
|
+
critical: true
|
|
16
|
+
metric: "npm test && npm run build"
|
|
17
|
+
|
|
18
|
+
- wave: 1
|
|
19
|
+
subtasks:
|
|
20
|
+
- id: deploy
|
|
21
|
+
title: "Deploy: {{context}}"
|
|
22
|
+
description: "Execute deployment. Follow the deployment runbook. Record deployed version and SHA."
|
|
23
|
+
delegation:
|
|
24
|
+
mode: human
|
|
25
|
+
budget_minutes: 30
|
|
26
|
+
critical: true
|
|
27
|
+
depends_on:
|
|
28
|
+
- preflight
|
|
29
|
+
|
|
30
|
+
- wave: 2
|
|
31
|
+
subtasks:
|
|
32
|
+
- id: smoke-test
|
|
33
|
+
title: "Smoke test: {{context}}"
|
|
34
|
+
description: "Run smoke tests against the deployed environment. Verify core functionality. Check health endpoints."
|
|
35
|
+
delegation:
|
|
36
|
+
mode: solo_mesh
|
|
37
|
+
budget_minutes: 15
|
|
38
|
+
depends_on:
|
|
39
|
+
- deploy
|
|
40
|
+
|
|
41
|
+
- wave: 3
|
|
42
|
+
subtasks:
|
|
43
|
+
- id: monitor
|
|
44
|
+
title: "Post-deploy monitoring: {{context}}"
|
|
45
|
+
description: "Monitor error rates, latency, and resource usage for 15 minutes post-deploy. Flag any anomalies."
|
|
46
|
+
delegation:
|
|
47
|
+
mode: local
|
|
48
|
+
budget_minutes: 20
|
|
49
|
+
depends_on:
|
|
50
|
+
- smoke-test
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
id: team-feature
|
|
2
|
+
name: "Feature: {{context}}"
|
|
3
|
+
description: "End-to-end feature pipeline — Design → Architecture → Implement → Test → Review"
|
|
4
|
+
failure_policy: abort_on_critical_fail
|
|
5
|
+
|
|
6
|
+
phases:
|
|
7
|
+
- wave: 0
|
|
8
|
+
subtasks:
|
|
9
|
+
- id: design
|
|
10
|
+
title: "Design: {{context}}"
|
|
11
|
+
description: "Create or update design documentation. Define requirements, acceptance criteria, edge cases, and dependencies."
|
|
12
|
+
delegation:
|
|
13
|
+
mode: local
|
|
14
|
+
budget_minutes: 15
|
|
15
|
+
critical: true
|
|
16
|
+
scope:
|
|
17
|
+
- "docs/"
|
|
18
|
+
- "design/"
|
|
19
|
+
|
|
20
|
+
- wave: 1
|
|
21
|
+
subtasks:
|
|
22
|
+
- id: architecture
|
|
23
|
+
title: "Architecture review: {{context}}"
|
|
24
|
+
description: "Review the design, define code architecture, interfaces, file structure, and integration points. Identify risks."
|
|
25
|
+
delegation:
|
|
26
|
+
mode: collab_mesh
|
|
27
|
+
collaboration:
|
|
28
|
+
mode: review
|
|
29
|
+
min_nodes: 2
|
|
30
|
+
max_nodes: 3
|
|
31
|
+
max_rounds: 2
|
|
32
|
+
convergence:
|
|
33
|
+
type: unanimous
|
|
34
|
+
budget_minutes: 20
|
|
35
|
+
critical: true
|
|
36
|
+
depends_on:
|
|
37
|
+
- design
|
|
38
|
+
|
|
39
|
+
- wave: 2
|
|
40
|
+
subtasks:
|
|
41
|
+
- id: implement
|
|
42
|
+
title: "Implement: {{context}}"
|
|
43
|
+
description: "Write the implementation following the approved architecture. Stay within scope. Write clean, tested code."
|
|
44
|
+
delegation:
|
|
45
|
+
mode: auto
|
|
46
|
+
budget_minutes: 45
|
|
47
|
+
depends_on:
|
|
48
|
+
- architecture
|
|
49
|
+
|
|
50
|
+
- wave: 3
|
|
51
|
+
subtasks:
|
|
52
|
+
- id: test
|
|
53
|
+
title: "Test: {{context}}"
|
|
54
|
+
description: "Write and run tests. Verify all acceptance criteria. Check edge cases. Measure performance impact."
|
|
55
|
+
delegation:
|
|
56
|
+
mode: solo_mesh
|
|
57
|
+
budget_minutes: 20
|
|
58
|
+
metric: "npm test"
|
|
59
|
+
depends_on:
|
|
60
|
+
- implement
|
|
61
|
+
|
|
62
|
+
- wave: 4
|
|
63
|
+
subtasks:
|
|
64
|
+
- id: review
|
|
65
|
+
title: "Code review: {{context}}"
|
|
66
|
+
description: "Final code review. Check for security issues, style compliance, test coverage, documentation completeness."
|
|
67
|
+
delegation:
|
|
68
|
+
mode: human
|
|
69
|
+
budget_minutes: 10
|
|
70
|
+
depends_on:
|
|
71
|
+
- test
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
id: qa-engineer
|
|
2
|
+
name: QA Engineer
|
|
3
|
+
description: Test design, validation, and quality assurance
|
|
4
|
+
|
|
5
|
+
responsibilities:
|
|
6
|
+
- "Design test cases covering happy paths, edge cases, and failure modes"
|
|
7
|
+
- "Write regression tests for every bug fix"
|
|
8
|
+
- "Verify test coverage meets minimum thresholds"
|
|
9
|
+
- "Validate gas consumption stays within budget"
|
|
10
|
+
- "Check that all acceptance criteria are testable"
|
|
11
|
+
|
|
12
|
+
must_not:
|
|
13
|
+
- "Modify production source code — only test files"
|
|
14
|
+
- "Skip edge case testing for gas optimization"
|
|
15
|
+
- "Mark tests as skipped without documenting why"
|
|
16
|
+
|
|
17
|
+
framework:
|
|
18
|
+
name: "Arrange-Act-Assert"
|
|
19
|
+
prompt: |
|
|
20
|
+
Structure every test using:
|
|
21
|
+
- ARRANGE: Set up preconditions and inputs
|
|
22
|
+
- ACT: Execute the behavior under test
|
|
23
|
+
- ASSERT: Verify the expected outcome
|
|
24
|
+
Each test must test exactly ONE behavior. Name tests descriptively:
|
|
25
|
+
"should revert when caller is not owner" not "test1".
|
|
26
|
+
|
|
27
|
+
required_outputs:
|
|
28
|
+
- type: file_match
|
|
29
|
+
pattern: "test/**"
|
|
30
|
+
description: "Must produce test files"
|
|
31
|
+
|
|
32
|
+
scope_paths: ["test/**"]
|
|
33
|
+
|
|
34
|
+
escalation:
|
|
35
|
+
on_budget_exceeded: tech-architect
|
|
36
|
+
on_metric_failure: human
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
id: solidity-dev
|
|
2
|
+
name: Solidity Developer
|
|
3
|
+
description: Smart contract implementation and testing
|
|
4
|
+
|
|
5
|
+
responsibilities:
|
|
6
|
+
- "Implement smart contract logic per specification"
|
|
7
|
+
- "Write comprehensive test coverage for all state transitions"
|
|
8
|
+
- "Document gas costs for all public functions"
|
|
9
|
+
- "Emit events on every state change"
|
|
10
|
+
- "Follow checks-effects-interactions pattern"
|
|
11
|
+
- "Use OpenZeppelin where applicable for standard patterns"
|
|
12
|
+
|
|
13
|
+
must_not:
|
|
14
|
+
- "Modify deployment scripts without explicit delegation"
|
|
15
|
+
- "Change contract interfaces without architecture review"
|
|
16
|
+
- "Hardcode addresses — resolve through config or registry"
|
|
17
|
+
- "Use inline assembly without architecture review"
|
|
18
|
+
- "Skip reentrancy guards on external calls"
|
|
19
|
+
|
|
20
|
+
framework:
|
|
21
|
+
name: "Checks-Effects-Interactions"
|
|
22
|
+
prompt: |
|
|
23
|
+
For every state-changing function, verify:
|
|
24
|
+
1. CHECKS: All require/revert conditions at top
|
|
25
|
+
2. EFFECTS: State changes before any external calls
|
|
26
|
+
3. INTERACTIONS: External calls last, with reentrancy guards
|
|
27
|
+
Document gas implications for any function exceeding 50k gas.
|
|
28
|
+
|
|
29
|
+
required_outputs:
|
|
30
|
+
- type: file_match
|
|
31
|
+
pattern: "test/**/*.test.js"
|
|
32
|
+
description: "Test file must accompany any contract change"
|
|
33
|
+
- type: content_check
|
|
34
|
+
pattern: "contracts/**/*.sol"
|
|
35
|
+
check: "emit"
|
|
36
|
+
description: "All state changes must emit events"
|
|
37
|
+
|
|
38
|
+
forbidden_patterns:
|
|
39
|
+
- pattern: "0x[a-fA-F0-9]{40}"
|
|
40
|
+
in: "contracts/**/*.sol"
|
|
41
|
+
description: "No hardcoded addresses — resolve through config"
|
|
42
|
+
- pattern: "selfdestruct|delegatecall"
|
|
43
|
+
in: "contracts/**/*.sol"
|
|
44
|
+
description: "No selfdestruct or raw delegatecall without architecture review"
|
|
45
|
+
|
|
46
|
+
scope_paths: ["contracts/**", "test/**"]
|
|
47
|
+
|
|
48
|
+
escalation:
|
|
49
|
+
on_scope_violation: tech-architect
|
|
50
|
+
on_budget_exceeded: tech-architect
|
|
51
|
+
on_metric_failure: qa-engineer
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
id: tech-architect
|
|
2
|
+
name: Technical Architect
|
|
3
|
+
description: Architecture decisions, code review, cross-domain coordination
|
|
4
|
+
|
|
5
|
+
responsibilities:
|
|
6
|
+
- "Review architecture for scalability and security"
|
|
7
|
+
- "Document technical decisions using ADR format"
|
|
8
|
+
- "Identify cross-domain dependencies and risks"
|
|
9
|
+
- "Define interfaces between system components"
|
|
10
|
+
- "Evaluate gas costs and performance implications"
|
|
11
|
+
|
|
12
|
+
must_not:
|
|
13
|
+
- "Implement features directly — delegate to specialists"
|
|
14
|
+
- "Skip ADR documentation for non-obvious choices"
|
|
15
|
+
- "Approve changes without reviewing test coverage"
|
|
16
|
+
|
|
17
|
+
framework:
|
|
18
|
+
name: "ADR Format"
|
|
19
|
+
prompt: |
|
|
20
|
+
Document all decisions using Architecture Decision Record format:
|
|
21
|
+
- CONTEXT: What forces are at play? What constraints exist?
|
|
22
|
+
- DECISION: What was decided and why?
|
|
23
|
+
- CONSEQUENCES: What are the tradeoffs? What does this enable/prevent?
|
|
24
|
+
- STATUS: proposed | accepted | deprecated | superseded
|
|
25
|
+
Every non-obvious technical choice requires an ADR.
|
|
26
|
+
|
|
27
|
+
required_outputs:
|
|
28
|
+
- type: file_match
|
|
29
|
+
pattern: "docs/adr-*.md"
|
|
30
|
+
description: "Architecture decisions must produce ADR documents"
|
|
31
|
+
|
|
32
|
+
scope_paths: ["docs/**", "contracts/**", "src/**"]
|
|
33
|
+
|
|
34
|
+
escalation:
|
|
35
|
+
on_scope_violation: tech-architect
|
|
36
|
+
on_budget_exceeded: human
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: solidity
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: framework
|
|
5
|
+
paths: ["contracts/**", "**/*.sol"]
|
|
6
|
+
detect: ["hardhat.config.js", "hardhat.config.ts", "foundry.toml"]
|
|
7
|
+
priority: 80
|
|
8
|
+
tags: ["solidity", "blockchain", "smart-contracts"]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Solidity Standards
|
|
12
|
+
|
|
13
|
+
- Never hardcode contract addresses. Resolve through a registry or deployment config.
|
|
14
|
+
- All external/public functions that modify state must have reentrancy guards.
|
|
15
|
+
- Every state change must emit an event. Events are the indexing layer.
|
|
16
|
+
- Use checks-effects-interactions pattern: validate → update state → external calls.
|
|
17
|
+
- All arithmetic on token amounts must use SafeMath or Solidity 0.8+ built-in overflow protection.
|
|
18
|
+
- Document gas costs for expensive operations. Set gas budgets for user-facing transactions.
|
|
19
|
+
- Upgradeable contracts must use the proxy pattern with storage layout compatibility checks.
|
|
20
|
+
- Never use `selfdestruct` or `delegatecall` to untrusted targets.
|
|
21
|
+
- All deployed contracts must have a verified source on block explorer.
|
|
22
|
+
- Test coverage must include: happy path, edge cases, access control, reentrancy, gas limits.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: typescript
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: framework
|
|
5
|
+
paths: ["**/*.ts", "**/*.tsx", "src/**"]
|
|
6
|
+
detect: ["tsconfig.json"]
|
|
7
|
+
priority: 70
|
|
8
|
+
tags: ["typescript", "javascript"]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TypeScript Standards
|
|
12
|
+
|
|
13
|
+
- Enable strict mode. Never set `strict: false` in tsconfig.
|
|
14
|
+
- Avoid `any` — use `unknown` for truly unknown types, then narrow with type guards.
|
|
15
|
+
- Prefer interfaces over type aliases for object shapes (interfaces are extensible, produce better errors).
|
|
16
|
+
- Use explicit return types on exported functions. Inferred types are fine for internal/private functions.
|
|
17
|
+
- Never use `@ts-ignore` without a comment explaining why and a tracking issue.
|
|
18
|
+
- Use discriminated unions over optional fields for variant types.
|
|
19
|
+
- Prefer `readonly` for properties that shouldn't change after construction.
|
|
20
|
+
- Handle all promise rejections — no unhandled promises. Use try/catch or `.catch()`.
|
|
21
|
+
- Prefer named exports over default exports (better refactoring, better tree-shaking).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: unity
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: framework
|
|
5
|
+
paths: ["Assets/**", "**/*.cs", "Packages/**"]
|
|
6
|
+
detect: ["ProjectSettings/ProjectVersion.txt"]
|
|
7
|
+
priority: 70
|
|
8
|
+
tags: ["unity", "gamedev", "csharp"]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Unity Standards
|
|
12
|
+
|
|
13
|
+
- Use delta time (`Time.deltaTime`) for all time-dependent calculations. Never assume fixed frame rate.
|
|
14
|
+
- Zero allocations in `Update()`, `FixedUpdate()`, and `LateUpdate()`. Cache references in `Awake()`/`Start()`.
|
|
15
|
+
- Use object pooling for frequently spawned/destroyed objects (projectiles, particles, UI elements).
|
|
16
|
+
- Never use `Find()`, `FindObjectOfType()`, or tag-based lookups in hot paths. Cache in `Awake()`.
|
|
17
|
+
- All gameplay values must come from ScriptableObjects or external config — never hardcoded in scripts.
|
|
18
|
+
- Use events/delegates for inter-system communication. No direct coupling between unrelated systems.
|
|
19
|
+
- Profile before and after optimization. Use Unity Profiler, not guesswork.
|
|
20
|
+
- Mobile: respect thermal state, target 30fps stable over 60fps with drops, batch draw calls.
|
|
21
|
+
- AR: all geospatial API calls must be async. Never block the main thread on location/anchor resolution.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: design-docs
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: universal
|
|
5
|
+
paths: ["docs/**", "design/**", "notes/**", "**/*.md"]
|
|
6
|
+
priority: 60
|
|
7
|
+
tags: ["documentation", "design"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Design Documentation Standards
|
|
11
|
+
|
|
12
|
+
- Every design document must include: Overview, Requirements, Approach, Edge Cases, Acceptance Criteria.
|
|
13
|
+
- Acceptance criteria must be testable — "should feel good" or "works correctly" are not valid criteria.
|
|
14
|
+
- Formulas and algorithms must include variable definitions, valid ranges, and example calculations.
|
|
15
|
+
- Edge cases must explicitly state WHAT happens, not just acknowledge they exist.
|
|
16
|
+
- Dependencies between systems must be bidirectional — if A depends on B, both A and B docs say so.
|
|
17
|
+
- Update documentation when changing the code it describes. Stale docs are worse than no docs.
|
|
18
|
+
- Architecture Decision Records (ADRs) for any non-obvious technical choice: context, decision, consequences.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: git-hygiene
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: universal
|
|
5
|
+
paths: ["**/*"]
|
|
6
|
+
priority: 40
|
|
7
|
+
tags: ["git", "workflow"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Git Hygiene
|
|
11
|
+
|
|
12
|
+
- Use conventional commit format: `type(scope): description` (feat, fix, refactor, test, docs, chore).
|
|
13
|
+
- Never force-push to main/master. Use feature branches and pull requests.
|
|
14
|
+
- Commits should be atomic — one logical change per commit, not a dump of accumulated work.
|
|
15
|
+
- Write commit messages that explain WHY, not just WHAT. The diff shows what changed.
|
|
16
|
+
- Never commit generated files, build artifacts, or dependency directories (node_modules, dist, build).
|
|
17
|
+
- Resolve merge conflicts by understanding both sides, not by accepting one blindly.
|
|
18
|
+
- Tag releases with semantic versioning. Breaking changes get a major bump.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: security
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: universal
|
|
5
|
+
paths: ["**/*"]
|
|
6
|
+
priority: 100
|
|
7
|
+
tags: ["security", "safety"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Security Standards
|
|
11
|
+
|
|
12
|
+
- NEVER hardcode API keys, passwords, tokens, or secrets in source code. Use environment variables or secret managers.
|
|
13
|
+
- Validate all external input at system boundaries (user input, API responses, file reads, URL parameters).
|
|
14
|
+
- Never use `eval()`, `Function()`, or equivalent dynamic code execution on untrusted input.
|
|
15
|
+
- Sanitize data before inserting into SQL queries, HTML templates, shell commands, or file paths. Use parameterized queries and template engines.
|
|
16
|
+
- Never log sensitive data (passwords, tokens, PII). Redact or mask before logging.
|
|
17
|
+
- Use HTTPS for all external communication. Verify TLS certificates.
|
|
18
|
+
- Apply principle of least privilege — request only the permissions and scopes actually needed.
|
|
19
|
+
- Never commit `.env` files, private keys, or credential files to version control.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: test-standards
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
tier: universal
|
|
5
|
+
paths: ["test/**", "tests/**", "**/*.test.*", "**/*.spec.*", "**/__tests__/**"]
|
|
6
|
+
priority: 80
|
|
7
|
+
tags: ["testing", "quality"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Test Standards
|
|
11
|
+
|
|
12
|
+
- Use Arrange/Act/Assert structure in every test.
|
|
13
|
+
- Name tests descriptively: `test_[system]_[scenario]_[expected_result]` or `describe/it` equivalent.
|
|
14
|
+
- Tests must be deterministic — no dependencies on network, wall clock, or external state.
|
|
15
|
+
- Every bug fix must include a regression test that fails without the fix and passes with it.
|
|
16
|
+
- Integration tests must clean up after themselves (database records, temp files, external state).
|
|
17
|
+
- Mock external dependencies (APIs, databases, filesystems) in unit tests. Integration tests hit real services.
|
|
18
|
+
- Performance tests must specify acceptable thresholds, not just "faster than before."
|
|
19
|
+
- Never use `sleep()` or fixed delays in tests. Use polling with timeouts or event-driven waits.
|
package/identity/DELEGATION.md
CHANGED
|
@@ -48,12 +48,12 @@ Subjective outputs (lore, design) require a verification proxy: word count, form
|
|
|
48
48
|
|
|
49
49
|
Check `bin/trust-registry` before delegating to a specialist soul.
|
|
50
50
|
|
|
51
|
-
| Tier | Min Tasks | Trust >= | Autonomy |
|
|
51
|
+
| Tier | Min Tasks | Trust >= | Autonomy | Capability |
|
|
52
52
|
|---|---|---|---|---|
|
|
53
|
-
| new | 0 | — | atomic (strict I/O) |
|
|
54
|
-
| developing | 3 | 0.50 | guided (can decompose, must report steps) |
|
|
55
|
-
| proven | 10 | 0.65 | open-ended (pursue sub-goals, report at end) |
|
|
56
|
-
| expert | 25 | 0.80 | full (can sub-delegate, minimal oversight) |
|
|
53
|
+
| new | 0 | — | atomic (strict I/O) | fast |
|
|
54
|
+
| developing | 3 | 0.50 | guided (can decompose, must report steps) | standard |
|
|
55
|
+
| proven | 10 | 0.65 | open-ended (pursue sub-goals, report at end) | standard |
|
|
56
|
+
| expert | 25 | 0.80 | full (can sub-delegate, minimal oversight) | reasoning |
|
|
57
57
|
|
|
58
58
|
After every delegation: `bin/trust-registry update <soul-id> --result success|failure --turns N --verified true|false --task "description"`
|
|
59
59
|
|
|
@@ -81,7 +81,7 @@ Every delegated task: completable in **2-5 minutes**.
|
|
|
81
81
|
On sub-agent failure:
|
|
82
82
|
1. Retry once with enriched context (add the error + background)
|
|
83
83
|
2. Re-delegate to different soul if capability mismatch
|
|
84
|
-
3. Escalate
|
|
84
|
+
3. Escalate capability tier (standard → reasoning)
|
|
85
85
|
4. Escalate to Gui if 1-3 fail or task is high-criticality
|
|
86
86
|
|
|
87
87
|
Never retry same prompt unchanged. Each retry must add information.
|