Skip to content

t1k:business:contract

FieldValue
Modulebase
Version0.12.1
Effortlow
Tools—

Keywords: agreement, beautify contract, contract, contract pdf, distribution agreement, docx, legal, license agreement, nda, pandoc, partnership agreement, pdf, render contract, tabularize, term sheet, term-sheet

/t1k:business:contract
init [dir] | lint <file.md> | fix <file.md> | tabularize <file.md> | render <file.md|dir> | beautify <file.md|dir>

TheOneKit Contract — Legal Document Beautifier

Section titled “TheOneKit Contract — Legal Document Beautifier”

Render Markdown legal documents (term sheets, NDAs, partnership / distribution / licensing agreements) into HTML, DOCX, and PDF that look professional enough to send to a counterparty.

Ships a CSS template (references/contract-style.css), a render pipeline (pandoc + Chrome headless), and a lint pass that catches the five pandoc gotchas that bit us on real contracts.

OperationWhat it does
init [dir]Scaffold contract-style.css + sample-term-sheet.md into dir (default: cwd). Idempotent — does not overwrite existing files.
lint <file.md>Run all checks against the Markdown source. Reports issues with line numbers. Exits non-zero on FAIL.
fix <file.md>Auto-apply safe fixes for the lint findings (\ hard breaks for run-on metadata + signatures; insert blank line before list/blockquote that follows a paragraph; collapse nested italic ambiguity in “(Identical to …)” patterns). Does NOT change semantics.
tabularize <file.md>Suggest sections that should be tables (Parties, vesting schedule, KPI thresholds, governing law, expense reimbursement, etc.). Reports candidates with line numbers; the AI does the conversion (semantic — not auto-applied).
render <file.md|dir>Generate paired .html, .docx, .pdf next to the source. Uses sibling contract-style.css if present. Skips lint.
beautify <file.md|dir>Full pass: fix then render. Default operation when in doubt.

All operations dispatch through scripts/contract.cjs <op> [args...].

The script auto-detects:

  • Output directory (same folder as source)
  • CSS template (sibling contract-style.css, or copy from references/ on first run)
  • Document title — from the first H1 in the body, falling back to the file’s basename. YAML frontmatter is not a title source: the renderer passes the H1 to pandoc as --metadata pagetitle, and a command-line --metadata overrides any document-side key. Setting frontmatter title: therefore does not set the document title — it emits a second <h1 class="title"> block alongside your body H1, which is the duplicate-header gotcha the lint warns about (gotcha 1 below).

These have all bitten real contracts in this codebase. The lint enforces them; the fix repairs them: (1) duplicate stacked H1 — use --metadata pagetitle, never title; (2) run-on metadata block — missing \ hard breaks collapse consecutive **Label:** lines into one paragraph; (3) run-on signature block — same cause, at the bottom of the doc; (4) nested italic ambiguity — four * in a row pair wrong, leaving stray asterisks; (5) missing blank line before a list/blockquote — silently concatenates the next block into the preceding paragraph.

Full cause/fix detail, worked examples, and the cluster-boundary/nesting edge cases: references/lint-rules.md.

render generates paired .html, .docx, and .pdf for each <file>.md: HTML via pandoc + the sibling CSS (--metadata pagetitle, never title); DOCX via plain pandoc (no --reference-doc by default); PDF via Chrome headless on the rendered HTML (--no-pdf-header-footer, CSS @page controls margins).

Exact commands + flag rationale: references/pandoc-conventions.md.

references/contract-style.css (~175 lines) is opinionated for legal/business documents:

  • Type: Georgia serif body (legal-document tradition), Helvetica Neue sans-serif headings.
  • Color: navy #0b2545 accents on H1/H2 headings, table headers, links.
  • Tables: zebra-striped rows, navy header bar, rounded corners, drop shadow.
  • Headings: double horizontal rule under H1; single rule under H2; uppercase tracked H4.
  • Blockquote: navy left-rule, italic text — for “About this scenario” callouts.
  • Print: A4 page size, 2.5cm vertical / 2cm horizontal margins, page-break-avoid on tables and signature blocks.

Override by dropping a contract-style.css in the same folder as the source markdown — the script picks it up automatically.

Tabularization patterns — sections that should be tables

Section titled “Tabularization patterns — sections that should be tables”

A contract reads better when structured data lives in tables, not prose or bullets. The tabularize operation reports candidates; the AI converts them. These nine patterns recur across every term sheet / partnership / distribution / licensing agreement and should always be tables:

SectionTable shapeWhy
§1 PartiesField × {Company, Counterparty} (3 columns)Side-by-side comparison; each field aligns visually. Beats two stacked bullet lists.
§ TermField / Value (2 cols) — Effective Date, Initial term, Renewal, Early terminationPure key-value data — bullets waste vertical space.
§ Signing grant / vesting scheduleMonth / Vests this period / Cumulative vested (3 cols)Time-series data; tabular form makes the schedule auditable at a glance.
§ Supporting KPIsKPI / Threshold / Measurement (3 cols)Each KPI has a discrete threshold + measurement formula — exactly what tables are for.
§ Vesting / M&A conditionsCondition / Requirement (2 cols)Conditions are atomic, side-by-side comparison helps.
§ Key Person departure optionsOption (Pause / Terminate) / Effect (2 cols)Two-row decision matrix — table is the canonical representation.
§ Termination — for cause / without cause / good vs bad leaverTrigger / Detail OR Type / Triggered by / Equity outcomeTermination is decision data; readers need to scan, not read.
§ Expense reimbursementField / Detail (2 cols) — Cap, Requires, Reimbursement, Not compensationField/value form.
§ Governing law and disputesField / Value (2 cols) — Governing law, Disputes, Seat, Language, Arbitrators, CostsUniversal contract pattern. Always a table.

Convert when:

  • The bullet list is purely **Field:** value patterns (4+ rows) → Field/Value table
  • Two parties have parallel fields → side-by-side table
  • A clause defines a discrete set of conditions/outcomes/options → table
  • Data has a numeric or time component → table

Keep as prose when:

  • The content is one continuous argument or narrative
  • Bullets nest 2+ levels (tables don’t nest)
  • Each item is a paragraph (>200 chars) — table cells become unreadable
  • The section is < 3 items (table overhead exceeds payoff)

The skill’s tabularize operation flags the patterns above. The AI does the actual conversion (semantic — column headers should fit the data, not be auto-generated).

Following these makes the output consistent across documents:

  • Top-of-doc metadata block — use \ line breaks, not blank lines (keeps it as a single visual cluster):

    **Status:** Draft for negotiation\
    **Date:** 2026-04-22\
    **Parties:** Foo Inc. and Bar Ltd.
  • Signature block — same pattern, with **For <Party Name>** as bold prefix:

    **For Acme Inc.**\
    Name: Jane Doe\
    Title: CEO\
    Date: [____]\
    Signature: ______________________
  • Cross-references — write as plain text with section number: as set forth in §6.4. Pandoc does NOT auto-link these; convert to clickable links manually if needed.

  • Defined terms — use bold-on-first-use convention: “Confidential Information”. The skill does NOT auto-highlight defined terms (intentional — automatic detection is unreliable on legal text).

  • Bracketed placeholders — write as [____] (4 underscores in brackets). The skill does not enforce this, but it’s the convention this codebase uses for fillable fields.

Only the read-only half of this skill is cheap-tier (routing SSOT: rules/orchestration-rules.md § “Task-Type → Agent Routing”). The rest stays on a reasoning tier.

StepAgent
lint <file.md> and tabularize <file.md> via scripts/contract.cjs: run the script and tabulate the findings with line numbers (both only read the source)t1k-metrics-reporter — runs the bundled script and tabulates its output; does not interpret or fix

Stays reasoning-tier: fix (rewrites the legal source document in place), init/render/beautify (write files and run pandoc + Chrome next to the source), and the semantic conversion of tabularize candidates into tables. Nothing here touches external state, but a wrong edit to contract text is not a re-runnable mistake.

Inline operation — the skill is deterministic. No agent delegation needed for lint, fix, render, or beautify. For drafting new term sheets from scratch, route to t1k-planner or t1k-researcher first.

  • references/contract-style.css — the bundled professional stylesheet
  • references/lint-rules.md — full reference for the five gotchas with regex patterns
  • references/pandoc-conventions.md — pandoc invocation + flag rationale
  • Refuses to render files containing BEGIN RSA PRIVATE KEY, -----BEGIN OPENSSH, password:, or other secret indicators (the lint pass checks).
  • Never embeds remote stylesheets or scripts (CSS is local-file only).
  • Chrome runs with --disable-gpu --headless (no UI, no remote-debugging port).