flowingkhaosSign in
Build a Claude Code mod that fails closedstep 8 of 8 · 0 of 18 carriedSign in to keep it
Step 8 of 8 · weight 2 · about 20 minutes

Read it, then pass the check at the end to open the final check.

Measure each mod and write when to remove it

Updated

What this step is for

You now have three mods that run on every session. This last step covers what they are not (a sandbox), how an organization keeps its rules above them, and the habit that keeps a mod honest: a dated number that says when to delete it.

Do it

Mods are not sandboxed

A mod runs with your user’s rights. $.process.run and $.fs.write reach your whole machine, outside the Bash sandbox and outside the permission prompt. Install only mods you have read, and gate your own with step 7’s script. We never install someone else’s mod on a work machine; we read it for ideas and write our own.

Keep the rules above the mods

Without a managed settings file, a mod’s answer can override your deny rules. With one, your deny rules hold over every mod. The file can be as small as the seven rules from step 4:

sudo mkdir -p "/Library/Application Support/ClaudeCode" && sudo cp ~/managed-settings.json "/Library/Application Support/ClaudeCode/managed-settings.json"
New-Item -ItemType Directory -Force "C:\Program Files\ClaudeCode"; Copy-Item "$HOME\managed-settings.json" "C:\Program Files\ClaudeCode\managed-settings.json"
sudo mkdir -p /etc/claude-code && sudo cp ~/managed-settings.json /etc/claude-code/managed-settings.json

where ~/managed-settings.json holds { "permissions": { "deny": [ … the rules … ] } }. The file locks only the keys it names. Run /status: the setting sources now include Enterprise managed settings.

Measure the thing the mod is for

Every mod we keep has a remove-if line: the measurement, the number and the date that would make us delete it. Ours, from the mods in this workshop:

Mod Remove if
context band on or after 2026-10-20, 25% or more of sessions still peak at 400k tokens of context (it was 25% before the band)
production guard more than 3 false holds in a week, or zero holds in the 60 days after each test run got its own database
handed commands fewer than 10 presses a week after two weeks, or one command runs that the operator did not mean to run
spend line the estimates differ from the provider’s bill by more than 20% for a day

The last line exists because of the fix linked to this step: a pricing API returned the cheapest tier’s price, so a spend estimate said $1.86 while the bill was about $5.20. A meter is only as true as the number under it: check the estimate against the bill before you trust a cap built on it.

For the turn band, measure what it shows. This script reads token counts only, never message text, and prints each session’s peak context:

python3 - <<'EOF'
import glob, json, os, statistics
peaks = []
for f in sorted(glob.glob(os.path.expanduser("~/.claude/projects/*/*.jsonl")), key=os.path.getmtime)[-30:]:
    peak = 0
    for line in open(f, errors="ignore"):
        try: d = json.loads(line)
        except ValueError: continue
        u = (d.get("message") or {}).get("usage") or {} if d.get("type") == "assistant" else {}
        peak = max(peak, sum(u.get(k, 0) for k in ("input_tokens", "cache_read_input_tokens", "cache_creation_input_tokens")))
    if peak: peaks.append(peak)
if peaks:
    print(f"sessions {len(peaks)} · median peak {statistics.median(peaks)/1000:.0f}k · max {max(peaks)/1000:.0f}k")
EOF

Our first run: 28 sessions, median 86k, max 760k, 7 of them (25%) at 400k or more.

Check it

Write one remove-if line for each mod you installed, in a REMOVE-IF.md beside them: the measurement, the number, and the date you will check it. Put the date in your calendar. A mod without that line is one you will still be running long after it stopped earning its place.

The gate · a reading check closes this stepweight 2 of Σw 15

Check what you read in “Measure each mod and write when to remove it”

Three questions drawn from a larger pool, so no two papers are quite the same. Two right passes it and opens the next step. The questions are public; scoring them needs an account, and the key never leaves the server.

Loading the check…

All 8 stepsTake the check

The columns, fixes and workshops continue in the community: SEO, AI, and making money with code.

Join on Whop

Luke Sidney writes and builds everything here, alone, in the open. lukesidney.me