Library and chains
library.yaml defines reusable components, and each chains/*.yaml file composes them into a chain template.
library.yaml: reusable components
library.yaml has four sections. Each maps a name to a definition, which any
chain takes with extends: <name>.
| Section | Holds |
|---|---|
tasks | Reusable tasks of any kind: agent, subprocess, builtin, forge. |
steps | Reusable ordered groups of tasks. A step may set read_only: true (read_only). |
nodes | Reusable nodes, with their own steps, on_failure, fix_loop and escalation. |
steering | Named guidance, {instructions: "..."}, that an agent task selects with steering: [name] and a repository selects with its repos.yaml steering:. |
kraft admin templates library lists every component as <section>.<name>
(tasks.implementer) with the chains that use it. kraft admin templates library ID
shows one component with its definition and any lint issue that names it.
Settings, Library shows the same and edits the file. Kraft refuses a save, with
the reason and nothing written, if it would stop any chain that resolves now.
tasks:
implementer:
kind: agent
harness: claude
profile: strong
prompt: Implement the approved plan.
code_review:
kind: agent
harness: claude
prompt: Review this work item's change for defects its passing tests do not catch.
skill: kraft:code-review
inputs: [review_package]
An agent task in the library takes harness, prompt, skill, steering, produces, profile, model, effort, fallback, inputs, scope, on_failure, policy and skippable. The other kinds take command, ref or target and wait. Chain nodes defines each key, and covers extends.
chains/*.yaml: chain templates
Each file in chains/ is one selectable chain, named by its id (or the file
name). The keys are in Chain nodes.
Concepts walks through the shipped default and
quick-task chains as worked examples. kraft admin templates show ID --resolved
prints a chain with its library components expanded, and Settings, Chains
edits the file itself.
Write your own chain walks through adding a node, with a command task, a fix loop and a judge. Kraft never overwrites these files on upgrade; Upgrading your templates shows how to take what a new release ships.