Agent skill

Harness Diet

by sangrokjung in sangrokjung/claude-forge

Measure and shrink the always-loaded context of a Claude Code harness (CLAUDE.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to…

MITAuto-check passedAgent Workflows

Install Harness Diet

skills CLI
$ npx skills add sangrokjung/claude-forge --skill harness-diet -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sangrokjung/claude-forge harness-diet --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sangrokjung/claude-forge.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/harness-diet .claude/skills/harness-diet && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
harness-diet
GitHub stars
852
Token cost
~1.9k tokens
SKILL.md length
879 words
Files
5 (incl. scripts, references)
Skills in repo
24
Repo updated
First seen
Licence
MIT

At a glance

Measure and shrink the always-loaded context of a Claude Code harness (CLAUDE.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to…

  • Works in 5 steps: Measure → Classify every always-loaded rule → Migrate (block-level, never prose… → …
  • Tasks that involve Agent instruction files
  • SKILL.md covers Budgets (defaults — override…, Phase 0 — Measure, Phase 1 — Classify every… and Phase 2 — Migrate…, plus 4 more sections
  • Runs Python and Shell scripts from its folder; calls python3

What it does

Harness Diet is an agent skill from sangrokjung/claude-forge. Measure and shrink the always-loaded context of a Claude Code harness (CLAUDE.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to path-scoped or skill-triggered loading, and verify zero governance loss with deterministic preservation checks. Use on "harness diet", "context diet", "rules diet", "CLAUDE.md too long", "always-load budget", "trim my rules", "context bloat", "하네스 다이어트", "룰 다이어트", "컨텍스트 다이어트", "always-load 줄여줘". Not for one-off prose editing…

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `hooks/rules-budget-guard.sh`, `references/methodology.md` and `scripts/harness_diet_audit.py`).

It sits in Agent Workflows, covering Agent instruction files. The repository describes itself as: oh-my-zsh for Claude Code — 16 agents, 35 commands, 32 skills, 21 safety hooks in one install. v4.0 adds an adversarial review loop: a second agent that never sees the first… The licence is MIT.

When your agent uses it

  • Tasks that involve Agent instruction files

Example prompts

  • “harness diet”
  • “context diet”
  • “rules diet”
  • “/harness-diet”

Requirements

  • Python 3
  • A Bash shell

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Measure
  2. Classify every always-loaded rule
  3. Migrate (block-level, never prose compression)
  4. Verify (two lenses, fresh checker)
  5. Guard (keep it off)

What it can do on your machine

Read from SKILL.md and the folder at commit 34d881d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.claude.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Harness Diet loads about 1.9k tokens when it runs, and up to ~3.4k if it reads all its reference files. Until then it costs about 139 tokens; SKILL.md has 879 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~139
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from sangrokjung/claude-forge at commit 34d881d, republished under its MIT licence (© sangrokjung). 879 words, ~1,919 tokens.

Download SKILL.mdSave it as .claude/skills/harness-diet/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
harness-diet
description
Measure and shrink the always-loaded context of a Claude Code harness (CLAUDE.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to path-scoped or skill-triggered loading, and verify zero governance loss with deterministic preservation checks. Use on "harness diet", "context diet", "rules diet", "CLAUDE.md too long", "always-load budget", "trim my rules", "context bloat", "하네스 다이어트", "룰 다이어트", "컨텍스트 다이어트", "always-load 줄여줘". Not for one-off prose editing or project docs cleanup.
license
MIT
metadata.category
harness-maintenance
metadata.phase
v1

harness-diet — put your always-loaded context back under budget

A harness gains weight automatically (every incident note, every boss directive, every fix lands as another paragraph in an always-loaded rule) but only loses weight when someone runs a diet. Field measurement on a mature harness: growth-to-reduction commit ratio of ~60:1, natural growth of ~70KB/month, and adherence degrading as the pile grows. Anthropic's guidance is blunt: "target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence", and rules without paths frontmatter load "with the same priority as CLAUDE.md" — every session, every token (memory docs).

Result you should expect: one field run took a harness from 146KB always-loaded (143% of budget) to 100.6KB (98%) with zero governance loss — every killswitch, decision table, trigger keyword, and canonical command verified present after the diet.

Budgets (defaults — override via flags)

MetricBudgetWhy
CLAUDE.md< 200 linesAnthropic official guidance
Per always-loaded rule file8,192 BKeeps any single rule scannable; forces narrative out
Total always-loaded rules102,400 BAttention-budget ceiling; beyond this, adherence drops

Bundled script paths: commands below use $HOME/.claude/skills/harness-diet/… (the install.sh layout). For marketplace (/plugin install) installs, resolve under ${CLAUDE_PLUGIN_ROOT}/skills/harness-diet/… instead. The scripts are stdlib-only Python; if unavailable, perform the step manually from the described contract.

Phase 0 — Measure

bash
DIET="$HOME/.claude/skills/harness-diet"   # or "${CLAUDE_PLUGIN_ROOT}/skills/harness-diet"
python3 "$DIET/scripts/harness_diet_audit.py"            # human summary
python3 "$DIET/scripts/harness_diet_audit.py" --json     # machine output
python3 "$DIET/scripts/harness_diet_audit.py" --strict   # exit 2 if over budget (CI/ratchet)

Auto-discovers ./.claude/rules, ~/.claude/rules, and CLAUDE.md files at project/user level. A rule is always-loaded iff its YAML frontmatter has no paths: key.

Phase 1 — Classify every always-loaded rule

Walk the list from largest to smallest and pick one bucket per file:

  1. Keep always-loaded — cross-cutting behavior needed in every session (tone, security boundaries, routing indexes). Diet the body (Phase 2) but keep the load class.
  2. Path-scope — the rule only matters when specific files are touched. Add paths: globs. ⚠ Path scoping fires on file access, never on spoken keywords. A rule triggered by what the user says cannot be path-scoped. ⚠ No literal brackets in globs ([locale] parses as a character class and silently never matches).
  3. Convert to skill / hook-injected — task-specific procedure? Official guidance: "use skills instead". Best case: the rule's real trigger is already a deterministic hook — have the hook inject "Read <rule> first" into context and drop the always-load.
  4. Migrate narrative to reference — the default for oversized keepers (Phase 2).

Phase 2 — Migrate (block-level, never prose compression)

For each oversized file:

  1. Extract a preservation manifest first (before touching anything):
    bash
    python3 "$DIET/scripts/preservation_check.py" extract rules/big-rule.md > /tmp/big-rule.manifest.json
  2. Append the outgoing blocks to references/<name>-ref.md (or your repo's reference dir), verbatim under a dated section header. Append before rewriting the rule body, and commit both together — a slimmed body pushed without its reference content is a content hole for every mirror that pulls in between.
  3. Rewrite the rule body: keep the verdict skeleton (what to do / never do), leave a one-line pointer to the reference for the "why" and the war stories.

Must stay in the body (never migrate): CRITICAL/IMPORTANT banners and their verdicts, decision tables, trigger keywords and agent names (they are a routing index, not prose), killswitch env vars, canonical command lines, IDs and threshold values.

Migrate aggressively: incident narratives, measurement history, duplicated explanations of the same point, long example blocks, anything already present in the reference file.

Show full SKILL.md (360 more words)Show less

Phase 3 — Verify (two lenses, fresh checker)

  1. Loss lens (deterministic):
    bash
    python3 "$DIET/scripts/preservation_check.py" verify rules/big-rule.md /tmp/big-rule.manifest.json
    Exit 2 = something load-bearing got migrated. Restore it before proceeding. Review the manifest by hand first — prune entries that were intended to move.
  2. Efficacy lens: re-run the audit; recompute the total; confirm the savings are real (reference files are lazily Read, not @-imported — check the rule bodies contain no @path imports of the reference, or the "savings" still load at launch).
  3. Fresh checker: hand the diff to an independent reviewer that didn't write it (pairs with the review-loop skill). Diets fail quietly: a plausible-looking slim body missing one qualifier is exactly what the maker cannot see.

Phase 4 — Guard (keep it off)

A diet without a guard regrows. Ship-with options in $DIET/hooks/:

  • rules-budget-guard.sh — PostToolUse (Edit|Write) advisory: the moment a rule edit pushes a file past budget, the editing session gets a context note telling it to migrate, not append. Non-blocking by design — a blocking pre-commit gate silently stalls auto-commit pipelines.
  • Re-run --strict weekly (cron, session-start dispatcher, or CI) and surface the report only when over budget.

Anti-patterns (each one cost a real harness a failed round)

Anti-patternWhy it fails
Prose compression ("tighten the wording")Trigger keywords, guru names, stage names are the routing index. A compression pass that saved 12% destroyed 70% of routing signals and was fully reverted. Move blocks; don't rewrite sentences.
Dedup toward a private fileIf rules are distributed to a team but ~/.claude/CLAUDE.md is one person's, "delete from rules, it's already in CLAUDE.md" deletes it from every teammate's context. Dedup toward the shared surface.
Slim body committed, reference append notMirrors pull a body full of dangling pointers. Commit both in one change.
Trusting the maker's "everything preserved" claimExtract the manifest before the edit and verify after. Field run: the maker claimed "6 bullets kept verbatim"; the deterministic check found two qualifiers gone.
Treating one diet as the fixGrowth is automatic; reduction is manual. Without the guard, one measured harness regrew from 145KB toward its 220KB peak within weeks.

References

  • references/methodology.md — budget rationale, growth mechanics, byte-accounting worksheet, verification lens design, worked field results.

© sangrokjung, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, references) in skills/harness-diet of sangrokjung/claude-forge.

  • SKILL.md
  • hooks/rules-budget-guard.sh
  • references/methodology.md
  • scripts/harness_diet_audit.py
  • scripts/preservation_check.py

Open the folder on GitHubat commit 34d881d

Compare with similar skills

Harness Diet next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Harness Diet compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Harness Diet this skillsangrokjung/claude-forge852—~1.9kAutomated safety check: PassMIT
Using Agent Skillsaddyosmani/agent-skills105k4 repos~2.4kAutomated safety check: PassMIT
Claude ReflectBayramAnnakov/claude-reflect1.8k2 repos~627Automated safety check: PassMIT
Writing For Agentsbestofjs/bestofjs3.1k20 repos~2.7kAutomated safety check: PassMIT
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
Task Observerrebelytics/one-skill-to-rule-them-all3.2k1 repos~11kAutomated safety check: PassCC-BY-4.0

Similar skills

  • Using Agent Skills

    addyosmani/agent-skills

    Meta-skill for choosing which workflow skill fits the task at hand, plus always-on habits: surface assumptions, stop on confusion, push back, keep it simple and stay in scope.

    105k GitHub starsUsed in 4 repos~2.4k tokens
    Agent WorkflowsAuto-check passed
  • Claude Reflect

    BayramAnnakov/claude-reflect

    Self-learning system that captures corrections during sessions and reminds users to run /reflect to update CLAUDE.md.

    1.8k GitHub starsUsed in 2 repos~627 tokens
    Agent WorkflowsAuto-check passed
  • Writing For Agents

    bestofjs/bestofjs

    Writing documents for agents. An agent skill from bestofjs/bestofjs.

    3.1k GitHub starsUsed in 20 repos~2.7k tokens
    Agent WorkflowsAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 9 days ago
    Agent WorkflowsAuto-check passed
  • Task Observer

    rebelytics/one-skill-to-rule-them-all

    Monitors task execution for skill improvement opportunities.

    3.2k GitHub starsUsed in 1 repo~11k tokens
    Agent WorkflowsAuto-check passed
  • SkillOpt Sleep Cycle

    microsoft/SkillOpt

    Official

    Runs an on-demand or nightly sleep cycle that reviews past Claude Code sessions and proposes validated updates to CLAUDE.md and skills.

    18k GitHub stars~2.3k tokensUpdated 4 days ago
    Agent WorkflowsAuto-check passed

More from sangrokjung/claude-forge

All 24 skills in this repo
  • Debugging Strategies

    sangrokjung/claude-forge

    Master systematic debugging techniques, profiling tools, and root cause analysis to efficiently track down bugs across any codebase or technology stack.

    852 GitHub starsUsed in 13 repos~3.1k tokens
    Auto-check passed
  • Dependency Upgrade

    sangrokjung/claude-forge

    Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing.

    852 GitHub starsUsed in 12 repos~2.3k tokens
    Auto-check passed
  • Skill Factory

    sangrokjung/claude-forge

    Analyze session work and automatically convert reusable patterns into Claude Code skills.

    852 GitHub stars~2.7k tokensUpdated 1 mo ago
    Auto-check passed
  • Cc Dev Agent

    sangrokjung/claude-forge

    A skill your agent uses when starting Claude Code projects, writing CLAUDE.md/spec.md, dispatching subagents, or requesting Agent Teams parallel development.

    852 GitHub stars~771 tokensUpdated 1 mo ago
    Auto-check passed
  • Continuous Learning V2

    sangrokjung/claude-forge

    Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

    852 GitHub starsUsed in 5 repos~1.8k tokens
    Auto-check passed
  • Session Wrap

    sangrokjung/claude-forge

    A skill your agent uses when wrapping up a session before ending.

    852 GitHub stars~1.6k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Harness Diet

What does Harness Diet do?

Measure and shrink the always-loaded context of a Claude Code harness (CLAUDE.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to…. Harness Diet is an agent skill from sangrokjung/claude-forge.md + rules without paths frontmatter) back under budget — migrate narrative to reference files, convert rules to path-scoped or skill-triggered loading, and verify zero governance loss with deterministic preservation checks.

When should I use Harness Diet?

Harness Diet fits situations like: tasks that involve Agent instruction files.

How do I install Harness Diet in Claude Code?

Run `npx skills add sangrokjung/claude-forge --skill harness-diet -a claude-code`. Or copy the skill folder (skills/harness-diet in sangrokjung/claude-forge) into .claude/skills/harness-diet in your project. Claude Code loads it when a task matches its description.

How do I install Harness Diet in Codex?

Run `npx skills add sangrokjung/claude-forge --skill harness-diet -a codex`. Or copy the skill folder (skills/harness-diet in sangrokjung/claude-forge) into .agents/skills/harness-diet in your project. Codex loads it when a task matches its description.

Can I use Harness Diet in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sangrokjung/claude-forge --skill harness-diet -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/harness-diet, .gemini/skills/harness-diet, .github/skills/harness-diet and .opencode/skills/harness-diet in your project.

What does Harness Diet need to run?

Going by SKILL.md and its folder, Harness Diet needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3; A Bash shell.

Does Harness Diet access the network?

SKILL.md names 1 domain. As links in the text: docs.claude.com. This is read from the text; nothing was executed.

Is Harness Diet safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Harness Diet use?

Harness Diet is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Harness Diet use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to Harness Diet?

Skills that share tags, products or a category with Harness Diet: Using Agent Skills (addyosmani/agent-skills, 105k stars), Claude Reflect (BayramAnnakov/claude-reflect, 1.8k stars), Writing For Agents (bestofjs/bestofjs, 3.1k stars) and Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Harness Diet?

sangrokjung (a GitHub user) maintains it in sangrokjung/claude-forge, which has 852 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on September 3, 2026.

Source: sangrokjung/claude-forge on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.