mohan-n-swamy

Claude Clean Context — Security skill for Claude Code

Security community

Keep Claude Code's always-loaded context lean: deterministic memory guard-rail distiller + skills audit.

How to install Claude Clean Context

This entry records only its repository, not the path inside it, so there is no exact command to give. Open mohan-n-swamy/claude-clean-context and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Clean Context does

Keep Claude Code's always-loaded context lean: deterministic memory guard-rail distiller + skills audit. Never deletes; dry-run default.

Alternatives in Security

  • Octoboss Clean Contexts — You are the Octoboss — a cross-tentacle orchestrator 1.4k ★
  • Imcodes — The IM for agents 960 ★
  • Data Viz Audit — Audit a data visualization for chart type selection, accessible color palette, annotations, and anti-patterns 309 ★

README

claude-clean-context

[![ci](https://github.com/mohan-n-swamy/claude-clean-context/actions/workflows/ci.yml/badge.svg)](https://github.com/mohan-n-swamy/claude-clean-context/actions/workflows/ci.yml)

![A pile of stale sticky notes is swept aside, leaving three tidy shelves: a top shelf of a few sturdy guard rails, a middle shelf of on-demand folders with one being pulled out, and a bottom shelf with an open book — standing context kept to rails, with status and narrative pushed to on-demand layers](assets/concept.png)

Keep Claude Code's always-loaded context lean by demoting stale memory pointers and auditing skill descriptions.

This repo gives Claude Code users a small, deterministic toolkit for cleaning the context that loads before every prompt. It focuses on the two movable layers that tend to grow over time: auto-memory indexes and skill descriptions.

![memory-distill.py dry-run: 15 pointers in, 6 out — session snapshots, closed work, and non-allowlisted status demoted, each with a reason](assets/demo.svg)

*A real `memory-distill.py` dry-run on the bundled example: 15 pointers in, 6 out. Dry-run by default — it shows exactly why each pointer would be demoted and writes nothing.*

The Problem

Claude Code starts each session with standing context already loaded. Some of that context is useful: durable rules, corrections, and project-specific guard rails. Some of it quietly turns into stale status: old session snapshots, shipped work notes, and skills that are no longer relevant to the current project.

That costs tokens and dilutes signal. The more stale context is always present, the easier it is for live rules to get crowded out. See [docs/the-problem.md](docs/the-problem.md) for the full explanation.

The Principle

A thing earns standing context ONLY if it must be present before you know you need it. Everything else loads on demand.

Memory should hold guard rails, not status logs. Skills should stay eager only when the current project plausib