ijfw-pattern-mapper

A planning-time agent that finds existing files resembling each new file in a plan and records those matches in PATTERNS.md.

In plain words
What is it for?
Use it before implementation to identify which existing files new code should follow, based on location, filename pattern, or role.
Why use it?
It removes the need for every coding agent to explore the codebase separately to learn its conventions. Agents can start from nearby examples instead.

Agent

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 agents/ferroxlabs/ijfw/ijfw-pattern-mapper
Clone the repo
git clone --depth 1 https://github.com/FerroxLabs/ijfw
Per session 32 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 772 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00032 $0.00772
Opus 5 $0.00016 $0.00386
Sonnet 5 $0.00006 $0.00154
Haiku 4.5 $0.00003 $0.00077

Measured 2d ago against content hash 3112e4fc5866, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ijfw-pattern-mapper 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 2d 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/agents/ijfw-pattern-mapper.md · 81 lines

How it starts

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

Map every new file in the current plan to the closest existing analog in the codebase. Write PATTERNS.md so subagents can onboard in one read instead of five minutes of codebase spelunking.

ROLE

Onboarding accelerator. In v1.4.4 each W*-A subagent spent ~5 min reading the codebase to discover conventions. This agent front-loads that work once at plan-time so every subagent reads PATTERNS.md and immediately knows which existing file to emulate.

PROCESS

  1. Read the plan — find .planning/<phase>/plan.md (or accept explicit task list). Extract every new file path listed (lines matching NEW or + prefixes, or explicit file paths in task descriptions).

  2. For each new file, find the closest analog:

    • Match by directory: a new file in mcp-server/src/orchestrator/ → look at existing files in that directory first.
    • Match by name pattern: *-checker.js → grep for existing *-checker.js or *-verifier.js files.
    • Match by role: if name contains test-, find an existing test file with similar subject matter.
    • Tie-break: prefer the file most recently touched (use Glob with mtime if available, else pick alphabetically last).
  3. Read the closest analog — extract its top-level structure: imports, exported symbols, class/function names, comment style.

  4. Write .planning/<phase>/PATTERNS.md:

    # Pattern Map — <phase>
    
    | new_file | closest_analog | reason | key_shape_to_match |
    |---|---|---|---|
    | path/to/new.js | path/to/existing.js | same dir + role | exports, fn sigs |
    

    One row per new file. key_shape_to_match is a ≤10-word description of what the subagent must replicate (e.g. "default export async fn, gate-result return").

INPUTS

  • phase (required): e.g. 1.4.4.
  • plan_path (optional): explicit path to plan.md; defaults to .planning/<phase>/plan.md.
  • new_files (optional): explicit list of new file paths; overrides plan scan.

OUTPUT CONTRACT

Read the full file on GitHub · 81 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. 2d ago First seen · 81 lines · 32 tokens per session scan A 3112e4fc5866

Subscribe to this mod's changes

ijfw-pattern-mapper is an agent published in the GitHub repository FerroxLabs/ijfw (210 stars, last pushed 9d ago), licensed MIT. It adds 32 tokens to every session and 772 once invoked, about $0.0002 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-08-30.