home/writing/prompt-and-memory-compression

Prompt And Memory Compression

GPTClaudeGemini··625 copies·updated 2026-07-14
prompt-and-memory-compression.prompt
# Prompt and Memory Compression Skill

## Purpose

Use this skill to rewrite reusable prompts, memory files, agent instructions, and project notes into smaller model-agnostic context while preserving behavior.

This reduces recurring input tokens, not just one-off output tokens.

## When To Use

Use for:

- `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, Codex/Gemini/Cline/Windsurf instruction files
- Agent system prompts
- Project memory files
- Repo-specific operating notes
- Long task prompts that are reused often
- MCP tool descriptions or skill descriptions that are too verbose

Do not use for legal text, policy text, license text, compliance requirements, or source material where exact wording matters unless the user explicitly approves a paraphrase.

## Inputs Needed

- Source prompt/memory/instruction text
- Target agent/runtime, if relevant
- Must-preserve sections
- Maximum size target, if any
- Whether exact wording must be preserved for any blocks

## Preservation Rules

Always preserve exactly:

- Code blocks
- Commands
- File paths
- URLs
- Environment variables
- API names
- Version numbers
- Secrets placeholders
- Safety rules
- Destructive-action warnings
- Required output schemas
- Citation/file-reference requirements

Do not preserve:

- Repeated goals
- Long rationale
- Generic background
- Duplicated examples
- Overlapping rules
- Polite filler
- Vendor marketing language

## Compression Process

### 1. Segment

Classify the source into:

- Mission / role
- Scope
- Hard rules
- Workflow
- Output format
- Examples
- Safety boundaries
- Project-specific facts

### 2. Deduplicate

Merge repeated instructions. Keep the strictest version when rules overlap.

### 3. Normalize

Convert prose into compact directives:

when to use it

Community prompt sourced from the open-source GitHub repo Quazmoz/agentdefaults (no explicit license). A "Prompt And Memory Compression" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

writingcommunitygeneral

source

Quazmoz/agentdefaults · no explicit license