coact.complete

COMPLETE — lift a .claude/skills/ skill into a .claude/agents/ definition.

COACT_SPEC §5. Given a skill, synthesize the §3.2 “extras envelope” (persona, return contract, tool allowlist, model, memory, …) and produce an AgentDefinition that references the skill (never copies it — §3.3). This is the mechanical, no-LLM path (DECISIONS D10): it reads the author’s coact: block plus an injected CompletionPolicy and reports what it guessed via AgentPlan provenance — it never decides silently.

Two entry points (progressive disclosure: dry-run first):

  • plan_completion() — returns an AgentPlan (the proposed agent + per-field provenance + warnings) without writing anything.

  • complete() — returns the AgentDefinition (the plan’s agent).

coact.complete.complete(source: str | Path | Skill, *, policy: CompletionPolicy | None = None, llm: object = None) AgentDefinition[source]

Complete a skill into an AgentDefinition (the plan’s agent).

>>> from skill.base import Skill, SkillMeta
>>> s = Skill(meta=SkillMeta(name='ux', description='Analyze bundles.'), body='steps')
>>> ad = complete(s)
>>> ad.name, ad.skills, ('Return contract' in ad.prompt)
('ux', ['ux'], True)
coact.complete.plan_completion(source: str | Path | Skill, *, policy: CompletionPolicy | None = None, llm: object = None) AgentPlan[source]

Plan the skill→agent completion, recording the provenance of every field.

Accepts a Skill, a path to a skill directory / SKILL.md, or a skill key/name resolvable in the local store or project skills. Pass an optional llm (any callable(str)->str, an aw StepConfig, or a model name) to draft a richer persona — the mechanical path needs none.

>>> from skill.base import Skill, SkillMeta
>>> s = Skill(meta=SkillMeta(name='auditor', description='Audit a bundle for issues.'), body='steps')
>>> plan = plan_completion(s)
>>> plan.agent.name
'auditor'
>>> plan.agent.model  # read-only description with default tools -> haiku
'haiku'
>>> any(p.field == 'prompt' for p in plan.provenance)
True
coact.complete.resolve_skill(source: str | Path | Skill) Skill[source]

Resolve a Skill from an object, a path, or a key/name.

Resolution order for strings: filesystem path → local store key → project .claude/skills/<name>.