toon-decode

A command that converts a TOON v2.0 file into a JSON file using a Zig-based decoder. TOON is a structured text format for representing data.

In plain words
What is it for?
Use it to decode a .toon file, optionally validate it in strict mode, and choose whether folded paths are expanded into nested JSON fields.
Why use it?
It avoids converting the file by hand and can check the input more strictly when needed.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ukkit/memcord/toon-decode
Clone the repo
git clone --depth 1 https://github.com/ukkit/memcord

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,354 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01354
Opus 5 $0.00000 $0.00677
Sonnet 5 $0.00000 $0.00271
Haiku 4.5 $0.00000 $0.00135

Measured yesterday against content hash 53cc21f403a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

toon-decode scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/toon-decode.md · 240 lines

How it starts

The opening of the file, as written. The whole thing — 240 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TOON Decode

Convert TOON v2.0 format back to JSON using the Zig decoder.

Usage: /toon-decode <file> [options]

Options:

  • --strict - Enable strict mode validation during decoding
  • --no-expand-paths - Don't expand folded paths (keep dot notation)

Execute the following workflow:

1. Validate Input

FILE="$1"

if [[ -z "$FILE" ]]; then
  echo "Usage: /toon-decode <file> [options]"
  echo "Example: /toon-decode data.toon"
  echo "Example: /toon-decode data.toon --strict"
  exit 1
fi

if [[ ! -f "$FILE" ]]; then
  echo "❌ Error: File not found: $FILE"
  exit 1
fi

if [[ ! "$FILE" =~ \.toon$ ]]; then
  echo "⚠️  Warning: File doesn't have .toon extension"
  read -p "Continue? (y/n) " -n 1 -r
  echo
  if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    exit 0
  fi
fi

echo "✓ Input: $FILE"

2. Parse Options

STRICT_FLAG=""
EXPAND_PATHS_FLAG=""
OUTPUT="${FILE%.toon}.json"

shift  # Remove first arg (filename)
while [[ $# -gt 0 ]]; do
  case "$1" in
    --strict)
      STRICT_FLAG="--strict"
      shift
      ;;
    --no-expand-paths)
      EXPAND_PATHS_FLAG="--no-expand-paths"
      shift
      ;;
    *)
      shift
      ;;
  esac
done

echo "⚙️  Configuration:"
echo "  Strict mode: ${STRICT_FLAG:-disabled}"
echo "  Path expansion: ${EXPAND_PATHS_FLAG:-enabled (default)}"
echo "  Output: $OUTPUT"

3. Check Zig Binary

TOON_BIN=".claude/utils/toon/zig-out/bin/toon"

if [[ ! -f "$TOON_BIN" ]]; then
  echo "❌ Zig binary not found. Building..."
  echo ""
  cd .claude/utils/toon
  /opt/homebrew/opt/[email protected]/bin/zig build -Doptimize=ReleaseFast
  cd -
  echo ""
  echo "✓ Build complete"
fi

4. Decode

echo ""
echo "Decoding..."

$TOON_BIN decode "$FILE" \
  $STRICT_FLAG \
  $EXPAND_PATHS_FLAG \
  > "$OUTPUT"

if [[ $? -eq 0 ]]; then
  echo "✓ Decoding successful"
else
  echo "❌ Decoding failed"
  exit 1
fi

5. Validate JSON

# Verify JSON is valid
if command -v python3 &> /dev/null; then
  python3 -m json.tool "$OUTPUT" > /dev/null 2>&1
  if [[ $? -eq 0 ]]; then
    echo "✓ JSON validation passed"
  else
    echo "⚠️  Warning: Output may not be valid JSON"
  fi
fi

Read the full file on GitHub · 240 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 240 lines · 0 tokens per session scan A 53cc21f403a8

Subscribe to this mod's changes

toon-decode is a command published in the GitHub repository ukkit/memcord (72 stars, last pushed 24d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,354 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.