lap

A single-step command from a recurring development loop that ships one small improvement and checks the result.

In plain words
What is it for?
Completing one bounded project task, testing its outcome, recording the result, and pushing the change.
Why use it?
It keeps autonomous work limited and verifiable, while also respecting pause and usage-throttling controls.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/patwalls/headroom/lap
Clone the repo
git clone --depth 1 https://github.com/patwalls/headroom

Made for: Claude Code.

Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,699 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.02699
Opus 5 $0.00015 $0.01350
Sonnet 5 $0.00006 $0.00540
Haiku 4.5 $0.00003 $0.00270

Measured 2d ago against content hash 487b304e78ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

lap scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- `cat ~/.claude/LOOPS_THROTTLE` gives a number of seconds. That is the MINIMUM delay

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Site live: !`curl -s -o /dev/null -w "%{http_code}" --max-time 10 https://headroom.walls.sh/health 2>/dev/null` · downloads: !`curl -s --max-time 10 "https://headroom.walls.sh/metrics?probe=1" 2>/dev/null | head -c 200
.claude/commands/lap.md · 167 lines

How it starts

The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.

⏸ Pause guard (check FIRST, before anything)

If ~/.claude/LOOPS_PAUSED exists (test -f ~/.claude/LOOPS_PAUSED), Pat has paused all loops (usually: out of credits). Say "loops are paused — not running this lap" and STOP immediately. Do no work, schedule no wakeups. Pat resumes with /resume-loops in walls.

🐢 Throttle guard (check right after pause)

If ~/.claude/LOOPS_THROTTLE exists, Pat is low on credits — run FRUGAL this lap:

  • cat ~/.claude/LOOPS_THROTTLE gives a number of seconds. That is the MINIMUM delay before the next lap: when this lap ends and you schedule the next wakeup, set ScheduleWakeup delaySeconds to AT LEAST that value.
  • Keep the lap small and cheap: do ONE small thing, do NOT escalate to opus/fable subagents (stay on the cheap session model), skip optional polish. Cleared with /unthrottle-loops (or /resume-loops) in walls.

💸 Token discipline (every lap, always)

The loop re-reads its whole context each lap, so wasted work compounds fast. Keep every lap cheap and bounded:

  • One thing, one success test. Before starting, state in ONE line what this lap ships and the exact check that proves it done. Hit that test, then STOP — no second task, no gold-plating, no "while I'm here."
  • Never spin. If an approach fails twice the same way, abandon it, log it as a blocker (a registry/VISION note), and end the lap. A third retry of a broken approach is banned — that is the #1 token sink.
  • Read once, narrowly. Open only the files this lap needs, once. Do NOT re-read or re-grep what is already in context. Trust VISION.md's loop log as the state of the world instead of re-deriving it from the whole codebase.
  • Cheap by default, escalate rarely. Stay on the session model. Spawn AT MOST one subagent per lap, and only for genuinely substantial/critical work — never fan out a swarm for a routine lap.
  • Hand off small. End with a 2–3 line loop-log entry (shipped / fact learned / next) so the next lap can act from that summary, not from re-reading everything.

Read the full file on GitHub · 167 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 167 lines · 29 tokens per session scan B 487b304e78ef

Subscribe to this mod's changes

lap is a command published in the GitHub repository patwalls/headroom (10 stars, last pushed 2mo ago), licensed MIT. It adds 29 tokens to every session and 2,699 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (reads agent configuration directories, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.