wire it to your agent
If you're a human who wants Claude, Codex, ChatGPT, or Copilot to write cr8script reliably: this page is the reference manual — for your assistant, not for you. The fastest way to put it to work is to paste the line below into your model and let it pull everything else from this page itself.
Read https://cr8script.com/agents.html in full and use it as your reference whenever you write, run, or repair cr8script. For any non-trivial task, also read https://github.com/LofiFren/cr8script/blob/main/LLM_MAP.md and build a typed plan graph before generating code. Loop strictly: plan -> write .cr8 -> run --check-json -> fix every issue -> run.
Everything below is what your assistant will read — the
loop spelled out, the system-prompt block, the tool schemas, and
pointers to canonical examples. cr8script is built so the static
checker's structured { line, message, hint } output
lets one round trip through a tool-use loop typically converge to
a working program. This page is the operational counterpart to
AGENTS.md;
keep reading if you want to know what your assistant just
promised to do.
step zero: the plan map
For any non-trivial task — a multi-stage pipeline, a code
generator, anything where the model would benefit from
externalizing the plan before writing — start with an
LLM map. It's a small typed JSON artifact with nodes
for goals, inputs, transforms, decisions, risks, outputs, and
checks. The map is the planning artifact; the
.cr8 is the execution artifact. Cuts
blank-page cost and gives downstream repair a structure to
trace failures back to. Schema, validator, and a worked
prototype:
LLM_MAP.md ↗ ·
examples/llm_map/ ↗ ·
tools/check_map.py ↗
(the map's own --check-json analogue).
install
pip install cr8script
That gives you a cr8script command on your PATH. From a
clone, the equivalent is python3 cr8script.py —
the two are interchangeable in every example below. The PyPI page is
pypi.org/project/cr8script ↗.
the loop
- (non-trivial tasks only) build the plan map — see step zero above
- generate a
.cr8script - run
cr8script --check-json $FILE - parse stdout as JSON
- if the list is empty, continue to step 5
- otherwise, for each
{line, message, hint}, edit the file atlineusinghint, then go to step 3
- run
cr8script $FILE— if exit 0, done; if exit 1, parse the line/message/hint from stderr, edit, go to step 3
system prompt
You are writing cr8script, not Python. cr8script is an English-shaped
scripting language with honest types (no truthy/falsy, no silent
coercion), decimal numbers (`0.1 + 0.2` is exactly `0.3`),
1-based lists, and `end`-terminated blocks. Function syntax is
`to name(args) ... end`, not `def name(args):`.
Before claiming a script works, run
`cr8script --check-json file.cr8` and fix every issue in
the JSON output. Each issue has `{line, message, hint}` -- apply the
hint, re-check, repeat until the list is empty. Then run the script.
For non-trivial tasks (multi-stage pipelines, code generators,
anything that would otherwise be blank-page generation), build a
typed plan map per `LLM_MAP.md` before writing code -- nodes
for goals, inputs, transforms, decisions, risks, outputs, and checks.
The map is the planning artifact; the `.cr8` is the execution
artifact. Skip this step for one-shot lookups and small transforms.
Hard rules -- these are errors, not warnings:
- Use `is`, `is not`, `is greater than`, `is less than`, `is at
least`, `is at most`. Never `==`, `!=`, `>=`, `<=`.
- Lists are 1-based. `xs[0]` is an error. Use `xs.first` / `xs.last`
or `xs[1]`.
- `if` requires a real boolean. `if 0 then`, `if "" then`,
`if [] then` are all errors.
- Records are values. `r.field` requires the field to exist. Use
`r.get("key")` for safe lookup (returns `nothing` on miss).
- Only `nothing` for absence -- no `null`, `None`, `undefined`.
- `let` is immutable. Reassignment requires `var`.
- Pipelines (`|`) only operate on lists. Verbs are `where`, `sort
by`, `take`, `map`, `group by`, `summarize`. Inside `where` /
`sort by` / `map`, bare names auto-resolve to fields of each item.
- `show` is a statement, no parens: `show "hi"`.
The full reference is in `LLMS.md`. The plan-graph format and its
validator (`tools/check_map.py`) are in `LLM_MAP.md`. The end-to-end
self-correction loop demo is in `examples/agent_loop/`.
tool definitions
| name | purpose | shell |
|---|---|---|
| cr8_check | Static-check a cr8script file. Returns a JSON list of issues. Empty list means clean. Always run this before cr8_run. |
cr8script --check-json "$path" |
| cr8_run | Run the script. Returns stdout on success or a single-line error with line/message/hint on stderr (exit 1). | cr8script "$path" |
cr8_check — full schema
{
"name": "cr8_check",
"description": "Static-check a cr8script file. Returns a JSON list of issues. Empty list = clean.",
"input_schema": {
"type": "object",
"properties": {
"path": { "type": "string" }
},
"required": ["path"]
}
}
cr8_run — full schema
{
"name": "cr8_run",
"description": "Run a cr8script file. Returns stdout on success or a single-line error with line/message/hint.",
"input_schema": {
"type": "object",
"properties": {
"path": { "type": "string" }
},
"required": ["path"]
}
}
canonical examples by task shape
tour.cr8
The whole language in 92 lines. Hand to a small model when you need it to absorb the surface in one window. view ↗
llm_map/
The typed planning graph (LLM_MAP.md) plus a worked prototype map for the balloon game. Validator at tools/check_map.py mirrors --check-json. view ↗
agent_loop/
broken.cr8 + the actual diagnostics.json + fixed.cr8. The end-to-end demo of the loop. view ↗
api_ingest.cr8
http.get + group by + summarize + csv.write. The "real data flow" idiom. view ↗
validate.cr8
list of records —> { ok, errors }. The agent-loop primitive for checking upstream output. view ↗
report_md.cr8
structured input —> markdown output via f-strings. No templating library. view ↗
diagrams in markdown
Sprint tickets —> Gantt; pipeline stages —> funnel; channel spend —> pie. Markdown-native, no plotting library. cookbook ↗
what cr8script is not for
Don't push your agent toward cr8script for: file I/O (out of
scope — pipe via http.get or hard-code; pipe out
via stdout to a redirected file); long-running services (no
async, no concurrency); heavy compute (tree-walking
evaluator, slow at >105 records); large dependency
surfaces (no imports — the built-in modules are
math, http, time,
json, csv, and that's it). For those,
your agent should produce Python or a real shell pipeline.
cr8script's win is per-script reliability — the loop
above terminates fast when the task fits.