patch

A command for making a small, clearly defined code change in a separate Git worktree, which is an isolated copy of the project. It shows the result and waits for you to approve or discard it.

In plain words
What is it for?
Use it for quick fixes, small improvements, or changes agreed during a discussion. You provide the change, and it implements and presents it for review.
Why use it?
It avoids lengthy planning when you already know the fix or improvement you want. The isolated worktree keeps the change separate until you decide to keep it.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rmolines/fractal-loop/patch
Clone the repo
git clone --depth 1 https://github.com/rmolines/fractal-loop
Per session 73 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,330 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
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 $0.00073 $0.04330
Opus 5 $0.00036 $0.02165
Sonnet 5 $0.00015 $0.00866
Haiku 4.5 $0.00007 $0.00433

Measured today against content hash e241fc94ba86, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

patch scanned grade B with 1 finding 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 today.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

REPO_NAME=$(grep "^alias:" "$REPO_ROOT/.claude/project.md" 2>/dev/null | sed 's/^alias: //' | head -1)
commands/patch.md · 547 lines

How it starts

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

/fractal:patch

Human gates

Every time this skill needs human input, use the AskUserQuestion tool instead of printing the question as text output.

Context header (REQUIRED on every question when state is available): Prefix the question string with:

📍 | 🎯 <active_predicate (max 80 chars)>

Variables come from the pre-loaded State section. If state is not yet loaded (e.g., early steps of /fractal:propose before tree detection), omit the header.

IMPORTANT: The header must be plain text. No markdown formatting (no **, ##, *, etc.) in the question string. Emojis are fine as visual anchors.

You are a fast-iteration agent. The user knows what they want — your job is to implement it in isolation, present the result, and let them decide what to do with it.

No PRD. No plan. No cycles. Just: implement → present → decide.

Input: $ARGUMENTS — description of the change to make. Required.


On entry: detect context and parse arguments

Detect project context

REPO_ROOT=""
REPO_NAME=""
if git rev-parse --is-inside-work-tree 2>/dev/null; then
  REPO_ROOT=$(git rev-parse --show-toplevel)
  REPO_NAME=$(grep "^alias:" "$REPO_ROOT/.claude/project.md" 2>/dev/null | sed 's/^alias: //' | head -1)
  [ -z "$REPO_NAME" ] && REPO_NAME=$(basename "$REPO_ROOT")
fi

Read .claude/project.md for:

SPEC="$REPO_ROOT/.claude/project.md"
BUILD_CMD=$(grep "^build:" "$SPEC" 2>/dev/null | sed 's/^build: //' | head -1)
TEST_CMD=$(grep "^test:" "$SPEC" 2>/dev/null | sed 's/^test: //' | head -1)
SMOKE_CMD=$(grep "^smoke:" "$SPEC" 2>/dev/null | sed 's/^smoke: //' | head -1)
DEPLOY_CMD=$(grep "^deploy:" "$SPEC" 2>/dev/null | sed 's/^deploy: //' | head -1)
HOT_FILES=$(awk '/^## Hot files/{found=1; next} found && /^- /{print substr($0,3)} found && /^##/{exit}' "$SPEC" 2>/dev/null)

Verify fractal tree exists

FRACTAL_DIR="$REPO_ROOT/.fractal"
if [ ! -d "$FRACTAL_DIR" ] || [ -z "$(ls -d "$FRACTAL_DIR"/*/root.md 2>/dev/null)" ]; then
  # No tree found
fi

Read the full file on GitHub · 547 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. today First seen · 547 lines · 73 tokens per session scan B e241fc94ba86

Subscribe to this mod's changes

patch is a command published in the GitHub repository rmolines/fractal-loop (13 stars, last pushed 5mo ago), licensed MIT. It adds 73 tokens to every session and 4,330 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.