operation-tracker

rayk's avatarfrom rayk

Maintain awareness of operation counts across the conversation to prevent cumulative context exhaustion. Use when you notice multiple operations accumulating or when working on iterative tasks across turns.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 29, 2025

When & Why to Use This Skill

The Operation Tracker skill is a sophisticated context-awareness framework designed to prevent cumulative context exhaustion in AI sessions. By monitoring operation patterns—such as repetitive edits, sequential file reads, and 'continue' loops—it enables Claude to proactively delegate tasks to subagents, preserving the main conversation's memory for high-level reasoning and long-term stability.

Use Cases

  • Preventing 'Continue' Loops: Automatically detects when a user repeatedly asks to 'continue' or 'keep going,' triggering delegation to prevent the conversation history from becoming unmanageable.
  • Managing Multi-File Exploration: Identifies when a sequence of individual file reads is turning into a deep exploration task and shifts the workload to a subagent to keep the main context clean.
  • Optimizing Iterative Development: Tracks repeated edits on the same file across multiple turns, suggesting delegation once a threshold is reached to maintain session performance.
  • Context Usage Monitoring: Periodically checks total context consumption and shifts to a full-delegation mode when usage exceeds 50%, ensuring the agent remains responsive throughout long-running tasks.
nameoperation-tracker
descriptionMaintain awareness of operation counts across the conversation to prevent cumulative context exhaustion. Use when you notice multiple operations accumulating or when working on iterative tasks across turns.
Maintain awareness of operation patterns across the conversation to prevent cumulative context exhaustion.

The per-turn threshold is a trap—it's the CONVERSATION-LEVEL accumulation that kills sessions. This skill helps Claude track operations and recognize when to delegate.

Before each operation, mentally note:
  1. Reads since last Task: How many files have I read directly since my last Task delegation?
  2. Edits since last Task: How many edits have I made since my last Task delegation?
  3. Same-file turns: Am I iterating on the same file across multiple turns?
  4. Continue loops: Is the user saying "continue" or similar repeatedly?

If any count exceeds threshold → delegate remaining work.

| Metric | Threshold | Action | |--------|-----------|--------| | Reads since last Task | ≥2 | Task(Explore) for remaining reads | | Edits since last Task | ≥3 | Task(general-purpose) for remaining edits | | Consecutive same-file turns | ≥3 | Suggest delegation to user | | "Continue" cycles | ≥3 | Delegate remaining refinements | | Context usage | >50% | All remaining work to subagents | User keeps saying "continue", "keep going", "more", etc. Each turn adds context without triggering delegation consideration. - User message is short (1-3 words) - Last response included edits/implementation - Pattern repeating for 3+ turns After 3 continue cycles: "I've been iterating directly for [N] turns. To preserve context for the rest of our session, I'll delegate remaining refinements to a subagent."

Then delegate via Task(general-purpose).

Each turn has 1-2 edits (under per-turn threshold), but conversation accumulates many. - Count edits since last Task delegation - Each turn passes individual check - Cumulative count exceeds threshold Mental checklist at start of each turn: - "Since my last Task delegation, I've done [N] edits" - If N ≥ 3: "I should delegate remaining edits" Sequential file reads to understand a feature/bug, loading each file into context. - Reading file A to understand something - Then reading file B because A referenced it - Then reading file C because B imported it - Each read seemed necessary individually This is EXPLORATION. Should have been Task(Explore) from the start. After 2 reads: delegate remaining exploration. Making repeated changes to the same file across multiple turns. - Turn 1: Edit file X - Turn 2: User feedback, edit file X again - Turn 3: More feedback, edit file X again - Each edit is small, but cumulative context grows After 3 turns on same file: "We've been iterating on [file] for several turns. Would you like me to delegate remaining refinements to preserve main context?" Notice when you start a task with proper delegation but gradually revert to direct execution. 1. Task starts: "I'll use Task(Explore) to find..." ✓ 2. Explore returns results 3. Next step: "Let me just quickly read..." ✗ 4. Then: "I'll make this small edit..." ✗ 5. Then: "One more fix..." ✗ 6. Result: Main context exhausted Ask yourself: - Did I start this task with Task delegation? - Am I now doing direct tool calls? - Is this "cleanup" or "verification" or "quick fix"?

If yes to all three: you're regressing.

Return to delegation mode: "I started with delegation but have been doing direct operations. Let me delegate the remaining work."

Task(general-purpose): "Complete the remaining [work description]"

After any exploration phase (Grep, Glob, multiple Reads): - Check: Did I load significant content into context? - If yes: Delegate action phase to preserve context When a Task returns results: - Check: Do I need to do follow-up work? - If yes: Is it debug/fix work? → New Task - Don't slip into direct execution for "just cleaning up" When user provides feedback/correction: - Check: How many iterations have we done on this file/feature? - If ≥3: Suggest delegation Periodically during long sessions: - Check: How much context have I used? - If approaching 50%: Shift to all-subagent mode - Use /context command to verify "I've done [N] [operations] since my last delegation. To preserve context for the rest of our session, I'll delegate the remaining [work type]." "We've been iterating on [target] for [N] turns. Would you like me to delegate remaining refinements to a subagent? This will help preserve context for other work." "I notice I've been doing direct operations after initially delegating. Let me return to delegation mode for the remaining work." "Context usage is approaching [X]%. I'll delegate all remaining work to subagents to ensure we can complete the session." **Wrong**: Checking thresholds only within current turn **Right**: Track cumulative operations since last Task delegation **Wrong**: Doing 10 operations without mentioning delegation consideration **Right**: Acknowledge when approaching thresholds, delegate proactively **Wrong**: Starting fresh count each turn **Right**: Maintain mental count across the conversation **Wrong**: Infinitely complying with "continue" requests via direct execution **Right**: After 3 cycles, delegate remaining work **Wrong**: Not noticing shift from delegation to direct execution **Right**: Periodically check if you've regressed from initial delegation The tracking is working when:
  • You can mentally state operation counts at any point
  • Delegation happens BEFORE thresholds are exceeded
  • Iteration loops are recognized and addressed
  • Regression from delegation is caught and corrected
  • Long sessions maintain consistent context usage
  • User is informed when delegation decisions are made
`delegate-first` provides the DECISION framework. `operation-tracker` provides the AWARENESS mechanism.

delegate-first answers: "Should this be delegated?" operation-tracker answers: "Have I accumulated too much?"

Use together: delegate-first for new operations, operation-tracker for ongoing awareness.