{"id":"47ac2394-2dd1-4a9a-9219-acb441bf2a41","entityType":"agent","slug":"clawhub-athola-nm-sanctum-doc-updates","name":"doc-updates","canonicalUrl":"https://www.xpersona.co/agent/clawhub-athola-nm-sanctum-doc-updates","canonicalPath":"/agent/clawhub-athola-nm-sanctum-doc-updates","generatedAt":"2026-10-10T13:33:24.770Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":null},"description":"Updates documentation after code changes with quality gates, slop detection, and accuracy checks Skill: doc-updates Owner: athola Summary: Updates documentation after code changes with quality gates, slop detection, and accuracy checks Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:20:16.228Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:40:20.663Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:57:14.019Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:05:10.289Z | user Release v1.9.14 v1.9.13 | 20","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-sanctum-doc-updates","sourceUrl":"https://clawhub.ai/athola/nm-sanctum-doc-updates","homepage":"https://clawhub.ai/athola/skills/nm-sanctum-doc-updates","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/athola/nm-sanctum-doc-updates","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/athola/skills/nm-sanctum-doc-updates","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":63,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Updates documentation after code changes with quality gates, slop detection, and accuracy checks Skill: doc-updates Owner: athola Summary: Updates documentation"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":null},"stars":null,"forks":null,"downloads":1474,"packageName":null,"latestVersion":"1.9.19","tractionLabel":"1.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T11:09:54.927Z","lastCrawledAt":"2026-10-10T11:09:54.927Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T11:09:54.927Z","lastVerifiedAt":null,"highlights":[{"version":"1.9.19","createdAt":"2026-08-26T13:20:16.228Z","changelog":"Release v1.9.19","fileCount":8,"zipByteSize":19591},{"version":"1.9.17","createdAt":"2026-07-30T05:40:20.663Z","changelog":"Release v1.9.17","fileCount":8,"zipByteSize":19445},{"version":"1.9.16","createdAt":"2026-07-14T19:57:14.019Z","changelog":"Release v1.9.16","fileCount":8,"zipByteSize":19532},{"version":"1.9.14","createdAt":"2026-06-30T18:05:10.289Z","changelog":"Release v1.9.14","fileCount":8,"zipByteSize":19489},{"version":"1.9.13","createdAt":"2026-06-27T16:23:04.082Z","changelog":"Release v1.9.13","fileCount":8,"zipByteSize":19516},{"version":"1.9.12","createdAt":"2026-06-19T03:18:26.274Z","changelog":"Release v1.9.12","fileCount":8,"zipByteSize":19513},{"version":"1.0.3","createdAt":"2026-06-18T15:20:13.796Z","changelog":"Release v1.9.12","fileCount":8,"zipByteSize":19630},{"version":"1.0.2","createdAt":"2026-05-09T02:19:49.034Z","changelog":"Release v1.9.5","fileCount":8,"zipByteSize":20374}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-sanctum-doc-updates","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T13:33:24.766Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-sanctum-doc-updates/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":null},"readme":"Skill: doc-updates\n\nOwner: athola\n\nSummary: Updates documentation after code changes with quality gates, slop detection, and accuracy checks\n\nTags: latest:1.9.19\n\nVersion history:\n\nv1.9.19 | 2026-08-26T13:20:16.228Z | user\n\nRelease v1.9.19\n\nv1.9.17 | 2026-07-30T05:40:20.663Z | user\n\nRelease v1.9.17\n\nv1.9.16 | 2026-07-14T19:57:14.019Z | user\n\nRelease v1.9.16\n\nv1.9.14 | 2026-06-30T18:05:10.289Z | user\n\nRelease v1.9.14\n\nv1.9.13 | 2026-06-27T16:23:04.082Z | user\n\nRelease v1.9.13\n\nv1.9.12 | 2026-06-19T03:18:26.274Z | user\n\nRelease v1.9.12\n\nv1.0.3 | 2026-06-18T15:20:13.796Z | user\n\nRelease v1.9.12\n\nv1.0.2 | 2026-05-09T02:19:49.034Z | user\n\nRelease v1.9.5\n\nv1.0.1 | 2026-05-06T14:21:11.655Z | user\n\nRelease v1.9.4\n\nv1.0.0 | 2026-04-15T18:01:33.479Z | auto\n\nInitial release of the doc-updates skill, providing a full workflow for updating documentation after code changes.\n\n- Introduces a step-by-step system for quality-controlled documentation updates, including context-gathering, target identification, and consolidation checks.\n- Adds strict style enforcement and AI slop detection for technical writing consistency and clarity.\n- Supports plugin and documentation version/capability synchronization with automated accuracy verification.\n- Integrates with other Night Market skills and tools for seamless documentation maintenance.\n\nArchive index:\n\nArchive v1.9.19: 8 files, 19591 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2325b), SKILL.md (13812b), _meta.json (142b)\n\nFile v1.9.19:SKILL.md\n\n---\nname: doc-updates\ndescription: |\n  Updates documentation after code changes with quality gates, slop detection, and accuracy checks\nversion: 1.9.8\ntriggers:\n  - documentation\n  - readme\n  - adr\n  - docstrings\n  - writing\n  - consolidation\n  - debloat\n  - code changes require corresponding doc updates\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.sanctum:shared\", \"night-market.sanctum:git-workspace-review\", \"night-market.imbue:proof-of-work\", \"night-market.scribe:slop-detector\", \"night-market.scribe:doc-generator\"]}}}\nsource: claude-night-market\nsource_plugin: sanctum\n---\n\n> **Night Market Skill** — ported from [claude-night-market/sanctum](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Step 1: Collect Context](#step-1-collect-context-context-collected)\n- [Step 2: Identify Targets](#step-2-identify-targets-targets-identified)\n- [Step 2.5: Check for Consolidation](#step-25-check-for-consolidation-consolidation-checked)\n- [Step 3: Apply Edits](#step-3-apply-edits-edits-applied)\n- [Step 4: Enforce Guidelines](#step-4-enforce-guidelines-guidelines-verified)\n- [Step 4.25: AI Slop Detection](#step-425-ai-slop-detection-slop-scanned)\n- [Step 4.75: Sync Capabilities Documentation](#step-475-sync-capabilities-documentation-capabilities-synced)\n- [Step 5: Verify Accuracy](#step-5-verify-accuracy-accuracy-verified)\n- [Step 6: Preview Changes](#step-6-preview-changes-preview)\n- [Exit Criteria](#exit-criteria)\n- [Flags](#flags)\n\n\n# Documentation Update Workflow\n\n## When To Use\n\nUse this skill when code changes require updates to the README, plans, wikis, or docstrings. Run `Skill(sanctum:git-workspace-review)` first to capture the change context.\n\n### System Capabilities\n\nThe documentation update workflow includes several specialized functions. It identifies redundancy through consolidation detection and enforces directory-specific style rules, with strict limits for `docs/` and more lenient ones for the `book/` directory. The system also verifies the accuracy of version numbers and component counts and integrates with the LSP for semantic documentation verification in supported versions of Claude Code.\n\n## When NOT To Use\n\n- README-specific updates - use update-readme instead\n- Complex multi-file consolidation - use doc-consolidation\n\n## Required TodoWrite Items\n\n1. `doc-updates:context-collected` - Git context + CHANGELOG review\n2. `doc-updates:targets-identified`\n3. `doc-updates:consolidation-checked` (skippable)\n4. `doc-updates:edits-applied`\n5. `doc-updates:guidelines-verified`\n6. `doc-updates:slop-scanned` - AI marker detection via scribe\n7. `doc-updates:plugins-synced` - plugin.json ↔ disk audit\n8. `doc-updates:capabilities-synced` - plugin.json ↔ documentation sync\n9. `doc-updates:accuracy-verified`\n10. `doc-updates:preview`\n\n## Step 1: Collect Context (`context-collected`)\n\n- Validate `Skill(sanctum:git-workspace-review)` has been run.\n- Use its notes to understand the delta.\n- Identify the features or bug fixes that need documentation updates.\n\n**CHANGELOG Reference** (critical for version sync):\n```bash\n# Check recent CHANGELOG entries for undocumented features\nhead -100 CHANGELOG.md\n\n# Compare documented version vs plugin versions\ngrep -E \"^\\[.*\\]\" CHANGELOG.md | head -3\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | head -5\n```\n\nCross-reference CHANGELOG entries against:\n- `book/src/reference/capabilities-reference.md` - All skills/commands/agents\n- Plugin documentation in `book/src/plugins/` - Per-plugin docs\n- Plugin READMEs - Quick reference docs\n\n## Step 2: Identify Targets (`targets-identified`)\n\n- List the relevant files from the scope across all documentation locations:\n  - `docs/` - Reference documentation (strict style)\n  - `book/` - Technical book content (lenient style)\n  - `README.md` files at project and plugin roots\n  - `wiki/` entries if present\n  - Docstrings in code files\n- Prioritize user-facing documentation first, then supporting plans and specifications.\n- When architectural work is planned, confirm whether an Architecture Decision Record (ADR) already exists in `wiki/architecture/` (or wherever ADRs are located).\n- Add missing ADRs to the target list before any implementation begins.\n\n## Step 2.5: Check for Consolidation (`consolidation-checked`)\n\nLoad: `@modules/consolidation-integration.md`\n\n**Purpose**: Detect redundancy and bloat before making edits.\n\n**Scan for:**\n- Untracked reports (ALL_CAPS *_REPORT.md, *_ANALYSIS.md files)\n- Bloated committed docs (files exceeding 500 lines in docs/, 1000 in book/)\n- Stale files (outdated content that should be deleted)\n\n**User approval required before:**\n- Merging content from one file to another\n- Deleting stale or redundant files\n- Splitting bloated files\n\n**Skip options:**\n- Use `--skip-consolidation` flag to bypass this phase\n- Select specific items instead of processing all\n\n**Exit criteria**: User has approved/skipped all consolidation opportunities.\n\n## Step 3: Apply Edits (`edits-applied`)\n\n- Update each file with grounded language: explain what changed and why.\n- Reference specific commands, filenames, or configuration options where possible.\n- For docstrings, use the imperative mood and keep them concise.\n- For ADRs, see `modules/adr-patterns.md` for complete template structure, status flow, immutability rules, and best practices.\n\n## Step 4: Enforce Guidelines (`guidelines-verified`)\n\nLoad: `@modules/directory-style-rules.md`\n\n### Style Enforcement\n\nMaintain consistent documentation by applying directory-specific rules. The system checks for and removes filler phrases such as \"in order to\" or \"it should be noted\" and ensures that no emojis are present in the body text of technical documents. Use grounded language with specific references rather than vague claims, and maintain an imperative mood for instructions. For lists of three or more items, prefer bullets over prose to improve scannability.\n\nThe audit will issue warnings for paragraphs that exceed length limits or files that surpass the established line count thresholds. We also flag marketing language and abstract adjectives like \"capable\" or \"smooth\" to maintain a technical and direct tone across all project documentation.\n\n## Step 4.25: AI Slop Detection (`slop-scanned`)\n\nRun `Skill(scribe:slop-detector)` on edited documentation to detect AI-generated content markers.\n\n### Scribe Integration\n\nThe scribe plugin provides comprehensive AI slop detection:\n\n```\nSkill(scribe:slop-detector) --target [edited-files]\n```\n\nThis detects:\n- **Tier 1 words**: delve, tapestry, comprehensive, leveraging, etc.\n- **Phrase patterns**: \"In today's fast-paced world\", \"cannot be overstated\"\n- **Structural markers**: Excessive em dashes, bullet overuse, sentence uniformity\n- **Sycophantic phrases**: \"I'd be happy to\", \"Great question!\"\n\n### Writing Style Guidelines\n\nFor enhanced writing quality, check for `elements-of-style:writing-clearly-and-concisely`:\n\n```\n# If superpowers/elements-of-style is installed:\nSkill(elements-of-style:writing-clearly-and-concisely)\n\n# Fallback if not installed - use scribe:doc-generator principles:\nSkill(scribe:doc-generator) --remediate\n```\n\nThe fallback provides equivalent guidance:\n1. Ground every claim with specifics\n2. Trim rhetorical crutches (no formulaic openers/closers)\n3. Use numbers, commands, filenames over adjectives\n4. Balance bullets with narrative prose\n5. Show authorial perspective (trade-offs, reasoning)\n\n### Remediation\n\nIf slop score exceeds 2.5 (moderate), run:\n\n```\nAgent(scribe:doc-editor) --target [file]\n```\n\nThis provides interactive section-by-section cleanup with user approval.\n\n### Skip Options\n\n- Use `--skip-slop` flag to bypass slop detection\n- Slop warnings are non-blocking by default\n\n## Step 4.5: Sync Plugin Registrations (`plugins-synced`)\n\n**Audit plugin.json files against disk** (prevents registration drift):\n\n```bash\n# Quick discrepancy check for all plugins\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  pjson=\"$plugin/.claude-plugin/plugin.json\"\n  [ -f \"$pjson\" ] || continue\n\n  # Count commands\n  json_cmds=$(jq -r '.commands | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_cmds=$(ls \"$plugin/commands/\"*.md 2>/dev/null | wc -l)\n\n  # Count skills (directories only)\n  json_skills=$(jq -r '.skills | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_skills=$(ls -d \"$plugin/skills\"/*/ 2>/dev/null | wc -l)\n\n  # Report mismatches\n  if [ \"$json_cmds\" != \"$disk_cmds\" ] || [ \"$json_skills\" != \"$disk_skills\" ]; then\n    echo \"$name: commands=$json_cmds/$disk_cmds skills=$json_skills/$disk_skills\"\n  fi\ndone\n```\n\n**If mismatches found**: Run `/update-plugins --fix` or manually update plugin.json files.\n\n**Why this matters**: Unregistered commands/skills won't appear in Claude Code's slash command menu or be discoverable.\n\n## Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nLoad: `@modules/capabilities-sync.md`\n\n**Purpose**: Ensure plugin.json registrations are reflected in reference documentation.\n\n**Sync Targets**:\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n\n**Quick Check**:\n```bash\n# Compare registered vs documented skills\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort > /tmp/registered-skills.txt\n\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md | \\\n  head -120 | awk -F'|' '{print $2\":\"$3}' | sort > /tmp/documented-skills.txt\n\n# Show missing\ncomm -23 /tmp/registered-skills.txt /tmp/documented-skills.txt\n```\n\n**If discrepancies found**:\n1. **Missing from docs**: Add entries to capabilities-reference.md tables\n2. **Missing plugin pages**: Create `book/src/plugins/{plugin}.md`\n3. **Missing from SUMMARY**: Add plugin to `book/src/SUMMARY.md`\n\n**Auto-generate entry format**:\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description} |\n```\n\n**Skip options**: Use `--skip-capabilities` to bypass this phase.\n\n## Step 5: Verify Accuracy (`accuracy-verified`)\n\nLoad: `@modules/accuracy-scanning.md`\n\n**Validate claims against codebase:**\n\n```bash\n# Quick version check\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone\n\n# Quick counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\n```\n**Verification:** Run the command with `--help` flag to verify availability.\n\n**Flag mismatches:**\n- Version numbers that don't match plugin.json\n- Plugin/skill/command counts that don't match actual directories\n- File paths that don't exist\n\n**LSP-Enhanced Verification (2.0.74+)**:\n\nWhen `ENABLE_LSP_TOOL=1` is set, enhance accuracy verification with semantic analysis:\n\n1. **API Documentation Coverage**:\n   - Query LSP for all public functions/classes\n   - Check which lack documentation\n   - Verify all exported items are documented\n\n2. **Signature Verification**:\n   - Compare documented function signatures with actual code\n   - Detect parameter mismatches\n   - Flag return type discrepancies\n\n3. **Reference Finding**:\n   - Use LSP to find all usages of documented items\n   - Include real usage examples in documentation\n   - Verify cross-references are accurate\n\n4. **Code Structure Validation**:\n   - Check documented file paths exist (via LSP definitions)\n   - Verify module organization matches documentation\n   - Detect renamed/moved items\n\n**Efficiency**: LSP queries (50ms) vs. manual file tracing (minutes) - dramatically faster verification.\n\n**Default Strategy**: Documentation updates should **prefer LSP** for all verification tasks. Enable `ENABLE_LSP_TOOL=1` permanently for best results.\n\n**Non-blocking**: Warnings are informational; user decides whether to fix.\n\n## Step 6: Preview Changes (`preview`)\n\n- Show diffs for each edited file (`git diff <file>` or `rg` snippets).\n- Include accuracy warnings if any were flagged.\n- Summarize:\n  - Files created/modified/deleted\n  - Consolidation actions taken\n  - Style violations fixed\n  - Remaining TODOs or follow-ups\n\n## Exit Criteria\n\n- All `TodoWrite` items are completed and documentation is updated.\n- New ADRs, if any, are in `wiki/architecture/` (or the established ADR directory) with the correct status and links to related work.\n- Directory-specific style rules are satisfied.\n- Accuracy warnings addressed or acknowledged.\n- Content does not sound AI-generated.\n- Files are staged or ready for review.\n\n## Flags\n\n| Flag | Effect |\n|------|--------|\n| `--skip-consolidation` | Skip Phase 2.5 consolidation check |\n| `--skip-slop` | Skip Phase 4.25 AI slop detection |\n| `--strict` | Treat all warnings as errors |\n| `--book-style` | Apply book/ rules to all files |\n## Troubleshooting\n\n### Common Issues\n\n**Documentation out of sync**\nRun `make docs-update` to regenerate from code\n\n**Build failures**\nCheck that all required dependencies are installed\n\n**Links broken**\nVerify relative paths in documentation files\n\nFile v1.9.19:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-sanctum-doc-updates\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787750416228\n}\n\nFile v1.9.19:modules/accuracy-scanning.md\n\n# Accuracy Scanning Module\n\nValidate documentation claims against actual codebase state. Runs as Phase 5.5 before preview to catch stale version numbers, outdated counts, and broken references.\n\n## Scan Types\n\n### 1. Version Number Validation\n\nCompares version references in documentation against `plugin.json` files.\n\n**Patterns to detect:**\n- `v1.2.3`, `version: 1.2.3`\n- `Plugin Name (v1.2.3)`, `Plugin Name v1.2.3`\n- Table cells with version numbers\n\n**Validation:**\n```bash\n# Extract actual versions\nfor plugin in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '.name + \" \" + .version' \"$plugin\"\ndone\n\n# Sample output:\n# abstract 1.0.5\n# sanctum 1.0.6\n# scry 1.1.0\n```\n\n**Warning format:**\n```markdown\n| File | Claimed | Actual | Action |\n|------|---------|--------|--------|\n| docs/api-overview.md | abstract v2.1.0 | 1.0.5 | Update version |\n| README.md | sanctum v3.0.0 | 1.0.6 | Update version |\n```\n\n### 2. Plugin Count Validation\n\nVerifies claims like \"13 plugins\" against actual directory count.\n\n**Patterns to detect:**\n- \"N plugins\", \"contains N plugins\"\n- Table rows claiming to list all plugins\n\n**Validation:**\n```bash\n# Count plugin directories with valid plugin.json\nls -d plugins/*/.claude-plugin/plugin.json 2>/dev/null | wc -l\n```\n\n### 3. Skill/Command Count Validation\n\nVerifies per-plugin statistics.\n\n**Patterns to detect:**\n- \"X skills\", \"Y commands\", \"Z agents\"\n- API inventory tables\n\n**Validation:**\n```bash\n# Count skills for a plugin\nls -d plugins/sanctum/skills/*/SKILL.md 2>/dev/null | wc -l\n\n# Count commands\nls plugins/sanctum/commands/*.md 2>/dev/null | wc -l\n\n# Count agents\nls plugins/sanctum/agents/*.md 2>/dev/null | wc -l\n```\n\n### 4. File/Path Reference Validation\n\nVerifies that referenced paths exist.\n\n**Patterns to detect:**\n- Backtick paths: `` `plugins/sanctum/skills/doc-updates/SKILL.md` ``\n- Relative paths in links: `[link](./modules/foo.md)`\n- Configuration examples with paths\n\n**Validation:**\n```bash\n# Check if path exists\ntest -e \"$path\" && echo \"EXISTS\" || echo \"MISSING\"\n```\n\n## Scan Algorithm\n\n```python\ndef scan_for_accuracy(file_path: str, content: str) -> list[AccuracyWarning]:\n    warnings = []\n\n    # Load current plugin versions\n    actual_versions = load_plugin_versions()\n\n    # Find version references\n    version_pattern = r'(\\w+)[\\s\\(]v?(\\d+\\.\\d+\\.\\d+)'\n    for match in re.finditer(version_pattern, content):\n        plugin_name = match.group(1).lower()\n        claimed_version = match.group(2)\n\n        if plugin_name in actual_versions:\n            actual = actual_versions[plugin_name]\n            if claimed_version != actual:\n                warnings.append({\n                    'type': 'version_mismatch',\n                    'plugin': plugin_name,\n                    'claimed': claimed_version,\n                    'actual': actual,\n                    'line': get_line_number(content, match.start())\n                })\n\n    # Find count claims\n    count_pattern = r'(\\d+)\\s+(plugins?|skills?|commands?|agents?)'\n    for match in re.finditer(count_pattern, content, re.IGNORECASE):\n        claimed_count = int(match.group(1))\n        item_type = match.group(2).lower().rstrip('s')\n        actual_count = count_items(item_type)\n\n        if abs(claimed_count - actual_count) > 0:\n            warnings.append({\n                'type': 'count_mismatch',\n                'item_type': item_type,\n                'claimed': claimed_count,\n                'actual': actual_count,\n                'line': get_line_number(content, match.start())\n            })\n\n    return warnings\n```\n\n## Quick Validation Commands\n\nFor manual verification during doc updates:\n\n```bash\n# All plugin versions\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | sort\n\n# Total counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\necho \"Commands: $(find plugins/*/commands -maxdepth 1 -name '*.md' | wc -l)\"\necho \"Agents: $(find plugins/*/agents -name '*.md' | wc -l)\"\n```\n\n## Output Format\n\n### Phase 5.5: Verify Accuracy\n\n```markdown\n## Accuracy Scan Results\n\nScanned: docs/api-overview.md, README.md (2 files)\nTime: 0.3 seconds\n\n### Warnings Found\n\n| Type | File | Line | Issue | Fix |\n|------|------|------|-------|-----|\n| version | docs/api-overview.md | 15 | abstract v2.1.0 → 1.0.5 | Update |\n| version | docs/api-overview.md | 18 | sanctum v3.0.0 → 1.0.6 | Update |\n| count | README.md | 42 | \"11 plugins\" → 13 | Update |\n\n### No Issues\n- All file paths valid\n- Command references exist\n\n**Action**: Review warnings before proceeding to preview.\n```\n\n## Integration Notes\n\n- Non-blocking: Warnings don't prevent workflow completion\n- Selective: Only scans files being edited (from Phase 2 targets)\n- Fast: Bash commands complete in <1 second per file\n- Progressive: Loads only when Phase 5 edits are complete\n\n## Cross-Reference: /update-version\n\nWhen version bumps are performed via `/update-version`, the automated script updates config files but NOT documentation. The `/update-version` command includes Phase 2 to update documentation files. If you're running `/update-docs` after a version bump, pay special attention to `docs/api-overview.md` which contains the plugin version inventory.\n\n## Edge Cases\n\n### Approximate counts\nSome docs use \"~10 skills\" or \"about 50 commands\". These should be validated but with wider tolerance (±20%).\n\n### Unreleased versions\nIf a plugin shows \"0.0.0\" or \"dev\", skip version validation for that plugin.\n\n### External references\nPaths outside the repository (URLs, system paths) are not validated.\n\nFile v1.9.19:modules/adr-patterns.md\n\n# Architecture Decision Record (ADR) Patterns\n\n## ADR Template Structure\n\nEvery ADR must follow a consistent Markdown template with these required sections:\n\n### Required Sections\n\n1. **Title**\n   - Format: `ADR-{number}: {Brief Decision Description}`\n   - Example: `ADR-001: Use PostgreSQL for primary data store`\n\n2. **Status**\n   - One of: Proposed, Accepted, Deprecated, Superseded\n   - Include date when status changed\n\n3. **Context**\n   - Forces driving the decision\n   - Constraints that must be satisfied\n   - Prior art or existing patterns\n   - Why this decision is needed now\n\n4. **Decision**\n   - The chosen option with clear justification\n   - Specific implementation approach\n   - Rationale for why this solves the context\n\n5. **Alternatives Considered**\n   - Other options evaluated\n   - Why each alternative was rejected\n   - Trade-offs between options\n\n6. **Consequences**\n   - Positive outcomes expected\n   - Negative outcomes or limitations\n   - Impact on other components or teams\n   - Future implications\n\n7. **Metadata**\n   - Author(s)\n   - Date created\n   - Approvers (if required)\n   - Links to related documents\n\n## Status Flow\n\nADRs follow this lifecycle:\n\n```\nProposed → Accepted → [Deprecated | Superseded]\n```\n\n- **Proposed**: Draft ADR under review\n- **Accepted**: Decision approved and implemented\n- **Deprecated**: No longer recommended but not replaced\n- **Superseded**: Replaced by a newer ADR (reference the new ADR number)\n\n## Immutability Rules\n\nADRs are treated like code:\n\n1. **Draft during planning**: Create ADR before implementation begins\n2. **Review via pull request**: ADRs go through same review process as code\n3. **Immutable once accepted**: Never edit an accepted ADR's decision\n4. **Supersede, don't modify**: Create new ADR to change direction\n\n## Superseding an ADR\n\nWhen replacing an existing decision:\n\n1. Create new ADR with next sequential number\n2. Reference the superseded ADR number in context\n3. Explain what changed and why the shift occurred\n4. Update old ADR status to \"Superseded by ADR-{new-number}\"\n5. Add link in old ADR to new record\n\n## Location Conventions\n\nADRs typically are in one of these locations:\n- `wiki/architecture/`\n- `docs/adr/`\n- `architecture/decisions/`\n\nCheck project structure to determine the established location before creating ADRs.\n\n## Best Practices\n\n### Keep Focused\n- One architectural decision per ADR\n- Maximum 1-2 pages in length\n- Don't combine multiple decisions\n\n### Maintain Traceability\n- Link to requirements documents\n- Reference design documents\n- Connect to related ADRs\n- Include issue/ticket numbers\n\n### Write Grounded Content\n- Reference specific technologies, tools, or approaches\n- Include concrete examples where helpful\n- Avoid abstract language or filler\n- Use imperative mood for clarity\n\n### Review Checklist\n- [ ] Single focused decision\n- [ ] All required sections present\n- [ ] Alternatives documented with rationale\n- [ ] Consequences (both positive and negative) identified\n- [ ] Links to related work included\n- [ ] Status clearly marked\n- [ ] Location follows project convention\n\nFile v1.9.19:modules/capabilities-sync.md\n\n# Capabilities Sync Module\n\nSynchronizes plugin.json registrations with capabilities reference documentation.\n\n## Purpose\n\nDetects drift between:\n- **Source of truth**: `plugins/*/.claude-plugin/plugin.json` files\n- **Documentation**: `book/src/reference/capabilities-reference.md` and related files\n\n## When Loaded\n\nThis module is loaded during Step 4.75 (after plugins-synced, before accuracy-verified).\n\n## Sync Targets\n\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` (Skills table) |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` (Commands table) |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` (Agents table) |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` (Hooks table) |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n| Plugin in layer | `book/src/plugins/{layer}-layer.md` |\n| Plugin in SUMMARY | `book/src/SUMMARY.md` |\n\n## Detection Script\n\n```bash\n#!/bin/bash\n# capabilities-sync-check.sh\n# Run from repo root\n\necho \"=== Capabilities Sync Report ===\"\necho \"\"\n\n# Temporary files for comparison\nREGISTERED_SKILLS=$(mktemp)\nDOCUMENTED_SKILLS=$(mktemp)\nREGISTERED_COMMANDS=$(mktemp)\nDOCUMENTED_COMMANDS=$(mktemp)\nREGISTERED_AGENTS=$(mktemp)\nDOCUMENTED_AGENTS=$(mktemp)\n\n# Extract registered skills from plugin.json files\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_SKILLS\"\n\n# Extract documented skills from capabilities-reference.md\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Skills/,/All Commands/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/.*\\(\\.\\.\\/plugins\\//, \"\", $3); gsub(/\\.md\\).*/, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_SKILLS\"\n\n# Extract registered commands\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.commands[]? | sub(\"^\\\\./commands/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"/\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_COMMANDS\"\n\n# Extract documented commands\ngrep -E \"^\\| \\`/\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Commands/,/All Agents/p' | \\\n  grep -E \"^\\| \\`/\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $2}' | \\\n  sort -u > \"$DOCUMENTED_COMMANDS\"\n\n# Extract registered agents\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.agents[]? | sub(\"^\\\\./agents/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_AGENTS\"\n\n# Extract documented agents\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Agents/,/All Hooks/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_AGENTS\"\n\n# Report differences\necho \"### Skills\"\necho \"Missing from docs (registered but not documented):\"\ncomm -23 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs (documented but not registered):\"\ncomm -13 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Commands\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Agents\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\n\n# Check for missing plugin pages in book\necho \"\"\necho \"### Plugin Pages\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if [ ! -f \"book/src/plugins/${name}.md\" ]; then\n    echo \"  - Missing: book/src/plugins/${name}.md\"\n  fi\ndone\n\n# Check SUMMARY.md includes all plugins\necho \"\"\necho \"### SUMMARY.md\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if ! grep -q \"plugins/${name}.md\" book/src/SUMMARY.md 2>/dev/null; then\n    echo \"  - Missing from SUMMARY: ${name}\"\n  fi\ndone\n\n# Cleanup\nrm -f \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\"\n```\n\n## Workflow Integration\n\n### Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nAfter `plugins-synced` (Step 4.5), run capabilities sync:\n\n```bash\n# Quick check for capabilities drift\nbash plugins/sanctum/skills/doc-updates/modules/capabilities-sync-check.sh\n```\n\n**If discrepancies found:**\n\n1. **Missing skills/commands/agents**: Generate table entries\n2. **Extra in docs**: Verify if removed or renamed\n3. **Missing plugin pages**: Create from template\n4. **Missing from SUMMARY**: Add to appropriate layer\n\n### Auto-Generation Templates\n\n#### Skill Entry\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description from SKILL.md frontmatter} |\n```\n\n#### Command Entry\n```markdown\n| `/{plugin}:{command}` | {plugin} | {description from command.md frontmatter} |\n```\n\n#### Agent Entry\n```markdown\n| `{agent-name}` | {plugin} | {description from agent.md frontmatter} |\n```\n\n#### Hook Entry\n```markdown\n| `{hook-file}` | {plugin} | {type} | {description} |\n```\n\n## Capabilities Sync Check\n\nTool: `scripts/capabilities-sync-check.sh` (invoked by\n`make docs-sync-check` and the `.github/workflows/capabilities-sync.yml`\nCI job).\n\nCompares skills/commands/agents registered in\n`plugins/*/.claude-plugin/plugin.json` against the tables in\n`book/src/reference/capabilities-reference.md`. Reports any items\npresent in `plugin.json` but missing from the doc, and vice versa.\n\n### CLI Usage\n\n```bash\n# Run the sync check (read-only)\nbash scripts/capabilities-sync-check.sh\n\n# Or via make\nmake docs-sync-check\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | All registered capabilities appear in the doc |\n| 1 | Discrepancies found |\n\n### Fixing Discrepancies\n\nThe check is read-only. When it reports a missing entry:\n\n1. Open `book/src/reference/capabilities-reference.md`\n2. Locate the relevant section (e.g. `### All skills (Alphabetical)`)\n3. Add a row using the same `| `name` | plugin | description |` shape\n   already present in the table\n4. Re-run the check to confirm\n\nWhen the check reports an extra entry (in the doc but not in any\n`plugin.json`), either re-register the item in the plugin's\n`plugin.json` or remove the row from the doc.\n\n## Exit Criteria\n\n- All registered capabilities appear in documentation\n- No orphaned documentation entries (items removed from plugin.json)\n- All plugins have book pages\n- SUMMARY.md is complete\n\nFile v1.9.19:modules/consolidation-integration.md\n\n# Consolidation Integration Module\n\nBridges doc-updates with doc-consolidation capabilities. Detects redundancy and bloat in existing documentation, presenting consolidation opportunities before edits begin.\n\n## Purpose\n\nDuring Phase 2.5, scan for:\n1. **Redundant files**: Multiple docs covering the same topic\n2. **Bloated files**: Docs exceeding recommended length thresholds\n3. **Stale files**: Documentation that should be deleted or archived\n4. **Untracked reports**: LLM-generated files that need consolidation\n\n## Detection Approach\n\n### Reuse from doc-consolidation\n\nImport candidate detection logic from `sanctum:doc-consolidation`:\n- Git-untracked file detection\n- ALL_CAPS naming pattern matching\n- Content marker scanning (Executive Summary, Findings, etc.)\n\n### Additional Signals for Committed Files\n\nExtend detection to analyze committed documentation:\n\n**Bloat signals:**\n- `docs/`: File exceeds 500 lines, section exceeds 150 lines\n- `book/`: File exceeds 1000 lines, section exceeds 300 lines\n- Multiple \"wall of text\" paragraphs (>4 sentences in docs/, >8 in book/)\n\n**Redundancy signals:**\n- Similar file names: `api-overview.md` vs `api-reference.md`\n- Similar headings across files\n- Overlapping content sections (manual inspection)\n- Design docs whose content exists in command/skill documentation\n- Planning artifacts for completed work (already implemented)\n\n**Redundancy check command:**\n```bash\n# For a candidate file, check if content exists elsewhere\ngrep -r \"key phrase from candidate\" docs/ book/ plugins/*/commands/*.md plugins/*/README.md\n```\n\n**Staleness signals:**\n- References to deprecated features\n- Version numbers more than 2 minor versions behind\n- \"TODO: update\" comments older than 30 days\n\n## Workflow\n\n### Step 1: Scan for Candidates\n\n```bash\n# Find untracked .md files (doc-consolidation pattern)\ngit status --porcelain | grep '^??' | grep '\\.md$' | grep -v 'docs/\\|book/\\|skills/\\|commands/\\|agents/'\n\n# Find bloated docs/ files (500 line limit)\nfind docs/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 500 {print}'\n\n# Find bloated book/ files (1000 line limit)\nfind book/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 1000 {print}'\n\n# Find recently unchanged files (potential staleness) - docs: 90 days, book: 180 days\nfind docs/ -name '*.md' -mtime +90 -type f 2>/dev/null\nfind book/ -name '*.md' -mtime +180 -type f 2>/dev/null\n```\n\n### Step 2: Present Opportunities\n\nShow consolidation candidates with recommended actions:\n\n```markdown\n## Phase 2.5: Consolidation Opportunities\n\n### Redundant Files (delete - content exists elsewhere)\n\n| File | Action | Reason |\n|------|--------|--------|\n| plugins/memory-palace/docs/PALACE_UNIFICATION.md | Delete | Content already in commands/palace.md |\n| docs/old-api-design.md | Delete | Superseded by docs/api-overview.md |\n\n### Untracked Reports (merge or delete)\n\n| File | Score | Markers | Recommendation |\n|------|-------|---------|----------------|\n| API_REVIEW_REPORT.md | 6 | Executive Summary, Findings | Merge to docs/api-overview.md |\n| MIGRATION_NOTES.md | 4 | Action Items, Tables | Merge to docs/migration-guide.md |\n\n### Bloated Files (split or trim)\n\n| File | Lines | Threshold | Recommendation |\n|------|-------|-----------|----------------|\n| book/src/tutorials/error-handling-tutorial.md | 1031 | 1000 | Trim verbose sections |\n| docs/function-extraction-guidelines.md | 571 | 500 | Consider splitting principles/patterns |\n\n### Staleness Candidates (review or delete)\n\n| File | Last Modified | Issue | Recommendation |\n|------|---------------|-------|----------------|\n| docs/enhanced-pre-commit-hooks.md | 45 days | Content moved to imbue | Delete |\n| docs/technical-debt-framework.md | 60 days | Replaced by backlog | Delete |\n\n---\n\n**Options:**\n- `Y` - Proceed with all recommended actions\n- `n` - Skip consolidation, continue to edits\n- `select` - Choose specific items to address\n- `--skip-consolidation` flag bypasses this phase\n```\n\n### Step 3: Execute Approved Actions\n\nFor each approved action:\n\n**Delete (redundant) actions:**\n1. Verify content exists in target document(s) by searching for key phrases\n2. Confirm no unique valuable content would be lost\n3. Remove file: `rm <file>`\n4. Add deletion to git staging: `git add -u`\n\n**Merge actions:**\n1. Extract valuable content from source\n2. Integrate into destination (using doc-consolidation merge strategies)\n3. Delete source file\n4. Add to git staging\n\n**Delete (stale) actions:**\n1. Confirm file has no unique valuable content\n2. Remove file\n3. Add deletion to git staging\n\n**Split actions:**\n1. Create new files for logical sections\n2. Move content to new locations\n3. Update cross-references\n4. Preserve original as index if needed\n\n**Action priority:**\n1. Delete redundant first (unbloats without adding content)\n2. Delete stale second (removes outdated info)\n3. Merge third (consolidates remaining value)\n4. Split last (increases file count, use sparingly)\n\n## User Controls\n\n### Skip Flag\n```bash\n/update-docs --skip-consolidation\n```\nBypasses Phase 2.5 entirely for quick updates.\n\n### Selective Processing\nWhen user chooses \"select\":\n```\nEnter file numbers to process (comma-separated), or 'all'/'none':\n> 1,3\nProcessing: API_REVIEW_REPORT.md, docs/enhanced-pre-commit-hooks.md\n```\n\n### Dry Run\n```bash\n/update-docs --consolidation-dry-run\n```\nShows what would be consolidated without executing.\n\n## Thresholds\n\n| Metric | docs/ Limit | book/ Limit | Action |\n|--------|-------------|-------------|--------|\n| File length | 500 lines | 1000 lines | Flag for review |\n| Section length | 150 lines | 300 lines | Suggest split |\n| Paragraph sentences | 4 | 8 | Warn, don't block |\n| Stale threshold | 90 days | 180 days | Review suggestion |\n\n## Integration with doc-consolidation\n\nThis module **imports** patterns from doc-consolidation but **does not** duplicate its full workflow:\n\n- **Imports**: Candidate detection signals, content markers, scoring\n- **Extends**: Adds bloat and staleness detection for committed files\n- **Defers to**: Full doc-consolidation skill for complex multi-file merges\n\nFor straightforward cases (single untracked report, obvious deletion), handle inline. For complex consolidations, recommend: \"Run `/merge-docs` for detailed consolidation workflow.\"\n\n## Exit Criteria\n\nPhase 2.5 completes when:\n- All candidates reviewed (approved or skipped)\n- Approved merges/deletions executed\n- Git staging updated with changes\n- Summary logged for Phase 5 preview\n\nProceed to Phase 3 (Edits Applied) regardless of consolidation outcome.\n\nFile v1.9.19:modules/directory-style-rules.md\n\n# Directory-Specific Style Rules\n\nApply different documentation standards based on file location. The `docs/` directory requires strict conciseness while `book/` allows technical book format with longer explanations.\n\n## Rule Sets\n\n### docs/ - Strict Reference Style\n\nTarget audience: Developers seeking quick answers.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Keeps files navigable |\n| Max section length | 100 lines | Forces topic focus |\n| Max paragraph sentences | 4 | Prevents wall-of-text |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Start directly (no \"This document describes...\")\n- Imperative mood for instructions\n- Bullets over prose for lists of 3+ items\n- Code examples over abstract descriptions\n\n**Anti-patterns to flag:**\n- Executive summaries (remove or move to introduction)\n- Filler phrases: \"in order to\", \"it should be noted\", \"as mentioned\"\n- Qualification hedging: \"generally\", \"typically\", \"usually\"\n- Empty transitions: \"Moving on\", \"Now let's look at\"\n\n### book/ - Technical Book Style\n\nTarget audience: Learners working through chapters.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 1000 lines | Chapter-length content |\n| Max section length | 300 lines | Tutorial depth allowed |\n| Max paragraph sentences | 8 | Explanatory narratives |\n| Max list items | 15 | Subgroup for clarity |\n| Max table rows | 25 | Comparison tables |\n\n**Allowed patterns:**\n- Narrative explanations\n- Before/after comparisons\n- Step-by-step walkthroughs\n- Conceptual introductions\n- Callout emojis (sparingly)\n\n**Still flagged:**\n- Filler phrases\n- Redundant explanations\n- Overly long code blocks without commentary\n\n### wiki/ - Wiki Reference Style\n\nTarget audience: Internal team and contributors seeking context.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Quick reference |\n| Max section length | 100 lines | Topic focus |\n| Max paragraph sentences | 4 | Scannable |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Same as docs/ strict style\n- Cross-links to related wiki pages\n- Architecture Decision Records (ADRs) in wiki/architecture/\n\n### plugins/*/README.md - Plugin Summary Style\n\nTarget audience: Users evaluating or installing plugins.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 300 lines | Concise overview |\n| Max section length | 50 lines | Quick scan |\n| Max paragraph sentences | 4 | Brief descriptions |\n| Max list items | 10 | Key features only |\n| Max table rows | 15 | Command/skill listing |\n\n**Required patterns:**\n- Installation instructions\n- Quick start example\n- Link to detailed docs in book/\n\n### Shared Rules (All Locations)\n\nApply everywhere regardless of directory:\n\n- No emojis in headings or body (callouts excepted in book/)\n- Grounded language (specific references, not vague claims)\n- Imperative mood for docstrings\n- No marketing language (\"capable\", \"smooth\", \"elegant\")\n- No first-person plural (\"we can see\", \"let's explore\")\n- Prose text wraps at 80 chars per line (hybrid wrapping:\n  prefer sentence/clause boundaries over arbitrary breaks)\n- Blank line before and after every heading\n- ATX headings only (`#` prefix, never setext underlines)\n- Blank line before every list (ordered or unordered)\n- Reference-style links when inline links push past 80 chars\n- Full formatting spec: `Skill(leyline:markdown-formatting)`\n\n## Detection Patterns\n\n### Wall-of-Text Detection\n\n```python\ndef detect_wall_of_text(content: str, max_sentences: int) -> list[Violation]:\n    violations = []\n    paragraphs = extract_paragraphs(content)\n\n    for i, para in enumerate(paragraphs):\n        sentence_count = len(re.split(r'[.!?]+', para.strip()))\n        if sentence_count > max_sentences:\n            violations.append({\n                'type': 'wall_of_text',\n                'location': f'paragraph {i+1}',\n                'actual': sentence_count,\n                'limit': max_sentences,\n                'suggestion': 'Break into smaller paragraphs or convert to bullet list'\n            })\n\n    return violations\n```\n\n### Filler Phrase Detection\n\n```python\nFILLER_PHRASES = [\n    r'\\bin order to\\b',\n    r'\\bit should be noted\\b',\n    r'\\bas mentioned (above|below|earlier|previously)\\b',\n    r'\\bmoving on\\b',\n    r'\\bnow let\\'?s (look at|explore|consider)\\b',\n    r'\\bthis (document|section|chapter) (describes|explains|covers)\\b',\n]\n\ndef detect_filler(content: str) -> list[Violation]:\n    violations = []\n    for pattern in FILLER_PHRASES:\n        matches = re.findall(pattern, content, re.IGNORECASE)\n        for match in matches:\n            violations.append({\n                'type': 'filler_phrase',\n                'phrase': match,\n                'suggestion': 'Remove or rewrite directly'\n            })\n    return violations\n```\n\n## Validation Workflow\n\n### Step 1: Determine Rule Set\n\n```python\ndef get_ruleset(file_path: str) -> RuleSet:\n    if file_path.startswith('book/'):\n        return BOOK_RULES\n    elif file_path.startswith('docs/'):\n        return DOCS_RULES\n    elif file_path.startswith('wiki/'):\n        return WIKI_RULES\n    elif re.match(r'plugins/[^/]+/README\\.md$', file_path):\n        return PLUGIN_README_RULES\n    else:\n        return DOCS_RULES  # Default to strict\n```\n\n### Step 2: Run Checks\n\n```python\ndef validate_file(file_path: str, content: str) -> ValidationResult:\n    rules = get_ruleset(file_path)\n    violations = []\n\n    # Structure checks\n    lines = content.split('\\n')\n    if len(lines) > rules.max_lines:\n        violations.append({\n            'severity': 'warning',\n            'type': 'file_length',\n            'actual': len(lines),\n            'limit': rules.max_lines\n        })\n\n    # Wall-of-text check\n    violations.extend(detect_wall_of_text(content, rules.max_sentences))\n\n    # Filler phrase check\n    violations.extend(detect_filler(content))\n\n    return ValidationResult(\n        file_path=file_path,\n        ruleset=rules.name,\n        violations=violations,\n        passed=len([v for v in violations if v.get('severity') == 'error']) == 0\n    )\n```\n\n### Step 3: Report Format\n\n```markdown\n## Style Validation: docs/api-overview.md\n\nUsing ruleset: **docs/ (strict)**\n\n### Violations Found\n\n| Severity | Type | Details | Suggestion |\n|----------|------|---------|------------|\n| warning | wall_of_text | Paragraph 3 has 7 sentences (limit: 4) | Break into smaller paragraphs |\n| info | filler_phrase | \"in order to\" | Remove or rewrite directly |\n| info | filler_phrase | \"This document describes\" | Start with content directly |\n\n### Passed Checks\n- File length: 287/500 lines\n- Section lengths: All under 100 lines\n- No marketing language detected\n```\n\n## Progressive Loading\n\nThis module loads only when Phase 4 (Guidelines Verified) is reached. It does not run during earlier phases to conserve context.\n\n**Load trigger**: `doc-updates:edits-applied` completed\n**Dependencies**: None\n\nFile v1.9.19:skill-card.md\n\n## Description:\n\nUpdates documentation after code changes with quality gates, slop detection, and accuracy checks.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[athola](https://clawhub.ai/user/athola)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and documentation maintainers use this skill after code changes to update READMEs, wikis, docstrings, ADRs, and reference documentation while checking style, accuracy, and capability drift.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can make broad documentation changes across a repository.\n\nMitigation: Review the target file list and diffs before accepting edits.\n\nRisk: Consolidation steps may delete, merge, split, or stage documentation files when approved.\n\nMitigation: Approve cleanup actions explicitly and confirm that no unique content is lost before deletion or staging.\n\nRisk: Generated documentation may contain stale counts, versions, paths, or capability listings.\n\nMitigation: Run the skill's accuracy and capability sync checks, then resolve reported mismatches before release.\n\nRisk: The workflow is tuned for codebase documentation and may be inappropriate for generic writing tasks.\n\nMitigation: Use it only for repository documentation maintenance after code changes.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-sanctum-doc-updates)\n- [OpenClaw homepage metadata](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown with inline shell commands, documentation edits, review summaries, and configuration snippets]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May propose or apply repository documentation edits, ADR changes, consolidation actions, accuracy checks, and git review steps.]\n\n## Skill Version(s):\n\n1.9.19 (source: server release evidence; artifact frontmatter shows 1.9.8)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.9.17: 8 files, 19445 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2034b), SKILL.md (13812b), _meta.json (142b)\n\nFile v1.9.17:SKILL.md\n\n---\nname: doc-updates\ndescription: |\n  Updates documentation after code changes with quality gates, slop detection, and accuracy checks\nversion: 1.9.8\ntriggers:\n  - documentation\n  - readme\n  - adr\n  - docstrings\n  - writing\n  - consolidation\n  - debloat\n  - code changes require corresponding doc updates\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.sanctum:shared\", \"night-market.sanctum:git-workspace-review\", \"night-market.imbue:proof-of-work\", \"night-market.scribe:slop-detector\", \"night-market.scribe:doc-generator\"]}}}\nsource: claude-night-market\nsource_plugin: sanctum\n---\n\n> **Night Market Skill** — ported from [claude-night-market/sanctum](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Step 1: Collect Context](#step-1-collect-context-context-collected)\n- [Step 2: Identify Targets](#step-2-identify-targets-targets-identified)\n- [Step 2.5: Check for Consolidation](#step-25-check-for-consolidation-consolidation-checked)\n- [Step 3: Apply Edits](#step-3-apply-edits-edits-applied)\n- [Step 4: Enforce Guidelines](#step-4-enforce-guidelines-guidelines-verified)\n- [Step 4.25: AI Slop Detection](#step-425-ai-slop-detection-slop-scanned)\n- [Step 4.75: Sync Capabilities Documentation](#step-475-sync-capabilities-documentation-capabilities-synced)\n- [Step 5: Verify Accuracy](#step-5-verify-accuracy-accuracy-verified)\n- [Step 6: Preview Changes](#step-6-preview-changes-preview)\n- [Exit Criteria](#exit-criteria)\n- [Flags](#flags)\n\n\n# Documentation Update Workflow\n\n## When To Use\n\nUse this skill when code changes require updates to the README, plans, wikis, or docstrings. Run `Skill(sanctum:git-workspace-review)` first to capture the change context.\n\n### System Capabilities\n\nThe documentation update workflow includes several specialized functions. It identifies redundancy through consolidation detection and enforces directory-specific style rules, with strict limits for `docs/` and more lenient ones for the `book/` directory. The system also verifies the accuracy of version numbers and component counts and integrates with the LSP for semantic documentation verification in supported versions of Claude Code.\n\n## When NOT To Use\n\n- README-specific updates - use update-readme instead\n- Complex multi-file consolidation - use doc-consolidation\n\n## Required TodoWrite Items\n\n1. `doc-updates:context-collected` - Git context + CHANGELOG review\n2. `doc-updates:targets-identified`\n3. `doc-updates:consolidation-checked` (skippable)\n4. `doc-updates:edits-applied`\n5. `doc-updates:guidelines-verified`\n6. `doc-updates:slop-scanned` - AI marker detection via scribe\n7. `doc-updates:plugins-synced` - plugin.json ↔ disk audit\n8. `doc-updates:capabilities-synced` - plugin.json ↔ documentation sync\n9. `doc-updates:accuracy-verified`\n10. `doc-updates:preview`\n\n## Step 1: Collect Context (`context-collected`)\n\n- Validate `Skill(sanctum:git-workspace-review)` has been run.\n- Use its notes to understand the delta.\n- Identify the features or bug fixes that need documentation updates.\n\n**CHANGELOG Reference** (critical for version sync):\n```bash\n# Check recent CHANGELOG entries for undocumented features\nhead -100 CHANGELOG.md\n\n# Compare documented version vs plugin versions\ngrep -E \"^\\[.*\\]\" CHANGELOG.md | head -3\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | head -5\n```\n\nCross-reference CHANGELOG entries against:\n- `book/src/reference/capabilities-reference.md` - All skills/commands/agents\n- Plugin documentation in `book/src/plugins/` - Per-plugin docs\n- Plugin READMEs - Quick reference docs\n\n## Step 2: Identify Targets (`targets-identified`)\n\n- List the relevant files from the scope across all documentation locations:\n  - `docs/` - Reference documentation (strict style)\n  - `book/` - Technical book content (lenient style)\n  - `README.md` files at project and plugin roots\n  - `wiki/` entries if present\n  - Docstrings in code files\n- Prioritize user-facing documentation first, then supporting plans and specifications.\n- When architectural work is planned, confirm whether an Architecture Decision Record (ADR) already exists in `wiki/architecture/` (or wherever ADRs are located).\n- Add missing ADRs to the target list before any implementation begins.\n\n## Step 2.5: Check for Consolidation (`consolidation-checked`)\n\nLoad: `@modules/consolidation-integration.md`\n\n**Purpose**: Detect redundancy and bloat before making edits.\n\n**Scan for:**\n- Untracked reports (ALL_CAPS *_REPORT.md, *_ANALYSIS.md files)\n- Bloated committed docs (files exceeding 500 lines in docs/, 1000 in book/)\n- Stale files (outdated content that should be deleted)\n\n**User approval required before:**\n- Merging content from one file to another\n- Deleting stale or redundant files\n- Splitting bloated files\n\n**Skip options:**\n- Use `--skip-consolidation` flag to bypass this phase\n- Select specific items instead of processing all\n\n**Exit criteria**: User has approved/skipped all consolidation opportunities.\n\n## Step 3: Apply Edits (`edits-applied`)\n\n- Update each file with grounded language: explain what changed and why.\n- Reference specific commands, filenames, or configuration options where possible.\n- For docstrings, use the imperative mood and keep them concise.\n- For ADRs, see `modules/adr-patterns.md` for complete template structure, status flow, immutability rules, and best practices.\n\n## Step 4: Enforce Guidelines (`guidelines-verified`)\n\nLoad: `@modules/directory-style-rules.md`\n\n### Style Enforcement\n\nMaintain consistent documentation by applying directory-specific rules. The system checks for and removes filler phrases such as \"in order to\" or \"it should be noted\" and ensures that no emojis are present in the body text of technical documents. Use grounded language with specific references rather than vague claims, and maintain an imperative mood for instructions. For lists of three or more items, prefer bullets over prose to improve scannability.\n\nThe audit will issue warnings for paragraphs that exceed length limits or files that surpass the established line count thresholds. We also flag marketing language and abstract adjectives like \"capable\" or \"smooth\" to maintain a technical and direct tone across all project documentation.\n\n## Step 4.25: AI Slop Detection (`slop-scanned`)\n\nRun `Skill(scribe:slop-detector)` on edited documentation to detect AI-generated content markers.\n\n### Scribe Integration\n\nThe scribe plugin provides comprehensive AI slop detection:\n\n```\nSkill(scribe:slop-detector) --target [edited-files]\n```\n\nThis detects:\n- **Tier 1 words**: delve, tapestry, comprehensive, leveraging, etc.\n- **Phrase patterns**: \"In today's fast-paced world\", \"cannot be overstated\"\n- **Structural markers**: Excessive em dashes, bullet overuse, sentence uniformity\n- **Sycophantic phrases**: \"I'd be happy to\", \"Great question!\"\n\n### Writing Style Guidelines\n\nFor enhanced writing quality, check for `elements-of-style:writing-clearly-and-concisely`:\n\n```\n# If superpowers/elements-of-style is installed:\nSkill(elements-of-style:writing-clearly-and-concisely)\n\n# Fallback if not installed - use scribe:doc-generator principles:\nSkill(scribe:doc-generator) --remediate\n```\n\nThe fallback provides equivalent guidance:\n1. Ground every claim with specifics\n2. Trim rhetorical crutches (no formulaic openers/closers)\n3. Use numbers, commands, filenames over adjectives\n4. Balance bullets with narrative prose\n5. Show authorial perspective (trade-offs, reasoning)\n\n### Remediation\n\nIf slop score exceeds 2.5 (moderate), run:\n\n```\nAgent(scribe:doc-editor) --target [file]\n```\n\nThis provides interactive section-by-section cleanup with user approval.\n\n### Skip Options\n\n- Use `--skip-slop` flag to bypass slop detection\n- Slop warnings are non-blocking by default\n\n## Step 4.5: Sync Plugin Registrations (`plugins-synced`)\n\n**Audit plugin.json files against disk** (prevents registration drift):\n\n```bash\n# Quick discrepancy check for all plugins\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  pjson=\"$plugin/.claude-plugin/plugin.json\"\n  [ -f \"$pjson\" ] || continue\n\n  # Count commands\n  json_cmds=$(jq -r '.commands | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_cmds=$(ls \"$plugin/commands/\"*.md 2>/dev/null | wc -l)\n\n  # Count skills (directories only)\n  json_skills=$(jq -r '.skills | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_skills=$(ls -d \"$plugin/skills\"/*/ 2>/dev/null | wc -l)\n\n  # Report mismatches\n  if [ \"$json_cmds\" != \"$disk_cmds\" ] || [ \"$json_skills\" != \"$disk_skills\" ]; then\n    echo \"$name: commands=$json_cmds/$disk_cmds skills=$json_skills/$disk_skills\"\n  fi\ndone\n```\n\n**If mismatches found**: Run `/update-plugins --fix` or manually update plugin.json files.\n\n**Why this matters**: Unregistered commands/skills won't appear in Claude Code's slash command menu or be discoverable.\n\n## Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nLoad: `@modules/capabilities-sync.md`\n\n**Purpose**: Ensure plugin.json registrations are reflected in reference documentation.\n\n**Sync Targets**:\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n\n**Quick Check**:\n```bash\n# Compare registered vs documented skills\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort > /tmp/registered-skills.txt\n\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md | \\\n  head -120 | awk -F'|' '{print $2\":\"$3}' | sort > /tmp/documented-skills.txt\n\n# Show missing\ncomm -23 /tmp/registered-skills.txt /tmp/documented-skills.txt\n```\n\n**If discrepancies found**:\n1. **Missing from docs**: Add entries to capabilities-reference.md tables\n2. **Missing plugin pages**: Create `book/src/plugins/{plugin}.md`\n3. **Missing from SUMMARY**: Add plugin to `book/src/SUMMARY.md`\n\n**Auto-generate entry format**:\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description} |\n```\n\n**Skip options**: Use `--skip-capabilities` to bypass this phase.\n\n## Step 5: Verify Accuracy (`accuracy-verified`)\n\nLoad: `@modules/accuracy-scanning.md`\n\n**Validate claims against codebase:**\n\n```bash\n# Quick version check\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone\n\n# Quick counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\n```\n**Verification:** Run the command with `--help` flag to verify availability.\n\n**Flag mismatches:**\n- Version numbers that don't match plugin.json\n- Plugin/skill/command counts that don't match actual directories\n- File paths that don't exist\n\n**LSP-Enhanced Verification (2.0.74+)**:\n\nWhen `ENABLE_LSP_TOOL=1` is set, enhance accuracy verification with semantic analysis:\n\n1. **API Documentation Coverage**:\n   - Query LSP for all public functions/classes\n   - Check which lack documentation\n   - Verify all exported items are documented\n\n2. **Signature Verification**:\n   - Compare documented function signatures with actual code\n   - Detect parameter mismatches\n   - Flag return type discrepancies\n\n3. **Reference Finding**:\n   - Use LSP to find all usages of documented items\n   - Include real usage examples in documentation\n   - Verify cross-references are accurate\n\n4. **Code Structure Validation**:\n   - Check documented file paths exist (via LSP definitions)\n   - Verify module organization matches documentation\n   - Detect renamed/moved items\n\n**Efficiency**: LSP queries (50ms) vs. manual file tracing (minutes) - dramatically faster verification.\n\n**Default Strategy**: Documentation updates should **prefer LSP** for all verification tasks. Enable `ENABLE_LSP_TOOL=1` permanently for best results.\n\n**Non-blocking**: Warnings are informational; user decides whether to fix.\n\n## Step 6: Preview Changes (`preview`)\n\n- Show diffs for each edited file (`git diff <file>` or `rg` snippets).\n- Include accuracy warnings if any were flagged.\n- Summarize:\n  - Files created/modified/deleted\n  - Consolidation actions taken\n  - Style violations fixed\n  - Remaining TODOs or follow-ups\n\n## Exit Criteria\n\n- All `TodoWrite` items are completed and documentation is updated.\n- New ADRs, if any, are in `wiki/architecture/` (or the established ADR directory) with the correct status and links to related work.\n- Directory-specific style rules are satisfied.\n- Accuracy warnings addressed or acknowledged.\n- Content does not sound AI-generated.\n- Files are staged or ready for review.\n\n## Flags\n\n| Flag | Effect |\n|------|--------|\n| `--skip-consolidation` | Skip Phase 2.5 consolidation check |\n| `--skip-slop` | Skip Phase 4.25 AI slop detection |\n| `--strict` | Treat all warnings as errors |\n| `--book-style` | Apply book/ rules to all files |\n## Troubleshooting\n\n### Common Issues\n\n**Documentation out of sync**\nRun `make docs-update` to regenerate from code\n\n**Build failures**\nCheck that all required dependencies are installed\n\n**Links broken**\nVerify relative paths in documentation files\n\nFile v1.9.17:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-sanctum-doc-updates\",\n  \"version\": \"1.9.17\",\n  \"publishedAt\": 1785390020663\n}\n\nFile v1.9.17:modules/accuracy-scanning.md\n\n# Accuracy Scanning Module\n\nValidate documentation claims against actual codebase state. Runs as Phase 5.5 before preview to catch stale version numbers, outdated counts, and broken references.\n\n## Scan Types\n\n### 1. Version Number Validation\n\nCompares version references in documentation against `plugin.json` files.\n\n**Patterns to detect:**\n- `v1.2.3`, `version: 1.2.3`\n- `Plugin Name (v1.2.3)`, `Plugin Name v1.2.3`\n- Table cells with version numbers\n\n**Validation:**\n```bash\n# Extract actual versions\nfor plugin in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '.name + \" \" + .version' \"$plugin\"\ndone\n\n# Sample output:\n# abstract 1.0.5\n# sanctum 1.0.6\n# scry 1.1.0\n```\n\n**Warning format:**\n```markdown\n| File | Claimed | Actual | Action |\n|------|---------|--------|--------|\n| docs/api-overview.md | abstract v2.1.0 | 1.0.5 | Update version |\n| README.md | sanctum v3.0.0 | 1.0.6 | Update version |\n```\n\n### 2. Plugin Count Validation\n\nVerifies claims like \"13 plugins\" against actual directory count.\n\n**Patterns to detect:**\n- \"N plugins\", \"contains N plugins\"\n- Table rows claiming to list all plugins\n\n**Validation:**\n```bash\n# Count plugin directories with valid plugin.json\nls -d plugins/*/.claude-plugin/plugin.json 2>/dev/null | wc -l\n```\n\n### 3. Skill/Command Count Validation\n\nVerifies per-plugin statistics.\n\n**Patterns to detect:**\n- \"X skills\", \"Y commands\", \"Z agents\"\n- API inventory tables\n\n**Validation:**\n```bash\n# Count skills for a plugin\nls -d plugins/sanctum/skills/*/SKILL.md 2>/dev/null | wc -l\n\n# Count commands\nls plugins/sanctum/commands/*.md 2>/dev/null | wc -l\n\n# Count agents\nls plugins/sanctum/agents/*.md 2>/dev/null | wc -l\n```\n\n### 4. File/Path Reference Validation\n\nVerifies that referenced paths exist.\n\n**Patterns to detect:**\n- Backtick paths: `` `plugins/sanctum/skills/doc-updates/SKILL.md` ``\n- Relative paths in links: `[link](./modules/foo.md)`\n- Configuration examples with paths\n\n**Validation:**\n```bash\n# Check if path exists\ntest -e \"$path\" && echo \"EXISTS\" || echo \"MISSING\"\n```\n\n## Scan Algorithm\n\n```python\ndef scan_for_accuracy(file_path: str, content: str) -> list[AccuracyWarning]:\n    warnings = []\n\n    # Load current plugin versions\n    actual_versions = load_plugin_versions()\n\n    # Find version references\n    version_pattern = r'(\\w+)[\\s\\(]v?(\\d+\\.\\d+\\.\\d+)'\n    for match in re.finditer(version_pattern, content):\n        plugin_name = match.group(1).lower()\n        claimed_version = match.group(2)\n\n        if plugin_name in actual_versions:\n            actual = actual_versions[plugin_name]\n            if claimed_version != actual:\n                warnings.append({\n                    'type': 'version_mismatch',\n                    'plugin': plugin_name,\n                    'claimed': claimed_version,\n                    'actual': actual,\n                    'line': get_line_number(content, match.start())\n                })\n\n    # Find count claims\n    count_pattern = r'(\\d+)\\s+(plugins?|skills?|commands?|agents?)'\n    for match in re.finditer(count_pattern, content, re.IGNORECASE):\n        claimed_count = int(match.group(1))\n        item_type = match.group(2).lower().rstrip('s')\n        actual_count = count_items(item_type)\n\n        if abs(claimed_count - actual_count) > 0:\n            warnings.append({\n                'type': 'count_mismatch',\n                'item_type': item_type,\n                'claimed': claimed_count,\n                'actual': actual_count,\n                'line': get_line_number(content, match.start())\n            })\n\n    return warnings\n```\n\n## Quick Validation Commands\n\nFor manual verification during doc updates:\n\n```bash\n# All plugin versions\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | sort\n\n# Total counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\necho \"Commands: $(find plugins/*/commands -maxdepth 1 -name '*.md' | wc -l)\"\necho \"Agents: $(find plugins/*/agents -name '*.md' | wc -l)\"\n```\n\n## Output Format\n\n### Phase 5.5: Verify Accuracy\n\n```markdown\n## Accuracy Scan Results\n\nScanned: docs/api-overview.md, README.md (2 files)\nTime: 0.3 seconds\n\n### Warnings Found\n\n| Type | File | Line | Issue | Fix |\n|------|------|------|-------|-----|\n| version | docs/api-overview.md | 15 | abstract v2.1.0 → 1.0.5 | Update |\n| version | docs/api-overview.md | 18 | sanctum v3.0.0 → 1.0.6 | Update |\n| count | README.md | 42 | \"11 plugins\" → 13 | Update |\n\n### No Issues\n- All file paths valid\n- Command references exist\n\n**Action**: Review warnings before proceeding to preview.\n```\n\n## Integration Notes\n\n- Non-blocking: Warnings don't prevent workflow completion\n- Selective: Only scans files being edited (from Phase 2 targets)\n- Fast: Bash commands complete in <1 second per file\n- Progressive: Loads only when Phase 5 edits are complete\n\n## Cross-Reference: /update-version\n\nWhen version bumps are performed via `/update-version`, the automated script updates config files but NOT documentation. The `/update-version` command includes Phase 2 to update documentation files. If you're running `/update-docs` after a version bump, pay special attention to `docs/api-overview.md` which contains the plugin version inventory.\n\n## Edge Cases\n\n### Approximate counts\nSome docs use \"~10 skills\" or \"about 50 commands\". These should be validated but with wider tolerance (±20%).\n\n### Unreleased versions\nIf a plugin shows \"0.0.0\" or \"dev\", skip version validation for that plugin.\n\n### External references\nPaths outside the repository (URLs, system paths) are not validated.\n\nFile v1.9.17:modules/adr-patterns.md\n\n# Architecture Decision Record (ADR) Patterns\n\n## ADR Template Structure\n\nEvery ADR must follow a consistent Markdown template with these required sections:\n\n### Required Sections\n\n1. **Title**\n   - Format: `ADR-{number}: {Brief Decision Description}`\n   - Example: `ADR-001: Use PostgreSQL for primary data store`\n\n2. **Status**\n   - One of: Proposed, Accepted, Deprecated, Superseded\n   - Include date when status changed\n\n3. **Context**\n   - Forces driving the decision\n   - Constraints that must be satisfied\n   - Prior art or existing patterns\n   - Why this decision is needed now\n\n4. **Decision**\n   - The chosen option with clear justification\n   - Specific implementation approach\n   - Rationale for why this solves the context\n\n5. **Alternatives Considered**\n   - Other options evaluated\n   - Why each alternative was rejected\n   - Trade-offs between options\n\n6. **Consequences**\n   - Positive outcomes expected\n   - Negative outcomes or limitations\n   - Impact on other components or teams\n   - Future implications\n\n7. **Metadata**\n   - Author(s)\n   - Date created\n   - Approvers (if required)\n   - Links to related documents\n\n## Status Flow\n\nADRs follow this lifecycle:\n\n```\nProposed → Accepted → [Deprecated | Superseded]\n```\n\n- **Proposed**: Draft ADR under review\n- **Accepted**: Decision approved and implemented\n- **Deprecated**: No longer recommended but not replaced\n- **Superseded**: Replaced by a newer ADR (reference the new ADR number)\n\n## Immutability Rules\n\nADRs are treated like code:\n\n1. **Draft during planning**: Create ADR before implementation begins\n2. **Review via pull request**: ADRs go through same review process as code\n3. **Immutable once accepted**: Never edit an accepted ADR's decision\n4. **Supersede, don't modify**: Create new ADR to change direction\n\n## Superseding an ADR\n\nWhen replacing an existing decision:\n\n1. Create new ADR with next sequential number\n2. Reference the superseded ADR number in context\n3. Explain what changed and why the shift occurred\n4. Update old ADR status to \"Superseded by ADR-{new-number}\"\n5. Add link in old ADR to new record\n\n## Location Conventions\n\nADRs typically are in one of these locations:\n- `wiki/architecture/`\n- `docs/adr/`\n- `architecture/decisions/`\n\nCheck project structure to determine the established location before creating ADRs.\n\n## Best Practices\n\n### Keep Focused\n- One architectural decision per ADR\n- Maximum 1-2 pages in length\n- Don't combine multiple decisions\n\n### Maintain Traceability\n- Link to requirements documents\n- Reference design documents\n- Connect to related ADRs\n- Include issue/ticket numbers\n\n### Write Grounded Content\n- Reference specific technologies, tools, or approaches\n- Include concrete examples where helpful\n- Avoid abstract language or filler\n- Use imperative mood for clarity\n\n### Review Checklist\n- [ ] Single focused decision\n- [ ] All required sections present\n- [ ] Alternatives documented with rationale\n- [ ] Consequences (both positive and negative) identified\n- [ ] Links to related work included\n- [ ] Status clearly marked\n- [ ] Location follows project convention\n\nFile v1.9.17:modules/capabilities-sync.md\n\n# Capabilities Sync Module\n\nSynchronizes plugin.json registrations with capabilities reference documentation.\n\n## Purpose\n\nDetects drift between:\n- **Source of truth**: `plugins/*/.claude-plugin/plugin.json` files\n- **Documentation**: `book/src/reference/capabilities-reference.md` and related files\n\n## When Loaded\n\nThis module is loaded during Step 4.75 (after plugins-synced, before accuracy-verified).\n\n## Sync Targets\n\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` (Skills table) |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` (Commands table) |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` (Agents table) |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` (Hooks table) |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n| Plugin in layer | `book/src/plugins/{layer}-layer.md` |\n| Plugin in SUMMARY | `book/src/SUMMARY.md` |\n\n## Detection Script\n\n```bash\n#!/bin/bash\n# capabilities-sync-check.sh\n# Run from repo root\n\necho \"=== Capabilities Sync Report ===\"\necho \"\"\n\n# Temporary files for comparison\nREGISTERED_SKILLS=$(mktemp)\nDOCUMENTED_SKILLS=$(mktemp)\nREGISTERED_COMMANDS=$(mktemp)\nDOCUMENTED_COMMANDS=$(mktemp)\nREGISTERED_AGENTS=$(mktemp)\nDOCUMENTED_AGENTS=$(mktemp)\n\n# Extract registered skills from plugin.json files\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_SKILLS\"\n\n# Extract documented skills from capabilities-reference.md\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Skills/,/All Commands/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/.*\\(\\.\\.\\/plugins\\//, \"\", $3); gsub(/\\.md\\).*/, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_SKILLS\"\n\n# Extract registered commands\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.commands[]? | sub(\"^\\\\./commands/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"/\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_COMMANDS\"\n\n# Extract documented commands\ngrep -E \"^\\| \\`/\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Commands/,/All Agents/p' | \\\n  grep -E \"^\\| \\`/\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $2}' | \\\n  sort -u > \"$DOCUMENTED_COMMANDS\"\n\n# Extract registered agents\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.agents[]? | sub(\"^\\\\./agents/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_AGENTS\"\n\n# Extract documented agents\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Agents/,/All Hooks/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_AGENTS\"\n\n# Report differences\necho \"### Skills\"\necho \"Missing from docs (registered but not documented):\"\ncomm -23 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs (documented but not registered):\"\ncomm -13 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Commands\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Agents\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\n\n# Check for missing plugin pages in book\necho \"\"\necho \"### Plugin Pages\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if [ ! -f \"book/src/plugins/${name}.md\" ]; then\n    echo \"  - Missing: book/src/plugins/${name}.md\"\n  fi\ndone\n\n# Check SUMMARY.md includes all plugins\necho \"\"\necho \"### SUMMARY.md\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if ! grep -q \"plugins/${name}.md\" book/src/SUMMARY.md 2>/dev/null; then\n    echo \"  - Missing from SUMMARY: ${name}\"\n  fi\ndone\n\n# Cleanup\nrm -f \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\"\n```\n\n## Workflow Integration\n\n### Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nAfter `plugins-synced` (Step 4.5), run capabilities sync:\n\n```bash\n# Quick check for capabilities drift\nbash plugins/sanctum/skills/doc-updates/modules/capabilities-sync-check.sh\n```\n\n**If discrepancies found:**\n\n1. **Missing skills/commands/agents**: Generate table entries\n2. **Extra in docs**: Verify if removed or renamed\n3. **Missing plugin pages**: Create from template\n4. **Missing from SUMMARY**: Add to appropriate layer\n\n### Auto-Generation Templates\n\n#### Skill Entry\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description from SKILL.md frontmatter} |\n```\n\n#### Command Entry\n```markdown\n| `/{plugin}:{command}` | {plugin} | {description from command.md frontmatter} |\n```\n\n#### Agent Entry\n```markdown\n| `{agent-name}` | {plugin} | {description from agent.md frontmatter} |\n```\n\n#### Hook Entry\n```markdown\n| `{hook-file}` | {plugin} | {type} | {description} |\n```\n\n## Capabilities Sync Check\n\nTool: `scripts/capabilities-sync-check.sh` (invoked by\n`make docs-sync-check` and the `.github/workflows/capabilities-sync.yml`\nCI job).\n\nCompares skills/commands/agents registered in\n`plugins/*/.claude-plugin/plugin.json` against the tables in\n`book/src/reference/capabilities-reference.md`. Reports any items\npresent in `plugin.json` but missing from the doc, and vice versa.\n\n### CLI Usage\n\n```bash\n# Run the sync check (read-only)\nbash scripts/capabilities-sync-check.sh\n\n# Or via make\nmake docs-sync-check\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | All registered capabilities appear in the doc |\n| 1 | Discrepancies found |\n\n### Fixing Discrepancies\n\nThe check is read-only. When it reports a missing entry:\n\n1. Open `book/src/reference/capabilities-reference.md`\n2. Locate the relevant section (e.g. `### All skills (Alphabetical)`)\n3. Add a row using the same `| `name` | plugin | description |` shape\n   already present in the table\n4. Re-run the check to confirm\n\nWhen the check reports an extra entry (in the doc but not in any\n`plugin.json`), either re-register the item in the plugin's\n`plugin.json` or remove the row from the doc.\n\n## Exit Criteria\n\n- All registered capabilities appear in documentation\n- No orphaned documentation entries (items removed from plugin.json)\n- All plugins have book pages\n- SUMMARY.md is complete\n\nFile v1.9.17:modules/consolidation-integration.md\n\n# Consolidation Integration Module\n\nBridges doc-updates with doc-consolidation capabilities. Detects redundancy and bloat in existing documentation, presenting consolidation opportunities before edits begin.\n\n## Purpose\n\nDuring Phase 2.5, scan for:\n1. **Redundant files**: Multiple docs covering the same topic\n2. **Bloated files**: Docs exceeding recommended length thresholds\n3. **Stale files**: Documentation that should be deleted or archived\n4. **Untracked reports**: LLM-generated files that need consolidation\n\n## Detection Approach\n\n### Reuse from doc-consolidation\n\nImport candidate detection logic from `sanctum:doc-consolidation`:\n- Git-untracked file detection\n- ALL_CAPS naming pattern matching\n- Content marker scanning (Executive Summary, Findings, etc.)\n\n### Additional Signals for Committed Files\n\nExtend detection to analyze committed documentation:\n\n**Bloat signals:**\n- `docs/`: File exceeds 500 lines, section exceeds 150 lines\n- `book/`: File exceeds 1000 lines, section exceeds 300 lines\n- Multiple \"wall of text\" paragraphs (>4 sentences in docs/, >8 in book/)\n\n**Redundancy signals:**\n- Similar file names: `api-overview.md` vs `api-reference.md`\n- Similar headings across files\n- Overlapping content sections (manual inspection)\n- Design docs whose content exists in command/skill documentation\n- Planning artifacts for completed work (already implemented)\n\n**Redundancy check command:**\n```bash\n# For a candidate file, check if content exists elsewhere\ngrep -r \"key phrase from candidate\" docs/ book/ plugins/*/commands/*.md plugins/*/README.md\n```\n\n**Staleness signals:**\n- References to deprecated features\n- Version numbers more than 2 minor versions behind\n- \"TODO: update\" comments older than 30 days\n\n## Workflow\n\n### Step 1: Scan for Candidates\n\n```bash\n# Find untracked .md files (doc-consolidation pattern)\ngit status --porcelain | grep '^??' | grep '\\.md$' | grep -v 'docs/\\|book/\\|skills/\\|commands/\\|agents/'\n\n# Find bloated docs/ files (500 line limit)\nfind docs/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 500 {print}'\n\n# Find bloated book/ files (1000 line limit)\nfind book/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 1000 {print}'\n\n# Find recently unchanged files (potential staleness) - docs: 90 days, book: 180 days\nfind docs/ -name '*.md' -mtime +90 -type f 2>/dev/null\nfind book/ -name '*.md' -mtime +180 -type f 2>/dev/null\n```\n\n### Step 2: Present Opportunities\n\nShow consolidation candidates with recommended actions:\n\n```markdown\n## Phase 2.5: Consolidation Opportunities\n\n### Redundant Files (delete - content exists elsewhere)\n\n| File | Action | Reason |\n|------|--------|--------|\n| plugins/memory-palace/docs/PALACE_UNIFICATION.md | Delete | Content already in commands/palace.md |\n| docs/old-api-design.md | Delete | Superseded by docs/api-overview.md |\n\n### Untracked Reports (merge or delete)\n\n| File | Score | Markers | Recommendation |\n|------|-------|---------|----------------|\n| API_REVIEW_REPORT.md | 6 | Executive Summary, Findings | Merge to docs/api-overview.md |\n| MIGRATION_NOTES.md | 4 | Action Items, Tables | Merge to docs/migration-guide.md |\n\n### Bloated Files (split or trim)\n\n| File | Lines | Threshold | Recommendation |\n|------|-------|-----------|----------------|\n| book/src/tutorials/error-handling-tutorial.md | 1031 | 1000 | Trim verbose sections |\n| docs/function-extraction-guidelines.md | 571 | 500 | Consider splitting principles/patterns |\n\n### Staleness Candidates (review or delete)\n\n| File | Last Modified | Issue | Recommendation |\n|------|---------------|-------|----------------|\n| docs/enhanced-pre-commit-hooks.md | 45 days | Content moved to imbue | Delete |\n| docs/technical-debt-framework.md | 60 days | Replaced by backlog | Delete |\n\n---\n\n**Options:**\n- `Y` - Proceed with all recommended actions\n- `n` - Skip consolidation, continue to edits\n- `select` - Choose specific items to address\n- `--skip-consolidation` flag bypasses this phase\n```\n\n### Step 3: Execute Approved Actions\n\nFor each approved action:\n\n**Delete (redundant) actions:**\n1. Verify content exists in target document(s) by searching for key phrases\n2. Confirm no unique valuable content would be lost\n3. Remove file: `rm <file>`\n4. Add deletion to git staging: `git add -u`\n\n**Merge actions:**\n1. Extract valuable content from source\n2. Integrate into destination (using doc-consolidation merge strategies)\n3. Delete source file\n4. Add to git staging\n\n**Delete (stale) actions:**\n1. Confirm file has no unique valuable content\n2. Remove file\n3. Add deletion to git staging\n\n**Split actions:**\n1. Create new files for logical sections\n2. Move content to new locations\n3. Update cross-references\n4. Preserve original as index if needed\n\n**Action priority:**\n1. Delete redundant first (unbloats without adding content)\n2. Delete stale second (removes outdated info)\n3. Merge third (consolidates remaining value)\n4. Split last (increases file count, use sparingly)\n\n## User Controls\n\n### Skip Flag\n```bash\n/update-docs --skip-consolidation\n```\nBypasses Phase 2.5 entirely for quick updates.\n\n### Selective Processing\nWhen user chooses \"select\":\n```\nEnter file numbers to process (comma-separated), or 'all'/'none':\n> 1,3\nProcessing: API_REVIEW_REPORT.md, docs/enhanced-pre-commit-hooks.md\n```\n\n### Dry Run\n```bash\n/update-docs --consolidation-dry-run\n```\nShows what would be consolidated without executing.\n\n## Thresholds\n\n| Metric | docs/ Limit | book/ Limit | Action |\n|--------|-------------|-------------|--------|\n| File length | 500 lines | 1000 lines | Flag for review |\n| Section length | 150 lines | 300 lines | Suggest split |\n| Paragraph sentences | 4 | 8 | Warn, don't block |\n| Stale threshold | 90 days | 180 days | Review suggestion |\n\n## Integration with doc-consolidation\n\nThis module **imports** patterns from doc-consolidation but **does not** duplicate its full workflow:\n\n- **Imports**: Candidate detection signals, content markers, scoring\n- **Extends**: Adds bloat and staleness detection for committed files\n- **Defers to**: Full doc-consolidation skill for complex multi-file merges\n\nFor straightforward cases (single untracked report, obvious deletion), handle inline. For complex consolidations, recommend: \"Run `/merge-docs` for detailed consolidation workflow.\"\n\n## Exit Criteria\n\nPhase 2.5 completes when:\n- All candidates reviewed (approved or skipped)\n- Approved merges/deletions executed\n- Git staging updated with changes\n- Summary logged for Phase 5 preview\n\nProceed to Phase 3 (Edits Applied) regardless of consolidation outcome.\n\nFile v1.9.17:modules/directory-style-rules.md\n\n# Directory-Specific Style Rules\n\nApply different documentation standards based on file location. The `docs/` directory requires strict conciseness while `book/` allows technical book format with longer explanations.\n\n## Rule Sets\n\n### docs/ - Strict Reference Style\n\nTarget audience: Developers seeking quick answers.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Keeps files navigable |\n| Max section length | 100 lines | Forces topic focus |\n| Max paragraph sentences | 4 | Prevents wall-of-text |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Start directly (no \"This document describes...\")\n- Imperative mood for instructions\n- Bullets over prose for lists of 3+ items\n- Code examples over abstract descriptions\n\n**Anti-patterns to flag:**\n- Executive summaries (remove or move to introduction)\n- Filler phrases: \"in order to\", \"it should be noted\", \"as mentioned\"\n- Qualification hedging: \"generally\", \"typically\", \"usually\"\n- Empty transitions: \"Moving on\", \"Now let's look at\"\n\n### book/ - Technical Book Style\n\nTarget audience: Learners working through chapters.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 1000 lines | Chapter-length content |\n| Max section length | 300 lines | Tutorial depth allowed |\n| Max paragraph sentences | 8 | Explanatory narratives |\n| Max list items | 15 | Subgroup for clarity |\n| Max table rows | 25 | Comparison tables |\n\n**Allowed patterns:**\n- Narrative explanations\n- Before/after comparisons\n- Step-by-step walkthroughs\n- Conceptual introductions\n- Callout emojis (sparingly)\n\n**Still flagged:**\n- Filler phrases\n- Redundant explanations\n- Overly long code blocks without commentary\n\n### wiki/ - Wiki Reference Style\n\nTarget audience: Internal team and contributors seeking context.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Quick reference |\n| Max section length | 100 lines | Topic focus |\n| Max paragraph sentences | 4 | Scannable |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Same as docs/ strict style\n- Cross-links to related wiki pages\n- Architecture Decision Records (ADRs) in wiki/architecture/\n\n### plugins/*/README.md - Plugin Summary Style\n\nTarget audience: Users evaluating or installing plugins.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 300 lines | Concise overview |\n| Max section length | 50 lines | Quick scan |\n| Max paragraph sentences | 4 | Brief descriptions |\n| Max list items | 10 | Key features only |\n| Max table rows | 15 | Command/skill listing |\n\n**Required patterns:**\n- Installation instructions\n- Quick start example\n- Link to detailed docs in book/\n\n### Shared Rules (All Locations)\n\nApply everywhere regardless of directory:\n\n- No emojis in headings or body (callouts excepted in book/)\n- Grounded language (specific references, not vague claims)\n- Imperative mood for docstrings\n- No marketing language (\"capable\", \"smooth\", \"elegant\")\n- No first-person plural (\"we can see\", \"let's explore\")\n- Prose text wraps at 80 chars per line (hybrid wrapping:\n  prefer sentence/clause boundaries over arbitrary breaks)\n- Blank line before and after every heading\n- ATX headings only (`#` prefix, never setext underlines)\n- Blank line before every list (ordered or unordered)\n- Reference-style links when inline links push past 80 chars\n- Full formatting spec: `Skill(leyline:markdown-formatting)`\n\n## Detection Patterns\n\n### Wall-of-Text Detection\n\n```python\ndef detect_wall_of_text(content: str, max_sentences: int) -> list[Violation]:\n    violations = []\n    paragraphs = extract_paragraphs(content)\n\n    for i, para in enumerate(paragraphs):\n        sentence_count = len(re.split(r'[.!?]+', para.strip()))\n        if sentence_count > max_sentences:\n            violations.append({\n                'type': 'wall_of_text',\n                'location': f'paragraph {i+1}',\n                'actual': sentence_count,\n                'limit': max_sentences,\n                'suggestion': 'Break into smaller paragraphs or convert to bullet list'\n            })\n\n    return violations\n```\n\n### Filler Phrase Detection\n\n```python\nFILLER_PHRASES = [\n    r'\\bin order to\\b',\n    r'\\bit should be noted\\b',\n    r'\\bas mentioned (above|below|earlier|previously)\\b',\n    r'\\bmoving on\\b',\n    r'\\bnow let\\'?s (look at|explore|consider)\\b',\n    r'\\bthis (document|section|chapter) (describes|explains|covers)\\b',\n]\n\ndef detect_filler(content: str) -> list[Violation]:\n    violations = []\n    for pattern in FILLER_PHRASES:\n        matches = re.findall(pattern, content, re.IGNORECASE)\n        for match in matches:\n            violations.append({\n                'type': 'filler_phrase',\n                'phrase': match,\n                'suggestion': 'Remove or rewrite directly'\n            })\n    return violations\n```\n\n## Validation Workflow\n\n### Step 1: Determine Rule Set\n\n```python\ndef get_ruleset(file_path: str) -> RuleSet:\n    if file_path.startswith('book/'):\n        return BOOK_RULES\n    elif file_path.startswith('docs/'):\n        return DOCS_RULES\n    elif file_path.startswith('wiki/'):\n        return WIKI_RULES\n    elif re.match(r'plugins/[^/]+/README\\.md$', file_path):\n        return PLUGIN_README_RULES\n    else:\n        return DOCS_RULES  # Default to strict\n```\n\n### Step 2: Run Checks\n\n```python\ndef validate_file(file_path: str, content: str) -> ValidationResult:\n    rules = get_ruleset(file_path)\n    violations = []\n\n    # Structure checks\n    lines = content.split('\\n')\n    if len(lines) > rules.max_lines:\n        violations.append({\n            'severity': 'warning',\n            'type': 'file_length',\n            'actual': len(lines),\n            'limit': rules.max_lines\n        })\n\n    # Wall-of-text check\n    violations.extend(detect_wall_of_text(content, rules.max_sentences))\n\n    # Filler phrase check\n    violations.extend(detect_filler(content))\n\n    return ValidationResult(\n        file_path=file_path,\n        ruleset=rules.name,\n        violations=violations,\n        passed=len([v for v in violations if v.get('severity') == 'error']) == 0\n    )\n```\n\n### Step 3: Report Format\n\n```markdown\n## Style Validation: docs/api-overview.md\n\nUsing ruleset: **docs/ (strict)**\n\n### Violations Found\n\n| Severity | Type | Details | Suggestion |\n|----------|------|---------|------------|\n| warning | wall_of_text | Paragraph 3 has 7 sentences (limit: 4) | Break into smaller paragraphs |\n| info | filler_phrase | \"in order to\" | Remove or rewrite directly |\n| info | filler_phrase | \"This document describes\" | Start with content directly |\n\n### Passed Checks\n- File length: 287/500 lines\n- Section lengths: All under 100 lines\n- No marketing language detected\n```\n\n## Progressive Loading\n\nThis module loads only when Phase 4 (Guidelines Verified) is reached. It does not run during earlier phases to conserve context.\n\n**Load trigger**: `doc-updates:edits-applied` completed\n**Dependencies**: None\n\nFile v1.9.17:skill-card.md\n\n## Description: <br>\nUpdates documentation after code changes with quality gates, slop detection, and accuracy checks. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and documentation maintainers use this skill after code changes to update READMEs, plans, wikis, docstrings, ADRs, and capability documentation while checking style, consistency, and accuracy. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Broad trigger words may activate the skill during general documentation or writing tasks. <br>\nMitigation: Confirm the intended documentation-update scope before allowing the workflow to edit files. <br>\nRisk: Consolidation steps can propose deletion, merging, splitting, or staging of documentation files. <br>\nMitigation: Review consolidation tables, use selective or dry-run mode for cleanup, and approve destructive actions explicitly. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-sanctum-doc-updates) <br>\n- [Claude Night Market sanctum plugin](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance] <br>\n**Output Format:** [Markdown guidance with command snippets, review tables, and documentation edits] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May propose consolidation, deletion, or staging actions that require user review or approval.] <br>\n\n## Skill Version(s): <br>\n1.9.17 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.16: 8 files, 19532 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2252b), SKILL.md (13812b), _meta.json (142b)\n\nFile v1.9.16:SKILL.md\n\n---\nname: doc-updates\ndescription: |\n  Updates documentation after code changes with quality gates, slop detection, and accuracy checks\nversion: 1.9.8\ntriggers:\n  - documentation\n  - readme\n  - adr\n  - docstrings\n  - writing\n  - consolidation\n  - debloat\n  - code changes require corresponding doc updates\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.sanctum:shared\", \"night-market.sanctum:git-workspace-review\", \"night-market.imbue:proof-of-work\", \"night-market.scribe:slop-detector\", \"night-market.scribe:doc-generator\"]}}}\nsource: claude-night-market\nsource_plugin: sanctum\n---\n\n> **Night Market Skill** — ported from [claude-night-market/sanctum](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Step 1: Collect Context](#step-1-collect-context-context-collected)\n- [Step 2: Identify Targets](#step-2-identify-targets-targets-identified)\n- [Step 2.5: Check for Consolidation](#step-25-check-for-consolidation-consolidation-checked)\n- [Step 3: Apply Edits](#step-3-apply-edits-edits-applied)\n- [Step 4: Enforce Guidelines](#step-4-enforce-guidelines-guidelines-verified)\n- [Step 4.25: AI Slop Detection](#step-425-ai-slop-detection-slop-scanned)\n- [Step 4.75: Sync Capabilities Documentation](#step-475-sync-capabilities-documentation-capabilities-synced)\n- [Step 5: Verify Accuracy](#step-5-verify-accuracy-accuracy-verified)\n- [Step 6: Preview Changes](#step-6-preview-changes-preview)\n- [Exit Criteria](#exit-criteria)\n- [Flags](#flags)\n\n\n# Documentation Update Workflow\n\n## When To Use\n\nUse this skill when code changes require updates to the README, plans, wikis, or docstrings. Run `Skill(sanctum:git-workspace-review)` first to capture the change context.\n\n### System Capabilities\n\nThe documentation update workflow includes several specialized functions. It identifies redundancy through consolidation detection and enforces directory-specific style rules, with strict limits for `docs/` and more lenient ones for the `book/` directory. The system also verifies the accuracy of version numbers and component counts and integrates with the LSP for semantic documentation verification in supported versions of Claude Code.\n\n## When NOT To Use\n\n- README-specific updates - use update-readme instead\n- Complex multi-file consolidation - use doc-consolidation\n\n## Required TodoWrite Items\n\n1. `doc-updates:context-collected` - Git context + CHANGELOG review\n2. `doc-updates:targets-identified`\n3. `doc-updates:consolidation-checked` (skippable)\n4. `doc-updates:edits-applied`\n5. `doc-updates:guidelines-verified`\n6. `doc-updates:slop-scanned` - AI marker detection via scribe\n7. `doc-updates:plugins-synced` - plugin.json ↔ disk audit\n8. `doc-updates:capabilities-synced` - plugin.json ↔ documentation sync\n9. `doc-updates:accuracy-verified`\n10. `doc-updates:preview`\n\n## Step 1: Collect Context (`context-collected`)\n\n- Validate `Skill(sanctum:git-workspace-review)` has been run.\n- Use its notes to understand the delta.\n- Identify the features or bug fixes that need documentation updates.\n\n**CHANGELOG Reference** (critical for version sync):\n```bash\n# Check recent CHANGELOG entries for undocumented features\nhead -100 CHANGELOG.md\n\n# Compare documented version vs plugin versions\ngrep -E \"^\\[.*\\]\" CHANGELOG.md | head -3\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | head -5\n```\n\nCross-reference CHANGELOG entries against:\n- `book/src/reference/capabilities-reference.md` - All skills/commands/agents\n- Plugin documentation in `book/src/plugins/` - Per-plugin docs\n- Plugin READMEs - Quick reference docs\n\n## Step 2: Identify Targets (`targets-identified`)\n\n- List the relevant files from the scope across all documentation locations:\n  - `docs/` - Reference documentation (strict style)\n  - `book/` - Technical book content (lenient style)\n  - `README.md` files at project and plugin roots\n  - `wiki/` entries if present\n  - Docstrings in code files\n- Prioritize user-facing documentation first, then supporting plans and specifications.\n- When architectural work is planned, confirm whether an Architecture Decision Record (ADR) already exists in `wiki/architecture/` (or wherever ADRs are located).\n- Add missing ADRs to the target list before any implementation begins.\n\n## Step 2.5: Check for Consolidation (`consolidation-checked`)\n\nLoad: `@modules/consolidation-integration.md`\n\n**Purpose**: Detect redundancy and bloat before making edits.\n\n**Scan for:**\n- Untracked reports (ALL_CAPS *_REPORT.md, *_ANALYSIS.md files)\n- Bloated committed docs (files exceeding 500 lines in docs/, 1000 in book/)\n- Stale files (outdated content that should be deleted)\n\n**User approval required before:**\n- Merging content from one file to another\n- Deleting stale or redundant files\n- Splitting bloated files\n\n**Skip options:**\n- Use `--skip-consolidation` flag to bypass this phase\n- Select specific items instead of processing all\n\n**Exit criteria**: User has approved/skipped all consolidation opportunities.\n\n## Step 3: Apply Edits (`edits-applied`)\n\n- Update each file with grounded language: explain what changed and why.\n- Reference specific commands, filenames, or configuration options where possible.\n- For docstrings, use the imperative mood and keep them concise.\n- For ADRs, see `modules/adr-patterns.md` for complete template structure, status flow, immutability rules, and best practices.\n\n## Step 4: Enforce Guidelines (`guidelines-verified`)\n\nLoad: `@modules/directory-style-rules.md`\n\n### Style Enforcement\n\nMaintain consistent documentation by applying directory-specific rules. The system checks for and removes filler phrases such as \"in order to\" or \"it should be noted\" and ensures that no emojis are present in the body text of technical documents. Use grounded language with specific references rather than vague claims, and maintain an imperative mood for instructions. For lists of three or more items, prefer bullets over prose to improve scannability.\n\nThe audit will issue warnings for paragraphs that exceed length limits or files that surpass the established line count thresholds. We also flag marketing language and abstract adjectives like \"capable\" or \"smooth\" to maintain a technical and direct tone across all project documentation.\n\n## Step 4.25: AI Slop Detection (`slop-scanned`)\n\nRun `Skill(scribe:slop-detector)` on edited documentation to detect AI-generated content markers.\n\n### Scribe Integration\n\nThe scribe plugin provides comprehensive AI slop detection:\n\n```\nSkill(scribe:slop-detector) --target [edited-files]\n```\n\nThis detects:\n- **Tier 1 words**: delve, tapestry, comprehensive, leveraging, etc.\n- **Phrase patterns**: \"In today's fast-paced world\", \"cannot be overstated\"\n- **Structural markers**: Excessive em dashes, bullet overuse, sentence uniformity\n- **Sycophantic phrases**: \"I'd be happy to\", \"Great question!\"\n\n### Writing Style Guidelines\n\nFor enhanced writing quality, check for `elements-of-style:writing-clearly-and-concisely`:\n\n```\n# If superpowers/elements-of-style is installed:\nSkill(elements-of-style:writing-clearly-and-concisely)\n\n# Fallback if not installed - use scribe:doc-generator principles:\nSkill(scribe:doc-generator) --remediate\n```\n\nThe fallback provides equivalent guidance:\n1. Ground every claim with specifics\n2. Trim rhetorical crutches (no formulaic openers/closers)\n3. Use numbers, commands, filenames over adjectives\n4. Balance bullets with narrative prose\n5. Show authorial perspective (trade-offs, reasoning)\n\n### Remediation\n\nIf slop score exceeds 2.5 (moderate), run:\n\n```\nAgent(scribe:doc-editor) --target [file]\n```\n\nThis provides interactive section-by-section cleanup with user approval.\n\n### Skip Options\n\n- Use `--skip-slop` flag to bypass slop detection\n- Slop warnings are non-blocking by default\n\n## Step 4.5: Sync Plugin Registrations (`plugins-synced`)\n\n**Audit plugin.json files against disk** (prevents registration drift):\n\n```bash\n# Quick discrepancy check for all plugins\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  pjson=\"$plugin/.claude-plugin/plugin.json\"\n  [ -f \"$pjson\" ] || continue\n\n  # Count commands\n  json_cmds=$(jq -r '.commands | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_cmds=$(ls \"$plugin/commands/\"*.md 2>/dev/null | wc -l)\n\n  # Count skills (directories only)\n  json_skills=$(jq -r '.skills | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_skills=$(ls -d \"$plugin/skills\"/*/ 2>/dev/null | wc -l)\n\n  # Report mismatches\n  if [ \"$json_cmds\" != \"$disk_cmds\" ] || [ \"$json_skills\" != \"$disk_skills\" ]; then\n    echo \"$name: commands=$json_cmds/$disk_cmds skills=$json_skills/$disk_skills\"\n  fi\ndone\n```\n\n**If mismatches found**: Run `/update-plugins --fix` or manually update plugin.json files.\n\n**Why this matters**: Unregistered commands/skills won't appear in Claude Code's slash command menu or be discoverable.\n\n## Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nLoad: `@modules/capabilities-sync.md`\n\n**Purpose**: Ensure plugin.json registrations are reflected in reference documentation.\n\n**Sync Targets**:\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n\n**Quick Check**:\n```bash\n# Compare registered vs documented skills\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort > /tmp/registered-skills.txt\n\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md | \\\n  head -120 | awk -F'|' '{print $2\":\"$3}' | sort > /tmp/documented-skills.txt\n\n# Show missing\ncomm -23 /tmp/registered-skills.txt /tmp/documented-skills.txt\n```\n\n**If discrepancies found**:\n1. **Missing from docs**: Add entries to capabilities-reference.md tables\n2. **Missing plugin pages**: Create `book/src/plugins/{plugin}.md`\n3. **Missing from SUMMARY**: Add plugin to `book/src/SUMMARY.md`\n\n**Auto-generate entry format**:\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description} |\n```\n\n**Skip options**: Use `--skip-capabilities` to bypass this phase.\n\n## Step 5: Verify Accuracy (`accuracy-verified`)\n\nLoad: `@modules/accuracy-scanning.md`\n\n**Validate claims against codebase:**\n\n```bash\n# Quick version check\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone\n\n# Quick counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\n```\n**Verification:** Run the command with `--help` flag to verify availability.\n\n**Flag mismatches:**\n- Version numbers that don't match plugin.json\n- Plugin/skill/command counts that don't match actual directories\n- File paths that don't exist\n\n**LSP-Enhanced Verification (2.0.74+)**:\n\nWhen `ENABLE_LSP_TOOL=1` is set, enhance accuracy verification with semantic analysis:\n\n1. **API Documentation Coverage**:\n   - Query LSP for all public functions/classes\n   - Check which lack documentation\n   - Verify all exported items are documented\n\n2. **Signature Verification**:\n   - Compare documented function signatures with actual code\n   - Detect parameter mismatches\n   - Flag return type discrepancies\n\n3. **Reference Finding**:\n   - Use LSP to find all usages of documented items\n   - Include real usage examples in documentation\n   - Verify cross-references are accurate\n\n4. **Code Structure Validation**:\n   - Check documented file paths exist (via LSP definitions)\n   - Verify module organization matches documentation\n   - Detect renamed/moved items\n\n**Efficiency**: LSP queries (50ms) vs. manual file tracing (minutes) - dramatically faster verification.\n\n**Default Strategy**: Documentation updates should **prefer LSP** for all verification tasks. Enable `ENABLE_LSP_TOOL=1` permanently for best results.\n\n**Non-blocking**: Warnings are informational; user decides whether to fix.\n\n## Step 6: Preview Changes (`preview`)\n\n- Show diffs for each edited file (`git diff <file>` or `rg` snippets).\n- Include accuracy warnings if any were flagged.\n- Summarize:\n  - Files created/modified/deleted\n  - Consolidation actions taken\n  - Style violations fixed\n  - Remaining TODOs or follow-ups\n\n## Exit Criteria\n\n- All `TodoWrite` items are completed and documentation is updated.\n- New ADRs, if any, are in `wiki/architecture/` (or the established ADR directory) with the correct status and links to related work.\n- Directory-specific style rules are satisfied.\n- Accuracy warnings addressed or acknowledged.\n- Content does not sound AI-generated.\n- Files are staged or ready for review.\n\n## Flags\n\n| Flag | Effect |\n|------|--------|\n| `--skip-consolidation` | Skip Phase 2.5 consolidation check |\n| `--skip-slop` | Skip Phase 4.25 AI slop detection |\n| `--strict` | Treat all warnings as errors |\n| `--book-style` | Apply book/ rules to all files |\n## Troubleshooting\n\n### Common Issues\n\n**Documentation out of sync**\nRun `make docs-update` to regenerate from code\n\n**Build failures**\nCheck that all required dependencies are installed\n\n**Links broken**\nVerify relative paths in documentation files\n\nFile v1.9.16:_meta.json\n\n{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-sanctum-doc-updates\",\n  \"version\": \"1.9.16\",\n  \"publishedAt\": 1784059034019\n}\n\nFile v1.9.16:modules/accuracy-scanning.md\n\n# Accuracy Scanning Module\n\nValidate documentation claims against actual codebase state. Runs as Phase 5.5 before preview to catch stale version numbers, outdated counts, and broken references.\n\n## Scan Types\n\n### 1. Version Number Validation\n\nCompares version references in documentation against `plugin.json` files.\n\n**Patterns to detect:**\n- `v1.2.3`, `version: 1.2.3`\n- `Plugin Name (v1.2.3)`, `Plugin Name v1.2.3`\n- Table cells with version numbers\n\n**Validation:**\n```bash\n# Extract actual versions\nfor plugin in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '.name + \" \" + .version' \"$plugin\"\ndone\n\n# Sample output:\n# abstract 1.0.5\n# sanctum 1.0.6\n# scry 1.1.0\n```\n\n**Warning format:**\n```markdown\n| File | Claimed | Actual | Action |\n|------|---------|--------|--------|\n| docs/api-overview.md | abstract v2.1.0 | 1.0.5 | Update version |\n| README.md | sanctum v3.0.0 | 1.0.6 | Update version |\n```\n\n### 2. Plugin Count Validation\n\nVerifies claims like \"13 plugins\" against actual directory count.\n\n**Patterns to detect:**\n- \"N plugins\", \"contains N plugins\"\n- Table rows claiming to list all plugins\n\n**Validation:**\n```bash\n# Count plugin directories with valid plugin.json\nls -d plugins/*/.claude-plugin/plugin.json 2>/dev/null | wc -l\n```\n\n### 3. Skill/Command Count Validation\n\nVerifies per-plugin statistics.\n\n**Patterns to detect:**\n- \"X skills\", \"Y commands\", \"Z agents\"\n- API inventory tables\n\n**Validation:**\n```bash\n# Count skills for a plugin\nls -d plugins/sanctum/skills/*/SKILL.md 2>/dev/null | wc -l\n\n# Count commands\nls plugins/sanctum/commands/*.md 2>/dev/null | wc -l\n\n# Count agents\nls plugins/sanctum/agents/*.md 2>/dev/null | wc -l\n```\n\n### 4. File/Path Reference Validation\n\nVerifies that referenced paths exist.\n\n**Patterns to detect:**\n- Backtick paths: `` `plugins/sanctum/skills/doc-updates/SKILL.md` ``\n- Relative paths in links: `[link](./modules/foo.md)`\n- Configuration examples with paths\n\n**Validation:**\n```bash\n# Check if path exists\ntest -e \"$path\" && echo \"EXISTS\" || echo \"MISSING\"\n```\n\n## Scan Algorithm\n\n```python\ndef scan_for_accuracy(file_path: str, content: str) -> list[AccuracyWarning]:\n    warnings = []\n\n    # Load current plugin versions\n    actual_versions = load_plugin_versions()\n\n    # Find version references\n    version_pattern = r'(\\w+)[\\s\\(]v?(\\d+\\.\\d+\\.\\d+)'\n    for match in re.finditer(version_pattern, content):\n        plugin_name = match.group(1).lower()\n        claimed_version = match.group(2)\n\n        if plugin_name in actual_versions:\n            actual = actual_versions[plugin_name]\n            if claimed_version != actual:\n                warnings.append({\n                    'type': 'version_mismatch',\n                    'plugin': plugin_name,\n                    'claimed': claimed_version,\n                    'actual': actual,\n                    'line': get_line_number(content, match.start())\n                })\n\n    # Find count claims\n    count_pattern = r'(\\d+)\\s+(plugins?|skills?|commands?|agents?)'\n    for match in re.finditer(count_pattern, content, re.IGNORECASE):\n        claimed_count = int(match.group(1))\n        item_type = match.group(2).lower().rstrip('s')\n        actual_count = count_items(item_type)\n\n        if abs(claimed_count - actual_count) > 0:\n            warnings.append({\n                'type': 'count_mismatch',\n                'item_type': item_type,\n                'claimed': claimed_count,\n                'actual': actual_count,\n                'line': get_line_number(content, match.start())\n            })\n\n    return warnings\n```\n\n## Quick Validation Commands\n\nFor manual verification during doc updates:\n\n```bash\n# All plugin versions\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | sort\n\n# Total counts\necho \"Plugins: $(ls -d plugins/*/.claude-plugin/plugin.json | wc -l)\"\necho \"Skills: $(find plugins/*/skills -name 'SKILL.md' | wc -l)\"\necho \"Commands: $(find plugins/*/commands -maxdepth 1 -name '*.md' | wc -l)\"\necho \"Agents: $(find plugins/*/agents -name '*.md' | wc -l)\"\n```\n\n## Output Format\n\n### Phase 5.5: Verify Accuracy\n\n```markdown\n## Accuracy Scan Results\n\nScanned: docs/api-overview.md, README.md (2 files)\nTime: 0.3 seconds\n\n### Warnings Found\n\n| Type | File | Line | Issue | Fix |\n|------|------|------|-------|-----|\n| version | docs/api-overview.md | 15 | abstract v2.1.0 → 1.0.5 | Update |\n| version | docs/api-overview.md | 18 | sanctum v3.0.0 → 1.0.6 | Update |\n| count | README.md | 42 | \"11 plugins\" → 13 | Update |\n\n### No Issues\n- All file paths valid\n- Command references exist\n\n**Action**: Review warnings before proceeding to preview.\n```\n\n## Integration Notes\n\n- Non-blocking: Warnings don't prevent workflow completion\n- Selective: Only scans files being edited (from Phase 2 targets)\n- Fast: Bash commands complete in <1 second per file\n- Progressive: Loads only when Phase 5 edits are complete\n\n## Cross-Reference: /update-version\n\nWhen version bumps are performed via `/update-version`, the automated script updates config files but NOT documentation. The `/update-version` command includes Phase 2 to update documentation files. If you're running `/update-docs` after a version bump, pay special attention to `docs/api-overview.md` which contains the plugin version inventory.\n\n## Edge Cases\n\n### Approximate counts\nSome docs use \"~10 skills\" or \"about 50 commands\". These should be validated but with wider tolerance (±20%).\n\n### Unreleased versions\nIf a plugin shows \"0.0.0\" or \"dev\", skip version validation for that plugin.\n\n### External references\nPaths outside the repository (URLs, system paths) are not validated.\n\nFile v1.9.16:modules/adr-patterns.md\n\n# Architecture Decision Record (ADR) Patterns\n\n## ADR Template Structure\n\nEvery ADR must follow a consistent Markdown template with these required sections:\n\n### Required Sections\n\n1. **Title**\n   - Format: `ADR-{number}: {Brief Decision Description}`\n   - Example: `ADR-001: Use PostgreSQL for primary data store`\n\n2. **Status**\n   - One of: Proposed, Accepted, Deprecated, Superseded\n   - Include date when status changed\n\n3. **Context**\n   - Forces driving the decision\n   - Constraints that must be satisfied\n   - Prior art or existing patterns\n   - Why this decision is needed now\n\n4. **Decision**\n   - The chosen option with clear justification\n   - Specific implementation approach\n   - Rationale for why this solves the context\n\n5. **Alternatives Considered**\n   - Other options evaluated\n   - Why each alternative was rejected\n   - Trade-offs between options\n\n6. **Consequences**\n   - Positive outcomes expected\n   - Negative outcomes or limitations\n   - Impact on other components or teams\n   - Future implications\n\n7. **Metadata**\n   - Author(s)\n   - Date created\n   - Approvers (if required)\n   - Links to related documents\n\n## Status Flow\n\nADRs follow this lifecycle:\n\n```\nProposed → Accepted → [Deprecated | Superseded]\n```\n\n- **Proposed**: Draft ADR under review\n- **Accepted**: Decision approved and implemented\n- **Deprecated**: No longer recommended but not replaced\n- **Superseded**: Replaced by a newer ADR (reference the new ADR number)\n\n## Immutability Rules\n\nADRs are treated like code:\n\n1. **Draft during planning**: Create ADR before implementation begins\n2. **Review via pull request**: ADRs go through same review process as code\n3. **Immutable once accepted**: Never edit an accepted ADR's decision\n4. **Supersede, don't modify**: Create new ADR to change direction\n\n## Superseding an ADR\n\nWhen replacing an existing decision:\n\n1. Create new ADR with next sequential number\n2. Reference the superseded ADR number in context\n3. Explain what changed and why the shift occurred\n4. Update old ADR status to \"Superseded by ADR-{new-number}\"\n5. Add link in old ADR to new record\n\n## Location Conventions\n\nADRs typically are in one of these locations:\n- `wiki/architecture/`\n- `docs/adr/`\n- `architecture/decisions/`\n\nCheck project structure to determine the established location before creating ADRs.\n\n## Best Practices\n\n### Keep Focused\n- One architectural decision per ADR\n- Maximum 1-2 pages in length\n- Don't combine multiple decisions\n\n### Maintain Traceability\n- Link to requirements documents\n- Reference design documents\n- Connect to related ADRs\n- Include issue/ticket numbers\n\n### Write Grounded Content\n- Reference specific technologies, tools, or approaches\n- Include concrete examples where helpful\n- Avoid abstract language or filler\n- Use imperative mood for clarity\n\n### Review Checklist\n- [ ] Single focused decision\n- [ ] All required sections present\n- [ ] Alternatives documented with rationale\n- [ ] Consequences (both positive and negative) identified\n- [ ] Links to related work included\n- [ ] Status clearly marked\n- [ ] Location follows project convention\n\nFile v1.9.16:modules/capabilities-sync.md\n\n# Capabilities Sync Module\n\nSynchronizes plugin.json registrations with capabilities reference documentation.\n\n## Purpose\n\nDetects drift between:\n- **Source of truth**: `plugins/*/.claude-plugin/plugin.json` files\n- **Documentation**: `book/src/reference/capabilities-reference.md` and related files\n\n## When Loaded\n\nThis module is loaded during Step 4.75 (after plugins-synced, before accuracy-verified).\n\n## Sync Targets\n\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` (Skills table) |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` (Commands table) |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` (Agents table) |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` (Hooks table) |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n| Plugin in layer | `book/src/plugins/{layer}-layer.md` |\n| Plugin in SUMMARY | `book/src/SUMMARY.md` |\n\n## Detection Script\n\n```bash\n#!/bin/bash\n# capabilities-sync-check.sh\n# Run from repo root\n\necho \"=== Capabilities Sync Report ===\"\necho \"\"\n\n# Temporary files for comparison\nREGISTERED_SKILLS=$(mktemp)\nDOCUMENTED_SKILLS=$(mktemp)\nREGISTERED_COMMANDS=$(mktemp)\nDOCUMENTED_COMMANDS=$(mktemp)\nREGISTERED_AGENTS=$(mktemp)\nDOCUMENTED_AGENTS=$(mktemp)\n\n# Extract registered skills from plugin.json files\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_SKILLS\"\n\n# Extract documented skills from capabilities-reference.md\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Skills/,/All Commands/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/.*\\(\\.\\.\\/plugins\\//, \"\", $3); gsub(/\\.md\\).*/, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_SKILLS\"\n\n# Extract registered commands\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.commands[]? | sub(\"^\\\\./commands/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"/\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_COMMANDS\"\n\n# Extract documented commands\ngrep -E \"^\\| \\`/\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Commands/,/All Agents/p' | \\\n  grep -E \"^\\| \\`/\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $2}' | \\\n  sort -u > \"$DOCUMENTED_COMMANDS\"\n\n# Extract registered agents\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.agents[]? | sub(\"^\\\\./agents/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_AGENTS\"\n\n# Extract documented agents\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Agents/,/All Hooks/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_AGENTS\"\n\n# Report differences\necho \"### Skills\"\necho \"Missing from docs (registered but not documented):\"\ncomm -23 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs (documented but not registered):\"\ncomm -13 \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Commands\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" | sed 's/^/  - /'\n\necho \"\"\necho \"### Agents\"\necho \"Missing from docs:\"\ncomm -23 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\necho \"\"\necho \"Extra in docs:\"\ncomm -13 \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\" | sed 's/^/  - /'\n\n# Check for missing plugin pages in book\necho \"\"\necho \"### Plugin Pages\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if [ ! -f \"book/src/plugins/${name}.md\" ]; then\n    echo \"  - Missing: book/src/plugins/${name}.md\"\n  fi\ndone\n\n# Check SUMMARY.md includes all plugins\necho \"\"\necho \"### SUMMARY.md\"\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  if ! grep -q \"plugins/${name}.md\" book/src/SUMMARY.md 2>/dev/null; then\n    echo \"  - Missing from SUMMARY: ${name}\"\n  fi\ndone\n\n# Cleanup\nrm -f \"$REGISTERED_SKILLS\" \"$DOCUMENTED_SKILLS\" \"$REGISTERED_COMMANDS\" \"$DOCUMENTED_COMMANDS\" \"$REGISTERED_AGENTS\" \"$DOCUMENTED_AGENTS\"\n```\n\n## Workflow Integration\n\n### Step 4.75: Sync Capabilities Documentation (`capabilities-synced`)\n\nAfter `plugins-synced` (Step 4.5), run capabilities sync:\n\n```bash\n# Quick check for capabilities drift\nbash plugins/sanctum/skills/doc-updates/modules/capabilities-sync-check.sh\n```\n\n**If discrepancies found:**\n\n1. **Missing skills/commands/agents**: Generate table entries\n2. **Extra in docs**: Verify if removed or renamed\n3. **Missing plugin pages**: Create from template\n4. **Missing from SUMMARY**: Add to appropriate layer\n\n### Auto-Generation Templates\n\n#### Skill Entry\n```markdown\n| `{skill-name}` | [{plugin}](../plugins/{plugin}.md) | {description from SKILL.md frontmatter} |\n```\n\n#### Command Entry\n```markdown\n| `/{plugin}:{command}` | {plugin} | {description from command.md frontmatter} |\n```\n\n#### Agent Entry\n```markdown\n| `{agent-name}` | {plugin} | {description from agent.md frontmatter} |\n```\n\n#### Hook Entry\n```markdown\n| `{hook-file}` | {plugin} | {type} | {description} |\n```\n\n## Capabilities Sync Check\n\nTool: `scripts/capabilities-sync-check.sh` (invoked by\n`make docs-sync-check` and the `.github/workflows/capabilities-sync.yml`\nCI job).\n\nCompares skills/commands/agents registered in\n`plugins/*/.claude-plugin/plugin.json` against the tables in\n`book/src/reference/capabilities-reference.md`. Reports any items\npresent in `plugin.json` but missing from the doc, and vice versa.\n\n### CLI Usage\n\n```bash\n# Run the sync check (read-only)\nbash scripts/capabilities-sync-check.sh\n\n# Or via make\nmake docs-sync-check\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | All registered capabilities appear in the doc |\n| 1 | Discrepancies found |\n\n### Fixing Discrepancies\n\nThe check is read-only. When it reports a missing entry:\n\n1. Open `book/src/reference/capabilities-reference.md`\n2. Locate the relevant section (e.g. `### All skills (Alphabetical)`)\n3. Add a row using the same `| `name` | plugin | description |` shape\n   already present in the table\n4. Re-run the check to confirm\n\nWhen the check reports an extra entry (in the doc but not in any\n`plugin.json`), either re-register the item in the plugin's\n`plugin.json` or remove the row from the doc.\n\n## Exit Criteria\n\n- All registered capabilities appear in documentation\n- No orphaned documentation entries (items removed from plugin.json)\n- All plugins have book pages\n- SUMMARY.md is complete\n\nFile v1.9.16:modules/consolidation-integration.md\n\n# Consolidation Integration Module\n\nBridges doc-updates with doc-consolidation capabilities. Detects redundancy and bloat in existing documentation, presenting consolidation opportunities before edits begin.\n\n## Purpose\n\nDuring Phase 2.5, scan for:\n1. **Redundant files**: Multiple docs covering the same topic\n2. **Bloated files**: Docs exceeding recommended length thresholds\n3. **Stale files**: Documentation that should be deleted or archived\n4. **Untracked reports**: LLM-generated files that need consolidation\n\n## Detection Approach\n\n### Reuse from doc-consolidation\n\nImport candidate detection logic from `sanctum:doc-consolidation`:\n- Git-untracked file detection\n- ALL_CAPS naming pattern matching\n- Content marker scanning (Executive Summary, Findings, etc.)\n\n### Additional Signals for Committed Files\n\nExtend detection to analyze committed documentation:\n\n**Bloat signals:**\n- `docs/`: File exceeds 500 lines, section exceeds 150 lines\n- `book/`: File exceeds 1000 lines, section exceeds 300 lines\n- Multiple \"wall of text\" paragraphs (>4 sentences in docs/, >8 in book/)\n\n**Redundancy signals:**\n- Similar file names: `api-overview.md` vs `api-reference.md`\n- Similar headings across files\n- Overlapping content sections (manual inspection)\n- Design docs whose content exists in command/skill documentation\n- Planning artifacts for completed work (already implemented)\n\n**Redundancy check command:**\n```bash\n# For a candidate file, check if content exists elsewhere\ngrep -r \"key phrase from candidate\" docs/ book/ plugins/*/commands/*.md plugins/*/README.md\n```\n\n**Staleness signals:**\n- References to deprecated features\n- Version numbers more than 2 minor versions behind\n- \"TODO: update\" comments older than 30 days\n\n## Workflow\n\n### Step 1: Scan for Candidates\n\n```bash\n# Find untracked .md files (doc-consolidation pattern)\ngit status --porcelain | grep '^??' | grep '\\.md$' | grep -v 'docs/\\|book/\\|skills/\\|commands/\\|agents/'\n\n# Find bloated docs/ files (500 line limit)\nfind docs/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 500 {print}'\n\n# Find bloated book/ files (1000 line limit)\nfind book/ -name '*.md' -exec wc -l {} \\; 2>/dev/null | awk '$1 > 1000 {print}'\n\n# Find recently unchanged files (potential staleness) - docs: 90 days, book: 180 days\nfind docs/ -name '*.md' -mtime +90 -type f 2>/dev/null\nfind book/ -name '*.md' -mtime +180 -type f 2>/dev/null\n```\n\n### Step 2: Present Opportunities\n\nShow consolidation candidates with recommended actions:\n\n```markdown\n## Phase 2.5: Consolidation Opportunities\n\n### Redundant Files (delete - content exists elsewhere)\n\n| File | Action | Reason |\n|------|--------|--------|\n| plugins/memory-palace/docs/PALACE_UNIFICATION.md | Delete | Content already in commands/palace.md |\n| docs/old-api-design.md | Delete | Superseded by docs/api-overview.md |\n\n### Untracked Reports (merge or delete)\n\n| File | Score | Markers | Recommendation |\n|------|-------|---------|----------------|\n| API_REVIEW_REPORT.md | 6 | Executive Summary, Findings | Merge to docs/api-overview.md |\n| MIGRATION_NOTES.md | 4 | Action Items, Tables | Merge to docs/migration-guide.md |\n\n### Bloated Files (split or trim)\n\n| File | Lines | Threshold | Recommendation |\n|------|-------|-----------|----------------|\n| book/src/tutorials/error-handling-tutorial.md | 1031 | 1000 | Trim verbose sections |\n| docs/function-extraction-guidelines.md | 571 | 500 | Consider splitting principles/patterns |\n\n### Staleness Candidates (review or delete)\n\n| File | Last Modified | Issue | Recommendation |\n|------|---------------|-------|----------------|\n| docs/enhanced-pre-commit-hooks.md | 45 days | Content moved to imbue | Delete |\n| docs/technical-debt-framework.md | 60 days | Replaced by backlog | Delete |\n\n---\n\n**Options:**\n- `Y` - Proceed with all recommended actions\n- `n` - Skip consolidation, continue to edits\n- `select` - Choose specific items to address\n- `--skip-consolidation` flag bypasses this phase\n```\n\n### Step 3: Execute Approved Actions\n\nFor each approved action:\n\n**Delete (redundant) actions:**\n1. Verify content exists in target document(s) by searching for key phrases\n2. Confirm no unique valuable content would be lost\n3. Remove file: `rm <file>`\n4. Add deletion to git staging: `git add -u`\n\n**Merge actions:**\n1. Extract valuable content from source\n2. Integrate into destination (using doc-consolidation merge strategies)\n3. Delete source file\n4. Add to git staging\n\n**Delete (stale) actions:**\n1. Confirm file has no unique valuable content\n2. Remove file\n3. Add deletion to git staging\n\n**Split actions:**\n1. Create new files for logical sections\n2. Move content to new locations\n3. Update cross-references\n4. Preserve original as index if needed\n\n**Action priority:**\n1. Delete redundant first (unbloats without adding content)\n2. Delete stale second (removes outdated info)\n3. Merge third (consolidates remaining value)\n4. Split last (increases file count, use sparingly)\n\n## User Controls\n\n### Skip Flag\n```bash\n/update-docs --skip-consolidation\n```\nBypasses Phase 2.5 entirely for quick updates.\n\n### Selective Processing\nWhen user chooses \"select\":\n```\nEnter file numbers to process (comma-separated), or 'all'/'none':\n> 1,3\nProcessing: API_REVIEW_REPORT.md, docs/enhanced-pre-commit-hooks.md\n```\n\n### Dry Run\n```bash\n/update-docs --consolidation-dry-run\n```\nShows what would be consolidated without executing.\n\n## Thresholds\n\n| Metric | docs/ Limit | book/ Limit | Action |\n|--------|-------------|-------------|--------|\n| File length | 500 lines | 1000 lines | Flag for review |\n| Section length | 150 lines | 300 lines | Suggest split |\n| Paragraph sentences | 4 | 8 | Warn, don't block |\n| Stale threshold | 90 days | 180 days | Review suggestion |\n\n## Integration with doc-consolidation\n\nThis module **imports** patterns from doc-consolidation but **does not** duplicate its full workflow:\n\n- **Imports**: Candidate detection signals, content markers, scoring\n- **Extends**: Adds bloat and staleness detection for committed files\n- **Defers to**: Full doc-consolidation skill for complex multi-file merges\n\nFor straightforward cases (single untracked report, obvious deletion), handle inline. For complex consolidations, recommend: \"Run `/merge-docs` for detailed consolidation workflow.\"\n\n## Exit Criteria\n\nPhase 2.5 completes when:\n- All candidates reviewed (approved or skipped)\n- Approved merges/deletions executed\n- Git staging updated with changes\n- Summary logged for Phase 5 preview\n\nProceed to Phase 3 (Edits Applied) regardless of consolidation outcome.\n\nFile v1.9.16:modules/directory-style-rules.md\n\n# Directory-Specific Style Rules\n\nApply different documentation standards based on file location. The `docs/` directory requires strict conciseness while `book/` allows technical book format with longer explanations.\n\n## Rule Sets\n\n### docs/ - Strict Reference Style\n\nTarget audience: Developers seeking quick answers.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Keeps files navigable |\n| Max section length | 100 lines | Forces topic focus |\n| Max paragraph sentences | 4 | Prevents wall-of-text |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Start directly (no \"This document describes...\")\n- Imperative mood for instructions\n- Bullets over prose for lists of 3+ items\n- Code examples over abstract descriptions\n\n**Anti-patterns to flag:**\n- Executive summaries (remove or move to introduction)\n- Filler phrases: \"in order to\", \"it should be noted\", \"as mentioned\"\n- Qualification hedging: \"generally\", \"typically\", \"usually\"\n- Empty transitions: \"Moving on\", \"Now let's look at\"\n\n### book/ - Technical Book Style\n\nTarget audience: Learners working through chapters.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 1000 lines | Chapter-length content |\n| Max section length | 300 lines | Tutorial depth allowed |\n| Max paragraph sentences | 8 | Explanatory narratives |\n| Max list items | 15 | Subgroup for clarity |\n| Max table rows | 25 | Comparison tables |\n\n**Allowed patterns:**\n- Narrative explanations\n- Before/after comparisons\n- Step-by-step walkthroughs\n- Conceptual introductions\n- Callout emojis (sparingly)\n\n**Still flagged:**\n- Filler phrases\n- Redundant explanations\n- Overly long code blocks without commentary\n\n### wiki/ - Wiki Reference Style\n\nTarget audience: Internal team and contributors seeking context.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 500 lines | Quick reference |\n| Max section length | 100 lines | Topic focus |\n| Max paragraph sentences | 4 | Scannable |\n| Max list items | 10 | Subgroup beyond this |\n| Max table rows | 15 | Paginate or summarize |\n\n**Required patterns:**\n- Same as docs/ strict style\n- Cross-links to related wiki pages\n- Architecture Decision Records (ADRs) in wiki/architecture/\n\n### plugins/*/README.md - Plugin Summary Style\n\nTarget audience: Users evaluating or installing plugins.\n\n| Rule | Limit | Rationale |\n|------|-------|-----------|\n| Max file length | 300 lines | Concise overview |\n| Max section length | 50 lines | Quick scan |\n| Max paragraph sentences | 4 | Brief descriptions |\n| Max list items | 10 | Key features only |\n| Max table rows | 15 | Command/skill listing |\n\n**Required patterns:**\n- Installation instructions\n- Quick start example\n- Link to detailed docs in book/\n\n### Shared Rules (All Locations)\n\nApply everywhere regardless of directory:\n\n- No emojis in headings or body (callouts excepted in book/)\n- Grounded language (specific references, not vague claims)\n- Imperative mood for docstrings\n- No marketing language (\"capable\", \"smooth\", \"elegant\")\n- No first-person plural (\"we can see\", \"let's explore\")\n- Prose text wraps at 80 chars per line (hybrid wrapping:\n  prefer sentence/clause boundaries over arbitrary breaks)\n- Blank line before and after every heading\n- ATX headings only (`#` prefix, never setext underlines)\n- Blank line before every list (ordered or unordered)\n- Reference-style links when inline links push past 80 chars\n- Full formatting spec: `Skill(leyline:markdown-formatting)`\n\n## Detection Patterns\n\n### Wall-of-Text Detection\n\n```python\ndef detect_wall_of_text(content: str, max_sentences: int) -> list[Violation]:\n    violations = []\n    paragraphs = extract_paragraphs(content)\n\n    for i, para in enumerate(paragraphs):\n        sentence_count = len(re.split(r'[.!?]+', para.strip()))\n        if sentence_count > max_sentences:\n            violations.append({\n                'type': 'wall_of_text',\n                'location': f'paragraph {i+1}',\n                'actual': sentence_count,\n                'limit': max_sentences,\n                'suggestion': 'Break into smaller paragraphs or convert to bullet list'\n            })\n\n    return violations\n```\n\n### Filler Phrase Detection\n\n```python\nFILLER_PHRASES = [\n    r'\\bin order to\\b',\n    r'\\bit should be noted\\b',\n    r'\\bas mentioned (above|below|earlier|previously)\\b',\n    r'\\bmoving on\\b',\n    r'\\bnow let\\'?s (look at|explore|consider)\\b',\n    r'\\bthis (document|section|chapter) (describes|explains|covers)\\b',\n]\n\ndef detect_filler(content: str) -> list[Violation]:\n    violations = []\n    for pattern in FILLER_PHRASES:\n        matches = re.findall(pattern, content, re.IGNORECASE)\n        for match in matches:\n            violations.append({\n                'type': 'filler_phrase',\n                'phrase': match,\n                'suggestion': 'Remove or rewrite directly'\n            })\n    return violations\n```\n\n## Validation Workflow\n\n### Step 1: Determine Rule Set\n\n```python\ndef get_ruleset(file_path: str) -> RuleSet:\n    if file_path.startswith('book/'):\n        return BOOK_RULES\n    elif file_path.startswith('docs/'):\n        return DOCS_RULES\n    elif file_path.startswith('wiki/'):\n        return WIKI_RULES\n    elif re.match(r'plugins/[^/]+/README\\.md$', file_path):\n        return PLUGIN_README_RULES\n    else:\n        return DOCS_RULES  # Default to strict\n```\n\n### Step 2: Run Checks\n\n```python\ndef validate_file(file_path: str, content: str) -> ValidationResult:\n    rules = get_ruleset(file_path)\n    violations = []\n\n    # Structure checks\n    lines = content.split('\\n')\n    if len(lines) > rules.max_lines:\n        violations.append({\n            'severity': 'warning',\n            'type': 'file_length',\n            'actual': len(lines),\n            'limit': rules.max_lines\n        })\n\n    # Wall-of-text check\n    violations.extend(detect_wall_of_text(content, rules.max_sentences))\n\n    # Filler phrase check\n    violations.extend(detect_filler(content))\n\n    return ValidationResult(\n        file_path=file_path,\n        ruleset=rules.name,\n        violations=violations,\n        passed=len([v for v in violations if v.get('severity') == 'error']) == 0\n    )\n```\n\n### Step 3: Report Format\n\n```markdown\n## Style Validation: docs/api-overview.md\n\nUsing ruleset: **docs/ (strict)**\n\n### Violations Found\n\n| Severity | Type | Details | Suggestion |\n|----------|------|---------|------------|\n| warning | wall_of_text | Paragraph 3 has 7 sentences (limit: 4) | Break into smaller paragraphs |\n| info | filler_phrase | \"in order to\" | Remove or rewrite directly |\n| info | filler_phrase | \"This document describes\" | Start with content directly |\n\n### Passed Checks\n- File length: 287/500 lines\n- Section lengths: All under 100 lines\n- No marketing language detected\n```\n\n## Progressive Loading\n\nThis module loads only when Phase 4 (Guidelines Verified) is reached. It does not run during earlier phases to conserve context.\n\n**Load trigger**: `doc-updates:edits-applied` completed\n**Dependencies**: None\n\nFile v1.9.16:skill-card.md\n\n## Description: <br>\nUpdates documentation after code changes with quality gates, slop detection, and accuracy checks. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[athola](https://clawhub.ai/user/athola) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and technical writers use this skill to update README files, plans, wikis, ADRs, and docstrings after code changes. It helps identify documentation targets, apply grounded edits, run style and accuracy checks, and preview the resulting changes. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Documentation edits or consolidation steps may remove or change useful content. <br>\nMitigation: Review proposed deletions, merges, staged changes, and previews before accepting the workflow output. <br>\nRisk: Broad activation triggers such as writing may invoke the workflow outside focused documentation tasks. <br>\nMitigation: Invoke the skill explicitly or narrow activation to documentation update work when broad triggers are inconvenient. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/athola/skills/nm-sanctum-doc-updates) <br>\n- [Declared homepage](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum) <br>\n- [Accuracy scanning module](modules/accuracy-scanning.md) <br>\n- [Capabilities sync module](modules/capabilities-sync.md) <br>\n- [Directory style rules module](modules/directory-style-rules.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Markdown, Code, Shell commands, Configuration, Guidance] <br>\n**Output Format:** [Markdown with inline shell commands and file-edit guidance] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May propose documentation edits, validation warnings, consolidation actions, and change previews.] <br>\n\n## Skill Version(s): <br>\n1.9.16 (source: server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.9.14: 8 files, 19489 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2121b), SKILL.md (13812b), _meta.json (142b)\n\nFile v1.9.14:SKILL.md\n\n---\nname: doc-updates\ndescription: |\n  Updates documentation after code changes with quality gates, slop detection, and accuracy checks\nversion: 1.9.8\ntriggers:\n  - documentation\n  - readme\n  - adr\n  - docstrings\n  - writing\n  - consolidation\n  - debloat\n  - code changes require corresponding doc updates\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.sanctum:shared\", \"night-market.sanctum:git-workspace-review\", \"night-market.imbue:proof-of-work\", \"night-market.scribe:slop-detector\", \"night-market.scribe:doc-generator\"]}}}\nsource: claude-night-market\nsource_plugin: sanctum\n---\n\n> **Night Market Skill** — ported from [claude-night-market/sanctum](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Step 1: Collect Context](#step-1-collect-context-context-collected)\n- [Step 2: Identify Targets](#step-2-identify-targets-targets-identified)\n- [Step 2.5: Check for Consolidation](#step-25-check-for-consolidation-consolidation-checked)\n- [Step 3: Apply Edits](#step-3-apply-edits-edits-applied)\n- [Step 4: Enforce Guidelines](#step-4-enforce-guidelines-guidelines-verified)\n- [Step 4.25: AI Slop Detection](#step-425-ai-slop-detection-slop-scanned)\n- [Step 4.75: Sync Capabilities Documentation](#step-475-sync-capabilities-documentation-capabilities-synced)\n- [Step 5: Verify Accuracy](#step-5-verify-accuracy-accuracy-verified)\n- [Step 6: Preview Changes](#step-6-preview-changes-preview)\n- [Exit Criteria](#exit-criteria)\n- [Flags](#flags)\n\n\n# Documentation Update Workflow\n\n## When To Use\n\nUse this skill when code changes require updates to the README, plans, wikis, or docstrings. Run `Skill(sanctum:git-workspace-review)` first to capture the change context.\n\n### System Capabilities\n\nThe documentation update workflow includes several specialized functions. It identifies redundancy through consolidation detection and enforces directory-specific style rules, with strict limits for `docs/` and more lenient ones for the `book/` directory. The system also verifies the accuracy of version numbers and component counts and integrates with the LSP for semantic documentation verification in supported versions of Claude Code.\n\n## When NOT To Use\n\n- README-specific updates - use update-readme instead\n- Complex multi-file consolidation - use doc-consolidation\n\n## Required TodoWrite Items\n\n1. `doc-updates:context-collected` - Git context + CHANGELOG review\n2. `doc-updates:targets-identified`\n3. `doc-updates:consolidation-checked` (skippable)\n4. `doc-updates:edits-applied`\n5. `doc-updates:guidelines-verified`\n6. `doc-updates:slop-scanned` - AI marker detection via scribe\n7. `doc-updates:plugins-synced` - plugin.json ↔ disk audit\n8. `doc-updates:capabilities-synced` - plugin.json ↔ documentation sync\n9. `doc-updates:accuracy-verified`\n10. `doc-updates:preview`\n\n## Step 1: Collect Context (`context-collected`)\n\n- Validate `Skill(sanctum:git-workspace-review)` has been run.\n- Use its notes to understand the delta.\n- Identify the features or bug fixes tha\n\nArchive v1.9.13: 8 files, 19516 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2165b), SKILL.md (13812b), _meta.json (142b)\n\nArchive v1.9.12: 8 files, 19513 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2232b), SKILL.md (13812b), _meta.json (142b)\n\nArchive v1.0.3: 8 files, 19630 bytes\n\nFiles: modules/accuracy-scanning.md (5645b), modules/adr-patterns.md (3107b), modules/capabilities-sync.md (7005b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2505b), SKILL.md (13812b), _meta.json (141b)\n\nArchive v1.0.2: 8 files, 20374 bytes\n\nFiles: modules/accuracy-scanning.md (5633b), modules/adr-patterns.md (3108b), modules/capabilities-sync.md (9896b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), skill-card.md (2392b), SKILL.md (13781b), _meta.json (141b)\n\nArchive v1.0.1: 7 files, 19135 bytes\n\nFiles: modules/accuracy-scanning.md (5633b), modules/adr-patterns.md (3108b), modules/capabilities-sync.md (9896b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), SKILL.md (13781b), _meta.json (141b)\n\nArchive v1.0.0: 7 files, 19135 bytes\n\nFiles: modules/accuracy-scanning.md (5633b), modules/adr-patterns.md (3108b), modules/capabilities-sync.md (9896b), modules/consolidation-integration.md (6555b), modules/directory-style-rules.md (7111b), SKILL.md (13781b), _meta.json (141b)","readmeExcerpt":"Skill: doc-updates Owner: athola Summary: Updates documentation after code changes with quality gates, slop detection, and accuracy checks Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:20:16.228Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:40:20.663Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:57:14.019Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:05:10.289Z | user Release v1.9.14 v1.9.13 | 20","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"# Check recent CHANGELOG entries for undocumented features\nhead -100 CHANGELOG.md\n\n# Compare documented version vs plugin versions\ngrep -E \"^\\[.*\\]\" CHANGELOG.md | head -3\nfor p in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '\"\\(.name): \\(.version)\"' \"$p\"\ndone | head -5"},{"language":"text","snippet":"Skill(scribe:slop-detector) --target [edited-files]"},{"language":"text","snippet":"# If superpowers/elements-of-style is installed:\nSkill(elements-of-style:writing-clearly-and-concisely)\n\n# Fallback if not installed - use scribe:doc-generator principles:\nSkill(scribe:doc-generator) --remediate"},{"language":"text","snippet":"Agent(scribe:doc-editor) --target [file]"},{"language":"bash","snippet":"# Quick discrepancy check for all plugins\nfor plugin in plugins/*/; do\n  name=$(basename \"$plugin\")\n  pjson=\"$plugin/.claude-plugin/plugin.json\"\n  [ -f \"$pjson\" ] || continue\n\n  # Count commands\n  json_cmds=$(jq -r '.commands | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_cmds=$(ls \"$plugin/commands/\"*.md 2>/dev/null | wc -l)\n\n  # Count skills (directories only)\n  json_skills=$(jq -r '.skills | length' \"$pjson\" 2>/dev/null || echo 0)\n  disk_skills=$(ls -d \"$plugin/skills\"/*/ 2>/dev/null | wc -l)\n\n  # Report mismatches\n  if [ \"$json_cmds\" != \"$disk_cmds\" ] || [ \"$json_skills\" != \"$disk_skills\" ]; then\n    echo \"$name: commands=$json_cmds/$disk_cmds skills=$json_skills/$disk_skills\"\n  fi\ndone"},{"language":"bash","snippet":"# Compare registered vs documented skills\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort > /tmp/registered-skills.txt\n\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md | \\\n  head -120 | awk -F'|' '{print $2\":\"$3}' | sort > /tmp/documented-skills.txt\n\n# Show missing\ncomm -23 /tmp/registered-skills.txt /tmp/documented-skills.txt"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: doc-updates\ndescription: |\n  Updates documentation after code changes with quality gates, slop detection, and accuracy checks\nversion: 1.9.8\ntriggers:\n  - documentation\n  - readme\n  - adr\n  - docstrings\n  - writing\n  - consolidation\n  - debloat\n  - code changes require corresponding doc updates\nmetadata: {\"openclaw\": {\"homepage\": \"https://github.com/athola/claude-night-market/tree/master/plugins/sanctum\", \"emoji\": \"\\ud83e\\udd9e\", \"requires\": {\"config\": [\"night-market.sanctum:shared\", \"night-market.sanctum:git-workspace-review\", \"night-market.imbue:proof-of-work\", \"night-market.scribe:slop-detector\", \"night-market.scribe:doc-generator\"]}}}\nsource: claude-night-market\nsource_plugin: sanctum\n---\n\n> **Night Market Skill** — ported from [claude-night-market/sanctum](https://github.com/athola/claude-night-market/tree/master/plugins/sanctum). For the full experience with agents, hooks, and commands, install the Claude Code plugin.\n\n\n## Table of Contents\n\n- [When to Use](#when-to-use)\n- [Required TodoWrite Items](#required-todowrite-items)\n- [Step 1: Collect Context](#step-1-collect-context-context-collected)\n- [Step 2: Identify Targets](#step-2-identify-targets-targets-identified)\n- [Step 2.5: Check for Consolidation](#step-25-check-for-consolidation-consolidation-checked)\n- [Step 3: Apply Edits](#step-3-apply-edits-edits-applied)\n- [Step 4: Enforce Guidelines](#step-4-enforce-guidelines-guidelines-verified)\n- [Step 4.25: AI Slop Detection](#step-425-ai-slop-detection-slop-scanned)\n- [Step 4.75: Sync Capabilities Documentation](#step-475-sync-capabilities-documentation-capabilities-synced)\n- [Step 5: Verify Accuracy](#step-5-verify-accuracy-accuracy-verified)\n- [Step 6: Preview Changes](#step-6-preview-changes-preview)\n- [Exit Criteria](#exit-criteria)\n- [Flags](#flags)\n\n\n# Documentation Update Workflow\n\n## When To Use\n\nUse this skill when code changes require updates to the README, plans, wikis, or docstrings. Run `Skill(sanctum:git-workspace-review)` first to capture the change context.\n\n### System Capabilities\n\nThe documentation update workflow includes several specialized functions. It identifies redundancy through consolidation detection and enforces directory-specific style rules, with strict limits for `docs/` and more lenient ones for the `book/` directory. The system also verifies the accuracy of version numbers and component counts and integrates with the LSP for semantic documentation verification in supported versions of Claude Code.\n\n## When NOT To Use\n\n- README-specific updates - use update-readme instead\n- Complex multi-file consolidation - use doc-consolidation\n\n## Required TodoWrite Items\n\n1. `doc-updates:context-collected` - Git context + CHANGELOG review\n2. `doc-updates:targets-identified`\n3. `doc-updates:consolidation-checked` (skippable)\n4. `doc-updates:edits-applied`\n5. `doc-updates:guidelines-verified`\n6. `doc-updates:slop-scanned` - AI marker detection via scribe\n7. `doc-updates:plugins-synced` - plugin.json ↔ disk audi"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7d107jg9jv602h9ytsegydq184a42s\",\n  \"slug\": \"nm-sanctum-doc-updates\",\n  \"version\": \"1.9.19\",\n  \"publishedAt\": 1787750416228\n}"},{"path":"modules/accuracy-scanning.md","content":"# Accuracy Scanning Module\n\nValidate documentation claims against actual codebase state. Runs as Phase 5.5 before preview to catch stale version numbers, outdated counts, and broken references.\n\n## Scan Types\n\n### 1. Version Number Validation\n\nCompares version references in documentation against `plugin.json` files.\n\n**Patterns to detect:**\n- `v1.2.3`, `version: 1.2.3`\n- `Plugin Name (v1.2.3)`, `Plugin Name v1.2.3`\n- Table cells with version numbers\n\n**Validation:**\n```bash\n# Extract actual versions\nfor plugin in plugins/*/.claude-plugin/plugin.json; do\n    jq -r '.name + \" \" + .version' \"$plugin\"\ndone\n\n# Sample output:\n# abstract 1.0.5\n# sanctum 1.0.6\n# scry 1.1.0\n```\n\n**Warning format:**\n```markdown\n| File | Claimed | Actual | Action |\n|------|---------|--------|--------|\n| docs/api-overview.md | abstract v2.1.0 | 1.0.5 | Update version |\n| README.md | sanctum v3.0.0 | 1.0.6 | Update version |\n```\n\n### 2. Plugin Count Validation\n\nVerifies claims like \"13 plugins\" against actual directory count.\n\n**Patterns to detect:**\n- \"N plugins\", \"contains N plugins\"\n- Table rows claiming to list all plugins\n\n**Validation:**\n```bash\n# Count plugin directories with valid plugin.json\nls -d plugins/*/.claude-plugin/plugin.json 2>/dev/null | wc -l\n```\n\n### 3. Skill/Command Count Validation\n\nVerifies per-plugin statistics.\n\n**Patterns to detect:**\n- \"X skills\", \"Y commands\", \"Z agents\"\n- API inventory tables\n\n**Validation:**\n```bash\n# Count skills for a plugin\nls -d plugins/sanctum/skills/*/SKILL.md 2>/dev/null | wc -l\n\n# Count commands\nls plugins/sanctum/commands/*.md 2>/dev/null | wc -l\n\n# Count agents\nls plugins/sanctum/agents/*.md 2>/dev/null | wc -l\n```\n\n### 4. File/Path Reference Validation\n\nVerifies that referenced paths exist.\n\n**Patterns to detect:**\n- Backtick paths: `` `plugins/sanctum/skills/doc-updates/SKILL.md` ``\n- Relative paths in links: `[link](./modules/foo.md)`\n- Configuration examples with paths\n\n**Validation:**\n```bash\n# Check if path exists\ntest -e \"$path\" && echo \"EXISTS\" || echo \"MISSING\"\n```\n\n## Scan Algorithm\n\n```python\ndef scan_for_accuracy(file_path: str, content: str) -> list[AccuracyWarning]:\n    warnings = []\n\n    # Load current plugin versions\n    actual_versions = load_plugin_versions()\n\n    # Find version references\n    version_pattern = r'(\\w+)[\\s\\(]v?(\\d+\\.\\d+\\.\\d+)'\n    for match in re.finditer(version_pattern, content):\n        plugin_name = match.group(1).lower()\n        claimed_version = match.group(2)\n\n        if plugin_name in actual_versions:\n            actual = actual_versions[plugin_name]\n            if claimed_version != actual:\n                warnings.append({\n                    'type': 'version_mismatch',\n                    'plugin': plugin_name,\n                    'claimed': claimed_version,\n                    'actual': actual,\n                    'line': get_line_number(content, match.start())\n                })\n\n    # Find count claims\n    count_pattern = r'(\\d+)\\s+(plugins?|skills?|commands?|agents?)'\n  "},{"path":"modules/adr-patterns.md","content":"# Architecture Decision Record (ADR) Patterns\n\n## ADR Template Structure\n\nEvery ADR must follow a consistent Markdown template with these required sections:\n\n### Required Sections\n\n1. **Title**\n   - Format: `ADR-{number}: {Brief Decision Description}`\n   - Example: `ADR-001: Use PostgreSQL for primary data store`\n\n2. **Status**\n   - One of: Proposed, Accepted, Deprecated, Superseded\n   - Include date when status changed\n\n3. **Context**\n   - Forces driving the decision\n   - Constraints that must be satisfied\n   - Prior art or existing patterns\n   - Why this decision is needed now\n\n4. **Decision**\n   - The chosen option with clear justification\n   - Specific implementation approach\n   - Rationale for why this solves the context\n\n5. **Alternatives Considered**\n   - Other options evaluated\n   - Why each alternative was rejected\n   - Trade-offs between options\n\n6. **Consequences**\n   - Positive outcomes expected\n   - Negative outcomes or limitations\n   - Impact on other components or teams\n   - Future implications\n\n7. **Metadata**\n   - Author(s)\n   - Date created\n   - Approvers (if required)\n   - Links to related documents\n\n## Status Flow\n\nADRs follow this lifecycle:\n\n```\nProposed → Accepted → [Deprecated | Superseded]\n```\n\n- **Proposed**: Draft ADR under review\n- **Accepted**: Decision approved and implemented\n- **Deprecated**: No longer recommended but not replaced\n- **Superseded**: Replaced by a newer ADR (reference the new ADR number)\n\n## Immutability Rules\n\nADRs are treated like code:\n\n1. **Draft during planning**: Create ADR before implementation begins\n2. **Review via pull request**: ADRs go through same review process as code\n3. **Immutable once accepted**: Never edit an accepted ADR's decision\n4. **Supersede, don't modify**: Create new ADR to change direction\n\n## Superseding an ADR\n\nWhen replacing an existing decision:\n\n1. Create new ADR with next sequential number\n2. Reference the superseded ADR number in context\n3. Explain what changed and why the shift occurred\n4. Update old ADR status to \"Superseded by ADR-{new-number}\"\n5. Add link in old ADR to new record\n\n## Location Conventions\n\nADRs typically are in one of these locations:\n- `wiki/architecture/`\n- `docs/adr/`\n- `architecture/decisions/`\n\nCheck project structure to determine the established location before creating ADRs.\n\n## Best Practices\n\n### Keep Focused\n- One architectural decision per ADR\n- Maximum 1-2 pages in length\n- Don't combine multiple decisions\n\n### Maintain Traceability\n- Link to requirements documents\n- Reference design documents\n- Connect to related ADRs\n- Include issue/ticket numbers\n\n### Write Grounded Content\n- Reference specific technologies, tools, or approaches\n- Include concrete examples where helpful\n- Avoid abstract language or filler\n- Use imperative mood for clarity\n\n### Review Checklist\n- [ ] Single focused decision\n- [ ] All required sections present\n- [ ] Alternatives documented with rationale\n- [ ] Consequences (both positive and negative) identified\n- [ "},{"path":"modules/capabilities-sync.md","content":"# Capabilities Sync Module\n\nSynchronizes plugin.json registrations with capabilities reference documentation.\n\n## Purpose\n\nDetects drift between:\n- **Source of truth**: `plugins/*/.claude-plugin/plugin.json` files\n- **Documentation**: `book/src/reference/capabilities-reference.md` and related files\n\n## When Loaded\n\nThis module is loaded during Step 4.75 (after plugins-synced, before accuracy-verified).\n\n## Sync Targets\n\n| Source | Documentation Target |\n|--------|---------------------|\n| `plugin.json.skills[]` | `book/src/reference/capabilities-reference.md` (Skills table) |\n| `plugin.json.commands[]` | `book/src/reference/capabilities-reference.md` (Commands table) |\n| `plugin.json.agents[]` | `book/src/reference/capabilities-reference.md` (Agents table) |\n| `hooks/hooks.json` | `book/src/reference/capabilities-reference.md` (Hooks table) |\n| Plugin existence | `book/src/plugins/{plugin}.md` |\n| Plugin in layer | `book/src/plugins/{layer}-layer.md` |\n| Plugin in SUMMARY | `book/src/SUMMARY.md` |\n\n## Detection Script\n\n```bash\n#!/bin/bash\n# capabilities-sync-check.sh\n# Run from repo root\n\necho \"=== Capabilities Sync Report ===\"\necho \"\"\n\n# Temporary files for comparison\nREGISTERED_SKILLS=$(mktemp)\nDOCUMENTED_SKILLS=$(mktemp)\nREGISTERED_COMMANDS=$(mktemp)\nDOCUMENTED_COMMANDS=$(mktemp)\nREGISTERED_AGENTS=$(mktemp)\nDOCUMENTED_AGENTS=$(mktemp)\n\n# Extract registered skills from plugin.json files\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.skills[]? | sub(\"^\\\\./skills/\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_SKILLS\"\n\n# Extract documented skills from capabilities-reference.md\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Skills/,/All Commands/p' | \\\n  grep -E \"^\\| \\`\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/.*\\(\\.\\.\\/plugins\\//, \"\", $3); gsub(/\\.md\\).*/, \"\", $3); print $3\":\"$2}' | \\\n  sort -u > \"$DOCUMENTED_SKILLS\"\n\n# Extract registered commands\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.commands[]? | sub(\"^\\\\./commands/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"/\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_COMMANDS\"\n\n# Extract documented commands\ngrep -E \"^\\| \\`/\" book/src/reference/capabilities-reference.md 2>/dev/null | \\\n  sed -n '/All Commands/,/All Agents/p' | \\\n  grep -E \"^\\| \\`/\" | \\\n  awk -F'|' '{gsub(/[`\\[\\] ]/, \"\", $2); gsub(/ /, \"\", $3); print $2}' | \\\n  sort -u > \"$DOCUMENTED_COMMANDS\"\n\n# Extract registered agents\nfor pjson in plugins/*/.claude-plugin/plugin.json; do\n  plugin=$(basename $(dirname $(dirname \"$pjson\")))\n  jq -r --arg p \"$plugin\" '.agents[]? | sub(\"^\\\\./agents/\"; \"\") | sub(\"\\\\.md$\"; \"\") | \"\\($p):\\(.)\"' \"$pjson\" 2>/dev/null\ndone | sort -u > \"$REGISTERED_AGENTS\"\n\n# Extract documented agents\ngrep -E \"^\\| \\`[a-z-]+\\` \\|\" book/src/reference/capabiliti"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Updates documentation after code changes with quality gates, slop detection, and accuracy checks Skill: doc-updates Owner: athola Summary: Updates documentation after code changes with quality gates, slop detection, and accuracy checks Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:20:16.228Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:40:20.663Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:57:14.019Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:05:10.289Z | user Release v1.9.14 v1.9.13 | 20","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1089,"uniquenessScore":48,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T11:09:54.927Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T13:33:24.770Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}