
jigstore
io.github.jigstore/jigstore
Deterministic tools for AI agents: charts, tables, QR codes and timelines from a short JSON spec.
Documentation
Ready-made tools for AI agents. In a workshop, a jig lets you repeat a precise job every time without redoing the setup. Jigstore does the same for agents: instead of having a model generate an SVG, a chart script or a document token by token, the agent writes a short spec and a deterministic tool does the rest. The output is the same every time, the model writes about 20 times fewer tokens, and the result arrives in under a second instead of 5 to 30 seconds of streaming.
Each tool is a jig in this catalog.
| jig | what it does |
|---|---|
chart | 12 chart types (bar, line, area, scatter, pie, donut, histogram, waterfall, funnel, heatmap, sparkline) from JSON to SVG or PNG |
table | Rows, or a CSV/JSON file, to Markdown, SVG, PNG, HTML or CSV, with totals, subtotals, formats, sorting, color rules and in-cell bars and sparklines |
qr | Text, a URL or Wi-Fi details to a scannable QR code, SVG or PNG |
timeline | Tasks with dates to a Gantt chart or roadmap, with groups, progress, milestones and a today marker |
Install
pip install jigstore
# PNG output: adds resvg, a self-contained wheel (no system libraries) for Linux, macOS and Windows
pip install "jigstore[png]"
No runtime dependencies. Python 3.10+.
Chart builder
jigstore chart '{"type":"bar","title":"Revenue by region","data":{"North":1240000,"South":905000,"East":1530000,"West":712000},"prefix":"$"}' -o revenue.png
# prints: revenue.png
The CLI prints only the output path, so the result costs the agent a few tokens. Errors are one line on stderr that say what to fix, with exit code 2.
From Python:
from jigstore.chart import render, save
svg = render({"type": "donut", "data": {"Compute": 48, "Storage": 15}})
save({"type": "line", "x": ["Q1", "Q2"], "series": {"Web": [3, 5]}}, "out.png")
Gallery
Sparkline, for tables and text:
Specs for every chart above are in examples/specs.json.
Options that tell a story
| Option | Example | What it does |
|---|---|---|
highlight | "highlight": "East" | Keeps one category in color and greys out the rest |
refs | "refs": [{"value": 1000, "label": "Target"}] | Dashed reference line with a label |
stack | "stack": "percent" | 100% stacked bars or areas |
curve | "curve": "smooth" or "step" | Smooth lines that never overshoot the data, or steps |
ymin, ymax | "ymin": 0 | Fix the value axis |
legend | "legend": "bottom" | top, bottom or none |
palette | "palette": "colorblind" | default, colorblind (Okabe-Ito), mono, warm, cool |
decimals, grid, font | "decimals": 1, "grid": false | Number format, gridlines, font family |
y2 | "y2": "Margin", "y2suffix": "%" | Draws that series as a line against a second axis on the right (bar and line charts) |
scale | "scale": "log" | Log scale for data that spans several orders of magnitude (bar, line, scatter) |
from | "from": "sales.csv", "x": "Month", "y": ["Revenue", "Cost"] | Reads the columns from a CSV or JSON file instead of typing the data |
numbers | "numbers": "indian" | Lakh and crore: ₹12.4L, ₹1.2Cr, 12,34,567 |
| dates | "x": ["2026-01-05", "2026-02-02"] | ISO dates make a time axis: points are spaced by time and ticks fall on round dates. "xtype": "category" turns it off |
What it handles for you
- Round axis ticks and compact numbers (
$1.5M,40K,12%), or lakh and crore with"numbers": "indian". - Labels that fit: long category names are rotated or shortened, crowded axes skip labels.
- Pie slices beyond 8 are grouped into "Other". Slice and cell labels pick black or white text for contrast.
- Gaps in line data (
null) break the line instead of dropping to zero. - Light and dark themes, colorblind-friendly palettes, accessible
<title>. - Small output: most example SVGs are 2 to 4 KB with no scripts or external fonts.
- Errors an agent can act on: a misspelled option or column gets a "did you mean" (
unknown option "colour"; did you mean "colors"?), and unknown options are errors rather than silently ignored. - Safe with untrusted specs: text is escaped and colors are validated. See SECURITY.md.
Tokens and time
Tokens are estimated as characters / 4. "By hand" is what a model would write to produce
the same chart itself. Time assumes 50 to 100 output tokens a second; rendering takes
about 0.1 ms and is left out. Run python scripts/build_examples.py to reproduce.
| chart | spec tokens | SVG by hand | saved | time by hand | time with a spec |
|---|---|---|---|---|---|
| bar | 37 | 553 | 94% | 5.5 to 11 s | 0.4 to 0.7 s |
| line | 49 | 896 | 95% | 9 to 18 s | 0.5 to 1 s |
| waterfall | 44 | 827 | 95% | 8.3 to 17 s | 0.4 to 0.9 s |
| heatmap | 50 | 1,586 | 97% | 16 to 32 s | 0.5 to 1 s |
| pie | 29 | 586 | 96% | 5.9 to 12 s | 0.3 to 0.6 s |
Writing matplotlib code instead usually takes 150 to 400 tokens of code, plus a heavy install and a second round trip when the code fails.
Table jig
jigstore table '{"from":"q3.csv","total":{"Region":"Total","Revenue":"sum"}}' # prints Markdown
jigstore table @spec.json -o q3.png # or .svg .html .csv .md
Why an agent would use it rather than write a Markdown table itself:
-
It reads the data from a file.
"from": "q3.csv"(or.json) means the agent never retypes rows it already saved from a query: 17 tokens instead of about 200 for a 20-row table, and no copying mistakes. Only the CLI and the local MCP server read files, and only inside the working folder (orJIGSTORE_OUT_DIR). -
Numbers come out right. Totals, averages, sorting and rounding are computed, not guessed. Each column uses one unit (
$0.91M,$1.24M) so values line up. -
It renders where Markdown doesn't. Slack and most email clients don't show Markdown tables. PNG and inline-styled HTML do. Writing that HTML by hand costs 750 to 2,350 tokens in the examples; the spec costs 78 to 111.
-
Safe output. Text is escaped in every format, and CSV cells that start with
=,+,-or@are neutralised so spreadsheets don't run them as formulas. -
Report tables, not just grids.
"group": "Region"adds a subtotal row after each region. Columnrulescolor cells by value ({"below": 0, "color": "#dc2626"}), and"wrap": truewraps long text onto several lines in images instead of cutting it.
Percentages are written as whole or decimal numbers (12, 95.5) and shown with 2 decimals
unless decimals says otherwise. Images show 25 rows by default (max_rows up to 200);
Markdown, HTML and CSV keep up to 1,000.
Timeline jig
jigstore timeline @plan.json -o plan.png
jigstore timeline '{"from":"plan.csv","today":"2026-02-10"}' -o plan.svg # columns name,start,end,group,owner,progress
Tasks need a name plus start and end (inclusive; 2026-03 means the whole month), or
a date for a milestone. group gives each group a band and a color, progress shades the
done part of a bar, owner is written next to it, and today and markers draw vertical
lines. Nothing reads the clock: "today" is the date in the spec, so the same spec always
gives the same image. The example spec is about 210 tokens; the SVG
it replaces is about 1,030, and the layout math is where models usually go wrong.
QR jig
jigstore qr '{"url":"https://github.com/jigstore/jigstore","label":"github.com/jigstore"}' -o qr.png
jigstore qr '{"wifi":{"ssid":"Office","password":"...","type":"WPA"}}' -o wifi.png
A model can't draw a working QR code: every module depends on error correction that has
to be computed. Agents usually have to install a library and write code for it. With the
jig the spec is about 15 tokens. The encoder is pure Python with no dependencies, covers
all 40 QR versions and the four error correction levels, and picks the smallest code that
fits. CI decodes a code of every version and level with an independent reader (zxing-cpp).
Wi-Fi codes escape ;, ,, :, " and \ in the network name and password, which is
easy to get wrong by hand.
Using it from an agent
Shell access (cheapest). Copy docs/agent-prompt.md into your agent's instructions,
or let the agent run jigstore docs chart or jigstore docs table when it needs the
spec format (about 250 tokens each). Nothing is loaded into context until it's used.
MCP. Add the server to any MCP client (Claude, Kiro, Cursor, VS Code and others):
{
"mcpServers": {
"jigstore": {
"command": "uvx",
"args": ["jigstore", "mcp"],
"env": { "JIGSTORE_OUT_DIR": "/path/to/charts" }
}
}
}
The server exposes one jig tool for every jig, so its schema stays about 145 tokens
per turn however many jigs exist. The full spec format of a jig is returned only when a
call fails, so it costs nothing while the model gets specs right. Arguments: jig
(chart or table), spec, out (a file path whose extension picks the format), and
view: true to also get a PNG back so the model can check the result. A table with no
out comes back as Markdown text. When JIGSTORE_OUT_DIR is set, files are read and
written only inside it.
The server has no dependencies and supports both the 2026-07-28 stateless MCP protocol
and the older initialize handshake (2024-11-05 to 2025-11-25).
Adding a jig
Each jig lives in src/jigstore/<name>/ with a USAGE.md of 300 tokens or less and one
entry in the registry (src/jigstore/registry.py). The CLI, the MCP server and the hosted
service pick it up from there. You can also publish a jig as your own package through the
jigstore.jigs entry point; jigstore list shows it next to the built-in jigs.
See CONTRIBUTING.md.
Support the project
Jigstore is built and maintained by one person. If it saves your agents tokens, you can sponsor it on GitHub or buy me a coffee. Bug reports, tool ideas and pull requests help just as much.
License
MIT
jigstorepip install jigstore