Argdown

From htlin222/dotfiles · View interactive version

Argdown is an AI agent skill from the GitHub repository htlin222/dotfiles. Author and iterate on `.argdown` argument-map files. Use when the user asks to "create an argdown", structure a debate / argument / pro-con map, lint a `.argdown` file, or export an argument map to SVG/DOT/HTML/JSON via the `argdown` CLI. Workflow — draft, then run `argdown` on the file to lint with

How to use this skill

Skill file

argdown

Argdown is a Markdown-flavored DSL for argument maps. Source is a .argdown text file; the argdown CLI parses it, reports syntax errors with location info, and exports to SVG/DOT/HTML/JSON.

When this skill fires

Prerequisite

argdown CLI must be on PATH (/opt/homebrew/bin/argdown on this machine). Check with command -v argdown. If missing: npm install -g @argdown/cli. For SVG/PNG export, Graphviz is also needed: brew install graphviz.

Core workflow

  1. Draft the .argdown file. Minimal skeleton:

```argdown

===

title: <topic>

===

# <Section>

[Main claim]: One-sentence thesis.

<Supporting Arg>

(1) Premise.

(2) Premise.


(3) [Main claim]

```

  1. Lint — there is no separate lint subcommand. The default invocation parses and logs syntax errors with line/col:

```bash

argdown path/to/file.argdown

```

Or use scripts/lint.sh <file> (bundled): adds --throwExceptions so exit code is non-zero on parser errors — suitable for an iterate-until-clean loop.

  1. Fix the reported errors. See "Gotchas" below for common ones.
  1. Render once clean:

```bash

argdown map path/to/file.argdown ./svg -f svg

```

Or scripts/render.sh <file> [outdir] — wraps lint + map and prints the SVG path.

  1. Iterate if the map looks wrong — adjust statements, relations, or --rankdir/label-mode flags.

Syntax cheat sheet

Full reference in references/syntax.md — load it when authoring a construct not covered here.

| Construct | Syntax | Notes |

|---|---|---|

| Statement (titled) | [Title]: text | Same title = same equivalence class |

| Argument | <Title>: description | Angle brackets, not equivalence-class |

| Premise-conclusion | (1) premise then ----- then (N) conclusion | Consecutive numbering, no blank lines inside |

| Support | + <Arg> or + [Stmt] | Indented under parent |

| Attack | - <Arg> | |

| Contradiction | >< <Arg> | symmetric |

| Undercut | _ <Arg> | targets an inference |

| Direction | <- outgoing, +> incoming | reverse the arrow |

| Reference | [Title] or <Title> alone | reuse without redefining |

| Mention | @[Title] / @<Title> | inline reference inside prose |

| Section | # Heading | groups in the map |

| Frontmatter | === ... === block | YAML config; mode: strict toggles strict relations |

| Inference detail | --\nModus Ponens\n{uses: [1,2]}\n-- | optional between premise list and conclusion |

| Comment | // line, /* block */, <!-- html --> | |

What the linter catches vs tolerates

Argdown's parser is permissive — it recovers from many surface errors and renders something. lint.sh (via --throwExceptions) fails reliably only on a narrow set of hard parse errors. The rest must be caught by visually checking the rendered SVG.

Hard errors lint.sh will fail on:

Silent / tolerated (renders despite looking broken):

Implication: after the lint passes, always render and skim the SVG before declaring the file correct.

Inline-formatting footguns

The body of a statement or argument description is parsed for markdown-style inline formatting before the rest of the rules apply. That means:

| Trigger | Effect | Mitigation |

|---|---|---|

| _word_ | italic span | Avoid bare underscores in identifiers — use - or wrap in backticks. |

| *word* | italic span | Same as above for asterisks. |

| **word** | bold span | Don't paste markdown bold into descriptions unless balanced. |

| [Anything] mid-prose | parsed as a statement reference | Rephrase or use a different bracket style. |

| <word> mid-prose | parsed as an argument reference | Same. |

When in doubt, write descriptions as plain prose and put code-like tokens in ` backticks ` — argdown treats them as inline code and leaves them alone.

Citing sources with YAML metadata

Any statement definition or reference can carry YAML metadata. Use this to attach a citation to a claim so the rendered map can hyperlink or label by source.

Recommended schema for a citation, fields in priority order:

| Field | Required when | Notes |

|---|---|---|

| source | always | DOI preferred — bare 10.xxxx/yyyy or https://doi.org/.... Fall back to a stable URL. |

| author | recommended | Surname et al. is fine for multi-author. |

| date | recommended | YYYY or YYYY-MM or YYYY-MM-DD. |

| title | recommended | Short title is enough; full title in the YAML keeps the diagram label clean. |

Inline form — use when the metadata fits on one line:

[Climate trend]: Global mean surface temperature rose 1.2 °C since 1850. {source: 10.1126/science.abc1234, author: Smith et al., date: 2023, title: HadCRUT5 reanalysis}

Block form — opening { followed by a newline activates YAML block mode; the brackets are ignored and the body between them is parsed as YAML:

[Climate trend]: Global mean surface temperature rose 1.2 °C since 1850.
{
  source: 10.1126/science.abc1234
  author: Smith et al.
  date: 2023-04
  title: A reanalysis of HadCRUT5
}

For URL sources, quote the value so the colons don't confuse the YAML parser:

[IPCC AR6]: Anthropogenic warming is the dominant cause of observed warming since 1850.
{
  source: "https://www.ipcc.ch/report/ar6/wg1/"
  author: IPCC
  date: 2021
  title: AR6 Working Group I Summary
}

Same metadata schema works for <Argument> definitions — drop the YAML block right after the argument title or description.

Useful CLI flags

Bundled scripts

Both scripts assume argdown is on PATH.

Reference

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.