Skip to content

REPL JSON Mode

The -j flag switches ilo output to structured JSON - ideal for agents that need to parse results programmatically.

Shell
ilo repl -j

Every response is a single JSON object on one line:

Success:

JSON
{"ok": 10}

Error:

JSON
{"code": "ILO-T004", "message": "undefined variable 'y'", "severity": "error", "suggestion": "did you mean 'x'?"}

The -j flag also works outside the REPL:

Shell
ilo 'dbl x:n>n;*x 2' -j 5
JSON
{"ok": 10}

Agents can’t reliably parse human-formatted output. With -j:

  • No ambiguity - success is {"ok": value}, errors have structured code/message/suggestion fields
  • Error recovery - the agent reads the suggestion field and retries automatically
  • Stateful sessions - the REPL keeps function definitions across lines, so the agent can build up a program incrementally and test each step

A typical agent loop using repl -j:

Terminal window
1. Agent sends: dbl x:n>n;*x 2
ilo returns: {"ok": "defined dbl"}
2. Agent sends: dbl 5
ilo returns: {"ok": 10}
3. Agent sends: dbl "hello"
ilo returns: {"code": "ILO-T003", "message": "expected n, got t", ...}
4. Agent reads error, adjusts, retries

When using ilo as a Claude Code skill, the skill automatically uses -j for reliable output parsing. The two features are designed to work together.