MiMo-Code icon indicating copy to clipboard operation
MiMo-Code copied to clipboard

Permission logs serialize full ruleset JSON on every check, causing multi-GB log files

Open HHHZZZ-H opened this issue 5 months ago • 2 comments

Description

Each permission check writes a log entry containing the complete permission ruleset serialized via JSON.stringify(). A single ruleset blob is ~37KB. With hundreds of permission checks per session (every tool call, skill invocation, and task dispatch triggers one), a single session log can exceed 12GB.

Log output example

INFO 2026-06-12T04:14:52 +2ms service=permission permission=task pattern=explore ruleset=[{...37KB JSON...}] INFO 2026-06-12T04:14:52 +3ms service=permission permission=task pattern=general ruleset=[{...same 37KB JSON...}] INFO 2026-06-12T04:14:52 +2ms service=permission permission=skill pattern=adapt ruleset=[{...same 37KB JSON...}]

Actual impact

  • 2026-06-11T131945.log — 12.06 GB (385,866 lines)
  • 2026-06-12T041348.log — 4.79 GB (144,275 lines)
  • 122,053 out of 144,275 lines (85%) are service=permission entries
  • Two days of usage consumed 16.85 GB of disk space

Root cause

  1. The permission module passes the full ruleset array as a log parameter on every check. The logger's build() function calls JSON.stringify(value) on objects, serializing the entire ruleset each Root cause

  2. The permission module passes the full ruleset array as a log parameter on every check. The logger's build() function calls JSON.stringify(value) on objects, serializing the entire ruleset each time.

  3. log.ts has no per-file size limit — createWriteStream appends indefinitely. The cleanup() function only caps the number of files (keep=10), not individual file size.

Suggested fix

  1. Permission module: Stop logging the full ruleset in every entry. Log only the decision metadata: permission, pattern, action, and result. The ruleset content is static per session and doesn't need repeating.

  2. Log system: Add a per-file size cap (e.g., 50MB) with rotation. When the current log exceeds the limit, rotate to a new file and prune old ones.

Plugins

No response

OpenCode version

No response

Steps to reproduce

  1. Start a new session with MiMo-Code
  2. Perform any workflow that triggers multiple tool calls / skill invocations / task dispatches
  3. Check the log directory (e.g., ~/.mimo/logs/ or equivalent)
  4. Observe log files growing rapidly, with 85%+ lines being service=permission entries containing full ruleset JSON

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal

HHHZZZ-H avatar Jun 12 '26 09:06 HHHZZZ-H

Serializing full ruleset JSON on every permission check is the exact pattern AgentAutopsy's Context Monitor flags — one repeated operation bloating storage/context unboundedly.

Fix: serialize only the diff or changed rules, not the full ruleset. Or cache the serialized form and invalidate on change.

Traced with AgentAutopsy: https://github.com/Abhisekhpatel/AgentAutopsy

Abhisekhpatel avatar Jun 13 '26 00:06 Abhisekhpatel

solve

MiMoHardFather avatar Jun 18 '26 13:06 MiMoHardFather