Roka Roka Docs

Concepts

How pruning works

The pipeline is deterministic on purpose. Agents cannot debug what they cannot inspect. The MCP implementation lives in roka-mcp/lib/prune.js and is reused by tools and watch.

1. Collapse

The file is split on newlines. Adjacent identical lines merge. A line seen 128 times in a row becomes one line plus (x128 repeated). Heartbeats, NTP sync, and retry storms stop filling the budget.

2. Force-keep

If the collapsed text still fits the budget, that is the output. If not, lines matching the crash regex are collected first:

ERROR | FATAL | CRITICAL | Exception | Traceback | panic

Those lines are never dropped to make room for chatter.

3. Fit

Remaining budget is filled from the end of the file (newest non-error lines), then everything is re-sorted back into original order. If the result is still over budget, it is sliced from the end to the exact character cap.

MCP default budget: 4000 characters. CLI default on the website examples is often 8000 tokens — check roka --help for the binary you installed. The research write-up used a 4,000-character budget on LogHub.

What stays local

Pruning itself (prune_logs / prune_file / prune_tail / watch --on-crash) runs in-process. Log text does not leave the machine for those tools. MCP still makes a one-time Pro verification request to api.roka-prune.com with the API key only.

The hosted pruning engine (Rust) and backend are proprietary. This public docs site plus the roka-mcp npm package are what you configure as an agent.