predict-failures

predict-failures is a command for Claude Code from idoforgod/Dissertation-Simulator-AgenticWorkflow. It costs 19 tokens per session (1,515 once invoked), scanned A, original, MIT.

A codebase scan that identifies areas likely to fail in production, then records the findings for later sessions.

In plain words
What is it for?
Use it to inspect a project for likely production failure areas and preserve the results for follow-up work.
Why use it?
It helps reveal risky parts of a system before users encounter failures. It reduces the chance that important warning signs are missed in a large codebase.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions subagents.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python .claude/hooks/scripts/scan_code_structure.py \.

Good fit Use it to inspect a project for likely production failure areas and preserve the results for follow-up work.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/idoforgod/Dissertation-Simulator-AgenticWorkflow
agentmods
npx agentmods add commands/idoforgod/dissertation-simulator-agenticworkflow/predict-failures

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for predict-failures

README.md
[![agentmods](https://agentmods.dev/badge/commands/idoforgod/dissertation-simulator-agenticworkflow/predict-failures.svg)](https://agentmods.dev/commands/idoforgod/dissertation-simulator-agenticworkflow/predict-failures)
Your own site
<a href="https://agentmods.dev/commands/idoforgod/dissertation-simulator-agenticworkflow/predict-failures"><img src="https://agentmods.dev/badge/commands/idoforgod/dissertation-simulator-agenticworkflow/predict-failures.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,515 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.01515
Opus 5 $0.00010 $0.00758
Sonnet 5 $0.00004 $0.00303
Haiku 4.5 $0.00002 $0.00152

Measured 5d ago against content hash aff33d18b66f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

predict-failures scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/predict-failures.md · 164 lines

How it starts

The opening of the file, as written. The whole thing — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/predict-failures — Predictive Failure Analysis

Performs a full codebase scan and predicts production failure areas using cross-domain patterns from other systems. Uses a P1-sandwich architecture to prevent hallucinations:

P1 Scan (grounding) → @failure-predictor (LLM) → P1 Validation → @failure-critic (LLM) → P1 Synthesis

Results persist in failure-predictions/ and are surfaced at every session start via RLM.


Orchestration (main context executes — do NOT delegate to sub-agent)

Announce to user: "Starting Predictive Failure Analysis — full scan. This involves two LLM agents and P1 validation steps."

Phase A: Code Structure Scan (P1 — establishes ground truth)

Run:

python .claude/hooks/scripts/scan_code_structure.py \
  --project-dir <ACTUAL_PROJECT_DIR> \
  --output .claude/context-snapshots/fp-code-map.json

Report to user:

  • How many files were scanned
  • Which F-categories have matches
  • Any files with Critical-severity signals

If Phase A fails: Report the error to the user and STOP. Do not proceed without ground truth.

Phase B-1: Failure Prediction (@failure-predictor)

Invoke @failure-predictor via Agent tool:

subagent_type: failure-predictor
prompt: |
  Read the code structure map at:
  <ACTUAL_PROJECT_DIR>/.claude/context-snapshots/fp-code-map.json

  Analyze the ENTIRE codebase for production failure risks using the F1-F7 taxonomy.
  Apply cross-domain patterns from other production systems.

  IMPORTANT:
  - Only cite files and line numbers from the code map
  - Output a JSON block with your predictions
  - Minimum 3 predictions required

Save the agent's full text response to .claude/context-snapshots/fp-predictor-response.txt using the Write tool (preserves raw response for debugging).

Extract JSON deterministically (P1 — prevents hallucination at LLM→P1 handoff):

python .claude/hooks/scripts/extract_json_block.py \
  --input .claude/context-snapshots/fp-predictor-response.txt \
  --output .claude/context-snapshots/fp-draft.json

Read the full file on GitHub · 164 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 164 lines · 19 tokens per session scan A aff33d18b66f

Subscribe to this mod's changes

predict-failures is a command published in the GitHub repository idoforgod/Dissertation-Simulator-AgenticWorkflow (108 stars, last pushed 3mo ago), licensed MIT. It adds 19 tokens to every session and 1,515 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.