Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/davide-desio-eleva/kirograph/llms.txt

Use this file to discover all available pages before exploring further.

Every token consumed by an AI agent has a cost — in latency, in API spend, and in the shrinking space available for code and reasoning. KiroGraph ships four complementary token reduction systems: shell output compression, prose compression (Caveman mode), on-demand text compression, and file read caching. Each operates independently and can be enabled or tuned without affecting the others.

Shell Compression — kirograph_exec

kirograph_exec runs a shell command and passes its output through a token-optimized filter before returning it to the agent. The filter is selected by command family — git, test runners, linters, build tools, Docker, package managers, AWS, GitHub CLI — and strips noise lines, deduplicates repeated entries, and groups results.
{
  "enableShellExec": true,
  "shellCompressionLevel": "normal"
}

Example

{
  "tool": "kirograph_exec",
  "command": "git log --oneline -20",
  "level": "aggressive"
}
The raw output of a git log can easily run 400–800 tokens. After filtering: typically 60–120 tokens.

Command Families

FamilyExamples
gitgit log, git diff, git status, git blame
testjest, vitest, pytest, go test, cargo test
linteslint, tsc, pylint, rubocop
filesls, find, tree
dockerdocker build, docker logs, docker ps
packagenpm install, pip install, cargo build
awsaws CLI output
githubgh CLI output
miscgrep, diff, curl, prisma, Playwright
genericEverything else — deduplication and noise removal

Compression Levels

LevelEffect
normalRemoves noise lines, deduplicates, groups summaries
aggressiveAdditional truncation of repeated patterns and verbose stack frames
ultraMaximum compression — retains only the signal lines

kirograph_exec Parameters

ParameterTypeDefaultDescription
commandstringrequiredShell command to execute
cwdstringproject rootWorking directory
levelstringnormalCompression level: normal, aggressive, ultra
timeoutnumber60Timeout in seconds
projectPathstringcwdProject root path

Token Analytics

kirograph_gain reports cumulative savings from both shell compression (measured exactly) and graph tools (estimated heuristically). It is part of the enableAgentUtils feature set and requires enableAgentUtils: true.
ParameterTypeDefaultDescription
periodstringsessionTime period: session, today, week, all
projectPathstringcwdProject root path

Caveman Mode — Prose Compression

Caveman mode compresses agent prose output — explanations, summaries, reasoning — by stripping filler words, articles, hedging phrases, and verbose constructs. It does not touch code blocks, file paths, URLs, or identifiers.
{
  "cavemanMode": "full"
}

Modes

ModeEffect
offNo prose compression (default)
liteRemoves obvious filler words and softening phrases
fullRemoves articles, hedges, and verbose constructions
ultraAggressively abbreviates common phrases in addition to full
Caveman mode is applied via multi-level steering injection — no tool call overhead. The agent’s explanations arrive compressed without any change to tool usage patterns.

General-Purpose Compression — kirograph_compress

kirograph_compress is an on-demand compression tool for arbitrary text that arrives outside of kirograph_exec. Enable it with enableGeneralCompression: true.
{
  "enableGeneralCompression": true
}
The tool routes to one of two compression engines depending on whether command is provided:

rtk-style filters (with command)

Pattern-matched per command family — same filters as kirograph_exec. Use when the text is the output of a known shell command that was run outside of kirograph_exec.

Caveman grammar (without command)

Prose compression for observations, summaries, and freeform text. Preserves code blocks, paths, URLs, and identifiers.

kirograph_compress Parameters

ParameterTypeDefaultDescription
textstringrequiredText to compress
commandstringShell command that produced the output. Activates rtk-style filters. Omit for prose.
levelstringfullIntensity: lite / normal (light), full / aggressive (medium), ultra (maximum)
The response includes inline savings: [42% tokens saved | 1800→1044 | rtk:git:aggressive]. When to use:
  • Text arrived from a tool that runs commands directly (not via kirograph_exec)
  • Compressing an observation before storing it to memory
  • Comparing compressed vs original before a large follow-up tool call
When not to use:
  • Commands run via kirograph_exec — already compressed automatically
  • Agent prose — use cavemanMode in config instead (zero tool-call overhead)
  • Source code — may break identifiers or whitespace-sensitive syntax

File Read Caching — kirograph_read and kirograph_retrieve

kirograph_read is a caching file reader that returns a compact [cached: file unchanged] marker (~13 tokens) on subsequent reads of files whose content has not changed. Enable it with enableAgentUtils: true.
{
  "enableAgentUtils": true
}

kirograph_read Parameters

ParameterTypeDefaultDescription
pathstringrequiredFile path (absolute or relative to project root)
modestringfullRead mode — see table below
startnumberStart line (for lines mode)
endnumberEnd line (for lines mode)
noCachebooleanfalseForce a fresh read, bypass cache
projectPathstringcwdProject root path

Read Modes

ModeReturns
fullComplete file content
mapStructure overview — classes, functions, exports with line numbers
signaturesFunction and method signatures only (no bodies)
diffChanges since the last kirograph_read of this file
linesA specific line range (startend)
importsImport statements only
exportsExport declarations only
Use signatures or map for large files when the agent only needs to understand the structure, not read every line.

Cached Content Retrieval — kirograph_retrieve

kirograph_retrieve (CCR) recovers the full content stored in the session cache without performing a filesystem read. Use it after kirograph_read returns a [cached: file unchanged] marker to get the actual content back without redundant I/O.
ParameterTypeDefaultDescription
pathstringrequiredFile path to retrieve
projectPathstringcwdProject root path
Prefix-stable cache markers enable KV cache hits on conversation context — the model sees the same token sequence for unchanged files, improving KV cache utilization on repeated calls.

kirograph_budget — Session Context Budget

kirograph_budget shows per-session token consumption, remaining budget, and utilization percentage. Useful for agents managing context window pressure during long sessions.
ParameterTypeDefaultDescription
resetbooleanfalseReset session budget counters
projectPathstringcwdProject root path

MCP Tool Token Budget Table

Each enabled flag adds tool descriptions to the model context on every MCP call. Total with all flags enabled: 126 tools · ~6,240 tokens.
Enable only the modules your project needs. A typical setup (enableMemory, enableDocs, enableAgentUtils, enableShellExec) costs about ~1,300 tokens — well under the point where tool descriptions start competing with your context budget.
FlagTools~Tokens
core (always-on)3~170
enableNavigation3~120
enableMemory16~746
enableSecurity15~675
enableData10~519
enableWiki10~319
enableCodeHealth25~935
enableDocs5~241
enableAgentUtils4~278
enableArchitecture5~205
enableWatchmen3~140
enablePatterns3~93
trackCallSites2~84
enableGitContext7~410
enableComplexity5~660
enableEditPrimitives5~280
enableBranch3~300
enableShellExec1~71
enableGeneralCompression1~68
Total126~6,240

Config Reference

FieldTypeDefaultDescription
shellCompressionLevelstringoffShell compression level: off, normal, aggressive, ultra
cavemanModestringoffProse compression mode: off, lite, full, ultra
enableShellExecbooleanfalseEnable the kirograph_exec shell tool
enableGeneralCompressionbooleanfalseEnable the kirograph_compress on-demand compression tool
enableAgentUtilsbooleanfalseEnable kirograph_read, kirograph_retrieve, kirograph_gain, and kirograph_budget

Build docs developers (and LLMs) love