---
schema_version: "newruntime-agent-readable-v0.2"
type: "post"
stable_id: "post:claude-code-context-cruft-audit"
slug: "claude-code-context-cruft-audit"
title: "Audit Claude Code Context Before You Rewrite the Prompt"
description: "The safest response to Claude Code prompt bloat is an evidence-led context audit: inspect loaded memory, skills, hooks, MCP tools, and setting precedence before deleting safeguards."
retrieval_nugget: "The safest response to Claude Code prompt bloat is an evidence-led context audit: inspect loaded memory, skills, hooks, MCP tools, and setting precedence before deleting safeguards. A provocative practitioner recipe recommends proxying Claude Code traffic, inspecting everything sent to the model, and removing accumulated prompt bloat through settings."
status: "published"
published_at: "2026-07-24"
updated_at: "2026-07-24"
record_date: "2026-07-24"
date_kind: "published_at"
topics: ["claude-code","context-engineering","agent-configuration"]
source_urls: ["https://x.com/mattpocockuk/status/2074464823232888987","https://code.claude.com/docs/en/debug-your-config","https://code.claude.com/docs/en/context-window","https://code.claude.com/docs/en/settings"]
visuals: [{"id":"claude-context-audit-sequence","kind":"editorial-diagram","role":"hero","src":"https://newruntime.com/images/posts/claude-context-audit-sequence.webp","alt":"A six-stage context audit inventories loaded layers, inspects their sources, compares a clean configuration, removes one stale item, replays the task, and measures outcomes.","caption":"Prompt cleanup is an evidence-led configuration audit: inspect what loaded, isolate one cause, preserve safeguards, and replay the same work.","credit":"New Runtime synthesis from Claude Code configuration diagnostics","source_url":"https://code.claude.com/docs/en/debug-your-config","generated_with":"gemini-3.1-flash-image","width":1600,"height":900,"legend":[{"label":"Inventory","description":"Use context diagnostics to attribute system tools, memory, skills, hooks, MCP tools, settings, and messages."},{"label":"Inspect","description":"Trace each loaded layer to its scope and source before deciding that it is stale."},{"label":"Compare","description":"Use safe mode or an empty configuration to isolate whether customization causes the problem."},{"label":"Change one thing","description":"Remove one duplicate or stale source while keeping permissions and enforced safety controls."},{"label":"Replay and measure","description":"Rerun the same task and compare context use, latency, tool accuracy, adherence, and test success."}]}]
routes: {"html":"https://newruntime.com/posts/claude-code-context-cruft-audit/","markdown":"https://newruntime.com/posts/claude-code-context-cruft-audit.md","json":"https://newruntime.com/posts/claude-code-context-cruft-audit.json"}
source_format: "markdown"
---

# Audit Claude Code Context Before You Rewrite the Prompt

## Retrieval answer

The safest response to Claude Code prompt bloat is an evidence-led context audit: inspect loaded memory, skills, hooks, MCP tools, and setting precedence before deleting safeguards. A provocative practitioner recipe recommends proxying Claude Code traffic, inspecting everything sent to the model, and removing accumulated prompt bloat through settings.

A provocative practitioner recipe recommends proxying Claude Code traffic, inspecting everything sent to the model, and removing accumulated prompt bloat through settings.

The underlying problem is real: instructions, memory files, skill descriptions, MCP tools, hooks, and conversation history all compete for context. But "delete the system prompt" is the wrong production rule. Some apparently repetitive content carries tool contracts, permissions, or safety behavior.

## A safer audit sequence

Claude Code's official diagnostics already expose the relevant layers:

1. run `/context` to see what occupies the window;
2. inspect `/memory`, `/skills`, `/hooks`, and `/mcp`;
3. use `/status` and `/doctor` to find precedence errors and invalid settings;
4. compare with `--safe-mode` or an empty configuration directory;
5. remove one source of cruft at a time and rerun the same task.

The outcome should be measured by completed work, not the smallest prompt. Track latency, context use, tool accuracy, adherence, and test success.

Intercepting raw model traffic can expose source code, prompts, credentials, or customer data. A local proxy may be useful for a controlled experiment, but it needs the same data-handling review as any observability system.

## New Runtime Read

The lesson for our agents is to make context inventory visible and attributable. Every durable instruction should have a scope, owner, and reason. Repeated operational behavior belongs in a skill or deterministic check; project conventions belong in repository guidance; hard restrictions belong in permissions or hooks.

Prompt cleanup is configuration hygiene, not prompt minimalism. Remove stale duplication while preserving the controls that make the agent reliable.
