TikZ Draw
Windows Runtime Commands
On native Windows, use the managed Windows runner and the native runtime command target. Set $runtime to the installed runtime root. Multi-agent installs usually use %LOCALAPPDATA%\ai-agents-skills\runtime. Then run:
$runtime = if ($env:AAS_RUNTIME_ROOT) { $env:AAS_RUNTIME_ROOT } else { "$env:LOCALAPPDATA\ai-agents-skills\runtime" }
& "$runtime\run_skill.ps1" "skills/tikz-draw/tikz_draw.py" <args>
POSIX examples below use run_skill.sh and .sh command targets; use the Windows command target above on native Windows.
Use this skill when the task is specifically about producing or repairing TikZ.
Typical cases:
- draw a new TikZ picture to illustrate a statement or research finding
- turn a
figure-brief.jsoninto a structural diagram spec first - refactor coordinate-heavy TikZ into structural placement
- extract an existing
tikzpicture,forest, ortikzcdblock into standalone and embeddable artifacts - run a deterministic compile and review loop on TikZ output
Runtime helper
The runtime helper exposes one stable verb set:
doctorcontractdesignspecrenderforce-checkcheckcompilereview-visualverify-designverify-semanticapprovereviewextract
Run it through the shared runtime wrapper:
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh doctor
On Windows, use:
$runtime = if ($env:AAS_RUNTIME_ROOT) { $env:AAS_RUNTIME_ROOT } else { "$env:LOCALAPPDATA\ai-agents-skills\runtime" }
& "$runtime\run_skill.ps1" `
"skills/tikz-draw/tikz_draw.py" doctor
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh render \
--brief /abs/path/to/figure-brief.json
Direct bootstrap without prewriting a brief:
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh render \
--request "Draw a validation pipeline for statement X"
render is structurally guarded: after writing the brief/spec/Tex/manifest it
automatically runs the forced overlap/symmetry loop. The command returns success
only when there are no rendered-overlap findings and the declared
symmetry_contract passes. If issues remain, it repairs layout-only geometry and
reruns the check until one of the forced-loop stop conditions fires.
If --out-dir is omitted in direct mode, the helper allocates:
- a target-specific run directory for direct Codex installs
${AAS_RUNS_ROOT:-~/.local/share/ai-agents-skills/runs}/tikz-draw/<run_id>/for shared runtime installs
For research or mathematical figures, first let the runtime write the intent contract or provide one explicitly:
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh contract \
--out /abs/path/to/F1.figure-contract.json \
--request "Draw a graph hardness reduction where an edge is replaced by a gadget"
The contract records the inferred figure family, required objects, required
relations, forbidden simplifications, notation that must be preserved, and the
approval criteria. spec and render enforce this contract. If a request says
to illustrate a graph hardness reduction, the contract must require graph
vertices and graph edges; a box-only flowchart is a contract violation.
Required workflow
- Establish the semantic intent contract before raw TikZ. Direct mode may infer and write the contract for you, but it must still be present in the generated brief and spec.
- For manuscript-facing semantic figures, establish a semantic design checkpoint before drawing or editing visual marks. This is mandatory for graph/proof/reduction figures, extracted figures intended for semantic approval, and any figure whose boxes, fills, regions, callouts, labels, or correspondence marks carry mathematical meaning. The checkpoint records the inspected source/caption/prose, affected visual marks, intended role of each mark, alternatives considered, chosen encoding, and caption/prose alignment.
- Route the figure to the right backend:
flowchart,dag:positioningtree:forestcommutative:tikz-cdgraph: baseline graph path first, with Sage-assisted routing when the request exceeds the baseline shorthand/layout surface
- Reject a requested or inferred backend family that contradicts the contract. Do not downgrade a graph request into a schematic diagram unless the contract explicitly says that a schematic is intended.
- Keep document-facing output inside the
adjustboxenvironment withmax width=\textwidth. - For standalone compile targets, use plain
\documentclass[border=...]{standalone}rather thanstandalone[tikz]. - After creating, extracting, refactoring, or modifying any TikZ figure, run the
forced structural loop (
renderdoes this automatically for generated figures; useforce-checkfor existing artifacts). Then run the strict approval gate before saying the figure is done, fixed, ready, passed, verified, or approved.
Forced structural loop:
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh force-check \
--artifacts /abs/path/to/F1.artifacts.json \
--work-dir /abs/path/to/work-dir
The loop is not optional for generated figures. It may stop only when one of these conditions is true:
issue_free_no_overlap_and_no_symmetry_failures: rendered overlap findings are gone andsymmetry_status=PASS.credit_budget_exhausted: the repair/checking credit budget is exhausted or the required checking resources are unavailable.user_stop_requested: the user explicitly asks to stop, represented locally byTIKZ_DRAW_FORCE_STOP,tikz-draw-force-stop, orSTOP_TIKZ_DRAWin the work directory, or by theTIKZ_DRAW_FORCE_STOPenvironment variable.
The loop repairs layout-only geometry: spacing, node dimensions, label anchoring, and absolute-position symmetry alignment. It must not change node labels, edge endpoints, graph meaning, captions, or semantic contracts to make a broken figure appear correct.
Strict approval command:
bash "${AAS_RUNTIME_ROOT:-$HOME/.local/share/ai-agents-skills/runtime}/run_skill.sh" \
skills/tikz-draw/run_tikz_draw.sh approve \
--artifacts /abs/path/to/F1.artifacts.json \
--work-dir /abs/path/to/work-dir
On native Windows, use the same verb through run_skill.ps1 and tikz_draw.py.
The only final approval is approve exiting 0 with:
final_verdict=APPROVEDoverlap_status=PASSdesign_status=PASSfor scoped semantic figures, ordesign_status=SKIPPEDwhen the design gate is out of scopesymmetry_status=PASS
render, force-check, extract, compile, check, review --tex,
review-visual, and verify-semantic are structural/preflight or artifact
commands. Never cite them as final approval. Source inspection, compile success,
screenshot review, PDF preview, or human visual inspection alone never
constitute final approval.
If approve fails, fix the reported issue and rerun approve. Repeat until it passes, or report the exact blocked state such as BLOCKED_INPUT, BLOCKED_ENVIRONMENT, or UNSUPPORTED_FAMILY. Do not use approval-style wording for blocked or unsupported states.
Graph routing
- The current graph lane keeps a trusted baseline path for already-supported requests such as Petersen and
J(n,k). - Richer graph requests may route to a Sage-assisted path.
- In the current slice, both paths may still use Sage for graph realization; the difference is in request routing, validation, and reporting.
- For direct graph bootstrap, the helper now accepts optional graph fields such as:
--graph-mode auto|local|sage--graph-constructor--graph-param--graph-layout--show-labels true|false
- Render manifests and semantic-review reports now carry routing fields including baseline vs Sage-assisted path selection and backend used.
Strict Approval Surface
approveis the authoritative final gate for supported render-generated figures.review --semanticdelegates to the strict approval path for compatibility.review --texremains source-only preflight and must not be treated as approval.renderruns the forced structural loop by default before returning.force-checkreruns the same forced structural loop for existing artifacts.review-visualruns through the rendered-artifact extractor and refreshesrender-semantics.jsonfrom the compiled PDF, but remains a component gate.verify-designchecks the visual-semantic design layer for scoped figures: mark roles, graph-object vs metadata separation, region/fill semantics, label/callout ownership, and declared caption/prose claim bindings.verify-semanticnow supports the current render-generatedflowchart,dag,tree, supported-squarecommutative, and Sage-backedgraphfamilies.verify-semanticstill fails closed withUNSUPPORTED_FAMILYfor an unsupported family and unsupported inputs outside the current renderer assumptions.- Strict approval is fail-closed for unsupported families, arbitrary extracted TikZ without a semantic target/spec, stale extracted sources, missing dependencies, missing render artifacts, failed overlap checks, and missing or failed symmetry contracts.
- Strict approval also fails closed when a generated spec is missing its semantic intent contract or contradicts it.
- Strict approval also fails closed when a scoped semantic figure is missing a
required visual-semantic design contract or when
verify-designreports role, metadata, region, label, correspondence, or caption/prose mismatches.
For semantic design, visual marks are not decorative by default. A box, fill, outline, color, arrow, brace, callout, label, or region must have a declared role such as graph object, annotation, callout, correspondence, gadget region, highlight region, or legend. Metadata such as list constraints should default to adjacent text or callouts, not graph-object styling. If the user correction shows that a previous design assumption was wrong, reopen the design checkpoint before editing again.
Every generated spec carries a symmetry_contract. The checker verifies the declared contract:
required: declared pair/axis/alignment symmetry must pass.not_required: accepted only with a justification.intentionally_asymmetric: accepted only with a justification.
Comments such as % Symmetry: ... are human hints only; they do not satisfy the machine-readable contract.
Regression runner
For implementation-level verification, use the persistent regression suite instead
of ad hoc /tmp smokes:
python3 $AAS_RUNTIME_WORKSPACE/skills/tikz-draw/semantic_regression_runner.py --platform both --strict-approval
The current suite covers supported good cases for flowchart, dag, tree,
commutative, and Sage-backed graph, plus mutation cases and intent-contract
cases that guard against graph-hardness requests becoming flowcharts.
On Windows, use:
$runtime = if ($env:AAS_RUNTIME_ROOT) { $env:AAS_RUNTIME_ROOT } else { "$env:LOCALAPPDATA\ai-agents-skills\runtime" }
& "$runtime\run_python.ps1" `
"skills/tikz-draw/semantic_regression_runner.py" --platform codex
References
Read these when the task needs tighter guardrails:
- backend-routing.md
- quality-gates.md
- tikz-prevention.md
- tikz-measurement.md
Boundaries
- Use this skill for TikZ-specific work, not for generic image generation.
- Keep the workflow narrow and structural in phase 1.
- Preserve
figure_idandsource_idswhen the request came from deep research. - Direct-use bootstrap may emit an empty
source_idslist; research-driven briefs should keep realS*ids.
Recommended templates
When this skill is involved, consider this workflow template (install via
the workflow-templates artifact profile, or --with-deps to pull backing skills):
tikz-figure-verification-runbook-- Bounded draw-compile-verify-redraw loop for a TikZ figure that guarantees it is free of overlap, wrong meaning, and bad layout, with Sage-assisted graph realization and fresh-agent visual confirmation before the strict approval gate.