Compositional document writer. Produces research papers, patent applications, technical reports, grant proposals, and literature reviews from source material (PDFs, notes, experiments, URLs) with claim verification and venue-specific formatting. Documents are stored as a JSON DSL and compiled to Markdown / LaTeX / PDF / DOCX / USPTO XML on demand. Vision-capable agents describe and cross-check figures. Watermark support (DRAFT / CONFIDENTIAL / auto-DRAFT when unverified claims exist) renders across every target. Domain specialists (Source, Outline, Draft, Cite, Vision, Figure, Claim, Style, Reviewer, plus patent-only Prior Art and Claim Author) each own a slice of the DSL and are orchestrated by a Document Director.
bahulam install document-writerRuns locally via the Bahulam CLI from github.com/BahulamAI/awesome-bahulam-plugins
Tools (43)
Initialize a new document with an empty outline, empty references, and a compiled document.md.
Return a compact summary of the document DSL (outline, section word counts, refs count, source count, unsupported-claim count). Pass full:true for the raw JSON. Call at the start of every specialist turn.
Snapshot document.json into snapshots/ before large edits.
Compile document.json to a target format (md / tex / pdf). Markdown is always kept in sync at <slug>/document.md; other targets are written to <slug>/exports/. PDF requires pandoc + pdflatex on PATH.
Ingest a PDF (local path or URL) into sources/. Uses configured pdf provider (env THREEJS_PDF_PROVIDER; local uses pdf-parse-lite). Extracts text + reference list into sources/extracted/<id>.json.
Snapshot a URL to sources/<id>.md (readability-cleaned HTML → Markdown).
Add a free-form note associated with a section (or unattached).
Register an experimental data file (CSV/JSON) as a source.
List sources registered on the document.
Replace the document outline with a full section list.
Append or insert a section in the outline.
Reorder the outline by explicit id list.
Remove a section (and its content) from the document.
Set a section's prose (append or replace). The Draft Agent writes the text itself via its own gateway; this tool only persists it and re-computes word counts.
Add a TODO marker (optionally scoped to a section) — surfaced in the compiled Markdown.
Add a reference entry (BibTeX JSON fields or raw BibTeX string).
Look up a reference via DOI or free-text query using the configured ref provider (Crossref by default; local regex-only fallback).
Attach a reference to a section (adds to section.cites).
Write refs.bib per venue style (IEEE / ACM / APA / arXiv-plain). The compiler always keeps refs.bib in sync; this tool lets the Cite Agent force a style change.
Detect and merge duplicate references (by DOI, then by title+year).
Extract figure images from an ingested PDF source into sources/extracted/<source_id>/figures/. Requires a pdf provider with layout support (the local fallback extracts text only and will report zero figures).
Store a figure's description on its DSL entry. The Vision Analyst generates the description via its own vision-capable gateway; this tool only persists it.
Persist a vision-verified verdict on a claim. Verdict is supported / contradicted / inconclusive. The Vision Analyst derives the verdict itself by looking at the figure; this tool only records it.
Register an image/figure file into figures/. Copies from an absolute path or URL into the document folder. Does NOT place the figure in a section — call place_figure for that.
Bind a registered figure to one or more outline sections.
Set the short caption (or placement) on a registered figure.
Return the figure manifest for a document.
Register a verifiable assertion (quantitative / complexity / qualitative / novelty). Claim starts unverified — Vision Analyst flips verified=true via set_claim_verdict.
Attach source ids or reference ids to a claim's supported_by list.
List claims (optionally filter by section / verified).
Return claims where verified !== true OR supported_by is empty. The Director runs this before compiling non-Markdown targets.
Apply a venue pack (config/venues/*.yaml) to the document — sets venue + bib_style, and appends any missing required sections.
Return per-section word count vs target plus totals.
Cross-check document against its venue pack (required sections, bib style, page limits). Returns { ok, issues[], warnings[] }.
Set or clear the document's watermark (DRAFT, CONFIDENTIAL, etc.). Applied by every compile target — Markdown banner, LaTeX draftwatermark package, USPTO XML publication-status element. Pass text:null (or empty "") to explicitly opt out — otherwise the compiler auto-applies DRAFT when unverified claims exist.
Persist a review the Reviewer Agent authored via its own gateway. verdict is accept | revise | reject; optional score 0-10.
List all reviews on a document (returns summaries; use get_document full for bodies).
Set doc.patent.{type, priority_date, inventors}. Only applies when kind === "patent_application".
Append an independent or dependent claim to doc.patent.claims_tree. Dependent claims require depends_on (id of the parent claim).
Narrow / broaden / rewrite an existing patent claim's text (id stable).
Register a reference from doc.references as prior art on the patent application.
Persist a novelty verdict on a patent claim (novel / similar_to_prior / anticipated / inconclusive). Prior Art Agent derives verdict via its own gateway; this tool only records it.
Validate patent claims_tree — reports orphans, cycles, depth, and independents/dependents counts.
Agents (13)
Orchestrator for Document Writer. Talks to the user, plans, delegates domain work (source / outline / draft / cite / vision), and drives the compile pipeline to produce research papers, patent applications, technical reports, grant proposals, and literature reviews.
Manages the reference list — DOI / arXiv / free-text lookups, dedup, bib style. Never drafts prose.
Patent-only. Authors independent and dependent claims for patent applications; narrows or broadens existing claims. Uses its own gateway to draft the exact claim prose (patent-style formality), then persists via add_claim_tree_item / update_claim_tree_item.
Extracts claims from drafted prose (using its own gateway), registers them with add_claim, and links each to its supporting source or reference. Does not verify — that is Vision Analyst.
Writes prose for one section at a time. Uses its own gateway to generate the text based on the outline, linked sources, notes, and available references; then calls set_section_content to persist.
Imports figures into figures/, places them into sections, and sets captions. Delegates figure GENERATION (3D rendering, animation stills) to sibling plugins — threejs-studio for 3D scenes, manim-studio for animation last-frames.
Owns the document outline — section list, target word counts, order, and dependencies. Nothing else.
Read-only planning sub-agent — produces an outline, venue recommendation, and source ingest plan before any drafting starts.
Patent-only. Compares patent claims against prior art references (from doc.references and doc.patent.prior_art) using its own gateway. Records a novelty verdict per claim via set_claim_novelty.
Reviews the drafted document against a rubric (novelty, clarity, rigor, contribution) OR simulates a specific reviewer persona (harsh_academic, industry_engineer, patent_examiner). Authors the review via its own gateway then persists via add_review.
Ingests PDFs / URLs / notes / experimental data as sources on the document. Delegates figure extraction to vision-analyst when needed.
Applies venue templates, checks per-section length vs targets, and verifies venue compliance (required sections, page limits, bib style).
Extracts figures from ingested PDFs and — using its own vision- capable gateway — describes them and verifies claims against them. Persists results via set_figure_description and set_claim_verdict.
Workspace views (4)
./workspace/studio.html
./workspace/references.html
./workspace/sources.html
./workspace/compile.html