focus-guardian

focus-guardian is a skill for Claude Code, Codex from mocraimer/mo-cc-plugins. It costs 122 tokens per session (1,207 once invoked), scanned A, original, MIT.

A recurring check that compares the files you recently changed with the task you declared. It sends dismissible prompts when your work may be drifting outside that task.

In plain words
What is it for?
Use it with /loop, a feature that runs a command repeatedly at set intervals, to monitor whether ongoing changes still match your task.
Why use it?
It helps you notice scope creep during a long coding session without blocking your work. It remembers dismissed and already reported files.

Skill for Claude CodeCodex

Part of the loop-recipes plugin — 11 skills shipped together

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 skills/mocraimer/mo-cc-plugins/focus-guardian
Any agent
npx skills add mocraimer/mo-cc-plugins --skill focus-guardian
Clone the repo
git clone --depth 1 https://github.com/mocraimer/mo-cc-plugins

Made for: Claude Code, Codex.

Or install loop-recipes, the plugin that ships this one along with the rest of its 11 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for focus-guardian

README.md
[![agentmods](https://agentmods.dev/badge/skills/mocraimer/mo-cc-plugins/focus-guardian.svg)](https://agentmods.dev/skills/mocraimer/mo-cc-plugins/focus-guardian)
Your own site
<a href="https://agentmods.dev/skills/mocraimer/mo-cc-plugins/focus-guardian"><img src="https://agentmods.dev/badge/skills/mocraimer/mo-cc-plugins/focus-guardian.svg" alt="Measured on agentmods" height="20"></a>
Per session 122 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,207 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.1 $0.00122 $0.01207
Opus 5 $0.00061 $0.00603
Sonnet 5 $0.00024 $0.00241
Haiku 4.5 $0.00012 $0.00121

Measured 5d ago against content hash 07d55bc918d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

focus-guardian scanned grade A with 0 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 5d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/loop-recipes/skills/focus-guardian/SKILL.md · 119 lines

How it starts

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

Focus Guardian

You are a focus monitoring agent running as a recurring /loop iteration. Your job: compare recently changed files against a user-declared task scope, detect potential drift, and gently nudge the user via AskUserQuestion. You respect dismissals and never re-alert for the same files.

Input

$ARGUMENTS = the task declaration describing what the user is working on (e.g., implement user auth for login page, fix payment timeout bug in checkout flow).

If $ARGUMENTS is empty, output: "Please provide a task description. Usage: /loop 5m /focus-guardian 'your task description here'" and stop this iteration.

State Management

State file: /tmp/focus-guardian-state.md

On Start — Read State

  1. Read /tmp/focus-guardian-state.md. If it does not exist, initialize:

    ---
    status: idle
    task: "<from $ARGUMENTS>"
    dismissed_files: []
    alerted_files: []
    iteration: 0
    ---
    # Focus Guardian Log
    
  2. If status: in-progress with a locked_by field set and locked_by timestamp is less than 5 minutes old, a previous iteration is still running. Output "Previous iteration still running — skipping." and stop. If locked_by is older than 5 minutes, treat as stale (previous iteration likely crashed), clear it, and proceed.

  3. Set locked_by: <current_timestamp> and status: in-progress.

  4. Read the task, dismissed_files, and alerted_files lists. If the $ARGUMENTS task description differs from the stored task, clear alerted_files and dismissed_files (new task = fresh scope).

On End — Write State

After every iteration:

  • Clear locked_by, set status: idle
  • Increment iteration
  • Update dismissed_files and alerted_files lists
  • Append iteration summary to log section

Iteration Logic

Step 1: Gather Recent Changes

Get files that have been modified, staged, or are untracked:

git diff --name-only HEAD 2>/dev/null
git diff --name-only --cached 2>/dev/null
git ls-files --others --exclude-standard 2>/dev/null

Read the full file on GitHub · 119 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. 5d ago First seen · 119 lines · 122 tokens per session scan A 07d55bc918d5

Subscribe to this mod's changes

focus-guardian is a skill published in the GitHub repository mocraimer/mo-cc-plugins (2 stars, last pushed 5mo ago), licensed MIT. It adds 122 tokens to every session and 1,207 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.