deep-document-processor
Deep Document Processor
Purpose
Transform large documents into token-efficient context artifacts optimized for downstream agent reasoning. The goal is NOT human-readable summaries — it's maximum decision-relevant signal per token.
Why This Exists
Agents face a fundamental tension: large documents contain critical context, but including them wholesale wastes tokens and dilutes attention. Naive approaches fail in predictable ways:
- Full inclusion: Blows token budget, buries signal in noise
- Naive truncation: Loses structure, misses late-document insights
- Single-pass summary: Misses cross-references, flattens hierarchy
This skill applies a disciplined multi-pass protocol inspired by expert reading heuristics, adapted for agent context engineering.
The Protocol: Four Passes
Pass 1 — Structural Survey (≤30 seconds)
Extract the document's skeleton before reading content. This creates a mental map that guides where to spend attention in later passes.
Extract:
- Document type and purpose (paper? spec? report? guide?)
- Table of contents / section headings / file tree
- Total length estimate (pages, sections, or tokens)
- Key entities mentioned (people, systems, concepts)
- Publication date and freshness signal
Output format:
STRUCTURE:
- Type: [document type]
- Sections: [numbered list of headings/sections]
- Length: [estimate]
- Key entities: [comma-separated]
- Freshness: [date or "undated"]
Why this matters: surveying first prevents the agent from committing deep-read tokens to sections that turn out to be irrelevant. It's the difference between reading a map before driving and just heading north.
Pass 2 — Selective Extraction (The 20% Rule)
Read each section and extract ONLY the content that meets one of these criteria:
- Decision-relevant: Would change a downstream choice or recommendation
- Constraint-defining: Sets boundaries on what's possible or allowed
- Counter-intuitive: Contradicts likely assumptions an agent might hold
- Dependency-creating: Other facts depend on this being known
Hard constraint: Extracted content must be ≤20% of original token count. If you find yourself extracting more, you're not being selective enough — stop and re-evaluate what's truly decision-relevant vs. merely interesting.
Extraction format — use dense, telegram-style notes, not prose:
EXTRACT [Section Name]:
- [fact/constraint/insight in ≤15 words]
- [fact/constraint/insight in ≤15 words]
- COUNTER-INTUITIVE: [thing that contradicts common assumption]
Pass 3 — Cross-Reference and Conflict Scan
Review your Pass 2 extracts and identify:
- Internal contradictions: Does section 3 contradict section 7?
- Cross-references: Does understanding X require knowing Y from another section?
- Missing context: Are there terms, acronyms, or concepts used without definition?
- Implicit assumptions: What does the document assume the reader already knows?
This pass catches what single-pass extraction misses — the relationships between facts, not just the facts themselves.
Output format:
CROSS-REFS:
- [Section X] depends on [Section Y]: [why]
- CONFLICT: [Section A] says X, but [Section B] implies Y
- UNDEFINED: [term/concept] used but never defined
- ASSUMES: [implicit knowledge required]
Pass 4 — Context Artifact Assembly
Combine passes 1-3 into a single context artifact structured for agent consumption. This is the final deliverable.
Template:
=== CONTEXT: [Document Title] ===
Type: [type] | Freshness: [date] | Compression: [X% of original]
STRUCTURE MAP:
[Pass 1 skeleton — 2-3 lines max]
KEY EXTRACTS:
[Pass 2 content, organized by relevance not document order]
DEPENDENCIES & CONFLICTS:
[Pass 3 findings — only if non-empty]
AGENT NOTES:
- [Any warnings about document quality, bias, or missing info]
- [Suggested follow-up if context is insufficient]
===
Quality Checks
After assembly, verify:
- Compression ratio: Output is ≤20% of input tokens. If not, cut more.
- Standalone test: Could an agent with ONLY this artifact make the same decisions as one with the full document? If not, what's missing?
- No filler: Every line must pass the "would removing this change a decision?" test. If no — delete it.
- Telegram density: Notes should read like telegrams, not prose. Cut articles, hedging language, and qualifiers ruthlessly.
Anti-Patterns to Avoid
- Summarizing for humans: This isn't a book report. Don't write flowing prose.
- Preserving document order: Organize by relevance, not by where things appeared.
- Including "interesting but irrelevant": If it doesn't affect decisions, cut it.
- Over-extracting definitions: Only define terms the downstream agent won't know.
- Hedging: "The document seems to suggest..." — No. State what it says. Flag uncertainty explicitly if needed, but don't hedge the extraction itself.
More from andurilcode/craftwork
summarizer
Apply this skill whenever the user asks to summarize, condense, distill, or compress any content — a document, article, meeting notes, conversation, codebase, book, research paper, video transcript, or any other source material. Triggers on phrases like 'summarize this', 'give me the TL;DR', 'condense this', 'what are the key points?', 'distill this down', 'brief me on this', 'what's the gist?', 'BLUF this', 'executive summary', 'compress this for me', or any request to reduce content while preserving its essential value. Also trigger when the user pastes a long text and implicitly wants it shortened, when they share a link and ask 'what does this say?', or when they ask for meeting notes or action items from a transcript. This skill does NOT apply to 'explain X to me' (use topic-explainer) or 'write a summary section for my doc' (use technical-writing). This skill is for when source material exists and needs to be compressed.
3inversion-premortem
Apply inversion and pre-mortem thinking whenever the user asks to evaluate a plan, strategy, architecture, feature, or decision before execution — or when they want to stress-test something that already exists. Triggers on phrases like "is this a good idea?", "what could go wrong?", "review this plan", "should we do this?", "are we missing anything?", "stress-test this", "what are the risks?", or any request to validate a decision or design. Use this skill proactively — if the user is about to commit to something, this skill should be consulted even if they don't ask for it explicitly.
3llms-txt-generator
Generate llms.txt-style context documents — token-budgeted, section-per-concept Markdown optimized for LLM and RAG consumption. Use this skill whenever someone asks to generate an llms.txt, create LLM-friendly documentation, produce a context document for a library or codebase, build a RAG-ready reference, make docs 'agent-readable', create a developer quick-reference, or says anything like 'generate context for X', 'make an llms.txt for this repo', 'create a reference doc for NotebookLM', 'turn these docs into something an LLM can use', 'context document', 'developer cheatsheet from docs'. Also trigger when someone provides a GitHub repo URL and asks for documentation synthesis, or when working inside a codebase and asked to produce a self-contained reference of how it works. This is the context engineer's doc generation tool — it turns sprawling documentation into precise, structured, token-efficient context.
3context-compressor
>
3probabilistic-thinking
Apply probabilistic and Bayesian thinking whenever the user needs to reason under uncertainty, compare risks, prioritize between options, update beliefs based on new evidence, or make decisions without complete information. Triggers on phrases like "what are the odds?", "how likely is this?", "should I be worried about X?", "which risk is bigger?", "does this data change anything?", "is this a signal or noise?", "what's the probability?", "how confident are we?", or any situation where decisions are being made based on incomplete or ambiguous evidence. Also trigger when someone is treating uncertain outcomes as certainties, or when probability language is being used loosely ("probably", "unlikely", "very likely") without quantification. Don't leave uncertainty unexamined.
3context-cartography
Use when designing what goes into an agent's context window — system prompts, tool definitions, retrieval results, or any context artifact assembled before the agent runs. Triggers on "what should I put in the system prompt?", "how do I structure my context?", "the agent loses track of...", "my context window is full", "how do I decide what to include?", "designing a new harness", "the agent ignores my instructions". Do NOT use for one-off prompts, runtime conversation management, or when the problem is model capability rather than context design.
3