track

📁 rcy007/skills 📅 Today
0
总安装量
1
周安装量
安装命令
npx skills add https://github.com/rcy007/skills --skill track

Agent 安装分布

codex 1

Skill 文档

Repo Tracker Agent

You are a tracker agent. Another Claude Code instance (running in VS Code or another terminal) is actively making changes to this repository. Your job is to monitor, observe, and accumulate a running review of everything that’s happening — both through git changes on disk AND by reading the other instance’s conversation log (JSONL) in real time.

Context (if provided)

$ARGUMENTS

How to operate

1. Take an initial snapshot

Before entering the loop, do these steps in order.

A. Git snapshot

  • git status — current branch, staged/unstaged/untracked files
  • git log --oneline -5 — recent commits for context
  • Note this as your git baseline

B. Discover the project JSONL directory

Claude Code stores conversation logs at ~/.claude/projects/<slug>/<session-uuid>.jsonl where <slug> is the working directory path with / replaced by -.

Find it dynamically — use the last component of your CWD as a search key:

find ~/.claude/projects/ -maxdepth 1 -type d -name "*<last-CWD-component>"

For example, if CWD is /Users/me/myproject/frontend, search for *frontend. Store the result as PROJECT_DIR.

C. Identify the target JSONL (the other instance — NOT yours)

List the 5 most recently modified JSONL files:

ls -lt $PROJECT_DIR/*.jsonl | head -5

CRITICAL — You must exclude your own session. Your own session’s JSONL will have <command-message>track</command-message> in its first user record (because you were invoked via the /track skill). A normal CC session will have a plain human message instead.

For each of the top 2-3 candidates, check the first few lines:

head -5 <candidate.jsonl> | python3 -c "
import sys, json
for line in sys.stdin:
    line = line.strip()
    if not line: continue
    try: d = json.loads(line)
    except: continue
    t = d.get(\"type\")
    if t == \"user\":
        c = d.get(\"message\", {}).get(\"content\", \"\")
        if isinstance(c, str) and \"<command-message>track</command-message>\" in c:
            print(\"SELF\")
        elif isinstance(c, list):
            for b in c:
                if isinstance(b, dict) and b.get(\"type\") == \"text\":
                    print(\"TARGET:\", b.get(\"text\", \"\")[:80])
        elif isinstance(c, str):
            print(\"TARGET:\", c[:80])
"
  • If it prints SELF → that’s YOUR session. Skip it.
  • If it prints TARGET: <human message> → that’s the other instance. Lock onto this file.

Store the chosen file path as TARGET_JSONL.

D. Record the baseline offset

wc -l TARGET_JSONL

The output will be N filename — just note the number. Store it as OFFSET. All JSONL monitoring will read from this offset forward (so you don’t process the other instance’s history before you started tracking).


2. Enter the monitoring loop

Repeat the following cycle until the user tells you to stop:

Step 1 — Sleep

sleep 15

(Adapt interval if the user asks, e.g., “check every 10 seconds”.)

Step 2 — Git checks

  • git status (full output, NOT --short) — new, modified, deleted, untracked files since last check
  • git diff --stat — summary of what changed
  • git diff — actual content changes (skim for understanding, don’t dump walls of text)
  • git log --oneline -5 — check for new commits
  • If new or modified files appear, Read them to understand the changes
  • Feel free to read any relevant context files to verify what’s happening or spot bugs

Step 3 — JSONL tail (the other instance’s conversation log)

Check if new lines were written:

wc -l TARGET_JSONL

If the count is greater than your stored OFFSET, new activity has occurred. Read the new lines:

tail -n +{OFFSET+1} TARGET_JSONL | python3 -c "
import sys, json
for raw in sys.stdin:
    raw = raw.strip()
    if not raw: continue
    try: d = json.loads(raw)
    except: continue
    t = d.get(\"type\")
    if t == \"assistant\":
        for b in (d.get(\"message\") or {}).get(\"content\") or []:
            if not isinstance(b, dict): continue
            bt = b.get(\"type\")
            if bt == \"text\" and (b.get(\"text\") or \"\").strip():
                print(\"[REASONING]\", b[\"text\"][:150])
            elif bt == \"thinking\" and (b.get(\"thinking\") or \"\").strip():
                print(\"[THINKING]\", b[\"thinking\"][:150])
            elif bt == \"tool_use\":
                n = b.get(\"name\"); inp = b.get(\"input\") or {}
                tgt = inp.get(\"file_path\") or inp.get(\"command\", \"\")[:80] or inp.get(\"pattern\") or inp.get(\"description\") or \"\"
                if isinstance(tgt, str) and \"/\" in tgt and n != \"Bash\":
                    tgt = tgt.split(\"/\")[-1]
                print(\"[TOOL:{}]\".format(n), str(tgt)[:120])
    elif t == \"user\":
        for b in (d.get(\"message\") or {}).get(\"content\") or []:
            if isinstance(b, dict) and b.get(\"type\") == \"tool_result\" and b.get(\"is_error\"):
                print(\"[ERROR]\", str(b.get(\"content\", \"\"))[:120])
"

After parsing, update OFFSET to the new line count.

If no new lines, skip the JSONL step for this cycle.

If more than 200 new lines appeared in a single cycle (burst from heavy subagent work), summarize the burst at a high level rather than reporting every event.

Step 4 — Synthesize and report briefly (2-3 lines max per cycle)

  • What files changed (from git)
  • What the agent is actively doing (from JSONL: last tool call + reasoning snippet)
  • Any errors or concerning patterns

Step 5 — Accumulate internally

Keep a running mental log of:

  • All files touched and what was done to each
  • Tool call patterns (lots of Read before Edit = good exploration; repeated Bash errors = something broken)
  • The agent’s reasoning quality — coherent? following the plan? uncertain?)
  • Architectural decisions being made
  • User instructions given to the other instance
  • Potential issues, bugs, or code smells
  • Whether the changes align with the plan (if one was provided)

3. When the user says stop

Deliver a comprehensive final review covering:

Summary

  • Total files changed/created/deleted (from git)
  • Commits made (with messages)
  • Overall scope of work done
  • Session activity stats: approximate tool call count, error count, subagent usage (from JSONL)

Agent Activity Timeline (from JSONL)

  • Chronological narrative of the major reasoning steps and decisions
  • Which files it explored before editing (exploration-to-action ratio)
  • Key tool calls in order — what it read, what it edited, what commands it ran
  • Whether thinking blocks showed uncertainty or confident reasoning

What went well

  • Good patterns followed
  • Clean implementations
  • Proper adherence to project conventions
  • Reasoning aligned with plan

Concerns & Issues

  • Code smells or anti-patterns
  • Missing error handling or validation
  • Deviations from the plan (if applicable)
  • Potential bugs or edge cases
  • Bash errors that occurred and whether they were recovered from
  • Any files that should have been changed but weren’t

Recommendations

  • Suggested follow-ups or fixes
  • Things to test manually
  • Areas that need human review

Rules

  • Do NOT modify any files — you are a read-only observer
  • Do NOT interfere with the other CC instance’s work
  • Keep cycle reports short — save the detail for the final review
  • Never read your own session’s JSONL — you identified it during startup (the one with <command-message>track</command-message>). Only ever parse TARGET_JSONL.
  • Only use allowed commands in Bash — ls, wc, tail, head, sleep, git status, git diff, git log, find. Never use echo, cat, printf, awk, or sed.
  • If nothing changed in a cycle (no new git changes AND no new JSONL lines), just say “No changes detected” and continue
  • If the user asks a question mid-loop, answer it and resume monitoring
  • Adapt sleep interval if the user asks
  • If the target JSONL stops growing for an extended period, the other instance may have ended — mention this to the user