extract-pattern

A command that studies a repository's structure and coding patterns, then turns the findings into architecture decision records (ADRs) and a detailed code-pattern document after user confirmation. An ADR records why a decision was made and its trade-offs.

In plain words
What is it for?
Use it to document a reference repository, capture a legacy project's conventions, or turn a cloned starter into reusable architecture and coding guidance.
Why use it?
It helps preserve how an existing, legacy, or starter project is organised without mixing the reasons for decisions with detailed implementation instructions.

Command

Part of the renata plugin — 3 skills, 33 commands, 6 agents, 2 hooks shipped together

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/ainsteinsbr/renata/extract-pattern
Clone the repo
git clone --depth 1 https://github.com/AInsteinsBR/renata

Or install renata, the plugin that ships this one along with the rest of its 3 skills, 33 commands, 6 agents, 2 hooks.

Per session 24 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,218 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.00024 $0.01218
Opus 5 $0.00012 $0.00609
Sonnet 5 $0.00005 $0.00244
Haiku 4.5 $0.00002 $0.00122

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

Security

Grade A, and why

extract-pattern 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.

commands/extract-pattern.md · 76 lines

How it starts

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

/renata:extract-pattern — Distill a repo's pattern into ADRs + a loadable doc

You are an architect. You receive a repo path in $ARGUMENTS, map the pattern in detail (via @pattern-mapper), confirm with the user, and generate ADRs (the decision) + code-pattern-<scope>.md (the operational detail).

Respond to the user and generate document content in the user's language (the language they are writing in).

It serves to: distill a cloned starter (frontend/), document a legacy project, or capture the pattern of a reference repo.

The ADR vs doc split (do not violate)

  • ADR = "why we decided X + alternatives + trade-offs + review trigger". Short, stable.
  • code-pattern-<scope>.md = "how the code does X, in detail + examples". Long, living.
  • The ADR points to the doc; the doc cites the ADR. Zero duplicated content. If it's "why", it goes in the ADR; if it's "how the code does it", it goes in the doc.

Step 1 — Resolve target and scope

  • $ARGUMENTS = repo path. No argument: assume frontend/ if it exists; otherwise ask which path.
  • Validate that the path exists and contains code (is not empty).
  • Infer the scope from the folder name: frontend/frontend, backend/backend, api/api. Show the inferred scope and ask: "Scope <X> — confirm or correct?". With no obvious path, ask for the scope.
  • The scope names the artifacts: code-pattern-<scope>.md and tags the ADRs ([<scope>] in the title).

Step 2 — Deep scan (trigger the agent)

Invoke the @pattern-mapper agent pointing to the resolved path. It scans the 4 axes (architecture, stack, design system, conventions) and returns a structured map with evidence strength per item.

Don't read the repo yourself — delegate to the agent (it preserves your context).

Step 3 — Item-by-item confirmation

Present the agent's map grouped by axis. For each item:

  • Default = what the code says ("the code is the truth").
  • Items marked weak evidence → highlight them as "possible hack — does it become a rule?".
  • The user confirms, corrects, or marks "not a rule" (stays out of the ADRs).

Read the full file on GitHub · 76 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 · 76 lines · 24 tokens per session scan A 3ecf1787c9f3

Subscribe to this mod's changes

extract-pattern is a command published in the GitHub repository AInsteinsBR/renata (10 stars, last pushed 12d ago), licensed MIT. It adds 24 tokens to every session and 1,218 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-08-31.