04-discourse-parser

A paper-analysis step that builds an RST, or Rhetorical Structure Theory, tree for each section. The tree records how paragraphs support, explain, contrast with, or otherwise relate to one another.

In plain words
What is it for?
Use it to analyze section relationships from Markdown and produce the trees needed for discourse-guided slide grouping.
Why use it?
It exposes the paper’s reasoning structure so later slide planning can group related paragraphs instead of relying only on their order.

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/rehglab/arcdeck/04-discourse-parser
Clone the repo
git clone --depth 1 https://github.com/RehgLab/ArcDeck
Per session 0 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,561 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.00000 $0.01561
Opus 5 $0.00000 $0.00781
Sonnet 5 $0.00000 $0.00312
Haiku 4.5 $0.00000 $0.00156

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

Security

Grade A, and why

04-discourse-parser 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.

arcdeck-skill/agents/04-discourse-parser.md · 184 lines

How it starts

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

Agent 4: Discourse Parser

Role

Constructs a hierarchical RST (Rhetorical Structure Theory) discourse tree for each paper section. Each tree captures how paragraphs relate to each other (elaboration, contrast, evidence, etc.), enabling discourse-guided slide grouping downstream.

Position in Pipeline

  • Phase: 2 (Narrative Outline Generation)
  • Depends on: A1 output (workspace/markdown.md)
  • Produces for: A5 (Slide Planner)
  • LLM Required: Yes
  • Execution: Per-section (loop over all sections in the paper)

Inputs

Input Source Format
Paper markdown workspace/markdown.md Plain text

Preprocessing Steps (before LLM calls)

Step 1: Split Markdown into Sections

  1. Split at ## headings (level-2 headers)
  2. Group subsections (e.g., ### 3.1, ### 3.2) under their parent section
  3. Remove the "References" section and everything below it
  4. Create a section key for each: slugify the heading (e.g., "Related Work" → related_work)

Step 2: Clean Text for RST Parsing

For each section's text:

  • Remove code blocks (...)
  • Remove image references (![...](...)), links ([text](url))
  • Remove bold/italic markers (**, *, __, _)
  • Strip inline LaTeX
  • Normalize whitespace

Step 3: Split into Paragraphs

For each section:

  1. Split cleaned text at double-newline boundaries
  2. Skip paragraphs shorter than 20 characters
  3. Name each paragraph: {section_key}_{index} (e.g., introduction_0, introduction_1)
  4. Save to workspace/rst/{section_key}/paragraphs.json

Paragraph JSON format:

{
  "introduction_0": "We present ArcDeck, a narrative-driven system...",
  "introduction_1": "Prior work on paper-to-slides conversion...",
  "introduction_2": "Our key insight is that rhetorical structure..."
}

Step 4: Skip sections with fewer than 2 paragraphs

RST requires at least 2 EDUs (paragraphs) to build a tree. For single-paragraph sections, create a trivial tree with just that paragraph as root.

Read the full file on GitHub · 184 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 · 184 lines · 0 tokens per session scan A b0cfc13b4a6c

Subscribe to this mod's changes

04-discourse-parser is an agent published in the GitHub repository RehgLab/ArcDeck (49 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,561 tokens. 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.