Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

aim-tracking-rotate

FreeRuns bundled scriptsNot checked

Enforce oversight-file caps at session-close, rotate over-cap append-only-logs and registers into dated archive shards, and fix over-cap files…

Hidden-Historyby Hidden-History★ 41 GitHub stars

About this skill

Tracking Rotate — Oversight Cap Enforcement and Archival

Purpose: Bound oversight-file bloat without breaking the chronological trail or by-id lookup (PLAN-028 D3 / BP-167 Part C). --check is the session-close enforcement gate; --apply is the BP-167 Part C rotation that fixes an over-cap file. Complements aim-tracking-freshness (which detects INDEX drift); rotate bounds the append-only-logs and registers.

Ownership boundary: rotate owns append-only-log + register archival. It does NOT touch bugs/INDEX.md or tech-debt/INDEX.md — those generated files and their CLOSED.md shards are owned by aim-tracking-freshness.

--apply support (and the TD-655 limitation): --check enforces the cap on every governed file, but --apply auto-rotation is shipped only for the id-H3 append-only log it was verified against:

File --apply Why
tracking/decision-log.md ✅ supported ### DEC-… id-H3 entries or ## S{n} session-blocks (auto-detected — see note below), newest-first; archives the oldest into a dated shard + manifest
tracking/blockers-log.md ⛔ refused → TD-655 "Active Blockers" table + ### BLK- detail H3 + "Resolved Blockers" table — archiving the H3 details orphans the matching table rows
tracking/risk-register.md ⛔ refused → TD-655 table rows under ### Critical/High/Medium/Low severity headers — the H3 boundary is a severity header, not a record
tracking/technical-debt.md ⛔ refused → TD-655 ### TD-NNN detail H3 entries + ### <Category> summary tables in "Debt by Category" — archiving the H3 details orphans the table rows referencing those TDs
SESSION_WORK_INDEX.md ⛔ refused → TD-655 four distinct tables (Active Task / Last 5 Sessions / Active Blockers / High Priority Risks); a bare ^| match sheds rows from the wrong table, and the last-5 window is hand-managed
session-index/INDEX.md ⛔ refused → TD-655 ### [Month YYYY] H3 sections + Current-Year and Archive tables (mixed)

Entry-format auto-detection (#291): auto-rotation tries the default id-H3 boundary (^### [A-Z]{2,4}-) first; if a governed append-only-log contains zero id-H3 entries, it falls back to the session-block boundary (^## S\d+ ) before reporting "no entries detected". This prevents a ## S{n} decision-log from silently no-op'ing at closeout while its file grows past cap.

For a ⛔ file, --apply makes no changes and exits non-zero with a manual remedy; run python $SCRIPT --fix {file} --oversight-root {oversight_path} (archive-whole-verbatim + lean index rewrite) or trim by hand. Field-aware safe auto-rotation for table-under-severity registers and multi-table live-indexes is deferred to TD-655. The refusal is enforced by relative path (the fixed set: blockers-log.md, risk-register.md, technical-debt.md, SESSION_WORK_INDEX.md, session-index/INDEX.md), so a future cap-contract seed cannot re-enable an unsafe --apply.


Usage

SCRIPT=~/.ai-memory/_ai-memory/pov/skills/aim-tracking-rotate/scripts/tracking_rotate.py

# Enforcement gate (session-close): exit non-zero if any governed file is over cap.
python $SCRIPT --check --oversight-root /path/to/oversight

# Rotate an over-cap file's oldest entries into a dated archive shard:
python $SCRIPT --apply /path/to/oversight/tracking/decision-log.md \
               --oversight-root /path/to/oversight

# Fix a single over-cap file (conformance + cap-fix + conservation proof):
python $SCRIPT --fix /path/to/oversight/tracking/decision-log.md \
               --oversight-root /path/to/oversight

# Fix all governed oversight files (MEMORY.md excluded by default):
python $SCRIPT --fix-all --oversight-root /path/to/oversight

# Fix all governed files AND MEMORY.md:
python $SCRIPT --fix-all --include-memory-md --oversight-root /path/to/oversight

# Fix MEMORY.md only (lossless relocation to sibling topic files):
python $SCRIPT --fix-memory-md

Optional flags (all modes): --period YYYY-MM (archive period override for deterministic runs). --apply additionally accepts --entry-pattern '<regex>' and --keep <N>. --include-memory-md (with --fix-all only): also fix the auto-memory MEMORY.md; skipped by default with a NOTICE. Oversight root can also come from $AI_MEMORY_OVERSIGHT_ROOT.

MEMORY.md fix details: when you need the full step-by-step procedure for MEMORY.md relocation or collision resolution, read:

cat "$(dirname "$SCRIPT")/../assets/memory_md_fix.md"

How it works

  • --check — for every governed file, read its cap from the file's own front-matter contract (cap_lines/cap_kb, D2) and fall back to a built-in filename → cap registry when the front-matter is absent (the D2 no-clobber carry-over case). Measure wc -l / wc -c. On any breach emit a SYSTEM FAILURE block (file, size, cap, remedy command) and exit non-zero so closeout cannot complete while a
Full SKILL.md on GitHub

Install aim-tracking-rotate in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Bash

Bundled files

assets/memory_md_fix.mdscripts/tracking_rotate.py

FAQ

What does the aim-tracking-rotate skill do?

Enforce oversight-file caps at session-close, rotate over-cap append-only-logs and registers into dated archive shards, and fix over-cap files non-interactively (including MEMORY.md lossless relocation).

How do I install the aim-tracking-rotate skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the aim-tracking-rotate skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare aim-tracking-rotate with