Markform
What if your Markdown docs had an agent-friendly semantic API?
Markform is a text format for defining structured forms that humans can read,
machines can parse, and agents can fill via tool calls.
Define instructions, fields, and validation rules in a single .form.md file.
Agents fill forms incrementally via patches.
Fields are validated, so errors are caught early and can be corrected.
Humans can review or intervene at any point.
Why forms?
For deep research or complex AI tasks, you need more than just prompts or flow: you need
structure, which is precise control over agent output at every stage of a workflow.
A well-designed form combines instructions, structured data, and validations in one
place.
How it Works
A Markform document exposes a programmatic interface: users fill fields via CLI or web
UI, agents fill via tool calls (Vercel AI SDK
integration included).
Changes are explicit patch operations
({ "op": "set_string", "fieldId": "name", "value": "Alice" }) validated against a
schema specified in the form.
The agent sees validation errors and can self-correct.
The format extends Markdown with a
precise specification.
Export Markform syntax to JSON, YAML, JSON Schema, or plain Markdown reports.
Optionally, the whole thing is wrapped in a harness where large forms can be filled
concurrently by any LLM in a structured agentic loop.
Useful details
Markform syntax is a good source format: it is token-efficient text you can read,
diff, and version control and it is ideal for context engineering because it
combines document context, data schema, and memory (data filled so far).
Structure is defined with HTML comment tags (<!-- field -->) that render invisibly
on GitHub, so forms look like regular Markdown. (Jinja-style tag syntax also works
if you prefer.)
Form-filling can scale to hundreds of fields and complex tabular data.
A form can be filled by dozens of concurrent LLM requests, which makes it possible
to systemetize extensive research processes or workflows.
(Also, a a detailed JSON fill record of the form-filling process is kept, so you
can review or debug agent behavior and tool usage.)
The optional CLI has a small, built-in web server, markform serve, for easy
viewing and debugging of forms.
It including a form web UI, the form schema, and a waterfall-style overview of the
fill record, including performance details, which is useful for large, concurrently
filled forms).
Simple Example: Research a Movie
Form Definition
A .form.md file combines YAML frontmatter with HTML comment tags that define
structure. The text can be any Markdown.
Here is the
movie-research-demo.form.md:
---
markform:
spec: MF/0.1
title: Movie Research Demo
description: Movie lookup with ratings from IMDB and Rotten Tomatoes.
run_mode: research
roles:
- user
- agent
role_instructions:
user: "Enter the movie title."
agent: |
Identify the movie with web searches and use imdb.com and rottentomatoes.com to fill in the ratings.
---
<!-- form id="movie_research_demo" -->
<!-- group id="movie_input" -->
## What movie do you want to research?
<!-- field kind="string" id="movie" label="Movie" role="user" required=true minLength=1 maxLength=300 --><!-- /field -->
<!-- instructions ref="movie" -->Enter the movie title (add year or details for disambiguation).<!-- /instructions -->
<!-- /group -->
<!-- group id="about_the_movie" title="About the Movie" -->
## Movie Ratings
Here are the ratings for the movie:
<!-- field kind="single_select" id="mpaa_rating" role="agent" label="MPAA Rating" -->
- [ ] G <!-- #g -->
- [ ] PG <!-- #pg -->
- [ ] PG-13 <!-- #pg_13 -->
- [ ] R <!-- #r -->
- [ ] NC-17 <!-- #nc_17 -->
- [ ] NR/Unrated <!-- #nr -->
<!-- /field -->
<!-- field kind="table" id="ratings_table" role="agent" label="Ratings" required=true columnIds=["source", "score", "votes"] columnTypes=["string", "number", "number"] minRows=0 maxRows=3 -->
| Source | Score | Votes |
|--------|-------|-------|
<!-- /field -->
<!-- instructions ref="ratings_table" -->
Fill in scores and vote counts from each source:
- IMDB: Rating (1.0-10.0 scale), vote count
- RT Critics: Tomatometer (0-100%), review count
- RT Audience: Audience Score (0-100%), rating count
<!-- /instructions -->
<!-- /group -->
<!-- /form -->
Fields have types defined by the attributes.
A field can have role="user" (filled interactively) or role="agent" (filled by an
agent). Values are filled in incrementally, just like any form.
Filled Form
The key point is that with this structure a Markdown file automatically gets a schema
and a tool API.
Agents or users can fill in values using a TypeScript API or via agent tool calls.
And agents find this format highly context efficient. All information needed to fill
in the form is right there, not in long conversation history.
And it can be done incrementally, a few fields at a time.
Once filled in, values appear directly inside the tags, in Markdown format:
<!-- form id="movie_research_demo" -->
<!-- group id="movie_input" -->
<!-- field kind="string" id="movie" label="Movie" role="user" required=true minLength=1 maxLength=300 -->
```value
The Shawshank Redemption
```
<!-- /field -->
<!-- /group -->
<!-- group id="about_the_movie" title="About the Movie" -->
<!-- field kind="single_select" id="mpaa_rating" role="agent" label="MPAA Rating" -->
- [ ] G <!-- #g -->
- [ ] PG <!-- #pg -->
- [ ] PG-13 <!-- #pg_13 -->
- [x] R <!-- #r -->
- [ ] NC-17 <!-- #nc_17 -->
- [ ] NR/Unrated <!-- #nr -->
<!-- /field -->
<!-- field kind="table" id="ratings_table" role="agent" label="Ratings" required=true columnIds=["source", "score", "votes"] columnTypes=["string", "number", "number"] minRows=0 maxRows=3 -->
| Source | Score | Votes |
| --- | --- | --- |
| IMDB | 9.3 | 3100000 |
| RT Critics | 89 | 146 |
| RT Audience | 98 | 250000 |
<!-- /field -->
<!-- /group -->
<!-- /form -->
Report Output
Run npx markform examples to copy examples, then npx markform run and select
Movie Research Demo to fill it.
A form can be exported as the filled form (Markform), as a report (plain Markdown), as
values (YAML or JSON), or as a JSON Schema (just the structure).
The report output (using gpt-5-mini to fill it in) looks like:
Movie:
The Shawshank Redemption
## About the Movie
MPAA Rating:
R
Ratings:
| Source | Score | Votes |
| --- | --- | --- |
| IMDB | 9.3 | 3100000 |
| RT Critics | 89 | 146 |
| RT Audience | 98 | 250000 |
YAML Export (click to expand)
values:
movie:
state: answered
value: The Shawshank Redemption
mpaa_rating:
state: answered
value: r
ratings_table:
state: answered
value:
- source: IMDB
score: 9.3
votes: 3100000
- source: RT Critics
score: 89
votes: 146
- source: RT Audience
score: 98
votes: 250000
JSON Schema (click to expand)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "movie_research_demo",
"type": "object",
"properties": {
"movie": {
"type": "string",
"title": "Movie",
"minLength": 1,
"maxLength": 300
},
"mpaa_rating": {
"type": "string",
"enum": ["g", "pg", "pg_13", "r", "nc_17", "nr"],
"title": "MPAA Rating"
},
"ratings_table": {
"type": "array",
"items": {
"type": "object",
"properties": {
"source": { "title": "Source", "type": "string" },
"score": { "title": "Score", "type": "number" },
"votes": { "title": "Votes", "type": "number" }
}
},
"title": "Ratings",
"minItems": 0,
"maxItems": 3
}
},
"required": ["movie", "ratings_table"]
}
Why Do Agents Need Forms?
For centuries, humans have used paper forms and
checklists to systematize
complex processes. A form with instructions, field definitions, and validations is a
concise way to share context: goals, background knowledge, process rules, and state
(memory). I don’t think AI changes this essential aspect of knowledge work.
Most agent frameworks focus on prompts and flow (the how) over the structure of
results (the what).
But for deep research or other multi-step workflows, you need precise
control over intermediate states and final output.
You don’t want that structure in a GUI (not token-friendly), in code (hard to update),
or dependent on model whims (changes unpredictably with model updates).
Forms solve this. Forms codify operational excellence.
They’re easy to read, easy to edit, and enforce standards.
Because LLMs handle Markdown well, agents can also help create and improve the forms
themselves—closing the meta-loop.
It’s time to bring bureaucracy to the agents!
See the FAQ for more on the design.
Quick Start
There are three ways to get started, from quickest to most thorough:
1. Run an example automatically — copy bundled forms and let an LLM fill one:
# Set OPENAI_API_KEY or ANTHROPIC_API_KEY (or put in .env)
npx markform@latest examples
Pick movie-research-demo.form.md for a quick demo.
2. Agent-guided tour — ask a coding agent (like Claude Code) to walk you through a
specific example step by step.
The agent copies the form, explains the structure, fills fields, validates, and exports:
# List available examples
markform examples --list
# Copy one to work with
markform examples --name movie-research-demo
3. End-to-end walkthrough — have a coding agent follow the
demo playbook to design a
research form from scratch, fill it with real data, validate, export, and browse.
This is the most thorough tour of all Markform features.
# Read the docs (tell your agents to run these; they are agent-friendly!)
npx markform # CLI help
npx markform readme # This file
npx markform docs # Quick reference for writing Markforms
npx markform spec # Read the full spec
Installation
Requires Node.js 20+.
# As a global CLI
npm install -g markform
# Or as a project dependency
npm install markform
Use as a Claude Code Skill
If you install markform globally (npm install -g markform), you can tell Claude to run
markform setup --auto to install it as a Claude Code skill.
This teaches Claude how to use markform commands when working with .form.md files in
your project.
# Install as a Claude Code skill (non-interactive, for agents)
markform setup --auto
# Or guided setup with prompts (for humans)
markform setup --interactive
# View the skill content
markform skill
More Example Forms
The package includes example forms.
View them with markform examples --list, copy with markform examples, and run with
markform run:
Why a New Format?
The closest alternatives I’ve seen are:
Plain Markdown docs can be used as templates and filled in by agents.
These are more expressive, but it is hard to edit them programmatically or use LLMs to
update them reliably.
JSON + JSON Schema which are good for struture but terrible for additional
unstructured context like instructions Markdown.
Agent to-do lists are part of many chat or coding interfaces and are programmatically
edited by agents. But these are limited to simple checklists, not forms with other
fields.
Numerous tools like Typeform, Google Forms, PDF forms, and Docusign offer
human-friendly UI. But these do not have a human-friendly text format for use by
agents as well as humans.
| Approach |
Usable GUI editor |
Human-readable source format |
Agent-editable |
APIs and validation rules |
| Plain Markdown |
✅ IDEs/editors |
✅ |
⚠️ fragile |
❌ |
| JSON + JSON Schema |
✅ IDEs/editors |
⚠️ no free text |
✅ |
✅ |
| SaaS tools (Typeform, Docusign, PDF forms) |
✅ |
⚠️ rarely |
⚠️ sometimes |
⚠️ sometimes |
| HTML/web Forms |
✅ IDEs/editors |
⚠️ HTML+code |
⚠️ coding agent |
✅ |
| Excel/Google Sheets |
✅ app |
❌ .csv/.xlsx |
⚠️ with tools |
✅ with some coding |
| Markform |
✅ IDEs/editors |
✅ |
✅ with this package |
✅ with this package |
Architecture