@rune-kit/rune 2.13.0 → 2.15.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 +31 -12
- package/compiler/__tests__/adapter-model-mapping.test.js +152 -0
- package/compiler/__tests__/adr-scoring.test.js +91 -0
- package/compiler/__tests__/context-md-format.test.js +180 -0
- package/compiler/__tests__/context-pack-smell-tests.test.js +215 -0
- package/compiler/__tests__/context-preview-signal.test.js +166 -0
- package/compiler/__tests__/diversity-score.test.js +117 -0
- package/compiler/__tests__/improve-architecture.test.js +171 -0
- package/compiler/__tests__/openclaw-adapter.test.js +11 -6
- package/compiler/__tests__/oracle-bundle-format.test.js +210 -0
- package/compiler/__tests__/oracle-pending-schema.test.js +209 -0
- package/compiler/__tests__/out-of-scope-format.test.js +303 -0
- package/compiler/__tests__/skill-description-quality.test.js +147 -0
- package/compiler/__tests__/zoom-out-output.test.js +112 -0
- package/compiler/adapters/antigravity.js +17 -1
- package/compiler/adapters/claude.js +4 -0
- package/compiler/adapters/codex.js +16 -1
- package/compiler/adapters/cursor.js +4 -0
- package/compiler/adapters/generic.js +14 -1
- package/compiler/adapters/openclaw.js +15 -1
- package/compiler/adapters/opencode.js +17 -1
- package/compiler/adapters/windsurf.js +4 -0
- package/package.json +2 -2
- package/skills/adversary/SKILL.md +61 -1
- package/skills/adversary/evals.md +79 -0
- package/skills/adversary/references/context-bundle-format.md +122 -0
- package/skills/adversary/references/oracle-mode.md +116 -0
- package/skills/asset-creator/SKILL.md +1 -1
- package/skills/audit/SKILL.md +3 -1
- package/skills/autopsy/SKILL.md +1 -1
- package/skills/ba/SKILL.md +242 -83
- package/skills/ba/references/context-md-format.md +136 -0
- package/skills/ba/references/explore-first.md +107 -0
- package/skills/ba/references/out-of-scope-format.md +152 -0
- package/skills/brainstorm/SKILL.md +78 -2
- package/skills/brainstorm/references/design-it-twice.md +155 -0
- package/skills/browser-pilot/SKILL.md +1 -1
- package/skills/completion-gate/SKILL.md +1 -1
- package/skills/constraint-check/SKILL.md +1 -1
- package/skills/context-engine/SKILL.md +85 -1
- package/skills/context-engine/references/preview-gate.md +139 -0
- package/skills/context-pack/SKILL.md +68 -25
- package/skills/context-pack/evals.md +122 -0
- package/skills/context-pack/references/brief-template.md +121 -0
- package/skills/context-pack/references/durability-rules.md +109 -0
- package/skills/cook/SKILL.md +5 -4
- package/skills/db/SKILL.md +1 -1
- package/skills/debug/SKILL.md +7 -4
- package/skills/dependency-doctor/SKILL.md +1 -1
- package/skills/design/SKILL.md +1 -1
- package/skills/doc-processor/SKILL.md +1 -1
- package/skills/docs/SKILL.md +1 -1
- package/skills/docs-seeker/SKILL.md +1 -1
- package/skills/fix/SKILL.md +5 -3
- package/skills/git/SKILL.md +1 -1
- package/skills/hallucination-guard/SKILL.md +1 -1
- package/skills/improve-architecture/SKILL.md +275 -0
- package/skills/improve-architecture/evals.md +145 -0
- package/skills/improve-architecture/references/deepening.md +87 -0
- package/skills/improve-architecture/references/interface-design.md +68 -0
- package/skills/improve-architecture/references/language.md +81 -0
- package/skills/improve-architecture/references/scoring.md +122 -0
- package/skills/integrity-check/SKILL.md +1 -1
- package/skills/journal/SKILL.md +34 -7
- package/skills/journal/references/adr-criteria.md +109 -0
- package/skills/logic-guardian/SKILL.md +1 -1
- package/skills/marketing/SKILL.md +1 -1
- package/skills/mcp-builder/SKILL.md +1 -1
- package/skills/onboard/SKILL.md +1 -1
- package/skills/perf/SKILL.md +1 -1
- package/skills/plan/SKILL.md +1 -1
- package/skills/preflight/SKILL.md +1 -1
- package/skills/research/SKILL.md +1 -1
- package/skills/retro/SKILL.md +1 -1
- package/skills/review/SKILL.md +3 -2
- package/skills/review-intake/SKILL.md +26 -3
- package/skills/safeguard/SKILL.md +1 -1
- package/skills/scaffold/SKILL.md +1 -1
- package/skills/scout/SKILL.md +33 -1
- package/skills/sentinel/SKILL.md +1 -1
- package/skills/sentinel-env/SKILL.md +1 -1
- package/skills/session-bridge/SKILL.md +91 -4
- package/skills/session-bridge/references/detach-protocol.md +111 -0
- package/skills/skill-forge/SKILL.md +1 -1
- package/skills/slides/SKILL.md +1 -1
- package/skills/surgeon/SKILL.md +17 -2
- package/skills/team/SKILL.md +3 -0
- package/skills/test/SKILL.md +48 -1
- package/skills/test/evals.md +137 -0
- package/skills/test/references/mocking-policy.md +121 -0
- package/skills/test/references/test-quality.md +124 -0
- package/skills/test/references/vertical-tdd.md +110 -0
- package/skills/trend-scout/SKILL.md +1 -1
- package/skills/video-creator/SKILL.md +1 -1
- package/skills/watchdog/SKILL.md +1 -1
- package/skills/worktree/SKILL.md +1 -1
package/skills/ba/SKILL.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ba
|
|
3
|
-
description: Business Analyst agent.
|
|
3
|
+
description: "Business Analyst agent. Use when starting a new feature requiring requirements elicitation BEFORE plan or cook. Asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document that plan and cook consume."
|
|
4
4
|
metadata:
|
|
5
5
|
author: runedev
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.11.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: opus
|
|
9
9
|
group: creation
|
|
10
10
|
tools: "Read, Glob, Grep"
|
|
11
|
+
emit: outofscope.match
|
|
11
12
|
---
|
|
12
13
|
|
|
13
14
|
# ba
|
|
@@ -16,6 +17,8 @@ metadata:
|
|
|
16
17
|
|
|
17
18
|
Business Analyst agent — the ROOT FIX for "Claude works a lot but produces nothing." BA forces deep understanding of WHAT to build before any code is written. It asks probing questions, identifies hidden requirements, maps stakeholders, defines scope boundaries, and produces a structured Requirements Document.
|
|
18
19
|
|
|
20
|
+
> Wrong requirements shipped correctly is the most expensive bug. BA's job is to prevent it — measure clarity (Step 2.5), measure completeness (Step 3.5), and measure cross-dimension consistency (Step 3.6) before handoff.
|
|
21
|
+
|
|
19
22
|
<HARD-GATE>
|
|
20
23
|
BA produces WHAT, not HOW. Never write code. Never plan implementation.
|
|
21
24
|
Output is a Requirements Document → hand off to rune:plan for implementation planning.
|
|
@@ -70,6 +73,58 @@ If Refactor → light version (Step 1 + Step 4 only). Skip Steps 2, 2.5, 3, 5, 6
|
|
|
70
73
|
|
|
71
74
|
If existing codebase → invoke `rune:scout` for context before proceeding.
|
|
72
75
|
|
|
76
|
+
### Step 1.5 — Out-of-Scope Match Check
|
|
77
|
+
|
|
78
|
+
Before any elicitation, check whether the request matches a concept previously rejected.
|
|
79
|
+
|
|
80
|
+
1. `Glob` `.out-of-scope/*.md` — if directory absent, skip silently.
|
|
81
|
+
2. For each file, parse YAML frontmatter (`concept`, `aliases`).
|
|
82
|
+
3. Build a token map (lowercased, split on `-` and whitespace).
|
|
83
|
+
4. Tokenize the user's request the same way.
|
|
84
|
+
5. Compute lexical overlap per concept; keep the top match's `confidence` (0.0–1.0).
|
|
85
|
+
|
|
86
|
+
**Action by confidence**:
|
|
87
|
+
|
|
88
|
+
| Confidence | Verdict | Action |
|
|
89
|
+
|------------|---------|--------|
|
|
90
|
+
| ≥ 0.8 | exact-match | Surface to user: *"This matches a prior rejection (`.out-of-scope/<slug>.md`) — closed because [body's "Why out of scope" first sentence]. Do you still feel the same way?"* Pause for user response before continuing. |
|
|
91
|
+
| 0.5 – 0.79 | similar | Mention inline: *"This is similar to a prior rejection (`<slug>`). Would you like to review it before we proceed?"* Continue regardless of answer. |
|
|
92
|
+
| < 0.5 | no-match | Continue silently, no user-facing mention. |
|
|
93
|
+
|
|
94
|
+
Emit `outofscope.match` signal with `{concept, confidence, verdict}` so downstream skills (cook, plan) inherit the context.
|
|
95
|
+
|
|
96
|
+
If verdict is exact-match AND user says "yes I still want it" → record their override reason in the Requirements Document `## Risks` section AND mark `priority_to_revisit: high` in the existing `.out-of-scope/<slug>.md` (do NOT delete the file). The override forces the candidate up the revisit ladder; it doesn't erase the prior decision.
|
|
97
|
+
|
|
98
|
+
If verdict is exact-match AND user accepts the prior rejection → end the BA session with a one-line summary referencing the file. No further questions.
|
|
99
|
+
|
|
100
|
+
Format reference: [references/out-of-scope-format.md](references/out-of-scope-format.md).
|
|
101
|
+
|
|
102
|
+
### Step 2.0 — Explore-First Pre-Check (HARD-GATE)
|
|
103
|
+
|
|
104
|
+
Before emitting ANY of the 5 elicitation questions, run the 4-item pre-check on each intended question:
|
|
105
|
+
|
|
106
|
+
1. Is the answer in `package.json` / `pyproject.toml` / `Cargo.toml` / `go.mod` / `pom.xml`?
|
|
107
|
+
2. Is the answer in `README.md` / `CLAUDE.md` / `docs/`?
|
|
108
|
+
3. Is it inferable from file extensions, directory structure, or config files?
|
|
109
|
+
4. Has the user answered it earlier in this conversation?
|
|
110
|
+
|
|
111
|
+
<HARD-GATE>
|
|
112
|
+
For every question Q the agent intends to ask, there MUST be prior tool-call evidence in the same session:
|
|
113
|
+
- At least 1 Read / Glob / Grep related to Q's domain, OR
|
|
114
|
+
- Explicit declaration: "Q cannot be answered from project artifacts because [specific reason]."
|
|
115
|
+
Without one of these, Q is BLOCKED — re-route to inference.
|
|
116
|
+
</HARD-GATE>
|
|
117
|
+
|
|
118
|
+
The gate is "tried to infer" — not "must succeed in inferring." If the file genuinely doesn't have the answer, the attempt itself is the gate.
|
|
119
|
+
|
|
120
|
+
Cache inferred answers in the requirements doc:
|
|
121
|
+
```
|
|
122
|
+
**Inferred from package.json**: TypeScript 5.4, Next.js 14.2, React 18.3
|
|
123
|
+
**Inferred from .github/workflows/**: CI runs on PRs targeting main
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Worked examples + edge cases: [references/explore-first.md](references/explore-first.md).
|
|
127
|
+
|
|
73
128
|
### Step 2 — Requirement Elicitation (the "5 Questions")
|
|
74
129
|
|
|
75
130
|
Ask exactly 5 probing questions, ONE AT A TIME (not all at once):
|
|
@@ -195,6 +250,23 @@ Clarity Score: [100 - ambiguity]%
|
|
|
195
250
|
Status: ACCEPTABLE (ambiguity 23%) — proceeding with noted gaps
|
|
196
251
|
```
|
|
197
252
|
|
|
253
|
+
### Step 2.6 — CONTEXT.md Cross-Reference Gate
|
|
254
|
+
|
|
255
|
+
After elicitation, before hidden-requirement discovery, scan the user's answers for assertions about *current behavior* — phrasings like "the system X", "the code does X", "we already X", "right now it X".
|
|
256
|
+
|
|
257
|
+
For each such assertion:
|
|
258
|
+
|
|
259
|
+
1. `Grep` the codebase for evidence (function names, route handlers, schema definitions matching the asserted behavior).
|
|
260
|
+
2. Compare grep results to the user's claim.
|
|
261
|
+
|
|
262
|
+
| Outcome | Action |
|
|
263
|
+
|---------|--------|
|
|
264
|
+
| Grep confirms claim | Proceed; record term in CONTEXT.md if domain-relevant |
|
|
265
|
+
| Grep contradicts claim | <HARD-GATE>Surface the conflict immediately. *"You said the system does X, but the code path I see does Y. Which is canonical?"* Pause until resolved.</HARD-GATE> |
|
|
266
|
+
| Grep returns nothing | Note as unverified; ask user for the file/function name; do not record in CONTEXT.md until verified |
|
|
267
|
+
|
|
268
|
+
This gate prevents the agent from silently transcribing user-asserted behavior that contradicts code — a common source of "the docs say X but the code does Y" drift.
|
|
269
|
+
|
|
198
270
|
### Step 3 — Hidden Requirement Discovery
|
|
199
271
|
|
|
200
272
|
After the 5 questions, analyze for requirements the user DIDN'T mention:
|
|
@@ -243,6 +315,53 @@ When presenting options, alternatives, or scope decisions to the user, rate each
|
|
|
243
315
|
**Anti-pattern**: "Choose B — it covers 90% of the value with less code." → If A is only 70 lines more, choose A. The last 10% is where production bugs hide.
|
|
244
316
|
|
|
245
317
|
|
|
318
|
+
### Step 3.6 — Logic Consistency Check
|
|
319
|
+
|
|
320
|
+
After ambiguity + completeness pass, scan for **cross-dimension contradictions**. Ambiguity measures CLARITY of each dimension in isolation; this step measures CONSISTENCY across dimensions. A perfectly clear requirement can still contradict itself.
|
|
321
|
+
|
|
322
|
+
#### Checks
|
|
323
|
+
|
|
324
|
+
Run each, label verdict 🟢 pass / 🟡 warn / 🔴 fail:
|
|
325
|
+
|
|
326
|
+
| # | Check | 🔴 Fail | 🟢 Pass |
|
|
327
|
+
|---|-------|---------|---------|
|
|
328
|
+
| 1 | Every Acceptance Criterion traces to a User Story | AC orphaned | 1:N mapping clear |
|
|
329
|
+
| 2 | Every Business Rule (Q5) is enforced in an AC or Exception Flow | Rule has no enforcement path | Rule → specific AC or exception |
|
|
330
|
+
| 3 | Scope IN ∩ Scope OUT = ∅ | Direct overlap in phrasing | Sets disjoint |
|
|
331
|
+
| 4 | Every user-story flow has a terminal state | State loop without exit condition | Terminal state explicit |
|
|
332
|
+
| 5 | Dependencies (Step 4) ⊂ Constraints acknowledged (Q5) | Dependency never mentioned in constraints | All deps covered |
|
|
333
|
+
| 6 | NFRs measurable against at least one AC | NFR has no test hook | Every NFR → testable AC |
|
|
334
|
+
| 7 | Hidden requirements (Step 3) resolved in/out | Silent inclusion | User confirmed inclusion or exclusion |
|
|
335
|
+
| 0 | Prior rejection check (Step 1.5) — exact-match resolved with explicit override or session ended | Silent re-litigation of rejected concept | User chose: override (priority bumped) OR accept prior decision (session ends) |
|
|
336
|
+
|
|
337
|
+
#### Output Format
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
Logic Consistency Report:
|
|
341
|
+
1. AC → User Story: 🟢 all AC trace to US-1 or US-2
|
|
342
|
+
2. Business rule → AC: 🟡 "no duplicate emails" cited — exception flow missing
|
|
343
|
+
3. Scope disjoint: 🟢
|
|
344
|
+
4. Terminal states: 🟢
|
|
345
|
+
5. Deps in constraints: 🔴 "PostgreSQL 15" missing from Q5 answer
|
|
346
|
+
6. NFR measurable: 🟢
|
|
347
|
+
7. Hidden reqs resolved: 🟢
|
|
348
|
+
|
|
349
|
+
Verdict: 1 🔴, 1 🟡, 5 🟢 → BLOCK handoff until 🔴 fixed
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### Gate Rule
|
|
353
|
+
|
|
354
|
+
| Result | Action |
|
|
355
|
+
|--------|--------|
|
|
356
|
+
| 0 🔴 | Proceed to Step 4 — 🟡 warnings become "Risks" in Requirements Doc |
|
|
357
|
+
| 1-2 🔴 | BLOCK — ask targeted question or re-scope to resolve each 🔴 |
|
|
358
|
+
| 3+ 🔴 | Scrap Steps 2-3 and restart — requirements structurally incoherent |
|
|
359
|
+
|
|
360
|
+
<HARD-GATE>
|
|
361
|
+
NEVER hand off to plan with unresolved 🔴. Ambiguity ≤ 40% does not imply consistency — they are orthogonal gates.
|
|
362
|
+
If user pushes "just build it" with 🔴 present, respond: "Contradiction in [dimension]: [specific conflict]. One clarification fixes this: [targeted question]"
|
|
363
|
+
</HARD-GATE>
|
|
364
|
+
|
|
246
365
|
### Step 4 — Scope Definition
|
|
247
366
|
|
|
248
367
|
Based on all gathered information, produce:
|
|
@@ -330,9 +449,19 @@ For product-oriented requirements (Feature Request, Integration, Greenfield), ge
|
|
|
330
449
|
- Every tier includes "Risk if skipped" — makes trade-offs explicit
|
|
331
450
|
- Skip this step for Bug Fix and Refactor types (no strategic dimension)
|
|
332
451
|
|
|
333
|
-
### Step 7 —
|
|
452
|
+
### Step 7 — Artifact Triad
|
|
334
453
|
|
|
335
|
-
Produce structured
|
|
454
|
+
Produce three structured artifacts — not one prose doc. Plan consumes all three; each answers a different question.
|
|
455
|
+
|
|
456
|
+
| Artifact | Question Answered | Consumer |
|
|
457
|
+
|----------|-------------------|----------|
|
|
458
|
+
| `requirements.md` | WHAT to build and WHY | plan, cook |
|
|
459
|
+
| `requirements.mermaid` | WHAT does the flow look like visually | plan, design, review |
|
|
460
|
+
| `tasks.md` | WHAT work layers exist | plan (as task backbone, not from scratch) |
|
|
461
|
+
|
|
462
|
+
#### Artifact 1: requirements.md
|
|
463
|
+
|
|
464
|
+
Structured document combining Steps 1-6.5. Save to `.rune/features/<feature-name>/requirements.md`:
|
|
336
465
|
|
|
337
466
|
```markdown
|
|
338
467
|
# Requirements Document: [Feature Name]
|
|
@@ -350,11 +479,8 @@ Created: [date] | BA Session: [summary]
|
|
|
350
479
|
|
|
351
480
|
## Scope
|
|
352
481
|
### In Scope
|
|
353
|
-
[from Step 4]
|
|
354
482
|
### Out of Scope
|
|
355
|
-
[from Step 4]
|
|
356
483
|
### Assumptions
|
|
357
|
-
[from Step 4]
|
|
358
484
|
|
|
359
485
|
## Non-Functional Requirements
|
|
360
486
|
[from Step 6]
|
|
@@ -368,101 +494,119 @@ Created: [date] | BA Session: [summary]
|
|
|
368
494
|
## Strategic Recommendations
|
|
369
495
|
[from Step 6.5 — skip for Bug Fix/Refactor]
|
|
370
496
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
- **Resources**: [effort estimate]
|
|
374
|
-
- **Expected Impact**: [measurable outcome]
|
|
375
|
-
|
|
376
|
-
### Differentiation (1-3 months)
|
|
377
|
-
- **Action**: [...]
|
|
378
|
-
- **Resources**: [...]
|
|
379
|
-
- **Expected Impact**: [...]
|
|
380
|
-
|
|
381
|
-
### Long-term Moat (6-12 months)
|
|
382
|
-
- **Action**: [...]
|
|
383
|
-
- **Resources**: [...]
|
|
384
|
-
- **Expected Impact**: [...]
|
|
497
|
+
## Logic Consistency Report
|
|
498
|
+
[from Step 3.6 — verbatim, for audit trail]
|
|
385
499
|
|
|
386
500
|
## Next Step
|
|
387
|
-
→ Hand off to rune:plan
|
|
501
|
+
→ Hand off to rune:plan (consumes all 3 artifacts)
|
|
388
502
|
```
|
|
389
503
|
|
|
390
|
-
|
|
504
|
+
#### Artifact 2: requirements.mermaid
|
|
391
505
|
|
|
392
|
-
|
|
506
|
+
Auto-generate from User Stories. Save to `.rune/features/<feature-name>/requirements.mermaid`.
|
|
507
|
+
|
|
508
|
+
**Sequence diagram** (primary happy path from US-1):
|
|
393
509
|
|
|
510
|
+
```mermaid
|
|
511
|
+
sequenceDiagram
|
|
512
|
+
actor User
|
|
513
|
+
participant System
|
|
514
|
+
participant Database
|
|
515
|
+
User->>System: [action from US-1]
|
|
516
|
+
System->>Database: [read/write from AC-1.1]
|
|
517
|
+
Database-->>System: [response]
|
|
518
|
+
System-->>User: [result from AC-1.1]
|
|
394
519
|
```
|
|
395
|
-
# Requirements Document: [Feature Name]
|
|
396
|
-
Created: [date] | BA Session: [summary]
|
|
397
520
|
|
|
398
|
-
|
|
399
|
-
[Problem statement — 2-3 sentences]
|
|
521
|
+
**State machine** (only if any User Story implies state):
|
|
400
522
|
|
|
401
|
-
|
|
402
|
-
-
|
|
403
|
-
|
|
523
|
+
```mermaid
|
|
524
|
+
stateDiagram-v2
|
|
525
|
+
[*] --> initial
|
|
526
|
+
initial --> processing: [trigger from AC]
|
|
527
|
+
processing --> success: [happy path AC]
|
|
528
|
+
processing --> failed: [error AC]
|
|
529
|
+
success --> [*]
|
|
530
|
+
failed --> initial: retry
|
|
531
|
+
```
|
|
404
532
|
|
|
405
|
-
|
|
406
|
-
US-1: As a [persona], I want to [action] so that [benefit]
|
|
407
|
-
AC-1.1: GIVEN [context] WHEN [action] THEN [result]
|
|
408
|
-
AC-1.2: GIVEN [error case] WHEN [action] THEN [error handling]
|
|
533
|
+
Skip state machine if feature is stateless (simple CRUD with no lifecycle). Sequence is always produced.
|
|
409
534
|
|
|
410
|
-
|
|
411
|
-
### In Scope
|
|
412
|
-
- [feature/behavior 1]
|
|
413
|
-
- [feature/behavior 2]
|
|
414
|
-
### Out of Scope
|
|
415
|
-
- [explicitly excluded 1]
|
|
416
|
-
### Assumptions
|
|
417
|
-
- [assumption — risk if wrong]
|
|
535
|
+
#### Artifact 3: tasks.md
|
|
418
536
|
|
|
419
|
-
|
|
420
|
-
| NFR | Requirement | Measurement |
|
|
421
|
-
|-----|-------------|-------------|
|
|
422
|
-
| [Performance/Security/etc.] | [specific target] | [how to verify] |
|
|
537
|
+
Pre-broken implementation tasks by layer. Plan refines this backbone, does not create from scratch. Save to `.rune/features/<feature-name>/tasks.md`:
|
|
423
538
|
|
|
424
|
-
|
|
425
|
-
|
|
539
|
+
```markdown
|
|
540
|
+
# Implementation Tasks: [Feature Name]
|
|
541
|
+
|
|
542
|
+
## Data Layer
|
|
543
|
+
- [ ] Schema — [tables/models from AC]
|
|
544
|
+
- [ ] Migration up + down
|
|
545
|
+
- [ ] Seed/fixtures if tests need them
|
|
546
|
+
|
|
547
|
+
## Logic Layer
|
|
548
|
+
- [ ] [each Q5 Business Rule → one task]
|
|
549
|
+
- [ ] Validation for [each AC error case]
|
|
550
|
+
- [ ] State transitions from requirements.mermaid (if present)
|
|
551
|
+
|
|
552
|
+
## Interface Layer (API / UI)
|
|
553
|
+
- [ ] [each User Story → one endpoint or UI component]
|
|
554
|
+
- [ ] Contract schema from AC (request/response)
|
|
555
|
+
- [ ] Error handling for [each AC error]
|
|
556
|
+
|
|
557
|
+
## Test Layer
|
|
558
|
+
- [ ] Unit: [each business rule → one test]
|
|
559
|
+
- [ ] Integration: [each AC happy path]
|
|
560
|
+
- [ ] Regression: [each AC error case]
|
|
561
|
+
|
|
562
|
+
## NFR Verification
|
|
563
|
+
- [ ] [each NFR from Step 6 → one measurement task]
|
|
564
|
+
```
|
|
426
565
|
|
|
427
|
-
|
|
428
|
-
-
|
|
566
|
+
Derivation rules:
|
|
567
|
+
- 1 User Story → ≥1 Interface task
|
|
568
|
+
- 1 Business Rule → 1 Logic task + 1 Unit test task
|
|
569
|
+
- 1 AC → ≥1 Test task (happy path + error)
|
|
570
|
+
- 1 NFR → 1 NFR Verification task
|
|
429
571
|
|
|
430
|
-
|
|
572
|
+
#### Handoff
|
|
431
573
|
|
|
432
|
-
|
|
433
|
-
|----------|---------|---------|
|
|
434
|
-
| **Decisions** (locked) | User confirmed — agent MUST follow | "Use PostgreSQL, not MongoDB" |
|
|
435
|
-
| **Discretion** (agent decides) | User trusts agent judgment | "Pick the best validation library" |
|
|
436
|
-
| **Deferred** (out of scope) | Explicitly NOT this task | "Mobile app — future phase" |
|
|
574
|
+
Emit signal to `plan` with paths to all three artifacts. Plan MUST read all three before producing phase files — the triad is the contract.
|
|
437
575
|
|
|
438
|
-
|
|
576
|
+
### Step 7.5 — Glossary Sharpen (CONTEXT.md update)
|
|
439
577
|
|
|
440
|
-
|
|
441
|
-
[Skip for Bug Fix/Refactor]
|
|
578
|
+
After the artifact triad is saved, append/update the project glossary `CONTEXT.md` with any domain terms that were sharpened during this session.
|
|
442
579
|
|
|
443
|
-
|
|
444
|
-
-
|
|
445
|
-
-
|
|
446
|
-
-
|
|
447
|
-
-
|
|
580
|
+
1. Determine glossary location:
|
|
581
|
+
- If `CONTEXT-MAP.md` exists at root → multi-context; pick the right per-context CONTEXT.md
|
|
582
|
+
- Else if root `CONTEXT.md` exists → use it
|
|
583
|
+
- Else if any term needs recording → create root `CONTEXT.md` lazily
|
|
584
|
+
- Else → skip silently (no-op when no terms emerged)
|
|
585
|
+
2. For each new term, add a row to the **Language** table (term, definition, aliases-to-avoid, status).
|
|
586
|
+
3. For each user-asserted relationship, add to the **Relationships** section.
|
|
587
|
+
4. For each ambiguity surfaced during elicitation, add to **Flagged ambiguities**.
|
|
448
588
|
|
|
449
|
-
|
|
450
|
-
- **Action**: [competitive advantage work]
|
|
451
|
-
- **Resources**: [...]
|
|
452
|
-
- **Expected Impact**: [...]
|
|
453
|
-
- **Risk if skipped**: [...]
|
|
589
|
+
**Conflict gate** — if a new term has ≥0.7 token overlap with an existing one, surface to user (merge / rename / keep distinct). NEVER silently re-define an existing term.
|
|
454
590
|
|
|
455
|
-
|
|
456
|
-
- **Action**: [defensible position work]
|
|
457
|
-
- **Resources**: [...]
|
|
458
|
-
- **Expected Impact**: [...]
|
|
459
|
-
- **Risk if skipped**: [...]
|
|
591
|
+
Format reference: [references/context-md-format.md](references/context-md-format.md).
|
|
460
592
|
|
|
461
|
-
##
|
|
462
|
-
|
|
463
|
-
|
|
593
|
+
## Output Format
|
|
594
|
+
|
|
595
|
+
Triad of artifacts under `.rune/features/<feature-name>/`:
|
|
596
|
+
|
|
597
|
+
| File | Template Reference |
|
|
598
|
+
|------|-------------------|
|
|
599
|
+
| `requirements.md` | Step 7 Artifact 1 |
|
|
600
|
+
| `requirements.mermaid` | Step 7 Artifact 2 (sequence + optional state machine) |
|
|
601
|
+
| `tasks.md` | Step 7 Artifact 3 (Data / Logic / Interface / Test / NFR layers) |
|
|
464
602
|
|
|
465
|
-
|
|
603
|
+
Inside `requirements.md` the **Decision Classification** table MUST appear verbatim — plan gates on Decision compliance, Discretion items skip approval:
|
|
604
|
+
|
|
605
|
+
| Category | Meaning | Example |
|
|
606
|
+
|----------|---------|---------|
|
|
607
|
+
| **Decisions** (locked) | User confirmed — agent MUST follow | "Use PostgreSQL, not MongoDB" |
|
|
608
|
+
| **Discretion** (agent decides) | User trusts agent judgment | "Pick the best validation library" |
|
|
609
|
+
| **Deferred** (out of scope) | Explicitly NOT this task | "Mobile app — future phase" |
|
|
466
610
|
|
|
467
611
|
## Constraints
|
|
468
612
|
|
|
@@ -482,9 +626,10 @@ Saved to `.rune/features/<feature-name>/requirements.md`
|
|
|
482
626
|
| Artifact | Format | Location |
|
|
483
627
|
|----------|--------|----------|
|
|
484
628
|
| Requirements document | Markdown | `.rune/features/<feature-name>/requirements.md` |
|
|
485
|
-
|
|
|
486
|
-
|
|
|
487
|
-
|
|
|
629
|
+
| Visual model | Mermaid (sequence + optional state machine) | `.rune/features/<feature-name>/requirements.mermaid` |
|
|
630
|
+
| Implementation task backbone | Markdown checklist by layer | `.rune/features/<feature-name>/tasks.md` |
|
|
631
|
+
| Logic Consistency Report | Markdown section | Embedded in requirements.md |
|
|
632
|
+
| Ambiguity + Completeness scores | Markdown display blocks | Embedded in requirements.md |
|
|
488
633
|
|
|
489
634
|
## Sharp Edges
|
|
490
635
|
|
|
@@ -508,6 +653,18 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
508
653
|
| Skipping ambiguity scoring because "user seems clear" | HIGH | Always compute the score — perceived clarity ≠ measured clarity. The formula catches gaps humans miss |
|
|
509
654
|
| Tiered recommendations too vague ("improve things") | MEDIUM | Each tier needs specific Action + measurable Expected Impact. "Build better UX" → "Reduce checkout steps from 5 to 3, targeting 15% conversion lift" |
|
|
510
655
|
| All three tiers have same resources/effort | MEDIUM | Quick Win should be low-effort. If all tiers need "2 engineers, 3 months" → re-scope Quick Win to something achievable in 1 sprint |
|
|
656
|
+
| Skipping Logic Consistency check because ambiguity is low | CRITICAL | Step 3.6 HARD-GATE: clarity ≠ consistency. A 90% clarity spec can still contain pairwise contradictions (scope IN/OUT overlap, rules with no enforcement, orphan ACs) |
|
|
657
|
+
| Handing off to plan with unresolved 🔴 consistency fails | CRITICAL | Step 3.6 gate: 1+ 🔴 = BLOCK. 🟡 allowed only when logged as Risk in requirements.md |
|
|
658
|
+
| Producing only requirements.md, skipping mermaid and tasks.md | HIGH | Step 7 is a triad — plan's contract expects all 3. Sequence diagram is always produced; state machine only if stateful; tasks.md always produced |
|
|
659
|
+
| Mermaid diagram unrelated to actual user stories (decorative only) | MEDIUM | Sequence must trace AC-1.1 of US-1; state machine nodes must map to state-bearing ACs. Auditable by pattern-match |
|
|
660
|
+
| tasks.md as flat list instead of layered | MEDIUM | Derivation rules enforce 1 US → Interface task, 1 rule → Logic + Unit test, 1 AC → Test task, 1 NFR → verification. Skipping layers loses plan's backbone structure |
|
|
661
|
+
| Re-litigating a previously rejected concept without surfacing it | HIGH | Step 1.5 HARD-GATE: scan `.out-of-scope/` first; exact match (≥0.8) MUST be surfaced before elicitation begins |
|
|
662
|
+
| Skipping Step 1.5 because `.out-of-scope/` directory looks empty | MEDIUM | Empty directory is silent-skip OK; directory absent entirely is silent-skip OK; never skip due to "I don't think this matches anything" — let the matcher decide |
|
|
663
|
+
| User asserts behavior; agent records user's version without grep verification | HIGH | Step 2.6 HARD-GATE: every "the system does X" assertion gets grep'd; conflicts surface to user before recording |
|
|
664
|
+
| Silently re-defining an existing CONTEXT.md term | HIGH | Step 7.5 conflict gate: ≥0.7 overlap → user chooses merge/rename/keep-distinct |
|
|
665
|
+
| Auto-creating an empty CONTEXT.md when no terms emerged | LOW | Lazy creation rule: only write when there's a non-trivial term to record |
|
|
666
|
+
| Asking inferable questions ("what stack are you using?") without first checking package.json | HIGH | Step 2.0 HARD-GATE — every question requires prior tool-call evidence (Read/Glob/Grep) or explicit unavailability declaration |
|
|
667
|
+
| Re-asking a question already answered earlier in the conversation | MEDIUM | Step 2.0 check 4 — cache and reuse, never re-ask |
|
|
511
668
|
|
|
512
669
|
## Done When
|
|
513
670
|
|
|
@@ -518,8 +675,10 @@ Known failure modes for this skill. Check these before declaring done.
|
|
|
518
675
|
- Scope defined (in/out/assumptions/dependencies)
|
|
519
676
|
- User stories with testable acceptance criteria produced
|
|
520
677
|
- Non-functional requirements assessed (relevant ones only)
|
|
678
|
+
- Logic Consistency Report produced — 0 🔴 before handoff (🟡 logged as Risks)
|
|
521
679
|
- Tiered recommendations generated (Quick Win / Differentiation / Moat) — skip for Bug Fix/Refactor
|
|
522
|
-
-
|
|
680
|
+
- Artifact triad saved: `requirements.md` + `requirements.mermaid` + `tasks.md`
|
|
681
|
+
- Out-of-scope match check completed (verdict logged: no-match | similar | exact-match-overridden | exact-match-accepted)
|
|
523
682
|
- Handed off to `plan` for implementation planning
|
|
524
683
|
|
|
525
684
|
## Cost Profile
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# CONTEXT.md — Project Glossary Format
|
|
2
|
+
|
|
3
|
+
Persistent vocabulary for the project's domain — what nouns mean, how concepts relate, which words are aliases of which. Lives at the repo root (or per-bounded-context root in multi-context repos).
|
|
4
|
+
|
|
5
|
+
## Where it lives
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<repo-root>/
|
|
9
|
+
├── CONTEXT.md ← single-context repo
|
|
10
|
+
└── src/
|
|
11
|
+
|
|
12
|
+
# OR for multi-context repos:
|
|
13
|
+
<repo-root>/
|
|
14
|
+
├── CONTEXT-MAP.md ← lists each context + relationships
|
|
15
|
+
└── src/
|
|
16
|
+
├── ordering/CONTEXT.md
|
|
17
|
+
└── billing/CONTEXT.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If `CONTEXT-MAP.md` exists at root, the repo has multiple contexts; otherwise it's single-context.
|
|
21
|
+
|
|
22
|
+
## Lazy creation
|
|
23
|
+
|
|
24
|
+
CONTEXT.md is created **only when there's a non-trivial term to record**. Empty file = bad signal. Absent file = silent OK.
|
|
25
|
+
|
|
26
|
+
`ba` checks via Glob; absence is **not** flagged as a project gap. Don't suggest "you should create one." Wait until a term needs sharpening.
|
|
27
|
+
|
|
28
|
+
## Format
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
# Project Glossary
|
|
32
|
+
|
|
33
|
+
One-line description of what this project is and why this glossary exists.
|
|
34
|
+
|
|
35
|
+
## Language
|
|
36
|
+
|
|
37
|
+
| Term | Definition | Aliases to avoid | Status |
|
|
38
|
+
|------|------------|-------------------|--------|
|
|
39
|
+
| **Order** | A customer's request to purchase items | Purchase, transaction | canonical |
|
|
40
|
+
| **Invoice** | A request for payment sent after delivery | Bill, payment request | canonical |
|
|
41
|
+
| **Customer** | A person or organization that places orders | Client, buyer, account | canonical |
|
|
42
|
+
| **User** | An authentication identity in the system | Login, account | canonical |
|
|
43
|
+
|
|
44
|
+
## Relationships
|
|
45
|
+
|
|
46
|
+
- An **Order** produces one or more **Invoices**
|
|
47
|
+
- An **Invoice** belongs to exactly one **Customer**
|
|
48
|
+
- A **Customer** may or may not be a **User** (guests can place orders)
|
|
49
|
+
|
|
50
|
+
## Example dialogue
|
|
51
|
+
|
|
52
|
+
> **Dev:** "When a **Customer** places an **Order**, do we create the **Invoice** immediately?"
|
|
53
|
+
> **Domain expert:** "No — an **Invoice** is generated once a **Fulfillment** is confirmed. A single **Order** can produce multiple **Invoices** if items ship in separate **Shipments**."
|
|
54
|
+
|
|
55
|
+
## Flagged ambiguities
|
|
56
|
+
|
|
57
|
+
- "account" was used for both **Customer** and **User** — resolved: distinct concepts. **Customer** places orders; **User** is an authentication identity.
|
|
58
|
+
- "transaction" sometimes meant **Order** and sometimes **Payment** — resolved: avoid the word entirely.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Term schema
|
|
62
|
+
|
|
63
|
+
Each row in the **Language** table:
|
|
64
|
+
|
|
65
|
+
| Column | Required | Description |
|
|
66
|
+
|--------|----------|-------------|
|
|
67
|
+
| Term | ✅ | Bold, kebab-case-friendly singular noun (or short phrase) |
|
|
68
|
+
| Definition | ✅ | One sentence. Defines what it IS, not what it does. |
|
|
69
|
+
| Aliases to avoid | optional | Other words the team has used; agents and humans must avoid them in code, comments, and conversation |
|
|
70
|
+
| Status | ✅ | `canonical` (settled) \| `pending` (waiting on domain-expert confirmation) \| `conflicted` (active disagreement, needs resolution) |
|
|
71
|
+
|
|
72
|
+
## Update protocol
|
|
73
|
+
|
|
74
|
+
### Inline sharpen (during a BA session)
|
|
75
|
+
|
|
76
|
+
When the user uses a term whose meaning is ambiguous, propose a precise canonical version. When confirmed, update CONTEXT.md right there. Don't batch.
|
|
77
|
+
|
|
78
|
+
> "You used 'account' twice — once meaning **Customer** (the person ordering), once meaning **User** (the login). I'll record these as distinct in CONTEXT.md."
|
|
79
|
+
|
|
80
|
+
### Cross-reference (HARD-GATE)
|
|
81
|
+
|
|
82
|
+
When the user asserts behavior — "the system cancels Orders when X" — `ba` MUST grep the codebase to verify before recording in CONTEXT.md. If grep contradicts the user, surface the conflict and ask which is canonical.
|
|
83
|
+
|
|
84
|
+
> User: "Yes, partial cancellation is supported."
|
|
85
|
+
> Agent (after grepping `src/orders/cancel.ts`): "The code path I see only handles full cancellation (`cancel(orderId)` returns `Order` with status `cancelled`, no partial-quantity argument). Either the code is incomplete, or partial cancellation isn't implemented yet. Which is the canonical behavior?"
|
|
86
|
+
|
|
87
|
+
This gate stops AI agents from silently recording user-asserted behavior that contradicts the code — a frequent source of "the docs say X but the code does Y" drift.
|
|
88
|
+
|
|
89
|
+
### Conflict gate
|
|
90
|
+
|
|
91
|
+
When a new term has ≥0.7 token overlap with an existing one, force a user choice:
|
|
92
|
+
|
|
93
|
+
| Choice | Action |
|
|
94
|
+
|--------|--------|
|
|
95
|
+
| Merge | Combine the new term's aliases into the existing entry |
|
|
96
|
+
| Rename | Pick a distinct slug for the new term |
|
|
97
|
+
| Keep distinct | Confirm the overlap is coincidental; record both |
|
|
98
|
+
|
|
99
|
+
Agents must NOT silently re-define existing terms.
|
|
100
|
+
|
|
101
|
+
## Single vs multi-context
|
|
102
|
+
|
|
103
|
+
**Single context (most repos)**: one `CONTEXT.md` at the repo root.
|
|
104
|
+
|
|
105
|
+
**Multiple contexts**: a `CONTEXT-MAP.md` at the root lists where each context lives:
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
# Context Map
|
|
109
|
+
|
|
110
|
+
## Contexts
|
|
111
|
+
|
|
112
|
+
- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders
|
|
113
|
+
- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments
|
|
114
|
+
|
|
115
|
+
## Relationships
|
|
116
|
+
|
|
117
|
+
- **Ordering → Billing**: Ordering emits `OrderPlaced` events; Billing consumes them
|
|
118
|
+
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`ba` infers structure:
|
|
122
|
+
- If `CONTEXT-MAP.md` exists → multi-context; read it to find the right CONTEXT.md
|
|
123
|
+
- If only root `CONTEXT.md` exists → single-context
|
|
124
|
+
- If neither exists → silent skip; create root CONTEXT.md lazily on first term resolution
|
|
125
|
+
|
|
126
|
+
## What does NOT belong in CONTEXT.md
|
|
127
|
+
|
|
128
|
+
- Generic programming concepts (timeouts, error types, function signatures) — these aren't domain terms.
|
|
129
|
+
- Module / class names — they belong in code, not glossary, unless they have meaning to a domain expert.
|
|
130
|
+
- Implementation details — CONTEXT.md is the *what* (concept), not the *how* (data shape).
|
|
131
|
+
|
|
132
|
+
Before adding a term, ask: would a non-engineer domain expert recognize this and care? If no, don't add it.
|
|
133
|
+
|
|
134
|
+
## Relationship to CLAUDE.md
|
|
135
|
+
|
|
136
|
+
CLAUDE.md describes *how to work in this repo* — conventions, danger zones, deploy commands. CONTEXT.md describes *what these words mean* — the domain glossary. The scopes are mutually exclusive; never duplicate.
|