extract

A command for extracting a reusable method from the current coding session into a shared pattern library.

In plain words
What is it for?
Checking whether a solution is reusable, finding similar existing patterns, categorising the method, and recording it for later use across projects.
Why use it?
It prevents useful problem-solving approaches from being lost while avoiding copying private code, client names, prices, or sensitive data.

Skill for Claude CodeCodex

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 skills/stoa-platform/stoa/extract
Any agent
npx skills add stoa-platform/stoa --skill extract
Clone the repo
git clone --depth 1 https://github.com/stoa-platform/stoa

Made for: Claude Code, Codex.

Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,228 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.00031 $0.01228
Opus 5 $0.00015 $0.00614
Sonnet 5 $0.00006 $0.00246
Haiku 4.5 $0.00003 $0.00123

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

Security

Grade A, and why

extract 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/skills/extract/SKILL.md · 140 lines

How it starts

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

HEGEMON Pattern Extraction — $ARGUMENTS

IP Guard: Patterns describe methodology and approach, never verbatim proprietary code, client names, pricing, or sensitive business data. Anonymize all examples. See hegemon/CLAUDE.md anonymization rules.

Step 1: Identify the Pattern

From the current session's work, identify what is reusable:

  1. What recurring problem was solved? (not a one-off fix)
  2. Is this transferable to other projects (PRAXIS, ATHLOS, OIKOS)?
  3. Does a similar pattern already exist? Check hegemon/patterns/ directory

If the answer to #1 or #2 is "no", this is NOT a pattern — it's a project-specific solution. Skip extraction.

If a similar pattern exists, update it (add to Reuse Log) instead of creating a new one.

Step 2: Categorize

Determine the pattern category:

Category Examples Directory
architecture System design, infrastructure patterns, integration patterns patterns/architecture/
workflow Development process, CI/CD, session management, estimation patterns/workflow/
validation Review processes, quality gates, Council patterns patterns/validation/
prompt Effective prompt structures, agent delegation patterns patterns/prompt/
communication Stakeholder management, reporting, documentation patterns patterns/communication/

Step 3: Assign Pattern ID

Read existing patterns to find the next available ID:

ls hegemon/patterns/*/HEG-PAT-*.md | sort -t- -k3 -n | tail -1

Next ID = highest existing + 1. Format: HEG-PAT-XXX (zero-padded to 3 digits).

Step 4: Write the Pattern File

Create the pattern file using the HEGEMON template. The file MUST include ALL sections:

# HEG-PAT-XXX: [Pattern Name]

## Metadata
- **Origin**: [Project] / [Ticket or context]
- **Category**: [architecture | workflow | prompt | validation | communication]
- **Supervision Tier**: [AUTOPILOT | CO-PILOT | COMMAND]
- **Created**: [YYYY-MM-DD]
- **Last Updated**: [YYYY-MM-DD]

## Problem
[What recurring problem does this pattern solve? 2-3 sentences.]

## Solution
[The reusable approach — methodology, decision trees, workflow structures.
NOT verbatim code. Describe the pattern abstractly enough to apply across projects.]

## Constraints
[When NOT to use this pattern. Preconditions. Limitations.]

## Reuse Log
| Date | Project | Outcome | Adaptations |
|------|---------|---------|-------------|
| [today] | [origin project] | Extracted | Initial extraction |

Read the full file on GitHub · 140 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 · 140 lines · 31 tokens per session scan A 6cbe5f2a3027

Subscribe to this mod's changes

extract is a skill published in the GitHub repository stoa-platform/stoa (5 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 31 tokens to every session and 1,228 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-31.