Plan audit entry per step
Skill kjuhwa/skills-hub/skills/agent-sdk/plan-audit-entry-per-step
Emit a structured audit dict on every planning iteration (loop count, tool budget, planned action count, rerouted flag, rerouted reason) and stash it in state so post-mortem analysis can replay every planner decision.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill plan-audit-entry-per-stepAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, 481 tokens by cl100k_base, as published. Nobody here has run it
Plan Audit Entry per Loop Step
When to use
Your agent has a planner that runs multiple times (one per loop iteration). When it misbehaves, you want to know exactly what was decided, with what budget, and whether the planner rerouted to a different source family. Logging via print makes this lossy; you want a typed dict in state.
How it works
- A
PlanAuditTypedDict declares the audit shape:loop,tool_budget,planned_count,rerouted, optionalreroute_reason. - Every planning node populates it before returning.
- Downstream nodes (e.g.
investigate) read the audit so summaries can include "loop 2: planner re-routed from grafana to datadog because Grafana returned no logs".
Example
class PlanAudit(TypedDict, total=False):
loop: int
tool_budget: int
planned_count: int
rerouted: bool
reroute_reason: str
def node_plan_actions(state):
loop_count = state.get("investigation_loop_count", 0)
plan, available_sources, available_action_names, _, rerouted, reroute_reason = build_plan_actions(...)
audit_entry: PlanAudit = {
"loop": loop_count,
"tool_budget": input_data.tool_budget,
"planned_count": len(plan.actions if plan else []),
"rerouted": rerouted,
}
if rerouted:
audit_entry["reroute_reason"] = reroute_reason
return {
"planned_actions": plan.actions if plan else [],
"plan_rationale": plan.rationale if plan else "",
"available_sources": available_sources,
"available_action_names": available_action_names,
"plan_audit": audit_entry,
}
Gotchas
- Use
TypedDict(total=False)so you can omit optional fields without forcing a sentinel value. - Don't accumulate the entire history in state — keep only the most recent
plan_audit. The full history can be reconstructed from LangSmith traces or LangGraph's checkpoint table. - Surface the audit in the final report so users can self-debug ("agent looped 3 times because Grafana returned no logs" is more actionable than "couldn't find root cause").
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.