context-anti-rot-sync
Audit, prune, synchronize, and lint multi-layer codebase context files across agent configurations. Enforces Rule 11 line limits, eliminates lint leakage, and synchronizes single-source instructions. Do not use for generic prose editing or creative writing.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- context-anti-rot-sync
- description
- Audit, prune, synchronize, and lint multi-layer codebase context files across agent configurations. Enforces Rule 11 line limits, eliminates lint leakage, and synchronizes single-source instructions. Do not use for generic prose editing or creative writing.
02 资源文件 4
- 参考文档CARD.md3.8 KB
- 参考文档config.default.yaml509 B
- 脚本scripts/context_sync_cli.py5.9 KB
- 脚本scripts/context_sync_engine.py22.1 KB
03 SKILL.md 正文
Context Anti-Rot Sync: Automated Hygiene & Synchronization
context-anti-rot-sync packages the end-to-end operational workflow for maintaining codebase context health, eliminating instruction rot, pruning lint leakage, and synchronizing single-source rules across coding agent tools.
Dependencies
This workflow coordinates and reuses the following core skills:
codebase-context-governor: Orchestrates 5-stage context governance and compute tier assessment.codebase-context-architect: Provides context synchronization engines and multi-agent projection rules.agent-instruction-architect: Enforces instruction file boundaries, seam definitions, and negative constraints.compute-model-assessor: Assesses 5D complexity to calibrate reasoning budgets.
Quick Start
# Option A: One-Shot Composite Context Hygiene Execution (Recommended)
python .agents/skills/context-anti-rot-sync/scripts/context_sync_cli.py run --target AGENTS.md --output %TEMP%/context_sync_report.json
# Option B: Granular Multi-Step Execution
# 1. Audit AGENTS.md for line-count overflow (>150 lines) and lint leakage
python .agents/skills/context-anti-rot-sync/scripts/context_sync_cli.py audit --target AGENTS.md --output %TEMP%/audit_report.json
# 2. Prune redundant whitespace and enforce negative boundaries
python .agents/skills/context-anti-rot-sync/scripts/context_sync_cli.py clean --target AGENTS.md --output %TEMP%/cleaned_agents.md
# 3. Synchronize canonical instructions to secondary agents (CLAUDE.md, .cursorrules)
python .agents/skills/context-anti-rot-sync/scripts/context_sync_cli.py sync --source AGENTS.md --output %TEMP%/sync_manifest.json
# 4. Run automated anti-rot linter suite across all context files
python .agents/skills/context-anti-rot-sync/scripts/context_sync_cli.py lint --output %TEMP%/lint_results.json
Utility Scripts
The companion CLI script scripts/context_sync_cli.py delegates to context_sync_engine.py and implements both composite and modular subcommands:
run: Executes the complete context hygiene pipeline (audit, clean, sync, and workspace lint) in a single atomic pass.audit: Scans instruction files for bloat, line-count overflow (>150 lines), token budget violations, and lint leakage. Writes full diagnostic findings to--output <file.json>.clean: Applies deterministic rule trimming, eliminates tutorial prose, deduplicates whitespace, and formats command palettes. Writes cleaned file to--output <file.md>.sync: Evaluates primary manifest against derived target configs (CLAUDE.md,.cursorrules), projecting shared rules without manual copy-paste.lint: Verifies all context files against line limits, frontmatter character budgets (100–350 chars), link formats, and delimiter syntax.
Workflow Stages
Stage 1: Context Rot & Line Audit
Scan all instruction files in the workspace for Rule 11 violations (lines > 150), transient lint dumps, and conflicting command palettes.
Completion criterion: Concrete list of target line-count and smell violations cataloged in JSON audit report.
Stage 2: Deterministic Cleanse
Prune conversational narrative and redundant examples while strictly preserving execution seams (build/test/lint) and negative boundaries ("what NOT to touch").
Completion criterion: Sanitized instruction file bounded strictly within $\le 150$ lines.
Stage 3: Single-Source Synchronization
Propagate updated invariants from the canonical manifest (AGENTS.md) to secondary tool instructions without divergence or semantic drift.
Completion criterion: All derived client instruction files synchronized with zero manual editing errors.
Stage 4: Mandatory Checkpoint
Generate an interactive audit brief and review report. Author an implementation_plan.md artifact if structural edits exceed threshold, and await explicit user confirmation before applying file changes.
Completion criterion: Explicit user confirmation received before in-place modification of repository context files.
Stage 5: Automated Anti-Rot Linting
Execute continuous verification through context_sync_cli.py lint to assert that all files pass line count, frontmatter budget, and link checks.
Completion criterion: 100% linter rules pass with zero critical warnings across all repository context files.
Visual Brief
When audit findings indicate structural drift or line-count bloat $\ge 150$ lines, generate an interactive HTML status report saved to %TEMP%/context-anti-rot-review-<timestamp>.html rendering a before/after line-count comparison table and Mermaid synchronization DAG.
Anti-Patterns
- Instruction Bloat — Expanding instruction files beyond 150 lines with tutorials, generic API documentation, or prose explanations.
- Transient Lint Leakage — Pasting transient compiler errors, tracebacks, or linter reports directly into persistent instruction files.
- Manual Divergent Sync — Manually editing secondary agent files (
CLAUDE.md,.cursorrules) instead of projecting from the canonical SSOT manifest. - Bypassing Negative Boundaries — Removing explicit "what NOT to touch" sections, allowing agent edits to bleed into forbidden directories.
04 同仓库更多 Skills
ui-behavior-primitive-architect
Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA/SSR/RTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.
trustgraph-ontology-governor
Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.
shim-harness-governor
Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.
graphiti-zep-memory-governor
Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash/LSH entity dedup, RRF/MMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.
agora-mcp-workbench-architect
Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway/dispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.
skill-eval-assurance-runner
Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.