Codebase Auditor (L2 Coordinator)
Coordinates 9 specialized audit workers to perform comprehensive codebase quality analysis.
Purpose & Scope
- Coordinates 9 audit workers (ln-621 through ln-629) running in parallel
- Research current best practices for detected tech stack via MCP tools ONCE
- Pass shared context to all workers (token-efficient)
- Aggregate worker results into single consolidated report
- Write report to
docs/project/codebase_audit.md (file-based, no task creation)
- Manual invocation by user; not part of Story pipeline
Workflow
- Discovery: Load tech_stack.md, principles.md, package manifests, auto-discover Team ID
- Research: Query MCP tools for current best practices per major dependency ONCE
- Build Context: Create contextStore with best practices + tech stack metadata
- Domain Discovery: Detect project domains from folder structure (NEW)
- Delegate: Two-stage delegation - global workers + domain-aware workers (UPDATED)
- Aggregate: Collect worker results, group by domain, calculate scores
- Generate Report: Build consolidated report with Domain Health Summary, Findings by Domain
- Write Report: Save to
docs/project/codebase_audit.md
Phase 1: Discovery
Load project metadata:
docs/project/tech_stack.md - detect tech stack for research
docs/principles.md - project-specific quality principles
- Package manifests:
package.json, requirements.txt, go.mod, Cargo.toml
- Auto-discover Team ID from
docs/tasks/kanban_board.md
Extract metadata only (not full codebase scan):
- Programming language(s)
- Major frameworks/libraries
- Database system(s)
- Build tools
- Test framework(s)
Phase 2: Research Best Practices (ONCE)
For each major dependency identified in Phase 1:
- Use
mcp__Ref__ref_search_documentation for current best practices
- Use
mcp__context7__get-library-docs for up-to-date library documentation
- Focus areas by technology type:
| Type |
Research Focus |
| Web Framework |
Async patterns, middleware, error handling, request lifecycle |
| ML/AI Libraries |
Inference optimization, memory management, batching |
| Database |
Connection pooling, transactions, query optimization |
| Containerization |
Multi-stage builds, security, layer caching |
| Language Runtime |
Idioms, performance patterns, memory management |
Build contextStore:
{
"tech_stack": {...},
"best_practices": {...},
"principles": {...},
"codebase_root": "..."
}
Phase 3: Domain Discovery
Purpose: Detect project domains from folder structure for domain-aware auditing.
Algorithm:
Priority 1: Explicit domain folders
- Check for:
src/domains/*/, src/features/*/, src/modules/*/
- Monorepo patterns:
packages/*/, libs/*/, apps/*/
- If found (>1 match) → use these as domains
Priority 2: Top-level src/ folders*
- List folders:
src/users/, src/orders/, src/payments/
- Exclude infrastructure:
utils, shared, common, lib, helpers, config, types, interfaces, constants, middleware, infrastructure, core
- If remaining >1 → use as domains
Priority 3: Fallback to global mode
- If <2 domains detected →
domain_mode = "global"
- All workers scan entire codebase (backward-compatible behavior)
Heuristics for domain detection:
| Heuristic |
Indicator |
Example |
| File count |
>5 files in folder |
src/users/ with 12 files |
| Structure |
controllers/, services/, models/ present |
MVC/Clean Architecture |
| Barrel export |
index.ts/index.js exists |
Module pattern |
| README |
README.md describes domain |
Domain documentation |
Output:
{
"domain_mode": "domain-aware",
"all_domains": [
{"name": "users", "path": "src/users", "file_count": 45, "is_shared": false},
{"name": "orders", "path": "src/orders", "file_count": 32, "is_shared": false},
{"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}
]
}
Shared folder handling:
- Folders named
shared, common, utils, lib, core → mark is_shared: true
- Shared code audited but grouped separately in report
- Does not affect domain-specific scores
Phase 4: Delegate to Workers
CRITICAL: All delegations use Task tool with subagent_type: "general-purpose" for context isolation.
Prompt template:
Task(description: "Audit via ln-62X",
prompt: "Execute ln-62X-{worker}-auditor. Read skill from ln-62X-{worker}-auditor/SKILL.md. Context: {contextStore}",
subagent_type: "general-purpose")
Anti-Patterns:
- ❌ Direct Skill tool invocation without Task wrapper
- ❌ Any execution bypassing subagent context isolation
Worker Output Contract (Unified):
All workers MUST return JSON with this structure:
{
"category": "Category Name",
"score": 7,
"total_issues": 12,
"critical": 0,
"high": 3,
"medium": 7,
"low": 2,
"findings": [
{
"severity": "HIGH",
"location": "path/file.ts:123",
"issue": "Description of the issue",
"principle": "Category / Sub-principle",
"recommendation": "How to fix",
"effort": "S"
}
]
}
Unified Scoring Formula (all workers):
penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)
score = max(0, 10 - penalty)
Domain-aware workers add optional fields: domain, scan_path
Phase 4a: Global Workers (PARALLEL)
Global workers scan entire codebase (not domain-aware):
| # |
Worker |
Priority |
What It Audits |
| 1 |
ln-621-security-auditor |
CRITICAL |
Hardcoded secrets, SQL injection, XSS, insecure deps |
| 2 |
ln-622-build-auditor |
CRITICAL |
Compiler/linter errors, deprecations, type errors |
| 5 |
ln-625-dependencies-auditor |
MEDIUM |
Outdated packages, unused deps, custom implementations |
| 6 |
ln-626-dead-code-auditor |
LOW |
Dead code, unused imports/variables, commented-out code |
| 7 |
ln-627-observability-auditor |
MEDIUM |
Structured logging, health checks, metrics, tracing |
| 8 |
ln-628-concurrency-auditor |
HIGH |
Race conditions, async/await, resource contention |
| 9 |
ln-629-lifecycle-auditor |
MEDIUM |
Bootstrap, graceful shutdown, resource cleanup |
Invocation (7 workers in PARALLEL):
FOR EACH worker IN [ln-621, ln-622, ln-625, ln-626, ln-627, ln-628, ln-629]:
Task(description: "Audit via " + worker,
prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),
subagent_type: "general-purpose")
Phase 4b: Domain-Aware Workers (PARALLEL per domain)
Domain-aware workers run once per domain:
| # |
Worker |
Priority |
What It Audits |
| 3 |
ln-623-code-principles-auditor |
HIGH |
DRY/KISS/YAGNI violations, TODO/FIXME, error handling, DI |
| 4 |
ln-624-code-quality-auditor |
MEDIUM |
Cyclomatic complexity, O(n²), N+1 queries, magic numbers |
Invocation (2 workers × N domains):
IF domain_mode == "domain-aware":
FOR EACH domain IN all_domains:
domain_context = {
...contextStore,
domain_mode: "domain-aware",
current_domain: { name: domain.name, path: domain.path }
}
// Invoke both workers for this domain
Skill(skill="ln-623-code-principles-auditor", args=JSON.stringify(domain_context))
Skill(skill="ln-624-code-quality-auditor", args=JSON.stringify(domain_context))
ELSE:
// Fallback: invoke once for entire codebase (global mode)
Skill(skill="ln-623-code-principles-auditor", args=JSON.stringify(contextStore))
Skill(skill="ln-624-code-quality-auditor", args=JSON.stringify(contextStore))
Parallelism strategy:
- Phase 4a: All 7 global workers run in PARALLEL
- Phase 4b: All (2 × N) domain-aware invocations run in PARALLEL
- Example: 3 domains → 6 invocations (ln-363×3 + ln-364×3) in single message
Phase 5: Aggregate Results
Collect results from workers:
Global worker output (unchanged):
{
"category": "Security",
"score": 7,
"total_issues": 5,
"critical": 1,
"high": 2,
"medium": 2,
"low": 0,
"findings": [...]
}
Domain-aware worker output (NEW):
{
"category": "Architecture & Design",
"score": 6,
"domain": "users",
"scan_path": "src/users",
"total_issues": 4,
"critical": 1,
"high": 2,
"medium": 1,
"low": 0,
"findings": [
{
"severity": "CRITICAL",
"location": "src/users/controllers/UserController.ts:45",
"issue": "Controller directly uses Repository",
"principle": "Layer Separation (Clean Architecture)",
"recommendation": "Create UserService",
"effort": "L",
"domain": "users"
}
]
}
Aggregation Algorithm:
1. Collect JSON from all 9 workers (7 global + 2×N domain-aware)
2. Merge findings from all workers into single array
3. Sum severity counts:
total_critical = sum(worker.critical for all workers)
total_high = sum(worker.high for all workers)
total_medium = sum(worker.medium for all workers)
total_low = sum(worker.low for all workers)
4. Calculate Overall Score:
overall_score = average(worker.score for all 9 categories)
5. Sort findings by severity: CRITICAL → HIGH → MEDIUM → LOW
6. Group findings by category for report sections
Aggregation steps:
- Global workers (7) → merge findings into single list
- Domain-aware workers (2 × N) → group by domain.name:
- Calculate domain-level scores (Architecture + Quality per domain)
- Build Domain Health Summary table
- Overall score → average of 9 category scores (Architecture/Quality averaged across domains)
- Severity summary → sum critical/high/medium/low across ALL workers
- Findings grouping:
- Global categories (Security, Build, etc.) → single table
- Domain-aware categories → subtables per domain
- Cross-Domain DRY Analysis (post-aggregation):
- From ln-623 domain results, collect all findings that have
pattern_signature field
- Group by
pattern_signature across domains
- Same
pattern_signature in 2+ domains → create Cross-Domain DRY finding:
- severity: HIGH
- principle: "Cross-Domain DRY Violation"
- list all affected domains and locations
- recommendation: "Extract to shared/ module accessible by all affected domains"
- Add findings to "Cross-Domain Issues" section in report
Output Format
MANDATORY READ: Load shared/templates/codebase_audit_template.md for full report structure.
Report is written to docs/project/codebase_audit.md using the template. Key sections:
- Executive Summary, Compliance Score (9 categories), Severity Summary
- Domain Health Summary + Cross-Domain Issues (if domain-aware)
- Strengths, Findings by Category (global + domain-grouped), Recommended Actions
- Sources Consulted
Phase 6: Write Report
MANDATORY READ: Load shared/templates/codebase_audit_template.md for report format.
Write consolidated report to docs/project/codebase_audit.md:
- Use template structure from codebase_audit_template.md
- Fill all sections with aggregated worker data
- Overwrite previous report (each audit is a full snapshot)
Critical Rules
- Two-stage delegation: Global workers (7) + Domain-aware workers (2 × N domains)
- Domain discovery: Auto-detect domains from folder structure; fallback to global mode
- Parallel execution: All workers (global + domain-aware) run in PARALLEL
- Single context gathering: Research best practices ONCE, pass contextStore to all workers
- Metadata-only loading: Coordinator loads metadata only; workers load full file contents
- Domain-grouped output: Architecture & Code Quality findings grouped by domain
- File output only: Write results to codebase_audit.md, no task/story creation
- Do not audit: Coordinator orchestrates only; audit logic lives in workers
Definition of Done
- Best practices researched via MCP tools for major dependencies
- Domain discovery completed (domain_mode determined)
- contextStore built with tech stack + best practices + domain info
- Global workers (7) invoked in PARALLEL
- Domain-aware workers (2 × N domains) invoked in PARALLEL
- All workers completed successfully (or reported errors)
- Results aggregated with domain grouping
- Domain Health Summary built (if domain_mode="domain-aware")
- Compliance score (X/10) calculated per category + overall
- Executive Summary and Strengths sections included
- Report written to
docs/project/codebase_audit.md
- Sources consulted listed with URLs
Workers
See individual worker SKILL.md files for detailed audit rules:
Reference Files
- Orchestrator lifecycle:
shared/references/orchestrator_pattern.md
- Task delegation pattern:
shared/references/task_delegation_pattern.md
- Audit scoring formula:
shared/references/audit_scoring.md
- Audit output schema:
shared/references/audit_output_schema.md
- Report template:
shared/templates/codebase_audit_template.md
- Principles:
docs/principles.md
- Tech stack:
docs/project/tech_stack.md
- Kanban board:
docs/tasks/kanban_board.md
Version: 5.0.0
Last Updated: 2025-12-23
1---2name: ln-620-codebase-auditor-83description: "Coordinates 9 specialized audit workers (security, build, architecture, code quality, dependencies, dead code, observability, concurrency, lifecycle). Researches best practices, delegates parallel audits, aggregates results into docs/project/codebase_audit.md."4allowed-tools: Read, Grep, Glob, Bash, WebFetch, WebSearch, mcp__Ref, mcp__context7, Skill5metadata:6 source: https://skillmd.com/skills/majiayu000/ln-620-codebase-auditor-87---89# Codebase Auditor (L2 Coordinator)1011Coordinates 9 specialized audit workers to perform comprehensive codebase quality analysis.1213## Purpose & Scope1415- **Coordinates 9 audit workers** (ln-621 through ln-629) running in parallel16- Research current best practices for detected tech stack via MCP tools ONCE17- Pass shared context to all workers (token-efficient)18- Aggregate worker results into single consolidated report19- Write report to `docs/project/codebase_audit.md` (file-based, no task creation)20- Manual invocation by user; not part of Story pipeline2122## Workflow23241) **Discovery:** Load tech_stack.md, principles.md, package manifests, auto-discover Team ID252) **Research:** Query MCP tools for current best practices per major dependency ONCE263) **Build Context:** Create contextStore with best practices + tech stack metadata274) **Domain Discovery:** Detect project domains from folder structure (NEW)285) **Delegate:** Two-stage delegation - global workers + domain-aware workers (UPDATED)296) **Aggregate:** Collect worker results, group by domain, calculate scores307) **Generate Report:** Build consolidated report with Domain Health Summary, Findings by Domain318) **Write Report:** Save to `docs/project/codebase_audit.md`3233## Phase 1: Discovery3435**Load project metadata:**36- `docs/project/tech_stack.md` - detect tech stack for research37- `docs/principles.md` - project-specific quality principles38- Package manifests: `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`39- Auto-discover Team ID from `docs/tasks/kanban_board.md`4041**Extract metadata only** (not full codebase scan):42- Programming language(s)43- Major frameworks/libraries44- Database system(s)45- Build tools46- Test framework(s)4748## Phase 2: Research Best Practices (ONCE)4950**For each major dependency identified in Phase 1:**51521. Use `mcp__Ref__ref_search_documentation` for current best practices532. Use `mcp__context7__get-library-docs` for up-to-date library documentation543. Focus areas by technology type:5556| Type | Research Focus |57|------|----------------|58| Web Framework | Async patterns, middleware, error handling, request lifecycle |59| ML/AI Libraries | Inference optimization, memory management, batching |60| Database | Connection pooling, transactions, query optimization |61| Containerization | Multi-stage builds, security, layer caching |62| Language Runtime | Idioms, performance patterns, memory management |6364**Build contextStore:**65```json66{67 "tech_stack": {...},68 "best_practices": {...},69 "principles": {...},70 "codebase_root": "..."71}72```7374## Phase 3: Domain Discovery7576**Purpose:** Detect project domains from folder structure for domain-aware auditing.7778**Algorithm:**79801. **Priority 1: Explicit domain folders**81 - Check for: `src/domains/*/`, `src/features/*/`, `src/modules/*/`82 - Monorepo patterns: `packages/*/`, `libs/*/`, `apps/*/`83 - If found (>1 match) → use these as domains84852. **Priority 2: Top-level src/* folders**86 - List folders: `src/users/`, `src/orders/`, `src/payments/`87 - Exclude infrastructure: `utils`, `shared`, `common`, `lib`, `helpers`, `config`, `types`, `interfaces`, `constants`, `middleware`, `infrastructure`, `core`88 - If remaining >1 → use as domains89903. **Priority 3: Fallback to global mode**91 - If <2 domains detected → `domain_mode = "global"`92 - All workers scan entire codebase (backward-compatible behavior)9394**Heuristics for domain detection:**9596| Heuristic | Indicator | Example |97|-----------|-----------|---------|98| File count | >5 files in folder | `src/users/` with 12 files |99| Structure | controllers/, services/, models/ present | MVC/Clean Architecture |100| Barrel export | index.ts/index.js exists | Module pattern |101| README | README.md describes domain | Domain documentation |102103**Output:**104```json105{106 "domain_mode": "domain-aware",107 "all_domains": [108 {"name": "users", "path": "src/users", "file_count": 45, "is_shared": false},109 {"name": "orders", "path": "src/orders", "file_count": 32, "is_shared": false},110 {"name": "shared", "path": "src/shared", "file_count": 15, "is_shared": true}111 ]112}113```114115**Shared folder handling:**116- Folders named `shared`, `common`, `utils`, `lib`, `core` → mark `is_shared: true`117- Shared code audited but grouped separately in report118- Does not affect domain-specific scores119120## Phase 4: Delegate to Workers121122> **CRITICAL:** All delegations use Task tool with `subagent_type: "general-purpose"` for context isolation.123124**Prompt template:**125```126Task(description: "Audit via ln-62X",127 prompt: "Execute ln-62X-{worker}-auditor. Read skill from ln-62X-{worker}-auditor/SKILL.md. Context: {contextStore}",128 subagent_type: "general-purpose")129```130131**Anti-Patterns:**132- ❌ Direct Skill tool invocation without Task wrapper133- ❌ Any execution bypassing subagent context isolation134135**Worker Output Contract (Unified):**136137All workers MUST return JSON with this structure:138```json139{140 "category": "Category Name",141 "score": 7,142 "total_issues": 12,143 "critical": 0,144 "high": 3,145 "medium": 7,146 "low": 2,147 "findings": [148 {149 "severity": "HIGH",150 "location": "path/file.ts:123",151 "issue": "Description of the issue",152 "principle": "Category / Sub-principle",153 "recommendation": "How to fix",154 "effort": "S"155 }156 ]157}158```159160**Unified Scoring Formula (all workers):**161```162penalty = (critical × 2.0) + (high × 1.0) + (medium × 0.5) + (low × 0.2)163score = max(0, 10 - penalty)164```165166**Domain-aware workers** add optional fields: `domain`, `scan_path`167168### Phase 4a: Global Workers (PARALLEL)169170**Global workers** scan entire codebase (not domain-aware):171172| # | Worker | Priority | What It Audits |173|---|--------|----------|----------------|174| 1 | ln-621-security-auditor | CRITICAL | Hardcoded secrets, SQL injection, XSS, insecure deps |175| 2 | ln-622-build-auditor | CRITICAL | Compiler/linter errors, deprecations, type errors |176| 5 | ln-625-dependencies-auditor | MEDIUM | Outdated packages, unused deps, custom implementations |177| 6 | ln-626-dead-code-auditor | LOW | Dead code, unused imports/variables, commented-out code |178| 7 | ln-627-observability-auditor | MEDIUM | Structured logging, health checks, metrics, tracing |179| 8 | ln-628-concurrency-auditor | HIGH | Race conditions, async/await, resource contention |180| 9 | ln-629-lifecycle-auditor | MEDIUM | Bootstrap, graceful shutdown, resource cleanup |181182**Invocation (7 workers in PARALLEL):**183```javascript184FOR EACH worker IN [ln-621, ln-622, ln-625, ln-626, ln-627, ln-628, ln-629]:185 Task(description: "Audit via " + worker,186 prompt: "Execute " + worker + ". Read skill. Context: " + JSON.stringify(contextStore),187 subagent_type: "general-purpose")188```189190### Phase 4b: Domain-Aware Workers (PARALLEL per domain)191192**Domain-aware workers** run once per domain:193194| # | Worker | Priority | What It Audits |195|---|--------|----------|----------------|196| 3 | ln-623-code-principles-auditor | HIGH | DRY/KISS/YAGNI violations, TODO/FIXME, error handling, DI |197| 4 | ln-624-code-quality-auditor | MEDIUM | Cyclomatic complexity, O(n²), N+1 queries, magic numbers |198199**Invocation (2 workers × N domains):**200```javascript201IF domain_mode == "domain-aware":202 FOR EACH domain IN all_domains:203 domain_context = {204 ...contextStore,205 domain_mode: "domain-aware",206 current_domain: { name: domain.name, path: domain.path }207 }208 // Invoke both workers for this domain209 Skill(skill="ln-623-code-principles-auditor", args=JSON.stringify(domain_context))210 Skill(skill="ln-624-code-quality-auditor", args=JSON.stringify(domain_context))211ELSE:212 // Fallback: invoke once for entire codebase (global mode)213 Skill(skill="ln-623-code-principles-auditor", args=JSON.stringify(contextStore))214 Skill(skill="ln-624-code-quality-auditor", args=JSON.stringify(contextStore))215```216217**Parallelism strategy:**218- Phase 4a: All 7 global workers run in PARALLEL219- Phase 4b: All (2 × N) domain-aware invocations run in PARALLEL220- Example: 3 domains → 6 invocations (ln-363×3 + ln-364×3) in single message221222## Phase 5: Aggregate Results223224**Collect results from workers:**225226**Global worker output (unchanged):**227```json228{229 "category": "Security",230 "score": 7,231 "total_issues": 5,232 "critical": 1,233 "high": 2,234 "medium": 2,235 "low": 0,236 "findings": [...]237}238```239240**Domain-aware worker output (NEW):**241```json242{243 "category": "Architecture & Design",244 "score": 6,245 "domain": "users",246 "scan_path": "src/users",247 "total_issues": 4,248 "critical": 1,249 "high": 2,250 "medium": 1,251 "low": 0,252 "findings": [253 {254 "severity": "CRITICAL",255 "location": "src/users/controllers/UserController.ts:45",256 "issue": "Controller directly uses Repository",257 "principle": "Layer Separation (Clean Architecture)",258 "recommendation": "Create UserService",259 "effort": "L",260 "domain": "users"261 }262 ]263}264```265266**Aggregation Algorithm:**267```2681. Collect JSON from all 9 workers (7 global + 2×N domain-aware)2692. Merge findings from all workers into single array2703. Sum severity counts:271 total_critical = sum(worker.critical for all workers)272 total_high = sum(worker.high for all workers)273 total_medium = sum(worker.medium for all workers)274 total_low = sum(worker.low for all workers)2754. Calculate Overall Score:276 overall_score = average(worker.score for all 9 categories)2775. Sort findings by severity: CRITICAL → HIGH → MEDIUM → LOW2786. Group findings by category for report sections279```280281**Aggregation steps:**2822831. **Global workers (7)** → merge findings into single list2842. **Domain-aware workers (2 × N)** → group by domain.name:285 - Calculate domain-level scores (Architecture + Quality per domain)286 - Build Domain Health Summary table2873. **Overall score** → average of 9 category scores (Architecture/Quality averaged across domains)2884. **Severity summary** → sum critical/high/medium/low across ALL workers2895. **Findings grouping:**290 - Global categories (Security, Build, etc.) → single table291 - Domain-aware categories → subtables per domain2926. **Cross-Domain DRY Analysis** (post-aggregation):293 - From ln-623 domain results, collect all findings that have `pattern_signature` field294 - Group by `pattern_signature` across domains295 - Same `pattern_signature` in 2+ domains → create Cross-Domain DRY finding:296 - severity: HIGH297 - principle: "Cross-Domain DRY Violation"298 - list all affected domains and locations299 - recommendation: "Extract to shared/ module accessible by all affected domains"300 - Add findings to "Cross-Domain Issues" section in report301302## Output Format303304**MANDATORY READ:** Load `shared/templates/codebase_audit_template.md` for full report structure.305306Report is written to `docs/project/codebase_audit.md` using the template. Key sections:307- Executive Summary, Compliance Score (9 categories), Severity Summary308- Domain Health Summary + Cross-Domain Issues (if domain-aware)309- Strengths, Findings by Category (global + domain-grouped), Recommended Actions310- Sources Consulted311312## Phase 6: Write Report313314**MANDATORY READ:** Load `shared/templates/codebase_audit_template.md` for report format.315316Write consolidated report to `docs/project/codebase_audit.md`:317- Use template structure from codebase_audit_template.md318- Fill all sections with aggregated worker data319- Overwrite previous report (each audit is a full snapshot)320321## Critical Rules322323- **Two-stage delegation:** Global workers (7) + Domain-aware workers (2 × N domains)324- **Domain discovery:** Auto-detect domains from folder structure; fallback to global mode325- **Parallel execution:** All workers (global + domain-aware) run in PARALLEL326- **Single context gathering:** Research best practices ONCE, pass contextStore to all workers327- **Metadata-only loading:** Coordinator loads metadata only; workers load full file contents328- **Domain-grouped output:** Architecture & Code Quality findings grouped by domain329- **File output only:** Write results to codebase_audit.md, no task/story creation330- **Do not audit:** Coordinator orchestrates only; audit logic lives in workers331332## Definition of Done333334- Best practices researched via MCP tools for major dependencies335- Domain discovery completed (domain_mode determined)336- contextStore built with tech stack + best practices + domain info337- Global workers (7) invoked in PARALLEL338- Domain-aware workers (2 × N domains) invoked in PARALLEL339- All workers completed successfully (or reported errors)340- Results aggregated with domain grouping341- Domain Health Summary built (if domain_mode="domain-aware")342- Compliance score (X/10) calculated per category + overall343- Executive Summary and Strengths sections included344- Report written to `docs/project/codebase_audit.md`345- Sources consulted listed with URLs346347## Workers348349See individual worker SKILL.md files for detailed audit rules:350- [ln-621-security-auditor](../ln-621-security-auditor/SKILL.md)351- [ln-622-build-auditor](../ln-622-build-auditor/SKILL.md)352- [ln-623-code-principles-auditor](../ln-623-code-principles-auditor/SKILL.md)353- [ln-624-code-quality-auditor](../ln-624-code-quality-auditor/SKILL.md)354- [ln-625-dependencies-auditor](../ln-625-dependencies-auditor/SKILL.md)355- [ln-626-dead-code-auditor](../ln-626-dead-code-auditor/SKILL.md)356- [ln-627-observability-auditor](../ln-627-observability-auditor/SKILL.md)357- [ln-628-concurrency-auditor](../ln-628-concurrency-auditor/SKILL.md)358- [ln-629-lifecycle-auditor](../ln-629-lifecycle-auditor/SKILL.md)359360## Reference Files361362- **Orchestrator lifecycle:** `shared/references/orchestrator_pattern.md`363- **Task delegation pattern:** `shared/references/task_delegation_pattern.md`364- **Audit scoring formula:** `shared/references/audit_scoring.md`365- **Audit output schema:** `shared/references/audit_output_schema.md`366- **Report template:** `shared/templates/codebase_audit_template.md`367- Principles: `docs/principles.md`368- Tech stack: `docs/project/tech_stack.md`369- Kanban board: `docs/tasks/kanban_board.md`370371---372**Version:** 5.0.0373**Last Updated:** 2025-12-23