epistract-domain

epistract-domain is a command for coding agents from usathyan/epistract. It costs 16 tokens per session (2,928 once invoked), scanned A, original, MIT.

A guided wizard for creating a knowledge-extraction package for a new subject area from sample documents.

In plain words
What is it for?
Use it to create packages for areas such as legal contracts or genomics from two to five PDF, DOCX, HTML, or text samples.
Why use it?
It removes the need to design the subject area's data structure and extraction rules manually.

Command

Part of the epistract plugin — 5 skills, 22 commands, 3 agents 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/usathyan/epistract/domain
Clone the repo
git clone --depth 1 https://github.com/usathyan/epistract

Or install epistract, the plugin that ships this one along with the rest of its 5 skills, 22 commands, 3 agents.

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 epistract-domain

README.md
[![agentmods](https://agentmods.dev/badge/commands/usathyan/epistract/domain.svg)](https://agentmods.dev/commands/usathyan/epistract/domain)
Your own site
<a href="https://agentmods.dev/commands/usathyan/epistract/domain"><img src="https://agentmods.dev/badge/commands/usathyan/epistract/domain.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,928 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.00016 $0.02928
Opus 5 $0.00008 $0.01464
Sonnet 5 $0.00003 $0.00586
Haiku 4.5 $0.00002 $0.00293

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

Security

Grade A, and why

epistract-domain 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 3d 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/domain.md · 299 lines

How it starts

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

/epistract:domain

Create a new domain package from sample documents. Analyzes documents via multi-pass LLM analysis to propose a domain schema, then generates a complete domain package (domain.yaml, SKILL.md, epistemic.py, references/) ready for the standard pipeline.

Usage Guard

If invoked with --help: Display the following and stop. Otherwise start the wizard.

Usage: /epistract:domain

Launches the interactive domain creation wizard. No arguments needed up front — the wizard will ask you for:
  1. Domain name (e.g., "legal-contracts", "genomics")
  2. A brief domain description (1-2 sentences)
  3. Paths to 2–5 sample documents representative of the domain

Output:
  domains/<domain-name>/domain.yaml   — entity and relation type schema
  domains/<domain-name>/SKILL.md      — extraction prompt for the domain
  domains/<domain-name>/epistemic.py  — epistemic analysis rules

Prerequisites

Prerequisites

  • Python environment with epistract dependencies installed
  • 2-5 sample documents from the target domain (PDF, DOCX, HTML, TXT, or any format Kreuzberg supports)

Usage

/epistract:domain

The wizard will prompt for:

  1. Domain name -- short identifier (e.g., "real-estate", "healthcare-records")
  2. Domain description -- 1-2 sentences describing the domain (e.g., "Real estate lease agreements between landlords and tenants")
  3. Sample document paths -- paths to 2-5 representative documents

Steps

Step 1: Gather Inputs

Ask the user for:

  • Domain name: A short, hyphenated identifier. Will become the directory name under domains/.
  • Domain description: 1-2 sentences. This provides context for LLM schema discovery.
  • Sample document paths: At least 2 documents (recommend 3-5). Accept any file format.

Validate inputs:

  • Domain name must be lowercase, alphanumeric with hyphens only
  • Check for domain name collision using core/domain_wizard.py:
    from core.domain_wizard import check_domain_exists
    if check_domain_exists(domain_name):
        # Warn user: domain already exists. Ask to overwrite or pick new name.
    
  • Verify all document paths exist and are readable files
  • Warn if only 1 document provided (minimum 2 required)

Read the full file on GitHub · 299 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. 3d ago First seen · 299 lines · 16 tokens per session scan A 926bec176dda

Subscribe to this mod's changes

epistract-domain is a command published in the GitHub repository usathyan/epistract (8 stars, last pushed 19d ago), licensed MIT. It adds 16 tokens to every session and 2,928 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.