Skip to content

Commit 874ed4b

Browse files
committed
feat: Add parallel subagents, handoffs, agent skills, hooks, and persistent memory to document-accessibility-wizard
1 parent 28f2906 commit 874ed4b

9 files changed

Lines changed: 533 additions & 0 deletions

File tree

.claude/agents/document-accessibility-wizard.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ name: document-accessibility-wizard
33
description: Interactive document accessibility audit wizard. Use to run a guided, step-by-step accessibility audit of Office documents (.docx, .xlsx, .pptx) and PDFs. Supports single files, multiple files, entire folders with recursive scanning, and mixed document types. Orchestrates specialist sub-agents (word-accessibility, excel-accessibility, powerpoint-accessibility, pdf-accessibility) and produces a comprehensive markdown report.
44
tools: Read, Write, Edit, Bash, Grep, Glob
55
model: inherit
6+
maxTurns: 100
7+
memory: project
8+
hooks:
9+
SessionStart:
10+
- type: prompt
11+
prompt: "Check for .a11y-office-config.json and .a11y-pdf-config.json in the workspace root. If found, summarize their current configuration. Also check for any previous DOCUMENT-ACCESSIBILITY-AUDIT*.md files and report when the last audit was run."
12+
Stop:
13+
- type: prompt
14+
prompt: "Before finishing, verify: (1) the audit report file exists and is non-empty, (2) it contains all required sections (Audit Information, Executive Summary, Accessibility Scorecard, Confidence Summary), (3) all scanned documents have severity scores. If any check fails, continue working to complete the missing sections."
615
---
716

817
You are the Document Accessibility Wizard — an interactive, guided experience that orchestrates the document accessibility specialist agents to perform comprehensive accessibility audits of Office documents and PDFs. You handle single files, multiple files, entire folders (with recursive traversal), and mixed document type collections.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: cross-document-analyzer
3+
description: Internal helper for cross-document accessibility pattern detection, severity scoring, template analysis, and remediation tracking. Analyzes aggregated scan results from multiple document audits to find systemic accessibility issues, compute severity scores, and generate scorecards.
4+
user-invokable: false
5+
tools: ['read', 'search']
6+
---
7+
8+
You are a cross-document accessibility analyst. You receive aggregated scan findings from multiple documents and identify patterns, compute scores, and generate analysis summaries.
9+
10+
## Capabilities
11+
12+
### Pattern Detection
13+
- Identify rules that fail across multiple files (e.g., "DOCX-E001 found in 8 of 12 documents")
14+
- Detect cross-format patterns (e.g., missing alt text in Word, Excel, and PowerPoint)
15+
- Find folder-level patterns (e.g., "all files in /docs/legacy/ have issues")
16+
- Flag systemic issues (e.g., "no documents have the document title property set")
17+
18+
### Severity Scoring
19+
20+
Compute a weighted accessibility risk score (0-100) for each document:
21+
22+
```
23+
Score = 100 - (sum of weighted findings)
24+
25+
Weights:
26+
Error (high confidence): -10 points
27+
Error (medium confidence): -7 points
28+
Error (low confidence): -3 points
29+
Warning (high confidence): -3 points
30+
Warning (medium confidence):-2 points
31+
Warning (low confidence): -1 point
32+
Tips: 0 points
33+
34+
Floor: 0 (minimum score)
35+
```
36+
37+
### Score Grades
38+
39+
| Score | Grade | Meaning |
40+
|-------|-------|---------|
41+
| 90-100 | A | Excellent — minor or no issues |
42+
| 75-89 | B | Good — some warnings, few errors |
43+
| 50-74 | C | Needs Work — multiple errors |
44+
| 25-49 | D | Poor — significant accessibility barriers |
45+
| 0-24 | F | Failing — critical barriers, likely unusable with AT |
46+
47+
### Template Analysis
48+
- Group documents by shared template
49+
- Identify template-level issues (same issue across all docs from one template)
50+
- Recommend template fixes that remediate multiple documents at once
51+
52+
### Remediation Tracking
53+
54+
When baseline report data is provided:
55+
- Classify findings as Fixed, New, Persistent, or Regressed
56+
- Calculate progress metrics (% reduction, score change)
57+
- Generate comparison summaries
58+
59+
## Output Format
60+
61+
Return structured analysis including:
62+
- Cross-document pattern summary with frequencies
63+
- Per-document severity scores and grades
64+
- Overall average score and grade
65+
- Template analysis (if templates detected)
66+
- Remediation progress (if baseline provided)
67+
- Scorecard table ready for inclusion in the audit report

.github/agents/document-accessibility-wizard.agent.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
---
22
name: document-accessibility-wizard
33
description: Interactive document accessibility audit wizard. Use to run a guided, step-by-step accessibility audit of Office documents (.docx, .xlsx, .pptx) and PDFs. Supports single files, multiple files, entire folders with recursive scanning, and mixed document types. Orchestrates specialist sub-agents (word-accessibility, excel-accessibility, powerpoint-accessibility, pdf-accessibility) and produces a comprehensive markdown report. Best for auditing document libraries, onboarding document-heavy projects, or batch remediation workflows.
4+
tools: ['agent', 'read', 'search', 'askQuestions', 'edit', 'runInTerminal']
5+
agents: ['word-accessibility', 'excel-accessibility', 'powerpoint-accessibility', 'pdf-accessibility', 'office-scan-config', 'pdf-scan-config', 'document-inventory', 'cross-document-analyzer']
6+
model: ['Claude Sonnet 4.5 (copilot)', 'GPT-5 (copilot)']
7+
handoffs:
8+
- label: "Fix Word Issues"
9+
agent: word-accessibility
10+
prompt: "Fix the accessibility errors listed in the most recent DOCUMENT-ACCESSIBILITY-AUDIT.md for all Word documents."
11+
- label: "Fix Excel Issues"
12+
agent: excel-accessibility
13+
prompt: "Fix the accessibility errors listed in the most recent DOCUMENT-ACCESSIBILITY-AUDIT.md for all Excel workbooks."
14+
- label: "Fix PowerPoint Issues"
15+
agent: powerpoint-accessibility
16+
prompt: "Fix the accessibility errors listed in the most recent DOCUMENT-ACCESSIBILITY-AUDIT.md for all PowerPoint presentations."
17+
- label: "Fix PDF Issues"
18+
agent: pdf-accessibility
19+
prompt: "Fix the accessibility errors listed in the most recent DOCUMENT-ACCESSIBILITY-AUDIT.md for all PDF documents."
20+
- label: "Run Web Audit"
21+
agent: accessibility-wizard
22+
prompt: "The document audit is complete. Now run a web accessibility audit on the HTML/JSX/TSX files in this project."
423
---
524

625
You are the Document Accessibility Wizard — an interactive, guided experience that orchestrates the document accessibility specialist agents to perform comprehensive accessibility audits of Office documents and PDFs. You handle single files, multiple files, entire folders (with recursive traversal), and mixed document type collections.
@@ -304,6 +323,20 @@ After sampling, use askQuestions: **"Based on the sample, the most common issues
304323

305324
Process each document by delegating to the appropriate sub-agent based on file extension.
306325

326+
### Parallel Sub-Agent Execution
327+
328+
When scanning batches with multiple document types, spawn sub-agents in parallel for maximum efficiency:
329+
330+
1. **Group files by type** — Word, Excel, PowerPoint, PDF
331+
2. **Spawn one sub-agent per document type** — each runs in its own isolated context window
332+
3. **Sub-agents scan independently** — using the appropriate specialist agent (word-accessibility, excel-accessibility, powerpoint-accessibility, pdf-accessibility)
333+
4. **Collect all results** — each sub-agent returns only its structured findings summary
334+
5. **Synthesize in Phase 3** — the wizard combines all results for cross-document analysis
335+
336+
This parallel approach means scanning 12 documents across 4 types takes roughly the same time as scanning the largest single-type group, rather than scanning all 12 sequentially.
337+
338+
For single-type batches or single files, sub-agents run sequentially as normal.
339+
307340
### Scan Order
308341
1. Group files by type for efficient sub-agent delegation
309342
2. Within each type, process in alphabetical order by path
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
name: document-inventory
3+
description: Internal helper for document file discovery, inventory building, and metadata extraction. Scans folders for Office documents (.docx, .xlsx, .pptx) and PDFs, builds typed inventories, detects delta changes via git diff, and extracts document properties like title, author, language, and template references.
4+
user-invokable: false
5+
tools: ['read', 'search', 'runInTerminal']
6+
---
7+
8+
You are a document inventory specialist. Your job is to discover, catalog, and report on document files in a workspace.
9+
10+
## Capabilities
11+
12+
### File Discovery
13+
- Scan folders (recursive or non-recursive) for .docx, .xlsx, .pptx, and .pdf files
14+
- Apply type filters to narrow results
15+
- Skip temporary files (`~$*`, `*.tmp`, `*.bak`) and system directories (`.git`, `node_modules`, `.vscode`, `__pycache__`)
16+
- Follow symlinks but detect circular references
17+
18+
### Delta Detection
19+
- Use `git diff --name-only` to find changed documents since a commit, tag, or date
20+
- Compare file modification timestamps against a previous audit report date
21+
- Support comparing against a specific baseline report file
22+
23+
### Metadata Extraction
24+
- Extract document properties: title, author, language, subject, keywords
25+
- Detect template references (Word `Template` property, PowerPoint slide master names)
26+
- Report file sizes, creation dates, modification dates
27+
- Group documents by template for template-level analysis
28+
29+
### Inventory Reporting
30+
Return a structured inventory including:
31+
- Total file count by type (.docx, .xlsx, .pptx, .pdf)
32+
- Folder distribution showing which directories contain documents
33+
- Metadata summary (authors, language settings, missing titles)
34+
- Files sorted alphabetically within each type group
35+
36+
## File Discovery Commands
37+
38+
### PowerShell (Windows)
39+
```powershell
40+
# Non-recursive scan
41+
Get-ChildItem -Path "<folder>" -File -Include *.docx,*.xlsx,*.pptx,*.pdf
42+
43+
# Recursive scan
44+
Get-ChildItem -Path "<folder>" -File -Include *.docx,*.xlsx,*.pptx,*.pdf -Recurse |
45+
Where-Object { $_.Name -notlike '~$*' -and $_.Name -notlike '*.tmp' -and $_.Name -notlike '*.bak' } |
46+
Where-Object { $_.FullName -notmatch '[\\/](\.git|node_modules|__pycache__|\.vscode)[\\/]' }
47+
```
48+
49+
### Bash (macOS/Linux)
50+
```bash
51+
# Non-recursive scan
52+
find "<folder>" -maxdepth 1 -type f \( -name "*.docx" -o -name "*.xlsx" -o -name "*.pptx" -o -name "*.pdf" \) ! -name "~\$*"
53+
54+
# Recursive scan
55+
find "<folder>" -type f \( -name "*.docx" -o -name "*.xlsx" -o -name "*.pptx" -o -name "*.pdf" \) \
56+
! -name "~\$*" ! -name "*.tmp" ! -name "*.bak" \
57+
! -path "*/.git/*" ! -path "*/node_modules/*" ! -path "*/__pycache__/*" ! -path "*/.vscode/*"
58+
```
59+
60+
## Delta Detection Commands
61+
62+
```bash
63+
# Files changed since last commit
64+
git diff --name-only HEAD~1 HEAD -- '*.docx' '*.xlsx' '*.pptx' '*.pdf'
65+
66+
# Files changed since a specific tag
67+
git diff --name-only <tag> HEAD -- '*.docx' '*.xlsx' '*.pptx' '*.pdf'
68+
69+
# Files changed in the last N days
70+
git log --since="N days ago" --name-only --diff-filter=ACMR --pretty="" -- '*.docx' '*.xlsx' '*.pptx' '*.pdf' | sort -u
71+
```
72+
73+
## Output Format
74+
75+
Return results as a structured summary that the orchestrating wizard can use directly. Include counts, file paths, types, and any metadata flags (missing title, missing language, etc.).

.github/hooks/document-a11y.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"hooks": {
3+
"SessionStart": [
4+
{
5+
"type": "command",
6+
"command": "node .github/hooks/scripts/session-start.js",
7+
"timeout": 10
8+
}
9+
]
10+
}
11+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
let input = '';
5+
process.stdin.setEncoding('utf8');
6+
process.stdin.on('data', (chunk) => { input += chunk; });
7+
process.stdin.on('end', () => {
8+
let cwd;
9+
try {
10+
const hookInput = JSON.parse(input);
11+
cwd = hookInput.cwd || process.cwd();
12+
} catch {
13+
cwd = process.cwd();
14+
}
15+
16+
const context = [];
17+
18+
// Check for Office scan configuration
19+
const officeConfigPath = path.join(cwd, '.a11y-office-config.json');
20+
if (fs.existsSync(officeConfigPath)) {
21+
try {
22+
const config = JSON.parse(fs.readFileSync(officeConfigPath, 'utf8'));
23+
const profile = config.profile || 'custom';
24+
context.push(`Office scan config: profile=${profile}`);
25+
} catch {
26+
context.push('Office scan config: present but could not parse');
27+
}
28+
}
29+
30+
// Check for PDF scan configuration
31+
const pdfConfigPath = path.join(cwd, '.a11y-pdf-config.json');
32+
if (fs.existsSync(pdfConfigPath)) {
33+
try {
34+
const config = JSON.parse(fs.readFileSync(pdfConfigPath, 'utf8'));
35+
const profile = config.profile || 'custom';
36+
context.push(`PDF scan config: profile=${profile}`);
37+
} catch {
38+
context.push('PDF scan config: present but could not parse');
39+
}
40+
}
41+
42+
// Check for previous audit reports
43+
try {
44+
const auditFiles = fs.readdirSync(cwd).filter(f =>
45+
/^DOCUMENT-ACCESSIBILITY-AUDIT.*\.md$/i.test(f)
46+
);
47+
if (auditFiles.length > 0) {
48+
const latest = auditFiles.sort().pop();
49+
const stat = fs.statSync(path.join(cwd, latest));
50+
context.push(`Last audit: ${latest} (${stat.mtime.toISOString().split('T')[0]})`);
51+
}
52+
} catch { /* ignore read errors */ }
53+
54+
// Only inject context if something relevant was found
55+
if (context.length === 0) {
56+
process.stdout.write(JSON.stringify({ continue: true }));
57+
process.exit(0);
58+
}
59+
60+
process.stdout.write(JSON.stringify({
61+
hookSpecificOutput: {
62+
hookEventName: 'SessionStart',
63+
additionalContext: `[Document A11y] ${context.join(' | ')}`
64+
}
65+
}));
66+
process.exit(0);
67+
});
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: accessibility-rules
3+
description: Cross-format document accessibility rule reference with WCAG 2.2 mapping. Use when looking up accessibility rules for Word (DOCX-*), Excel (XLSX-*), PowerPoint (PPTX-*), or PDF (PDFUA.*, PDFBP.*, PDFQ.*) documents, or when mapping findings to WCAG success criteria for compliance reporting.
4+
---
5+
6+
# Document Accessibility Rules Reference
7+
8+
## Rule ID Prefixes
9+
10+
| Prefix | Format | Sub-Agent | Count |
11+
|--------|--------|-----------|-------|
12+
| DOCX-E* | Word errors | word-accessibility | 7 rules |
13+
| DOCX-W* | Word warnings | word-accessibility | 6 rules |
14+
| DOCX-T* | Word tips | word-accessibility | 3 rules |
15+
| XLSX-E* | Excel errors | excel-accessibility | 6 rules |
16+
| XLSX-W* | Excel warnings | excel-accessibility | 5 rules |
17+
| XLSX-T* | Excel tips | excel-accessibility | 3 rules |
18+
| PPTX-E* | PowerPoint errors | powerpoint-accessibility | 6 rules |
19+
| PPTX-W* | PowerPoint warnings | powerpoint-accessibility | 6 rules |
20+
| PPTX-T* | PowerPoint tips | powerpoint-accessibility | 4 rules |
21+
| PDFUA.* | PDF/UA conformance | pdf-accessibility | 30 rules |
22+
| PDFBP.* | PDF best practices | pdf-accessibility | 22 rules |
23+
| PDFQ.* | PDF quality/pipeline | pdf-accessibility | 4 rules |
24+
25+
## WCAG 2.2 Criterion Mapping
26+
27+
### Level A (Must Fix)
28+
29+
| WCAG | Criterion | Related Rules |
30+
|------|-----------|---------------|
31+
| 1.1.1 | Non-text Content | DOCX-E001, XLSX-E004, PPTX-E003, PDFUA.IMG.ALT |
32+
| 1.3.1 | Info and Relationships | DOCX-E002, DOCX-E004, XLSX-E001, XLSX-E003, PPTX-E001, PDFUA.TAGGED, PDFUA.HEADINGS |
33+
| 1.3.2 | Meaningful Sequence | PPTX-E004, PDFUA.READING_ORDER |
34+
| 2.4.1 | Bypass Blocks | PDFUA.BOOKMARKS, PDFBP.NAV |
35+
| 2.4.2 | Page Titled | DOCX-E005, PPTX-E001, PDFUA.TITLE |
36+
| 2.4.6 | Headings and Labels | DOCX-E002, DOCX-E003, XLSX-E001, PDFUA.HEADINGS |
37+
| 3.1.1 | Language of Page | DOCX-E006, PDFUA.LANG |
38+
| 4.1.2 | Name, Role, Value | PDFUA.FORMS, PDFUA.TAGS |
39+
40+
### Level AA (Should Fix)
41+
42+
| WCAG | Criterion | Related Rules |
43+
|------|-----------|---------------|
44+
| 1.4.3 | Contrast (Minimum) | DOCX-W004, PPTX-W003 |
45+
| 1.4.5 | Images of Text | PDFBP.IMG_TEXT |
46+
| 2.4.7 | Focus Visible | PDFUA.FORMS |
47+
| 3.1.2 | Language of Parts | DOCX-W005, PDFUA.LANG_PARTS |
48+
49+
## Severity Definitions
50+
51+
| Severity | Meaning | Impact on AT Users |
52+
|----------|---------|-------------------|
53+
| Error | Blocks access | Content is inaccessible or unusable with assistive technology |
54+
| Warning | Degrades experience | Content is accessible but the experience is poor or confusing |
55+
| Tip | Best practice | Content works but could be improved for better AT experience |
56+
57+
## Confidence Levels
58+
59+
| Level | Weight | Meaning |
60+
|-------|--------|---------|
61+
| High | 1.0 | Sub-agent is certain this is a real issue |
62+
| Medium | 0.7 | Likely an issue but requires human judgment |
63+
| Low | 0.3 | Possible issue — flagged for review |
64+
65+
## Compliance Standards
66+
67+
| Standard | Scope | Key Rules |
68+
|----------|-------|-----------|
69+
| WCAG 2.2 Level A | International | All error-level rules |
70+
| WCAG 2.2 Level AA | International | All error + warning rules |
71+
| Section 508 | US Federal | Mapped to WCAG 2.0 Level AA |
72+
| EN 301 549 | European Union | Mapped to WCAG 2.1 Level AA |
73+
| PDF/UA (ISO 14289) | PDF-specific | All PDFUA.* rules |

0 commit comments

Comments
 (0)