agentleFS
mkarami313mkarami313/Claude-skill/skills/task-observer/SKILL.md

task-observer

Skill0 starsChanged 13 days agoMITView on GitHub

Watch long-running tasks and report on them without burning context — builds, test suites, migrations, data jobs, training runs, deploys, servers — and catch an agent going in circles. Use when a command may take more than a minute or two, when running several jobs in parallel, when asked to monitor, babysit, keep an eye on or report on a task, or to set up the loop-guard hook that warns on repeated or failing tool calls.

11 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ui-ux-pro-max.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Start: every long command through the observer, in the background (Bash run_in_background: true): python3 .observer/observe.py run <name> …

    line 13
  2. Very specific:

    Never read the full log into the conversation: Use status <name>; if you need more, Grep the log for the error, then Read 40–80 lines …

    line 23

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Task observer

Two failure modes on long work: polling blind (re-reading huge logs, sleep loops, or forgetting the task exists) and going in circles (re-running the same failing command, re-editing the same file). This skill fixes both with two stdlib-only scripts in <skill-dir>/scripts/.

Long-running commands — observe.py

Copy once per project (so commands stay short): mkdir -p .observer && cp <skill-dir>/scripts/observe.py .observer/ and add .observer/ to .git/info/exclude.

  1. Start every long command through the observer, in the background (Bash run_in_background: true): python3 .observer/observe.py run <name> [--stall 300] [--repeat 20] -- <command ...> It logs all output to .observer/<name>.log and keeps .observer/<name>.json current: state, elapsed, idle time, last progress line (37%, 120/500, epoch 4), and the most repeated error line (numbers/paths normalized).
  2. Wait with the observer, also in the background, so you are re-invoked when something happens instead of polling: python3 .observer/observe.py wait <name> --timeout 1800 Exit codes: 0 done · 1 failed/stopped/lost · 3 stalled (no output for --stall s) or repeating (same error --repeat times) · 4 timeout, still running.
  3. Check any time: observe.py status (one line per task) or observe.py status <name> --tail 20.
  4. Stop: observe.py stop <name> (SIGTERM to the whole process group).

Rules:

  • Never read the full log into the conversation. Use status <name>; if you need more, Grep the log for the error, then Read 40–80 lines around it.
  • On stalled: check whether it is waiting for input (prompts, y/N, auth), a deadlock, or genuinely slow (a big download with no progress output). Decide stop vs. extend; don't just wait again with the same timeout.
  • On repeating: the job is retrying something that won't fix itself (DB down, wrong URL, missing file). Stop it, fix the cause, restart.
  • Choose --stall from the job: ~120 s for builds/tests, 600+ s for jobs that print rarely (DB migrations, model training without per-step logs).
  • Parallel jobs: one name each, one wait each; report with one status call.
  • Report to the user in one line per task (name · state · elapsed · progress · top error), not log excerpts, unless they ask.

Agent loops — loop_guard.py (PostToolUse hook)

Install when the user wants it, or when a long autonomous run is starting. Add to .claude/settings.json (project) or ~/.claude/settings.json (user), merging with existing hooks:

{ "hooks": { "PostToolUse": [ { "matcher": "*", "hooks": [
  { "type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR/.observer/loop_guard.py\"" } ] } ] } }

and copy <skill-dir>/scripts/loop_guard.py to .observer/. It records each tool call (a hash, not the content) in .observer/agent-<session>.jsonl and warns Claude (stderr + exit 2) when, within the last 30 calls:

PatternDefault trigger
same-callidentical tool + input ≥3×
same-failthe same failing call (numbers ignored) ≥3×
fail-streak5 failed calls in a row
edit-churnone file edited ≥6×
Each warning fires at most once per 10 calls. Tune with LOOP_GUARD_* env vars (see the script header); LOOP_GUARD_OFF=1 disables it. It never blocks a call and exits 0 on any internal error.

When you see a [loop-guard] message, do what it says before the next tool call: state in one or two sentences what you tried and why it failed, then change approach (different hypothesis, smaller repro, read the actual error) or ask the user. Do not re-run the same call to "check again".

Subagents and parallel agents

  • Give each background agent a task name and ask it to finish with one status line (name · done/failed · result · evidence).
  • A long-running agent's own shell work should go through observe.py too, so the parent can status it without reading its transcript.

When NOT to use

Commands that finish in under a minute (just run them), interactive commands (they will stall — run them yourself or ask the user), and services meant to run forever (start with observe.py run but don't wait; check status when needed).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.