tl-agent-plan-audit
Plan Audit
Unified audit workflow for .plan.md files. Validates structural compliance against the tl-agent-plan-create specification, then combines critique, pre-mortem simulation, parallelization review, and implementation readiness analysis into a single cohesive audit.
When to Use
- User says "audit this plan" or "review the plan"
- Before starting execution of a plan
- User asks to optimize a plan for efficiency
- User wants a pre-mortem or critique
Outcomes
- Analysis: Unified audit report with findings grouped by subject matter
- Decision: Verdict (Ready to execute | Changes recommended | Rework needed)
- Artifact: Actionable recommendations for plan revision
Audit Process
Run Analysis 0 first — it is mechanical validation that reads the plan and produces numbered findings. Then perform Analyses 1–4 mentally and merge all findings into a unified output grouped by subject matter. Do NOT reveal the analysis numbering to the user.
Analysis 0: Structural Compliance
See Structural Compliance Rules for the full 9-step mechanical validation procedure (plan-type detection, frontmatter checks, todo structure, phase/gate completeness, body/YAML cross-reference, specificity, decision resolution, plan integrity, verification metadata compliance).
This analysis MUST always produce a "Structural Compliance" section in the audit output. If all checks pass, write "All 9 structural checks pass." If any fail, list each violation numbered.
Read the rules file first, then execute its 9 steps in order against the target plan. The validation is mechanical — no judgment calls.
Analysis 1: Principal Engineer Critique
Evaluate:
- Clarity: Is the goal unambiguous? Are subtasks atomic and verifiable? Will another engineer understand this?
- Risk: What could fail? Are failure modes addressed? Hidden assumptions?
- Sequencing: Is the order optimal? Unnecessary dependencies? Could earlier phases de-risk later ones?
- Leverage: What has highest impact-to-effort ratio? Are high-leverage tasks front-loaded?
Analysis 2: Pre-Mortem Simulation
Mentally execute the plan start-to-finish. For each subtask, identify:
- Hidden subtasks (unstated work required)
- Dependencies (what must exist before this can start)
- Bottlenecks (where things will slow down)
- Failure points (what's most likely to go wrong)
Analysis 3: Parallelization Review
Identify:
- Independent tasks (no dependencies between them)
- Parallel agent opportunities (multiple agents working simultaneously)
- Blocking paths (what MUST be sequential)
- Specific agent allocation recommendations
Analysis 4: Implementation Readiness
For EVERY file the plan modifies, creates, or deletes, perform exhaustive pre-reads and document:
- Signatures: Exact function signatures with parameter types, return types, and line numbers. Not summaries — the actual code.
- Import graph: Every file that currently imports the target. Every import the target file has that may break. Exact file paths and line numbers.
- Call sites: The exact lines where changes hook in. If the plan says "add externalIdService.link after upsert", the audit must show the upsert call and its surrounding context.
- API surface: For route handlers, the exact request schema (query params, body shape) and response shape today.
- Job handler shape: For job files, what
job.datalooks like today and whether it is currently used or ignored (_jobpattern). - State of the world: Which planned deletions/creations overlap with work already done in prior plans? Which files have already been deleted?
The standard is: an implementor should be able to execute the plan start-to-finish without a single exploratory file read. Every fact needed is either in the plan body or in a code reference within the Implementation Context section.
Red flags that MUST be caught:
- Plan says "modify X.ts" but doesn't include X's current function signature
- Plan says "delete Y.ts" without listing every file that imports Y
- Plan says "extend endpoint Z" without stating Z's current query params and response shape
- Plan says "replace CONSTANT" without listing every file that imports it
- Plan says "add after upsert" without showing the upsert call site with surrounding context
- Plan says "accept NewPayload" but target already has a different options type (naming conflict)
Adaptive Depth
Scale analysis depth to plan complexity:
| Plan Size | Risk Level | Analysis Depth |
|---|---|---|
| Small (1-2 phases) | Low | Brief findings, focus on blockers only |
| Medium (3-4 phases) | Medium | Standard analysis, all major findings |
| Large (5+ phases) | High | Detailed analysis, every subtask reviewed |
| Any size | Any risk | If plan modifies 5+ files: require Implementation Readiness analysis |
Risk multipliers: External integrations, data migrations, auth/security, billing = deeper analysis regardless of size.
Smart Auto-Fix Rule
Obvious improvements: Apply directly without asking. Examples:
- Missing gate criteria → add specific verification
- Vague subtask → make atomic
- Missing dependencies → add them
- Parallelizable tasks not marked → add parallelization notes
- Missing
isProjectfield in frontmatter → add it - Todo IDs not matching convention → reformat to
t{p}-{g}-{s}or slug style - Missing
Precondition:orExit gate:in a phase → add skeleton - Body/YAML numbering mismatch → reconcile
- Unresolved "Option A / Option B" alternatives → research codebase, apply first principles, commit to one approach
Implementation unknowns: If a plan modifies a file but doesn't document the current signature/shape, add an "Implementation Context" section with those facts. This is an obvious fix — perform the pre-reads and add the results to the plan.
Integrity violations (Steps 8-9): These are always obvious fixes — apply directly:
- Stale file path → verify and correct or remove the reference
- Wrong line number → read the file, update to the actual line
- YAML/body inconsistency → update the YAML todo text to match the body
- Missing files from scope → grep, find the consumers, add them to the plan
- Exit gate example values that don't match actual output → correct the examples
- Missing cross-section rationale → read both sections, add a
> Decision:note explaining the difference - Missing
verified_at_commit→ rungit rev-parse --short HEADand add it - Missing or incomplete
verifications:array → run the verification commands from Step 8b and produce the block - Stale verification results → re-run the command, update the result, flag if the claim changed
Non-obvious decisions: Probe, ask questions, propose with rationale. Examples:
- Reordering phases (may have unstated reasons)
- Removing scope (user may have context you don't)
- Architectural changes
- Adding significant new work
- Alternatives where both approaches have legitimate first-principles arguments and codebase evidence is ambiguous → ask the user
Output Format
See Output Format Template for the complete audit report template (Summary, Findings grouped by subject area, Parallelization, Critical path, Agent allocation, Recommendations list).
Produce a unified audit report. Group findings by subject matter (e.g., by phase, by system component, by risk area) — NOT by audit type.
After the Audit
Update plan-level status. If the verdict is "Ready to execute," set the plan's YAML frontmatter status field to audited. This signals to tl-agent-plan-execute that the plan has been reviewed and its verification receipts are trustworthy. If the verdict is "Changes recommended" or "Rework needed," leave status as planned until the revisions are applied and the plan is re-audited.
If verdict is "Changes recommended":
Audit complete. I've identified [N] changes.
[If any are obvious fixes]: I can apply items 1, 3, 5 directly — they're straightforward improvements.
[If any need discussion]: Items 2, 4 involve trade-offs. Want me to elaborate on any before proceeding?
Ready to revise the plan?
If verdict is "Ready to execute":
Plan looks solid. Minor suggestions in the findings, but nothing blocking.
Ready to start execution?
Branch Workflow Check
Before execution begins, ask about branching strategy if not already specified in the plan:
prompt: "Should this work be done in a feature branch?"
options:
- id: yes_branch
label: "Yes - create a feature branch (e.g., feat/plan-name)"
- id: no_branch
label: "No - work directly on current branch"
- id: already_specified
label: "Already specified in plan"
If yes:
- Add a "create-branch" task as the first todo
- Add a "Branch" section at the top of the plan body
- Add commit/push instructions at the end
- Suggest branch name based on plan name (e.g.,
feat/embedded-checkout)
Example Subject Groupings
See Example Subject Groupings for guidance on organizing findings (by phase, by system component, by risk category, or by execution concern).
Choose the grouping that minimizes redundancy for the specific plan being audited.
More from toddlevy/tl-agent-skills
tl-openmeter-api
Works with the OpenMeter REST API for usage metering, billing, and entitlements. Covers CloudEvents ingestion, meters, features, plans, customers, subscriptions, entitlements, notifications, billing profiles, invoices, apps, addons, grants, and the Stripe marketplace. Use when integrating OpenMeter, debugging metering, building catalog sync scripts, or when the user mentions OpenMeter API.
15tl-first-principles
Foundational software design principles traced to their intellectual origins. Covers information hiding, separation of concerns, abstraction, SSOT/DRY, conceptual integrity, and composition. Use when making architectural decisions, evaluating trade-offs, or understanding *why* best practices exist.
15tl-knip
Find and remove unused files, dependencies, and exports in TypeScript/JavaScript projects using Knip. Covers configuration-first workflow, plugin system, barrel file handling, CI integration, monorepo support, and agent-specific cleanup guidance.
14tl-docs-create
Create documentation from scratch for codebases. Covers SSOT-driven generation, writing standards, and templates for README/AGENTS.md/CHANGELOG. Use when creating new docs or documenting an undocumented codebase.
14tl-devlog
Maintain a structured development changelog (DEVLOG.md) capturing architectural decisions, milestones, incidents, and insights. Use when the user says "log this", "devlog", "archive this", or at natural pause points after significant decisions. Trigger on changelog, decision log, work log, or progress tracking.
14tl-docs-audit
Audit existing documentation for gaps, staleness, and sync issues. Generates sync reports with actionable findings. Use when reviewing doc coverage, finding outdated docs, or syncing docs with code.
14