v2.0.0next
Customize and automate

Add a security review or a gate reviewer

Add the shipped security-review and gate-review skills to a chain of your own, since no shipped chain uses them.

Add the two review skills that no shipped chain runs to a copy of the default chain: a security review inside verification, and an agent that reviews a gate before a person is asked.

  • kraft:security-review reviews a change that touches authentication, sessions, tokens, secrets, or permission checks. It reports findings the way kraft:code-review does, so they enter the same fix loop.
  • kraft:gate-review reads the document a gate is about and reports a verdict, so a gate that needs no person's decision no longer waits for one. It never clears the gate itself.

Both are opt-in because both cost money. A security pass costs an extra agent session per review round on every item. A gate reviewer is a paid agent session on every item that reaches the gate with auto-gate on, and it decides whether a person sees that gate at all. Neither runs unless you add it to your chain.

Before you start

  • A running Kraft server.
  • A chain of your own to edit. Step 2 makes chains/reviewed.yaml; if you already have a chain, edit that one.
  • Your config directory: ~/.kraft/config/, or $KRAFT_HOME/config/ if you set KRAFT_HOME.

Add a security review to verification

  1. Add the task to library.yaml, under tasks::
    config/library.yaml
    security_review:
      kind: agent
      harness: claude
      prompt: Review this work item's change for security defects.
      skill: kraft:security-review
      inputs: [review_package, carried_findings, previous_review]
    
  2. Copy the default chain to a chain of your own. cp -n never overwrites a file, so if chains/reviewed.yaml exists, skip this step and keep editing it:
    cd "${KRAFT_HOME:-$HOME/.kraft}/config"
    cp -n chains/default.yaml chains/reviewed.yaml
    
  3. In chains/reviewed.yaml, change id: default to id: reviewed.
  4. Replace the existing - id: verification entry with one that runs the security review beside the code review. A list replaces the parent's when a node extends (how extends merges), so write both steps out:
    config/chains/reviewed.yaml
    - id: verification
      extends: verification
      steps:
        - id: tests
          tasks:
            - id: test_changed_scopes
              extends: verify_changed_scopes
        - id: review
          tasks:
            - id: code_review
              extends: code_review
            - id: security_review
              extends: security_review
    

    Tasks in one step run in parallel, so both reviews read the same tests-green change. Their findings share the node's fix loop.

Add a gate reviewer to a gate

  1. Open chains/reviewed.yaml, or your own chain, and find the gate node to review. This guide uses spec_approval.
  2. Add auto_review to it. It takes an agent task, which you write out as below or extends from the library:
    config/chains/reviewed.yaml
    - id: spec_approval
      kind: gate
      message: Review and approve the specification.
      artifact: spec
      reject_to: spec
      auto_review:
        id: reviewer
        kind: agent
        harness: claude
        prompt: Decide whether this gate needs a person.
        skill: kraft:gate-review
    
  3. Leave out fallback:. A gate review launches its reviewer once, so Kraft refuses the task at launch if it selects an agent profile (profile:) whose tier has a fallback: list.

Auto-gate is on by default for an item you file, so adding auto_review starts a paid reviewer agent on every such item that reaches the gate. An item filed by a schedule, POST /api/triggers or auto-intake has it off, and --no-auto-gate opts one more item out. Filing a work item has the rule.

What the reviewer can decide

The reviewer runs as a worker, so Kraft refuses it if it tries to approve or reject. It reports one of approve, reject, fixed, or undecided, and Kraft applies the verdict. Result file says what each one does.

If the reviewer reports nothing or an unknown value, Kraft records undecided: the gate waits for a person, who sees the reviewer's concerns first. auto_review_attempts in policy.yaml (default 1) bounds how many attempts one pending gate gets.

Check it worked

  1. Lint the files, make the server read them, and print the chain with the library expanded:
    kraft admin templates lint
    kraft admin reload
    kraft admin templates show reviewed --resolved
    

    A pass prints these lines (the counts are your own):
    3 chain(s), no errors
    reloaded 3 template(s) and policy.yaml and intake.yaml
    

    The first line is lint's, the second reload's. In the show output, look for security_review under verification, and auto_review on the gate.
  2. File an item on the chain:
    kraft item create "title" --chain reviewed
    
  3. When the item has passed the tests in verification, list the findings, and when it reaches the reviewed gate, list the reviewer's start:
    kraft view events ID --type findings_measured
    kraft view events ID --type gate_auto_review_started
    

    A security finding shows in findings_measured like any review finding. A gate review that ran shows one gate_auto_review_started row. A gate_auto_review_skipped row means the reviewer left the gate to a person.

Next steps

Copyright © 2026