From session-closer
Audits and updates all AI/agent documentation files to ensure consistency and accuracy after implementation work. Covers agent definitions, skills, workflows, rules files, README, and AI-specific config files across multiple AI coding tools (Claude Code, Cursor, OpenCode, Antigravity, Gemini, GitHub Copilot). Triggers on 'sync AI docs', 'update agent files', 'check if docs are current', 'update rules files', 'ensure docs consistency', 'align AI instructions with code', or before finishing a development session. Also invoked by session-closer-agent as part of session-closing workflow.
npx claudepluginhub bartekck/bartek-marketplace --plugin session-closerThis skill uses the workspace's default tool permissions.
AI/agent documentation drifts from the actual implementation after every development session. Agent descriptions reference stale tools, skills point to files that no longer exist, rules files contradict each other, and READMEs no longer reflect current capabilities. This skill audits all AI-related documentation files and applies targeted updates to restore consistency.
Audits and syncs AI agent configuration files (CLAUDE.md, CODEX.md, AGENTS.md, .cursorrules, hooks, settings) across workspaces for drift, duplicates, and staleness.
Maintains CLAUDE.md and AGENTS.md instruction files by enforcing size limits (<300 lines), progressive disclosure via docs/ references, multi-agent compatibility, and tool-first content. Use for creation, updates, audits.
Generates, validates, and updates AGENTS.md files for AI agent onboarding to projects. Detects stacks, extracts commands/CI rules/architecture, verifies freshness and executability.
Share bugs, ideas, or general feedback.
AI/agent documentation drifts from the actual implementation after every development session. Agent descriptions reference stale tools, skills point to files that no longer exist, rules files contradict each other, and READMEs no longer reflect current capabilities. This skill audits all AI-related documentation files and applies targeted updates to restore consistency.
Core principle: Only update what the session actually changed. Leave everything else intact.
Scan the repository for all AI/agent-related documentation. Different AI tools use different file locations and formats.
| Category | Files to Find |
|---|---|
| Agent definitions | agents/*.md, agents/**/*.md |
| Skills | skills/*/SKILL.md, skills/**/*.md |
| Workflow docs | workflows/*.md, workflows/**/*.md |
| Rules / instructions | CLAUDE.md, .cursorrules, .cursor/rules/*.mdc, .github/copilot-instructions.md, GEMINI.md, .antigravity/**, .opencode/**, rules/*.md |
| README | README.md |
| Plugin manifests | .claude-plugin/plugin.json |
| Commands | commands/*.md |
| MCP config | .mcp.json |
| Memory files | ~/.claude/projects/<project>/memory/MEMORY.md, memory/**/*.md |
Glob for each pattern from the project root. Build a complete inventory before proceeding. Record which categories have files and which are empty. An empty category is not an error.
For tool-specific file formats and locations, consult the references:
references/claude-code.md — Claude Code plugin structure (agents, skills, commands, plugin.json, .mcp.json)references/cursor.md — Cursor rules and project configurationreferences/copilot.md — GitHub Copilot instructionsreferences/opencode.md — OpenCode configuration filesreferences/antigravity.md — Antigravity project setupreferences/gemini.md — Gemini instructions and configurationreferences/memory.md — Auto memory file structure, MEMORY.md index, session memoriesLoad two sources of context before beginning any audit:
Source 1 — Session memories
Check ./docs/sessions/ for session documents. Read the most recent one (highest NNN). If no session docs exist, check ~/.claude/projects/*/memory/sessions/ (legacy auto memory location; glob for all projects, match by directory name) as a fallback. Extract:
Source 2 — Git diff
Run git diff --stat HEAD~1 HEAD (or git diff --stat HEAD for unstaged changes). If HEAD~1 fails (e.g., initial commit), fall back to git diff --stat HEAD only. If the session involved multiple commits, expand the range to cover all session commits. Extract:
Combine both into a session change summary. This summary is the ground truth used throughout the audit. If the session log and git diff contradict each other, prefer the session log — it reflects decisions made, not just file changes.
Audit every file in the inventory against the session change summary. For each file, determine one of three verdicts:
CURRENT — accurately reflects current state; no changes neededUPDATE NEEDED — has confirmed staleness; apply targeted updateREVIEW — change is ambiguous or requires human judgment; surface itFor each agent file, evaluate:
For each skill file, evaluate:
references/? Confirm each still exists at the expected path.Ownership note: CLAUDE.md updates are exclusively owned by this skill. Neither the session-closer-agent nor the close-session skill modify CLAUDE.md directly.
These are the AI-tool-specific files (CLAUDE.md, .cursorrules, GEMINI.md, etc.). For each:
For each workflow file:
For each command file:
.mcp.json still reference correct names?For each memory file, evaluate:
MEMORY.md? Does every entry point to an existing file?description field specific enough to judge relevance in future conversations?After auditing individual files, check consistency across the entire documentation set:
| Check | What to Look For |
|---|---|
| Terminology | Same concept described with same terms everywhere |
| Cross-references | Links/references between files are valid and bidirectional where expected |
| Duplication | Same instructions duplicated across files — flag for consolidation |
| Contradictions | File A says "always do X", file B says "never do X" |
| Coverage gaps | A capability documented in one place but missing from related files |
Before executing any changes, produce a structured table:
| Category | File | Verdict | Reason |
|-----------------|-----------------------------------|----------------|------------------------------------------------|
| Agent | agents/my-agent.md | CURRENT | Description unchanged; no new tools added |
| Skill | skills/my-skill/SKILL.md | UPDATE NEEDED | References renamed file path |
| Rules | CLAUDE.md | UPDATE NEEDED | Missing new architectural decision |
| Rules | .cursorrules | REVIEW | May need new pattern added |
| README | README.md | UPDATE NEEDED | Capabilities section outdated |
| Manifest | .claude-plugin/plugin.json | CURRENT | Auto-discovery; no explicit list to update |
Present this table to the user. Do not execute updates silently — the table is the checkpoint before action.
For every UPDATE NEEDED item:
For every REVIEW item:
Leave CURRENT items untouched.
After updating any item, check for cascading staleness:
Apply the same verdict framework to each cascading item. Add rows to the audit table.
Before declaring sync complete, verify:
Rewriting accurate content — Only update what the session changed. If a file was accurate before and the session didn't touch its domain, leave it alone.
Treating REVIEW as UPDATE NEEDED — REVIEW exists because some changes are genuinely ambiguous. Surface these for human decision.
Missing the cascade — Updating a skill without checking which agents reference it by name is incomplete.
Auditing without session context — Load both sources (session log + git diff) before beginning the audit.
Flagging cosmetic differences — Wording that differs from implementation but still accurately describes it is not stale.
Forcing consistency where none is needed — Different AI tools have different conventions. A .cursorrules file doesn't need to match CLAUDE.md's structure — only the facts and terminology should be consistent.
Trusting reference files blindly — The reference files in references/ describe expected file formats and locations for each AI tool. If a discovered file's actual format does not match what the reference describes, treat the reference as potentially stale and audit based on the file's actual format. Reference files should be updated when discrepancies are found.
When deciding between verdicts, apply this test:
Can you identify the specific session change (from the session log or git diff) that caused this inaccuracy?
UPDATE NEEDEDREVIEWCURRENTFor AI-tool-specific file formats, locations, and conventions:
references/claude-code.md — Claude Code plugins, agents, skills, commands, .mcp.jsonreferences/cursor.md — Cursor rules (.cursorrules, .cursor/rules/*.mdc)references/copilot.md — GitHub Copilot instructionsreferences/opencode.md — OpenCode configurationreferences/antigravity.md — Antigravity project setupreferences/gemini.md — Gemini CLI and Gemini Code Assistreferences/memory.md — Auto memory file structure, MEMORY.md index, session memories