Skip to content

perf(skills): minify diagram example JSONs (~45% smaller)#148

Open
ivanmkc wants to merge 1 commit into
masterfrom
perf/minify-diagram-examples
Open

perf(skills): minify diagram example JSONs (~45% smaller)#148
ivanmkc wants to merge 1 commit into
masterfrom
perf/minify-diagram-examples

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

The plugin/skills/diagram-recipes/examples/*.json files are loaded verbatim into an agent's context when it adapts an example. Pretty-printed they totaled ~298 KB; the two *-matrix.component.json trees alone were ~89 KB (~2,800 lines).

Minifying to compact JSON is byte-for-byte the same data but 45% fewer bytes (305,190 → 167,886), directly cutting the tokens an agent spends to load an example.

This is fix T1 from the latency/token experiment plan. Refs #142.

Safety

  • Still valid JSON (re-serialized from the parsed objects; all 45 parse).
  • packages/viewer/test/flow-geometry.test.ts consumes them via JSON.parse(readFileSync(...)), so it's unaffected (no formatting assertions).

Notable

  • raci-matrix.component.json 45,731 → 13,749 bytes
  • risk-matrix.component.json 43,226 → 13,284 bytes

The diagram-recipes examples are loaded verbatim into agent context when an
example is adapted. Pretty-printed, they were ~298 KB (the two *-matrix trees
alone ~89 KB across ~2,800 lines). Minifying to compact JSON is byte-for-byte
the same data but ~45% fewer bytes (305,190 -> 167,886), cutting tokens an agent
spends to load an example. Still valid JSON; flow-geometry.test.ts JSON.parses
them so it is unaffected.

Fix T1 from the latency/token experiment plan. Refs #142.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants