Skip to content

Commit a4f2cf0

Browse files
authored
Merge pull request #22 from raifdmueller/feat/llm-runtime-phase1
feat: LLM Runtime Integration modifier (L0-L4)
2 parents bc76722 + b358a5e commit a4f2cf0

8 files changed

Lines changed: 633 additions & 137 deletions

File tree

.claude/skills/risk-assess/SKILL.md

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,37 @@ Blast radius is nearly impossible to auto-detect. Note any hints:
145145

146146
Flag that user confirmation is **required**.
147147

148+
### 2f. LLM Runtime Integration Detection
149+
150+
Grep for LLM SDK imports and agentic patterns using the patterns in the
151+
`LLM Runtime Integration` section of `.claude/skills/shared/risk-model.md`.
152+
153+
Report findings with evidence:
154+
155+
```
156+
LLM Runtime scan for {module}:
157+
LLM SDK imports: 3 files
158+
src/chat/client.ts:1 — imports "openai"
159+
src/summarize.ts:2 — imports "@anthropic-ai/sdk"
160+
Generative patterns (L2+): 2 files
161+
src/chat/client.ts:14 — matches "messages.create"
162+
Tool use / agentic patterns (L3+): 0 matches
163+
Code-execution sandbox (L4): 0 matches
164+
→ Auto-detected hint: L2 (Generative)
165+
```
166+
167+
If **no** LLM imports are found:
168+
169+
```
170+
LLM Runtime scan for {module}:
171+
No LLM SDK imports found.
172+
→ Auto-detected hint: L0 (No LLM)
173+
```
174+
175+
Auto-detection produces only a **hint** — the user must always confirm the
176+
level explicitly in Step 3. A library import alone is ambiguous (could be
177+
test code, data-science notebooks, build tooling, or production).
178+
148179
---
149180

150181
## Step 3 — Interactive Confirmation
@@ -203,18 +234,49 @@ Data Sensitivity: Auto-detected score 2 (General PII)
203234
[Keep 2] / [Upgrade to 3: Sensitive PII] / [Upgrade to 4: PHI/PCI]
204235
```
205236

237+
### 3d. LLM Runtime Integration Confirmation (ALWAYS ask)
238+
239+
Auto-detection produces only a hint — **always** ask the user to confirm,
240+
even if L0 was detected (the user may know about planned future LLM use).
241+
242+
Present the hint with evidence, then ask:
243+
244+
```
245+
LLM Runtime Integration for {module}:
246+
Auto-detected hint: L2 (Generative)
247+
Evidence: openai + @anthropic-ai/sdk imported, messages.create pattern found in src/chat/client.ts
248+
249+
How does this module use LLMs at runtime?
250+
[0] No LLM — classical software, no LLM at runtime
251+
[1] Classify — passive use: sentiment, intent, embeddings
252+
[2] Generate — generative output: chat, summaries
253+
[3] Tool Use — function calling, LLM triggers actions
254+
[4] Agentic — autonomous loops, code execution, self-modification
255+
256+
Suggested: [2]
257+
```
258+
259+
Remind the user of the tier implications before they answer:
260+
261+
> **Note:** L3 forces at least Tier 3, L4 forces at least Tier 4, regardless
262+
> of the code dimensions. A coding agent that could run `rm -rf` is
263+
> safety-critical by definition.
264+
206265
---
207266

208267
## Step 4 — Tier Calculation and Output
209268

210269
### 4a. Calculate Tier
211270

212271
```
213-
Tier = max(codeType, language, deployment, data, blastRadius)
214-
Mapping: max <= 1 → Tier 1, max <= 2 → Tier 2, max <= 3 → Tier 3, max = 4 → Tier 4
272+
base = max(codeType, language, deployment, data, blastRadius)
273+
baseTier = base <= 1 ? 1 : base <= 2 ? 2 : base <= 3 ? 3 : 4
274+
floor = llmRuntimeLevel >= 4 ? 4 : llmRuntimeLevel >= 3 ? 3 : 1
275+
tier = max(baseTier, floor)
215276
```
216277

217-
Present the result:
278+
Present the result. If the LLM Runtime modifier **lifted** the tier
279+
above the base, make that explicit:
218280

219281
```
220282
{module} Risk Assessment:
@@ -223,10 +285,26 @@ Present the result:
223285
Deployment: 2 (Public-facing app)
224286
Data Sensitivity: 2 (General PII)
225287
Blast Radius: 1 (Performance / DoS)
288+
LLM Runtime: L0 (No LLM)
226289
227290
→ Tier 3 — determined by Code Type = 3
228291
```
229292

293+
Example with modifier lift:
294+
295+
```
296+
{module} Risk Assessment:
297+
Code Type: 2 (Business Logic)
298+
Language: 2 (Dynamically typed)
299+
Deployment: 2 (Public-facing app)
300+
Data Sensitivity: 1 (Internal business data)
301+
Blast Radius: 2 (Data loss recoverable)
302+
LLM Runtime: L4 (Agentic)
303+
304+
Base Tier: 2 — Moderate
305+
→ Tier 4 — lifted from Tier 2 by LLM Runtime L4 (Agentic)
306+
```
307+
230308
### 4b. Scan Existing Mitigations
231309

232310
Before writing, scan for mitigation signals as listed in the shared risk model.

.claude/skills/risk-mitigate/SKILL.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Read the shared risk model at `.claude/skills/shared/risk-model.md` for all meas
1818
> No Risk Radar Assessment found in CLAUDE.md. Please run `/risk-assess` first.
1919
4. If found, parse every `### Module: {name}` subsection. For each module extract:
2020
- The five dimension scores (codeType, language, deployment, data, blastRadius)
21+
- The **LLM Runtime Integration** level (L0–L4), if present (default L0 for legacy assessments)
2122
- The overall **Tier** (1–4)
2223
5. Print a summary table:
2324

2425
```
2526
Found N module(s) with risk assessments:
26-
| Module | Tier | Highest Dimension |
27-
|--------|------|-------------------|
28-
| ... | ... | ... |
27+
| Module | Tier | Highest Dimension | LLM Runtime |
28+
|--------|------|-------------------|-------------|
29+
| ... | ... | ... | L{N} |
2930
```
3031

3132
---
@@ -116,6 +117,54 @@ After the table, summarize:
116117
- Missing: Z
117118
- Completion: Y/X (percentage)
118119

120+
### 3b. LLM Runtime Callout (L3+ modules only)
121+
122+
If any module has `llmRuntimeLevel >= 3`, display a **callout** before moving
123+
to implementation, making it explicit that our mitigation catalog is
124+
**insufficient** for runtime LLM risks:
125+
126+
```
127+
⚠️ {module} has LLM Runtime Integration L{N} ({name})
128+
129+
The mitigations listed above cover build-time risks (how the code was
130+
written). Your runtime LLM use introduces a qualitatively different risk
131+
class — prompt injection, unauthorized tool calls, agentic runaway — that
132+
this framework does not deeply cover.
133+
134+
For these risks, defer to specialized frameworks:
135+
136+
• OWASP LLM Top 10
137+
https://owasp.org/www-project-top-10-for-large-language-model-applications/
138+
• Palo Alto Unit 42 SHIELD
139+
https://unit42.paloaltonetworks.com/securing-vibe-coding-tools/
140+
• Aikido VCAL
141+
https://www.aikido.dev/blog/vibe-coding-security
142+
• Google SAIF
143+
https://saif.google/secure-ai-framework
144+
145+
Recommended runtime mitigations (not installable via this skill):
146+
- Prompt injection detection and input sanitization
147+
- Tool allow-list / deny-list with least-privilege function calling
148+
- Output filtering (PII redaction, unsafe content detection)
149+
- Sandbox for code execution (e2b, Firecracker, gVisor)
150+
- Rate limiting and cost caps per user/session
151+
- Audit logging of all tool calls with prompt provenance
152+
- Human-in-the-loop confirmation for destructive actions
153+
```
154+
155+
Ask the user:
156+
157+
```
158+
Would you like to track these runtime mitigations in CLAUDE.md as
159+
pending items? [y/N]
160+
```
161+
162+
If yes, add a new table `### LLM Runtime Mitigations: {module-name} (L{N})`
163+
to CLAUDE.md with the recommended runtime mitigations as `Pending`, plus
164+
links to the source framework for each. The skill **does not** install
165+
these tools — they require architectural decisions that belong with the
166+
user, not an automated skill.
167+
119168
---
120169

121170
## Step 4 — Interactive Implementation

0 commit comments

Comments
 (0)