trajectory-risk-supervisor
Classify task traces, detect risky engineering trajectories, score advisory bad-state risk, and route to the least disruptive intervention. Use when a repo has docs/observability/task-trace.jsonl, tra
SKILL.mdskills/trajectory-risk-supervisor/SKILL.md
GitHubTrajectory Risk Supervisor
Purpose
Use observable task traces to detect quality drift before finalization without turning the harness into a blocking daemon.
Inspect First
docs/observability/task-trace.jsonldocs/observability/trajectory-risk-policy.jsondocs/observability/trajectory-risk-report.md- feature state, sprint contract, termination evidence, pre-edit evidence, review findings, and recent validation output
Procedure
Collect or inspect trace events.
- Use
docs/observability/task-trace.jsonlas newline-delimited JSON. - Events should record task id, task type, phase, action, files read, files changed, commands run, validation, risk surfaces, intervention, outcome, and notes.
- Use
scripts/append_task_trace.pywhen a deterministic event append is useful.
- Use
Classify the current trajectory.
- Run
scripts/classify_agent_trace.py <repo> --json. - Derive task phase, task type, repo understanding, diff scope, test status, risk surfaces, repeated failure loops, and evidence coverage.
- Run
Check invariants and score risk.
- Run
scripts/check_trajectory_invariants.py <repo> --json. - Run
scripts/score_trajectory_risk.py <repo> --json. - Treat scoring as shadow/advisory unless the target repo explicitly wires enforcement through its own wrapper.
- Run
Recommend the least disruptive intervention.
- Editing before inspection routes to
$pre-edit-investigation-gate. - Repeated failures route to
$agent-failure-introspection. - Finalization without tests routes to
$termination-gatekeeper. - Dependency choices without sources route to
$research-first-change. - UI lifecycle gaps route to
$click-path-and-browser-qa. - Security, migration, or broad-diff risks route to
$agent-revieweror a generated reviewer subagent.
- Editing before inspection routes to
Document risk when useful.
- Use
assets/templates/trajectory-risk-report.md.tmpl. - Keep hooks out of default behavior; plugin hooks are a future opt-in shadow layer only after users trust them.
- Use
Validation
- Run
scripts/classify_agent_trace.py <repo> --json. - Run
scripts/score_trajectory_risk.py <repo> --json. - Confirm every risk cites trace evidence and maps to a concrete intervention or command.
- Confirm advisory mode does not block unrelated lightweight repos.
Completion Criteria
- The current task trajectory has a clear state, risk level, evidence list, and recommended intervention.
- The repo can opt into
./scripts/check-trajectory-riskwithout changing the stable baseline command interface.