|
| 1 | +--- |
| 2 | +name: goclaw-docs-audit |
| 3 | +description: "Detect which GoClaw docs pages need updating when source code changes." |
| 4 | +argument-hint: "[commit-range|file1 file2 ...]" |
| 5 | +metadata: |
| 6 | + author: goclaw |
| 7 | + version: "2.0.0" |
| 8 | +--- |
| 9 | + |
| 10 | +# GoClaw Docs Audit |
| 11 | + |
| 12 | +> Detect which GoClaw docs need updating when GoClaw source code changes. |
| 13 | +> Cross-check accuracy against GoClaw source docs (source of truth). |
| 14 | +
|
| 15 | +## Trigger |
| 16 | + |
| 17 | +`/goclaw-docs-audit` or `/goclaw-docs-audit <commit-range>` or `/goclaw-docs-audit <file1> <file2>` |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +- `/goclaw-docs-audit` — audit all changes since last audit (or last commit if first run) |
| 22 | +- `/goclaw-docs-audit HEAD~5..HEAD` — audit specific commit range |
| 23 | +- `/goclaw-docs-audit internal/agent/loop.go internal/channels/telegram/bot.go` — audit specific files |
| 24 | + |
| 25 | +## GoClaw Source Path |
| 26 | + |
| 27 | +The skill needs access to the GoClaw source repository. Resolution order: |
| 28 | + |
| 29 | +1. **`GOCLAW_SOURCE_PATH`** environment variable (set in shell or `.claude/settings.local.json`) |
| 30 | +2. **Fallback:** `../goclaw/` (assumes `goclaw/` and `goclaw-docs/` share the same parent folder) |
| 31 | + |
| 32 | +If neither resolves to a valid git repo, ask the user for the path. |
| 33 | + |
| 34 | +**Contributor setup example:** |
| 35 | +```bash |
| 36 | +export GOCLAW_SOURCE_PATH=/path/to/my/goclaw |
| 37 | +``` |
| 38 | +Or in `.claude/settings.local.json`: |
| 39 | +```json |
| 40 | +{ "env": { "GOCLAW_SOURCE_PATH": "/path/to/my/goclaw" } } |
| 41 | +``` |
| 42 | + |
| 43 | +## Instructions |
| 44 | + |
| 45 | +When this skill is triggered, follow these steps exactly: |
| 46 | + |
| 47 | +### Step 0: Resolve GoClaw Source Path |
| 48 | + |
| 49 | +Determine `$GOCLAW_SOURCE` using the resolution order above: |
| 50 | +1. Check if `GOCLAW_SOURCE_PATH` env var is set and points to a valid git repo |
| 51 | +2. Otherwise check if `../goclaw/` exists and is a valid git repo |
| 52 | +3. If neither works, ask the user to set `GOCLAW_SOURCE_PATH` |
| 53 | + |
| 54 | +Use `$GOCLAW_SOURCE` for all subsequent steps where `../goclaw/` was referenced. |
| 55 | + |
| 56 | +### Step 1: Identify Changed Files |
| 57 | + |
| 58 | +- If argument is a commit range (contains `..` or `HEAD`): run `git diff --name-only <range>` in `$GOCLAW_SOURCE` |
| 59 | +- If argument is file paths: use those directly |
| 60 | +- If no argument: |
| 61 | + 1. Read `.claude/skills/goclaw-docs-audit/.last-audit` for the last audit commit hash |
| 62 | + 2. If file exists: run `git diff --name-only <last-audit-hash>..HEAD` in `$GOCLAW_SOURCE` |
| 63 | + 3. If file doesn't exist (first run): run `git diff --name-only HEAD~1..HEAD` in `$GOCLAW_SOURCE` |
| 64 | + |
| 65 | +### Step 2: Load Mapping Rules |
| 66 | + |
| 67 | +Read `mapping.json` from the same directory as this SKILL.md file. |
| 68 | + |
| 69 | +The mapping also includes `source_of_truth` pointing to `docs/` (relative to `$GOCLAW_SOURCE`) — use those authoritative docs to verify accuracy of goclaw-docs pages. |
| 70 | + |
| 71 | +### Step 3: Match Changed Files to Docs |
| 72 | + |
| 73 | +For each changed file, check if its path matches any `pattern` in the mapping rules (use glob matching). Collect all matched `docs` pages and their `priority`. |
| 74 | + |
| 75 | +### Step 4: Accuracy Check Against Source of Truth |
| 76 | + |
| 77 | +For each matched docs page, cross-reference with the corresponding `$GOCLAW_SOURCE/docs/*.md` file: |
| 78 | +- Read the relevant goclaw internal doc (e.g., `01-agent-loop.md` for agent changes) |
| 79 | +- Compare key facts (config fields, API signatures, behavior descriptions) against what the goclaw-docs page says |
| 80 | +- Flag any discrepancies as "Needs accuracy update" |
| 81 | + |
| 82 | +Source of truth mapping (`$GOCLAW_SOURCE/docs/`): |
| 83 | +| GoClaw Doc | Covers | |
| 84 | +|---|---| |
| 85 | +| `00-architecture-overview.md` | Overall architecture, component relationships | |
| 86 | +| `01-agent-loop.md` | Agent loop, reasoning, tool execution | |
| 87 | +| `02-providers.md` | LLM provider integrations | |
| 88 | +| `03-tools-system.md` | Tool registration, execution, built-in tools | |
| 89 | +| `04-gateway-protocol.md` | WebSocket/RPC protocol | |
| 90 | +| `05-channels-messaging.md` | Channel integrations | |
| 91 | +| `06-store-data-model.md` | Database schema, data model | |
| 92 | +| `07-bootstrap-skills-memory.md` | Bootstrap, skills, memory systems | |
| 93 | +| `08-scheduling-cron.md` | Cron jobs, scheduling | |
| 94 | +| `09-security.md` | Security, auth, permissions | |
| 95 | +| `10-tracing-observability.md` | OpenTelemetry, tracing | |
| 96 | +| `11-agent-teams.md` | Agent teams, delegation | |
| 97 | +| `12-extended-thinking.md` | Extended thinking feature | |
| 98 | +| `13-ws-team-events.md` | WebSocket team events | |
| 99 | +| `14-skills-runtime.md` | Skills runtime | |
| 100 | +| `15-core-skills-system.md` | Core skills system | |
| 101 | +| `16-skill-publishing.md` | Skill publishing | |
| 102 | +| `17-changelog.md` | Changelog | |
| 103 | +| `18-http-api.md` | HTTP/REST API | |
| 104 | +| `19-websocket-rpc.md` | WebSocket RPC methods | |
| 105 | +| `20-api-keys-auth.md` | API keys, authentication | |
| 106 | + |
| 107 | +### Step 5: Check EN-VI Sync Status |
| 108 | + |
| 109 | +For each matched docs page in the goclaw-docs repo: |
| 110 | +- Get last modification date of the EN file (e.g., `getting-started/quick-start.md`) |
| 111 | +- Get last modification date of the VI file (e.g., `vi/getting-started/quick-start.md`) |
| 112 | +- If VI is older than EN, or VI doesn't exist: mark as "Outdated" |
| 113 | +- If VI is same date or newer: mark as "Synced" |
| 114 | + |
| 115 | +Use `git log -1 --format=%cd --date=short -- <file>` to get last modification dates. |
| 116 | + |
| 117 | +### Step 6: Generate Report |
| 118 | + |
| 119 | +Create a markdown report with this format: |
| 120 | + |
| 121 | +```markdown |
| 122 | +# GoClaw Docs Audit Report |
| 123 | + |
| 124 | +**GoClaw changes:** `<commit-range or file list>` |
| 125 | +**Date:** YYYY-MM-DD |
| 126 | + |
| 127 | +## Affected Docs Pages |
| 128 | + |
| 129 | +| Changed File | Affected Docs | Priority | |
| 130 | +|---|---|---| |
| 131 | +| internal/agent/loop.go | agents/*, core-concepts/agents-explained.md | High | |
| 132 | + |
| 133 | +## Accuracy Check (vs $GOCLAW_SOURCE/docs/) |
| 134 | + |
| 135 | +| Docs Page | Source of Truth | Status | Notes | |
| 136 | +|---|---|---|---| |
| 137 | +| agents/creating-agents.md | 01-agent-loop.md | Accurate | — | |
| 138 | +| core-concepts/tools-overview.md | 03-tools-system.md | Discrepancy | Missing new tool type "x" | |
| 139 | + |
| 140 | +## EN-VI Sync Status |
| 141 | + |
| 142 | +| EN Page | Last EN Update | Last VI Update | Status | |
| 143 | +|---|---|---|---| |
| 144 | +| getting-started/quick-start.md | 2026-03-07 | 2026-03-01 | Outdated | |
| 145 | + |
| 146 | +## Recommended Actions |
| 147 | +1. Review `agents/creating-agents.md` — agent creation flow changed |
| 148 | +2. Fix accuracy: `core-concepts/tools-overview.md` missing new tool type |
| 149 | +3. Sync VI translation for `getting-started/quick-start.md` |
| 150 | +``` |
| 151 | + |
| 152 | +### Step 7: Save Report |
| 153 | + |
| 154 | +Save to `{goclaw-docs-root}/plans/reports/docs-audit-{YYYY-MM-DD}.md` or to the reports path provided by session context. |
| 155 | + |
| 156 | +### Step 8: Update Last Audit Marker |
| 157 | + |
| 158 | +After saving the report, record the current HEAD commit hash of `$GOCLAW_SOURCE` so the next no-argument run starts from here: |
| 159 | + |
| 160 | +```bash |
| 161 | +cd $GOCLAW_SOURCE && git rev-parse HEAD > <goclaw-docs-root>/.claude/skills/goclaw-docs-audit/.last-audit |
| 162 | +``` |
| 163 | + |
| 164 | +The `.last-audit` file contains a single line: the commit hash. This file is gitignored. |
| 165 | + |
| 166 | +## Key Rules |
| 167 | + |
| 168 | +- GoClaw source path is resolved via `GOCLAW_SOURCE_PATH` env var, fallback to `../goclaw/` (assumes same parent folder) |
| 169 | +- `$GOCLAW_SOURCE/docs/` is the **source of truth** for feature accuracy |
| 170 | +- Docs live in `goclaw-docs/` (EN at root, VI under `vi/`) |
| 171 | +- If no GoClaw repo found, ask user for the path |
| 172 | +- Always show: affected docs, accuracy check, AND EN-VI sync status |
| 173 | +- Group results by priority (High → Medium → Low) |
0 commit comments