# Context Diet

> Measure Claude Code prompt overhead and disable unused tools or features while preserving required workflows. Use for context-size analysis or settings-based reduction.

- Skill: `cskwork/context-diet` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add cskwork/context-diet`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cskwork/context-diet/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: cskwork (https://skillmd.com/u/cskwork)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cskwork/context-diet

---


# context-diet

Measure the tool definitions, skill catalogue, and feature instructions included in the current Claude Code configuration, then trim unused capabilities. Payload size is not billing: report cached input, uncached input, and output separately when available, and do not infer cost savings from raw token reductions.

Method adapted from aihero.dev, "How to kill the bloat in Claude Code's system prompt." Bare-name versus scoped deny behavior is documented in the [official Agent SDK permissions guide](https://code.claude.com/docs/en/agent-sdk/permissions).

## The idea in one line

A **bare tool name** in `permissions.deny` (e.g. `"NotebookEdit"`) removes the tool's
*definition* from the payload. A **scoped rule** (e.g. `"Skill(dataviz)"`) only blocks
the call but keeps the definition. To shrink tokens, deny bare names and flip `disable*` flags.

## Measure — record the baseline first

1. `/context` in a session prints the system / tools / MCP / memory / message token
   split. Write those numbers down; they are the only "before" you get. It reports one
   combined "tools" number, not a per-tool ranking.
2. For a per-tool ranking, run the logging proxy:
   ```bash
   node proxy.mjs                                   # repo root; :8787 → api.anthropic.com
   ANTHROPIC_BASE_URL=http://localhost:8787 claude  # in another terminal
   ```
   Each request is logged to `./logs/*.md` and a ranked tool-size table prints live.
   If port 8787 is already taken (e.g. an existing token proxy), use `PORT=9000 node proxy.mjs`
   and point `ANTHROPIC_BASE_URL` at the same port.

## Apply the diet

Paths below are relative to the skill directory `skills/context-diet`, so run there —
except `--project`, which writes `.claude/settings.json` into the *current* directory:
run that one from your project root and give the script's full path.

```bash
node scripts/apply-config.mjs            # merge into ~/.claude/settings.json (global)
node scripts/apply-config.mjs --project  # into ./.claude/settings.json (this project)
node scripts/apply-config.mjs --dry-run  # preview, write nothing
```

Inspect the current settings and preview with `--dry-run` first. Choose only capabilities the user does not need and preserve unrelated configuration. The script backs up the target, appends deduplicated deny rules, and sets disable flags; use `--template templates/settings.conservative.json` for the smaller subset. A template is a menu, not permission to disable everything it contains.

Done when Claude Code has been restarted, `/context` shows the measured before/after difference, and representative retained workflows still work. A lower count alone does not prove a successful configuration change.

## What the config does

- `permissions.deny: [bare tool names]` — drops those tool definitions from every request.
- `disableBundledSkills` — drops all Anthropic-bundled skills at once. Your own
  `~/.claude/skills` and plugin skills stay; bundled slash commands stay typable.
- `disableWorkflows` — drops the multi-agent `Workflow` tool (typically the single
  largest line in the table).
- `disableRemoteControl`, `disableClaudeAiConnectors`, `disableArtifact` — drop those
  feature surfaces and their instructions.
- Trim skills selectively instead of all-or-nothing: `skillOverrides` → `"off"` or
  `"user-invocable-only"` per skill.

## Menu, not prescription

Keep anything you use. Denying `EnterPlanMode`/`ExitPlanMode` removes plan mode;
`AskUserQuestion` removes clarifying questions; `NotebookEdit` breaks notebook edits;
`SendMessage`/`ScheduleWakeup` are used by multi-agent and `/loop` runs. Read
`REFERENCE.md` at the repo root before denying anything on that list — it carries the
full 6-step method and the per-item cost table.

## Templates

- `templates/settings.aggressive.json` — the full menu, biggest savings.
- `templates/settings.conservative.json` — keeps plan mode + AskUserQuestion + bundled skills.

