@rune-kit/rune 2.2.6 → 2.3.1
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 +395 -389
- package/compiler/__tests__/tier-override.test.js +158 -0
- package/compiler/adapters/antigravity.js +3 -8
- package/compiler/adapters/codex.js +3 -8
- package/compiler/adapters/cursor.js +3 -8
- package/compiler/adapters/generic.js +3 -8
- package/compiler/adapters/openclaw.js +4 -9
- package/compiler/adapters/opencode.js +3 -8
- package/compiler/adapters/windsurf.js +3 -8
- package/compiler/bin/rune.js +34 -1
- package/compiler/emitter.js +94 -5
- package/compiler/transforms/branding.js +10 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/SKILL-TEMPLATE.md +15 -0
- package/docs/VISION.md +3 -3
- package/docs/guides/index.html +14 -14
- package/docs/index.html +82 -13
- package/docs/script.js +33 -6
- package/docs/skills/index.html +832 -832
- package/docs/style.css +62 -0
- package/extensions/ai-ml/PACK.md +7 -0
- package/extensions/content/PACK.md +7 -0
- package/extensions/mobile/PACK.md +9 -9
- package/extensions/zalo/PACK.md +9 -0
- package/package.json +8 -6
- package/skills/adversary/SKILL.md +12 -0
- package/skills/audit/SKILL.md +526 -467
- package/skills/autopsy/SKILL.md +12 -0
- package/skills/ba/SKILL.md +349 -342
- package/skills/brainstorm/SKILL.md +11 -0
- package/skills/completion-gate/SKILL.md +260 -249
- package/skills/context-engine/SKILL.md +77 -1
- package/skills/context-pack/SKILL.md +160 -0
- package/skills/cook/SKILL.md +648 -958
- package/skills/cook/references/deviation-rules.md +19 -0
- package/skills/cook/references/error-recovery.md +37 -0
- package/skills/cook/references/exit-conditions.md +31 -0
- package/skills/cook/references/loop-detection.md +39 -0
- package/skills/cook/references/mid-run-signals.md +31 -0
- package/skills/cook/references/output-format.md +40 -0
- package/skills/cook/references/pack-detection.md +82 -0
- package/skills/cook/references/pause-resume-template.md +38 -0
- package/skills/cook/references/rfc-template.md +52 -0
- package/skills/cook/references/sharp-edges.md +24 -0
- package/skills/cook/references/subagent-status.md +38 -0
- package/skills/db/SKILL.md +12 -0
- package/skills/debug/SKILL.md +392 -362
- package/skills/deploy/SKILL.md +10 -0
- package/skills/deploy/references/post-deploy-integration.md +192 -0
- package/skills/design/SKILL.md +9 -0
- package/skills/docs/SKILL.md +12 -0
- package/skills/docs-seeker/SKILL.md +11 -0
- package/skills/fix/SKILL.md +281 -249
- package/skills/incident/SKILL.md +10 -0
- package/skills/launch/SKILL.md +12 -0
- package/skills/logic-guardian/SKILL.md +11 -0
- package/skills/marketing/SKILL.md +13 -0
- package/skills/mcp-builder/SKILL.md +13 -0
- package/skills/onboard/SKILL.md +50 -2
- package/skills/perf/SKILL.md +11 -0
- package/skills/plan/SKILL.md +342 -688
- package/skills/plan/references/completeness-scoring.md +36 -0
- package/skills/plan/references/outcome-block.md +40 -0
- package/skills/plan/references/plan-templates.md +193 -0
- package/skills/plan/references/wave-planning.md +44 -0
- package/skills/plan/references/workflow-registry.md +52 -0
- package/skills/preflight/SKILL.md +360 -280
- package/skills/rescue/SKILL.md +11 -0
- package/skills/research/SKILL.md +149 -150
- package/skills/retro/SKILL.md +11 -0
- package/skills/review/SKILL.md +489 -396
- package/skills/review-intake/SKILL.md +11 -0
- package/skills/safeguard/SKILL.md +12 -0
- package/skills/scaffold/SKILL.md +10 -0
- package/skills/scope-guard/SKILL.md +11 -0
- package/skills/scout/SKILL.md +9 -0
- package/skills/sentinel/SKILL.md +296 -425
- package/skills/sentinel/references/config-protection.md +52 -0
- package/skills/sentinel/references/destructive-commands.md +39 -0
- package/skills/sentinel/references/domain-hooks.md +73 -0
- package/skills/sentinel/references/framework-patterns.md +46 -0
- package/skills/sentinel/references/owasp-patterns.md +69 -0
- package/skills/sentinel/references/secret-patterns.md +40 -0
- package/skills/sentinel/references/skill-content-guard.md +54 -0
- package/skills/session-bridge/SKILL.md +56 -2
- package/skills/skill-forge/SKILL.md +47 -2
- package/skills/skill-router/{SKILL.md → skill.md} +446 -365
- package/skills/surgeon/SKILL.md +12 -0
- package/skills/team/SKILL.md +34 -1
- package/skills/test/SKILL.md +585 -427
- package/skills/watchdog/references/webhook-health-checks.md +243 -0
|
@@ -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,39 @@
|
|
|
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
|
+
|
|
6
|
+
## Pattern Table
|
|
7
|
+
|
|
8
|
+
Any skill executing Bash commands SHOULD check against these patterns before execution:
|
|
9
|
+
|
|
10
|
+
| Pattern | Risk | Action |
|
|
11
|
+
|---------|------|--------|
|
|
12
|
+
| `rm -rf` / `rm -r` / `rm --recursive` | Recursive delete | WARN — confirm target is expected |
|
|
13
|
+
| `DROP TABLE` / `DROP DATABASE` / `TRUNCATE` | Data loss | BLOCK — require explicit confirmation |
|
|
14
|
+
| `git push --force` / `git push -f` | History rewrite | WARN — confirm branch is correct |
|
|
15
|
+
| `git reset --hard` | Uncommitted work loss | WARN — verify no unsaved changes |
|
|
16
|
+
| `git checkout .` / `git restore .` | Working tree wipe | WARN — verify intent |
|
|
17
|
+
| `kubectl delete` / `docker system prune` | Production impact | BLOCK — require namespace/context confirmation |
|
|
18
|
+
| `chmod 777` / `chmod -R 777` | Permission escalation | WARN — almost never correct |
|
|
19
|
+
|
|
20
|
+
## Safe Exceptions (do NOT warn)
|
|
21
|
+
|
|
22
|
+
- `rm -rf node_modules`, `.next`, `dist`, `__pycache__`, `.cache`, `build`, `.turbo`, `coverage`, `target`
|
|
23
|
+
- `git push --force-with-lease` (safe force push)
|
|
24
|
+
- `docker rm` on explicitly named test containers
|
|
25
|
+
|
|
26
|
+
## Static Scan Targets (Step 4a)
|
|
27
|
+
|
|
28
|
+
Scan changed files for:
|
|
29
|
+
- Destructive shell commands in scripts: `rm -rf /`, `DROP TABLE`, `DELETE FROM` without `WHERE`, `TRUNCATE`
|
|
30
|
+
- File operations using absolute paths outside the project root (e.g., `/etc/`, `/usr/`, `C:\Windows\`)
|
|
31
|
+
- Direct production database connection strings (`prod`, `production` in DB host names)
|
|
32
|
+
|
|
33
|
+
Destructive command on production path = **BLOCK**. Suspicious path = **WARN**.
|
|
34
|
+
|
|
35
|
+
## Composable Modes (future — advisory only)
|
|
36
|
+
|
|
37
|
+
- **Careful mode**: warn before any destructive command (all patterns above)
|
|
38
|
+
- **Freeze mode**: restrict file edits to a specific directory (scope lock)
|
|
39
|
+
- **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,54 @@
|
|
|
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
|
+
|
|
7
|
+
## Category Groups
|
|
8
|
+
|
|
9
|
+
| Category | Pattern Examples | Severity |
|
|
10
|
+
|----------|-----------------|----------|
|
|
11
|
+
| Destructive ops | `rm -rf /`, `fork bomb: :(){ :|:& };:` | BLOCK |
|
|
12
|
+
| Code injection | `eval(`, `exec(`, `curl \| bash`, `wget \| sh` | BLOCK |
|
|
13
|
+
| Credential theft | `cat ~/.ssh`, `env \| grep`, `printenv` in instructions | BLOCK |
|
|
14
|
+
| Path traversal | `../../../`, `%2e%2e%2f` in tool call instructions | BLOCK |
|
|
15
|
+
| SQL injection | `' OR '1'='1`, `; DROP TABLE` in prompt text | BLOCK |
|
|
16
|
+
| Privilege escalation | `sudo`, `chmod 777`, `chown root` in agent instructions | WARN |
|
|
17
|
+
| Prompt injection | `Ignore previous instructions`, `Disregard your`, `New system prompt:` | BLOCK |
|
|
18
|
+
| Jailbreak attempts | `DAN mode`, `developer mode`, `unrestricted AI` | BLOCK |
|
|
19
|
+
| Data exfiltration | `curl -d @`, `nc -e`, sending files to external hosts in instructions | BLOCK |
|
|
20
|
+
| Reverse shell | `bash -i`, `/dev/tcp/`, `mkfifo` in agent instructions | BLOCK |
|
|
21
|
+
| Env variable leak | `$HOME`, `$PATH`, `$USER` echoed to external endpoints | WARN |
|
|
22
|
+
| File enumeration | `ls -la /`, `find / -name`, directory traversal in instructions | WARN |
|
|
23
|
+
| Network scanning | `nmap`, `masscan`, port scanning in instructions | BLOCK |
|
|
24
|
+
| Crypto mining | `xmrig`, `minergate`, cryptocurrency mining commands | BLOCK |
|
|
25
|
+
| Log tampering | `> /var/log/`, clearing auth logs in instructions | BLOCK |
|
|
26
|
+
| Process hijacking | `ptrace`, `LD_PRELOAD=` in agent instructions | BLOCK |
|
|
27
|
+
| Sudo escalation | `sudo -i`, `sudo su`, `sudo bash` | BLOCK |
|
|
28
|
+
| SUID abuse | `find / -perm -4000`, SUID bit manipulation | WARN |
|
|
29
|
+
| Crontab injection | `crontab -e`, scheduled malicious commands | WARN |
|
|
30
|
+
| Package poisoning | Installing from untrusted registries in instructions | WARN |
|
|
31
|
+
| DNS rebinding | Localhost bypass patterns in HTTP instructions | WARN |
|
|
32
|
+
| SSRF patterns | Internal IP ranges (10.x, 192.168.x, 172.16-31.x) in fetch instructions | WARN |
|
|
33
|
+
| Template injection | `{{7*7}}`, `${7*7}` in output templates | WARN |
|
|
34
|
+
| Insecure deserialization | `pickle.loads`, `yaml.load(` without safe loader | BLOCK |
|
|
35
|
+
| XXE injection | XML with `SYSTEM` entity in tool call content | WARN |
|
|
36
|
+
| Header injection | `\r\n` in HTTP header values | WARN |
|
|
37
|
+
| Command chaining abuse | `;` or `&&` chains in Bash instructions with destructive ops | WARN |
|
|
38
|
+
| Webhook exfiltration | Sending `.rune/` or `SKILL.md` content to external URLs | BLOCK |
|
|
39
|
+
|
|
40
|
+
## Safe Exceptions
|
|
41
|
+
|
|
42
|
+
These patterns appear legitimately in skill examples and MUST NOT trigger:
|
|
43
|
+
|
|
44
|
+
1. **Inside fenced code blocks labeled as anti-patterns** — preceded by `# BAD`, `// BAD`, or block labeled `bad-example`
|
|
45
|
+
2. **Inside backtick fences explicitly documenting the attack** — educational examples in security skills (sentinel itself, sast, adversary)
|
|
46
|
+
3. **Actual shell scripts in `scripts/` directory** — functional code, not agent instructions
|
|
47
|
+
4. **Files in `test/`, `fixtures/`, `__mocks__/`** — test data, not live instructions
|
|
48
|
+
|
|
49
|
+
## When to Apply
|
|
50
|
+
|
|
51
|
+
- Any time skill content is WRITTEN or EDITED (not just committed)
|
|
52
|
+
- Invoke from `skill-forge` Phase 7 pre-ship check
|
|
53
|
+
- Invoke from any hook writing to `SKILL.md` files
|
|
54
|
+
- 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.
|
|
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
|
-
|
|
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,59 @@ 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
|
+
#### Step 5.7 — Instinct Extraction (Project-Scoped Learning)
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
174
|
+
**Instinct format:**
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
## [YYYY-MM-DD] Instinct: <short name>
|
|
178
|
+
|
|
179
|
+
**Trigger:** <when this pattern applies — specific condition>
|
|
180
|
+
**Action:** <what to do — specific behavior>
|
|
181
|
+
**Confidence:** <0.3–0.9>
|
|
182
|
+
**Evidence:** <what happened that taught this — file, error, outcome>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Extraction rules:**
|
|
186
|
+
|
|
187
|
+
| Signal | Example | Confidence |
|
|
188
|
+
|--------|---------|------------|
|
|
189
|
+
| Repeated manual correction by user | "Don't use X, use Y here" (2+ times) | 0.7–0.9 |
|
|
190
|
+
| Failed approach → successful pivot | Tried approach A, failed, approach B worked | 0.5–0.7 |
|
|
191
|
+
| Project-specific convention discovered | "This codebase uses X pattern for Y" | 0.4–0.6 |
|
|
192
|
+
| One-off preference (may not generalize) | User chose a specific library once | 0.3–0.4 |
|
|
193
|
+
|
|
194
|
+
**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.
|
|
195
|
+
|
|
196
|
+
**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.
|
|
197
|
+
|
|
198
|
+
**Max instincts**: Keep `.rune/instincts.md` under 20 entries. When full, evict the lowest-confidence entry.
|
|
199
|
+
|
|
146
200
|
#### Step 6 — Cross-Project Knowledge Extraction (Neural Memory Bridge)
|
|
147
201
|
|
|
148
202
|
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.
|
|
6
|
+
version: "1.5.0"
|
|
7
7
|
layer: L2
|
|
8
8
|
model: opus
|
|
9
9
|
group: creation
|
|
@@ -346,10 +346,41 @@ install_method: "non-destructive" # MUST be non-destructive
|
|
|
346
346
|
- Build a **skill** when: the capability is self-contained and fits a layer in the mesh
|
|
347
347
|
- Build a **pack** when: you're bundling multiple related skills for a domain
|
|
348
348
|
|
|
349
|
-
### Phase 7 —
|
|
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
|
|
350
380
|
|
|
351
381
|
```bash
|
|
352
382
|
git add skills/[skill-name]/SKILL.md
|
|
383
|
+
git add skills/[skill-name]/evals.md
|
|
353
384
|
git add docs/ARCHITECTURE.md CLAUDE.md
|
|
354
385
|
# Add any updated existing skills
|
|
355
386
|
git commit -m "feat: add [skill-name] — [one-line purpose]"
|
|
@@ -372,6 +403,8 @@ git commit -m "feat: add [skill-name] — [one-line purpose]"
|
|
|
372
403
|
- [ ] Data flow mapped (Feeds Into / Fed By / Feedback Loops)
|
|
373
404
|
- [ ] Self-Validation has 3-5 domain-specific checks (not generic)
|
|
374
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)
|
|
375
408
|
|
|
376
409
|
**Architecture:**
|
|
377
410
|
- [ ] Layer assignment correct (L1=orchestrate, L2=workflow, L3=utility)
|
|
@@ -485,6 +518,18 @@ Techniques:
|
|
|
485
518
|
- Mesh connections wired (ARCHITECTURE.md, CLAUDE.md, related skills)
|
|
486
519
|
- Git committed with conventional commit message
|
|
487
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
|
+
|
|
488
531
|
## Cost Profile
|
|
489
532
|
|
|
490
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.
|