@rune-kit/rune 2.1.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/LICENSE +21 -0
- package/README.md +357 -0
- package/agents/.gitkeep +0 -0
- package/agents/architect.md +29 -0
- package/agents/asset-creator.md +11 -0
- package/agents/audit.md +11 -0
- package/agents/autopsy.md +11 -0
- package/agents/brainstorm.md +11 -0
- package/agents/browser-pilot.md +11 -0
- package/agents/coder.md +29 -0
- package/agents/completion-gate.md +11 -0
- package/agents/constraint-check.md +11 -0
- package/agents/context-engine.md +11 -0
- package/agents/cook.md +11 -0
- package/agents/db.md +11 -0
- package/agents/debug.md +11 -0
- package/agents/dependency-doctor.md +11 -0
- package/agents/deploy.md +11 -0
- package/agents/design.md +11 -0
- package/agents/docs-seeker.md +11 -0
- package/agents/fix.md +11 -0
- package/agents/hallucination-guard.md +11 -0
- package/agents/incident.md +11 -0
- package/agents/integrity-check.md +11 -0
- package/agents/journal.md +11 -0
- package/agents/launch.md +11 -0
- package/agents/logic-guardian.md +11 -0
- package/agents/marketing.md +11 -0
- package/agents/onboard.md +11 -0
- package/agents/perf.md +11 -0
- package/agents/plan.md +11 -0
- package/agents/preflight.md +11 -0
- package/agents/problem-solver.md +11 -0
- package/agents/rescue.md +11 -0
- package/agents/research.md +11 -0
- package/agents/researcher.md +29 -0
- package/agents/review-intake.md +11 -0
- package/agents/review.md +11 -0
- package/agents/reviewer.md +28 -0
- package/agents/safeguard.md +11 -0
- package/agents/sast.md +11 -0
- package/agents/scanner.md +28 -0
- package/agents/scope-guard.md +11 -0
- package/agents/scout.md +11 -0
- package/agents/sentinel.md +11 -0
- package/agents/sequential-thinking.md +11 -0
- package/agents/session-bridge.md +11 -0
- package/agents/skill-forge.md +11 -0
- package/agents/skill-router.md +11 -0
- package/agents/surgeon.md +11 -0
- package/agents/team.md +11 -0
- package/agents/test.md +11 -0
- package/agents/trend-scout.md +11 -0
- package/agents/verification.md +11 -0
- package/agents/video-creator.md +11 -0
- package/agents/watchdog.md +11 -0
- package/agents/worktree.md +11 -0
- package/commands/.gitkeep +0 -0
- package/commands/rune.md +168 -0
- package/compiler/__tests__/openclaw-adapter.test.js +140 -0
- package/compiler/__tests__/parser.test.js +55 -0
- package/compiler/adapters/antigravity.js +59 -0
- package/compiler/adapters/claude.js +37 -0
- package/compiler/adapters/cursor.js +67 -0
- package/compiler/adapters/generic.js +60 -0
- package/compiler/adapters/index.js +45 -0
- package/compiler/adapters/openclaw.js +150 -0
- package/compiler/adapters/windsurf.js +60 -0
- package/compiler/bin/rune.js +288 -0
- package/compiler/doctor.js +153 -0
- package/compiler/emitter.js +240 -0
- package/compiler/parser.js +208 -0
- package/compiler/transformer.js +69 -0
- package/compiler/transforms/branding.js +27 -0
- package/compiler/transforms/cross-references.js +29 -0
- package/compiler/transforms/frontmatter.js +38 -0
- package/compiler/transforms/hooks.js +68 -0
- package/compiler/transforms/subagents.js +36 -0
- package/compiler/transforms/tool-names.js +60 -0
- package/contexts/dev.md +34 -0
- package/contexts/research.md +43 -0
- package/contexts/review.md +55 -0
- package/extensions/ai-ml/PACK.md +517 -0
- package/extensions/analytics/PACK.md +557 -0
- package/extensions/backend/PACK.md +678 -0
- package/extensions/chrome-ext/PACK.md +995 -0
- package/extensions/content/PACK.md +381 -0
- package/extensions/devops/PACK.md +520 -0
- package/extensions/ecommerce/PACK.md +280 -0
- package/extensions/gamedev/PACK.md +393 -0
- package/extensions/mobile/PACK.md +273 -0
- package/extensions/saas/PACK.md +805 -0
- package/extensions/security/PACK.md +536 -0
- package/extensions/trading/PACK.md +597 -0
- package/extensions/ui/PACK.md +947 -0
- package/package.json +47 -0
- package/skills/.gitkeep +0 -0
- package/skills/adversary/SKILL.md +271 -0
- package/skills/asset-creator/SKILL.md +157 -0
- package/skills/audit/SKILL.md +466 -0
- package/skills/autopsy/SKILL.md +200 -0
- package/skills/ba/SKILL.md +279 -0
- package/skills/brainstorm/SKILL.md +266 -0
- package/skills/browser-pilot/SKILL.md +168 -0
- package/skills/completion-gate/SKILL.md +151 -0
- package/skills/constraint-check/SKILL.md +165 -0
- package/skills/context-engine/SKILL.md +176 -0
- package/skills/cook/SKILL.md +636 -0
- package/skills/db/SKILL.md +256 -0
- package/skills/debug/SKILL.md +240 -0
- package/skills/dependency-doctor/SKILL.md +235 -0
- package/skills/deploy/SKILL.md +174 -0
- package/skills/design/DESIGN-REFERENCE.md +365 -0
- package/skills/design/SKILL.md +462 -0
- package/skills/doc-processor/SKILL.md +254 -0
- package/skills/docs/SKILL.md +336 -0
- package/skills/docs-seeker/SKILL.md +166 -0
- package/skills/fix/SKILL.md +192 -0
- package/skills/git/SKILL.md +285 -0
- package/skills/hallucination-guard/SKILL.md +204 -0
- package/skills/incident/SKILL.md +241 -0
- package/skills/integrity-check/SKILL.md +169 -0
- package/skills/journal/SKILL.md +190 -0
- package/skills/launch/SKILL.md +330 -0
- package/skills/logic-guardian/SKILL.md +240 -0
- package/skills/marketing/SKILL.md +229 -0
- package/skills/mcp-builder/SKILL.md +311 -0
- package/skills/onboard/SKILL.md +298 -0
- package/skills/perf/SKILL.md +297 -0
- package/skills/plan/SKILL.md +520 -0
- package/skills/preflight/SKILL.md +231 -0
- package/skills/problem-solver/SKILL.md +284 -0
- package/skills/rescue/SKILL.md +434 -0
- package/skills/research/SKILL.md +122 -0
- package/skills/review/SKILL.md +354 -0
- package/skills/review-intake/SKILL.md +222 -0
- package/skills/safeguard/SKILL.md +188 -0
- package/skills/sast/SKILL.md +190 -0
- package/skills/scaffold/SKILL.md +276 -0
- package/skills/scope-guard/SKILL.md +150 -0
- package/skills/scout/SKILL.md +232 -0
- package/skills/sentinel/SKILL.md +320 -0
- package/skills/sentinel-env/SKILL.md +226 -0
- package/skills/sequential-thinking/SKILL.md +234 -0
- package/skills/session-bridge/SKILL.md +287 -0
- package/skills/skill-forge/SKILL.md +317 -0
- package/skills/skill-router/SKILL.md +267 -0
- package/skills/surgeon/SKILL.md +203 -0
- package/skills/team/SKILL.md +397 -0
- package/skills/test/SKILL.md +271 -0
- package/skills/trend-scout/SKILL.md +145 -0
- package/skills/verification/SKILL.md +201 -0
- package/skills/video-creator/SKILL.md +201 -0
- package/skills/watchdog/SKILL.md +166 -0
- package/skills/worktree/SKILL.md +140 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: preflight
|
|
3
|
+
description: Pre-commit quality gate that catches "almost right" code. Goes beyond linting — checks logic correctness, error handling, regressions, and completeness.
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.2.0"
|
|
7
|
+
layer: L2
|
|
8
|
+
model: sonnet
|
|
9
|
+
group: quality
|
|
10
|
+
tools: "Read, Bash, Glob, Grep"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# preflight
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
<HARD-GATE>
|
|
18
|
+
Preflight verdict of BLOCK stops the pipeline. The calling skill (cook, deploy, launch) MUST halt until all BLOCK findings are resolved and preflight re-runs clean.
|
|
19
|
+
</HARD-GATE>
|
|
20
|
+
|
|
21
|
+
Pre-commit quality gate that catches "almost right" code — the kind that compiles and passes linting but has logic errors, missing error handling, or incomplete implementations. Goes beyond static analysis to check data flow, edge cases, async correctness, and regression impact. The last defense before code enters the repository.
|
|
22
|
+
|
|
23
|
+
## Triggers
|
|
24
|
+
|
|
25
|
+
- Called automatically by `cook` before commit phase
|
|
26
|
+
- Called by `fix` after applying fixes (verify fix quality)
|
|
27
|
+
- `/rune preflight` — manual quality check
|
|
28
|
+
- Auto-trigger: when staged changes exceed 100 LOC
|
|
29
|
+
|
|
30
|
+
## Calls (outbound)
|
|
31
|
+
|
|
32
|
+
- `scout` (L2): find code affected by changes (dependency tracing)
|
|
33
|
+
- `sentinel` (L2): security sub-check on changed files
|
|
34
|
+
- `hallucination-guard` (L3): verify imports and API references exist
|
|
35
|
+
- `test` (L2): run test suite as pre-commit check
|
|
36
|
+
|
|
37
|
+
## Called By (inbound)
|
|
38
|
+
|
|
39
|
+
- `cook` (L1): before commit phase — mandatory gate
|
|
40
|
+
|
|
41
|
+
## Check Categories
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
LOGIC — data flow errors, edge case misses, async bugs
|
|
45
|
+
ERROR — missing try/catch, bare catches, unhelpful error messages
|
|
46
|
+
REGRESSION — untested impact zones, breaking changes to public API
|
|
47
|
+
COMPLETE — missing validation, missing loading states, missing tests
|
|
48
|
+
SECURITY — delegated to sentinel
|
|
49
|
+
IMPORTS — delegated to hallucination-guard
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Executable Steps
|
|
53
|
+
|
|
54
|
+
### Stage A — Spec Compliance (Plan vs Diff)
|
|
55
|
+
|
|
56
|
+
Before checking code quality, verify the code matches what was planned.
|
|
57
|
+
|
|
58
|
+
Use `Bash` to get the diff: `git diff --cached` (staged) or `git diff HEAD` (all changes).
|
|
59
|
+
Use `Read` to load the approved plan from the calling skill (cook passes plan context).
|
|
60
|
+
|
|
61
|
+
**Check each plan phase against the diff:**
|
|
62
|
+
|
|
63
|
+
| Plan says... | Diff shows... | Verdict |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| "Add function X to file Y" | Function X exists in file Y | PASS |
|
|
66
|
+
| "Add function X to file Y" | Function X missing | BLOCK — incomplete implementation |
|
|
67
|
+
| "Modify function Z" | Function Z untouched | BLOCK — planned change not applied |
|
|
68
|
+
| Nothing about file W | File W modified | WARN — out-of-scope change (scope creep) |
|
|
69
|
+
|
|
70
|
+
**Output**: List of plan-vs-diff mismatches. Any missing planned change = BLOCK. Any unplanned change = WARN.
|
|
71
|
+
|
|
72
|
+
If no plan is available (manual preflight invocation), skip Stage A and proceed to Step 1.
|
|
73
|
+
|
|
74
|
+
### Step 1 — Logic Review
|
|
75
|
+
Use `Read` to load each changed file. For every modified function or method:
|
|
76
|
+
- Trace the data flow from input to output. Identify where a `null`, `undefined`, empty array, or 0 value would cause a runtime error or wrong result.
|
|
77
|
+
- Check async/await: every `async` function that calls an async operation must `await` it. Identify missing `await` that would cause race conditions or unhandled promise rejections.
|
|
78
|
+
- Check boundary conditions: off-by-one in loops, array index out of bounds, division by zero.
|
|
79
|
+
- Check type coercions: implicit `==` comparisons that could produce wrong results, string-to-number conversions without validation.
|
|
80
|
+
|
|
81
|
+
**Common patterns to flag:**
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// BAD — missing await (race condition)
|
|
85
|
+
async function processOrder(orderId: string) {
|
|
86
|
+
const order = db.orders.findById(orderId); // order is a Promise, not a value
|
|
87
|
+
return calculateTotal(order.items); // crashes: order.items is undefined
|
|
88
|
+
}
|
|
89
|
+
// GOOD
|
|
90
|
+
async function processOrder(orderId: string) {
|
|
91
|
+
const order = await db.orders.findById(orderId);
|
|
92
|
+
return calculateTotal(order.items);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// BAD — sequential independent I/O
|
|
98
|
+
const user = await fetchUser(id);
|
|
99
|
+
const permissions = await fetchPermissions(id); // waits unnecessarily
|
|
100
|
+
// GOOD — parallel
|
|
101
|
+
const [user, permissions] = await Promise.all([fetchUser(id), fetchPermissions(id)]);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Flag each issue with: file path, line number, category (null-deref | missing-await | off-by-one | type-coerce), and a one-line description.
|
|
105
|
+
|
|
106
|
+
### Step 2 — Error Handling
|
|
107
|
+
For every changed file, verify:
|
|
108
|
+
- Every `async` function has a `try/catch` block OR the caller explicitly handles the rejected promise.
|
|
109
|
+
- No bare `catch(e) {}` or `except: pass` — every catch must log or rethrow with context.
|
|
110
|
+
- Every `fetch` / HTTP client call checks the response status before consuming the body.
|
|
111
|
+
- Error messages are user-friendly: no raw stack traces, no internal variable names exposed to the client.
|
|
112
|
+
- API route handlers return appropriate HTTP status codes (4xx for client errors, 5xx for server errors).
|
|
113
|
+
|
|
114
|
+
**Common patterns to flag:**
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// BAD — swallowed exception
|
|
118
|
+
try {
|
|
119
|
+
await saveUser(data);
|
|
120
|
+
} catch (e) {} // silent failure, caller never knows
|
|
121
|
+
|
|
122
|
+
// BAD — leaks internals to client
|
|
123
|
+
app.use((err, req, res, next) => {
|
|
124
|
+
res.status(500).json({ error: err.stack }); // exposes stack trace
|
|
125
|
+
});
|
|
126
|
+
// GOOD — log internally, generic message to client
|
|
127
|
+
app.use((err, req, res, next) => {
|
|
128
|
+
logger.error(err);
|
|
129
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Flag each violation with: file path, line number, category (bare-catch | missing-status-check | raw-error-exposure), and description.
|
|
134
|
+
|
|
135
|
+
### Step 3 — Regression Check
|
|
136
|
+
Use `rune:scout` to identify all files that import or depend on the changed files/functions.
|
|
137
|
+
For each dependent file:
|
|
138
|
+
- Check if the changed function signature is still compatible (parameter count, types, return type).
|
|
139
|
+
- Check if the dependent file has tests that cover the interaction with the changed code.
|
|
140
|
+
- Flag untested impact zones: dependents with zero test coverage of the affected code path.
|
|
141
|
+
|
|
142
|
+
Flag each regression risk with: dependent file path, what changed, whether tests exist, severity (breaking | degraded | untested).
|
|
143
|
+
|
|
144
|
+
### Step 4 — Completeness Check
|
|
145
|
+
Verify that new code ships complete:
|
|
146
|
+
- New API endpoint → has input validation schema (Zod, Pydantic, Joi, etc.)
|
|
147
|
+
- New React/Svelte component → has loading state AND error state
|
|
148
|
+
- New feature → has at least one test file
|
|
149
|
+
- New configuration option → has documentation (inline comment or docs file)
|
|
150
|
+
- New database query → has corresponding migration file if schema changed
|
|
151
|
+
|
|
152
|
+
**Framework-specific completeness (apply only if detected):**
|
|
153
|
+
- React component with async data → must have `loading` state AND `error` state
|
|
154
|
+
- Next.js Server Action → must have `try/catch` and return typed result
|
|
155
|
+
- FastAPI endpoint → must have Pydantic request/response models
|
|
156
|
+
- Django ViewSet → must have explicit `permission_classes`
|
|
157
|
+
- Express route → must have input validation middleware before handler
|
|
158
|
+
|
|
159
|
+
If any completeness item is missing, flag as **WARN** with: what is missing, which file needs it.
|
|
160
|
+
|
|
161
|
+
### Step 5 — Security Sub-Check
|
|
162
|
+
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
|
+
|
|
164
|
+
### Step 6 — Generate Verdict
|
|
165
|
+
Aggregate all findings:
|
|
166
|
+
- Any BLOCK from sentinel OR a logic issue that would cause data corruption or security bypass → overall **BLOCK**
|
|
167
|
+
- Any missing error handling, regression risk with no tests, or incomplete feature → **WARN**
|
|
168
|
+
- Only style or best-practice suggestions → **PASS**
|
|
169
|
+
|
|
170
|
+
Report PASS, WARN, or BLOCK. For WARN, list each item the developer must acknowledge. For BLOCK, list each item that must be fixed before proceeding.
|
|
171
|
+
|
|
172
|
+
## Output Format
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
## Preflight Report
|
|
176
|
+
- **Status**: PASS | WARN | BLOCK
|
|
177
|
+
- **Files Checked**: [count]
|
|
178
|
+
- **Changes**: +[added] -[removed] lines across [files] files
|
|
179
|
+
|
|
180
|
+
### Logic Issues
|
|
181
|
+
- `path/to/file.ts:42` — null-deref: `user.name` accessed without null check
|
|
182
|
+
- `path/to/api.ts:85` — missing-await: async database call not awaited
|
|
183
|
+
|
|
184
|
+
### Error Handling
|
|
185
|
+
- `path/to/handler.ts:20` — bare-catch: error swallowed silently
|
|
186
|
+
|
|
187
|
+
### Regression Risk
|
|
188
|
+
- `utils/format.ts` — changed function used by 5 modules, 2 have tests, 3 untested (WARN)
|
|
189
|
+
|
|
190
|
+
### Completeness
|
|
191
|
+
- `api/users.ts` — new POST endpoint missing input validation schema
|
|
192
|
+
- `components/Form.tsx` — no loading state during submission
|
|
193
|
+
|
|
194
|
+
### Security (from sentinel)
|
|
195
|
+
- [sentinel findings if any]
|
|
196
|
+
|
|
197
|
+
### Verdict
|
|
198
|
+
WARN — 3 issues found (0 blocking, 3 must-acknowledge). Resolve before commit or explicitly acknowledge each WARN.
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Constraints
|
|
202
|
+
|
|
203
|
+
1. MUST check: logic errors, error handling, edge cases, type safety, naming conventions
|
|
204
|
+
2. MUST reference specific file:line for every finding
|
|
205
|
+
3. MUST NOT skip edge case analysis — "happy path works" is insufficient
|
|
206
|
+
4. MUST verify error messages are user-friendly and don't leak internal details
|
|
207
|
+
5. MUST check that async operations have proper error handling and cleanup
|
|
208
|
+
|
|
209
|
+
## Sharp Edges
|
|
210
|
+
|
|
211
|
+
| Failure Mode | Severity | Mitigation |
|
|
212
|
+
|---|---|---|
|
|
213
|
+
| Stopping at first BLOCK finding without checking remaining files | HIGH | Aggregate all findings first — developer needs the complete list, not just the first blocker |
|
|
214
|
+
| "Happy path works" accepted as sufficient | HIGH | CONSTRAINT blocks this — edge case analysis is mandatory on every function |
|
|
215
|
+
| Calling verification directly instead of the test skill | MEDIUM | Preflight calls rune:test for test suite execution; rune:verification for lint/type/build checks |
|
|
216
|
+
| 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
|
+
| Skipping Stage A (spec compliance) when plan is available | HIGH | If cook provides an approved plan, Stage A is mandatory — catches incomplete implementations |
|
|
218
|
+
| Agent modified files not in plan without flagging | MEDIUM | Stage A flags unplanned file changes as WARN — scope creep detection |
|
|
219
|
+
|
|
220
|
+
## Done When
|
|
221
|
+
|
|
222
|
+
- Every changed function traced for null-deref, missing-await, and off-by-one
|
|
223
|
+
- Error handling verified on all async functions and HTTP calls
|
|
224
|
+
- Regression impact assessed — dependent files identified via scout
|
|
225
|
+
- Completeness checklist passed (validation schema, loading/error states, test file)
|
|
226
|
+
- Sentinel invoked and its output attached in Security section
|
|
227
|
+
- Structured report emitted with PASS / WARN / BLOCK verdict and file:line for every finding
|
|
228
|
+
|
|
229
|
+
## Cost Profile
|
|
230
|
+
|
|
231
|
+
~2000-4000 tokens input, ~500-1500 tokens output. Sonnet for logic analysis quality.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: problem-solver
|
|
3
|
+
description: "Structured reasoning frameworks for complex problems. 14 analytical frameworks, 12 cognitive bias detectors, 10 decomposition methods, 8 mental models, and 6 communication patterns. McKinsey-grade problem solving for AI coding assistants."
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.3.0"
|
|
7
|
+
layer: L3
|
|
8
|
+
model: sonnet
|
|
9
|
+
group: reasoning
|
|
10
|
+
tools: "Read, Glob, Grep"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# problem-solver
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Structured reasoning utility for problems that resist straightforward analysis. Receives a problem statement, detects cognitive biases, selects the appropriate analytical framework, applies it step-by-step with evidence, and returns ranked solutions with a communication structure. Stateless — no memory between calls.
|
|
18
|
+
|
|
19
|
+
Inspired by McKinsey problem-solving methodology and cognitive science research on decision-making errors.
|
|
20
|
+
|
|
21
|
+
## Calls (outbound)
|
|
22
|
+
|
|
23
|
+
None — pure L3 reasoning utility.
|
|
24
|
+
|
|
25
|
+
## Called By (inbound)
|
|
26
|
+
|
|
27
|
+
- `debug` (L2): complex bugs that resist standard debugging
|
|
28
|
+
- `brainstorm` (L2): structured frameworks for creative exploration
|
|
29
|
+
- `plan` (L2): complex architecture decisions with many trade-offs
|
|
30
|
+
- `ba` (L2): requirement analysis when scope is ambiguous
|
|
31
|
+
|
|
32
|
+
## Execution
|
|
33
|
+
|
|
34
|
+
### Input
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
problem: string — clear statement of the problem to analyze
|
|
38
|
+
context: string — (optional) relevant background, constraints, symptoms observed
|
|
39
|
+
goal: string — (optional) desired outcome or success criteria
|
|
40
|
+
mode: string — (optional) "analyze" | "decide" | "decompose" | "communicate"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 1 — Receive and Classify
|
|
44
|
+
|
|
45
|
+
Read the `problem` and `context` inputs. Restate the problem in one sentence to confirm understanding.
|
|
46
|
+
|
|
47
|
+
Classify the problem type:
|
|
48
|
+
|
|
49
|
+
| Type | Signal Words | Primary Approach |
|
|
50
|
+
|------|-------------|-----------------|
|
|
51
|
+
| Root cause / diagnostic | "why", "broken", "failing", "declining" | 5 Whys, Fishbone, Root Cause |
|
|
52
|
+
| Decision / choice | "should I", "choose", "compare", "vs" | Decision Frameworks (Step 3b) |
|
|
53
|
+
| Decomposition | "break down", "understand", "structure" | Decomposition Methods (Step 3c) |
|
|
54
|
+
| Creative / stuck | "stuck", "no ideas", "exhausted options" | SCAMPER, Collision-Zone, Inversion |
|
|
55
|
+
| Architecture / scale | "design", "architecture", "will it scale" | First Principles, Scale Game |
|
|
56
|
+
|
|
57
|
+
### Step 2 — Bias Check (ALWAYS RUN)
|
|
58
|
+
|
|
59
|
+
<HARD-GATE>
|
|
60
|
+
NEVER skip bias detection. Every problem has biases — explicitly address them.
|
|
61
|
+
This is the #1 value-add from structured reasoning. Without it, solutions are just dressed-up gut feelings.
|
|
62
|
+
</HARD-GATE>
|
|
63
|
+
|
|
64
|
+
Scan the problem statement and context for bias indicators. Check the top 6 most dangerous biases:
|
|
65
|
+
|
|
66
|
+
| Bias | Detection Question | Debiasing Strategy |
|
|
67
|
+
|------|-------------------|-------------------|
|
|
68
|
+
| **Confirmation Bias** | Have we actively sought evidence AGAINST our preferred option? Are we explaining away contradictory data? | Assign devil's advocate. Explicitly seek disconfirming evidence. Require equal analysis of all options. |
|
|
69
|
+
| **Anchoring Effect** | Would our evaluation change if we saw options in a different order? Is the first number/proposal dominating? | Generate evaluation criteria BEFORE seeing options. Score independently before group discussion. |
|
|
70
|
+
| **Sunk Cost Fallacy** | If we were starting fresh today with zero prior investment, would we still choose this? Are we justifying by pointing to past spend? | Evaluate each option as if starting fresh (zero-based). Separate past investment from forward-looking decision. |
|
|
71
|
+
| **Status Quo Bias** | Are we holding the current state to the SAME standard as alternatives? Would we actively choose the status quo if starting from scratch? | Explicitly include status quo as an option evaluated with same rigor. Calculate the cost of inaction. |
|
|
72
|
+
| **Overconfidence** | What is our confidence level, and what is it based on? Have we been right about similar predictions before? | Use pre-mortem to stress-test. Track calibration. Seek outside perspectives. |
|
|
73
|
+
| **Planning Fallacy** | Are our estimates based on best-case assumptions? Have similar projects in the past taken longer or cost more? | Use reference class forecasting — compare to actual outcomes of similar past efforts rather than bottom-up estimates. |
|
|
74
|
+
|
|
75
|
+
Additional biases to check when relevant:
|
|
76
|
+
- **Framing Effect**: Would our preference change if framed as a gain vs. a loss?
|
|
77
|
+
- **Availability Heuristic**: Are we basing estimates on vivid anecdotes rather than systematic data?
|
|
78
|
+
- **Groupthink**: Has anyone expressed strong disagreement? Are we reaching consensus suspiciously fast?
|
|
79
|
+
- **Loss Aversion**: Are we avoiding an option primarily because of what we might lose, rather than evaluating the full picture?
|
|
80
|
+
- **Survivorship Bias**: Are we only looking at successful cases? Who tried this approach and failed?
|
|
81
|
+
- **Recency Bias**: Are we extrapolating from the last few data points instead of looking at 5-10 years of data?
|
|
82
|
+
|
|
83
|
+
**Output**: List 2-3 biases most likely to affect THIS specific problem, with their debiasing strategy. Weave these warnings into the analysis.
|
|
84
|
+
|
|
85
|
+
### Step 3a — Select Analytical Framework
|
|
86
|
+
|
|
87
|
+
Choose the framework based on what is unknown about the problem:
|
|
88
|
+
|
|
89
|
+
| Situation | Framework |
|
|
90
|
+
|-----------|-----------|
|
|
91
|
+
| Root cause unknown — symptoms clear | **5 Whys** |
|
|
92
|
+
| Multiple potential causes from different domains | **Fishbone (Ishikawa)** |
|
|
93
|
+
| Standard assumptions need challenging | **First Principles** |
|
|
94
|
+
| Creative options needed for known problem | **SCAMPER** |
|
|
95
|
+
| Must prioritize among known solutions | **Impact Matrix** |
|
|
96
|
+
| Conventional approaches exhausted, need breakthrough | **Collision-Zone Thinking** |
|
|
97
|
+
| Feeling forced into "the only way" | **Inversion Exercise** |
|
|
98
|
+
| Same pattern appearing in 3+ places | **Meta-Pattern Recognition** |
|
|
99
|
+
| Complexity spiraling, growing special cases | **Simplification Cascades** |
|
|
100
|
+
| Unsure if approach survives production scale | **Scale Game** |
|
|
101
|
+
| High-stakes irreversible decision — need to find blind spots | **Pre-Mortem** |
|
|
102
|
+
| Need to determine how much analysis effort is warranted | **Reversibility Filter** |
|
|
103
|
+
| Quantifiable outcomes with estimable probabilities | **Expected Value Calculation** |
|
|
104
|
+
| Key assumptions uncertain, need to know what flips the decision | **Sensitivity Analysis** |
|
|
105
|
+
|
|
106
|
+
State which framework was selected and why.
|
|
107
|
+
|
|
108
|
+
### Step 3b — Decision Frameworks (when mode = "decide")
|
|
109
|
+
|
|
110
|
+
When the problem is a decision/choice, use these specialized frameworks:
|
|
111
|
+
|
|
112
|
+
**Reversibility Filter** (always apply first):
|
|
113
|
+
- Is this a one-way door (irreversible) or two-way door (reversible)?
|
|
114
|
+
- Two-way door → decide quickly, set review date, iterate
|
|
115
|
+
- One-way door → invest in thorough analysis, use other frameworks
|
|
116
|
+
- Proportional effort: analysis depth should match reversibility
|
|
117
|
+
|
|
118
|
+
**Weighted Criteria Matrix** (multi-option comparison):
|
|
119
|
+
1. List all options
|
|
120
|
+
2. Define 3-5 evaluation criteria (max 5 — more causes choice overload)
|
|
121
|
+
3. Assign weights (must sum to 100)
|
|
122
|
+
4. Score each option 1-5 on each criterion
|
|
123
|
+
5. Calculate weighted scores
|
|
124
|
+
6. Run sensitivity: which weight changes would flip the decision?
|
|
125
|
+
|
|
126
|
+
**Pros-Cons-Fixes** (binary or few-option, quick):
|
|
127
|
+
1. List pros and cons for each option
|
|
128
|
+
2. For each con: can it be fixed, mitigated, or is it permanent?
|
|
129
|
+
3. Re-evaluate with fixable cons addressed
|
|
130
|
+
4. Decide based on remaining permanent trade-offs
|
|
131
|
+
|
|
132
|
+
**Pre-Mortem** (high-stakes, irreversible):
|
|
133
|
+
1. Assume the decision has already failed catastrophically (12 months later)
|
|
134
|
+
2. List what went wrong (work backward)
|
|
135
|
+
3. Categorize by likelihood and severity
|
|
136
|
+
4. Develop mitigation plans for high-risk failures
|
|
137
|
+
|
|
138
|
+
**Expected Value** (quantifiable outcomes):
|
|
139
|
+
1. List possible outcomes for each option
|
|
140
|
+
2. Estimate probability of each
|
|
141
|
+
3. Estimate value (monetary or utility) of each
|
|
142
|
+
4. Calculate EV = Σ(probability × value)
|
|
143
|
+
5. Choose highest EV adjusted for risk tolerance
|
|
144
|
+
|
|
145
|
+
### Step 3c — Decomposition Methods (when mode = "decompose")
|
|
146
|
+
|
|
147
|
+
When the problem needs structuring before analysis:
|
|
148
|
+
|
|
149
|
+
| Method | When to Use | Pattern |
|
|
150
|
+
|--------|------------|---------|
|
|
151
|
+
| **Issue Tree** | Don't have a hypothesis yet, exploring | Root Question → Sub-questions (why/what) → deeper |
|
|
152
|
+
| **Hypothesis Tree** | Have domain expertise, need speed | Hypothesis → Conditions that must be true → Evidence needed |
|
|
153
|
+
| **Profitability Tree** | Business performance problem | Profit → Revenue (Price × Volume) → Costs (Fixed + Variable) |
|
|
154
|
+
| **Process Flow** | Operational/efficiency problem | Step 1 → Step 2 → ... → find bottleneck |
|
|
155
|
+
| **Systems Map** | Complex with feedback loops | Variables → causal links (+/-) → reinforcing/balancing loops |
|
|
156
|
+
| **Customer Journey** | User/customer problem | Awareness → Consideration → Purchase → Experience → Retention |
|
|
157
|
+
|
|
158
|
+
All decompositions MUST pass the MECE test:
|
|
159
|
+
- **ME** (Mutually Exclusive): branches don't overlap
|
|
160
|
+
- **CE** (Collectively Exhaustive): branches cover all possibilities
|
|
161
|
+
|
|
162
|
+
### Step 4 — Apply Framework
|
|
163
|
+
|
|
164
|
+
Execute the selected framework with discipline. For each framework, follow the steps defined in Step 3a/3b/3c.
|
|
165
|
+
|
|
166
|
+
At each step, apply the bias debiasing strategies identified in Step 2.
|
|
167
|
+
|
|
168
|
+
### Step 5 — Apply Mental Models
|
|
169
|
+
|
|
170
|
+
Cross-check the framework output against relevant mental models:
|
|
171
|
+
|
|
172
|
+
| Model | Core Question | When It Helps |
|
|
173
|
+
|-------|--------------|---------------|
|
|
174
|
+
| **Second-Order Thinking** | "And then what?" — consequences of consequences | Decisions with delayed effects |
|
|
175
|
+
| **Bayesian Updating** | How should we update our beliefs given this new evidence? | When new data arrives during analysis |
|
|
176
|
+
| **Margin of Safety** | What buffer do we need for things going wrong? | Planning timelines, budgets, capacity |
|
|
177
|
+
| **Opportunity Cost** | What's the best alternative we're giving up? | Resource allocation, project prioritization |
|
|
178
|
+
| **Occam's Razor** | Among competing explanations, prefer the simplest | Multiple possible root causes |
|
|
179
|
+
| **Leverage Points** | Where does small effort produce large effect? | System redesign, process improvement |
|
|
180
|
+
| **Hanlon's Razor** | Never attribute to malice what can be explained by incompetence or misaligned incentives | Organizational problems, team conflicts |
|
|
181
|
+
| **Regression to the Mean** | Is this extreme result likely to revert to average? | After exceptional performance (good or bad) |
|
|
182
|
+
|
|
183
|
+
Apply 1-2 most relevant models. State which and why.
|
|
184
|
+
|
|
185
|
+
### Step 6 — Generate Solutions
|
|
186
|
+
|
|
187
|
+
From the framework output, derive 2-3 actionable solutions. For each:
|
|
188
|
+
- Describe what to do concretely
|
|
189
|
+
- Estimate impact: high / medium / low
|
|
190
|
+
- Estimate effort: high / medium / low
|
|
191
|
+
- State any preconditions or risks
|
|
192
|
+
- Note which biases might affect evaluation of this solution
|
|
193
|
+
|
|
194
|
+
Rank solutions by impact/effort ratio.
|
|
195
|
+
|
|
196
|
+
### Step 7 — Select Communication Structure
|
|
197
|
+
|
|
198
|
+
Choose how to present the analysis based on audience:
|
|
199
|
+
|
|
200
|
+
| Audience | Pattern | Format |
|
|
201
|
+
|----------|---------|--------|
|
|
202
|
+
| Executive / senior | **Pyramid Principle** | Lead with recommendation → support with 3 arguments → evidence |
|
|
203
|
+
| Mixed / unfamiliar | **SCR** | Situation (context) → Complication (tension) → Resolution (recommendation) |
|
|
204
|
+
| Technical / peers | **Day-1 Answer** | State best hypothesis → list evidence for/against → confidence level |
|
|
205
|
+
| Quick update | **BLUF** | Bottom Line Up Front → background → details → action required |
|
|
206
|
+
|
|
207
|
+
Structure the output report using the selected pattern.
|
|
208
|
+
|
|
209
|
+
## Constraints
|
|
210
|
+
|
|
211
|
+
- MUST run bias check (Step 2) for EVERY problem — the bias layer IS the differentiator
|
|
212
|
+
- Never skip the framework — the structure is the value
|
|
213
|
+
- Use Sonnet, not Haiku — reasoning depth matters
|
|
214
|
+
- If problem is underspecified, state assumptions explicitly before proceeding
|
|
215
|
+
- Do not produce more than 3 recommended solutions — prioritize quality over quantity
|
|
216
|
+
- Max 5 evaluation criteria in Weighted Matrix — more causes choice overload
|
|
217
|
+
- Decompositions MUST pass MECE test — no overlapping or missing branches
|
|
218
|
+
|
|
219
|
+
## Output Format
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
## Analysis: [Problem Statement]
|
|
223
|
+
- **Type**: [root cause / decision / decomposition / creative / architecture]
|
|
224
|
+
- **Framework**: [chosen framework and reason]
|
|
225
|
+
- **Confidence**: high | medium | low
|
|
226
|
+
|
|
227
|
+
### Bias Warnings
|
|
228
|
+
- ⚠️ [Bias 1]: [how it might affect this analysis] → [debiasing action taken]
|
|
229
|
+
- ⚠️ [Bias 2]: [how it might affect this analysis] → [debiasing action taken]
|
|
230
|
+
|
|
231
|
+
### Reasoning Chain
|
|
232
|
+
1. [step with evidence or reasoning]
|
|
233
|
+
2. [step with evidence or reasoning]
|
|
234
|
+
3. [step with evidence or reasoning]
|
|
235
|
+
...
|
|
236
|
+
|
|
237
|
+
### Mental Model Cross-Check
|
|
238
|
+
- [Model applied]: [insight gained]
|
|
239
|
+
|
|
240
|
+
### Root Cause / Core Finding
|
|
241
|
+
[what the framework reveals as the fundamental issue or conclusion]
|
|
242
|
+
|
|
243
|
+
### Recommended Solutions (ranked)
|
|
244
|
+
1. **[Solution Name]** — Impact: high/medium/low | Effort: high/medium/low
|
|
245
|
+
[concrete description of what to do]
|
|
246
|
+
⚠️ Bias risk: [which bias might make us over/under-value this]
|
|
247
|
+
2. **[Solution Name]** — Impact: high/medium/low | Effort: high/medium/low
|
|
248
|
+
[concrete description of what to do]
|
|
249
|
+
3. **[Solution Name]** — Impact: high/medium/low | Effort: high/medium/low
|
|
250
|
+
[concrete description of what to do]
|
|
251
|
+
|
|
252
|
+
### Next Action
|
|
253
|
+
[single most important immediate step]
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Sharp Edges
|
|
257
|
+
|
|
258
|
+
| Failure Mode | Severity | Mitigation |
|
|
259
|
+
|---|---|---|
|
|
260
|
+
| Skipping bias check and jumping to framework | CRITICAL | HARD-GATE: Step 2 is mandatory — biases ARE the value-add |
|
|
261
|
+
| Skipping the framework and jumping to solutions | CRITICAL | Solutions without structured analysis are guesses |
|
|
262
|
+
| Proceeding with underspecified problem | HIGH | Step 1: restate in one sentence — if ambiguous, state interpretation |
|
|
263
|
+
| Producing more than 3 solutions | MEDIUM | Max 3 ranked — prioritize quality over quantity |
|
|
264
|
+
| Framework mismatch (5 Whys for a creative problem) | MEDIUM | Use selection table — match framework to "what is unknown" |
|
|
265
|
+
| Weighted Matrix with > 5 criteria | MEDIUM | Choice overload — max 5 criteria, focus on what matters |
|
|
266
|
+
| Pre-Mortem without debiasing strategies | MEDIUM | Pre-Mortem reveals risks — MUST include mitigation plans |
|
|
267
|
+
| Decomposition failing MECE test | HIGH | Every branch must be ME (no overlap) and CE (no gaps) |
|
|
268
|
+
| Ignoring second-order effects in recommendations | MEDIUM | Apply Second-Order Thinking: "and then what?" |
|
|
269
|
+
| Presenting analysis without communication structure | LOW | Step 7: match output pattern to audience |
|
|
270
|
+
|
|
271
|
+
## Done When
|
|
272
|
+
|
|
273
|
+
- Problem restated in one sentence (understanding confirmed)
|
|
274
|
+
- Bias check completed — 2-3 biases identified with debiasing strategies
|
|
275
|
+
- Framework selected with explicit reason stated
|
|
276
|
+
- Framework applied step-by-step with evidence at each step
|
|
277
|
+
- Mental models cross-checked (1-2 relevant models applied)
|
|
278
|
+
- 2-3 solutions ranked by impact/effort ratio with bias risk noted
|
|
279
|
+
- Next Action identified (single most important immediate step)
|
|
280
|
+
- Analysis Report emitted with communication structure
|
|
281
|
+
|
|
282
|
+
## Cost Profile
|
|
283
|
+
|
|
284
|
+
~500-1500 tokens input, ~800-1500 tokens output. Sonnet for reasoning quality. Opus recommended for high-stakes irreversible decisions.
|