Compress prompt

From griddynamics/rosetta · View interactive version

Compress prompt is an AI agent skill from the GitHub repository griddynamics/rosetta. Compress a Rosetta KB prompt artifact (skill · workflow · phase · rule · agent · template · generic) by stripping structural tautology and ineffective scaffolding while preserving every importance-bearing token. Use when the user asks to compress, shorten, tighten, densify, or reduce a prompt / skil

How to use this skill

Skill file

Compress a KB Prompt

Mental model

Allowed reads — read-only, NEVER adjust

Read ONLY: the target artifact + its type schema + the grammar below. Nothing else. Stay focused.

Schemas (learn which XML scopes are MANDATORY vs optional, and each scope's role):

Grammar — directive commands the system ACTS ON; protect verbatim + their args:

| Command | Semantics |

|---|---|

| USE SKILL <name> / READ SKILL <name> | activate skill (load SKILL.md + act) / load content only |

| READ SKILL FILE <subpath> / APPLY SKILL FILE <subpath> | load / load+execute a file of the CURRENT skill; never names a skill (isolation is grammar-enforced) |

| USE FLOW <name>.md / READ FLOW <name>.md | invoke a whole workflow / load without executing |

| APPLY PHASE <file>.md | load + fully execute the next phase body of a running workflow |

| INVOKE SUBAGENT <name> / READ SUBAGENT <name> | spawn subagent / load its definition only |

| READ RULE <file>.md / APPLY RULE <file>.md | load / load+execute a rule |

| READ TEMPLATE <file>.md | load a template |

| READ CONFIGURE <tool>.md | load an IDE/agent configure spec |

| LIST <path> | enumerate immediate children of a KB folder |

| ACQUIRE <path> FROM KB | MCP-only, generated shells: query_instructions(tags="<path>") |

KEEP verbatim (never shrink / drop)

CUT — where real reduction lives

COMPRESS

e.g. "ONE PHASE AT A TIME: read file, execute, update state, advance" → "ONE PHASE AT A TIME. READ JIT."

NEVER

TRANSFORM — ordered passes, LOOP until iteration cannot compress any more

INVARIANTS (always-on, declared once): ## KEEP verbatim + ## NEVER. Run passes IN ORDER; skip none.

  1. CUT — FIRST whole-scope load-bearing audit, THEN line/rule cuts → ## CUT.
  2. GROUP + REPHRASE — cluster same-topic rules → merge → rephrase clearly → output as SEPARATE lines. NEVER defer duplication to a later pass.
  3. COMPRESS — densify → ## COMPRESS.
  4. HARD CAP — every rule/bullet line < 10 words; NO line-splitting to cheat; NEVER drop signal for the cap; whole file MAY add ≤ 10 lines.

↺ Repeat from pass 1 until a full loop changes nothing — each pass exposes new cuts/merges.

Process (HITL)

  1. Read target + its type schema + the grammar above. Nothing else.
  2. Inventory: per-scope purpose + LOAD-BEARING verdict (keep/shrink/cut) + duplications, stale items, repeated literals.
  3. Compress to just key points and terse phrases, keep only thinking points (not even decisions), heavily compress direction text (to 1-3 words per step, not amount of steps). Allow running AI to make decisions. Draft the compressed artifact as file next to current one, running ## Transform to fixpoint. Do not overwrite yet.
  4. HITL: present to the user → word Δ (before→after, %) + where the cuts came from + your reasoned take on the subagent findings.
  5. VERIFY via subagent — INVOKE SUBAGENT (Sonnet-5.5 low reasoning or GPT 6 Luna medium class) with a fresh read of OLD vs NEW, asking only:
  1. Do NOT auto-apply the subagent's output. CRITICALLY evaluate its findings — decide which are real vs noise, and why; adjust the draft only where a finding is genuine.
  2. HITL: present to the user → proposed artifact + word Δ (before→after, %) + where the cuts came from + your reasoned take on the subagent findings.
  3. On explicit user approval → write the TARGET file only.

If you learned something new which is reusable, there are process efficiency improvements, you can prevent failures in the future, update ## Lessons learned below for self-improvement.

Lessons learned (self-improvement, keep updating, first line is template, keep template, follow "<instructions>", high confidence only):

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.