@rune-kit/rune 2.2.2 → 2.2.4
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/compiler/__tests__/adapters.test.js +109 -0
- package/compiler/__tests__/openclaw-adapter.test.js +149 -140
- package/compiler/__tests__/pack-split.test.js +145 -145
- package/compiler/__tests__/parser.test.js +3 -3
- package/compiler/__tests__/pipeline.test.js +110 -0
- package/compiler/__tests__/skill-validation.test.js +148 -0
- package/compiler/__tests__/transformer.test.js +70 -0
- package/compiler/__tests__/transforms.test.js +92 -0
- package/compiler/adapters/antigravity.js +5 -6
- package/compiler/adapters/claude.js +1 -1
- package/compiler/adapters/codex.js +69 -77
- package/compiler/adapters/cursor.js +5 -6
- package/compiler/adapters/generic.js +5 -6
- package/compiler/adapters/index.js +3 -3
- package/compiler/adapters/openclaw.js +146 -150
- package/compiler/adapters/opencode.js +78 -86
- package/compiler/adapters/windsurf.js +5 -6
- package/compiler/bin/rune.js +32 -23
- package/compiler/doctor.js +19 -7
- package/compiler/emitter.js +11 -18
- package/compiler/parser.js +5 -5
- package/compiler/transformer.js +3 -5
- package/compiler/transforms/branding.js +5 -4
- package/compiler/transforms/compliance.js +40 -40
- package/compiler/transforms/frontmatter.js +1 -1
- package/compiler/transforms/hooks.js +12 -14
- package/compiler/transforms/subagents.js +1 -3
- package/compiler/transforms/tool-names.js +1 -1
- package/docs/guides/index.html +48 -7
- package/docs/index.html +67 -2
- package/docs/style.css +18 -1
- package/extensions/security/PACK.md +4 -3
- package/extensions/security/skills/defense-in-depth.md +103 -0
- package/package.json +8 -1
- package/skills/completion-gate/SKILL.md +31 -1
- package/skills/cook/SKILL.md +20 -2
- package/skills/debug/SKILL.md +16 -1
- package/skills/hallucination-guard/SKILL.md +21 -6
- package/skills/plan/SKILL.md +90 -1
- package/skills/review/SKILL.md +1 -0
- package/skills/sentinel-env/SKILL.md +31 -1
- package/skills/skill-forge/SKILL.md +57 -1
- package/skills/team/SKILL.md +61 -15
- package/skills/test/SKILL.md +101 -10
- package/skills/verification/SKILL.md +29 -1
|
@@ -3,7 +3,7 @@ name: hallucination-guard
|
|
|
3
3
|
description: Verify AI-generated imports, API calls, and packages actually exist. Catches phantom functions, non-existent packages, and slopsquatting attacks.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.3.0"
|
|
7
7
|
layer: L3
|
|
8
8
|
model: haiku
|
|
9
9
|
group: validation
|
|
@@ -74,15 +74,30 @@ File: resolved file path
|
|
|
74
74
|
|
|
75
75
|
If export not found → mark as **WARN** (symbol may not be exported).
|
|
76
76
|
|
|
77
|
-
### Step 3 — Verify external packages
|
|
77
|
+
### Step 3 — Verify external packages (Dependency Check Before Import)
|
|
78
|
+
|
|
79
|
+
> From taste-skill (Leonxlnx/taste-skill, 3.4k★): "Before importing ANY 3rd party lib, check package.json."
|
|
78
80
|
|
|
79
81
|
Use `Read` on the project's dependency manifest to confirm each external package is listed:
|
|
80
82
|
|
|
81
83
|
- JavaScript/TypeScript: `package.json` → check `dependencies` and `devDependencies`
|
|
82
|
-
- Python: `requirements.txt` or `pyproject.toml`
|
|
83
|
-
- Rust: `Cargo.toml` → `[dependencies]`
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
- Python: `requirements.txt` or `pyproject.toml` → `[project.dependencies]` and `[project.optional-dependencies]`
|
|
85
|
+
- Rust: `Cargo.toml` → `[dependencies]` and `[dev-dependencies]`
|
|
86
|
+
|
|
87
|
+
**Pre-import gate** (BEFORE writing import statements, not just after):
|
|
88
|
+
1. If the agent is ABOUT to import a package → check manifest FIRST
|
|
89
|
+
2. If package is NOT in manifest → output install command before writing the import:
|
|
90
|
+
```
|
|
91
|
+
⚠ Package '<name>' not in dependencies. Install first:
|
|
92
|
+
npm install <name> # JS/TS
|
|
93
|
+
pip install <name> # Python
|
|
94
|
+
cargo add <name> # Rust
|
|
95
|
+
```
|
|
96
|
+
3. If package IS in manifest → proceed with import
|
|
97
|
+
|
|
98
|
+
**Post-import verification** (after code is written):
|
|
99
|
+
- If package is **not listed** in the manifest → mark as **BLOCK** (phantom dependency)
|
|
100
|
+
- If package is listed but not installed (no lockfile entry) → mark as **WARN** (not yet installed)
|
|
86
101
|
|
|
87
102
|
Also check for typosquatting: if package name has edit distance ≤ 2 from a known popular package (axios/axois, lodash/lodahs, react/recat), mark as **SUSPICIOUS**.
|
|
88
103
|
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: plan
|
|
|
3
3
|
description: Create structured implementation plans from requirements. Produces master plan + phase files for enterprise-scale project management. Master plan = overview (<80 lines). Phase files = execution detail (<150 lines each). Each session handles 1 phase. Uses opus for deep reasoning.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.6.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: opus
|
|
9
9
|
group: creation
|
|
@@ -149,6 +149,46 @@ Phase decomposition rules:
|
|
|
149
149
|
- **Dependencies before consumers**: create what's imported before the importer
|
|
150
150
|
- **Test alongside**: each phase includes its own test tasks
|
|
151
151
|
- **Max 5-7 tasks per phase**: if more, split the phase
|
|
152
|
+
- **Vertical slices over horizontal layers**: prefer "auth end-to-end" over "all models → all APIs → all UI"
|
|
153
|
+
|
|
154
|
+
### Wave-Based Task Grouping (within each phase)
|
|
155
|
+
|
|
156
|
+
Tasks inside a phase MUST be organized into **waves** based on dependency analysis. Independent tasks within the same wave can execute in parallel.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
## Tasks
|
|
160
|
+
|
|
161
|
+
### Wave 1 (parallel — no dependencies)
|
|
162
|
+
- [ ] Task 1 — Create types/interfaces
|
|
163
|
+
- File: `src/types.ts` (new)
|
|
164
|
+
- ...
|
|
165
|
+
- [ ] Task 2 — Create validation schema
|
|
166
|
+
- File: `src/validation.ts` (new)
|
|
167
|
+
- ...
|
|
168
|
+
|
|
169
|
+
### Wave 2 (depends on Wave 1)
|
|
170
|
+
- [ ] Task 3 — Implement core logic (imports types from Task 1)
|
|
171
|
+
- File: `src/core.ts` (new)
|
|
172
|
+
- depends_on: [Task 1]
|
|
173
|
+
- ...
|
|
174
|
+
|
|
175
|
+
### Wave 3 (depends on Wave 2)
|
|
176
|
+
- [ ] Task 4 — Wire into API endpoint (imports core from Task 3)
|
|
177
|
+
- File: `src/routes/api.ts` (modify)
|
|
178
|
+
- depends_on: [Task 3]
|
|
179
|
+
- ...
|
|
180
|
+
- [ ] Task 5 — Write integration tests (tests core from Task 3)
|
|
181
|
+
- File: `tests/core.test.ts` (new)
|
|
182
|
+
- depends_on: [Task 3]
|
|
183
|
+
- ...
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Wave rules:**
|
|
187
|
+
- Wave 1 = tasks with zero dependencies (types, schemas, configs) — always first
|
|
188
|
+
- Subsequent waves: a task goes in the earliest wave where ALL its `depends_on` tasks are in prior waves
|
|
189
|
+
- Tasks within the same wave have NO dependencies on each other → safe for parallel dispatch
|
|
190
|
+
- `depends_on` field is MANDATORY for Wave 2+ tasks — explicit is better than implicit
|
|
191
|
+
- `team` orchestrator can dispatch wave tasks as parallel subagents; solo `cook` executes sequentially within a wave but respects wave ordering
|
|
152
192
|
|
|
153
193
|
### Step 4 — Write Master Plan File
|
|
154
194
|
|
|
@@ -188,6 +228,52 @@ Save to `.rune/plan-<feature>.md`:
|
|
|
188
228
|
|
|
189
229
|
**Max 80 lines.** No implementation details — that's what phase files are for.
|
|
190
230
|
|
|
231
|
+
### Step 4.5 — Workflow Registry (Complex Features Only)
|
|
232
|
+
|
|
233
|
+
> From agency-agents (msitarzewski/agency-agents, 50.8k★): "Every route is an entry point. Every worker is a workflow. If it's missing from the registry, it doesn't exist."
|
|
234
|
+
|
|
235
|
+
For complex features (4+ phases OR 3+ user-facing workflows), build a **4-view Workflow Registry** before writing phase files. This catches missing pieces, dead ends, and integration gaps at plan time — not implementation time.
|
|
236
|
+
|
|
237
|
+
**Skip conditions**: trivial tasks, inline plans, single-workflow features.
|
|
238
|
+
|
|
239
|
+
**4 cross-referenced views:**
|
|
240
|
+
|
|
241
|
+
```markdown
|
|
242
|
+
## Workflow Registry
|
|
243
|
+
|
|
244
|
+
### View 1: By Workflow
|
|
245
|
+
| Workflow | Entry Point | Components Touched | Exit Point | Phase |
|
|
246
|
+
|----------|-------------|-------------------|------------|-------|
|
|
247
|
+
| User signup | POST /auth/register | AuthService, UserRepo, EmailService | 201 + email sent | Phase 1 |
|
|
248
|
+
| Password reset | POST /auth/reset | AuthService, EmailService, TokenRepo | 200 + reset email | Phase 2 |
|
|
249
|
+
|
|
250
|
+
### View 2: By Component
|
|
251
|
+
| Component | Used By Workflows | Owner Phase | Status |
|
|
252
|
+
|-----------|-------------------|-------------|--------|
|
|
253
|
+
| AuthService | signup, login, reset | Phase 1 | Planned |
|
|
254
|
+
| EmailService | signup, reset, invite | Phase 2 | Planned |
|
|
255
|
+
| TokenRepo | reset, invite | Phase 2 | Missing ← RED FLAG |
|
|
256
|
+
|
|
257
|
+
### View 3: By User Journey
|
|
258
|
+
| Journey | Steps (workflow chain) | Happy Path | Error Path |
|
|
259
|
+
|---------|----------------------|------------|------------|
|
|
260
|
+
| New user → first action | signup → verify email → login → onboard | 4 steps | signup fail, email bounce |
|
|
261
|
+
|
|
262
|
+
### View 4: By State
|
|
263
|
+
| Step | User Sees | DB State | Logs | Operator Sees |
|
|
264
|
+
|------|-----------|----------|------|---------------|
|
|
265
|
+
| After signup | "Check your email" | user.status=pending | user.created event | New user in admin |
|
|
266
|
+
| After verify | Dashboard | user.status=active | user.verified event | Active user count +1 |
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**Validation rules:**
|
|
270
|
+
- Every component in View 2 MUST appear in at least one workflow in View 1 — orphaned components = dead code
|
|
271
|
+
- Every workflow in View 1 MUST map to a phase — unphased workflows will be forgotten
|
|
272
|
+
- "Missing" status in View 2 = **red flag** — component needed but not planned in any phase → add to a phase or create new phase
|
|
273
|
+
- Every user journey step in View 3 MUST have a corresponding state row in View 4
|
|
274
|
+
|
|
275
|
+
**Output**: Add the registry to the master plan file (it fits within the 80-line budget when tables are compact). Phase files reference it but don't duplicate it.
|
|
276
|
+
|
|
191
277
|
### Step 5 — Write Phase Files
|
|
192
278
|
|
|
193
279
|
For each phase, save to `.rune/plan-<feature>-phase<N>.md`.
|
|
@@ -519,7 +605,10 @@ Max 200 lines. Self-contained — coder needs ONLY this file.
|
|
|
519
605
|
| Phase with zero test tasks | CRITICAL | HARD-GATE rejects it |
|
|
520
606
|
| 10+ phases overwhelming the master plan | MEDIUM | Max 8 phases — split into sub-projects if more |
|
|
521
607
|
| Task without File path or Verify command | HIGH | Every task MUST have File + Test + Verify + Commit fields — no vague "implement the feature" tasks |
|
|
608
|
+
| Horizontal layer planning (all models → all APIs → all UI) | HIGH | Vertical slices parallelize better. Use wave-based grouping: independent tasks in same wave, dependent tasks in later waves |
|
|
609
|
+
| Tasks without `depends_on` in Wave 2+ | MEDIUM | Implicit dependencies break parallel dispatch. Every Wave 2+ task MUST declare `depends_on` |
|
|
522
610
|
| Plan ignores locked Decisions from BA | CRITICAL | Decision Compliance section cross-checks requirements.md — locked decisions are non-negotiable |
|
|
611
|
+
| Complex feature missing Workflow Registry — components planned but never wired | HIGH | Step 4.5: 4-view registry catches orphaned components, unphased workflows, and missing state transitions before phase files are written |
|
|
523
612
|
|
|
524
613
|
## Done When
|
|
525
614
|
|
package/skills/review/SKILL.md
CHANGED
|
@@ -380,6 +380,7 @@ LOW — style inconsistency, naming suggestion, minor refactor opportunity
|
|
|
380
380
|
| Treating purple/indigo accent as "just a color choice" | MEDIUM | It is a documented AI-generated UI signature — always flag for domain justification |
|
|
381
381
|
| Suggesting "add X" without checking if X is used | MEDIUM | YAGNI pushback: grep codebase for the suggested feature → if uncalled anywhere → respond "Not called anywhere. Remove? (YAGNI)". Valid pushback, not laziness |
|
|
382
382
|
| Adding abstractions "for future flexibility" | MEDIUM | Three similar lines > premature abstraction. Only abstract when there are 3+ concrete callers today |
|
|
383
|
+
| Missing cross-phase integration check at phase boundary | MEDIUM | When reviewing a phase completion: check orphaned exports, uncalled routes, auth gaps, E2E flow continuity. Delegate to completion-gate Step 4.5 |
|
|
383
384
|
|
|
384
385
|
## Done When
|
|
385
386
|
|
|
@@ -3,7 +3,7 @@ name: sentinel-env
|
|
|
3
3
|
description: Environment-aware pre-flight check. Validates OS, runtime versions, installed tools, port availability, env vars, and disk space BEFORE coding starts. Prevents "works on my machine" failures. Like sentinel but for the environment, not the code.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.2.0"
|
|
7
7
|
layer: L3
|
|
8
8
|
model: haiku
|
|
9
9
|
group: validation
|
|
@@ -111,6 +111,34 @@ Detect and verify tools the project depends on:
|
|
|
111
111
|
4. **Database tools**: Check if `prisma`, `drizzle`, `alembic`, `django` migrations exist → verify DB client installed
|
|
112
112
|
5. **Build tools**: Check for `turbo.json` (turborepo), `nx.json` (Nx), `Makefile`, etc.
|
|
113
113
|
|
|
114
|
+
6. **Hard dependencies** — tools the project WRAPS (not just uses as dev dependency):
|
|
115
|
+
> From CLI-Anything (HKUDS/CLI-Anything, 17.4k★): "The software is a required dependency, not optional."
|
|
116
|
+
|
|
117
|
+
Scan for evidence that the project wraps an external tool:
|
|
118
|
+
- `Grep` for `shutil.which(`, `which `, `command -v ` → project looks up an executable at runtime
|
|
119
|
+
- `Grep` for `subprocess.run(`, `child_process.exec(`, `Deno.Command(` → project invokes external CLI
|
|
120
|
+
- `Read` README/docs for "requires X installed" or "depends on X"
|
|
121
|
+
|
|
122
|
+
For each detected hard dependency:
|
|
123
|
+
```bash
|
|
124
|
+
# Verify the tool exists on PATH
|
|
125
|
+
which <tool-name> 2>/dev/null || echo "MISSING: <tool-name>"
|
|
126
|
+
# If found, check version
|
|
127
|
+
<tool-name> --version 2>/dev/null
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Verdict:**
|
|
131
|
+
- Tool found on PATH → PASS (log version)
|
|
132
|
+
- Tool NOT found → **BLOCK** with clear install instructions per OS:
|
|
133
|
+
```
|
|
134
|
+
[ENV-XXX] Required tool '<tool>' not found on PATH
|
|
135
|
+
→ Debian/Ubuntu: sudo apt install <tool>
|
|
136
|
+
→ macOS: brew install <tool>
|
|
137
|
+
→ Windows: winget install <tool> (or choco install <tool>)
|
|
138
|
+
→ Manual: <download URL if known>
|
|
139
|
+
```
|
|
140
|
+
- This prevents the entire class of "it worked in CI but not locally" failures where `subprocess.run()` silently fails
|
|
141
|
+
|
|
114
142
|
### Step 4: Port Availability Check
|
|
115
143
|
|
|
116
144
|
Detect which ports the project needs and check if they're available:
|
|
@@ -210,6 +238,8 @@ For each finding, include a specific remediation command the developer can copy-
|
|
|
210
238
|
| .env file contains secrets — accidentally logged | CRITICAL | NEVER read .env values, only check key existence via grep for key names |
|
|
211
239
|
| Platform detection wrong — WSL vs native Windows | MEDIUM | Check for WSL explicitly (`uname -r` contains "microsoft") |
|
|
212
240
|
| Over-checking — flagging optional tools as required | MEDIUM | Only check tools evidenced by config files, not speculative |
|
|
241
|
+
| Missing hard dependency — project wraps external CLI but tool not checked | HIGH | Step 3.6: scan for `shutil.which`, `subprocess.run`, `child_process.exec` → verify tool exists on PATH |
|
|
242
|
+
| Hard dep found but wrong version — tool exists but API changed | MEDIUM | Log version for manual review. Version compatibility is project-specific — don't guess |
|
|
213
243
|
|
|
214
244
|
## Done When
|
|
215
245
|
|
|
@@ -3,7 +3,7 @@ name: skill-forge
|
|
|
3
3
|
description: Use when creating new Rune skills, editing existing skills, or verifying skill quality before deployment. Applies TDD discipline to skill authoring — test before write, verify before ship.
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.2.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: opus
|
|
9
9
|
group: creation
|
|
@@ -214,6 +214,62 @@ Run additional pressure scenarios with varied pressures. For each new failure:
|
|
|
214
214
|
|
|
215
215
|
Repeat until no new failures emerge in 2 consecutive test runs.
|
|
216
216
|
|
|
217
|
+
#### Pressure Types for Test Scenarios
|
|
218
|
+
|
|
219
|
+
Best tests combine 3+ pressures simultaneously:
|
|
220
|
+
|
|
221
|
+
| Pressure | Example Scenario |
|
|
222
|
+
|----------|------------------|
|
|
223
|
+
| Time | "Emergency deployment, deadline in 30 min" |
|
|
224
|
+
| Sunk cost | "Already wrote 200 lines, can't restart" |
|
|
225
|
+
| Authority | "Senior dev says skip testing" |
|
|
226
|
+
| Economic | "Customer churning, ship now or lose $50k MRR" |
|
|
227
|
+
| Exhaustion | "50 tool calls deep, context filling up" |
|
|
228
|
+
| Social | "Looking dogmatic by insisting on process" |
|
|
229
|
+
| Pragmatic | "Being practical vs being pedantic" |
|
|
230
|
+
|
|
231
|
+
#### Scenario Quality Requirements
|
|
232
|
+
|
|
233
|
+
1. **Concrete A/B/C options** — force explicit choice (no "I'd ask the user" escape hatch)
|
|
234
|
+
2. **Real constraints** — specific times, actual consequences, named files
|
|
235
|
+
3. **Real file paths** — `/tmp/payment-system` not "a project"
|
|
236
|
+
4. **"Make agent ACT"** — "What do you do?" not "What should you do?"
|
|
237
|
+
5. **No easy outs** — every option has a cost
|
|
238
|
+
|
|
239
|
+
#### Meta-Testing (When GREEN Isn't Working)
|
|
240
|
+
|
|
241
|
+
If the agent keeps failing even WITH the skill loaded, ask: "How could that skill have been written differently to make the correct option crystal clear?"
|
|
242
|
+
|
|
243
|
+
Three possible responses:
|
|
244
|
+
1. "Skill was clear, I chose to ignore it" → foundational principle needed (stronger HARD-GATE)
|
|
245
|
+
2. "Skill should have said X explicitly" → add that exact phrasing verbatim
|
|
246
|
+
3. "I didn't see section Y" → reorganize for discoverability (move up, add header)
|
|
247
|
+
|
|
248
|
+
#### Bulletproof Criteria
|
|
249
|
+
|
|
250
|
+
A skill is bulletproof when:
|
|
251
|
+
- Agent chooses correct option under maximum pressure (3+ pressures combined)
|
|
252
|
+
- Agent CITES skill sections as justification for its choice
|
|
253
|
+
- Agent ACKNOWLEDGES the temptation but follows the rule anyway
|
|
254
|
+
|
|
255
|
+
#### Persuasion Principles for Skill Language
|
|
256
|
+
|
|
257
|
+
Research (Meincke et al., 2025, 28,000 conversations) shows 33% → 72% compliance with these techniques:
|
|
258
|
+
|
|
259
|
+
| Principle | Application | Use For |
|
|
260
|
+
|-----------|-------------|---------|
|
|
261
|
+
| Authority | "YOU MUST", imperative language | Eliminates decision fatigue, safety-critical rules |
|
|
262
|
+
| Commitment | Explicit announcements + tracked choices | Creates accountability trail |
|
|
263
|
+
| Scarcity | Time-bound requirements, "before proceeding" | Triggers immediate action |
|
|
264
|
+
| Social Proof | "Every time", universal statements | Documents what prevents failures |
|
|
265
|
+
| Unity | "We're building quality" language | Shared identity, quality goals |
|
|
266
|
+
|
|
267
|
+
**Prohibited in skills:**
|
|
268
|
+
- **Liking** ("Great job following the process!") → creates sycophancy
|
|
269
|
+
- **Reciprocity** ("I helped you, now follow the rules") → feels manipulative
|
|
270
|
+
|
|
271
|
+
**Ethical test**: Would this serve the user's genuine interests if they fully understood the technique?
|
|
272
|
+
|
|
217
273
|
### Phase 6 — INTEGRATE
|
|
218
274
|
|
|
219
275
|
Wire the skill into the mesh:
|
package/skills/team/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ context: fork
|
|
|
5
5
|
agent: general-purpose
|
|
6
6
|
metadata:
|
|
7
7
|
author: runedev
|
|
8
|
-
version: "0.
|
|
8
|
+
version: "0.5.0"
|
|
9
9
|
layer: L1
|
|
10
10
|
model: opus
|
|
11
11
|
group: orchestrator
|
|
@@ -152,7 +152,11 @@ Mark todo[1] `in_progress`.
|
|
|
152
152
|
|
|
153
153
|
**2a. Launch parallel streams.**
|
|
154
154
|
|
|
155
|
-
Launch independent streams (depends_on: []) in parallel using Task tool with worktree isolation
|
|
155
|
+
Launch independent streams (depends_on: []) in parallel using Task tool with worktree isolation.
|
|
156
|
+
|
|
157
|
+
> From agency-agents (msitarzewski/agency-agents, 50.8k★): "Structured handoff docs prevent the #1 multi-agent failure: context loss between agents."
|
|
158
|
+
|
|
159
|
+
Each stream receives a **NEXUS Handoff Template** — not a bare prompt:
|
|
156
160
|
|
|
157
161
|
```
|
|
158
162
|
For each stream where depends_on == []:
|
|
@@ -160,22 +164,54 @@ For each stream where depends_on == []:
|
|
|
160
164
|
subagent_type: "general-purpose",
|
|
161
165
|
model: "sonnet",
|
|
162
166
|
isolation: "worktree",
|
|
163
|
-
prompt:
|
|
167
|
+
prompt: <NEXUS Handoff below>
|
|
164
168
|
)
|
|
165
169
|
```
|
|
166
170
|
|
|
171
|
+
**NEXUS Handoff Template** (sent to each cook instance):
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
## NEXUS Handoff: Stream [id]
|
|
175
|
+
|
|
176
|
+
### Metadata
|
|
177
|
+
- Stream: [id] of [total]
|
|
178
|
+
- Depends on: [none | stream ids]
|
|
179
|
+
- File ownership: [list — ONLY these files may be modified]
|
|
180
|
+
- Model: sonnet
|
|
181
|
+
|
|
182
|
+
### Context
|
|
183
|
+
- Project: [project name and type]
|
|
184
|
+
- Overall goal: [1-line feature description]
|
|
185
|
+
- This stream's goal: [specific sub-task]
|
|
186
|
+
- Conventions: [key patterns from scout — naming, file structure, test framework]
|
|
187
|
+
|
|
188
|
+
### Deliverable
|
|
189
|
+
- [ ] [specific outcome 1 — e.g., "AuthService with login/register/reset methods"]
|
|
190
|
+
- [ ] [specific outcome 2 — e.g., "Unit tests covering happy path + 3 error cases"]
|
|
191
|
+
- [ ] [specific outcome 3 — e.g., "Types exported for Phase 2 consumers"]
|
|
192
|
+
|
|
193
|
+
### Quality Expectations
|
|
194
|
+
- Tests: must pass with evidence (stdout captured)
|
|
195
|
+
- Types: no `any`, strict mode
|
|
196
|
+
- Security: no hardcoded secrets, parameterized queries
|
|
197
|
+
- Conventions: [project-specific — from scout output]
|
|
198
|
+
|
|
199
|
+
### Evidence Required
|
|
200
|
+
Return a Cook Report with:
|
|
201
|
+
- Exact files modified (git diff --stat)
|
|
202
|
+
- Test output (stdout — not just "tests pass")
|
|
203
|
+
- Any CONCERNS discovered during implementation
|
|
204
|
+
```
|
|
205
|
+
|
|
167
206
|
**2b. Launch dependent streams sequentially.**
|
|
168
207
|
|
|
169
208
|
```
|
|
170
209
|
For each stream where depends_on != []:
|
|
171
210
|
WAIT for all depends_on streams to complete.
|
|
172
|
-
Then launch:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
isolation: "worktree",
|
|
177
|
-
prompt: "Cook task: [stream.task]. Files in scope: [stream.files]. Patterns from stream [depends_on] are available in worktree. Return cook report."
|
|
178
|
-
)
|
|
211
|
+
Then launch with NEXUS Handoff that includes:
|
|
212
|
+
- Completed stream's deliverables as "Available Context"
|
|
213
|
+
- Exported interfaces/types from prior streams in "Code Contracts" section
|
|
214
|
+
- Any CONCERNS from prior streams in "Known Issues" section
|
|
179
215
|
```
|
|
180
216
|
|
|
181
217
|
**2b.5. Pre-merge scope verification.**
|
|
@@ -367,16 +403,24 @@ Mark todo[4] `completed`.
|
|
|
367
403
|
- **Duration**: [time across streams]
|
|
368
404
|
|
|
369
405
|
### Streams
|
|
370
|
-
| Stream | Task | Status |
|
|
371
|
-
|
|
372
|
-
| A | [task] |
|
|
373
|
-
| B | [task] |
|
|
374
|
-
| C | [task] |
|
|
406
|
+
| Stream | Task | Status | Deliverables | Concerns |
|
|
407
|
+
|--------|------|--------|-------------|----------|
|
|
408
|
+
| A | [task] | DONE | 3/3 delivered | None |
|
|
409
|
+
| B | [task] | DONE_WITH_CONCERNS | 2/2 delivered | Perf regression on large input |
|
|
410
|
+
| C | [task] | DONE | 2/2 delivered | None |
|
|
411
|
+
|
|
412
|
+
### Acceptance Criteria
|
|
413
|
+
| # | Criterion | Stream | Evidence | Verdict |
|
|
414
|
+
|---|-----------|--------|----------|---------|
|
|
415
|
+
| 1 | Auth endpoints return JWT | A | Test stdout: "3 passed" | PASS |
|
|
416
|
+
| 2 | No SQL injection | A | Sentinel: PASS | PASS |
|
|
417
|
+
| 3 | Dashboard loads < 2s | B | No perf test run | UNVERIFIED |
|
|
375
418
|
|
|
376
419
|
### Integration
|
|
377
420
|
- Merge conflicts: [count]
|
|
378
421
|
- Integration tests: [passed]/[total]
|
|
379
422
|
- Coverage: [%]
|
|
423
|
+
- Unresolved concerns: [count — from DONE_WITH_CONCERNS streams]
|
|
380
424
|
```
|
|
381
425
|
|
|
382
426
|
---
|
|
@@ -405,6 +449,8 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
405
449
|
| Agent modified files outside declared scope | HIGH | Pre-merge scope verification in Phase 2b.5 — flag before merge, not after |
|
|
406
450
|
| Merge failure with no rollback path | HIGH | pre-team-merge tag created before merges — git reset --hard on failure |
|
|
407
451
|
| Poisoned cook report merged blindly | HIGH | Phase 3a.5 integrity-check on all cook reports before merge |
|
|
452
|
+
| Bare prompt to cook instance — no context, conventions, or scope boundary | HIGH | NEXUS Handoff Template: structured handoff with metadata, deliverables, quality expectations, and evidence requirements |
|
|
453
|
+
| Cook returns "done" with no acceptance criteria tracking | MEDIUM | Team Report includes Acceptance Criteria table with per-criterion evidence and PASS/FAIL/UNVERIFIED verdict |
|
|
408
454
|
|
|
409
455
|
## Done When
|
|
410
456
|
|
package/skills/test/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: test
|
|
|
3
3
|
description: "TDD test writer. Writes failing tests FIRST (red), then verifies they pass after implementation (green). Covers unit, integration, and e2e tests."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.5.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: sonnet
|
|
9
9
|
group: development
|
|
@@ -168,15 +168,73 @@ Input: git diff main --name-only
|
|
|
168
168
|
Output: Prioritized test plan targeting only affected paths
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
## Test Types
|
|
171
|
+
## Test Types — 4-Layer Methodology
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
|
176
|
-
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
173
|
+
Tests are organized in 4 layers. Each layer catches a different failure class. Higher layers are slower but catch integration issues lower layers miss.
|
|
174
|
+
|
|
175
|
+
| Layer | Type | What It Catches | Framework | Speed |
|
|
176
|
+
|-------|------|-----------------|-----------|-------|
|
|
177
|
+
| L1 | **Unit** | Logic bugs, boundary violations, pure function errors | jest/vitest/pytest/cargo test | Fast |
|
|
178
|
+
| L2 | **Integration** | API contract breaks, DB query errors, service interaction failures | supertest/httpx/reqwest | Medium |
|
|
179
|
+
| L3 | **True Backend** | Real tool/service output correctness (not just exit 0) | Same + real software invocation | Medium-Slow |
|
|
180
|
+
| L4 | **E2E / Subprocess** | Full workflow from user/agent perspective, installed app works | Playwright/Cypress/subprocess | Slow |
|
|
181
|
+
|
|
182
|
+
**Layer rules:**
|
|
183
|
+
- **L1 (Unit)**: Synthetic data, no external deps. Every function tested in isolation. Fast, deterministic, CI-friendly
|
|
184
|
+
- **L2 (Integration)**: Tests service boundaries — API endpoints, DB operations, message queues. May need test DB or mock server
|
|
185
|
+
- **L3 (True Backend)**: **Invokes the REAL tool/service** and verifies output programmatically. No graceful degradation — if the dependency isn't installed, tests FAIL (not skip). Verify: magic bytes, file size > 0, content structure. Print artifact paths for manual inspection
|
|
186
|
+
- **L4 (E2E/Subprocess)**: Tests the installed command/app via subprocess or browser automation. Full user workflow: input → process → output → verify
|
|
187
|
+
|
|
188
|
+
**"No graceful degradation" rule** (L3/L4): Hard dependencies MUST be installed. Tests MUST NOT skip or produce fake results when the dependency is missing. A silently skipping test is worse than a loudly failing test.
|
|
189
|
+
|
|
190
|
+
Additional modes:
|
|
191
|
+
|
|
192
|
+
| Type | When | Speed |
|
|
193
|
+
|------|------|-------|
|
|
194
|
+
| Regression | After bug fixes | Fast |
|
|
195
|
+
| Diff-aware | After implementation, large codebases (Phase 6.5) | Fast (targeted) |
|
|
196
|
+
|
|
197
|
+
## TEST.md — Test Plan + Results Document
|
|
198
|
+
|
|
199
|
+
For non-trivial features (3+ test files or 20+ test cases), create a `TEST.md` in the test directory. This is BOTH a planning doc (written BEFORE tests) and results doc (appended AFTER tests pass).
|
|
200
|
+
|
|
201
|
+
### Before writing tests — write the plan:
|
|
202
|
+
```markdown
|
|
203
|
+
# Test Plan: [Feature Name]
|
|
204
|
+
|
|
205
|
+
## Test Inventory
|
|
206
|
+
- `test_core.py`: ~XX unit tests planned (L1)
|
|
207
|
+
- `test_integration.py`: ~XX integration tests planned (L2)
|
|
208
|
+
- `test_e2e.py`: ~XX E2E tests planned (L3/L4)
|
|
209
|
+
|
|
210
|
+
## Unit Test Plan (L1)
|
|
211
|
+
| Module | Functions | Edge Cases | Est. Tests |
|
|
212
|
+
|--------|-----------|------------|------------|
|
|
213
|
+
| `core/auth.py` | login, register, refresh | expired token, invalid creds, rate limit | 12 |
|
|
214
|
+
|
|
215
|
+
## E2E Scenarios (L3/L4)
|
|
216
|
+
| Workflow | Simulates | Operations | Verified |
|
|
217
|
+
|----------|-----------|------------|----------|
|
|
218
|
+
| User signup | New user onboarding | register → verify → login | Token valid, profile created |
|
|
219
|
+
|
|
220
|
+
## Realistic Workflow Scenarios
|
|
221
|
+
- **[Name]**: [Step 1] → [Step 2] → verify [output properties]
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### After tests pass — append results:
|
|
225
|
+
```markdown
|
|
226
|
+
## Test Results
|
|
227
|
+
[Paste full `pytest -v --tb=no` or `npm test` output]
|
|
228
|
+
|
|
229
|
+
## Summary
|
|
230
|
+
- Total: XX | Passed: XX | Failed: 0
|
|
231
|
+
- Execution time: X.Xs | Coverage: XX%
|
|
232
|
+
|
|
233
|
+
## Gaps
|
|
234
|
+
- [Areas not covered and why]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Why TEST.md**: Planning tests before code catches missing edge cases early. Appending results creates permanent evidence. One document = complete testing story.
|
|
180
238
|
|
|
181
239
|
## Error Recovery
|
|
182
240
|
|
|
@@ -271,6 +329,36 @@ If you catch yourself with ANY of these, delete implementation code and restart
|
|
|
271
329
|
- [existing test that broke, with error details]
|
|
272
330
|
```
|
|
273
331
|
|
|
332
|
+
## Testing Anti-Patterns (Gate Functions)
|
|
333
|
+
|
|
334
|
+
Before writing tests, check yourself against these 5 anti-patterns. Each has a **gate function** — a question you MUST answer before proceeding.
|
|
335
|
+
|
|
336
|
+
### Anti-Pattern 1: Testing Mock Behavior
|
|
337
|
+
Asserting that a mock exists (e.g., `testId="sidebar-mock"`) instead of testing real component behavior. You're proving the mock works, not the code.
|
|
338
|
+
**Gate**: "Am I testing real component behavior or just mock existence?" → If mock existence: STOP. Rewrite to test real behavior.
|
|
339
|
+
|
|
340
|
+
### Anti-Pattern 2: Test-Only Methods in Production
|
|
341
|
+
Adding `destroy()`, `reset()`, or `__testSetup()` methods to production classes that are ONLY called from test files. Production code should not know tests exist.
|
|
342
|
+
**Gate**: "Is this method only called by tests?" → If yes: STOP. Move to test utilities or test helper file, not production class.
|
|
343
|
+
|
|
344
|
+
### Anti-Pattern 3: Mocking Without Understanding Side Effects
|
|
345
|
+
Mocking a function without first understanding ALL its side effects. The real function may write config files, update caches, or emit events that downstream code depends on.
|
|
346
|
+
**Gate**: Before mocking, STOP and answer: "What side effects does the REAL function have? Does this test depend on any of those?" → Run with real implementation first, observe what happens, THEN add minimal mocking.
|
|
347
|
+
|
|
348
|
+
### Anti-Pattern 4: Incomplete Mocks
|
|
349
|
+
Partial mock missing fields that downstream code consumes. Your test passes because it only checks the fields you mocked, but production code reads fields your mock doesn't have → runtime crash.
|
|
350
|
+
**Iron Rule**: Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses. Examine actual API response / real data shape before writing mock.
|
|
351
|
+
|
|
352
|
+
### Anti-Pattern 5: Mock Setup Longer Than Test Logic
|
|
353
|
+
If mock setup is 30 lines and the actual test assertion is 3 lines, the test is testing infrastructure, not behavior. This is a code smell that indicates wrong abstraction level.
|
|
354
|
+
**Gate**: "Is my mock setup longer than my test logic?" → If yes: test at a higher level (integration) or extract mock factories.
|
|
355
|
+
|
|
356
|
+
**Red flags — any of these means STOP and rethink:**
|
|
357
|
+
- Mock setup longer than test logic
|
|
358
|
+
- `*-mock` test IDs in assertions
|
|
359
|
+
- Methods only called in test files
|
|
360
|
+
- Can't explain in one sentence why a mock is needed
|
|
361
|
+
|
|
274
362
|
## Sharp Edges
|
|
275
363
|
|
|
276
364
|
Known failure modes for this skill. Check these before declaring done.
|
|
@@ -279,10 +367,13 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
279
367
|
|---|---|---|
|
|
280
368
|
| Tests passing before implementation exists | CRITICAL | RED Gate: rewrite stricter tests — passing without code = not testing real behavior |
|
|
281
369
|
| Skipping the RED phase (not confirming FAIL) | HIGH | Run tests, confirm FAIL output before calling cook/fix to implement |
|
|
282
|
-
| Testing mock behavior instead of real code | HIGH |
|
|
370
|
+
| Testing mock behavior instead of real code | HIGH | Anti-Pattern 1 gate: "Am I testing real behavior or mock existence?" |
|
|
371
|
+
| Mocking without understanding side effects | HIGH | Anti-Pattern 3 gate: run with real impl first, observe side effects, THEN mock minimally |
|
|
372
|
+
| Incomplete mocks missing downstream fields | HIGH | Anti-Pattern 4 iron rule: mock COMPLETE data structure, not just fields your test checks |
|
|
283
373
|
| Coverage below 80% without filling gaps | MEDIUM | Coverage Gate: identify uncovered lines and write additional tests |
|
|
284
374
|
| Introducing a new test framework instead of using existing one | MEDIUM | Constraint 6: detect framework first, use project's existing one always |
|
|
285
375
|
| Modifying source files to make tests work | HIGH | Role boundary: test writes test files ONLY — source changes go to rune:fix |
|
|
376
|
+
| Test-only methods leaking into production code | MEDIUM | Anti-Pattern 2 gate: if method only called by tests → move to test utilities |
|
|
286
377
|
|
|
287
378
|
## Done When
|
|
288
379
|
|
|
@@ -3,7 +3,7 @@ name: verification
|
|
|
3
3
|
description: "Universal verification runner. Runs lint, type-check, tests, and build. Use after any code change to verify nothing is broken."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.5.0"
|
|
7
7
|
layer: L3
|
|
8
8
|
model: haiku
|
|
9
9
|
group: validation
|
|
@@ -233,6 +233,33 @@ Overall: [PASS/FAIL]
|
|
|
233
233
|
- Unwired: [files that failed Level 3 with 0 consumers]
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
+
## Output Completion Enforcement
|
|
237
|
+
|
|
238
|
+
> From taste-skill (Leonxlnx/taste-skill, 3.4k★): Truncated code is worse than no code — it passes reviews but breaks at runtime.
|
|
239
|
+
|
|
240
|
+
When verifying code files (Level 2 SUBSTANTIVE check), also scan for **truncation patterns** — signs that the agent generated partial output and stopped:
|
|
241
|
+
|
|
242
|
+
| Banned Pattern | Language | What It Means |
|
|
243
|
+
|---|---|---|
|
|
244
|
+
| `// ...` or `/* ... */` as a statement | JS/TS | Agent truncated remaining code |
|
|
245
|
+
| `# ...` as a statement (not comment) | Python | Agent truncated |
|
|
246
|
+
| `// rest of code` / `// remaining implementation` | Any | Explicit truncation admission |
|
|
247
|
+
| `// TODO: implement` as sole function body | Any | Placeholder, not implementation |
|
|
248
|
+
| `{ /* same as above */ }` | JS/TS | Copy-paste truncation |
|
|
249
|
+
| `...` (bare ellipsis, not spread operator) | JS/TS/Python | Truncation marker |
|
|
250
|
+
| `[PAUSED]` / `[CONTINUED]` in source | Any | Agent session marker leaked into code |
|
|
251
|
+
|
|
252
|
+
**Action on detection:**
|
|
253
|
+
- Mark file as TRUNCATED (distinct from STUB) in Verification Report
|
|
254
|
+
- TRUNCATED files are Level 2 FAIL — they CANNOT pass verification
|
|
255
|
+
- Report the specific line number and pattern detected
|
|
256
|
+
- If agent claims "done" with truncated files → REJECTED by Evidence-Before-Claims gate
|
|
257
|
+
|
|
258
|
+
**Continuation protocol** — if the agent hit output limits mid-file:
|
|
259
|
+
- Agent MUST log: `[PAUSED — X of Y functions complete]` in its response (NOT in the code file)
|
|
260
|
+
- Agent MUST resume and complete the file in the next turn
|
|
261
|
+
- Verification re-runs after completion to clear the TRUNCATED flag
|
|
262
|
+
|
|
236
263
|
## Evidence-Before-Claims Gate
|
|
237
264
|
|
|
238
265
|
<HARD-GATE>
|
|
@@ -284,6 +311,7 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
284
311
|
| Trusting exit code 0 without output verification | CRITICAL | Artifact Verification HARD-GATE: always confirm success indicator in stdout (pass count, "0 errors", output file exists) |
|
|
285
312
|
| Existence Theater — file exists but is a stub | HIGH | 3-Level check: Level 2 scans for stub patterns (`<div>Placeholder</div>`, `return null`, `NotImplementedError`) |
|
|
286
313
|
| Dead code — file created but never imported/used | MEDIUM | 3-Level check: Level 3 greps for consumers. 0 importers = UNWIRED |
|
|
314
|
+
| Truncated code — agent hit output limit mid-file | HIGH | Output Completion Enforcement: scan for `// ...`, `// rest of code`, bare ellipsis patterns. TRUNCATED = Level 2 FAIL |
|
|
287
315
|
|
|
288
316
|
## Done When
|
|
289
317
|
|