@rune-kit/rune 2.2.4 → 2.3.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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/compiler/adapters/openclaw.js +63 -0
  3. package/compiler/emitter.js +10 -0
  4. package/docs/EXTENSION-TEMPLATE.md +18 -0
  5. package/docs/SKILL-TEMPLATE.md +46 -0
  6. package/docs/guides/index.html +84 -21
  7. package/docs/index.html +303 -37
  8. package/docs/script.js +236 -18
  9. package/docs/style.css +417 -59
  10. package/extensions/saas/PACK.md +13 -8
  11. package/extensions/saas/skills/billing-integration.md +82 -3
  12. package/package.json +7 -5
  13. package/skills/adversary/SKILL.md +12 -0
  14. package/skills/audit/SKILL.md +64 -1
  15. package/skills/autopsy/SKILL.md +12 -0
  16. package/skills/ba/SKILL.md +63 -1
  17. package/skills/brainstorm/SKILL.md +11 -0
  18. package/skills/completion-gate/SKILL.md +51 -2
  19. package/skills/context-engine/SKILL.md +83 -1
  20. package/skills/context-pack/SKILL.md +160 -0
  21. package/skills/cook/SKILL.md +657 -808
  22. package/skills/cook/references/deviation-rules.md +19 -0
  23. package/skills/cook/references/error-recovery.md +37 -0
  24. package/skills/cook/references/exit-conditions.md +31 -0
  25. package/skills/cook/references/loop-detection.md +39 -0
  26. package/skills/cook/references/mid-run-signals.md +31 -0
  27. package/skills/cook/references/output-format.md +40 -0
  28. package/skills/cook/references/pack-detection.md +82 -0
  29. package/skills/cook/references/pause-resume-template.md +38 -0
  30. package/skills/cook/references/rfc-template.md +52 -0
  31. package/skills/cook/references/sharp-edges.md +24 -0
  32. package/skills/cook/references/subagent-status.md +38 -0
  33. package/skills/db/SKILL.md +12 -0
  34. package/skills/debug/SKILL.md +81 -2
  35. package/skills/deploy/SKILL.md +56 -1
  36. package/skills/design/SKILL.md +9 -0
  37. package/skills/docs/SKILL.md +12 -0
  38. package/skills/docs-seeker/SKILL.md +11 -0
  39. package/skills/fix/SKILL.md +63 -3
  40. package/skills/git/SKILL.md +55 -1
  41. package/skills/incident/SKILL.md +10 -0
  42. package/skills/journal/SKILL.md +51 -3
  43. package/skills/launch/SKILL.md +12 -0
  44. package/skills/logic-guardian/SKILL.md +11 -0
  45. package/skills/marketing/SKILL.md +13 -0
  46. package/skills/mcp-builder/SKILL.md +13 -0
  47. package/skills/onboard/SKILL.md +54 -2
  48. package/skills/perf/SKILL.md +11 -0
  49. package/skills/plan/SKILL.md +342 -629
  50. package/skills/plan/references/completeness-scoring.md +37 -0
  51. package/skills/plan/references/outcome-block.md +41 -0
  52. package/skills/plan/references/plan-templates.md +193 -0
  53. package/skills/plan/references/wave-planning.md +44 -0
  54. package/skills/plan/references/workflow-registry.md +53 -0
  55. package/skills/preflight/SKILL.md +135 -1
  56. package/skills/rescue/SKILL.md +10 -0
  57. package/skills/research/SKILL.md +36 -8
  58. package/skills/retro/SKILL.md +325 -0
  59. package/skills/review/SKILL.md +100 -1
  60. package/skills/review-intake/SKILL.md +11 -0
  61. package/skills/safeguard/SKILL.md +12 -0
  62. package/skills/scaffold/SKILL.md +10 -0
  63. package/skills/scope-guard/SKILL.md +11 -0
  64. package/skills/scout/SKILL.md +9 -0
  65. package/skills/sentinel/SKILL.md +307 -320
  66. package/skills/sentinel/references/config-protection.md +52 -0
  67. package/skills/sentinel/references/destructive-commands.md +40 -0
  68. package/skills/sentinel/references/domain-hooks.md +73 -0
  69. package/skills/sentinel/references/framework-patterns.md +46 -0
  70. package/skills/sentinel/references/owasp-patterns.md +69 -0
  71. package/skills/sentinel/references/secret-patterns.md +40 -0
  72. package/skills/sentinel/references/skill-content-guard.md +55 -0
  73. package/skills/session-bridge/SKILL.md +60 -2
  74. package/skills/skill-forge/SKILL.md +131 -4
  75. package/skills/skill-router/SKILL.md +33 -1
  76. package/skills/surgeon/SKILL.md +12 -0
  77. package/skills/team/SKILL.md +35 -1
  78. package/skills/test/SKILL.md +211 -7
@@ -0,0 +1,52 @@
1
+ # Config Protection — 3-Layer Defense Reference
2
+
3
+ Reference for Step 4.6. Detect attempts to weaken linting, security, or CI/CD configurations.
4
+
5
+ ## Layer 1 — Linter/Formatter Config Drift
6
+
7
+ Scan diff for changes to:
8
+ - `.eslintrc*`, `eslint.config.*`, `biome.json` → rules disabled or removed
9
+ - `tsconfig.json` → `strict` changed to `false`, `any` allowed, `skipLibCheck` added
10
+ - `ruff.toml`, `.ruff.toml`, `pyproject.toml [tool.ruff]` → rules removed from select list
11
+ - `.prettierrc*` → significant format changes without team discussion
12
+
13
+ Detection patterns:
14
+
15
+ ```
16
+ # ESLint rule disable
17
+ "off" or 0 in rule config (compare with previous)
18
+ // eslint-disable added to >3 lines in same file
19
+
20
+ # TypeScript strictness weakening
21
+ "strict": false
22
+ "noImplicitAny": false
23
+ "skipLibCheck": true (added, not already present)
24
+
25
+ # Ruff rule removal
26
+ select = [...] with fewer rules than before
27
+ ```
28
+
29
+ Match = **WARN** — "Config change weakens code quality — verify this is intentional."
30
+
31
+ ## Layer 2 — Security Middleware Removal
32
+
33
+ Scan for removal of security-critical middleware or decorators:
34
+
35
+ - `helmet` removed from Express/Fastify middleware chain
36
+ - `csrf` middleware removed or commented out
37
+ - `cors` configuration changed to `origin: '*'`
38
+ - `SecurityMiddleware` removed from Django `MIDDLEWARE`
39
+ - `@csrf_protect` decorator removed from Django views
40
+
41
+ Match = **BLOCK** — "Security middleware removed — this must be explicitly justified."
42
+
43
+ ## Layer 3 — CI/CD Safety Bypass
44
+
45
+ Scan for weakening of CI/CD safety checks:
46
+
47
+ - `--no-verify` added to git commands in scripts
48
+ - `--force` added to deployment scripts
49
+ - Test steps removed or marked `continue-on-error: true`
50
+ - Coverage thresholds lowered
51
+
52
+ Match = **WARN** — "CI safety check weakened — verify this is intentional."
@@ -0,0 +1,40 @@
1
+ # Destructive Command Guard — Pattern Table and Safe Exceptions
2
+
3
+ Reference for Step 4b. Real-time command guard patterns for agent workflows.
4
+
5
+ > Source: garrytan/gstack v0.9.0 (careful/freeze/guard skills) — real-time command safety, composable with edit scope lock.
6
+
7
+ ## Pattern Table
8
+
9
+ Any skill executing Bash commands SHOULD check against these patterns before execution:
10
+
11
+ | Pattern | Risk | Action |
12
+ |---------|------|--------|
13
+ | `rm -rf` / `rm -r` / `rm --recursive` | Recursive delete | WARN — confirm target is expected |
14
+ | `DROP TABLE` / `DROP DATABASE` / `TRUNCATE` | Data loss | BLOCK — require explicit confirmation |
15
+ | `git push --force` / `git push -f` | History rewrite | WARN — confirm branch is correct |
16
+ | `git reset --hard` | Uncommitted work loss | WARN — verify no unsaved changes |
17
+ | `git checkout .` / `git restore .` | Working tree wipe | WARN — verify intent |
18
+ | `kubectl delete` / `docker system prune` | Production impact | BLOCK — require namespace/context confirmation |
19
+ | `chmod 777` / `chmod -R 777` | Permission escalation | WARN — almost never correct |
20
+
21
+ ## Safe Exceptions (do NOT warn)
22
+
23
+ - `rm -rf node_modules`, `.next`, `dist`, `__pycache__`, `.cache`, `build`, `.turbo`, `coverage`, `target`
24
+ - `git push --force-with-lease` (safe force push)
25
+ - `docker rm` on explicitly named test containers
26
+
27
+ ## Static Scan Targets (Step 4a)
28
+
29
+ Scan changed files for:
30
+ - Destructive shell commands in scripts: `rm -rf /`, `DROP TABLE`, `DELETE FROM` without `WHERE`, `TRUNCATE`
31
+ - File operations using absolute paths outside the project root (e.g., `/etc/`, `/usr/`, `C:\Windows\`)
32
+ - Direct production database connection strings (`prod`, `production` in DB host names)
33
+
34
+ Destructive command on production path = **BLOCK**. Suspicious path = **WARN**.
35
+
36
+ ## Composable Modes (future — advisory only)
37
+
38
+ - **Careful mode**: warn before any destructive command (all patterns above)
39
+ - **Freeze mode**: restrict file edits to a specific directory (scope lock)
40
+ - **Guard mode**: careful + freeze combined
@@ -0,0 +1,73 @@
1
+ # Domain Hook Templates — Pre-Commit Hook Generation Reference
2
+
3
+ Reference for Step 5 (Domain Hook Templates). Contains the hook architecture, template, and built-in domain patterns.
4
+
5
+ ## Hook Architecture
6
+
7
+ ```
8
+ hooks/
9
+ ├── pre-commit-security.sh # Always — secret scan, OWASP basics (generated by sentinel)
10
+ ├── pre-commit-<domain>.sh # Domain-specific — generated on request
11
+ └── validate-<domain>.py # Complex validation scripts (Python for portability)
12
+ ```
13
+
14
+ ## Hook Generation Rules
15
+
16
+ 1. **Exit 0 if no relevant files staged** — prevents false positives when committing unrelated changes
17
+ 2. **ERRORS block commit** (exit 1) — critical violations that must be fixed
18
+ 3. **WARNINGS alert but allow** (exit 0 with stderr) — non-critical issues the developer should review
19
+ 4. **List specific files and line numbers** — actionable output, not vague warnings
20
+ 5. **Fast execution** (<5 seconds) — hooks that slow down commits get disabled by developers
21
+
22
+ ## Domain Hook Template
23
+
24
+ ```bash
25
+ #!/usr/bin/env bash
26
+ # Pre-commit hook: <domain> quality gate
27
+ # Generated by rune:sentinel — do not edit manually
28
+
29
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
30
+ DOMAIN_FILES=$(echo "$STAGED_FILES" | grep -E '<file-pattern>')
31
+
32
+ # Exit early if no relevant files staged
33
+ if [ -z "$DOMAIN_FILES" ]; then
34
+ exit 0
35
+ fi
36
+
37
+ ERRORS=0
38
+ WARNINGS=0
39
+
40
+ for file in $DOMAIN_FILES; do
41
+ # ERROR checks (block commit)
42
+ # <domain-specific-error-patterns>
43
+
44
+ # WARNING checks (alert only)
45
+ # <domain-specific-warning-patterns>
46
+ done
47
+
48
+ if [ $ERRORS -gt 0 ]; then
49
+ echo "❌ $ERRORS error(s) found — commit blocked. Fix before retrying."
50
+ exit 1
51
+ fi
52
+
53
+ if [ $WARNINGS -gt 0 ]; then
54
+ echo "⚠️ $WARNINGS warning(s) found — review recommended."
55
+ fi
56
+
57
+ exit 0
58
+ ```
59
+
60
+ ## Built-in Domain Hook Patterns
61
+
62
+ | Domain | File Pattern | ERROR Checks | WARNING Checks |
63
+ |--------|-------------|-------------|----------------|
64
+ | **Schema/API** | `*.graphql`, `*.proto`, `openapi.*` | Breaking field removal, type changes | Deprecated field usage |
65
+ | **Database** | `migrations/*.sql`, `*.migration.*` | DROP TABLE without backup, DELETE without WHERE | Missing rollback script |
66
+ | **Config** | `*.env*`, `*config*`, `tsconfig*` | Secrets in config, strict mode disabled | New env var without docs |
67
+ | **Dependencies** | `package.json`, `requirements.txt`, `Cargo.toml` | Known vulnerable version pinned | Major version bump without changelog |
68
+ | **Legal/Compliance** | `docs/policies/*`, `PRIVACY*`, `TERMS*` | Placeholder text ([Company Name], [Date]) | Review date >12 months old |
69
+ | **Financial** | `**/invoice*`, `**/billing*`, `**/payment*` | Hardcoded prices/rates, missing decimal precision | Currency without locale formatting |
70
+
71
+ ## Usage
72
+
73
+ 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 from the table.
@@ -0,0 +1,46 @@
1
+ # Framework-Specific Security Patterns
2
+
3
+ Reference for Step 4.5. Apply only when the relevant framework is detected in changed files.
4
+
5
+ ## Django
6
+
7
+ Detect: `django` in `requirements.txt` or imports.
8
+
9
+ | Check | Severity |
10
+ |-------|----------|
11
+ | `DEBUG = True` in non-development settings file | BLOCK |
12
+ | Missing `permission_classes` on `ModelViewSet` | WARN |
13
+ | `SecurityMiddleware` / CSRF middleware removed from `MIDDLEWARE` list | BLOCK |
14
+
15
+ ## React / Next.js
16
+
17
+ Detect: `.tsx` or `.jsx` files in changed set.
18
+
19
+ | Check | Severity |
20
+ |-------|----------|
21
+ | JWT stored in `localStorage` instead of `httpOnly` cookie | WARN |
22
+ | `dangerouslySetInnerHTML` without `DOMPurify.sanitize()` | BLOCK |
23
+
24
+ ## Node.js / Express / Fastify
25
+
26
+ Detect: `express` or `fastify` in imports.
27
+
28
+ | Check | Severity |
29
+ |-------|----------|
30
+ | CORS set to `origin: '*'` on authenticated endpoints | WARN |
31
+ | Missing `helmet` middleware for HTTP security headers | WARN |
32
+
33
+ ## Python
34
+
35
+ Detect: `.py` files in changed set.
36
+
37
+ | Check | Severity |
38
+ |-------|----------|
39
+ | `pickle.loads(user_input)` or `eval(user_expression)` | BLOCK |
40
+ | `yaml.load()` without `Loader` argument (uses unsafe loader) | WARN |
41
+
42
+ ## Detection Notes
43
+
44
+ - Framework detection is file-based — scan imports and dependency manifests (`package.json`, `requirements.txt`, `Cargo.toml`, `go.mod`) in the changed file set.
45
+ - Apply only the relevant framework sections — do not scan React patterns in a pure Python project.
46
+ - "The framework handles security" is NOT an acceptable reason to skip any check (see Constraints in SKILL.md).
@@ -0,0 +1,69 @@
1
+ # OWASP Patterns — Code Examples and Detection Details
2
+
3
+ Reference for Step 3 (OWASP Check). Contains concrete detection examples for each category.
4
+
5
+ ## SQL Injection
6
+
7
+ Detect string concatenation or interpolation inside SQL query strings.
8
+ Severity: **BLOCK**
9
+
10
+ ```python
11
+ # BAD — string interpolation in SQL → BLOCK
12
+ cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
13
+ query = "SELECT * FROM users WHERE name = '" + name + "'"
14
+
15
+ # GOOD — parameterized query
16
+ cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
17
+ ```
18
+
19
+ Detection signals:
20
+ - f-string or `+` concatenation where the outer string contains `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `WHERE`, `FROM`
21
+ - `.format()` or `%` formatting applied to SQL strings
22
+
23
+ ## XSS (Cross-Site Scripting)
24
+
25
+ Detect `innerHTML =`, `dangerouslySetInnerHTML`, `document.write(` with non-static content.
26
+ Severity: **BLOCK**
27
+
28
+ ```typescript
29
+ // BAD — renders raw user content → BLOCK
30
+ element.innerHTML = userComment;
31
+ <div dangerouslySetInnerHTML={{ __html: userInput }} />
32
+
33
+ // GOOD — safe alternatives
34
+ element.textContent = userComment;
35
+ <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userInput) }} />
36
+ ```
37
+
38
+ Detection signals:
39
+ - `innerHTML` assigned a variable (not a string literal)
40
+ - `dangerouslySetInnerHTML` without `DOMPurify.sanitize()` wrapping the value
41
+ - `document.write(` with any non-literal argument
42
+
43
+ ## CSRF
44
+
45
+ Detect HTML `<form>` without CSRF token fields; `Set-Cookie` without `SameSite`.
46
+ Severity: **WARN**
47
+
48
+ Detection signals:
49
+ - `<form method="post">` or `<form method="POST">` without a hidden input containing `csrf`, `_token`, or `authenticity_token`
50
+ - `Set-Cookie:` header string without `SameSite=` attribute
51
+
52
+ ## Missing Input Validation
53
+
54
+ Detect new route/API handlers passing `req.body` / `request.json()` directly to DB calls.
55
+ Severity: **WARN**
56
+
57
+ ```typescript
58
+ // BAD — raw body to DB → WARN
59
+ app.post('/users', async (req, res) => { await db.users.create(req.body); });
60
+
61
+ // GOOD — validate at boundary
62
+ app.post('/users', async (req, res) => {
63
+ const validated = CreateUserSchema.parse(req.body);
64
+ await db.users.create(validated);
65
+ });
66
+ ```
67
+
68
+ Detection signals:
69
+ - Route handler body where `req.body` / `request.json()` / `event.body` flows directly into a DB call (`.create(`, `.insert(`, `.save(`, `.update(`) with no intermediate validation call
@@ -0,0 +1,40 @@
1
+ # Secret Patterns — Extended Gitleaks Reference
2
+
3
+ Extended secret detection patterns for Step 1 (Secret Scan).
4
+
5
+ ## 1b. Extended Gitleaks Patterns
6
+
7
+ ```
8
+ SLACK_TOKEN: xox[bpors]-[0-9a-zA-Z]{10,}
9
+ STRIPE_KEY: [sr]k_(live|test)_[0-9a-zA-Z]{24,}
10
+ SENDGRID: SG\.[a-zA-Z0-9_-]{22}\.[a-zA-Z0-9_-]{43}
11
+ TWILIO: SK[0-9a-fA-F]{32}
12
+ FIREBASE: AIza[0-9A-Za-z_-]{35}
13
+ PRIVATE_KEY: -----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----
14
+ JWT: eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}
15
+ GENERIC_API_KEY: (?i)(apikey|api_key|api-key)\s*[:=]\s*["'][A-Za-z0-9_-]{16,}
16
+ ```
17
+
18
+ ## 1c. Git History Scan (First Run Only)
19
+
20
+ If no `.rune/sentinel-baseline.md` exists, run a historical scan:
21
+
22
+ ```bash
23
+ git log --all --diff-filter=A -- '*.env*' '*.key' '*.pem' '*.p12' '*credentials*' '*secret*'
24
+ ```
25
+
26
+ Result: any output → **WARN** — historical secret files detected. Recommend BFG/git-filter-repo cleanup.
27
+
28
+ For subsequent runs, scan only the current diff (incremental).
29
+
30
+ ## Core Patterns (always active)
31
+
32
+ Scan for these patterns in all changed files:
33
+
34
+ - `sk-`, `AKIA`, `ghp_`, `ghs_`, `-----BEGIN`
35
+ - `password\s*=\s*["']`, `secret\s*=\s*["']`
36
+ - `api_key\s*=\s*["']`, `token\s*=\s*["']`
37
+ - `.env` file contents committed directly (lines matching `KEY=value` outside `.env` files)
38
+ - High-entropy strings: length > 40, entropy > 4.5 → HIGH_ENTROPY candidate
39
+
40
+ Any match = **BLOCK**.
@@ -0,0 +1,55 @@
1
+ # Skill Content Security Guard — 28 Regex Category Reference
2
+
3
+ Reference for Step 3.5. Scan SKILL.md and skill-adjacent content files BEFORE write/commit.
4
+ First-match-wins — report the category that triggered and halt.
5
+
6
+ > Source: nextlevelbuilder/goclaw (832★) — 28 compiled regex rules on skill content pre-write.
7
+
8
+ ## Category Groups
9
+
10
+ | Category | Pattern Examples | Severity |
11
+ |----------|-----------------|----------|
12
+ | Destructive ops | `rm -rf /`, `fork bomb: :(){ :|:& };:` | BLOCK |
13
+ | Code injection | `eval(`, `exec(`, `curl \| bash`, `wget \| sh` | BLOCK |
14
+ | Credential theft | `cat ~/.ssh`, `env \| grep`, `printenv` in instructions | BLOCK |
15
+ | Path traversal | `../../../`, `%2e%2e%2f` in tool call instructions | BLOCK |
16
+ | SQL injection | `' OR '1'='1`, `; DROP TABLE` in prompt text | BLOCK |
17
+ | Privilege escalation | `sudo`, `chmod 777`, `chown root` in agent instructions | WARN |
18
+ | Prompt injection | `Ignore previous instructions`, `Disregard your`, `New system prompt:` | BLOCK |
19
+ | Jailbreak attempts | `DAN mode`, `developer mode`, `unrestricted AI` | BLOCK |
20
+ | Data exfiltration | `curl -d @`, `nc -e`, sending files to external hosts in instructions | BLOCK |
21
+ | Reverse shell | `bash -i`, `/dev/tcp/`, `mkfifo` in agent instructions | BLOCK |
22
+ | Env variable leak | `$HOME`, `$PATH`, `$USER` echoed to external endpoints | WARN |
23
+ | File enumeration | `ls -la /`, `find / -name`, directory traversal in instructions | WARN |
24
+ | Network scanning | `nmap`, `masscan`, port scanning in instructions | BLOCK |
25
+ | Crypto mining | `xmrig`, `minergate`, cryptocurrency mining commands | BLOCK |
26
+ | Log tampering | `> /var/log/`, clearing auth logs in instructions | BLOCK |
27
+ | Process hijacking | `ptrace`, `LD_PRELOAD=` in agent instructions | BLOCK |
28
+ | Sudo escalation | `sudo -i`, `sudo su`, `sudo bash` | BLOCK |
29
+ | SUID abuse | `find / -perm -4000`, SUID bit manipulation | WARN |
30
+ | Crontab injection | `crontab -e`, scheduled malicious commands | WARN |
31
+ | Package poisoning | Installing from untrusted registries in instructions | WARN |
32
+ | DNS rebinding | Localhost bypass patterns in HTTP instructions | WARN |
33
+ | SSRF patterns | Internal IP ranges (10.x, 192.168.x, 172.16-31.x) in fetch instructions | WARN |
34
+ | Template injection | `{{7*7}}`, `${7*7}` in output templates | WARN |
35
+ | Insecure deserialization | `pickle.loads`, `yaml.load(` without safe loader | BLOCK |
36
+ | XXE injection | XML with `SYSTEM` entity in tool call content | WARN |
37
+ | Header injection | `\r\n` in HTTP header values | WARN |
38
+ | Command chaining abuse | `;` or `&&` chains in Bash instructions with destructive ops | WARN |
39
+ | Webhook exfiltration | Sending `.rune/` or `SKILL.md` content to external URLs | BLOCK |
40
+
41
+ ## Safe Exceptions
42
+
43
+ These patterns appear legitimately in skill examples and MUST NOT trigger:
44
+
45
+ 1. **Inside fenced code blocks labeled as anti-patterns** — preceded by `# BAD`, `// BAD`, or block labeled `bad-example`
46
+ 2. **Inside backtick fences explicitly documenting the attack** — educational examples in security skills (sentinel itself, sast, adversary)
47
+ 3. **Actual shell scripts in `scripts/` directory** — functional code, not agent instructions
48
+ 4. **Files in `test/`, `fixtures/`, `__mocks__/`** — test data, not live instructions
49
+
50
+ ## When to Apply
51
+
52
+ - Any time skill content is WRITTEN or EDITED (not just committed)
53
+ - Invoke from `skill-forge` Phase 7 pre-ship check
54
+ - Invoke from any hook writing to `SKILL.md` files
55
+ - Scope: `skills/*/SKILL.md`, `extensions/*/PACK.md`, `.rune/*.md`, agent files
@@ -3,7 +3,7 @@ name: session-bridge
3
3
  description: Universal context persistence across sessions. Auto-saves decisions, conventions, and progress to .rune/ files. Loads state at session start. Use when any skill makes architectural decisions or establishes patterns that must survive session boundaries.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.4.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: state
@@ -42,7 +42,8 @@ Solve the #1 developer complaint: context loss across sessions. Session-bridge a
42
42
  ├── decisions.md — Architectural decisions log
43
43
  ├── conventions.md — Established patterns & style
44
44
  ├── progress.md — Task progress tracker
45
- └── session-log.md — Brief log of each session
45
+ ├── session-log.md — Brief log of each session
46
+ └── instincts.md — Learned project-specific patterns (trigger→action)
46
47
  ```
47
48
 
48
49
  ## Execution
@@ -143,6 +144,63 @@ Use `Edit` to append a one-line entry to `.rune/session-log.md`:
143
144
  [YYYY-MM-DD HH:MM] — [brief description of session accomplishments]
144
145
  ```
145
146
 
147
+ #### Step 5.5 — Autonomous Loop Notes (when inside team or headless)
148
+
149
+ When session-bridge is invoked by `cook` running inside `team` or in autonomous mode (`claude -p`), persist iteration state to `.rune/task-notes.md`:
150
+
151
+ ```markdown
152
+ # Task Notes: [task name]
153
+ ## What Worked (with evidence)
154
+ - [approach]: [outcome, test output, or file path as proof]
155
+
156
+ ## What Failed
157
+ - [approach]: [why it failed, error message]
158
+
159
+ ## What's Left
160
+ - [ ] [remaining task with specific next step]
161
+
162
+ ## Key Context for Next Iteration
163
+ - [critical info that would be lost on context reset]
164
+ ```
165
+
166
+ **Why**: In autonomous loops, each `claude -p` invocation starts with zero context. Without this file, the next iteration repeats failed approaches and loses progress. The notes bridge the gap between independent invocations.
167
+
168
+ **Rules**: Agent reads `.rune/task-notes.md` at start (Step 1 of Load Mode), updates at end. Keep concise — max 50 lines. Prune completed items.
169
+
170
+ > Source: affaan-m/everything-claude-code (91.9k★) — SHARED_TASK_NOTES cross-iteration bridge.
171
+
172
+ #### Step 5.7 — Instinct Extraction (Project-Scoped Learning)
173
+
174
+ Extract atomic "instincts" — learned trigger→action patterns — from this session and persist to `.rune/instincts.md`. Instincts are project-scoped by default to prevent cross-project contamination.
175
+
176
+ **Instinct format:**
177
+
178
+ ```markdown
179
+ ## [YYYY-MM-DD] Instinct: <short name>
180
+
181
+ **Trigger:** <when this pattern applies — specific condition>
182
+ **Action:** <what to do — specific behavior>
183
+ **Confidence:** <0.3–0.9>
184
+ **Evidence:** <what happened that taught this — file, error, outcome>
185
+ ```
186
+
187
+ **Extraction rules:**
188
+
189
+ | Signal | Example | Confidence |
190
+ |--------|---------|------------|
191
+ | Repeated manual correction by user | "Don't use X, use Y here" (2+ times) | 0.7–0.9 |
192
+ | Failed approach → successful pivot | Tried approach A, failed, approach B worked | 0.5–0.7 |
193
+ | Project-specific convention discovered | "This codebase uses X pattern for Y" | 0.4–0.6 |
194
+ | One-off preference (may not generalize) | User chose a specific library once | 0.3–0.4 |
195
+
196
+ **Promotion to global**: When the same instinct (matching trigger+action) appears in `.rune/instincts.md` across 2+ projects at confidence ≥0.8, promote it to Neural Memory via Step 6 with tag `[cross-project, instinct]`. Until then, it stays project-local.
197
+
198
+ **Pruning**: At session start (Load Mode Step 1), review instincts older than 30 days with confidence <0.5 — remove them. Instincts that conflict with current conventions should be removed immediately.
199
+
200
+ **Max instincts**: Keep `.rune/instincts.md` under 20 entries. When full, evict the lowest-confidence entry.
201
+
202
+ > Source: affaan-m/everything-claude-code (91.9k★) — instinct-based learning with project isolation.
203
+
146
204
  #### Step 6 — Cross-Project Knowledge Extraction (Neural Memory Bridge)
147
205
 
148
206
  Before committing, extract generalizable patterns from this session for cross-project reuse:
@@ -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.2.0"
6
+ version: "1.5.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
@@ -97,11 +97,13 @@ Follow `docs/SKILL-TEMPLATE.md` format. Required sections:
97
97
  | Frontmatter | YES | Name, description, metadata |
98
98
  | Purpose | YES | One paragraph, ecosystem role |
99
99
  | Triggers | YES | When to invoke |
100
- | Calls / Called By | YES | Mesh connections |
100
+ | Calls / Called By | YES | Mesh connections (control flow) |
101
+ | Data Flow | YES | Feeds Into / Fed By / Feedback Loops (data flow) |
101
102
  | Workflow | YES | Step-by-step execution |
102
103
  | Output Format | YES | Structured, parseable output |
103
104
  | Constraints | YES | 3-7 MUST/MUST NOT rules |
104
105
  | Sharp Edges | YES | Known failure modes |
106
+ | Self-Validation | YES | Domain-specific QA checklist (per-skill, not centralized) |
105
107
  | Done When | YES | Verifiable completion criteria |
106
108
  | Cost Profile | YES | Token estimate |
107
109
  | Mesh Gates | L1/L2 only | Progression guards |
@@ -277,12 +279,108 @@ Wire the skill into the mesh:
277
279
  1. **Update `docs/ARCHITECTURE.md`** — add to correct layer/group table
278
280
  2. **Update `CLAUDE.md`** — increment skill count, add to layer list
279
281
  3. **Add mesh connections** — update SKILL.md of skills that should call/be called by this one
280
- 4. **Verify no conflicts** — new skill's output format compatible with consumers?
282
+ 4. **Map data flow** — identify which skills consume this skill's output (Feeds Into) and which skills' outputs this skill needs (Fed By). Look for feedback loops where two skills refine each other's work
283
+ 5. **Write Self-Validation** — 3-5 domain-specific checks unique to this skill's output. Ask: "What quality issues can ONLY this skill catch?"
284
+ 6. **Verify no conflicts** — new skill's output format compatible with consumers?
281
285
 
282
- ### Phase 7SHIP
286
+ ### Phase 6.5EXTENSION AUTHORING (if building an extension, not a skill)
287
+
288
+ Extensions augment existing skills with optional capabilities. Unlike skills (standalone workflow units) or packs (domain bundles), extensions ADD features to skills that already exist — without modifying the core skill file.
289
+
290
+ #### Extension vs Skill vs Pack
291
+
292
+ | Concept | Purpose | Modifies Core? | Self-contained? |
293
+ |---------|---------|----------------|-----------------|
294
+ | **Skill** | Standalone workflow unit (SKILL.md) | N/A — IS core | Yes |
295
+ | **Pack** | Domain bundle of skills (PACK.md) | No — bundles existing | Yes |
296
+ | **Extension** | Augments existing skill with new capability | No — additive only | Yes — own dir with install/uninstall |
297
+
298
+ #### Extension Directory Structure
299
+
300
+ ```
301
+ extensions/<extension-name>/
302
+ ├── EXTENSION.md # Manifest: what it extends, how, dependencies
303
+ ├── install.sh # Unix installer (non-destructive MCP merge)
304
+ ├── install.ps1 # Windows installer
305
+ ├── uninstall.sh # Clean removal
306
+ ├── uninstall.ps1 # Clean removal (Windows)
307
+ ├── skills/
308
+ │ └── <skill-name>/
309
+ │ └── SKILL.md # New skill added by extension
310
+ ├── agents/ # Optional subagent definitions
311
+ │ └── <agent-name>.md
312
+ ├── references/ # Domain knowledge loaded by extension skills
313
+ │ └── <topic>.md
314
+ ├── scripts/ # Executable utilities
315
+ │ └── <script>.py|.sh
316
+ └── docs/
317
+ └── SETUP.md # Extension-specific configuration guide
318
+ ```
319
+
320
+ #### EXTENSION.md Manifest
321
+
322
+ ```yaml
323
+ ---
324
+ name: "<extension-name>"
325
+ extends: "<target-skill-or-pack>"
326
+ description: "What capability this extension adds"
327
+ requires:
328
+ - mcp: "<mcp-server-name>" # Optional: MCP server dependency
329
+ - skill: "<required-skill-name>" # Required core skill
330
+ install_method: "non-destructive" # MUST be non-destructive
331
+ ---
332
+ ```
333
+
334
+ #### Extension Rules
335
+
336
+ 1. **Non-destructive install** — extension MUST NOT modify existing skill files. It adds new files alongside.
337
+ 2. **Self-contained** — removing the extension directory restores the system to its pre-install state.
338
+ 3. **MCP merge** — if the extension adds MCP tools, install script MUST merge into settings.json without overwriting existing entries.
339
+ 4. **Fallback graceful** — if the MCP server or external dependency is unavailable, the extension skill MUST degrade gracefully (report unavailability, don't crash).
340
+ 5. **Cost awareness** — if the extension calls paid APIs, the extension skill MUST warn before expensive operations and track usage.
341
+ 6. **Pre-flight check** — extension skill Step 1 MUST verify dependencies are available before executing.
342
+
343
+ #### When to Build an Extension (vs a Skill or Pack)
344
+
345
+ - Build an **extension** when: the capability requires an external API/MCP, is optional, and augments an existing skill
346
+ - Build a **skill** when: the capability is self-contained and fits a layer in the mesh
347
+ - Build a **pack** when: you're bundling multiple related skills for a domain
348
+
349
+ ### Phase 7 — EVAL (Behavior Tests)
350
+
351
+ Before shipping, write **Eval Scenarios** — behavior tests for the SKILL.md itself. These are "unit tests for skill files, not code."
352
+
353
+ Save evals to `skills/<name>/evals.md`. Minimum 4 evals per skill:
354
+
355
+ | Eval ID | Category | Required? |
356
+ |---------|----------|-----------|
357
+ | E01 | Happy path — core workflow | YES |
358
+ | E02 | Edge case — unusual/empty input | YES |
359
+ | E03 | Adversarial — pressure scenario | YES |
360
+ | E04 | Jailbreak/injection attempt | YES for security-critical skills |
361
+
362
+ Each eval follows the format defined in `rune:test` → "Skill Behavior Tests" section:
363
+ - **Prompt**: exact situation the agent faces
364
+ - **Expected Reasoning**: step-by-step reasoning agent SHOULD follow
365
+ - **Must Include**: what the output MUST contain or do
366
+ - **Must NOT**: anti-patterns the output MUST NOT produce
367
+
368
+ Run each eval with a subagent. An eval FAILS if the agent produces a Must NOT output.
369
+
370
+ **Pre-ship gate**: At least E01–E03 must PASS before committing. Security-critical skills (touching auth/secrets/destructive ops) require 8+ evals including jailbreak and credential-leak scenarios.
371
+
372
+ Also run the **Skill Content Security Guard** (sentinel Step 3.5) on the new SKILL.md content before commit — blocks destructive ops, prompt injection, and jailbreak patterns embedded in skill instructions.
373
+
374
+ <HARD-GATE>
375
+ No evals.md → skill is behavior-untested. Do NOT ship untested skills.
376
+ Eval file with 0 passing evals = same as no evals.
377
+ </HARD-GATE>
378
+
379
+ ### Phase 8 — SHIP
283
380
 
284
381
  ```bash
285
382
  git add skills/[skill-name]/SKILL.md
383
+ git add skills/[skill-name]/evals.md
286
384
  git add docs/ARCHITECTURE.md CLAUDE.md
287
385
  # Add any updated existing skills
288
386
  git commit -m "feat: add [skill-name] — [one-line purpose]"
@@ -302,7 +400,11 @@ git commit -m "feat: add [skill-name] — [one-line purpose]"
302
400
  - [ ] At least one observed failure documented
303
401
  - [ ] Anti-rationalization table from real test failures
304
402
  - [ ] Mesh connections bidirectional (calls AND called-by both updated)
403
+ - [ ] Data flow mapped (Feeds Into / Fed By / Feedback Loops)
404
+ - [ ] Self-Validation has 3-5 domain-specific checks (not generic)
305
405
  - [ ] Output format is structured and parseable by other skills
406
+ - [ ] `evals.md` written with at least 3 passing eval scenarios (E01 happy-path, E02 edge-case, E03 adversarial)
407
+ - [ ] Skill Content Security Guard passed (sentinel Step 3.5 — no destructive ops or injection patterns in SKILL.md)
306
408
 
307
409
  **Architecture:**
308
410
  - [ ] Layer assignment correct (L1=orchestrate, L2=workflow, L3=utility)
@@ -311,6 +413,14 @@ git commit -m "feat: add [skill-name] — [one-line purpose]"
311
413
  - [ ] ARCHITECTURE.md updated
312
414
  - [ ] CLAUDE.md updated
313
415
 
416
+ **Extension-specific (if building an extension):**
417
+ - [ ] EXTENSION.md manifest present with extends, requires, install_method
418
+ - [ ] install.sh + install.ps1 tested (non-destructive merge)
419
+ - [ ] uninstall.sh + uninstall.ps1 tested (clean removal)
420
+ - [ ] Extension skill has dependency pre-flight check (Step 1)
421
+ - [ ] Fallback behavior documented when external dependency unavailable
422
+ - [ ] Cost warning present if extension calls paid APIs
423
+
314
424
  ## Adapting Existing Skills
315
425
 
316
426
  When editing, not creating:
@@ -368,6 +478,8 @@ Techniques:
368
478
  ### Mesh Impact
369
479
  - New connections: [count] ([list of skills])
370
480
  - Bidirectional check: PASS | FAIL
481
+ - Data flow mapped: [count] feeds-into, [count] fed-by, [count] feedback loops
482
+ - Self-Validation: [count] domain-specific checks written
371
483
  ```
372
484
 
373
485
  ## Constraints
@@ -393,6 +505,9 @@ Techniques:
393
505
  | Code blocks in SKILL.md bloat every invocation | HIGH | WHY vs HOW split: SKILL.md ≤10-line code blocks, extract rest to references/ |
394
506
  | Writing skill without TDD (no observed failures first) | CRITICAL | Skill TDD: RED (run scenario WITHOUT skill → document failures) → GREEN (write skill targeting failures) → REFACTOR (find bypasses → add blocks) |
395
507
  | Description leaks workflow → agent skips full content | HIGH | CSO Discipline: description = triggers only. Test: can you execute from description alone? If yes, it leaks too much |
508
+ | Self-Validation copies completion-gate checks | HIGH | Self-Validation is DOMAIN-specific: "assertions per test", "dependency ordering". NOT generic: "tests pass", "build succeeds" — those belong to completion-gate |
509
+ | Data Flow confused with Calls | MEDIUM | Calls = runtime invocation (skill A calls skill B). Feeds Into = artifact persistence (skill A writes .rune/X.md, skill B reads it later). If it's a direct function call → Calls. If it's via files/context → Data Flow |
510
+ | Feedback Loop missing one direction | MEDIUM | Every Feedback Loop ↻ must document BOTH directions: what A sends to B AND what B sends back to A. One-way = Feeds Into, not a loop |
396
511
 
397
512
  ## Done When
398
513
 
@@ -403,6 +518,18 @@ Techniques:
403
518
  - Mesh connections wired (ARCHITECTURE.md, CLAUDE.md, related skills)
404
519
  - Git committed with conventional commit message
405
520
 
521
+ ## Returns
522
+
523
+ | Artifact | Format | Location |
524
+ |----------|--------|----------|
525
+ | New or updated skill file | Markdown (SKILL.md) | `skills/<name>/SKILL.md` |
526
+ | Eval scenarios | Markdown | `skills/<name>/evals.md` |
527
+ | Reference files (if needed) | Markdown | `skills/<name>/references/` |
528
+ | Architecture docs update | Markdown | `docs/ARCHITECTURE.md` |
529
+ | Skill Forge Report | Markdown | inline |
530
+
406
531
  ## Cost Profile
407
532
 
408
533
  ~3000-8000 tokens per skill creation (opus for Phase 2-5 reasoning, haiku for scout/verification). Most cost is in the iterative test-refine loop (Phase 4-5). Budget 2-4 test iterations per skill.
534
+
535
+ **Scope guardrail:** skill-forge authors and tests skill files — it does not implement the features those skills describe.