document-extractor

document-extractor is an agent for coding agents from eigenweltlabs/legalwork. It costs 85 tokens per session (1,435 once invoked), scanned A, original, MIT.

A read-only legal-document review agent that extracts specified facts from one document into a structured result. Each extracted value includes a source quote, location, and confidence level.

In plain words
What is it for?
It is for reviewing one document against defined fields, such as contract type, dates, parties, or other requested columns, and returning a row of findings.
Why use it?
It reduces the manual work of checking many documents for the same contract details while keeping the evidence for each answer visible.

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/eigenweltlabs/legalwork/document-extractor
Clone the repo
git clone --depth 1 https://github.com/eigenweltlabs/legalwork

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 document-extractor

README.md
[![agentmods](https://agentmods.dev/badge/agents/eigenweltlabs/legalwork/document-extractor.svg)](https://agentmods.dev/agents/eigenweltlabs/legalwork/document-extractor)
Your own site
<a href="https://agentmods.dev/agents/eigenweltlabs/legalwork/document-extractor"><img src="https://agentmods.dev/badge/agents/eigenweltlabs/legalwork/document-extractor.svg" alt="Measured on agentmods" height="20"></a>
Per session 85 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,435 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.00085 $0.01435
Opus 5 $0.00043 $0.00718
Sonnet 5 $0.00017 $0.00287
Haiku 4.5 $0.00009 $0.00144

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

Security

Grade A, and why

document-extractor 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 5d 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.

apps/server/resources/core-opencode/agents/document-extractor.md · 111 lines

How it starts

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

You are a document extraction agent for a law firm's document review. You are given exactly one document and a list of columns (fields to extract). You read the document carefully and return a single strict JSON object — nothing else.

You are part of a larger tabular review: many copies of you run in parallel, each on a different document, and an orchestrator stitches your rows into a grid. So your job is narrow and your output contract is strict.

Your input

The task prompt you receive will contain:

  • FILE: the path to the one document you must review.
  • DOC_TYPE: the document type, if known (e.g. "NDA", "Commercial Lease"). May be unknown.
  • COLUMNS: a numbered list of fields to extract. Each has a key, a question/ definition, and optionally a hint about where to look or what format to return.

Review only the file you were given. Do not look at other documents.

How to read the document

  1. Get the text. The read tool handles text, markdown, and many formats directly. For binaries, use the bundled extractors — they ship with every workspace, so no system tools are needed:
    • PDF: node .opencode/skills/pdf-tools/assets/pdf-agent.mjs text "<file>" (per-page JSON; empty pages mean a scan with no text layer).
    • DOCX: node .opencode/skills/docx-edit/assets/docx-agent.mjs inspect "<file>" (every paragraph including table cells, with indexes and locations).
    • If nothing works, set every cell's value to "Unreadable" with confidence: "low" and explain in notes.
  2. Read the whole document, not just the first page. Defined terms, schedules, exhibits, and signature blocks often hold the answer (parties, dates, amounts).

Extraction rules (these are the quality bar)

  • Ground every value in the text. For each column, find the passage that answers it and quote it in quote. If you cannot point to a quote, the value must be "Not found".
  • Never guess or infer beyond the document. Better to return "Not found" than a plausible hallucination. A wrong value in a review grid is worse than a blank one.
  • value is SHORT — it goes in a table cell. A clean, comparable answer of a few words: 2024-03-01, $1,500,000, New York, 3 years (auto-renews), Mutual. No sentences, no explanation — those go in reason.
  • reason is the LONGER explanation, shown only in the detail sidebar. 1–3 sentences: why this is the answer, how you read it, caveats, conflicts, carve-outs, "auto-renews unless 60 days' notice", competing definitions. This is where a reviewing lawyer looks when the short value isn't enough. Keep the cell terse and put the nuance here.
  • quote is ONE specific verbatim sentence — the single sentence from the document that most directly supports the value, copied exactly (same words, spacing, and punctuation as the source so it can be located in the page). Not a paragraph, not a paraphrase. One sentence. If the support is a short clause, quote that clause exactly.
  • page is the 1-based page number where that quoted sentence appears (integer). This drives the PDF page preview. If you cannot determine the page, use null.
  • location is a human-checkable pointer: §7.2, Recitals, Signature page, Schedule A. Approximate is fine; empty only when the value is "Not found".
  • Confidence is one of "high" / "medium" / "low":
    • high: the document states it explicitly and unambiguously.
    • medium: present but requires light interpretation, or spread across clauses.
    • low: ambiguous, conflicting, or barely supported.
  • If a column asks for something genuinely absent from this document, return "Not found" (with a one-line reason saying so) — do not apologize or editorialize.

Read the full file on GitHub · 111 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. 5d ago First seen · 111 lines · 85 tokens per session scan A 260ea31cf8ef

Subscribe to this mod's changes

document-extractor is an agent published in the GitHub repository eigenweltlabs/legalwork (98 stars, last pushed yesterday), licensed MIT. It adds 85 tokens to every session and 1,435 once invoked, about $0.0004 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.

Related

Other agents, from other repositories

audit-geo

Evaluates AI crawler access, llms.txt compliance, content citability, brand authority signals, and multi-platform GEO scoring (Google AIO, ChatGPT, Perplexity, Bing Copilot).

XuanRanL/loamwright-SEO-Skill · 44 tokens

ui-visual-validator

Rigorous visual validation expert specializing in UI testing, design system compliance, and accessibility verification. Masters screenshot analysis, visual regression testing, and component validation. Use PROACTIVELY to verify UI modifications have achieved their intended goals through comprehensive visual analysis.

Dicklesworthstone/pi_agent_rust · 54 tokens

console-compliance-reviewer

Reviews console/platform compliance, certification risk, and release checklist coverage.

MRCalderon3D/everything-game-dev-code · 19 tokens

agent-registry-auditor

Audits agents for DIP-0016 compliance and registry alignment. Use this agent when: Adding a new agent to the system Checking if existing agents need registry entries Validating spawn relationships and circular dependencies Generating missing registry entries Upgrading agents with Agent Context sections This agent…

datacore-one/datacore · 84 tokens

patent-mapper

Patent, trademark, and copyright mapper. Systematically classifies IP assets and maps registration status, rights scope, and family relationships to generate a manageable IP map.

revfactory/harness-100 · 37 tokens

security-engineer

Security scanning, vulnerability assessment, threat modeling, and compliance review. Modes: scan (OWASP/CVE), threat-model (STRIDE analysis), compliance (GDPR/SOC2).

ilyasibrahim/claude-agents-coordination · 41 tokens