Analyze: see and move between the layers
Four small tools wrap the two transforms. All have a .render() for the
terminal and a structured object for code.
diff — what extras an agent adds over its skill
Audit drift between the SSOT skill and a derived agent (the §3.2 extras table):
from coact import diff
print(diff(".claude/skills/ux-analyst", ".claude/agents/ux-analyst.md").render())
# rows tagged [from skill] (name/description/skills) vs [extra (agent-only)]
# (tools/model/memory/persona/returns/...)
coact diff .claude/skills/ux-analyst .claude/agents/ux-analyst.md
agent may be an AgentDefinition, an agent *.md path, or a skill source
(completed first). Use it to confirm an agent didn't silently drift from its
skill, or to see exactly which envelope fields COMPLETE synthesized.
estimate — the fan-out cost gate (use before you spawn)
A running fleet costs ~an order of magnitude more tokens than one agent, and the
premium is worst on interdependent tasks. estimate surfaces the tradeoff so
you don't pay it blindly:
from coact import estimate
est = estimate([agent_a, agent_b])
est.token_multiplier_vs_chat # ~4× one agent, ceiling ~15× a fleet
est.interdependent # True if they share skills or declare a `consumes` contract
est.shared_skills
print(est.recommendation) # often: "prefer one host agent (backend='host')"
coact estimate .claude/agents/a.md .claude/agents/b.md
Heuristic: shared skills or any declared input contract ⇒ interdependent ⇒
multi-agent is a poor fit (isolation buys you nothing; context is shared anyway),
so it steers you to backend="host". An independent, breadth-first set is the
case where a fleet can pay off — if the task value justifies the spend.
inventory — a project's reusable AI assets
from coact import inventory
inv = inventory(".")
inv.skills, inv.agents, inv.mcp_tools
print(inv.render())
coact inventory .
Enumerates .claude/skills/ skills, .claude/agents/ derived agents, and the
MCP tools declared in skills' coact: mcp blocks (skill: module:function).
Reuses skill discovery and adds the agent + MCP dimensions.
back — lossy agent → skill extraction
Harvest an ad-hoc agent back into reusable procedural knowledge. Lossy by design: it strips the persona / return-contract envelope to a skill stub (name + description + a pointer to the skills the agent referenced). The actual procedure usually lives in those referenced skills, so this is a starting point you flesh out — not a faithful inverse of COMPLETE.
from coact import back
skill_stub = back(".claude/agents/ad-hoc.md")
print(skill_stub.to_string())
coact back .claude/agents/ad-hoc.md
Related
coact-complete— produce the agentsdiff/estimate/inventoryinspect.coact-realize—estimatedecides the backend;realizematerializes it.