ai-fob 1.1.3 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agents/meta-auditor-agent.md +48 -0
- package/assets/commands/audit-cc-assets.md +585 -0
- package/assets/commands/build-phase-V2.md +25 -1
- package/assets/commands/create-highlevel-plan-phases.md +14 -1
- package/assets/commands/deep-research.md +430 -0
- package/assets/skills/audit-cc-assets/SKILL.md +305 -0
- package/assets/skills/audit-cc-assets/reference/audit-checklist.md +285 -0
- package/assets/skills/audit-cc-assets/reference/changelog-parsing.md +128 -0
- package/assets/skills/audit-cc-assets/templates/audit-report.md +103 -0
- package/assets/skills/audit-cc-assets/templates/audit-state-schema.md +57 -0
- package/assets/skills/deep-research/SKILL.md +194 -0
- package/assets/skills/deep-research/reference/evaluation-frameworks.md +203 -0
- package/assets/skills/deep-research/reference/research-methodology.md +154 -0
- package/assets/skills/deep-research/templates/decision-record.md +34 -0
- package/assets/skills/deep-research/templates/domain-research.md +68 -0
- package/assets/skills/deep-research/templates/overview.md +63 -0
- package/assets/skills/deep-research/templates/stage-document.md +57 -0
- package/manifest.json +11 -6
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: meta-auditor-agent
|
|
3
|
+
description: >
|
|
4
|
+
CC Documentation Auditor. Receives current CC documentation research and
|
|
5
|
+
asset inventory scan, cross-references each asset against current CC
|
|
6
|
+
conventions, and produces categorized findings (BREAKING/OUTDATED/MISSING)
|
|
7
|
+
with fix recommendations. Use when auditing CC assets against current
|
|
8
|
+
documentation.
|
|
9
|
+
tools: Read, Grep, Glob
|
|
10
|
+
model: opus
|
|
11
|
+
color: yellow
|
|
12
|
+
permissionMode: plan
|
|
13
|
+
skills:
|
|
14
|
+
- claude-code-primitives
|
|
15
|
+
- audit-cc-assets
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Meta Auditor Agent
|
|
19
|
+
|
|
20
|
+
## Purpose
|
|
21
|
+
|
|
22
|
+
You are a CC documentation auditor. You analyze CC assets (skills, agents, commands, hooks, reference guides) against current Claude Code documentation to detect documentation drift. Your domain knowledge comes from two preloaded skills: `claude-code-primitives` provides the baseline for what correct CC assets look like, and `audit-cc-assets` provides the audit methodology, categorization framework, and report format.
|
|
23
|
+
|
|
24
|
+
## Core Principle: Compare, Don't Assume
|
|
25
|
+
|
|
26
|
+
Always verify against the documentation data provided in your delegation prompt. Never rely on pre-trained knowledge about what CC documentation says -- it changes frequently. If a value is not addressed by the provided documentation data, do not flag it. You report only what the evidence supports, nothing more.
|
|
27
|
+
|
|
28
|
+
## Workflow
|
|
29
|
+
|
|
30
|
+
When invoked, follow these steps:
|
|
31
|
+
|
|
32
|
+
1. **Load the audit checklist.** Read `reference/audit-checklist.md` from the `audit-cc-assets` skill. This contains the exhaustive valid-value lists for every auditable dimension.
|
|
33
|
+
2. **Load the report template.** Read `templates/audit-report.md` from the `audit-cc-assets` skill. This defines the output format.
|
|
34
|
+
3. **Parse the delegation prompt.** Extract the documentation research data (current CC state) and the asset scan data (current asset state) provided by the calling command.
|
|
35
|
+
4. **Audit each asset.** For every asset file in the scan data, read the file directly using the Read tool. Compare every auditable dimension (frontmatter fields, tool names, permission modes, model values, URLs, skill references, hook events) against the valid-value lists from the checklist and the current documentation data.
|
|
36
|
+
5. **Classify findings.** For each discrepancy, classify it as BREAKING, OUTDATED, or MISSING using the categorization framework from the `audit-cc-assets` skill. Determine severity, auto-fixability, breaking change status, and the CC version that introduced the change (if known).
|
|
37
|
+
6. **Include exact references.** Every finding must include the exact file path and line number where the issue occurs.
|
|
38
|
+
7. **Produce the report.** Structure the output using the audit report template. Include the summary, categorized findings sections, and fix plan table.
|
|
39
|
+
|
|
40
|
+
## Report
|
|
41
|
+
|
|
42
|
+
Structure your output using the audit report template from the `audit-cc-assets` skill (`templates/audit-report.md`). The report must include:
|
|
43
|
+
|
|
44
|
+
- **Summary**: File counts, finding counts by category, auto-fixable count
|
|
45
|
+
- **BREAKING Findings**: Each with file, line, current value, recommended fix, severity, CC version, description
|
|
46
|
+
- **OUTDATED Findings**: Each with file, line, current value, recommended fix, severity, CC version, description
|
|
47
|
+
- **MISSING Findings**: Each with file, line, what is missing, severity, CC version, description, recommendation
|
|
48
|
+
- **Fix Plan**: Table of BREAKING and OUTDATED fixes grouped by file
|
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Audit CC assets against current Claude Code documentation -- identifies breaking changes, outdated patterns, and missing features
|
|
3
|
+
model: opus
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: Agent, Skill, Read, Write, Edit, Glob, Grep, Bash, MultiEdit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Audit CC Assets
|
|
9
|
+
|
|
10
|
+
Audit all CC assets (skills, agents, commands, hooks, reference guides) against current Claude Code documentation. Detects breaking changes, identifies outdated patterns, catalogs missing features, and applies fixes with user approval. Supports incremental audits by tracking state between runs.
|
|
11
|
+
|
|
12
|
+
**Required Skill**: Before starting Step 1, invoke the `audit-cc-assets` skill using the Skill tool. This loads the audit methodology, categorization framework (BREAKING, OUTDATED, MISSING), per-asset-type audit dimensions, finding structure, source URLs, and audit state schema into the command agent's context. Keep this methodology in context throughout all 10 steps.
|
|
13
|
+
|
|
14
|
+
### Step 1: Check State (Main Agent)
|
|
15
|
+
|
|
16
|
+
You (the main agent) handle this step directly. The audit-cc-assets skill is already loaded from the Required Skill invocation above.
|
|
17
|
+
|
|
18
|
+
1. **Determine the current CC version.** Run `claude --version` via the Bash tool. Parse the version string (e.g., "claude v2.1.76"). Store as CURRENT_CC_VERSION.
|
|
19
|
+
- If the Bash command fails (binary not found), ask the user: "Could not detect the CC version. What version of Claude Code is installed? (e.g., 2.1.76)"
|
|
20
|
+
|
|
21
|
+
2. **Read the audit state file.** Use the Read tool to read `.claude/audit-state.json`.
|
|
22
|
+
|
|
23
|
+
**If the file exists:**
|
|
24
|
+
- Parse the JSON. Extract `lastAuditedCCVersion`, `lastAuditDate`, and `lastAuditSummary`.
|
|
25
|
+
- Determine the audit mode:
|
|
26
|
+
- If the CC version gap is more than 5 minor versions since `lastAuditedCCVersion`, set AUDIT_MODE to `full`.
|
|
27
|
+
- Otherwise, set AUDIT_MODE to `incremental`.
|
|
28
|
+
- Present to the user:
|
|
29
|
+
```
|
|
30
|
+
AUDIT STATE
|
|
31
|
+
Current CC version: v{CURRENT_CC_VERSION}
|
|
32
|
+
Last audited: v{lastAuditedCCVersion} on {lastAuditDate}
|
|
33
|
+
Previous findings: {lastAuditSummary.totalFindings} total ({lastAuditSummary.breaking} breaking, {lastAuditSummary.outdated} outdated, {lastAuditSummary.missing} missing)
|
|
34
|
+
Fixes applied last time: {lastAuditSummary.fixesApplied}
|
|
35
|
+
Audit mode: {AUDIT_MODE}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**If the file does NOT exist:**
|
|
39
|
+
- This is the first audit. Set AUDIT_MODE to `full`.
|
|
40
|
+
- Present to the user:
|
|
41
|
+
```
|
|
42
|
+
AUDIT STATE
|
|
43
|
+
Current CC version: v{CURRENT_CC_VERSION}
|
|
44
|
+
No previous audit found. This will be a full audit.
|
|
45
|
+
The full CC documentation will be fetched and all assets will be scanned.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. **Proceed automatically.** Do NOT wait for user confirmation. Move directly to Step 2.
|
|
49
|
+
|
|
50
|
+
### Step 2: Research (Parallel agents via Agent tool)
|
|
51
|
+
|
|
52
|
+
Spawn two agents **in parallel** (both Agent tool calls in the SAME message). Neither depends on the other's output. Make all Agent tool calls in a single response so they execute in parallel.
|
|
53
|
+
|
|
54
|
+
#### 2a. Docs Researcher
|
|
55
|
+
|
|
56
|
+
Delegate via the Agent tool (set `subagent_type` to `"docs-researcher-agent"`) with description "CC docs changelog research" and this prompt:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
You are researching the current Claude Code documentation and changelog for a CC asset audit.
|
|
60
|
+
|
|
61
|
+
## Audit Context
|
|
62
|
+
- Current CC version: {CURRENT_CC_VERSION}
|
|
63
|
+
- Last audited CC version: {lastAuditedCCVersion or "none (first audit)"}
|
|
64
|
+
- Audit mode: {AUDIT_MODE}
|
|
65
|
+
|
|
66
|
+
## Your Research Tasks
|
|
67
|
+
|
|
68
|
+
### Task 1: Fetch the CC Changelog
|
|
69
|
+
Fetch the CC changelog from https://code.claude.com/docs/en/changelog
|
|
70
|
+
|
|
71
|
+
If this is an incremental audit (last audited version is known):
|
|
72
|
+
- Extract all changes between v{lastAuditedCCVersion} (exclusive) and v{CURRENT_CC_VERSION} (inclusive)
|
|
73
|
+
- For each version entry: note the version number, date, and each change with its category (new feature, improvement, bug fix, breaking change, deprecation)
|
|
74
|
+
- Focus on audit-relevant changes: new frontmatter fields, tool name changes, hook event changes, permission mode changes, documentation URL changes, model changes, deprecated features
|
|
75
|
+
|
|
76
|
+
If this is a full audit (first audit):
|
|
77
|
+
- Extract the most recent 10 version entries for context
|
|
78
|
+
- Focus on capturing the current state rather than historical changes
|
|
79
|
+
|
|
80
|
+
### Task 2: Fetch Current CC Documentation
|
|
81
|
+
Fetch each of these official documentation pages to establish the current ground truth:
|
|
82
|
+
|
|
83
|
+
1. Skills documentation: https://code.claude.com/docs/en/skills
|
|
84
|
+
2. Sub-agents documentation: https://code.claude.com/docs/en/sub-agents
|
|
85
|
+
3. Tools reference: https://code.claude.com/docs/en/tools-reference
|
|
86
|
+
4. Model configuration: https://code.claude.com/docs/en/model-config
|
|
87
|
+
5. Permissions: https://code.claude.com/docs/en/permissions
|
|
88
|
+
6. Hooks: https://code.claude.com/docs/en/hooks
|
|
89
|
+
7. Agent teams: https://code.claude.com/docs/en/agent-teams
|
|
90
|
+
8. Commands: https://code.claude.com/docs/en/commands
|
|
91
|
+
|
|
92
|
+
For each page, extract:
|
|
93
|
+
- All valid frontmatter fields per asset type
|
|
94
|
+
- All valid tool names (complete canonical list)
|
|
95
|
+
- All valid permission modes
|
|
96
|
+
- All valid model values (aliases, full IDs, special values)
|
|
97
|
+
- All valid hook events and handler types
|
|
98
|
+
- Any deprecated patterns or migration guidance
|
|
99
|
+
|
|
100
|
+
### Task 3: Compile Current CC State Summary
|
|
101
|
+
Produce a structured summary of the current CC state:
|
|
102
|
+
- Complete list of valid tool names
|
|
103
|
+
- Complete list of valid hook events
|
|
104
|
+
- Complete list of valid permission modes
|
|
105
|
+
- Complete list of valid model aliases and model ID patterns
|
|
106
|
+
- Complete list of frontmatter fields per asset type (skills, agents, commands)
|
|
107
|
+
- Complete list of string substitution variables
|
|
108
|
+
- Any recently deprecated patterns with replacement guidance
|
|
109
|
+
|
|
110
|
+
## Output Format
|
|
111
|
+
|
|
112
|
+
Structure your findings with these sections:
|
|
113
|
+
|
|
114
|
+
### Changelog Entries (v{lastAuditedCCVersion} to v{CURRENT_CC_VERSION})
|
|
115
|
+
[For each version: version, date, audit-relevant changes with category]
|
|
116
|
+
|
|
117
|
+
### Current CC State
|
|
118
|
+
[Complete valid-value lists for every auditable dimension]
|
|
119
|
+
|
|
120
|
+
### Deprecated Patterns
|
|
121
|
+
[Patterns that have been deprecated or renamed, with replacement guidance]
|
|
122
|
+
|
|
123
|
+
### Documentation Observations
|
|
124
|
+
[Anything unusual or noteworthy found during documentation research]
|
|
125
|
+
|
|
126
|
+
Do NOT write your findings to a file. Return them directly.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### 2b. Explorer (Asset Scanner)
|
|
130
|
+
|
|
131
|
+
Delegate via the Agent tool (set `subagent_type` to `"explorer-agent"`) with description "CC asset inventory scan" and this prompt:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
You are scanning ALL CC assets in this project for a comprehensive audit inventory.
|
|
135
|
+
|
|
136
|
+
## Your Scan Tasks
|
|
137
|
+
|
|
138
|
+
Scan the entire `.claude/` directory and catalog every CC asset. Be exhaustive -- the auditor needs to know exactly what exists and what each asset contains.
|
|
139
|
+
|
|
140
|
+
### 1. Agent Files
|
|
141
|
+
For each `.md` file in `.claude/agents/`:
|
|
142
|
+
- File path
|
|
143
|
+
- All frontmatter fields with their exact values (name, description, tools, disallowedTools, model, permissionMode, maxTurns, skills, mcpServers, hooks, memory, background, isolation, color, and any other fields present)
|
|
144
|
+
- Body content summary (purpose, workflow steps, key instructions)
|
|
145
|
+
- Line count (total file lines)
|
|
146
|
+
|
|
147
|
+
### 2. Skill Directories
|
|
148
|
+
For each directory in `.claude/skills/`:
|
|
149
|
+
- Directory path
|
|
150
|
+
- SKILL.md: all frontmatter fields with exact values, line count
|
|
151
|
+
- Reference files: list each file in `reference/` with line count
|
|
152
|
+
- Template files: list each file in `templates/` with line count
|
|
153
|
+
- Script files: list each file in `scripts/` with line count
|
|
154
|
+
- Any non-standard subdirectories
|
|
155
|
+
|
|
156
|
+
### 3. Command Files
|
|
157
|
+
For each `.md` file in `.claude/commands/`:
|
|
158
|
+
- File path
|
|
159
|
+
- All frontmatter fields with their exact values (description, argument-hint, allowed-tools, model, disable-model-invocation, and any other fields present)
|
|
160
|
+
- Agent references: every `subagent_type` value mentioned in the body
|
|
161
|
+
- Skill references: every skill invoked via the Skill tool in the body
|
|
162
|
+
- Line count (total file lines)
|
|
163
|
+
|
|
164
|
+
### 4. Reference Guides in claude-code-primitives
|
|
165
|
+
For each file in `.claude/skills/claude-code-primitives/reference/`:
|
|
166
|
+
- File path
|
|
167
|
+
- Tool names mentioned (search for tool name references)
|
|
168
|
+
- Model values mentioned (search for model alias references)
|
|
169
|
+
- Frontmatter field lists (extract any tables documenting frontmatter fields)
|
|
170
|
+
- URL patterns (extract any documentation URLs)
|
|
171
|
+
- Line count
|
|
172
|
+
|
|
173
|
+
### 5. Settings and Hooks
|
|
174
|
+
Read `.claude/settings.json` if it exists:
|
|
175
|
+
- List all hook configurations with event names, handler types, and handler details
|
|
176
|
+
- Note any other settings configured
|
|
177
|
+
|
|
178
|
+
### 6. Summary Statistics
|
|
179
|
+
At the end, provide:
|
|
180
|
+
- Total agent files found
|
|
181
|
+
- Total skill directories found
|
|
182
|
+
- Total command files found
|
|
183
|
+
- Total reference/template files found
|
|
184
|
+
- Total files scanned
|
|
185
|
+
|
|
186
|
+
## Output Format
|
|
187
|
+
|
|
188
|
+
Structure your findings per-file, with exact values and line numbers for every item cataloged. Use this structure:
|
|
189
|
+
|
|
190
|
+
### Agents ({count} files)
|
|
191
|
+
[Per-file catalog]
|
|
192
|
+
|
|
193
|
+
### Skills ({count} directories)
|
|
194
|
+
[Per-directory catalog]
|
|
195
|
+
|
|
196
|
+
### Commands ({count} files)
|
|
197
|
+
[Per-file catalog]
|
|
198
|
+
|
|
199
|
+
### Reference Guides ({count} files)
|
|
200
|
+
[Per-file catalog]
|
|
201
|
+
|
|
202
|
+
### Settings
|
|
203
|
+
[Hook configurations and other settings]
|
|
204
|
+
|
|
205
|
+
### Summary
|
|
206
|
+
[Total counts]
|
|
207
|
+
|
|
208
|
+
Do NOT write your findings to a file. Return them directly.
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Step 3: Analyze (meta-auditor-agent via Agent tool)
|
|
212
|
+
|
|
213
|
+
After BOTH Step 2 agents return their findings, delegate the analysis to the meta-auditor-agent.
|
|
214
|
+
|
|
215
|
+
Delegate via the Agent tool (set `subagent_type` to `"meta-auditor-agent"`) with description "CC asset audit analysis" and this prompt:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
You are auditing all CC assets in this project against current Claude Code documentation.
|
|
219
|
+
|
|
220
|
+
## Audit Context
|
|
221
|
+
- Current CC version: {CURRENT_CC_VERSION}
|
|
222
|
+
- Last audited CC version: {lastAuditedCCVersion or "none (first audit)"}
|
|
223
|
+
- Audit mode: {AUDIT_MODE}
|
|
224
|
+
- Date: {CURRENT_DATE}
|
|
225
|
+
|
|
226
|
+
## Documentation Research Data (from docs-researcher-agent)
|
|
227
|
+
|
|
228
|
+
{INSERT the complete output from the docs-researcher-agent (Step 2a) here -- this is the current CC state, changelog entries, and deprecated patterns}
|
|
229
|
+
|
|
230
|
+
## Asset Scan Data (from explorer-agent)
|
|
231
|
+
|
|
232
|
+
{INSERT the complete output from the explorer-agent (Step 2b) here -- this is the complete inventory of all CC assets with their frontmatter values, contents, and line counts}
|
|
233
|
+
|
|
234
|
+
## Instructions
|
|
235
|
+
|
|
236
|
+
1. Before beginning analysis, load the audit checklist reference file at `reference/audit-checklist.md` from the `audit-cc-assets` skill. This contains the exhaustive valid-value lists you need for comparison.
|
|
237
|
+
|
|
238
|
+
2. For every asset file listed in the scan data, read the actual file using the Read tool. Do not rely solely on the scan summaries -- verify frontmatter values directly.
|
|
239
|
+
|
|
240
|
+
3. Compare every auditable dimension of every asset against:
|
|
241
|
+
- The valid-value lists from the audit checklist
|
|
242
|
+
- The current CC state from the documentation research
|
|
243
|
+
- The changelog changes since the last audit
|
|
244
|
+
|
|
245
|
+
4. For each discrepancy found, classify it using the categorization framework:
|
|
246
|
+
- BREAKING: Values that are invalid in current CC (asset will fail or behave unpredictably)
|
|
247
|
+
- OUTDATED: Values that still work but use deprecated identifiers
|
|
248
|
+
- MISSING: New features not reflected in assets or reference guides
|
|
249
|
+
|
|
250
|
+
5. For each finding, produce the complete finding record with all 10 fields: file, line, category, currentValue, recommendedFix, severity, breakingChange, autoFixable, ccVersion, description
|
|
251
|
+
|
|
252
|
+
6. Structure your output using the audit report template from `templates/audit-report.md` in the audit-cc-assets skill.
|
|
253
|
+
|
|
254
|
+
## Constraints
|
|
255
|
+
|
|
256
|
+
- Compare, Don't Assume. Only flag issues that are supported by the documentation research data. Do not rely on pre-trained knowledge about what CC documentation says.
|
|
257
|
+
- Every finding must include the exact file path and line number.
|
|
258
|
+
- BREAKING findings are listed first (most urgent).
|
|
259
|
+
- The Fix Plan section must group proposed changes by file.
|
|
260
|
+
- MISSING findings do NOT appear in the Fix Plan (they require user decisions, not automatic fixes).
|
|
261
|
+
|
|
262
|
+
Do NOT write your report to a file. Return it directly.
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Step 4: Present Report (Main Agent, interactive)
|
|
266
|
+
|
|
267
|
+
Receive the meta-auditor-agent's findings from Step 3. Parse the categorized findings and present them to the user organized by severity.
|
|
268
|
+
|
|
269
|
+
Present:
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
AUDIT REPORT
|
|
273
|
+
CC Version: v{CURRENT_CC_VERSION} (last audited: v{lastAuditedCCVersion or "none"})
|
|
274
|
+
Audit Mode: {AUDIT_MODE}
|
|
275
|
+
Assets Scanned: {count from meta-auditor report}
|
|
276
|
+
Assets with Findings: {count}
|
|
277
|
+
|
|
278
|
+
## BREAKING ({count})
|
|
279
|
+
|
|
280
|
+
[For each BREAKING finding:]
|
|
281
|
+
- {file path} (line {line}): `{currentValue}` -> `{recommendedFix}`
|
|
282
|
+
{description}
|
|
283
|
+
Auto-fixable: {yes/no}
|
|
284
|
+
|
|
285
|
+
## OUTDATED ({count})
|
|
286
|
+
|
|
287
|
+
[For each OUTDATED finding:]
|
|
288
|
+
- {file path} (line {line}): `{currentValue}` -> `{recommendedFix}`
|
|
289
|
+
{description}
|
|
290
|
+
Auto-fixable: {yes/no}
|
|
291
|
+
|
|
292
|
+
## MISSING ({count})
|
|
293
|
+
|
|
294
|
+
[For each MISSING finding:]
|
|
295
|
+
- {file path}: {description}
|
|
296
|
+
Recommendation: {recommendation -- marked as "User decision required"}
|
|
297
|
+
|
|
298
|
+
## Summary
|
|
299
|
+
Total findings: {count}
|
|
300
|
+
Auto-fixable: {count of BREAKING + OUTDATED findings}
|
|
301
|
+
Requires manual review: {count of MISSING findings}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Store the complete findings data in context for use in Steps 5, 6, 7, and 9. This includes the full finding records with all 10 fields, and the Fix Plan table from the meta-auditor's report.
|
|
305
|
+
|
|
306
|
+
### Step 5: Persist Report (Main Agent)
|
|
307
|
+
|
|
308
|
+
Write the full audit findings to a persistent report file. Determine the current date as CURRENT_DATE (YYYY-MM-DD format).
|
|
309
|
+
|
|
310
|
+
1. Create the output directory if it does not exist. Use Bash:
|
|
311
|
+
```
|
|
312
|
+
mkdir -p .claude/specs/audit/
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
2. Read the audit report template from the audit-cc-assets skill using the Read tool:
|
|
316
|
+
- File: `.claude/skills/audit-cc-assets/templates/audit-report.md`
|
|
317
|
+
|
|
318
|
+
3. Fill the template with the meta-auditor-agent's complete findings from Step 3. Include:
|
|
319
|
+
- YAML frontmatter: type, date, cc-version, previous-audit-date, previous-cc-version, audit-mode, status
|
|
320
|
+
- Summary section with all counts
|
|
321
|
+
- BREAKING Findings section with all finding details
|
|
322
|
+
- OUTDATED Findings section with all finding details
|
|
323
|
+
- MISSING Findings section with all finding details
|
|
324
|
+
- Fix Plan section grouping BREAKING and OUTDATED fixes by file
|
|
325
|
+
- Changelog Changes section
|
|
326
|
+
|
|
327
|
+
4. Write the filled template to: `.claude/specs/audit/audit-{CURRENT_DATE}.md`
|
|
328
|
+
|
|
329
|
+
5. Confirm to the user: "Audit report saved to `.claude/specs/audit/audit-{CURRENT_DATE}.md`"
|
|
330
|
+
|
|
331
|
+
Proceed directly to Step 6 -- do not wait for confirmation.
|
|
332
|
+
|
|
333
|
+
### Step 6: Fix Approval (Main Agent, interactive)
|
|
334
|
+
|
|
335
|
+
This is the CONFIRMATION GATE. Present the auto-fixable findings and ask the user what to do.
|
|
336
|
+
|
|
337
|
+
Count the auto-fixable findings (all BREAKING + all OUTDATED findings where autoFixable is true).
|
|
338
|
+
|
|
339
|
+
If there are zero auto-fixable findings, present:
|
|
340
|
+
```
|
|
341
|
+
No auto-fixable findings. All {MISSING count} findings require manual design decisions.
|
|
342
|
+
The audit report has been saved to `.claude/specs/audit/audit-{CURRENT_DATE}.md`.
|
|
343
|
+
```
|
|
344
|
+
Skip Steps 7 and 8. Proceed directly to Step 9.
|
|
345
|
+
|
|
346
|
+
If there are auto-fixable findings, present:
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
FIX APPROVAL
|
|
350
|
+
|
|
351
|
+
The following {auto-fixable count} findings are auto-fixable:
|
|
352
|
+
|
|
353
|
+
BREAKING ({count}):
|
|
354
|
+
{For each BREAKING finding:}
|
|
355
|
+
- {file path}: `{currentValue}` -> `{recommendedFix}` ({description})
|
|
356
|
+
|
|
357
|
+
OUTDATED ({count}):
|
|
358
|
+
{For each OUTDATED finding:}
|
|
359
|
+
- {file path}: `{currentValue}` -> `{recommendedFix}` ({description})
|
|
360
|
+
|
|
361
|
+
MISSING findings ({count}) require manual design decisions and cannot be auto-fixed.
|
|
362
|
+
|
|
363
|
+
Options:
|
|
364
|
+
all -- Apply all auto-fixable changes ({count} fixes)
|
|
365
|
+
breaking -- Apply only BREAKING fixes ({BREAKING count} fixes)
|
|
366
|
+
select -- Choose individual fixes
|
|
367
|
+
none -- Skip all fixes (report is saved)
|
|
368
|
+
|
|
369
|
+
What would you like to do?
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**CONFIRMATION GATE**: Do NOT proceed to Step 7 until the user responds.
|
|
373
|
+
|
|
374
|
+
Handle the user's response:
|
|
375
|
+
- **"all"**: Proceed to Step 7 with ALL auto-fixable findings (BREAKING + OUTDATED).
|
|
376
|
+
- **"breaking"**: Proceed to Step 7 with only BREAKING findings.
|
|
377
|
+
- **"select"**: Present each auto-fixable finding individually and ask "Apply this fix? (yes/no)" for each. Collect the user's selections. Proceed to Step 7 with the selected findings.
|
|
378
|
+
- **"none"**: Skip Steps 7 and 8. Set FIXES_APPLIED to 0. Proceed directly to Step 9.
|
|
379
|
+
|
|
380
|
+
Store the accepted fix list as ACCEPTED_FIXES for Step 7.
|
|
381
|
+
|
|
382
|
+
### Step 7: Apply Fixes (meta-agent via Agent tool)
|
|
383
|
+
|
|
384
|
+
Delegate the accepted fixes to the meta-agent for implementation.
|
|
385
|
+
|
|
386
|
+
Delegate via the Agent tool (set `subagent_type` to `"meta-agent"`) with description "Apply CC asset fixes" and this prompt:
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
You are applying approved fixes to CC assets. Apply ONLY the fixes listed below. Do NOT make any additional changes.
|
|
390
|
+
|
|
391
|
+
## Accepted Fixes
|
|
392
|
+
|
|
393
|
+
{For each fix in ACCEPTED_FIXES, list:}
|
|
394
|
+
|
|
395
|
+
### Fix {N}: {file path}
|
|
396
|
+
- Line: {line number or section}
|
|
397
|
+
- Category: {BREAKING or OUTDATED}
|
|
398
|
+
- Current Value: `{currentValue}`
|
|
399
|
+
- Fix To: `{recommendedFix}`
|
|
400
|
+
- Description: {description}
|
|
401
|
+
|
|
402
|
+
## Instructions
|
|
403
|
+
|
|
404
|
+
1. For each fix listed above:
|
|
405
|
+
a. Read the current file content using the Read tool
|
|
406
|
+
b. Locate the current value at the specified line or section
|
|
407
|
+
c. Verify the current value matches what is listed above
|
|
408
|
+
d. If it matches: apply the change using Edit or MultiEdit tool
|
|
409
|
+
e. If it does NOT match: STOP for this fix and report the conflict (do not improvise a different change)
|
|
410
|
+
|
|
411
|
+
2. After applying all changes, verify each modified file:
|
|
412
|
+
- YAML frontmatter parses correctly (no broken delimiters, no duplicate keys)
|
|
413
|
+
- Markdown structure is intact (headings, code blocks, lists properly formatted)
|
|
414
|
+
|
|
415
|
+
3. Report your results
|
|
416
|
+
|
|
417
|
+
## Constraints
|
|
418
|
+
- Apply ONLY the fixes listed above -- no additional changes
|
|
419
|
+
- If a fix requires changing multiple lines in the same file, use MultiEdit for efficiency
|
|
420
|
+
- If a current value does not match what is listed, report the conflict rather than guessing
|
|
421
|
+
- Do NOT use Write to overwrite entire files -- use Edit or MultiEdit for targeted changes
|
|
422
|
+
|
|
423
|
+
## Output Format
|
|
424
|
+
|
|
425
|
+
### Files Modified
|
|
426
|
+
- {file path}: {what was changed}
|
|
427
|
+
|
|
428
|
+
### Conflicts Encountered
|
|
429
|
+
{List any fixes where the current value did not match, or "None"}
|
|
430
|
+
|
|
431
|
+
### Verification
|
|
432
|
+
- {file path}: frontmatter valid ({yes/no}), structure valid ({yes/no})
|
|
433
|
+
|
|
434
|
+
### Summary
|
|
435
|
+
Total fixes applied: {count}
|
|
436
|
+
Total conflicts: {count}
|
|
437
|
+
|
|
438
|
+
Do NOT write this report to a file. Return it directly.
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Step 8: Validate Fixes (Main Agent)
|
|
442
|
+
|
|
443
|
+
VALIDATION_CYCLE = 1
|
|
444
|
+
MAX_CYCLES = 3
|
|
445
|
+
|
|
446
|
+
For each fix in ACCEPTED_FIXES that the meta-agent reported as applied (not conflicted):
|
|
447
|
+
|
|
448
|
+
1. **Read the file** using the Read tool.
|
|
449
|
+
2. **Grep for the old value** (the `currentValue` from the finding). The old value should NOT be present at the specified line. If the old value is a pattern that appears elsewhere in the file legitimately, check specifically at the reported line number.
|
|
450
|
+
3. **Grep for the new value** (the `recommendedFix` from the finding). The new value SHOULD be present.
|
|
451
|
+
4. **Verify frontmatter** (if the fix was in frontmatter): Check that the YAML frontmatter block has valid delimiters (`---`) and no obvious syntax errors.
|
|
452
|
+
|
|
453
|
+
Record each fix as PASS or FAIL.
|
|
454
|
+
|
|
455
|
+
**If ALL fixes PASS**: Proceed to Step 9. Set FIXES_APPLIED to the count of applied fixes.
|
|
456
|
+
|
|
457
|
+
**If any fix FAILS and VALIDATION_CYCLE < MAX_CYCLES**:
|
|
458
|
+
1. Increment VALIDATION_CYCLE
|
|
459
|
+
2. Compile a list of the failed validations with details (which file, what was expected, what was found)
|
|
460
|
+
3. Re-delegate to the meta-agent via the Agent tool (set `subagent_type` to `"meta-agent"`) with description "Re-apply failed fixes" and this prompt:
|
|
461
|
+
|
|
462
|
+
```
|
|
463
|
+
The previous fix implementation failed validation. Apply corrections.
|
|
464
|
+
|
|
465
|
+
## Failed Fixes
|
|
466
|
+
|
|
467
|
+
{For each failed fix:}
|
|
468
|
+
### Fix {N}: {file path}
|
|
469
|
+
- Expected old value `{currentValue}` to be replaced with `{recommendedFix}`
|
|
470
|
+
- Validation result: {what was found -- e.g., "old value still present at line X" or "new value not found"}
|
|
471
|
+
|
|
472
|
+
## Instructions
|
|
473
|
+
1. Read each affected file
|
|
474
|
+
2. Diagnose why the fix was not applied correctly
|
|
475
|
+
3. Apply the correct change
|
|
476
|
+
4. Verify the file structure after the change
|
|
477
|
+
|
|
478
|
+
## Constraints
|
|
479
|
+
- Only modify what is needed to address the validation failures
|
|
480
|
+
- Do NOT make changes beyond the original fix specifications
|
|
481
|
+
|
|
482
|
+
Return: files modified, conflicts encountered, verification results.
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
4. Re-validate all previously-failed fixes
|
|
486
|
+
5. Return to the PASS/FAIL check
|
|
487
|
+
|
|
488
|
+
**If any fix FAILS after MAX_CYCLES (3 cycles)**:
|
|
489
|
+
Present the persistent failures to the user:
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
VALIDATION INCOMPLETE
|
|
493
|
+
|
|
494
|
+
{count} fixes could not be validated after {MAX_CYCLES} attempts:
|
|
495
|
+
{For each persistent failure:}
|
|
496
|
+
- {file path}: {description of what failed}
|
|
497
|
+
|
|
498
|
+
The remaining {passed count} fixes were applied and validated successfully.
|
|
499
|
+
Proceeding to update audit state with partial results.
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Set FIXES_APPLIED to the count of fixes that PASSED validation. Proceed to Step 9.
|
|
503
|
+
|
|
504
|
+
### Step 9: Update State (Main Agent)
|
|
505
|
+
|
|
506
|
+
Update the audit state file with the results of this audit.
|
|
507
|
+
|
|
508
|
+
1. **Compute summary values:**
|
|
509
|
+
- TOTAL_FINDINGS: total count from the meta-auditor's report
|
|
510
|
+
- BREAKING_COUNT: count of BREAKING findings
|
|
511
|
+
- OUTDATED_COUNT: count of OUTDATED findings
|
|
512
|
+
- MISSING_COUNT: count of MISSING findings
|
|
513
|
+
- FILES_SCANNED: count from the explorer's scan
|
|
514
|
+
- FILES_WITH_FINDINGS: count from the meta-auditor's report
|
|
515
|
+
- FIXES_APPLIED: count from Steps 7-8 (validated fixes only), or 0 if user chose "none"
|
|
516
|
+
|
|
517
|
+
2. **Build the new state object:**
|
|
518
|
+
|
|
519
|
+
```json
|
|
520
|
+
{
|
|
521
|
+
"lastAuditDate": "{CURRENT_DATE}",
|
|
522
|
+
"lastAuditedCCVersion": "{CURRENT_CC_VERSION}",
|
|
523
|
+
"lastAuditSummary": {
|
|
524
|
+
"totalFindings": {TOTAL_FINDINGS},
|
|
525
|
+
"breaking": {BREAKING_COUNT},
|
|
526
|
+
"outdated": {OUTDATED_COUNT},
|
|
527
|
+
"missing": {MISSING_COUNT},
|
|
528
|
+
"filesScanned": {FILES_SCANNED},
|
|
529
|
+
"filesWithFindings": {FILES_WITH_FINDINGS},
|
|
530
|
+
"fixesApplied": {FIXES_APPLIED}
|
|
531
|
+
},
|
|
532
|
+
"auditHistory": [
|
|
533
|
+
{EXISTING_HISTORY_ENTRIES if any},
|
|
534
|
+
{
|
|
535
|
+
"date": "{CURRENT_DATE}",
|
|
536
|
+
"ccVersion": "{CURRENT_CC_VERSION}",
|
|
537
|
+
"findings": {TOTAL_FINDINGS},
|
|
538
|
+
"fixesApplied": {FIXES_APPLIED}
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
If this is the first audit (no previous state file), `auditHistory` starts as a single-element array.
|
|
545
|
+
If a previous state file existed, read it first, preserve the existing `auditHistory` entries, and append the new entry.
|
|
546
|
+
|
|
547
|
+
3. **Write the state file** to `.claude/audit-state.json` using the Write tool.
|
|
548
|
+
|
|
549
|
+
### Step 10: Final Report (Main Agent)
|
|
550
|
+
|
|
551
|
+
Present the final audit summary to the user.
|
|
552
|
+
|
|
553
|
+
## Report
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
AUDIT COMPLETE
|
|
557
|
+
|
|
558
|
+
CC Version: v{CURRENT_CC_VERSION}
|
|
559
|
+
Audit Mode: {AUDIT_MODE}
|
|
560
|
+
Date: {CURRENT_DATE}
|
|
561
|
+
|
|
562
|
+
Scan:
|
|
563
|
+
Assets scanned: {FILES_SCANNED}
|
|
564
|
+
Assets with findings: {FILES_WITH_FINDINGS}
|
|
565
|
+
|
|
566
|
+
Findings:
|
|
567
|
+
BREAKING: {BREAKING_COUNT}
|
|
568
|
+
OUTDATED: {OUTDATED_COUNT}
|
|
569
|
+
MISSING: {MISSING_COUNT}
|
|
570
|
+
Total: {TOTAL_FINDINGS}
|
|
571
|
+
|
|
572
|
+
Fixes:
|
|
573
|
+
Auto-fixable: {count of BREAKING + OUTDATED}
|
|
574
|
+
User-approved: {count of ACCEPTED_FIXES or 0}
|
|
575
|
+
Applied and validated: {FIXES_APPLIED}
|
|
576
|
+
Remaining (manual review): {MISSING_COUNT}
|
|
577
|
+
|
|
578
|
+
Output:
|
|
579
|
+
Audit report: .claude/specs/audit/audit-{CURRENT_DATE}.md
|
|
580
|
+
Audit state: .claude/audit-state.json
|
|
581
|
+
|
|
582
|
+
Next Steps:
|
|
583
|
+
- Review MISSING findings in the audit report for manual design decisions
|
|
584
|
+
- Run /audit-cc-assets again after the next CC update to check for new changes
|
|
585
|
+
```
|