Skip to content

Instantly share code, notes, and snippets.

@oazabir
Last active November 13, 2025 12:47
Show Gist options
  • Select an option

  • Save oazabir/7c0d84bf794fe49430c27b5b0d472215 to your computer and use it in GitHub Desktop.

Select an option

Save oazabir/7c0d84bf794fe49430c27b5b0d472215 to your computer and use it in GitHub Desktop.
/compact-context
description
Compact AGENTS.md or CLAUDE.md to reduce token usage while preserving essential context

Task: Compact AGENTS.md or CLAUDE.md

Read AGENTS.md or CLAUDE.md, then create a highly condensed version of the file that:

Must Keep (Essential Context):

  • ✅ Current phase status table (compact format)
  • ✅ Tech stack with versions (table format)
  • ✅ Critical configuration requirements (.npmrc, tsconfig, etc.)
  • ✅ Complete project structure tree
  • ✅ Key features by phase WITH file locations (e.g., components/Omnibox.tsx)
  • ✅ All Make commands (critical for workflow)
  • ✅ TypeScript data models (condensed format)
  • ✅ Common Pitfalls section (prevents broken code generation)
  • ✅ Troubleshooting commands (iOS, Android, general)
  • ✅ Known architectural patterns with file references
  • ✅ File operation rules (Read vs cat, Edit vs sed)
  • ✅ Development best practices
  • ✅ Git workflow

Must Remove (Verbose/Redundant):

  • ❌ Step-by-step implementation histories
  • ❌ Verbose component descriptions (keep file paths only)
  • ❌ "Latest Updates" narrative sections
  • ❌ Redundant feature explanations
  • ❌ Long-form test descriptions
  • ❌ Duplicate information across phases
  • ❌ Excessive implementation details that can be inferred from code
  • ❌ Historical context not relevant to current development

Format Requirements:

  1. Use dense, reference-style prose
  2. Use tables where appropriate for readability
  3. Keep code examples minimal but functional
  4. Use bullet points with file paths: Feature: file/path.tsx - Brief description
  5. Preserve exact locations (line numbers when critical)
  6. Aim for 50-60% size reduction from original

Success Criteria:

The compacted file must enable LLMs to:

  • Generate accurate code following project architecture
  • Prevent common failures (Node.js APIs, cache issues, iOS ATS)
  • Use correct tools and commands
  • Understand file locations and implemented features
  • Follow TypeScript strict mode patterns

After creating the compact version, show a summary of:

  • Original line count vs new line count
  • Percentage reduction
  • Key sections preserved
  • Key sections removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment