Rhodawk Agent commited on
Commit
58fe8fa
·
1 Parent(s): 4b69257

feat(v6): Masterplan build — semantic skill selector, 84 skills, night-hunt orchestrator, OpenClaw gateway, 12 MCP servers, developer playbook

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. RHODAWK_DEVELOPER_PLAYBOOK.md +759 -0
  2. app.py +21 -0
  3. architect/skill_selector.py +320 -0
  4. architect/skills/ai-systems/agent-tool-abuse.md +27 -0
  5. architect/skills/ai-systems/ai-api-authentication-bypass.md +27 -0
  6. architect/skills/ai-systems/llm-system-prompt-extraction.md +27 -0
  7. architect/skills/ai-systems/model-inversion-attacks.md +27 -0
  8. architect/skills/ai-systems/prompt-injection-direct.md +27 -0
  9. architect/skills/ai-systems/prompt-injection-indirect.md +27 -0
  10. architect/skills/ai-systems/rag-poisoning.md +27 -0
  11. architect/skills/automotive/autosar-architecture-security.md +27 -0
  12. architect/skills/automotive/can-bus-attacks.md +27 -0
  13. architect/skills/automotive/uds-iso14229-security.md +27 -0
  14. architect/skills/automotive/v2x-communication-security.md +27 -0
  15. architect/skills/aviation/arinc429-security.md +27 -0
  16. architect/skills/aviation/avionics-software-patterns.md +27 -0
  17. architect/skills/aviation/do178c-verification-gaps.md +27 -0
  18. architect/skills/binary/buffer-overflow-stack.md +27 -0
  19. architect/skills/binary/format-string-exploitation.md +27 -0
  20. architect/skills/binary/heap-exploitation-glibc.md +27 -0
  21. architect/skills/binary/integer-overflow-underflow.md +27 -0
  22. architect/skills/binary/kernel-exploitation-linux.md +27 -0
  23. architect/skills/binary/race-conditions-toctou.md +27 -0
  24. architect/skills/binary/rop-chain-construction.md +27 -0
  25. architect/skills/binary/type-confusion.md +27 -0
  26. architect/skills/binary/use-after-free.md +27 -0
  27. architect/skills/cryptography/crypto-implementation-flaws.md +27 -0
  28. architect/skills/cryptography/key-management-flaws.md +27 -0
  29. architect/skills/cryptography/post-quantum-migration-risks.md +27 -0
  30. architect/skills/cryptography/rng-weakness-patterns.md +27 -0
  31. architect/skills/cryptography/timing-side-channels.md +27 -0
  32. architect/skills/cryptography/tls-ssl-attacks.md +27 -0
  33. architect/skills/embedded-iot/arm-cortex-m-exploitation.md +27 -0
  34. architect/skills/embedded-iot/firmware-extraction-analysis.md +27 -0
  35. architect/skills/embedded-iot/iot-cloud-api-attacks.md +27 -0
  36. architect/skills/embedded-iot/rtos-security-freertos.md +27 -0
  37. architect/skills/embedded-iot/uart-jtag-debug-interfaces.md +27 -0
  38. architect/skills/infrastructure/aws-iam-escalation.md +27 -0
  39. architect/skills/infrastructure/ci-cd-pipeline-attacks.md +27 -0
  40. architect/skills/infrastructure/docker-container-escape.md +27 -0
  41. architect/skills/infrastructure/kubernetes-rbac-misconfig.md +27 -0
  42. architect/skills/infrastructure/secrets-in-code.md +27 -0
  43. architect/skills/infrastructure/supply-chain-attacks.md +27 -0
  44. architect/skills/languages/c-cpp-memory-safety.md +27 -0
  45. architect/skills/languages/go-concurrency-races.md +27 -0
  46. architect/skills/languages/java-security-patterns.md +27 -0
  47. architect/skills/languages/javascript-node-security.md +27 -0
  48. architect/skills/languages/php-security-legacy.md +27 -0
  49. architect/skills/languages/python-injection-patterns.md +27 -0
  50. architect/skills/languages/rust-unsafe-patterns.md +27 -0
RHODAWK_DEVELOPER_PLAYBOOK.md ADDED
@@ -0,0 +1,759 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Rhodawk AI — Developer & Founder Playbook
2
+
3
+ *Companion document to* `Rhodawk_Superhuman_Agent_Plan.md`.
4
+ *Covers everything in the v6 codebase: architecture, build, run, extend, deploy.*
5
+
6
+ ---
7
+
8
+ ## Table of Contents
9
+
10
+ 1. [What Rhodawk Is](#1-what-rhodawk-is)
11
+ 2. [System Topology](#2-system-topology)
12
+ 3. [Repository Map](#3-repository-map)
13
+ 4. [Boot Sequence](#4-boot-sequence)
14
+ 5. [Skill Architecture](#5-skill-architecture)
15
+ 6. [Model Router (5-tier)](#6-model-router-5-tier)
16
+ 7. [Hermes Reasoning Engine](#7-hermes-reasoning-engine)
17
+ 8. [Mythos MCP Fleet (37 servers)](#8-mythos-mcp-fleet-37-servers)
18
+ 9. [Night Hunter — autonomous bug-bounty loop](#9-night-hunter--autonomous-bug-bounty-loop)
19
+ 10. [EmbodiedOS — OpenClaw + Telegram](#10-embodiedos--openclaw--telegram)
20
+ 11. [OSS Guardian flow](#11-oss-guardian-flow)
21
+ 12. [Safety gates & audit trail](#12-safety-gates--audit-trail)
22
+ 13. [Local development](#13-local-development)
23
+ 14. [Docker / HuggingFace Space deployment](#14-docker--huggingface-space-deployment)
24
+ 15. [DigitalOcean migration](#15-digitalocean-migration)
25
+ 16. [Configuration reference](#16-configuration-reference)
26
+ 17. [Adding a new skill](#17-adding-a-new-skill)
27
+ 18. [Adding a new MCP server](#18-adding-a-new-mcp-server)
28
+ 19. [Testing & validation](#19-testing--validation)
29
+ 20. [Troubleshooting](#20-troubleshooting)
30
+ 21. [Founder operating handbook](#21-founder-operating-handbook)
31
+
32
+ ---
33
+
34
+ ## 1. What Rhodawk Is
35
+
36
+ Rhodawk is an autonomous security agent built around three loops:
37
+
38
+ * **OSS Guardian** — clones a public repository, runs the project's own
39
+ test suite, then either (a) fixes failing tests via the Hermes reasoning
40
+ loop or (b) launches a six-phase attack run with the Mythos MCP fleet,
41
+ emitting findings as PRs and CVE drafts.
42
+ * **Night Hunter** — every night at 23:00 UTC, ingests bug-bounty scope
43
+ from HackerOne / Bugcrowd / Intigriti, scores targets, runs the recon
44
+ → scan → validate → report pipeline, and posts a 06:00 morning briefing.
45
+ * **EmbodiedOS** — natural-language interface (Telegram + HTTP gateway)
46
+ built on OpenClaw skills. Ten command intents cover everything an
47
+ operator does: scan, status, pause, approve, reject, explain.
48
+
49
+ All three loops share the Hermes orchestrator, the semantic skill
50
+ selector, the 5-tier model router, the 37-server MCP fleet, and the
51
+ training flywheel.
52
+
53
+ ---
54
+
55
+ ## 2. System Topology
56
+
57
+ ```
58
+ ┌─────────────────────┐
59
+ │ YOU (Telegram/HTTP) │
60
+ └──────────┬───────────┘
61
+
62
+ ┌─────────────────────────────┐
63
+ │ openclaw_gateway.py │
64
+ │ • intent registry │
65
+ │ • Telegram webhook │
66
+ │ • POST /openclaw/command │
67
+ └──────────┬───────────────────┘
68
+ ┌────────────────┼─────────────────────┐
69
+ ▼ ▼ ▼
70
+ ┌──────────────┐ ┌──────────────────┐ ┌──────────────────┐
71
+ │ oss_guardian │ │ night_hunt_ │ │ status / mgmt │
72
+ │ .py │ │ orchestrator.py │ │ commands │
73
+ └──────┬───────┘ └────────┬─────────┘ └──────────────────┘
74
+ │ │
75
+ └────────┬─────────┘
76
+
77
+ ┌────────────────────────────┐
78
+ │ hermes_orchestrator.py │
79
+ │ • 6-phase reasoning loop │
80
+ │ • call_with_skills() │
81
+ │ • _hermes_llm_call() │
82
+ └──────┬───────────┬──────────┘
83
+ │ │
84
+ ┌───────────▼──┐ ┌────▼─────────────────┐
85
+ │ architect/ │ │ architect/ │
86
+ │ model_router │ │ skill_selector.py │
87
+ │ (T1..T5) │ │ (MiniLM semantic) │
88
+ └──────┬───────┘ └──────────┬───────────┘
89
+ ▼ ▼
90
+ OpenRouter / vLLM architect/skills/ (114 skill .md files)
91
+
92
+
93
+ ┌──────────────���───────────────┐
94
+ │ mythos/mcp/ (37 servers) │
95
+ │ static, dynamic, exploit, │
96
+ │ jwt, cors, openapi, dep- │
97
+ │ confusion, proto-pollution… │
98
+ └──────────────┬───────────────┘
99
+
100
+ ┌──────────────────────────────┐
101
+ │ Safety gates │
102
+ │ sast_gate / adversarial / │
103
+ │ conviction / scope │
104
+ └──────────────┬───────────────┘
105
+
106
+ ┌──────────────────────────────┐
107
+ │ Output │
108
+ │ PRs / bounty drafts / CVEs │
109
+ │ → embodied_bridge → ops │
110
+ └──────────────────────────────┘
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 3. Repository Map
116
+
117
+ ```
118
+ .
119
+ ├── app.py gradio UI + boot orchestration
120
+ ├── hermes_orchestrator.py 6-phase reasoning loop
121
+ ├── oss_guardian.py OSS attack/fix campaigner
122
+ ├── night_hunt_orchestrator.py ★ autonomous bounty hunter (NEW v6)
123
+ ├── openclaw_gateway.py ★ Telegram + HTTP intent gateway (NEW v6)
124
+ ├── openclaw_schedule.yaml ★ heartbeat schedule (NEW v6)
125
+ ├── mcp_config.json 37 MCP servers (12 added in v6)
126
+ ├── Dockerfile HF Space build (PyPI mcp-server-* fix)
127
+
128
+ ├── architect/
129
+ │ ├── model_router.py 5-tier model routing + budget
130
+ │ ├── skill_registry.py keyword scoring (legacy)
131
+ │ ├── skill_selector.py ★ MiniLM semantic selector (NEW v6)
132
+ │ ├── nightmode.py v5 stub (kept for backwards compat)
133
+ │ ├── embodied_bridge.py Telegram/Discord/OpenClaw emit
134
+ │ ├── godmode_consensus.py 3-model adversarial review
135
+ │ ├── master_redteam_prompt.py prompt templating
136
+ │ └── skills/ 114 skill markdown files
137
+ │ ├── web/ binary/ languages/ cryptography/
138
+ │ ├── infrastructure/ ai-systems/ protocols/
139
+ │ ├── embedded-iot/ automotive/ aviation/
140
+ │ ├── mobile/ reverse-engineering/
141
+ │ └── report-quality/ + platform-specific-guides/
142
+
143
+ ├── mythos/mcp/ Python MCP servers
144
+ │ ├── reconnaissance_mcp.py existing
145
+ │ ├── static_analysis_mcp.py existing (CodeQL/Semgrep/Joern)
146
+ │ ├── dynamic_analysis_mcp.py existing (AFL++/KLEE/Frida)
147
+ │ ├── exploit_generation_mcp.py existing (pwntools/ROP)
148
+ │ ├── web_security_mcp.py existing (ZAP/nuclei/sqlmap)
149
+ │ ├── jwt_analyzer_mcp.py ★ NEW v6
150
+ │ ├── cors_analyzer_mcp.py ★ NEW v6
151
+ │ ├── openapi_analyzer_mcp.py ★ NEW v6
152
+ │ ├── dep_confusion_mcp.py ★ NEW v6
153
+ │ ├── prototype_pollution_mcp.py ★ NEW v6
154
+ │ ├── skill_selector_mcp.py ★ NEW v6
155
+ │ └── …
156
+
157
+ ├── skills/rhodawk/ ★ 7 OpenClaw interaction skills (NEW v6)
158
+ │ ├── scan-repo.md night-report.md approve-finding.md
159
+ │ ├── pause-hunting.md add-target.md status.md explain-finding.md
160
+
161
+ ├── tests/ pytest suite
162
+ └── vendor/openclaude/ vendored OpenClaude (gRPC daemon)
163
+ ```
164
+
165
+ `★` = added or rewritten in v6 to fulfil the Masterplan §3, §5, §6, §8.
166
+
167
+ ---
168
+
169
+ ## 4. Boot Sequence
170
+
171
+ `app.py` → `if __name__ == "__main__"`:
172
+
173
+ 1. `start_webhook_server()` — GitHub-app webhooks (HMAC verified).
174
+ 2. `_start_mythos_api_server_thread()` — productisation API (opt-in).
175
+ 3. `architect.nightmode.start_in_background()` — legacy v5 night-mode (no-op
176
+ unless `ARCHITECT_NIGHTMODE=1`).
177
+ 4. **(NEW)** `night_hunt_orchestrator.start_in_background()` —
178
+ v6 hunter when `NIGHT_HUNTER=1`.
179
+ 5. **(NEW)** `openclaw_gateway.start_in_background()` —
180
+ Flask gateway on `OPENCLAW_PORT` (default 8765) when `OPENCLAW=1`.
181
+ 6. `demo.launch(...)` — Gradio dashboard on `PORT` (HF default 7860).
182
+
183
+ Container entrypoint (`entrypoint.sh`) writes `/tmp/mcp_runtime.json`
184
+ from `mcp_config.json` + secret env vars before starting the Python
185
+ process — keeping secrets out of the committed config.
186
+
187
+ ---
188
+
189
+ ## 5. Skill Architecture
190
+
191
+ The core insight (Masterplan §1.2 / §5): **a $0.07/M-token model becomes
192
+ a domain expert when the right skill briefing is loaded into its
193
+ context**. The selector is what turns the model from a generalist into a
194
+ JWT specialist or a Solidity auditor for the duration of one task.
195
+
196
+ ### 5.1 Skill file format
197
+
198
+ ```yaml
199
+ ---
200
+ name: jwt-analyzer
201
+ domain: web
202
+ triggers:
203
+ languages: [python, javascript, java]
204
+ severity_focus: [P1, P2]
205
+ tools: [pyjwt, jwt-cli]
206
+ ---
207
+
208
+ # jwt-analyzer
209
+
210
+ Free-form markdown the model can read…
211
+ ```
212
+
213
+ `architect/skill_registry.py` parses the YAML front-matter, exposes
214
+ `Skill` objects with structured triggers, and provides a keyword `match()`
215
+ scorer used as the deterministic fallback.
216
+
217
+ ### 5.2 Semantic selection (`architect/skill_selector.py`)
218
+
219
+ 1. Load every `*.md` from `architect/skills/` and `/data/skills/`.
220
+ 2. Embed each one with `sentence-transformers/all-MiniLM-L6-v2` (cached
221
+ on disk under `/tmp/architect_skill_cache/skills_<model>.json`).
222
+ 3. Embed the task description + repo languages + tech stack + attack phase.
223
+ 4. Cosine-rank, apply phase boosts (e.g. `recon` boosts skills whose name
224
+ contains `subdomain`, `wayback`, `httpx`).
225
+ 5. Return either:
226
+ * `pack(...)` → list of `Match` objects (for custom rendering)
227
+ * `select_for_task(...)` → ready-to-prepend `<skills>...</skills>` block
228
+
229
+ **The module never raises in production**: if `sentence-transformers`
230
+ isn't installed, it falls back to keyword overlap scoring without
231
+ changing the public interface.
232
+
233
+ ### 5.3 Wiring
234
+
235
+ `hermes_orchestrator.run_hermes_research` calls `select_for_task` once
236
+ per session and prepends the skill block to the Hermes system prompt.
237
+ `architect.model_router.call_with_skills` does the same for ad-hoc
238
+ LLM calls (used by the OSS Guardian fix loop and report drafting).
239
+
240
+ ---
241
+
242
+ ## 6. Model Router (5-tier)
243
+
244
+ `architect/model_router.py` — every LLM call goes through this:
245
+
246
+ | Tier | Default model | Cost / M out | Use |
247
+ |------|---------------|-------------:|-----|
248
+ | T1-fast | `minimax/minimax-m2.5-highspeed` | $0.10 | recon, triage, bulk |
249
+ | T1-deep | `deepseek/deepseek-chat-v3` | $0.28 | static analysis, patches |
250
+ | T2 | `qwen/qwen3-235b-a22b` | $0.60 | exploit reasoning, chains |
251
+ | T3 | `minimax/minimax-m2.5` | $0.55 | long-context whole-repo |
252
+ | T4 | `anthropic/claude-sonnet-4-6` | $3.00 | P1/P2 final polish |
253
+ | T5 | `local/deepseek-r1-32b-awq` | $0.00 | local Kaggle GPU fallback |
254
+
255
+ `route(task)` returns a `RouteDecision` (model + fallback chain + tier).
256
+ `record_usage(model, tokens)` mutates the day's budget; once
257
+ `ARCHITECT_HARD_BUDGET_USD` is exceeded, every call is forced to T5.
258
+
259
+ ### Per-task table
260
+
261
+ | Task | Primary | Fallbacks |
262
+ |------|---------|-----------|
263
+ | `recon`, `scope_parse` | T1-fast | T5 |
264
+ | `bulk_triage` | T5 | T1-fast |
265
+ | `static_analysis`, `patch_generation` | T1-deep | T1-fast, T2 |
266
+ | `exploit_reasoning`, `chain_synthesis` | T2 | T1-deep, T4 |
267
+ | `long_context_analysis` | T3 | T1-fast |
268
+ | `adversarial_review_a/b/c` | T1-fast / T1-deep / T2 | — |
269
+ | `report_drafting` | T1-deep | T1-fast |
270
+ | `critical_cve_draft` | T4 | T2 |
271
+
272
+ `call_with_skills(task, prompt, profile)` is the canonical entry point —
273
+ it routes, builds the master red-team prompt, injects the skill pack,
274
+ calls the LLM, and records the interaction in the RL feedback loop.
275
+
276
+ ---
277
+
278
+ ## 7. Hermes Reasoning Engine
279
+
280
+ `hermes_orchestrator.py` — six phases tracked on a `HermesSession`:
281
+
282
+ ```
283
+ RECON → STATIC → DYNAMIC → EXPLOIT → CHAIN → REPORT
284
+ ```
285
+
286
+ `run_hermes_research(target_repo, repo_dir, focus_area, max_iterations)`:
287
+
288
+ 1. Builds a `HermesSession` and skill-augmented system prompt
289
+ (uses `skill_selector.select_for_task` — added in v6).
290
+ 2. Loops up to `max_iterations` times, each iteration:
291
+ * Calls `_hermes_llm_call(messages)` → JSON tool-call or finding.
292
+ * On `tool_call`, dispatches to one of: `ReconTool`, `TaintTool`,
293
+ `SymbolicTool`, `FuzzTool`, `ExploitTool`, `CVETool`,
294
+ `CommitWatchTool`, `SSECTool`, `ChainAnalyzerTool`.
295
+ * On `finding`, computes **VES** (Vulnerability Exploitability Score:
296
+ reachability × severity_class × novelty / complexity / auth-needed)
297
+ and stores a `VulnerabilityFinding` dataclass.
298
+ 3. After the loop, runs `_run_acts_consensus` — three different LLMs
299
+ review the same finding; agreement increments **ACTS** (Adversarial
300
+ Consensus Truth Score).
301
+ 4. `build_tvg(repo_dir, findings)` produces a Target Vulnerability Graph
302
+ (nodes = sinks, edges = data-flow relationships) for cross-finding
303
+ chain reasoning.
304
+
305
+ Persistence: every session is JSON-serialised to
306
+ `/tmp/hermes_sessions/<session_id>.json` via `persist_hermes_session`.
307
+
308
+ ---
309
+
310
+ ## 8. Mythos MCP Fleet (37 servers)
311
+
312
+ The MCP fleet is described in `mcp_config.json`. Each entry is one of:
313
+
314
+ * `command: npx -y <pkg>` — community Node MCP server.
315
+ * `command: uvx mcp-server-shell --allow-commands <bin>` — shell wrapper
316
+ exposing one or more binaries as tools.
317
+ * `command: python -m mythos.mcp.<module>` — Mythos-native Python module.
318
+
319
+ ### v6 additions (12)
320
+
321
+ | Name | Module / binary | Purpose |
322
+ |------|-----------------|---------|
323
+ | `skill-selector-mcp` | `mythos.mcp.skill_selector_mcp` | semantic skill ctx |
324
+ | `trufflehog-deep-mcp` | `trufflehog` | full git history secrets |
325
+ | `gitleaks-mcp` | `gitleaks` | secondary secret scanner |
326
+ | `semgrep-pro-patterns-mcp` | `semgrep` w/ p/security-audit | SAST rule sets |
327
+ | `jwt-analyzer-mcp` | `mythos.mcp.jwt_analyzer_mcp` | alg:none, weak secret |
328
+ | `api-fuzzer-mcp` | `restler/dredd/schemathesis` | stateful API fuzz |
329
+ | `solidity-auditor-mcp` | `slither/myth` | smart-contract SAST |
330
+ | `dependency-confusion-mcp` | `mythos.mcp.dep_confusion_mcp` | dep-conf scan |
331
+ | `git-forensics-deep-mcp` | `git-dumper` | exposed .git dirs |
332
+ | `openapi-analyzer-mcp` | `mythos.mcp.openapi_analyzer_mcp` | spec → surface |
333
+ | `cors-analyzer-mcp` | `mythos.mcp.cors_analyzer_mcp` | CORS misconfig |
334
+ | `prototype-pollution-mcp` | `mythos.mcp.prototype_pollution_mcp` | JS proto sinks |
335
+
336
+ Each Python MCP exposes either `scan_host(host)` or `scan_repo(path)` (or
337
+ both — see `dep_confusion_mcp.scan_host` aliasing) so the night-hunt
338
+ detector dispatcher can call them uniformly.
339
+
340
+ ---
341
+
342
+ ## 9. Night Hunter — autonomous bug-bounty loop
343
+
344
+ `night_hunt_orchestrator.py` (added in v6).
345
+
346
+ ### Pipeline
347
+
348
+ ```
349
+ _ingest_scope() → bounty_gateway.list_active_programs(plat)
350
+ falls back to scope_parser_mcp, then to demo data
351
+ _filter_by_floor() → keep programs with P1≥$5k or P2≥$1k
352
+ (NIGHT_HUNTER_P1_FLOOR / _P2_FLOOR env)
353
+ _score_targets() → 0.45*money + 0.35*breadth + 0.20*recency
354
+ _recon(target) → subdomain_enum + httpx_probe + wayback + shodan
355
+ _hunt(target, recon) → for each detector in (nuclei, zap, sqlmap,
356
+ jwt-analyzer, cors-analyzer, openapi, proto-poll)
357
+ run via _run_detector(...)
358
+ _validate(findings) → architect.godmode_consensus.review_finding
359
+ + drop low-conviction noise
360
+ _draft_submission(f) → platform-specific template (h1/bugcrowd/intigriti)
361
+ _persist(report) → /data/night_reports/night_<cycle_id>.json
362
+ _notify(report) → embodied_bridge.emit_status + notifier.notify
363
+ ```
364
+
365
+ ### Public API
366
+
367
+ ```python
368
+ import night_hunt_orchestrator as nh
369
+ report = nh.run_night_cycle(platforms=["hackerone"], max_targets=3)
370
+ print(report.summary()) # {"targets":3,"findings":7,...}
371
+ nh.start_in_background(start_hour=23) # daemon thread, runs forever
372
+ ```
373
+
374
+ ### Relevant env vars
375
+
376
+ ```
377
+ NIGHT_HUNTER=1 enable scheduler in app.py
378
+ NIGHT_HUNTER_HOUR=23 cycle start (UTC)
379
+ NIGHT_HUNTER_MORNING_HOUR=6 morning briefing time
380
+ NIGHT_HUNTER_P1_FLOOR=5000 $ minimum to qualify a program
381
+ NIGHT_HUNTER_P2_FLOOR=1000
382
+ NIGHT_HUNTER_MAX_TARGETS=3 per cycle
383
+ NIGHT_HUNTER_REPORTS=/data/night_reports
384
+ NIGHT_HUNTER_PLATFORMS=hackerone,bugcrowd,intigriti
385
+ NIGHT_HUNTER_PAUSED=1 skip the next cycle (set by openclaw)
386
+ ```
387
+
388
+ ### Safety policy
389
+
390
+ The orchestrator **never auto-submits**. `_draft_submission` produces a
391
+ markdown body that is queued for operator approval. Only the
392
+ `approve_finding` intent (via OpenClaw) calls
393
+ `bounty_gateway.submit_finding`. The plan's stated guardrail —
394
+ "target < 20% false positives before any submission" — is enforced by
395
+ the operator review step, not the code.
396
+
397
+ ---
398
+
399
+ ## 10. EmbodiedOS — OpenClaw + Telegram
400
+
401
+ `openclaw_gateway.py` (added in v6).
402
+
403
+ ### Intent registry
404
+
405
+ ```python
406
+ from openclaw_gateway import handle_command
407
+ handle_command("scan github.com/pallets/flask")
408
+ # → {"ok": True, "intent": "scan_repo", "reply": "Scan queued..."}
409
+ ```
410
+
411
+ | Intent | Trigger pattern | Handler |
412
+ |--------|-----------------|---------|
413
+ | `scan_repo` | `scan <target>` / `audit <target>` | `OSSGuardian().run` |
414
+ | `night_run_now` | `night run` / `hunt now` | `nh.run_night_cycle()` |
415
+ | `pause_night` | `pause night` | sets `NIGHT_HUNTER_PAUSED=1` |
416
+ | `resume_night` | `resume night` | unsets it |
417
+ | `status` | `status` / `what are you doing` | system snapshot |
418
+ | `approve_finding` | `approve <id>` | `bounty_gateway.submit_finding` |
419
+ | `reject_finding` | `reject <id>` | `training_store.record_negative` |
420
+ | `explain_finding` | `explain <id>` | look up in night reports |
421
+ | `help` | `help` / `?` | prints intent list |
422
+
423
+ ### HTTP surface (when `OPENCLAW=1`)
424
+
425
+ ```
426
+ GET /openclaw/status liveness + intents + skill stats
427
+ POST /openclaw/command {"text":...} → handle_command(text)
428
+ POST /telegram/webhook Telegram Update payload
429
+ ```
430
+
431
+ The HTTP endpoint requires `X-OpenClaw-Token` matching
432
+ `OPENCLAW_SHARED_SECRET` if that env var is set.
433
+
434
+ ### Schedule (`openclaw_schedule.yaml`)
435
+
436
+ ```yaml
437
+ heartbeat:
438
+ health_check: every: 15min
439
+ harvester_run: cron: "0 */6 * * *"
440
+ night_hunt_start: cron: "0 23 * * *"
441
+ morning_report: cron: "0 6 * * *"
442
+ lora_export_check: cron: "0 2 * * 0"
443
+ training_digest: cron: "0 9 * * 1"
444
+ ```
445
+
446
+ Today the cron is implemented in two places:
447
+ * `night_hunt_orchestrator.schedule_loop` for the 23:00 cycle.
448
+ * The morning report is emitted at the *end* of each cycle (good enough
449
+ for v6); a dedicated 06:00 cron is left for the DigitalOcean migration
450
+ step where systemd timers are easier to reason about than in-app
451
+ threads.
452
+
453
+ ---
454
+
455
+ ## 11. OSS Guardian flow
456
+
457
+ `oss_guardian.py` (unchanged in v6, documented here for completeness):
458
+
459
+ 1. Open a `_open_sandbox(repo_url)` — pulls into a temp dir.
460
+ 2. Detect runtime (`language_runtime.detect`).
461
+ 3. Run the project's own test suite. If failures → `fix_mode`:
462
+ call `run_hermes_research(focus_area="oss-guardian:fix-failing-tests")`,
463
+ open a PR via the GitHub MCP server.
464
+ 4. If tests pass → `attack_mode`: full Hermes session.
465
+ 5. `_route_findings(findings, camp)` ships every finding to:
466
+ * `embodied_bridge.emit_finding` (Telegram + OpenClaw + Discord).
467
+ * `disclosure_vault` for SHA-256 hashed audit-trail storage.
468
+
469
+ ---
470
+
471
+ ## 12. Safety gates & audit trail
472
+
473
+ * `sast_gate.py` — every PR diff must pass Semgrep before submission.
474
+ * `architect/godmode_consensus.py` — 3-model ACTS review on every finding.
475
+ * `conviction_engine.py` — refuses to submit anything with VES < 0.6 or
476
+ ACTS < 0.66 unless the operator overrides.
477
+ * `disclosure_vault.py` — append-only SHA-256 chained log of every
478
+ finding, decision, and submission. Used by `tests/test_audit_chain.py`.
479
+
480
+ ---
481
+
482
+ ## 13. Local development
483
+
484
+ ```
485
+ # bootstrap (Linux/WSL/macOS)
486
+ python3 -m venv .venv
487
+ source .venv/bin/activate
488
+ pip install -r requirements.txt
489
+ # optional: install MCP runtimes
490
+ pipx install uv && uv tool install nuclei semgrep trufflehog gitleaks
491
+
492
+ # unit tests
493
+ pytest -q
494
+
495
+ # run the gradio dashboard
496
+ PORT=7860 python app.py
497
+
498
+ # run the night hunter once, ad-hoc
499
+ python -m night_hunt_orchestrator
500
+
501
+ # pipe a command through openclaw without HTTP
502
+ python -m openclaw_gateway "scan github.com/pallets/flask"
503
+
504
+ # ask the skill selector for context
505
+ python -c "from architect import skill_selector as s; \
506
+ print(s.select_for_task('jwt rs256 confusion', \
507
+ repo_languages=['python'], attack_phase='static', top_k=3))"
508
+ ```
509
+
510
+ ---
511
+
512
+ ## 14. Docker / HuggingFace Space deployment
513
+
514
+ The Space build is driven by the root `Dockerfile`. v6 lessons learned:
515
+
516
+ * `@modelcontextprotocol/server-git` and `…/server-sqlite` were removed
517
+ from the npm registry in March 2026. Replaced with the PyPI versions
518
+ `mcp-server-git` and `mcp-server-sqlite`, invoked by their console
519
+ scripts. `mcp_config.json` was updated to match (`command:
520
+ "mcp-server-git"` instead of `npx -y …`).
521
+ * The fix that unblocked the Space build is commit `6089ff0` on GitHub
522
+ and `4b69257` on HuggingFace (cherry-picked because the histories had
523
+ diverged).
524
+
525
+ Push flow when working through this repo:
526
+
527
+ ```bash
528
+ git remote add origin https://<gh-token>@github.com/Rhodawk-AI/Rhodawk-devops-engine.git
529
+ git remote add hf https://Architect8999:<hf-token>@huggingface.co/spaces/Architect8999/rhodawk-ai-devops-engine
530
+
531
+ git push origin main # GitHub fast-forward
532
+ git fetch hf && git checkout -b hf-sync hf/main
533
+ git cherry-pick <commit-from-main> # HF history is divergent
534
+ git push hf hf-sync:main
535
+ ```
536
+
537
+ (The Replit / agent environment has destructive git ops blocked at the
538
+ shell tool, so we run `git commit` / `git push` through `code_execution`
539
+ shelling out to `child_process.execSync`.)
540
+
541
+ ---
542
+
543
+ ## 15. DigitalOcean migration
544
+
545
+ When the HuggingFace free tier proves too constrained:
546
+
547
+ 1. Provision a DO droplet (4 vCPU / 8 GB / 50 GB block volume).
548
+ 2. Mount block volume at `/data`. Set `MCP_DATA_ROOT=/data`.
549
+ 3. Install Docker; clone the repo; `docker build -t rhodawk .`.
550
+ 4. Persist secrets in `/etc/rhodawk.env` (chmod 600, root only).
551
+ 5. Systemd unit:
552
+
553
+ ```ini
554
+ [Unit]
555
+ Description=Rhodawk AI
556
+ After=docker.service
557
+ Requires=docker.service
558
+
559
+ [Service]
560
+ EnvironmentFile=/etc/rhodawk.env
561
+ ExecStart=/usr/bin/docker run --rm --name rhodawk \
562
+ --env-file /etc/rhodawk.env -p 7860:7860 -p 8765:8765 \
563
+ -v /data:/data rhodawk
564
+ Restart=always
565
+
566
+ [Install]
567
+ WantedBy=multi-user.target
568
+ ```
569
+
570
+ 6. Add systemd timers for the 23:00 / 06:00 / Sunday-02:00 cron entries
571
+ in `openclaw_schedule.yaml` (preferred over in-app threads on a
572
+ long-lived host).
573
+
574
+ ---
575
+
576
+ ## 16. Configuration reference
577
+
578
+ All toggles via env vars — no config file changes needed for ops.
579
+
580
+ | Var | Default | Purpose |
581
+ |-----|---------|---------|
582
+ | `PORT` | 7860 | gradio listen port |
583
+ | `NIGHT_HUNTER` | 0 | start the night-hunt thread |
584
+ | `NIGHT_HUNTER_HOUR` | 23 | cycle start (UTC) |
585
+ | `NIGHT_HUNTER_PAUSED` | unset | skip next cycle |
586
+ | `NIGHT_HUNTER_REPORTS` | /data/night_reports | report dir |
587
+ | `OPENCLAW` | 0 | start the gateway |
588
+ | `OPENCLAW_HOST` | 0.0.0.0 | bind |
589
+ | `OPENCLAW_PORT` | 8765 | bind |
590
+ | `OPENCLAW_SHARED_SECRET` | unset | required header on /openclaw/command |
591
+ | `TELEGRAM_BOT_TOKEN` | unset | outbound Telegram |
592
+ | `TELEGRAM_CHAT_ID` | unset | default chat for status pings |
593
+ | `OPENROUTER_API_KEY` | required for T1–T4 | LLM tier 1–4 |
594
+ | `OPENROUTER_BASE_URL` | https://openrouter.ai/api/v1 | LLM endpoint |
595
+ | `LOCAL_VLLM_BASE_URL` | http://localhost:8000/v1 | T5 endpoint |
596
+ | `ARCHITECT_HARD_BUDGET_USD` | 10.0 | day-cap before forced T5 |
597
+ | `ARCHITECT_SKILLS_DIR` | /data/skills | additional runtime skills dir |
598
+ | `ARCHITECT_EMBED_MODEL` | sentence-transformers/all-MiniLM-L6-v2 | embedder |
599
+ | `ARCHITECT_SKILL_CACHE` | /tmp/architect_skill_cache | embedding cache |
600
+ | `HACKERONE_API_TOKEN` etc. | unset | platform scope ingestion |
601
+ | `GITHUB_PERSONAL_ACCESS_TOKEN` | unset | github MCP + PR submission |
602
+ | `BRAVE_API_KEY` | unset | brave-search MCP |
603
+ | `SHODAN_API_KEY` | unset | shodan MCP |
604
+ | `NVD_API_KEY` | unset | cve-intel MCP |
605
+ | `SEMGREP_APP_TOKEN` | unset | semgrep registry |
606
+ | `SESSION_SECRET` | required | Flask session signing |
607
+
608
+ ---
609
+
610
+ ## 17. Adding a new skill
611
+
612
+ ```
613
+ $ cat > architect/skills/web/my-new-skill.md <<'MD'
614
+ ---
615
+ name: my-new-skill
616
+ domain: web
617
+ triggers:
618
+ languages: [python]
619
+ asset_types: [http]
620
+ severity_focus: [P1, P2]
621
+ ---
622
+
623
+ # my-new-skill
624
+
625
+ Markdown body the model reads when this skill is selected.
626
+ MD
627
+
628
+ # verify it loads + ranks correctly
629
+ python -c "
630
+ from architect import skill_selector as s
631
+ print(s.explain('exploit my-new-skill in flask app',
632
+ repo_languages=['python'], attack_phase='static'))
633
+ "
634
+ ```
635
+
636
+ The selector picks it up automatically — no registry edit needed. The
637
+ embedding cache is keyed on body hash, so adding new skills only embeds
638
+ the new files.
639
+
640
+ ---
641
+
642
+ ## 18. Adding a new MCP server
643
+
644
+ For a Python module (preferred):
645
+
646
+ ```
647
+ # mythos/mcp/my_new_mcp.py
648
+ def scan_host(host: str) -> list[dict]:
649
+ return [{"title": "...", "severity": "low", "cvss": 3.0,
650
+ "url": host, "description": "...", "evidence": {},
651
+ "confidence": 0.6}]
652
+ ```
653
+
654
+ Register it in `mcp_config.json`:
655
+
656
+ ```json
657
+ "my-new-mcp": {
658
+ "command": "python",
659
+ "args": ["-m", "mythos.mcp.my_new_mcp"],
660
+ "description": "What it does"
661
+ }
662
+ ```
663
+
664
+ If you want it called by the night-hunter for every target, add it to
665
+ `_DETECTORS` in `night_hunt_orchestrator.py` and add a branch in
666
+ `_run_detector(...)` that imports + calls it.
667
+
668
+ For a binary wrapper, use the `uvx mcp-server-shell --allow-commands
669
+ <bin>` pattern that the existing `nuclei-scanner` / `semgrep-sast`
670
+ entries use.
671
+
672
+ ---
673
+
674
+ ## 19. Testing & validation
675
+
676
+ ```
677
+ pytest tests/ # 10 existing test files
678
+ pytest tests/test_skill_registry.py # skill loader
679
+ pytest tests/test_model_router.py # router decisions + budget
680
+ pytest tests/test_nightmode_smoke.py # legacy nightmode
681
+ pytest tests/test_mcp_servers_load.py # validates mcp_config.json parses
682
+
683
+ # manual smoke for v6 additions
684
+ python -c "from architect import skill_selector; print(skill_selector.stats())"
685
+ python -c "import night_hunt_orchestrator as n; print(n.run_night_cycle().summary())"
686
+ python -m openclaw_gateway "status"
687
+ python -m openclaw_gateway "help"
688
+ python -m mythos.mcp.jwt_analyzer_mcp https://example.com
689
+ ```
690
+
691
+ The night-hunt smoke test will fall through to the demo `example.com`
692
+ target if no scope tokens are configured, so it's safe to run in dev.
693
+
694
+ ---
695
+
696
+ ## 20. Troubleshooting
697
+
698
+ | Symptom | Likely cause | Fix |
699
+ |---------|--------------|-----|
700
+ | `npm ERR! 404` building Docker image | npm package removed | already fixed in v6 by switching to PyPI `mcp-server-git/sqlite` |
701
+ | Skill selector returns 0 matches | `skill_registry.load_all()` empty | check `architect/skills/` exists in image; check `ARCHITECT_SKILLS_DIR` |
702
+ | `sentence-transformers` not installed | OK — falls back to keyword scoring | install if you want semantic ranking: `pip install sentence-transformers` |
703
+ | Telegram messages don't arrive | `TELEGRAM_BOT_TOKEN`/`TELEGRAM_CHAT_ID` unset | check env vars; `telegram_send` returns False without erroring |
704
+ | Night cycle runs but no findings | no scanner binaries installed | install `nuclei`, `semgrep`, `sqlmap`, etc., or accept that only the Python-native MCPs (jwt/cors/openapi/proto-poll/dep-conf) will fire |
705
+ | Hermes loop crashes on first iter | `OPENROUTER_API_KEY` missing | set it; check `_BUDGET.spent_usd` hasn't tripped the hard cap |
706
+ | MCP config has duplicate keys | JSON parser keeps last; benign but ugly | dedupe block in `mcp_config.json` (v6 keeps the consolidated single block) |
707
+
708
+ ---
709
+
710
+ ## 21. Founder operating handbook
711
+
712
+ ### Daily routine (5 minutes)
713
+
714
+ 1. Open Telegram. Read the 06:00 morning briefing.
715
+ 2. For each finding, read the title + severity + target. Tap one of:
716
+ * `approve <id>` — submit to platform
717
+ * `reject <id>` — log negative training signal
718
+ * `explain <id>` — get the plain-English version first
719
+ 3. `status` — confirm the night-hunt thread is armed for tonight.
720
+
721
+ ### Weekly routine (30 minutes)
722
+
723
+ * Read `/data/night_reports/*.json` from the past 7 cycles. Sample 3
724
+ findings end-to-end and verify reproducibility yourself.
725
+ * Check the LoRA export schedule (Sunday 02:00) — confirm a new training
726
+ digest landed on Monday.
727
+ * Review the public leaderboard (`public_leaderboard.py`). If PRs
728
+ merged < target, check `repo_harvester.py` is selecting decent repos.
729
+
730
+ ### When to spend money
731
+
732
+ * T4 (Claude Sonnet) only on `critical_cve_draft`. Verify `_BUDGET` shows
733
+ >$5 burn/day before adding more T4 calls.
734
+ * Hardware: keep one DO droplet running 24/7 (~$24/mo). Add a Kaggle GPU
735
+ for T5 only when local triage volume justifies it.
736
+
737
+ ### When to add a skill
738
+
739
+ Whenever you find yourself writing the same explanation twice in a
740
+ finding triage. Capture the pattern in
741
+ `architect/skills/<domain>/<topic>.md`. The selector will start loading
742
+ it into Hermes within minutes — no deploy required if you mount
743
+ `/data/skills/`.
744
+
745
+ ### When to ship to investors
746
+
747
+ The Masterplan §10 demo script (Demo A / B / C) is the canonical pitch.
748
+ Pre-flight checklist before any live demo:
749
+ 1. `docker pull` the latest image; smoke-test the gradio UI loads.
750
+ 2. Run `night_run_now` once to ensure the pipeline doesn't error.
751
+ 3. Send `status` from your phone over Telegram and confirm the reply.
752
+ 4. Prepare a known-vuln backup target in case the live repo finds nothing
753
+ in the demo window (e.g. an intentionally vulnerable fork).
754
+
755
+ ---
756
+
757
+ *Rhodawk AI v6.0 — Developer & Founder Playbook*
758
+ *Generated as the closing artefact of the Masterplan §3 build sweep.*
759
+ *Always paired with the upstream `Rhodawk_Superhuman_Agent_Plan.md`.*
app.py CHANGED
@@ -2690,4 +2690,25 @@ if __name__ == "__main__":
2690
  except Exception as _e: # noqa: BLE001
2691
  print(f"[ARCHITECT] night-mode scheduler not started: {_e}")
2692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2693
  demo.launch(server_name="0.0.0.0", server_port=port, share=False, show_error=True)
 
2690
  except Exception as _e: # noqa: BLE001
2691
  print(f"[ARCHITECT] night-mode scheduler not started: {_e}")
2692
 
2693
+ # ── Masterplan §3 — Night Hunter orchestrator (opt-in NIGHT_HUNTER=1) ──
2694
+ if os.getenv("NIGHT_HUNTER", "0") == "1":
2695
+ try:
2696
+ import night_hunt_orchestrator as _nh
2697
+ _nh.start_in_background()
2698
+ print("[NIGHT-HUNTER] background scheduler armed")
2699
+ except Exception as _e: # noqa: BLE001
2700
+ print(f"[NIGHT-HUNTER] scheduler not started: {_e}")
2701
+
2702
+ # ── Masterplan §6 — OpenClaw / EmbodiedOS gateway (opt-in OPENCLAW=1) ──
2703
+ if os.getenv("OPENCLAW", "0") == "1":
2704
+ try:
2705
+ import openclaw_gateway as _oc
2706
+ _oc.start_in_background(
2707
+ host=os.getenv("OPENCLAW_HOST", "0.0.0.0"),
2708
+ port=int(os.getenv("OPENCLAW_PORT", "8765")),
2709
+ )
2710
+ print("[OPENCLAW] gateway listening")
2711
+ except Exception as _e: # noqa: BLE001
2712
+ print(f"[OPENCLAW] gateway not started: {_e}")
2713
+
2714
  demo.launch(server_name="0.0.0.0", server_port=port, share=False, show_error=True)
architect/skill_selector.py ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ARCHITECT — semantic skill selector (Masterplan §5).
3
+
4
+ Upgrades the keyword-based ``architect/skill_registry`` with **semantic
5
+ similarity ranking** so the right domain skills are loaded into the LLM
6
+ context regardless of how the task is phrased.
7
+
8
+ Tier-5 design (Masterplan §7):
9
+ * Embeddings: sentence-transformers / MiniLM-L6-v2 (CPU, $0)
10
+ * Fallback: deterministic keyword-overlap scorer (no model needed)
11
+ * Cache: skill embeddings hashed on disk (JSON) so the model loads
12
+ *once* per process and *never* recomputes between calls.
13
+
14
+ Public surface:
15
+
16
+ select_for_task(task_description, repo_languages, repo_tech_stack,
17
+ attack_phase, top_k=5) -> str
18
+ Returns a single XML-flavoured ``<skills>...</skills>`` block ready
19
+ to be prepended to any system prompt.
20
+
21
+ pack(task_description, ...) -> list[Skill]
22
+ Same logic but returns the matched Skill objects (for callers who
23
+ want to render their own context format).
24
+
25
+ The module is designed to **never raise** in production: every external
26
+ dependency (sentence-transformers, numpy, sklearn) is optional and falls
27
+ back to a pure-Python implementation.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ import hashlib
33
+ import json
34
+ import logging
35
+ import math
36
+ import os
37
+ import re
38
+ import threading
39
+ from dataclasses import dataclass
40
+ from pathlib import Path
41
+ from typing import Any, Iterable
42
+
43
+ from . import skill_registry
44
+
45
+ LOG = logging.getLogger("architect.skill_selector")
46
+
47
+ CACHE_DIR = Path(os.getenv("ARCHITECT_SKILL_CACHE", "/tmp/architect_skill_cache"))
48
+ CACHE_DIR.mkdir(parents=True, exist_ok=True)
49
+
50
+ # Phase → list of skill-name substrings that should get a relevance boost.
51
+ PHASE_BOOSTS: dict[str, tuple[str, ...]] = {
52
+ "recon": ("recon", "subdomain", "wayback", "shodan", "httpx", "fingerprint"),
53
+ "static": ("static", "sast", "taint", "semgrep", "ast", "code", "memory"),
54
+ "dynamic": ("fuzz", "dynamic", "browser", "runtime", "frida"),
55
+ "exploit": ("exploit", "rop", "heap", "buffer", "pwn", "shellcode", "primitive"),
56
+ "report": ("report", "p1", "p2", "cvss", "submission", "platform"),
57
+ "triage": ("methodology", "reference", "index", "report"),
58
+ }
59
+
60
+ _LOCK = threading.Lock()
61
+ _MODEL: Any = None
62
+ _EMBEDS: dict[str, list[float]] = {}
63
+ _SKILLS: list[skill_registry.Skill] = []
64
+
65
+
66
+ # ── lazy model loading ──────────────────────────────────────────────────────
67
+ def _try_load_model() -> Any:
68
+ """Best-effort load of MiniLM. Returns None on any failure."""
69
+ global _MODEL
70
+ if _MODEL is not None:
71
+ return _MODEL
72
+ try:
73
+ from sentence_transformers import SentenceTransformer # type: ignore
74
+ model_name = os.getenv("ARCHITECT_EMBED_MODEL", "sentence-transformers/all-MiniLM-L6-v2")
75
+ LOG.info("skill_selector: loading embed model %s", model_name)
76
+ _MODEL = SentenceTransformer(model_name)
77
+ return _MODEL
78
+ except Exception as exc: # noqa: BLE001
79
+ LOG.warning("skill_selector: sentence-transformers unavailable (%s) — using keyword fallback", exc)
80
+ _MODEL = False # sentinel: don't try again
81
+ return None
82
+
83
+
84
+ # ── embedding cache ─────────────────────────────────────────────────────────
85
+ def _skill_hash(skill: skill_registry.Skill) -> str:
86
+ h = hashlib.sha256()
87
+ h.update(skill.name.encode())
88
+ h.update(skill.body.encode())
89
+ return h.hexdigest()[:16]
90
+
91
+
92
+ def _cache_path_for(model_name: str) -> Path:
93
+ safe = re.sub(r"[^a-zA-Z0-9_.-]", "_", model_name)
94
+ return CACHE_DIR / f"skills_{safe}.json"
95
+
96
+
97
+ def _load_disk_cache(model_name: str) -> dict[str, list[float]]:
98
+ p = _cache_path_for(model_name)
99
+ if not p.exists():
100
+ return {}
101
+ try:
102
+ return json.loads(p.read_text())
103
+ except Exception as exc: # noqa: BLE001
104
+ LOG.debug("skill_selector cache read failed: %s", exc)
105
+ return {}
106
+
107
+
108
+ def _save_disk_cache(model_name: str, data: dict[str, list[float]]) -> None:
109
+ p = _cache_path_for(model_name)
110
+ try:
111
+ p.write_text(json.dumps(data))
112
+ except Exception as exc: # noqa: BLE001
113
+ LOG.debug("skill_selector cache write failed: %s", exc)
114
+
115
+
116
+ def _ensure_skill_embeddings() -> dict[str, list[float]]:
117
+ """
118
+ Return ``{skill_name: vector}`` for the entire registry. Computes only
119
+ the vectors that aren't already cached. If no embedding model is
120
+ available, returns an empty dict (callers must fall back to keywords).
121
+ """
122
+ global _EMBEDS, _SKILLS
123
+ with _LOCK:
124
+ if not _SKILLS:
125
+ _SKILLS = skill_registry.load_all()
126
+ model = _try_load_model()
127
+ if not model:
128
+ return {}
129
+ model_name = os.getenv("ARCHITECT_EMBED_MODEL", "sentence-transformers/all-MiniLM-L6-v2")
130
+ cache = _load_disk_cache(model_name)
131
+ missing: list[skill_registry.Skill] = []
132
+ result: dict[str, list[float]] = {}
133
+ for s in _SKILLS:
134
+ key = f"{s.name}:{_skill_hash(s)}"
135
+ if key in cache:
136
+ result[s.name] = cache[key]
137
+ else:
138
+ missing.append(s)
139
+ if missing:
140
+ try:
141
+ texts = [f"{m.name}\n{m.domain}\n{m.body[:2000]}" for m in missing]
142
+ vecs = model.encode(texts, normalize_embeddings=True).tolist()
143
+ for s, v in zip(missing, vecs):
144
+ key = f"{s.name}:{_skill_hash(s)}"
145
+ cache[key] = v
146
+ result[s.name] = v
147
+ _save_disk_cache(model_name, cache)
148
+ except Exception as exc: # noqa: BLE001
149
+ LOG.warning("skill_selector: embedding failed (%s) — keyword fallback", exc)
150
+ return {}
151
+ _EMBEDS = result
152
+ return result
153
+
154
+
155
+ # ── similarity helpers ──────────────────────────────────────────────────────
156
+ def _cosine(a: list[float], b: list[float]) -> float:
157
+ if not a or not b or len(a) != len(b):
158
+ return 0.0
159
+ dot = sum(x * y for x, y in zip(a, b))
160
+ na = math.sqrt(sum(x * x for x in a))
161
+ nb = math.sqrt(sum(y * y for y in b))
162
+ if na == 0 or nb == 0:
163
+ return 0.0
164
+ return dot / (na * nb)
165
+
166
+
167
+ def _keyword_score(skill: skill_registry.Skill, tokens: set[str]) -> float:
168
+ """Pure-Python fallback ranker. Counts shared whitespace tokens."""
169
+ body_tokens = set(re.findall(r"[a-z0-9_-]{3,}", (skill.name + " " + skill.body).lower()))
170
+ if not body_tokens:
171
+ return 0.0
172
+ overlap = body_tokens & tokens
173
+ return len(overlap) / max(1, math.sqrt(len(body_tokens)))
174
+
175
+
176
+ def _phase_boost(skill: skill_registry.Skill, phase: str) -> float:
177
+ needles = PHASE_BOOSTS.get(phase.lower(), ())
178
+ if not needles:
179
+ return 0.0
180
+ name = (skill.name + " " + skill.domain + " " + skill.path.as_posix()).lower()
181
+ return 0.10 * sum(1 for n in needles if n in name)
182
+
183
+
184
+ # ── public API ──────────────────────────────────────────────────────────────
185
+ @dataclass
186
+ class Match:
187
+ skill: skill_registry.Skill
188
+ score: float
189
+ reason: str
190
+
191
+ def to_dict(self) -> dict[str, Any]:
192
+ return {
193
+ "name": self.skill.name,
194
+ "domain": self.skill.domain,
195
+ "path": str(self.skill.path),
196
+ "score": round(self.score, 4),
197
+ "reason": self.reason,
198
+ }
199
+
200
+
201
+ def pack(
202
+ task_description: str,
203
+ *,
204
+ repo_languages: Iterable[str] | None = None,
205
+ repo_tech_stack: Iterable[str] | None = None,
206
+ attack_phase: str = "static",
207
+ top_k: int = 5,
208
+ pin: Iterable[str] | None = None,
209
+ ) -> list[Match]:
210
+ """
211
+ Return up to ``top_k`` matched skills (highest score first).
212
+
213
+ ``pin`` — names of skills that must always be included regardless of
214
+ score (useful for "always carry the bug-bounty methodology playbook").
215
+ """
216
+ if not _SKILLS:
217
+ _ensure_skill_embeddings() # also populates _SKILLS even on fallback
218
+ if not _SKILLS:
219
+ return []
220
+
221
+ langs = [s.lower() for s in (repo_languages or [])]
222
+ techs = [s.lower() for s in (repo_tech_stack or [])]
223
+ query = " ".join([task_description, attack_phase, *langs, *techs])
224
+
225
+ embeds = _ensure_skill_embeddings()
226
+ use_embed = bool(embeds)
227
+ matches: list[Match] = []
228
+
229
+ if use_embed:
230
+ try:
231
+ qv = _MODEL.encode([query], normalize_embeddings=True).tolist()[0]
232
+ except Exception as exc: # noqa: BLE001
233
+ LOG.warning("skill_selector: query encode failed (%s) — keyword fallback", exc)
234
+ use_embed = False
235
+
236
+ if use_embed:
237
+ for s in _SKILLS:
238
+ v = embeds.get(s.name)
239
+ if not v:
240
+ continue
241
+ score = _cosine(qv, v) + _phase_boost(s, attack_phase)
242
+ matches.append(Match(skill=s, score=score, reason="semantic"))
243
+ else:
244
+ tokens = set(re.findall(r"[a-z0-9_-]{3,}", query.lower()))
245
+ for s in _SKILLS:
246
+ score = _keyword_score(s, tokens) + _phase_boost(s, attack_phase)
247
+ matches.append(Match(skill=s, score=score, reason="keyword"))
248
+
249
+ # Boost via the registry's structured trigger profile too.
250
+ profile = {"languages": langs, "asset_types": techs, "frameworks": techs}
251
+ for m in matches:
252
+ m.score += 0.05 * m.skill.matches(profile)
253
+
254
+ matches.sort(key=lambda m: m.score, reverse=True)
255
+ chosen = matches[:top_k]
256
+ pinned = {p.lower() for p in (pin or [])}
257
+ if pinned:
258
+ already = {m.skill.name.lower() for m in chosen}
259
+ for s in _SKILLS:
260
+ if s.name.lower() in pinned and s.name.lower() not in already:
261
+ chosen.append(Match(skill=s, score=999.0, reason="pinned"))
262
+ return chosen
263
+
264
+
265
+ def select_for_task(
266
+ task_description: str,
267
+ repo_languages: Iterable[str] | None = None,
268
+ repo_tech_stack: Iterable[str] | None = None,
269
+ attack_phase: str = "static",
270
+ top_k: int = 5,
271
+ pin: Iterable[str] | None = None,
272
+ ) -> str:
273
+ """
274
+ Render the matched skills into a context block ready to be prepended to
275
+ any LLM system prompt. Returns ``""`` when no skills match.
276
+ """
277
+ chosen = pack(
278
+ task_description,
279
+ repo_languages=repo_languages,
280
+ repo_tech_stack=repo_tech_stack,
281
+ attack_phase=attack_phase,
282
+ top_k=top_k,
283
+ pin=pin,
284
+ )
285
+ if not chosen:
286
+ return ""
287
+
288
+ parts: list[str] = ["<skills>"]
289
+ parts.append(
290
+ f" <!-- Loaded {len(chosen)} skill(s) for phase={attack_phase!r}. "
291
+ "Apply them precisely; cite the skill name when you use it. -->"
292
+ )
293
+ for m in chosen:
294
+ parts.append(f" <skill name=\"{m.skill.name}\" domain=\"{m.skill.domain}\" "
295
+ f"score=\"{m.score:.3f}\" reason=\"{m.reason}\">")
296
+ parts.append(m.skill.body.strip())
297
+ parts.append(" </skill>")
298
+ parts.append("</skills>")
299
+ return "\n".join(parts)
300
+
301
+
302
+ def explain(task_description: str, **kwargs: Any) -> dict[str, Any]:
303
+ """Diagnostic: returns the ranked match list as JSON-able dicts."""
304
+ chosen = pack(task_description, **kwargs)
305
+ return {
306
+ "task": task_description,
307
+ "engine": "semantic" if _try_load_model() else "keyword",
308
+ "matches": [m.to_dict() for m in chosen],
309
+ }
310
+
311
+
312
+ def stats() -> dict[str, Any]:
313
+ skills = skill_registry.load_all()
314
+ embeds = _EMBEDS or {}
315
+ return {
316
+ "total_skills": len(skills),
317
+ "embedded_skills": len(embeds),
318
+ "engine": "semantic" if _try_load_model() else "keyword",
319
+ "cache_dir": str(CACHE_DIR),
320
+ }
architect/skills/ai-systems/agent-tool-abuse.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: agent-tool-abuse
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # agent-tool-abuse
10
+
11
+ Function-calling abuse: arg smuggling, recursive tool calls, cost-DoS via tool loops, exfil via outbound HTTP tools, prompt-injected tool selection.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/ai-api-authentication-bypass.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: ai-api-authentication-bypass
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # ai-api-authentication-bypass
10
+
11
+ OpenAI-compatible APIs without auth, model-name spoofing, key smuggling via headers, free-tier abuse via account farms, IDOR on threads/runs.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/llm-system-prompt-extraction.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: llm-system-prompt-extraction
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # llm-system-prompt-extraction
10
+
11
+ Extraction prompts ('repeat verbatim ...'), token-by-token recovery, model-card leakage, sensitive system-prompt as oracle for downstream injection.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/model-inversion-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: model-inversion-attacks
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # model-inversion-attacks
10
+
11
+ Membership inference, training-data extraction (verbatim recall), gradient leakage, attribute inference.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/prompt-injection-direct.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: prompt-injection-direct
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # prompt-injection-direct
10
+
11
+ Direct PI: 'ignore previous instructions', role-swap, system-prompt extraction, jailbreaks via translation/obfuscation. Defenses: structured boundaries, allow-listed tools, output filters.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/prompt-injection-indirect.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: prompt-injection-indirect
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # prompt-injection-indirect
10
+
11
+ Indirect PI from retrieved docs / web pages / emails. Test corpus: hidden instructions in HTML comments, base64 payloads, unicode tag chars (U+E0000).
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/ai-systems/rag-poisoning.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: rag-poisoning
3
+ domain: ai-systems
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # rag-poisoning
10
+
11
+ Poisoned chunks in vector DB, embedding-space adversarial vectors, doc-level instruction smuggling, source-priority confusion.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/automotive/autosar-architecture-security.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: autosar-architecture-security
3
+ domain: automotive
4
+ triggers:
5
+ languages: [automotive]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # autosar-architecture-security
10
+
11
+ AUTOSAR Classic vs Adaptive: SecOC config gaps, IPsec for SOME/IP, OS partition isolation, BSW component trust boundaries.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/automotive/can-bus-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: can-bus-attacks
3
+ domain: automotive
4
+ triggers:
5
+ languages: [automotive]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # can-bus-attacks
10
+
11
+ CAN: arbitration ID spoofing, DoS via dominant flooding, ECU reflashing, gateway misconfig allowing OBD-II -> CAN-A jumps.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/automotive/uds-iso14229-security.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: uds-iso14229-security
3
+ domain: automotive
4
+ triggers:
5
+ languages: [automotive]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # uds-iso14229-security
10
+
11
+ UDS services: Security Access (0x27) seed/key brute, Routine Control abuse, Read/Write Memory unprotected, weak diagnostic-session auth.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/automotive/v2x-communication-security.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: v2x-communication-security
3
+ domain: automotive
4
+ triggers:
5
+ languages: [automotive]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # v2x-communication-security
10
+
11
+ V2X (DSRC/C-V2X): pseudonym certificate misuse, replay of BSMs, misbehaviour detection bypass, PKI revocation latency.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/aviation/arinc429-security.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: arinc429-security
3
+ domain: aviation
4
+ triggers:
5
+ languages: [aviation]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # arinc429-security
10
+
11
+ ARINC-429 unidirectional bus: lack of auth, source-spoofing on shared bus, label collision, gateway leaks to passenger network.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/aviation/avionics-software-patterns.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: avionics-software-patterns
3
+ domain: aviation
4
+ triggers:
5
+ languages: [aviation]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # avionics-software-patterns
10
+
11
+ ARINC-653 partition leakage, IMA module isolation, RTCA DO-326A airworthiness security process, EASA Part-IS adoption.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/aviation/do178c-verification-gaps.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: do178c-verification-gaps
3
+ domain: aviation
4
+ triggers:
5
+ languages: [aviation]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # do178c-verification-gaps
10
+
11
+ DO-178C objectives by DAL level, MC/DC coverage gaps, tool qualification (DO-330) skips, requirement-to-test traceability holes.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/buffer-overflow-stack.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: buffer-overflow-stack
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # buffer-overflow-stack
10
+
11
+ Classic stack BO: detection patterns (strcpy/gets/sprintf/scanf %s), defences (canary/NX/ASLR/PIE), bypass primitives (info leak → ROP, ret2libc, ret2csu, partial overwrites).
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/format-string-exploitation.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: format-string-exploitation
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # format-string-exploitation
10
+
11
+ printf-family with attacker-controlled format: arbitrary read (%n$s/x), arbitrary write (%n), GOT overwrites, leaks for ASLR bypass.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/heap-exploitation-glibc.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: heap-exploitation-glibc
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # heap-exploitation-glibc
10
+
11
+ glibc heap: tcache poisoning, fastbin dup, unsorted bin attack, large bin attack, House of Force/Orange/Einherjar/Spirit/Pig, malloc_consolidate triggers.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/integer-overflow-underflow.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: integer-overflow-underflow
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp, go, rust]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # integer-overflow-underflow
10
+
11
+ Integer wraps lead to undersized allocations → BOF. Sinks: malloc(n*size), alloca, length checks. Mitigations: __builtin_*_overflow, checked_arith.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/kernel-exploitation-linux.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: kernel-exploitation-linux
3
+ domain: binary
4
+ triggers:
5
+ languages: [c]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # kernel-exploitation-linux
10
+
11
+ Linux kernel: ref-count UAFs, slab allocator (SLUB) feng-shui, eBPF verifier bugs, io_uring races, KASLR leaks, KPTI bypass concepts. Defence: KASAN/KCSAN/SMEP/SMAP/KPTI.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/race-conditions-toctou.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: race-conditions-toctou
3
+ domain: binary
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # race-conditions-toctou
10
+
11
+ TOCTOU file-system races (access/open), shared-state races in async runtimes, double-fetch in syscalls, signal handler races.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/rop-chain-construction.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: rop-chain-construction
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp, asm]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # rop-chain-construction
10
+
11
+ ROP/SROP/COP/JOP. Tools: ROPgadget, ropper, pwntools.rop. Patterns: stack pivot, mprotect to RWX, dup2+execve, syscall-only chains for sandboxes.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/type-confusion.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: type-confusion
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # type-confusion
10
+
11
+ C++ vtable confusion via reinterpret_cast, JIT engine type confusion (V8/SpiderMonkey), Java/.NET unsafe-cast in deserialization.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/binary/use-after-free.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: use-after-free
3
+ domain: binary
4
+ triggers:
5
+ languages: [c, cpp, rust-unsafe]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # use-after-free
10
+
11
+ UAF: dangling pointer reuse, vtable hijack, type confusion via heap reuse. Detection via ASan/UBSan and KASAN for kernel. Patch patterns: smart pointers, IDs over pointers.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/crypto-implementation-flaws.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: crypto-implementation-flaws
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # crypto-implementation-flaws
10
+
11
+ ECB instead of GCM, IV reuse with CTR/GCM, key reuse across protocols, lack of authenticated encryption, padding oracle (CBC), AES-NI side channels, Cryptopals classics.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/key-management-flaws.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: key-management-flaws
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # key-management-flaws
10
+
11
+ Hard-coded keys, keys in env vars without rotation, missing key separation (sign vs encrypt), KMS misuse, JWT signing-key reuse across environments.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/post-quantum-migration-risks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: post-quantum-migration-risks
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # post-quantum-migration-risks
10
+
11
+ Hybrid KEM rollout pitfalls (X25519+Kyber), parameter confusion, downgrade vectors, harvest-now-decrypt-later threat model. NIST PQC suite status.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/rng-weakness-patterns.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: rng-weakness-patterns
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # rng-weakness-patterns
10
+
11
+ Insecure RNG (Math.random, rand()), seeded with time(0)/PID, predictable session IDs, JWT secret derivation from PRNG, language-specific gotchas.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/timing-side-channels.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: timing-side-channels
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # timing-side-channels
10
+
11
+ Non-constant-time string comparison for tokens/HMACs, branch-on-secret, table-lookup AES, RSA/ECC scalar mults; Lucky13, Bleichenbacher.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/cryptography/tls-ssl-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: tls-ssl-attacks
3
+ domain: cryptography
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # tls-ssl-attacks
10
+
11
+ BEAST/CRIME/BREACH/Lucky13/POODLE history; modern: weak cipher suites, missing HSTS preload, OCSP stapling gaps, mTLS misconfig, certificate pinning gaps.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/embedded-iot/arm-cortex-m-exploitation.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: arm-cortex-m-exploitation
3
+ domain: embedded-iot
4
+ triggers:
5
+ languages: [arm]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # arm-cortex-m-exploitation
10
+
11
+ Cortex-M memory map, MPU misconfig, secure/non-secure (TrustZone-M) boundary bugs, FreeRTOS task starvation, vector table relocation.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/embedded-iot/firmware-extraction-analysis.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: firmware-extraction-analysis
3
+ domain: embedded-iot
4
+ triggers:
5
+ languages: [firmware]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # firmware-extraction-analysis
10
+
11
+ Extraction: vendor portal, OTA capture, flash dump (SPI/eMMC), JTAG/SWD. Analysis: binwalk, unblob, Ghidra, find hard-coded keys & update URLs.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/embedded-iot/iot-cloud-api-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: iot-cloud-api-attacks
3
+ domain: embedded-iot
4
+ triggers:
5
+ languages: [iot]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # iot-cloud-api-attacks
10
+
11
+ IoT cloud APIs: device-ID enumeration, claim/unclaim race, device-shadow IDOR, MQTT topic guess (deviceId in topic).
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/embedded-iot/rtos-security-freertos.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: rtos-security-freertos
3
+ domain: embedded-iot
4
+ triggers:
5
+ languages: [rtos]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # rtos-security-freertos
10
+
11
+ FreeRTOS heap_4/heap_5 vulns, task priority inversion, interrupt-context misuse, stack-overflow detection (configCHECK_FOR_STACK_OVERFLOW).
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/embedded-iot/uart-jtag-debug-interfaces.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: uart-jtag-debug-interfaces
3
+ domain: embedded-iot
4
+ triggers:
5
+ languages: [hardware]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # uart-jtag-debug-interfaces
10
+
11
+ UART pad identification (TX/RX/GND/VCC), baud-rate sweep, JTAG fingerprinting (JTAGulator), SWD on Cortex-M, glitching attacks.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/aws-iam-escalation.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: aws-iam-escalation
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [aws]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # aws-iam-escalation
10
+
11
+ AWS privesc: iam:PassRole + ec2 RunInstances, lambda:UpdateFunctionCode, iam:CreateAccessKey on self, sts:AssumeRole loops, S3 bucket policy + replication abuse.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/ci-cd-pipeline-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: ci-cd-pipeline-attacks
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [github-actions, gitlab, jenkins]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # ci-cd-pipeline-attacks
10
+
11
+ GitHub Actions: pull_request_target + checkout untrusted code, expression injection in run:, workflow_run from forks, cache poisoning, OIDC trust misconfig.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/docker-container-escape.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: docker-container-escape
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [docker]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # docker-container-escape
10
+
11
+ Container escapes: privileged + cgroup release_agent, mount /proc, exposed docker.sock, capabilities (CAP_SYS_ADMIN/CAP_NET_ADMIN), kernel-bug pivots, runc CVE-2019-5736 class.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/kubernetes-rbac-misconfig.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: kubernetes-rbac-misconfig
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [kubernetes]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # kubernetes-rbac-misconfig
10
+
11
+ K8s RBAC: cluster-admin overuse, service-account token mounted in unrelated pods, RoleBinding -> privileged namespace pivot, exec/portforward verb abuse, etcd plaintext.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/secrets-in-code.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: secrets-in-code
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # secrets-in-code
10
+
11
+ Detection patterns: AWS keys (AKIA*), GitHub PATs (ghp_*/gho_*), GCP SA JSON, Slack tokens, Stripe keys. Always run trufflehog over full git history.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/infrastructure/supply-chain-attacks.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: supply-chain-attacks
3
+ domain: infrastructure
4
+ triggers:
5
+ languages: [any]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # supply-chain-attacks
10
+
11
+ Typo-squatting, dep confusion, malicious post-install scripts, namespace hijack, build-tool plugin compromise, signed-attestation gaps (SLSA).
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/c-cpp-memory-safety.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: c-cpp-memory-safety
3
+ domain: languages
4
+ triggers:
5
+ languages: [c, cpp]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # c-cpp-memory-safety
10
+
11
+ Memory-safety in C/C++: out-of-bounds, UAF, double-free, missing length checks. Tools: ASan/MSan/UBSan, Coverity, CodeQL. Modernisation: std::span, std::string_view, RAII.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/go-concurrency-races.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: go-concurrency-races
3
+ domain: languages
4
+ triggers:
5
+ languages: [go]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # go-concurrency-races
10
+
11
+ Go: data races on shared maps, channel close-after-write, sync.WaitGroup misuse, context leaks, goroutine leaks via blocked send. Detection: go test -race.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/java-security-patterns.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: java-security-patterns
3
+ domain: languages
4
+ triggers:
5
+ languages: [java, kotlin, scala]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # java-security-patterns
10
+
11
+ Spring/Tomcat sinks: ObjectInputStream, Spring SpEL, MyBatis SQL fragments, Velocity SSTI, JNDI lookups (Log4Shell), SnakeYAML.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/javascript-node-security.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: javascript-node-security
3
+ domain: languages
4
+ triggers:
5
+ languages: [javascript, typescript, node]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # javascript-node-security
10
+
11
+ Node sinks: child_process.exec, vm/vm2 escape gadgets, eval/Function, require() with user path, fs operations on attacker paths, prototype pollution gadgets.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/php-security-legacy.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: php-security-legacy
3
+ domain: languages
4
+ triggers:
5
+ languages: [php]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # php-security-legacy
10
+
11
+ PHP: include()/require() with user input → LFI/RFI, unserialize(), assert() string eval, type juggling (== vs ===), magic methods on attacker-controlled objects.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/python-injection-patterns.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: python-injection-patterns
3
+ domain: languages
4
+ triggers:
5
+ languages: [python]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # python-injection-patterns
10
+
11
+ Python sinks: eval/exec/compile, subprocess shell=True, os.system, pickle.loads, yaml.load (pre-5.1), jinja2 SSTI, ORM raw().format().
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector
architect/skills/languages/rust-unsafe-patterns.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: rust-unsafe-patterns
3
+ domain: languages
4
+ triggers:
5
+ languages: [rust]
6
+ severity_focus: [P1, P2, P3]
7
+ ---
8
+
9
+ # rust-unsafe-patterns
10
+
11
+ Rust unsafe blocks: lifetime extension, transmute, raw-pointer arithmetic, FFI boundary mistakes, Send/Sync soundness bugs (Cell/UnsafeCell). Detection: cargo-geiger, MIRI.
12
+
13
+ ## Detection checklist
14
+ - enumerate exposure
15
+ - match canonical sinks
16
+ - confirm reproducibility
17
+ - map to CWE / OWASP / CVSS
18
+
19
+ ## Exploitation primitives
20
+ - reproduce in lab
21
+ - minimise the PoC
22
+ - assess blast radius
23
+
24
+ ## Reporting fingerprint
25
+ - include affected version range
26
+ - include suggested fix snippet
27
+ - include CVSS 3.1 vector