STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes tokens. Begin executing Step 0 immediately.
Step 0 — Immediate Output
Before ANY tool calls, display this banner:
╔══════════════════════════════════════════════════════════════╗
║ PLAN-BUILD-RUN ► SESSION AUDIT ║
╚══════════════════════════════════════════════════════════════╝
Then proceed to Step 1.
/pbr:audit — Session Compliance & UX Review
You are running the audit skill. Your job is to analyze past Claude Code session logs for this project, checking PBR workflow compliance (STATE.md updates, hook firing, commit format, skill usage) and user experience quality (flow choice, friction, unmet expectations). You produce a comprehensive report document.
This skill uses parallel Task() delegation to analyze multiple sessions simultaneously, keeping main context lean.
Context Budget
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Reference: skills/shared/agent-type-resolution.md for agent type fallback when spawning Task() subagents.
Additionally for this skill:
- Delegate ALL session analysis to audit subagents — do NOT read JSONL files in main context
- Main context handles: argument parsing, session discovery, agent orchestration, report synthesis
- Target: main context stays under 20% utilization
Step 1 — Parse Arguments
Parse $ARGUMENTS for:
| Argument | Default | Description |
|---|---|---|
--from DATE | Start of today | Start of audit window (ISO date or natural language) |
--to DATE | Now | End of audit window |
--today | false | Shorthand for --from start of today --to now |
--mode MODE | full | compliance = workflow only, ux = user experience only, full = both |
--preset PRESET | config.json audit.preset | Override audit preset (minimal/standard/comprehensive) |
--dimension ID | (none) | Add specific dimension(s) to the active set. Accepts code (SI-01) or slug (skill-template-refs). Repeatable. |
--skip ID | (none) | Remove specific dimension(s) from the active set. Accepts code or slug. Repeatable. |
--only ID | (none) | Run ONLY these dimensions, ignoring preset/categories. Accepts code or slug. Repeatable. |
Natural language parsing: Accept formats like:
--todayor justtoday--from 2026-02-21or--from "yesterday"--from "3 days ago"or--from "last monday"- A bare date like
02/21implies--from 02/21 --to 02/21(full day) - A bare
3implies last 3 days
If no arguments provided, default to --today --mode full.
Display the parsed time range to the user:
Audit window: {from} → {to}
Mode: {mode}
Step 1b — Resolve Dimensions
Load the project's config.json audit section. Build cliFlags from parsed arguments:
const cliFlags = {
preset: parsedArgs.preset, // string or undefined
dimension: parsedArgs.dimension, // array of ID/slug strings or undefined
skip: parsedArgs.skip, // array of ID/slug strings or undefined
only: parsedArgs.only, // array of ID/slug strings or undefined
};
Call audit-dimensions.js resolveDimensions(config, cliFlags) to compute the active dimension set.
Display the resolution summary:
Preset: {preset} ({N} base dimensions)
Active dimensions: {N} ({breakdown by category, e.g., "SI: 15, IH: 10, EF: 7, WC: 12"})
If --dimension or --skip was used, also display:
Adjustments: +{added} -{removed}
Store the resolved dimension list for use in Step 4.
Step 2 — Discover Session Logs
Session JSONL files live at:
~/.claude/projects/{encoded-project-path}/*.jsonl
Where {encoded-project-path} encodes the project directory path (e.g., D:\Repos\plan-build-run → D--Repos-plan-build-run).
CRITICAL: Determine the correct encoded path for the current project by listing ~/.claude/projects/ and finding the directory that matches.
Use Bash to find sessions in the audit window:
find ~/.claude/projects/{encoded-path}/ -name "*.jsonl" -maxdepth 1 \
-newermt "{from_datetime}" ! -newermt "{to_datetime}" | sort
CRITICAL — Exclude Current Session: Before proceeding, determine the current session ID:
- The current session's JSONL file is the most recently modified
.jsonlin the project directory that is actively being written to (i.e., THIS session) - Identify it by checking which session file has been modified within the last 60 seconds:
find ~/.claude/projects/{encoded-path}/ -name "*.jsonl" -maxdepth 1 -mmin -1 2>/dev/null - Remove the current session from the discovered sessions list
- Display:
Excluding current session {id} from analysis (self-referential) - If no sessions remain after exclusion, show the "no sessions found" error
For each session file found, also check for subagent logs:
ls ~/.claude/projects/{encoded-path}/{session-id}/subagents/*.jsonl 2>/dev/null
Display discovery results:
Found {N} sessions in audit window:
{session-id-1} ({size}, {date})
{session-id-2} ({size}, {date})
...
If no sessions found, display an error and exit:
╔══════════════════════════════════════════════════════════════╗
║ ERROR ║
╚══════════════════════════════════════════════════════════════╝
No session logs found between {from} and {to}.
Check: ~/.claude/projects/{encoded-path}/
Step 3 — Discover Git Activity
In parallel with session analysis (Step 4), gather git commit data for the audit window:
git log --since="{from_iso}" --until="{to_iso}" --format="%h %s %an %ai" --all
Check for:
- Conventional commit format violations
- Forbidden
Co-Authored-Bylines - Release-please automated commits
This data feeds into the final report synthesis.
Step 4 — Spawn Audit Agents
CRITICAL: Spawn one pbr:audit agent per session, ALL in parallel. Do NOT analyze sessions sequentially.
4a. Discover Insights Report
Before spawning agents, check for a recent insights report:
ls -t ~/.claude/insights/*.html 2>/dev/null | head -1
If a file exists and was modified within the last 30 days, store its absolute path as insights_report_path. Otherwise set to 'none'.
4b. Compute Spawn Parameters
Compute paths for the spawn prompt:
- Plugin root: absolute path to
plugins/pbr(e.g.,D:/Repos/plan-build-run/plugins/pbr) - Planning dir: absolute path to
.planning(e.g.,D:/Repos/plan-build-run/.planning) - Config JSON:
JSON.stringify(config)from the loaded config.json — escape backslashes and quotes for template embedding
For each session:
Task({
subagent_type: "pbr:audit",
prompt: "<files_to_read>
CRITICAL: Read these files BEFORE any other action:
1. {absolute_path_to_session.jsonl} — session log to analyze
2. {subagent log paths, if any} — subagent session logs
</files_to_read>
<audit_assignment>
Session JSONL: {absolute_path_to_session.jsonl}
Subagent logs: {list of subagent jsonl paths, or 'none'}
Audit mode: {mode}
Active dimensions: {comma-separated list of dimension codes from Step 1b}
Preset: {preset}
Plugin root: {absolute path to plugins/pbr}
Planning dir: {absolute path to .planning}
Config JSON: {JSON.stringify(config) — escaped for template}
Run programmatic checks first via audit-checks/index.js runAllChecks(),
then analyze JSONL for session-dependent dimensions.
Return per-dimension results table.
Only check dimensions in the active set. Skip all others.
Output path: DO NOT write to disk — return findings inline.
Analyze this session for PBR workflow compliance and/or UX quality
per your audit checklists. Return your full findin