@rune-kit/rune 2.2.3 → 2.2.6

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.
@@ -3,7 +3,7 @@ name: preflight
3
3
  description: Pre-commit quality gate that catches "almost right" code. Goes beyond linting — checks logic correctness, error handling, regressions, and completeness.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -158,6 +158,52 @@ Verify that new code ships complete:
158
158
 
159
159
  If any completeness item is missing, flag as **WARN** with: what is missing, which file needs it.
160
160
 
161
+ ### Step 4.5 — Domain Quality Hooks
162
+
163
+ Apply domain-specific quality checks based on detected file types in the diff. These extend the generic completeness checks in Step 4 with deeper domain validation.
164
+
165
+ <HARD-GATE>
166
+ Domain hooks are additive — they add checks, never remove generic ones from Steps 1-4.
167
+ If a domain hook flags BLOCK, the overall preflight verdict is BLOCK regardless of other steps.
168
+ </HARD-GATE>
169
+
170
+ #### Hook Selection (auto-detect from diff)
171
+
172
+ | Detected Pattern | Domain Hook | Key Checks |
173
+ |-----------------|-------------|------------|
174
+ | `migrations/*.sql`, `*.migration.*` | Database | Rollback script present, no bare DROP/DELETE, migration tested |
175
+ | `openapi.*`, `*.graphql`, `*.proto` | API Contract | Breaking changes flagged, version bumped, deprecated fields documented |
176
+ | `docs/policies/*`, `PRIVACY*`, `TERMS*` | Legal/Compliance | No placeholder text, review date current, practice matches policy |
177
+ | `**/billing*`, `**/payment*`, `**/invoice*` | Financial | Decimal precision correct, currency locale-aware, no hardcoded rates |
178
+ | `skills/*/SKILL.md`, `extensions/*/PACK.md` | Rune Skill | Frontmatter valid, all required sections present, word count within layer budget |
179
+ | `*.test.*`, `*.spec.*`, `__tests__/*` | Test Quality | No `.skip`/`.only` left in, assertions present (not empty tests), no hardcoded timeouts |
180
+
181
+ #### Domain Hook Execution
182
+
183
+ For each detected domain, run its checks on the relevant files in the diff:
184
+
185
+ 1. **Identify** which domain hooks apply based on changed file patterns
186
+ 2. **Load** domain-specific check rules (inline above, or from pack reference files if a pack is installed)
187
+ 3. **Scan** each relevant file for domain violations
188
+ 4. **Classify** findings: BLOCK (data loss risk, breaking contract) or WARN (best practice, incomplete)
189
+ 5. **Append** to preflight report under `### Domain Quality` section
190
+
191
+ #### Pack Integration
192
+
193
+ When a domain pack is installed (e.g., `@rune-pro/finance`, `@rune-pro/legal`), preflight checks the pack's **Hard-Stop Thresholds** table and applies matching rules to staged files. This means:
194
+ - Installing `@rune-pro/finance` automatically adds financial quality gates to preflight
195
+ - Installing `@rune-pro/legal` automatically adds compliance checks to preflight
196
+ - No manual configuration needed — pack presence = hooks active
197
+
198
+ #### Output Section
199
+
200
+ ```
201
+ ### Domain Quality
202
+ - **Domains detected**: [Database, Financial]
203
+ - `migrations/003-add-billing.sql` — BLOCK: DROP TABLE without rollback script
204
+ - `src/billing/invoice.ts:42` — WARN: price calculation uses `toFixed(2)` instead of `Intl.NumberFormat`
205
+ ```
206
+
161
207
  ### Step 5 — Security Sub-Check
162
208
  Invoke `rune:sentinel` on the changed files. Attach sentinel's output verbatim under the "Security" section of the preflight report. If sentinel returns BLOCK, preflight verdict is also BLOCK.
163
209
 
@@ -216,6 +262,9 @@ WARN — 3 issues found (0 blocking, 3 must-acknowledge). Resolve before commit
216
262
  | Skipping sentinel sub-check because "this file doesn't look security-relevant" | HIGH | MUST invoke sentinel — security relevance is sentinel's job to determine, not preflight's |
217
263
  | Skipping Stage A (spec compliance) when plan is available | HIGH | If cook provides an approved plan, Stage A is mandatory — catches incomplete implementations |
218
264
  | Agent modified files not in plan without flagging | MEDIUM | Stage A flags unplanned file changes as WARN — scope creep detection |
265
+ | Domain hooks not triggered when pack is installed | HIGH | Step 4.5 auto-detects file patterns — if pack is installed but hooks don't fire, check file pattern matching |
266
+ | Domain hooks overriding generic checks | HIGH | HARD-GATE: domain hooks are ADDITIVE — they never replace Steps 1-4 |
267
+ | Pack Hard-Stop Thresholds ignored in preflight | MEDIUM | Step 4.5 Pack Integration must read installed pack thresholds — test with each new pack |
219
268
 
220
269
  ## Done When
221
270
 
@@ -3,7 +3,7 @@ name: research
3
3
  description: Web search and external knowledge lookup. Gathers data on technologies, libraries, best practices, and competitor solutions.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: knowledge
@@ -44,25 +44,51 @@ Generate 2-3 targeted search queries from the research question. Vary phrasing t
44
44
  - Secondary: "[topic] best practices 2026" or "[topic] vs alternatives"
45
45
  - Tertiary: "[topic] example" or "[topic] tutorial" if implementation detail needed
46
46
 
47
- ### Step 2 — Search
47
+ ### Step 2 — Search (Minimum 3 Complementary Sources)
48
48
 
49
- Call `WebSearch` for each query. Collect result titles, URLs, and snippets. Identify the top 3-5 most relevant URLs based on:
50
- - Source authority (official docs, major blogs, GitHub repos)
49
+ <HARD-GATE>
50
+ Every research conclusion MUST be backed by at minimum 3 complementary sources from DIFFERENT source types.
51
+ Single-source conclusions are flagged as `low` confidence regardless of source authority.
52
+ </HARD-GATE>
53
+
54
+ Call `WebSearch` for each query. Collect result titles, URLs, and snippets. Identify the top 3-5 most relevant URLs prioritizing **source diversity**:
55
+
56
+ | Source Type | Examples | Why |
57
+ |-------------|----------|-----|
58
+ | **Official docs** | Framework docs, API reference, RFC | Authoritative but may lag behind reality |
59
+ | **Community** | Stack Overflow, GitHub Issues, Reddit | Real-world pain points, edge cases |
60
+ | **Technical blogs** | Dev.to, Medium engineering blogs, personal blogs | Practical experience, tutorials |
61
+ | **Repositories** | GitHub repos, npm packages, example code | Working implementations |
62
+
63
+ **Selection rules:**
64
+ - Source authority (official docs > major blogs > personal blogs)
51
65
  - Recency (prefer 2025-2026)
52
66
  - Relevance to the query
67
+ - **Diversity: never select 3+ URLs from the same domain** — spread across source types
68
+
69
+ > Source: K-Dense claude-scientific-skills (literature-review "minimum 3 complementary databases" pattern), adapted for software research.
53
70
 
54
71
  ### Step 3 — Deep Dive
55
72
 
56
73
  Call `WebFetch` on the top 3-5 URLs identified in Step 2. Hard limit: **max 5 WebFetch calls** per research invocation. For each fetched page:
57
74
  - Extract key facts, API signatures, code examples
58
75
  - Note the source URL and publication date if visible
76
+ - Tag the source type (official/community/blog/repo) for Step 4 triangulation
59
77
 
60
- ### Step 4 — Synthesize
78
+ ### Step 4 — Synthesize (Triangulation)
61
79
 
62
- Across all fetched content:
63
- - Identify points of consensus across sources
80
+ Across all fetched content, **triangulate** — don't just aggregate:
81
+ - Identify points of consensus across sources (≥3 sources = strong signal)
64
82
  - Flag any conflicting information explicitly (e.g., "Source A says X, Source B says Y")
65
- - Assign confidence: `high` (3+ sources agree), `medium` (1-2 sources), `low` (single source or unclear)
83
+ - Check if conflicts are temporal (old vs new info) or genuine disagreement
84
+ - Assign confidence using source diversity:
85
+
86
+ | Confidence | Criteria |
87
+ |------------|----------|
88
+ | `high` | 3+ sources from different types agree |
89
+ | `medium` | 2 sources agree, or 3+ from same type |
90
+ | `low` | Single source, or sources conflict without resolution |
91
+ | `unverified` | No sources found — report this explicitly, NEVER fabricate |
66
92
 
67
93
  ### Step 5 — Report
68
94
 
@@ -108,6 +134,8 @@ Known failure modes for this skill. Check these before declaring done.
108
134
  | Reporting conflicting sources without flagging the conflict | HIGH | Constraint: flag conflicting information explicitly, never silently pick one side |
109
135
  | Assigning "high" confidence from a single source | MEDIUM | High = 3+ sources agree; 1-2 sources = medium confidence |
110
136
  | Exceeding 5 WebFetch calls per invocation | MEDIUM | Hard limit: prioritize top 3-5 URLs from search, fetch only the most relevant |
137
+ | Single-source conclusions presented as fact | HIGH | HARD-GATE: minimum 3 complementary sources from different source types. Single source = `low` confidence |
138
+ | All sources from same domain (e.g., 3 Stack Overflow links) | MEDIUM | Source diversity rule: never 3+ URLs from the same domain. Spread across official/community/blog/repo |
111
139
 
112
140
  ## Done When
113
141
 
@@ -0,0 +1,314 @@
1
+ ---
2
+ name: retro
3
+ description: Engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with trend tracking. Per-person breakdowns, shipping streaks, and actionable improvements. Use when asked for "retro", "weekly review", "what did we ship", or "engineering retrospective".
4
+ metadata:
5
+ author: runedev
6
+ version: "0.1.0"
7
+ layer: L2
8
+ model: sonnet
9
+ group: knowledge
10
+ tools: "Read, Bash, Glob, Grep"
11
+ ---
12
+
13
+ # retro
14
+
15
+ ## Purpose
16
+
17
+ Engineering retrospective engine. Analyzes git history, work patterns, and code quality signals to produce actionable retrospectives with per-person breakdowns, shipping streaks, and concrete improvement habits. Fills a gap in the Rune ecosystem — cook builds, review checks, but nothing reflects on HOW the team works.
18
+
19
+ <HARD-GATE>
20
+ Retro is READ-ONLY. It analyzes and reports — it does NOT modify code, create PRs, or change any files except its own output artifacts (.rune/retros/).
21
+ Retro is ENCOURAGING but CANDID. Every critique is anchored in specific commits, not vague impressions.
22
+ </HARD-GATE>
23
+
24
+ ## Triggers
25
+
26
+ - `/rune retro` — default 7-day retrospective
27
+ - `/rune retro 24h` — daily standup review
28
+ - `/rune retro 14d` — sprint retro (2 weeks)
29
+ - `/rune retro 30d` — monthly review
30
+ - `/rune retro compare` — current vs previous period side-by-side
31
+ - Called by `audit` (L2) for engineering health dimension
32
+ - Auto-suggest: end of work week (Friday sessions)
33
+
34
+ ## Calls (outbound)
35
+
36
+ - `scout` (L2): scan codebase for test file counts, project structure
37
+ - `neural-memory` (L3): recall past retro insights for trend comparison
38
+
39
+ ## Called By (inbound)
40
+
41
+ - `audit` (L2): engineering velocity and health dimension
42
+ - `cook` (L1): optional — after completing a multi-phase feature, suggest retro
43
+ - User: `/rune retro` direct invocation
44
+
45
+ ## Data Flow
46
+
47
+ ### Feeds Into →
48
+
49
+ - `plan` (L2): retro insights inform future sprint planning (e.g., "fix ratio too high → allocate debugging time")
50
+ - `journal` (L3): retro findings → ADR entries for team patterns
51
+ - `neural-memory` (external): retro insights → persistent cross-session memory
52
+
53
+ ### Fed By ←
54
+
55
+ - `git` history: commits, authors, timestamps, file changes
56
+ - `.rune/retros/` history: previous retro JSON for trend comparison
57
+ - `neural-memory` (external): past retro insights for pattern recognition
58
+
59
+ ### Feedback Loops ↻
60
+
61
+ - `retro` ↔ `plan`: retro identifies bottlenecks → plan adjusts estimation and phase sizing → next retro measures improvement
62
+
63
+ ## Execution
64
+
65
+ ### Step 1 — Gather Raw Data
66
+
67
+ Run these git commands to collect metrics for the specified time window:
68
+
69
+ ```bash
70
+ # Core metrics (run in parallel)
71
+ git log --since="<window-start>" --format="%H|%an|%ae|%aI|%s" --shortstat
72
+ git log --since="<window-start>" --format="%H" --numstat
73
+ git log --since="<window-start>" --format="%aI" # timestamps for session detection
74
+ git log --since="<window-start>" --format="%an" | sort | uniq -c | sort -rn # per-author
75
+ git shortlog --since="<window-start>" -sn # author leaderboard
76
+ ```
77
+
78
+ **Time window alignment**: For day/week units, align to midnight: `--since="YYYY-MM-DDT00:00:00"`. This prevents partial-day skew.
79
+
80
+ **Identify "You"**: `git config user.name` = current user. All others are teammates.
81
+
82
+ Also gather:
83
+ - Test file count: `find . -name "*.test.*" -o -name "*.spec.*" -o -name "*_test.*" | wc -l`
84
+ - `.rune/retros/` for prior retro history (if exists)
85
+ - TODOS.md for backlog health
86
+
87
+ ### Step 2 — Compute Summary Metrics
88
+
89
+ | Metric | How to compute |
90
+ |--------|---------------|
91
+ | Commits | Count from git log |
92
+ | Contributors | Unique authors |
93
+ | LOC added/removed | Sum from numstat |
94
+ | Test LOC ratio | test files LOC / total LOC changed |
95
+ | Active days | Unique dates with commits |
96
+ | Sessions | Detected via 45-min gap threshold (Step 4) |
97
+ | LOC/session-hour | Total LOC / total session hours |
98
+ | Fix ratio | `fix:` commits / total commits |
99
+
100
+ ### Step 3 — Hourly Activity Histogram
101
+
102
+ Build an ASCII bar chart showing commit distribution by hour (local timezone):
103
+
104
+ ```
105
+ Hour Commits
106
+ 06 ██ 3
107
+ 07 ████ 7
108
+ 08 ██████ 12
109
+ ...
110
+ ```
111
+
112
+ Identify: peak hours, dead zones, bimodal patterns (morning + evening coder).
113
+
114
+ ### Step 4 — Session Detection
115
+
116
+ Group commits into sessions using a **45-minute gap threshold**:
117
+
118
+ - Commits within 45 min of each other = same session
119
+ - Gap > 45 min = new session
120
+
121
+ Classify sessions:
122
+ - **Deep** (50+ min): focused work blocks
123
+ - **Medium** (20-50 min): moderate focus
124
+ - **Micro** (<20 min): quick fixes, drive-bys
125
+
126
+ ### Step 5 — Commit Type Breakdown
127
+
128
+ Parse conventional commit prefixes and show percentage bar:
129
+
130
+ ```
131
+ feat ████████████████ 45%
132
+ fix ████████ 22%
133
+ ref ████ 11%
134
+ test ████ 11%
135
+ docs ██ 5%
136
+ chore██ 6%
137
+ ```
138
+
139
+ **Flag**: if `fix` ratio > 50% → "High fix ratio suggests reactive mode. Consider investing in test coverage."
140
+
141
+ ### Step 6 — Hotspot Analysis
142
+
143
+ Top 10 most-changed files in the window:
144
+
145
+ | File | Changes | Test Coverage |
146
+ |------|---------|--------------|
147
+ | src/auth/login.ts | 8 | ✅ |
148
+ | src/api/users.ts | 6 | ❌ |
149
+
150
+ **Flag**: files with 5+ changes = **churn hotspot** — candidate for refactoring.
151
+ **Flag**: hotspot files without test coverage = **risk**.
152
+
153
+ ### Step 7 — Focus Score & Ship of the Week
154
+
155
+ - **Focus Score** = % of commits in top-changed directory. High focus (>60%) = deep work. Low focus (<30%) = context switching.
156
+ - **Ship of the Week** = highest-LOC commit/PR with feat: prefix. Celebrate it.
157
+
158
+ ### Step 8 — Per-Person Breakdown
159
+
160
+ For each contributor:
161
+
162
+ **Current user (deepest treatment):**
163
+ - Commits, LOC, areas of focus
164
+ - Commit type mix (builder vs fixer vs maintainer)
165
+ - Session patterns (deep vs micro ratio)
166
+ - Test discipline (% of feat commits with corresponding test commits)
167
+ - Biggest ship
168
+
169
+ **Teammates (2-3 sentences each):**
170
+ - Summary of work areas and volume
171
+ - **Specific praise** — anchored in actual commits (e.g., "Your auth refactor in 3 commits was surgically clean")
172
+ - **One growth opportunity** — constructive, based on patterns (e.g., "8 of 12 commits were fixes — consider adding tests alongside features")
173
+
174
+ ### Step 9 — Trend Tracking (if prior retros exist)
175
+
176
+ Read most recent `.rune/retros/*.json`. Compute deltas:
177
+
178
+ | Metric | Previous | Current | Delta |
179
+ |--------|----------|---------|-------|
180
+ | Commits | 45 | 52 | +15% ↑ |
181
+ | Test ratio | 0.18 | 0.24 | +33% ↑ |
182
+ | Fix ratio | 0.55 | 0.38 | -31% ↓ (improving) |
183
+ | Deep sessions | 8 | 12 | +50% ↑ |
184
+
185
+ ### Step 10 — Shipping Streak
186
+
187
+ Query full history for consecutive days with at least 1 commit:
188
+ - **Team streak**: any contributor committed
189
+ - **Personal streak**: current user committed
190
+
191
+ ### Step 11 — Save Retro History
192
+
193
+ Write JSON snapshot to `.rune/retros/{YYYY-MM-DD}.json`:
194
+
195
+ ```json
196
+ {
197
+ "date": "2026-03-20",
198
+ "window": "7d",
199
+ "metrics": {
200
+ "commits": 52, "contributors": 3, "loc_added": 1850,
201
+ "loc_removed": 620, "test_ratio": 0.24, "fix_ratio": 0.38,
202
+ "active_days": 5, "sessions": 14, "deep_sessions": 8
203
+ },
204
+ "authors": ["user1", "user2"],
205
+ "streak": { "team": 12, "personal": 5 },
206
+ "summary": "Shipped auth overhaul + 3 bug fixes. Test ratio improving."
207
+ }
208
+ ```
209
+
210
+ ### Step 12 — Write Narrative Report
211
+
212
+ Structure (~800-1500 words — concise, not a novel):
213
+
214
+ 1. **Tweetable summary** (1 sentence, <280 chars)
215
+ 2. **Summary table** (Step 2 metrics)
216
+ 3. **Time & session patterns** (Steps 3-4)
217
+ 4. **Shipping velocity** (Step 5 commit types)
218
+ 5. **Code quality signals** (Step 6 hotspots, test ratio)
219
+ 6. **Focus & highlights** (Step 7)
220
+ 7. **Your week** (current user deep dive from Step 8)
221
+ 8. **Team breakdown** (Step 8 teammates)
222
+ 9. **Top 3 wins** (specific, anchored in commits)
223
+ 10. **3 things to improve** (specific, actionable)
224
+ 11. **3 habits for next week** (concrete daily practices)
225
+ 12. **Trends** (Step 9, if available)
226
+
227
+ **Tone**: Encouraging but candid. Specific and concrete. Anchored in actual commits, not vague impressions. Every critique paired with a specific suggestion.
228
+
229
+ ## Compare Mode
230
+
231
+ When invoked as `/rune retro compare`:
232
+
233
+ 1. Compute current period metrics (same as above)
234
+ 2. Compute previous same-length period (e.g., if current = 7d, previous = 7d before that)
235
+ 3. Side-by-side delta table
236
+ 4. Highlight biggest improvements and regressions
237
+ 5. Save only current-period snapshot
238
+
239
+ ## Self-Validation
240
+
241
+ ```
242
+ SELF-VALIDATION (run before emitting report):
243
+ - [ ] All metrics computed from actual git data — no assumptions or estimates
244
+ - [ ] Per-person praise is anchored in specific commits (not generic "great work")
245
+ - [ ] Improvement suggestions are actionable (not "write more tests" but "add tests for the 3 hotspot files without coverage")
246
+ - [ ] Retro JSON saved to .rune/retros/ for trend tracking
247
+ - [ ] No code was modified — retro is read-only
248
+ ```
249
+
250
+ ## Constraints
251
+
252
+ 1. MUST NOT modify any code — retro is read-only analysis
253
+ 2. MUST anchor all observations in specific commits — no vague impressions
254
+ 3. MUST include per-person breakdown for teams with 2+ contributors
255
+ 4. MUST save JSON snapshot for trend tracking across retros
256
+ 5. MUST flag churn hotspots (5+ changes to same file)
257
+ 6. MUST flag high fix ratio (>50%) as reactive mode signal
258
+ 7. MUST include actionable habits — "test the hotspots" not "write more tests"
259
+
260
+ ## Sharp Edges
261
+
262
+ | Failure Mode | Severity | Mitigation |
263
+ |---|---|---|
264
+ | Generic praise not anchored in commits | HIGH | Every praise MUST reference a specific commit or PR — "great auth refactor in 3 commits" not "good job this week" |
265
+ | Vague improvement suggestions | HIGH | "Add tests for src/api/users.ts (6 changes, 0 tests)" not "consider writing more tests" |
266
+ | Counting merge commits as real work | MEDIUM | Use `--no-merges` flag to exclude merge commits from metrics |
267
+ | Timezone skew in hourly histogram | MEDIUM | Convert all timestamps to local timezone before bucketing |
268
+ | Retro on empty window (no commits) | LOW | Detect early and report: "No commits in the last {window}. Nothing to retro." |
269
+ | Discouraging tone for struggling weeks | HIGH | Even bad weeks have wins. Find the smallest positive signal and lead with it |
270
+
271
+ ## Output Format
272
+
273
+ ```
274
+ ## Engineering Retro: [date range]
275
+
276
+ > [tweetable summary]
277
+
278
+ ### Summary
279
+ | Metric | Value |
280
+ |--------|-------|
281
+ | Commits | N |
282
+ | ... | ... |
283
+
284
+ ### [remaining sections per Step 12]
285
+
286
+ ### Top 3 Wins
287
+ 1. [specific win anchored in commit]
288
+ 2. [specific win]
289
+ 3. [specific win]
290
+
291
+ ### 3 Things to Improve
292
+ 1. [specific, actionable]
293
+ 2. [specific, actionable]
294
+ 3. [specific, actionable]
295
+
296
+ ### 3 Habits for Next Week
297
+ 1. [concrete daily practice]
298
+ 2. [concrete daily practice]
299
+ 3. [concrete daily practice]
300
+ ```
301
+
302
+ ## Done When
303
+
304
+ - All git metrics gathered for specified time window
305
+ - Summary metrics computed (commits, LOC, test ratio, fix ratio, sessions)
306
+ - Per-person breakdown with specific praise and growth areas
307
+ - Top 3 wins and 3 improvements identified (commit-anchored)
308
+ - Retro JSON saved to `.rune/retros/` for trend tracking
309
+ - Narrative report emitted
310
+ - No code was modified
311
+
312
+ ## Cost Profile
313
+
314
+ ~3000-5000 tokens input (git history parsing), ~2000-4000 tokens output (narrative). Sonnet for analysis quality. Runs infrequently (weekly/sprint cadence).
@@ -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
3
3
  description: Automated security gatekeeper. Blocks unsafe code before commit — secret scanning, OWASP top 10, dependency audit, permission checks. A GATE, not a suggestion.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.4.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: quality
@@ -150,14 +150,43 @@ app.post('/users', async (req, res) => {
150
150
  });
151
151
  ```
152
152
 
153
- ### Step 4 — Permission Check
154
- Use `Grep` to scan for:
153
+ ### Step 4 — Destructive Command Guard
154
+
155
+ Scan for destructive operations in code AND detect real-time destructive commands during agent execution.
156
+
157
+ **4a. Static scan** — Use `Grep` to scan changed files for:
155
158
  - Destructive shell commands in scripts: `rm -rf /`, `DROP TABLE`, `DELETE FROM` without `WHERE`, `TRUNCATE`
156
159
  - File operations using absolute paths outside the project root (e.g., `/etc/`, `/usr/`, `C:\Windows\`)
157
160
  - Direct production database connection strings (e.g., `prod`, `production` in DB host names)
158
161
 
159
162
  Destructive command on production path = **BLOCK**. Suspicious path = **WARN**.
160
163
 
164
+ **4b. Real-Time Command Guard** (advisory for agent workflows)
165
+
166
+ When sentinel is invoked by `cook` or `fix`, include this destructive command pattern table in the report. Any skill executing Bash commands SHOULD check against these patterns before execution:
167
+
168
+ | Pattern | Risk | Action |
169
+ |---------|------|--------|
170
+ | `rm -rf` / `rm -r` / `rm --recursive` | Recursive delete | WARN — confirm target is expected |
171
+ | `DROP TABLE` / `DROP DATABASE` / `TRUNCATE` | Data loss | BLOCK — require explicit confirmation |
172
+ | `git push --force` / `git push -f` | History rewrite | WARN — confirm branch is correct |
173
+ | `git reset --hard` | Uncommitted work loss | WARN — verify no unsaved changes |
174
+ | `git checkout .` / `git restore .` | Working tree wipe | WARN — verify intent |
175
+ | `kubectl delete` / `docker system prune` | Production impact | BLOCK — require namespace/context confirmation |
176
+ | `chmod 777` / `chmod -R 777` | Permission escalation | WARN — almost never correct |
177
+
178
+ **Safe exceptions** (do NOT warn):
179
+ - `rm -rf node_modules`, `.next`, `dist`, `__pycache__`, `.cache`, `build`, `.turbo`, `coverage`, `target`
180
+ - `git push --force-with-lease` (safe force push)
181
+ - `docker rm` on explicitly named test containers
182
+
183
+ **Composable modes** (future — advisory only for now):
184
+ - **Careful mode**: warn before any destructive command (all patterns above)
185
+ - **Freeze mode**: restrict file edits to a specific directory (scope lock)
186
+ - **Guard mode**: careful + freeze combined
187
+
188
+ > Source: garrytan/gstack v0.9.0 (careful/freeze/guard skills) — real-time command safety, composable with edit scope lock.
189
+
161
190
  ### Step 4.5 — Framework-Specific Security Patterns
162
191
 
163
192
  Apply only if the framework is detected in changed files:
@@ -265,6 +294,78 @@ Silent continuation past WARN = VIOLATION.
265
294
  The calling skill (cook) must present WARNs and wait for acknowledgment.
266
295
  ```
267
296
 
297
+ ### Step 5 — Domain Hook Templates
298
+
299
+ Generate domain-specific pre-commit hook scripts when requested. These hooks run as git pre-commit hooks and enforce domain-level quality gates BEFORE code enters the repository.
300
+
301
+ #### Hook Architecture
302
+
303
+ ```
304
+ hooks/
305
+ ├── pre-commit-security.sh # Always — secret scan, OWASP basics (generated by sentinel)
306
+ ├── pre-commit-<domain>.sh # Domain-specific — generated on request
307
+ └── validate-<domain>.py # Complex validation scripts (Python for portability)
308
+ ```
309
+
310
+ #### Hook Generation Rules
311
+
312
+ 1. **Exit 0 if no relevant files staged** — prevents false positives when committing unrelated changes
313
+ 2. **ERRORS block commit** (exit 1) — critical violations that must be fixed
314
+ 3. **WARNINGS alert but allow** (exit 0 with stderr) — non-critical issues the developer should review
315
+ 4. **List specific files and line numbers** — actionable output, not vague warnings
316
+ 5. **Fast execution** (<5 seconds) — hooks that slow down commits get disabled by developers
317
+
318
+ #### Domain Hook Template
319
+
320
+ ```bash
321
+ #!/usr/bin/env bash
322
+ # Pre-commit hook: <domain> quality gate
323
+ # Generated by rune:sentinel — do not edit manually
324
+
325
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
326
+ DOMAIN_FILES=$(echo "$STAGED_FILES" | grep -E '<file-pattern>')
327
+
328
+ # Exit early if no relevant files staged
329
+ if [ -z "$DOMAIN_FILES" ]; then
330
+ exit 0
331
+ fi
332
+
333
+ ERRORS=0
334
+ WARNINGS=0
335
+
336
+ for file in $DOMAIN_FILES; do
337
+ # ERROR checks (block commit)
338
+ # <domain-specific-error-patterns>
339
+
340
+ # WARNING checks (alert only)
341
+ # <domain-specific-warning-patterns>
342
+ done
343
+
344
+ if [ $ERRORS -gt 0 ]; then
345
+ echo "❌ $ERRORS error(s) found — commit blocked. Fix before retrying."
346
+ exit 1
347
+ fi
348
+
349
+ if [ $WARNINGS -gt 0 ]; then
350
+ echo "⚠️ $WARNINGS warning(s) found — review recommended."
351
+ fi
352
+
353
+ exit 0
354
+ ```
355
+
356
+ #### Built-in Domain Hook Patterns
357
+
358
+ | Domain | File Pattern | ERROR Checks | WARNING Checks |
359
+ |--------|-------------|-------------|----------------|
360
+ | **Schema/API** | `*.graphql`, `*.proto`, `openapi.*` | Breaking field removal, type changes | Deprecated field usage |
361
+ | **Database** | `migrations/*.sql`, `*.migration.*` | DROP TABLE without backup, DELETE without WHERE | Missing rollback script |
362
+ | **Config** | `*.env*`, `*config*`, `tsconfig*` | Secrets in config, strict mode disabled | New env var without docs |
363
+ | **Dependencies** | `package.json`, `requirements.txt`, `Cargo.toml` | Known vulnerable version pinned | Major version bump without changelog |
364
+ | **Legal/Compliance** | `docs/policies/*`, `PRIVACY*`, `TERMS*` | Placeholder text ([Company Name], [Date]) | Review date >12 months old |
365
+ | **Financial** | `**/invoice*`, `**/billing*`, `**/payment*` | Hardcoded prices/rates, missing decimal precision | Currency without locale formatting |
366
+
367
+ When a pack or skill requests domain hooks (via `sentinel` integration), generate the appropriate hook script using the template above, customized with domain-specific patterns.
368
+
268
369
  ## Output Format
269
370
 
270
371
  ```
@@ -306,6 +407,10 @@ BLOCKED — 2 critical findings must be resolved before commit.
306
407
  | Dependency audit tool missing → silently skipped | LOW | Report INFO "tool not found, skipping" — never skip silently |
307
408
  | Stopping after first BLOCK without aggregating all findings | MEDIUM | Complete ALL steps, aggregate ALL findings, then report — developer needs the full list |
308
409
  | Missing agentic security scan when .rune/ exists | HIGH | Step 4.7 is mandatory when .rune/ directory detected — never skip |
410
+ | Domain hook too slow (>5s) → developers disable it | MEDIUM | Keep hooks fast — grep-based patterns only, no network calls. Complex validation goes in CI, not pre-commit |
411
+ | Domain hook blocks on test fixtures / mock data | MEDIUM | Check file path context — `test/`, `fixtures/`, `__mocks__/` directories get relaxed rules |
412
+ | Agent runs destructive command without checking pattern table | HIGH | Step 4b: real-time command guard patterns MUST be checked before Bash execution. Safe exceptions prevent false positives on `rm -rf node_modules` |
413
+ | False positive on `rm -rf` in build cleanup scripts | MEDIUM | Safe exceptions list (node_modules, dist, .next, etc.) — build cleanup is NOT destructive |
309
414
 
310
415
  ## Done When
311
416
 
@@ -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.1.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