michi

Give agents smaller, clearer tool results in Rust or Node.

build
pre-release
GitHub

Why Michi

the problem

A tool can return the right answer and still spend too many tokens saying it.

what it does

Michi turns structured results into compact TOON, with clear hints, errors and cut markers.

Use its Rust crates or Node package. Pipeline and graph helpers are there when a tool needs more than formatting.

From rows to a useful answer

Give an agent the data it needs, with less repetition and a clear next step.

  1. 01 / shape

    Pass typed data

    Give Michi the fields, rows and total count you already have.

  2. 02 / render

    Write less text

    TOON names fields once and quotes values only when the format needs it.

  3. 03 / return

    Keep the context

    Add help, status and cut markers; MCP results can carry structured JSON too.

Same rows, fewer tokens

See the compact result, compare the JSON, then try the Node API.

What the agent reads
issues[2]{number,title,state}:
  51815,"[Bug]: Telegram plugin",open
  51812,dark mode request,open
totalCount: 8771
help[1]: Run `gh-axi issue view <number>` to view an issue
The same rows in JSON
[
  { "number": 51815, "title": "[Bug]: Telegram plugin", "state": "open" },
  { "number": 51812, "title": "dark mode request", "state": "open" }
]
Render it from typed rows in Node
// npm i @orin-dx/michi
import { renderToon } from '@orin-dx/michi'

const output = renderToon({
  typeName: 'issues',
  fields: ['number', 'title', 'state'],
  rows: [
    [
      { type: 'int', intVal: 51815 },
      { type: 'str', strVal: '[Bug]: Telegram plugin' },
      { type: 'str', strVal: 'open' },
    ],
    [
      { type: 'int', intVal: 51812 },
      { type: 'str', strVal: 'dark mode request' },
      { type: 'str', strVal: 'open' },
    ],
  ],
  totalCount: 8771,
  hints: ['Run `gh-axi issue view <number>` to view an issue'],
})

process.stdout.write(output)

Smaller lists. Steady answers.

Measured on flat, uniform lists of 100 rows. These are format results, not a speed benchmark.

47%
Fewer tokens than pretty JSON, median
Nine seeded datasets, 100 rows each; cl100k_base tokenizer.
96.8%
Exact-answer retrieval accuracy with TOON
94 questions × 3 repeats × 4 models; JSON and Markdown results were within noise.

Before you try it

  • Token savings were measured on flat, uniform lists. Sparse or nested data can save much less.
  • Retrieval accuracy was tested on exact-answer questions over up to 100 rows, not multi-step agent tasks.
  • Pipeline resume is at least once per step unless a downstream uses its idempotency key to deduplicate.
  • The Node package has no Windows binary yet.
  • michi-core and michi-pipeline are FSL-1.1-MIT; michi-graph is MIT.

More than a shorter list

Small pieces you can use together or separately.

Readable results

  • Render TOON lists and key-value blocks, plus hints, recovery steps, status and partial success.
  • One cell cannot escape into another line or field. When a cell is cut, a separate truncated block says what was removed.
  • MCP results can carry agent-facing text and structured JSON together.

Clear failures

  • Nine error codes tell a caller what failed and whether retrying makes sense.
  • Known secret values and URL credentials can be redacted before text reaches an agent.
  • Retry math, Retry-After parsing and idempotency keys are available without a runtime requirement.

Execution and graphs

  • michi-pipeline runs bounded steps with cancellation, records outcomes and can resume; downstream deduplication is needed for exactly-once effects.
  • michi-graph validates dependency graphs, finds cycles and orders work deterministically.
  • Callisto already uses michi-graph for release ordering and cycle handling.

What it supports

Packages and platforms

Pick the piece your tool needs.

Published Michi packages
packagewhat it gives you
michi-core (Rust)TOON, responses, structured errors, MCP results and retry primitives.
michi-pipeline (Rust)Async step execution, records, resume and circuit breakers.
michi-graph (Rust, MIT)Dependency validation, cycles, ordering and ready sets.
@orin-dx/michi (Node)Native bindings for macOS arm64/x64 and Linux arm64/x64, glibc or musl.

Built on Michi

What’s next

  • Check TOON output against an independent decoder and real consumer fixtures.
  • Test typed MCP results with clients before changing the wire profile.
  • Expand response shapes only when independent tools need the same contract.