@kitman-sh/cli 0.14.9 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{chunk-cwdrhsvk.js → chunk-0ws25xvg.js} +2 -2
  2. package/dist/{chunk-mgjer6c7.js → chunk-39ykbhq8.js} +3 -3
  3. package/dist/{chunk-y9x0yv20.js → chunk-3n99j4z0.js} +456 -219
  4. package/dist/{chunk-vt8aqeby.js → chunk-3ns4sbfb.js} +1 -1
  5. package/dist/{chunk-h7qv6nzc.js → chunk-4x7a1qkj.js} +7 -7
  6. package/dist/{chunk-vjt0d9zj.js → chunk-4zc1g45m.js} +7 -7
  7. package/dist/{chunk-0x5r7h2g.js → chunk-58hehm8d.js} +1123 -105
  8. package/dist/{chunk-c80dvhxf.js → chunk-5hkdgzh4.js} +1 -6
  9. package/dist/{chunk-dd7wknyk.js → chunk-8393zths.js} +1500 -113
  10. package/dist/{chunk-qb9jft1r.js → chunk-8wpg3rph.js} +2 -2
  11. package/dist/{chunk-enmtmq63.js → chunk-b16qxawc.js} +1 -1
  12. package/dist/chunk-cf1hxp43.js +3080 -0
  13. package/dist/chunk-csxxwscf.js +39 -0
  14. package/dist/{chunk-ftre6ndb.js → chunk-djp6t2g6.js} +6 -6
  15. package/dist/{chunk-wttgq85b.js → chunk-dx792s4w.js} +1396 -41
  16. package/dist/{chunk-b2yy07ag.js → chunk-fv2zpgh0.js} +7 -7
  17. package/dist/{chunk-93xj74qp.js → chunk-fzaecdgv.js} +3 -3
  18. package/dist/{chunk-2r4jy82z.js → chunk-k2wd9r6t.js} +4 -4
  19. package/dist/chunk-mrkrt2hg.js +4345 -0
  20. package/dist/{chunk-6qygqj10.js → chunk-qkt77rtj.js} +6 -6
  21. package/dist/{chunk-cpss81fx.js → chunk-rt0qfdtg.js} +13 -5
  22. package/dist/{chunk-czmbgsqr.js → chunk-snwjv2sd.js} +656 -39
  23. package/dist/{chunk-bmwf2ea5.js → chunk-vg78dz3w.js} +85 -26
  24. package/dist/{chunk-jsb61dsk.js → chunk-vq7caqt2.js} +1814 -116
  25. package/dist/{chunk-axr8avvs.js → chunk-wfz64h9p.js} +4 -4
  26. package/dist/{chunk-e3c15bgw.js → chunk-xx711t5r.js} +4 -4
  27. package/dist/index.js +4 -4
  28. package/package.json +2 -1
  29. package/dist/chunk-3hdjd2c3.js +0 -1192
  30. package/dist/chunk-qvyqfm54.js +0 -526
@@ -66,6 +66,12 @@ Approve a check that reads the target branch, such as a migration history test t
66
66
  kitman verify add migration-history bun run test:vitest packages/db/src/migration-history.test.ts --reads-target
67
67
  \`\`\`
68
68
 
69
+ Approve a command that a Loop's \`command\` Step runs by name, with its own arguments, with \`--command\`. \`verify\` never runs it as a check, so \`--pipeline\` and \`--reads-target\` are refused with it. Approving the name again without \`--command\` keeps it a command:
70
+
71
+ \`\`\`sh
72
+ kitman verify add changelog .kitman/changelog --command
73
+ \`\`\`
74
+
69
75
  Set up this machine's Harnesses from your Kits: the Workspace's, your Teams' and your own, with the Kitman MCP server. \`--harness\` narrows it to one of \`claude\`, \`codex\`, \`opencode\`, \`pi\` or \`antigravity\`. Antigravity gets its skills in \`~/.agents/skills\`, which other agents also read, and its plugins beside your own in \`~/.gemini/config/plugins\`. A sync removes the skills and plugins it wrote before and writes the Kits' again, so a skill or plugin of yours that shares a name with a Kit's is replaced:
70
76
 
71
77
  \`\`\`sh
@@ -429,6 +435,7 @@ Kitman Web includes user, agent, and operator guides.
429
435
  - [Triage](/docs/triage)
430
436
  - [Inbox](/docs/inbox)
431
437
  - [Projects and Saved Views](/docs/projects-and-views)
438
+ - [Release Flows](/docs/release-flows)
432
439
  - [Kits Guide](/docs/kits)
433
440
  - [Loop Operations Guide](/docs/loop-operations)
434
441
  - [Runner Operations Guide](/docs/runner-operations)`
@@ -454,7 +461,14 @@ A Team's Tasks and Runs get the Kits of its Owner chain, nearest first: the Team
454
461
  path: "kits#starting-a-kit",
455
462
  level: 2,
456
463
  link: "https://kitman.sh/knowledge/docs/kits#starting-a-kit",
457
- text: "## Starting a Kit\n\n```sh\nkitman init --kit acme-kit\n```\n\nThis writes a `defineKit` project with an example Loop, its test and a GitLab pipeline that deploys the default branch. `kitman loop fork <loop>` starts a Kit that spreads a shipped Loop instead."
464
+ text: "## Starting a Kit\n\n```sh\nkitman init --kit acme-kit\n```\n\nThis writes a `defineKit` project with an example Loop, its test and a GitLab pipeline that deploys the default branch. The example Loop defines two Steps and calls them in order, and its test scripts one of them, so `bun test` runs it with no Kitman and no agent.\n\nA Loop is built of Steps. A Step you define with `step` has a payload, the results it ends in and the errors it fails with, and calls other Steps, such as an agent's work or a verification. A Loop calls its agents as functions: `agent` takes the Loop's own name for the agent, a key of its `agents`, which says which Agent does the work:\n\n```ts\nimport * as Effect from 'effect/Effect'\nimport * as Schema from 'effect/Schema'\nimport { agent, defineLoop, step, verify } from '@kitman-sh/sdk/loop'\n\nconst implementer = agent('implementer')\n\nexport class Fixed extends Schema.TaggedClass<Fixed>()('Fixed', { summary: Schema.String }) {}\n\nexport class CannotFix extends Schema.TaggedError<CannotFix>()('CannotFix', { reason: Schema.String }) {}\n\nconst FixAnswer = Schema.Struct({ fixed: Schema.Boolean, summary: Schema.String })\n\n/** An agent fixes the ticket on the Run's branch, or says why it cannot. */\nexport const fixed = step('fixed', {\n payload: { ticket: Schema.String.annotate({ description: 'The ticket to fix.' }) },\n success: Fixed,\n error: CannotFix,\n run: ({ ticket }) =>\n Effect.gen(function* () {\n const answer = yield* implementer('fix', { prompt: `Fix ${ticket}.`, output: FixAnswer })\n\n return answer.fixed ? new Fixed({ summary: answer.summary }) : yield* new CannotFix({ reason: answer.summary })\n })\n})\n\nexport class Passed extends Schema.TaggedClass<Passed>()('Passed', { revision: Schema.String }) {}\n\nexport class ChecksFailed extends Schema.TaggedError<ChecksFailed>()('ChecksFailed', {\n failed: Schema.Array(Schema.String)\n}) {}\n\n/** Runs the repository's approved checks at the Run's head. */\nexport const checked = step('checked', {\n payload: {},\n success: Passed,\n error: ChecksFailed,\n run: () =>\n Effect.gen(function* () {\n const evidence = yield* verify('checks', {})\n const failed = evidence.checks.filter(check => check.status === 'failed').map(check => check.name)\n\n return evidence.passed ? new Passed({ revision: evidence.revision }) : yield* new ChecksFailed({ failed })\n })\n})\n\nexport default defineLoop({\n id: 'fix',\n title: 'Fix',\n input: Schema.Struct({ ticket: Schema.String.annotate({ description: 'The ticket to fix.' }) }),\n output: Schema.Struct({\n status: Schema.Literals(['fixed', 'not_fixed', 'red']),\n summary: Schema.String.annotate({ description: 'What changed, or why nothing did.' })\n }),\n agents: { implementer: 'implementer' },\n checkout: 'write',\n capabilities: ['agent_work', 'verify'],\n run: ({ ticket }) =>\n Effect.gen(function* () {\n const { summary } = yield* fixed({ ticket })\n const { revision } = yield* checked({})\n\n return { status: 'fixed' as const, summary: `${summary} Checks passed at ${revision}.` }\n }).pipe(\n Effect.catchTags({\n CannotFix: ({ reason }) => Effect.succeed({ status: 'not_fixed' as const, summary: reason }),\n ChecksFailed: ({ failed }) =>\n Effect.succeed({ status: 'red' as const, summary: `Failed: ${failed.join(', ')}` })\n })\n ),\n // A build runs each check twice, the second time replaying the first from its journal.\n checks: [\n {\n name: 'fixes',\n script: {\n input: { ticket: 'KIT-1' },\n outputs: { 'fixed/fix': { fixed: true, summary: 'Guarded the empty list.' } }\n }\n }\n ]\n})\n```\n\n`kitman kit build` reads each Loop's outline from its source: every Step, branch, repeat and end, which the Loop's page and each Run's page draw. It fails when a Loop calls an agent by a literal name its `agents` does not declare. A name picked at run time, as `agent(seat)`, is checked when the Step runs, and fails it."
465
+ },
466
+ {
467
+ title: "Kits Guide \u203A Forking a shipped Loop",
468
+ path: "kits#forking-a-shipped-loop",
469
+ level: 2,
470
+ link: "https://kitman.sh/knowledge/docs/kits#forking-a-shipped-loop",
471
+ text: "## Forking a shipped Loop\n\n```sh\nkitman loop fork tidy acme-tidy\n```\n\nThis writes a Kit that depends on `@kitman-sh/software-engineering` and forks one of its Loops. A fork replaces one Step with a Layer and keeps every other Step, and `kitman loop fork` lists the Steps the Loop calls in the Kit's `kitman.config.ts`, so replacing another is a one-line change. This fork has Tidy's `tidied` Step keep out of generated code:\n\n```ts\nimport { defineLoop } from '@kitman-sh/sdk/loop'\nimport { loops, steps } from '@kitman-sh/software-engineering'\n\nconst shippedTidied = steps.tidied.run.defaultValue()\n\nexport default defineLoop({\n ...loops.tidy,\n provide: steps.tidied.layer(payload =>\n shippedTidied({ ...payload, words: `${payload.words ?? 'Anywhere'}, outside the generated code` })\n )\n})\n```\n\nA replacement takes the Step's payload and gives one of its results, so one of another shape does not typecheck. Deploy the fork to the Workspace or a Team, and its Loop replaces the installed one in that layer."
458
472
  },
459
473
  {
460
474
  title: "Kits Guide \u203A Publishing to npm",
@@ -498,13 +512,13 @@ The Marketplace lists references to Kits shared as git and npm packages. Adding
498
512
  path: "loop-operations",
499
513
  level: 1,
500
514
  link: "https://kitman.sh/knowledge/docs/loop-operations",
501
- text: `Agent guide for Loop catalog, Run inspection, templates, and promotion.
515
+ text: `Agent guide for Loop catalog, Run inspection, and forking a Loop.
502
516
 
503
- Loop is the durable automation primitive. A Loop definition declares triggers, guards, steps, contracts, packages, capabilities, and approval policy. Run is one execution of that definition.
517
+ A Loop is a program built of Steps: the Steps it defines and the Steps Kitman lends, such as an agent's work, a Question or a verification. Its definition declares the Input it takes, the Output it gives, the Agents it runs, the When Clauses that start it and the capabilities it needs. A Run is one execution of a Loop, and the Run page draws the Loop's outline, every Step, branch, repeat and end, with the Run's progress over it.
504
518
 
505
519
  Use the Loop catalog to inspect whether a Loop is enabled, what can trigger it, and what capabilities it can use. Use the Run inspector to review step status, attempts, waiting or blocked states, safe output, runner attribution, contracts, and package references.
506
520
 
507
- Templates propose reviewed changes through Kitman\u2019s governance queue. Direct Loops are promoted only after approval. Git-backed Loops are promoted through the provider delivery path, where package changes are reviewed, linked, and merged through the configured repository policy.
521
+ A Loop changes only at its Kit's source. To change a shipped Loop, fork it: the fork replaces one of its Steps and keeps the rest, as the [Kits Guide](kits.md#forking-a-shipped-loop) shows, and deploying the fork makes it the Loop its layer runs.
508
522
 
509
523
  Agents should record implementation evidence, verification, and delivery artifacts in Kitman. Human governance remains explicit for approval, Memory acceptance, and Task completion.`
510
524
  },
@@ -605,7 +619,7 @@ kitman run drift <run> --dismiss <constraint> --reason "fixtures, not released m
605
619
  link: "https://kitman.sh/knowledge/docs/loop-operations#automatic-starts",
606
620
  text: `## Automatic starts
607
621
 
608
- A Loop's When Clauses start Runs from Events. A Team turns each one on or off on the Loop's page, under Starts when, or from a terminal:
622
+ A Loop's When Clauses start Runs from Events. \`kitman loop show <loop>\` and the Loop's page list each one by its name, with its Event and filter, and each Input field the Loop takes, with its description, type, whether it is required and its default. A Team turns each When Clause on or off on the Loop's page, under Starts when, or from a terminal:
609
623
 
610
624
  \`\`\`sh
611
625
  kitman loop show shepherd
@@ -620,13 +634,88 @@ Two of the software-engineering Kit's starts are off until a Team turns them on:
620
634
  - Release, once per head, when such a ChangeRequest is approved at that head, by the forge or through Kitman, and its pipeline passed there, while no Run works it. A ChangeRequest a Build lands through Shepherd is merged and released by that Shepherd instead. Release asks before it publishes, unless the Team delivers in full auto. It releases only under a \`merge\` release trigger: under a \`milestone\` or \`project\` trigger each Run it starts ends \`not_due\`, so leave it off there.
621
635
 
622
636
  Turning a start off stops new Runs from it. Runs it already started go on. \`kitman loop starts\` lists what each Event started, or why it started nothing.`
637
+ },
638
+ {
639
+ title: "Loop Operations Guide \u203A Input Defaults",
640
+ path: "loop-operations#input-defaults",
641
+ level: 2,
642
+ link: "https://kitman.sh/knowledge/docs/loop-operations#input-defaults",
643
+ text: `## Input Defaults
644
+
645
+ An Input Default gives a Loop's Input fields values for its Runs in the Workspace, a Team or a Project: for every Run of the Loop there, or only for those one When Clause starts, by its name. "This Project's Milestones cut a prerelease", "this Team's Builds take five review rounds" and "this Team's alerts fix themselves" are each one Input Default, with no fork of the Loop. Any field the Loop's Input declares can have one.
646
+
647
+ A Run takes each field from the first of these that sets it:
648
+
649
+ 1. the Run's own Input, from whoever started it, the Event's bound fields, or the parent Run that called it;
650
+ 2. its Project's default for the When Clause that started it, then its Project's for the Loop; the Project is the Run's Task's;
651
+ 3. its Team's, the same way;
652
+ 4. the Workspace's, the same way;
653
+ 5. the \`values\` the Kit gives the When Clause;
654
+ 6. the schema's default.
655
+
656
+ A default for one When Clause reaches only the Runs that clause starts, never one a person, a Schedule, another clause or a parent Run started; a Run started from another Run's offered action takes that Run's own Input, not the defaults it took. A Loop-wide default fills a required field for a person's start too, so they need not give it. A Release that names no Task takes its Project's defaults only when Kitman's own \`release.due\` Event started it. The Run page and \`kitman run show\` name the layer each Input field came from.
657
+
658
+ Set them on the Loop's page under Input Defaults, picking the layer, on a Project's page, or in Settings > Delivery and releases for the selected Team. The form shows each field's description and, under it, the value it inherits and the layer that sets it; leave a field empty to inherit. From a terminal:
659
+
660
+ \`\`\`sh
661
+ kitman loop input firewatch --team OPS autoFix=true
662
+ kitman loop input release --project '0.14.0 - Release flows' --when milestone prerelease=rc
663
+ kitman loop input build --team KIT maxRounds=5
664
+ kitman loop input build --team KIT maxRounds=
665
+ kitman loop input firewatch --team OPS --when monitoring-alert --off
666
+ kitman loop input build --clear
667
+ \`\`\`
668
+
669
+ \`<field>=<value>\` reads the value as JSON when it parses, such as \`5\`, \`true\` or \`["a"]\`, and as text otherwise; \`<field>=\` removes the field, and \`--clear\` the whole entry. With no change it prints what the layer sets and inherits. \`--off\` turns the named When Clause off for that layer and \`--on\` back on, so a Team or Project stops one automatic start without forking the Loop; another Team's starts go on. Each When Clause entry says whether the clause starts Runs at that layer, and what stops it: this layer's off, a lower layer's, or the Team's switch under Starts when, which an opt-in clause needs turned on. The Starts when switches say the same the other way round: a clause an Input Default turns off for the Team or the Workspace starts no Runs whatever its switch, and its switch, \`kitman loop show\` and \`kitman loop when\` name that layer. A When Clause given a name after it had settings, as Release's \`milestone\` and \`project\` that replaced the unnamed \`release-due\`, takes, at each layer, the settings that layer keeps under its Event's name until that layer gives it its own. The first change to it at a layer that keeps only the old entry moves that entry to each clause that replaced it first. Code Mode reads and sets the same with \`loops.inputDefaults.get\`, \`loops.inputDefaults.set\` and \`loops.inputDefaults.clear\`.
670
+
671
+ Kitman checks a default against the Loop's Input schema when it is set, and refuses a field the Input does not declare or a value its schema refuses. A Kit deploy can change the schema under a default that was valid: a Run that would take such a default starts nothing, and its Event says why, as \`kitman loop starts\` shows; the settings page marks the default and the reason until someone changes or clears it. A default for a When Clause a later Kit version drops, or for a Loop that no longer resolves, can still be cleared.`
672
+ },
673
+ {
674
+ title: "Loop Operations Guide \u203A Landing a branch",
675
+ path: "loop-operations#landing-a-branch",
676
+ level: 2,
677
+ link: "https://kitman.sh/knowledge/docs/loop-operations#landing-a-branch",
678
+ text: "## Landing a branch\n\nThe Land Loop delivers one branch into another, such as a release branch or `develop` into the default branch, without opening the ChangeRequest by hand. `kitman run start land --input source=release/next` opens the ChangeRequest from `release/next` into its target, or continues on the one already open, and Shepherd takes it from there: it merges once the ChangeRequest is level, green and approved, asking first unless the Team delivers in full auto. A Schedule or a When Clause can start it too.\n\n- **`target`**: where to deliver it. Left out, it is the branch `source` delivers into when `source` is a Milestone's or a Project's target branch, else the repository's default branch.\n- **`hold`**: gets the ChangeRequest level, green and approved and stops as `ready`, merging nothing.\n- **`title`**: the ChangeRequest's title, `Land <source> into <target>` when left out.\n\nThe ChangeRequest's description lists the merged ChangeRequests it delivers, by their forge references such as `!12`, and names no Task: people outside your Workspace may read the forge. The Run ends `landed` with the merge revision, `ready`, `nothing` when the branches do not differ, `elsewhere` when another Team's Run holds that ChangeRequest, `busy` naming the Run that still works the branch, such as an earlier Land's Shepherd waiting for approval, or `needs_you` with Shepherd's reason. None of these fails the Run.\n\nLand also keeps a Milestone's or a Project's target branch mergeable without anyone starting it. The first ChangeRequest merged into the branch, while the forge has no ChangeRequest open delivering it, records `delivery.missing`, and Land opens that ChangeRequest and gets it level, green and approved without merging it. When the forge says that ChangeRequest conflicts, `delivery.conflicted` starts Land again on it, held, to merge the base in and settle the conflict, once per conflicting head. A branch that is only behind starts nothing. Neither start merges, whatever an Input Default sets for `hold`. A conflict Land cannot settle lands in the Project lead's Inbox as an item of the Project, naming the files when the lead may read the Team that ran it. Turn either start off for a Team under Starts when on Land's page (`open-delivery` and `level-delivery`), or with an Input Default for that clause."
679
+ },
680
+ {
681
+ title: "Loop Operations Guide \u203A Holding a merge turn",
682
+ path: "loop-operations#holding-a-merge-turn",
683
+ level: 2,
684
+ link: "https://kitman.sh/knowledge/docs/loop-operations#holding-a-merge-turn",
685
+ text: '## Holding a merge turn\n\nShepherd merges into a branch only while it holds that branch\'s merge turn, the claim `merge:<RepoBinding id>:<branch>`, so ChangeRequests for one branch land one at a time, oldest first. A Shepherd started with `hold`, which keeps a ChangeRequest level, green and approved without merging it, takes the turn only while it merges the branch in. Once a release candidate is cut, a person can hold that turn by hand so the branch stops moving while the candidate stabilises:\n\n```sh\nkitman claim hold merge:<RepoBinding id>:release/0.14.0 --reason "0.14.0-rc.1 is cut; fixes only"\nkitman claim list\nkitman cr merge-through <ChangeRequest id or URL>\nkitman claim release merge:<RepoBinding id>:release/0.14.0 --reason "0.14.0 shipped"\n```\n\nKitman names the resource you type as Shepherd names it, lowercased, with each run of characters other than letters, digits, `.`, `_`, `:` and `-` made `-`: `release/0.14.0` is held as `release-0.14.0`, and `kitman claim list` shows it so. **Settings \u2192 Delivery and releases \u2192 Merge turns** holds and lets go of a repository branch\'s turn without typing the name, and the Code Mode MCP\'s `claims.hold`, `claims.release` and `changeRequests.mergeThrough` do the same.\n\nWhile a person holds the turn, a Shepherd that reaches an approved, green, mergeable ChangeRequest into that branch waits for the turn instead of merging, whether its Team is gated or in full auto. Its Run page says who holds the turn, since when and why. A Run already holding the turn when the hold is placed keeps it until it lets go, and nothing after it gets the turn. `kitman claim list` shows the hold as the person\'s, with why and how many Runs wait.\n\n`kitman cr merge-through` lets one ChangeRequest through: its Shepherd takes the turn, merges and lets go, while the turn stays held for every other Run. Letting the hold go with `kitman claim release` gives the turn to the oldest waiting Run, and the rest follow one at a time as each lets go. A turn kept by a Run whose program died holding it stays kept: once the hold is let go, each waiting Run is told who keeps it, and one that asked to take it over gets it. A Loop of your own is let through when its `claim` names `changeRequestId`, which must be the Run\'s input `changeRequestId`: Kitman refuses a claim for any other ChangeRequest, held or not. Holding, letting through and letting go are each audited with who did it. Kitman adds no freeze setting: a Team that wants a branch held when a prerelease is cut holds it from its own Loop or by hand.'
686
+ },
687
+ {
688
+ title: "Loop Operations Guide \u203A Backporting a merged change",
689
+ path: "loop-operations#backporting-a-merged-change",
690
+ level: 2,
691
+ link: "https://kitman.sh/knowledge/docs/loop-operations#backporting-a-merged-change",
692
+ text: "## Backporting a merged change\n\nThe software-engineering Kit's Backport Loop moves a merged ChangeRequest's change to another branch, such as a fix on the default branch that `release/1.x` needs too. From a checkout of the repository:\n\n```sh\nkitman run start backport !123 --input branch=release/1.x\n```\n\nThe Run starts from `release/1.x` and cherry-picks the change of `!123`. A change that applies cleanly starts no agent; one that conflicts has an agent settle the files. It verifies the result and opens a ChangeRequest into `release/1.x` that names the original and is linked to the original's Tasks. Shepherd then reviews and lands it like any other ChangeRequest: in a gated Team a person merges it, and in full auto Shepherd merges it once it is approved and green. When `release/1.x` already has the change, the Run ends as nothing to do. When the agent cannot settle a conflict, it ends as a conflict and opens nothing. A ChangeRequest that is not merged, or that a Revert took back out, is not backported.\n\nAfter each merge, Shepherd offers a Backport for each other live branch of the repository. A live branch is the target branch of an open Project or Milestone with your Team's Tasks in the repository, or a branch other than the default one that a Release was cut from since it last merged into the branch the change merged into. A merge into a Project's or Milestone's branch, or into a branch with an open ChangeRequest of its own, offers none: that branch's own merge does. Branches of private Projects and Teams you cannot see are left out. Each offer is an action on the Shepherd Run, **Backport to release/1.x**, and none starts unless you take it. To backport to a branch on every merge, set Shepherd's `backportTo` for your Team:\n\n```sh\nkitman loop input shepherd --team KIT 'backportTo=[\"release/1.x\"]'\n```\n\nShepherd then starts a Backport for each live branch the list names, and still offers the others. In a gated Team each one stops as ready once it is approved and green, so Shepherd does not wait for its merge, and a person merges it afterwards; when Shepherd was told to merge, it merges each backport too. A Backport's own Shepherd offers no more backports."
693
+ },
694
+ {
695
+ title: "Loop Operations Guide \u203A Reverting a merged change",
696
+ path: "loop-operations#reverting-a-merged-change",
697
+ level: 2,
698
+ link: "https://kitman.sh/knowledge/docs/loop-operations#reverting-a-merged-change",
699
+ text: `## Reverting a merged change
700
+
701
+ A branch is released as a whole, so one Task that turns out wrong holds back everything else on it. The Revert Loop takes that Task's merged ChangeRequest back out of the branch it merged into, without reverting by hand. Start it from a terminal in the repository, with the ChangeRequest's number and, after it, why:
702
+
703
+ \`\`\`sh
704
+ kitman run start revert !123 "it locks people out of sign-in"
705
+ \`\`\`
706
+
707
+ or with **Revert** beside a merged change under "Where it is" on the Task page, which asks why before it starts and is offered on a Task of the change's own Team. The Run starts from the branch the ChangeRequest merged into and works for no Task. A change already in a full version can still be reverted; the Run, its Questions and the revert's ChangeRequest say which version shipped it.
708
+
709
+ The Runner reverts the change as one commit. Where later changes conflict with it, the agent settles what it can and names the later ChangeRequests that changed those files; the Run then asks before it goes on, and with no default it waits for a person, in full auto too. Files the agent could not settle end the Run with the branch as it was, naming them, and it asks a person to revert by hand. Verified, the revert opens as a ChangeRequest titled \`Revert !123 <title>\`, which names the original but none of its Task keys, and Shepherd reviews and lands it. Merged later by a person instead, it counts the same.
710
+
711
+ Once it lands, each Task the original delivers moves back to its Team's first started state, with a note on the Task saying which ChangeRequest reverted it, why, and who asked. Its Milestone and Project are open again, so they record no \`release.due\` until they close again, and then release again: under the \`project-name\` Version Scheme, once the Project's close was released, as the next patch version. The original shows as taken out by a revert on the Task, and the Releases that contain it say it was reverted, and in which later Release.`
623
712
  },
624
713
  {
625
714
  title: "Loop Operations Guide \u203A Agents and effort",
626
715
  path: "loop-operations#agents-and-effort",
627
716
  level: 2,
628
717
  link: "https://kitman.sh/knowledge/docs/loop-operations#agents-and-effort",
629
- text: "## Agents and effort\n\nKitman ships the Agents `implementer`, `planned-implementer`, `reviewer`, `plan-reviewer`, `planner`, `releaser`, `investigator` and `judge`. The `reviewer` runs on Pi with GPT-6.2 Sol, then Claude Opus at `medium` effort; the `plan-reviewer` runs on the same, with Opus at `high` effort; the `planner` runs on Claude Fable 5.2 at `high` effort; and the `implementer` runs on Claude alone, waiting out a known quota reset rather than falling back to Pi. The `planned-implementer` extends `implementer` at `low` effort: Build runs it for the first implementation of a Task that plan review passed, and `implementer` at `medium` for everything else. The implementers and the others name no model, so a Step runs on whatever model the Runner's harness is logged in to. A Workspace or Team overrides one, such as its harness, model or effort, by declaring an Agent of the same id that extends it, in a Kit it deploys. Each declaration is a layer over the Agent it extends:\n\n```ts\nexport default defineKit({\n agents: {\n reviewer: {\n extends: 'reviewer',\n instructions: `## House rules\nNever approve a migration that edits a released one.`,\n effort: 'high'\n }\n }\n})\n```\n\nA declared Agent replaces only the fields it names. Its instructions merge by `## ` heading:\n\n- A section it names replaces the parent's section with that heading.\n- A new heading is appended.\n- Any text before its first heading replaces the parent's.\n\nAn Agent can list fallbacks for a Runner that does not offer its Harness:\n\n```ts\nexport default defineKit({\n agents: {\n reviewer: {\n extends: 'reviewer',\n harness: 'claude',\n effort: 'high',\n fallbacks: [\n { harness: 'codex', model: 'gpt-5.5' },\n { harness: 'pi', effort: 'medium' }\n ]\n }\n }\n})\n```\n\nA Step launches the first choice the claiming Runner offers, and the Run page's Step view shows the choices it skipped and why. A Step that ran on a later choice than its first is marked on the Run page and in `kitman run show` with the Harness and model it ran on and why its first choice was passed over. The mark follows the latest attempt whose Harness started, which its Runner shows by reporting what the Harness spent or its agent by submitting an Output. A claim alone does not move it: a retry on the first choice clears it once its Harness starts, and an attempt given back before its Harness started, one whose Harness failed to start, and a base sync the Runner found up to date ran no agent and are not marked. A fallback with no effort runs at the Agent's effort, and one with no model runs on the Harness's own model. An Agent that extends another inherits its fallbacks; naming `fallbacks` replaces them, and `fallbacks: []` clears them.\n\nEffort (`low`, `medium`, `high` or `xhigh`) is recorded on each StepAttempt. `kitman agent list --team <team>` shows each Agent merged as that Team's Runs resolve it, with the layer each field came from, so a Team Kit's override reads `claude (team)`. Without `--team` it uses the active Team, or only the workspace layer when there is none, and its first line says which."
718
+ text: "## Agents and effort\n\nKitman ships the Agents `implementer`, `planned-implementer`, `reviewer`, `plan-reviewer`, `planner`, `releaser`, `investigator` and `judge`. The `reviewer` runs on Pi with GPT-6.2 Sol, then Claude Opus at `medium` effort; the `plan-reviewer` runs on the same, with Opus at `high` effort; the `planner` runs on Claude Fable 5.2 at `high` effort; and the `implementer` runs on Claude alone, waiting out a known quota reset rather than falling back to Pi. The `planned-implementer` extends `implementer` at `low` effort: Build runs it for the first implementation of a Task that plan review passed, and `implementer` at `medium` for everything else. The implementers and the others name no model, so a Step runs on whatever model the Runner's harness is logged in to. A Workspace or Team overrides one, such as its harness, model or effort, by declaring an Agent of the same id that extends it, in a Kit it deploys. Each declaration is a layer over the Agent it extends:\n\n```ts\nimport { defineKit } from '@kitman-sh/sdk/loop'\n\nexport default defineKit({\n agents: {\n reviewer: {\n extends: 'reviewer',\n instructions: `## House rules\nNever approve a migration that edits a released one.`,\n effort: 'high'\n }\n }\n})\n```\n\nA declared Agent replaces only the fields it names. Its instructions merge by `## ` heading:\n\n- A section it names replaces the parent's section with that heading.\n- A new heading is appended.\n- Any text before its first heading replaces the parent's.\n\nAn Agent can list fallbacks for a Runner that does not offer its Harness:\n\n```ts\nimport { defineKit } from '@kitman-sh/sdk/loop'\n\nexport default defineKit({\n agents: {\n reviewer: {\n extends: 'reviewer',\n harness: 'claude',\n effort: 'high',\n fallbacks: [\n { harness: 'codex', model: 'gpt-5.5' },\n { harness: 'pi', effort: 'medium' }\n ]\n }\n }\n})\n```\n\nA Step launches the first choice the claiming Runner offers, and the Run page's Step view shows the choices it skipped and why. A Step that ran on a later choice than its first is marked on the Run page and in `kitman run show` with the Harness and model it ran on and why its first choice was passed over. The mark follows the latest attempt whose Harness started, which its Runner shows by reporting what the Harness spent or its agent by submitting an Output. A claim alone does not move it: a retry on the first choice clears it once its Harness starts, and an attempt given back before its Harness started, one whose Harness failed to start, and a base sync the Runner found up to date ran no agent and are not marked. A fallback with no effort runs at the Agent's effort, and one with no model runs on the Harness's own model. An Agent that extends another inherits its fallbacks; naming `fallbacks` replaces them, and `fallbacks: []` clears them.\n\nEffort (`low`, `medium`, `high` or `xhigh`) is recorded on each StepAttempt. `kitman agent list --team <team>` shows each Agent merged as that Team's Runs resolve it, with the layer each field came from, so a Team Kit's override reads `claude (team)`. Without `--team` it uses the active Team, or only the workspace layer when there is none, and its first line says which."
630
719
  },
631
720
  {
632
721
  title: "Projects and Saved Views",
@@ -655,14 +744,158 @@ Deleting a Milestone or a Project takes its Tasks out of it; the Tasks stay.`
655
744
  path: "projects-and-views#when-a-project-releases",
656
745
  level: 3,
657
746
  link: "https://kitman.sh/knowledge/docs/projects-and-views#when-a-project-releases",
658
- text: "### When a Project releases\n\nBy default Release runs after each merge. Under **Settings \u2192 Delivery and releases**, the Workspace sets when Release runs, and a Team can choose its own: on each merge, when a Milestone is done, or when the Project is done. A Project sets its own on its page, under **Release**, and otherwise inherits its Team's. A Shepherd or Release Run can still override it for itself, for example to release a hotfix on merge.\n\nName a Project by its version, such as `0.11.0`. When a Project releases per Milestone, the last Task of each Milestone to finish starts one Release: each Milestone before the last cuts the next release candidate (`0.11.0-rc.1`, `0.11.0-rc.2`, ...), and the Milestone that finishes the Project cuts `0.11.0`. When it releases per Project, one Release cuts `0.11.0` once all its Tasks are done. Canceled and duplicate Tasks do not hold a Milestone or Project open. Merges in between start no Release. A Project that releases on each merge, by its own setting or one it inherits, never cuts its version: each merge ships under the next version tag, and the Project's page says so under **Release**. The Release Run shows the Milestone or Project that started it and the Tasks it ships, and every Shepherd and Release Run shows the trigger it used and where that came from.\n\nFrom a terminal, `kitman release workspace|team <team>|project <project> [merge|milestone|project|inherit]` reads or sets it; Code Mode's `workspaces.releaseTrigger`, `teams.releaseTrigger` and `projects.releaseTrigger` do the same."
747
+ text: `### When a Project releases
748
+
749
+ By default Release runs after each merge. Under **Settings \u2192 Delivery and releases**, the Workspace sets when Release runs, and a Team can choose its own: on each merge, when a Milestone is done, when the Project is done, or only when a person, a Schedule or a Loop starts it. A Project sets its own on its page, under **Release**, and otherwise inherits its Team's. A Shepherd or Release Run can still override it for itself, for example to release a hotfix on merge.
750
+
751
+ When a Project releases per Milestone, the last Task of each Milestone to finish starts one Release, and the Milestone that finishes the Project starts the Release of its close. A Project with no Milestones releases once, when it is done. A Task in the Project and in no Milestone ships with the Release that finishes the Project. When it releases per Project, one Release runs once all its Tasks are done. Canceled and duplicate Tasks do not hold a Milestone or Project open. Merges in between start no Release. A Task in no Project has nothing to finish, so under either it releases on each merge, and its Run shows the trigger that was set, where that came from, and that it released on merge because its Task is in no Project. The Release Run shows the Milestone or Project that started it and the Tasks it ships, and every Shepherd and Release Run shows the trigger it used and where that came from.
752
+
753
+ The trigger says only when Release runs. The version comes from Release's Version Scheme, its \`scheme\` Input, which a Team sets as an [Input Default](/docs/loop-operations#input-defaults). Naming a Project by its version is one scheme among several:
754
+
755
+ - \`auto\`, the default, uses the Project's name when it starts with a version, such as \`0.11.0\` or \`0.11.0 - Loop stability\`, and semver from the repository's tags otherwise.
756
+ - \`project-name\` takes the version from the Project's name: each Milestone that does not finish the Project cuts the next release candidate (\`0.11.0-rc.1\`, \`0.11.0-rc.2\`, ...), and the Project's close cuts \`0.11.0\`. A Project whose name holds no version, or whose name the Release's readers may not see, gets its version from the tags instead.
757
+ - \`semver-tags\` cuts the next version from the repository's tags, whatever the Project is called, with release candidates only when a Team sets a \`prerelease\` such as \`rc\`.
758
+ - \`calver\` cuts a calendar version.
759
+
760
+ A Project that releases on each merge, by its own setting or one it inherits, never cuts a version of its own: each merge ships under the next version tag, and the Project's page says so under **Release**.
761
+
762
+ Each finished Milestone or Project records a \`release.due\` Event for each repository its Tasks ship in. It says what finished: the Project, the Milestone when one finished, \`closesProject\`, \`reopened\` when a revert reopened it after the Project's close was released, the repository and the Tasks it ships. It names no version. Release's \`milestone\` When Clause starts on a Milestone that does not finish its Project, and its \`project\` When Clause on the close, so each \`release.due\` starts one Release. A Team sets what each does with an Input Default for that When Clause, such as \`prerelease: rc\` for a Milestone.
763
+
764
+ To release on a calendar, from one branch into another, or when a person decides, choose **When a person, a Schedule or a Loop starts it** (\`manual\`). Then nothing releases by itself: merges, even of a Task in no Project, start no Release, and a finished Milestone or Project starts none either. A Release you start with \`kitman run start release\`, a Schedule bound to Release, or another Loop that calls Release still runs.
765
+
766
+ From a terminal, \`kitman release workspace|team <team>|project <project> [merge|milestone|project|manual|inherit]\` reads or sets it; Code Mode's \`workspaces.releaseTrigger\`, \`teams.releaseTrigger\` and \`projects.releaseTrigger\` do the same.`
767
+ },
768
+ {
769
+ title: "Projects and Saved Views \u203A Where a Project's work is, and Release now",
770
+ path: "projects-and-views#where-a-projects-work-is-and-release-now",
771
+ level: 3,
772
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#where-a-projects-work-is-and-release-now",
773
+ text: `### Where a Project's work is, and Release now
774
+
775
+ A Project's page, under **Release**, shows **Where its work is** for each repository its Tasks work in that you may read:
776
+
777
+ - the branch its Releases tag: its [target branch](#the-branch-a-projects-a-milestones-or-a-tasks-work-merges-into), else the default branch;
778
+ - the open ChangeRequest that delivers its target branch into the default branch, and whether it is level with it, behind it, in conflict with it, or not yet compared, as the forge's Events last told Kitman. Kitman reads no forge on a clock for this;
779
+ - its Tasks whose merges Kitman recorded on that branch, directly or through an epic's or a Milestone's branch delivered into it, that no full Release contains yet, with their ChangeRequests;
780
+ - its Releases: those that contain its Tasks' ChangeRequests or that its Release Runs cut, newest first, at most 20;
781
+ - its latest Release Run, whether it failed, and the tag it published;
782
+ - the Input Defaults the Project's close takes there, in the Team it would release in, for each of Release's When Clauses it starts, each with the layer it comes from.
783
+
784
+ A Project with no target branch shows the same on the default branch. A target branch that is the default branch needs nothing to deliver it. A repository you may not read is left out, with its branches and ChangeRequests, and so is a Task or ChangeRequest of a Team you may not see.
785
+
786
+ **Release now** starts a Release by hand, whatever the Project's release trigger and whether or not it is done. Pick what it acts as: **The Project's close**, which cuts the Project's version, or the next free patch once a full Release of it is out, or a Milestone's close, which cuts the next release candidate of it. The Run starts as the When Clause that such a close's \`release.due\` Event matches and its Team has on, of the Loop with the \`release\` role there, so it takes that clause's Input Defaults; where more than one applies, pick one. That Loop is Release, or a Loop of another id the Team deploys with the \`release\` role. When the close would start two such Loops, each with a When Clause the Team has on, Release now and the close itself start neither and name both, and the page names them under **Where its work is**: turn one's When Clause off for the Team, or remove it, to keep one. It ships the Tasks whose merges Kitman recorded on the branch it tags: a Task marked Done with nothing merged ships nothing. Before it starts, it shows, per repository, the tag it cuts, the branch it gates and tags and the one that delivers into, whether it merges a ChangeRequest first or tags what already merged, the Tasks it ships, the Deploy Target it deploys to, and where each Input field came from; **Start Release** starts exactly that plan, and refuses if anything in it changed since, so preview it again. When the latest Release of the same close in a repository published its tag and failed after it, as a failed deploy does, Release now deploys that tag again and cuts no second version; a Release that published nothing starts again. While a Release of it still runs, it starts none there. This is also how a Project that will never close gets its work out. A Release started by hand does not count as the close's own: when the Milestone or Project does close under its trigger, that still starts its Release.
787
+
788
+ From a terminal, \`kitman project show <project>\` shows the same, and \`kitman project release <project> [--milestone <milestone>] [--repository <repository>] [--when <clause>]\` shows what Release now would do; add \`--yes\` to start that plan. \`--json\` prints the data. Code Mode's \`projects.get\` gives the same per repository in \`repositories\`; \`projects.release\` with \`preview: true\` says what it would do and returns its \`plan\`, and called again with \`confirm\` set to that plan it starts it.
789
+
790
+ [Release Flows](/docs/release-flows) shows the common flows built from these settings, such as a release branch per Project or git-flow, and how to compose your own.`
791
+ },
792
+ {
793
+ title: "Projects and Saved Views \u203A Releasing a Project's repositories together",
794
+ path: "projects-and-views#releasing-a-projects-repositories-together",
795
+ level: 3,
796
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#releasing-a-projects-repositories-together",
797
+ text: "### Releasing a Project's repositories together\n\nA Project whose Tasks work in several repositories releases each one by itself: each repository gets its own Release, which gates, tags and deploys whatever the others do. To release them as one, set the Release set Loop's `together` Input Default on the Project:\n\n```sh\nkitman loop input release-set --project '0.15.0 - Release flows' together=true\n```\n\nThen, when a Milestone or the Project closes under its release trigger, Kitman records one `release.due` for all its repositories, in place of one each, and it starts Release set (`release-set`) instead of a Release per repository. Release set starts each repository's Release, which gates, cuts the version and drafts the notes, and tags nothing. Once every one has drafted, it asks one Question with every repository's notes; a full-auto Team is asked nothing. Only when every gate passed and the Question is approved does each Release go on to tag and deploy, one repository at a time, proving its revision again first. The set runs in a gated Team when any Team that shipped its work is gated, so that Team's repository still waits for a person. Each repository's Release takes the Project's Release Input Defaults, as it would alone. Set `order` to the repositories in the order they should tag and deploy, by name, such as `acme/api`, or by RepoBinding id: `kitman loop input release-set --project '0.15.0 - Release flows' 'order=[\"acme/api\",\"acme/web\"]'`. Those it leaves out follow in the order Kitman gives them. Set `together` on the Workspace to release every Project so; a Project's own `together=false` keeps it releasing per repository.\n\nWhat this promises: no repository is tagged while another repository's gate fails, nor before the one Question is approved. A rejected Question tags nothing anywhere.\n\nWhat it does not promise: tags across repositories are never atomic. Each repository tags and deploys in turn, so a failure after the first tag, such as the second repository's deploy failing, undoes nothing: the repositories before it stay released. Release set stops there and starts no later repository, and the Run says exactly which repositories tagged and deployed, which tagged and did not deploy, and which were not tagged. A Release that fails outright, rather than ending with a status, is shown as one that may have tagged, since it may have failed after its tag. Without `together`, each repository releases by itself, as before."
659
798
  },
660
799
  {
661
800
  title: "Projects and Saved Views \u203A Where a Project's work lands",
662
801
  path: "projects-and-views#where-a-projects-work-lands",
663
802
  level: 3,
664
803
  link: "https://kitman.sh/knowledge/docs/projects-and-views#where-a-projects-work-lands",
665
- text: "### Where a Project's work lands\n\nBy default every Task's ChangeRequest targets the repository's default branch. Under **Settings \u2192 Delivery and releases**, the Workspace sets where delivery lands, and a Team can choose its own; a Project sets its own on its page, under **Delivery**, and otherwise inherits its Team's. On an epic branch, each sub-task's Build branches from its epic's branch (`feature/KIT-1` by default) on a branch of its own (`feature/KIT-1-KIT-2`), its ChangeRequest targets the epic branch, and Shepherd merges it there and keeps the epic branch up to date with the default branch. Once every sub-task is done, the epic's ChangeRequest to the default branch opens, and Release runs only after it merges. A Build, Review, Shepherd or Release Run can override it for itself with `deliveryTarget: default_branch`, for example to ship a hotfix from a sub-task straight to the default branch. Every such Run shows where it landed and where that came from.\n\nFrom a terminal, `kitman land workspace|team <team>|project <project> [default|epic|inherit]` reads or sets it; Code Mode's `workspaces.deliveryTarget`, `teams.deliveryTarget` and `projects.deliveryTarget` do the same."
804
+ text: "### Where a Project's work lands\n\nBy default every Task's ChangeRequest targets the repository's default branch, or the target branch its Task, Milestone or Project names. Under **Settings \u2192 Delivery and releases**, the Workspace sets where delivery lands, and a Team can choose its own; a Project sets its own on its page, under **Delivery**, and otherwise inherits its Team's. On an epic branch, each sub-task's Build branches from its epic's branch (`feature/KIT-1` by default) on a branch of its own (`feature/KIT-1-KIT-2`), its ChangeRequest targets the epic branch, and Shepherd merges it there and keeps the epic branch up to date with the default branch. Once every sub-task is done, the epic's ChangeRequest to the default branch opens, and Release runs only after it merges. A Build, Review, Shepherd or Release Run can override it for itself with `deliveryTarget: default_branch`, for example to ship a hotfix from a sub-task straight to the default branch. Every such Run shows where it landed and where that came from.\n\nFrom a terminal, `kitman land workspace|team <team>|project <project> [default|epic|inherit]` reads or sets it; Code Mode's `workspaces.deliveryTarget`, `teams.deliveryTarget` and `projects.deliveryTarget` do the same."
805
+ },
806
+ {
807
+ title: "Projects and Saved Views \u203A The branch a Project's, a Milestone's or a Task's work merges into",
808
+ path: "projects-and-views#the-branch-a-projects-a-milestones-or-a-tasks-work-merges-into",
809
+ level: 3,
810
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#the-branch-a-projects-a-milestones-or-a-tasks-work-merges-into",
811
+ text: `### The branch a Project's, a Milestone's or a Task's work merges into
812
+
813
+ A Project can name a target branch, such as \`release/next\`, to keep its work off the default branch. It is one name, used in each repository the Project's Tasks work in. Set it on the Project's page under **Release**, or under **Settings \u2192 Delivery and releases**; leave it empty to merge into each repository's default branch.
814
+
815
+ Two finer layers sit under it, for a Team that branches per Milestone and for a fix that must go to a maintenance line:
816
+
817
+ - **A Milestone** can name its own, such as \`release/next-m1\`, while you edit it on its Project's page. Its Tasks that name none use it. It is made from, and delivers into, its Project's target branch, or the default branch when the Project names none.
818
+ - **A Task** can name its own, such as \`release/1.x\`, under **Target branch** in its properties. It builds against that branch whatever its Milestone and Project say, and a sub-task builds against it whatever its epic says too; an epic Task's own branch is the one its epic branch is made from and delivers into. It is a destination: Kitman delivers it nowhere further. When it is missing, Kitman makes it from the Milestone's or Project's branch, or from the default branch.
819
+
820
+ Each layer's branch is made from, and delivers into, the next layer's: a Milestone's into its Project's, and a Project's into the repository's default branch. A merge into any of a Task's layers lands the Task.
821
+
822
+ A Run starts from, and its ChangeRequest targets, the first branch named in this order:
823
+
824
+ 1. The Run's own \`branch\`, as a launch from a checkout gives it.
825
+ 2. The target of the ChangeRequest the Run continues or reads.
826
+ 3. Its epic's branch, when its Task lands on an epic branch and is a sub-task that names no target branch of its own, or the epic Task itself.
827
+ 4. The Task's own target branch.
828
+ 5. Its Milestone's target branch.
829
+ 6. Its Project's target branch.
830
+ 7. The repository's default branch.
831
+
832
+ Layers 4 to 6 do not apply when the Run's own delivery target is the default branch, as for a hotfix, or when the repository is a plain git remote, where Kitman cannot make branches.
833
+
834
+ When the target branch does not exist yet, Kitman makes it from the next layer's before the Run's first Step, making that one first when it is missing too. An epic branch is made from its epic Task's target branch. Shepherd merges each ChangeRequest into its own target, so a Build on a Milestone's Task opens its ChangeRequest against the Milestone's branch and Shepherd merges it there. Plan's integration branch starts from the target branch and delivers to it, in each repository its tickets work in. A Milestone's Release gates and tags the Milestone's branch when it names one; \`release.due\` carries it as \`branch\`, and the branch it delivers into as \`base\`. A Project's Release, including the one its last Milestone's close cuts, gates and tags the Project's branch. A Task whose own target branch is neither the branch a Release tags nor its Milestone's ships there, and is left out of that Release. When the last Milestone's Tasks in a repository all ship elsewhere, the Project's close still releases there from its earlier Milestones' work. Every Run's page, and \`kitman run show\`, names its base branch and which of these layers it came from.
835
+
836
+ A Run given a Milestone's or a Project's branch as its \`branch\` is told where that branch delivers, as the Input's \`deliversInto\`: a Milestone's branch into its Project's, and a Project's into the default branch. It is the field a landing Loop reads when it is given no \`target\`.
837
+
838
+ Setting or clearing a target branch, or moving a Task to another Milestone or Project, moves no open ChangeRequest and no merged work: only Runs that start after it take the new branch.
839
+
840
+ From a terminal, \`kitman release project <project> branch [<name>|none]\`, \`kitman release milestone <project> <milestone> branch [<name>|none]\` and \`kitman release task <task> branch [<name>|none]\` read, set or clear them. In Code Mode, \`projects.targetBranch\`, \`projects.milestoneTargetBranch\` and \`tasks.targetBranch\` do the same.`
841
+ },
842
+ {
843
+ title: "Projects and Saved Views \u203A What each Release contains",
844
+ path: "projects-and-views#what-each-release-contains",
845
+ level: 3,
846
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#what-each-release-contains",
847
+ text: "### What each Release contains\n\nKitman keeps a record of each Release of a repository: its tag, version, whether it is a prerelease, the commit it tags, the branch it was cut from, the previous full version, its notes and the Run that cut it. A Run's `release` Step leaves one for each tag it cuts; one a person or another tool publishes on GitHub or GitLab is recorded from the forge's webhook. A tag with a prerelease part, such as `1.3.0-rc.1`, is a prerelease, and GitHub's release is marked one too; GitLab has no prereleases. A release marked a prerelease on GitHub is one whatever its tag, and so is one a Run's `release` Step cuts as a prerelease, on GitLab too. A full version never starts after a release Kitman had already recorded as a prerelease. One Kitman has no record of, such as one published before the repository was connected, or records only after the version that follows it, still counts as the previous full version where its tag is a full version's. A prerelease may start after another with a full version's tag, as where every release is marked one, and then contains only what came after it.\n\nWhat a Release contains is read from the repository, never claimed: the ChangeRequests that merged as commits between the previous full version and its tag, by a merge commit, a squash or a rebase, and the Tasks linked to them. A ChangeRequest merged to a branch the tag does not reach is not in it. A prerelease also says what it adds to the previous prerelease of its version. Kitman reads this from the forge within a minute or two of the release, and until then shows it as not yet read; one the forge keeps refusing, or lists only some of the commits of, is shown as unreadable, with nothing in it. Each Release records a `release.published` Event once, with its repository as `owner/name`, tag, version, prerelease flag, revision, branch and previous tag, which a Loop's When Clause or `waitFor` can act on.\n\nFor GitLab, Kitman turns release events on in the project webhook it makes, including those it made before it kept Releases, through the connection that made the webhook. A GitHub App needs the **Release** event."
848
+ },
849
+ {
850
+ title: "Projects and Saved Views \u203A The Releases page",
851
+ path: "projects-and-views#the-releases-page",
852
+ level: 3,
853
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#the-releases-page",
854
+ text: `### The Releases page
855
+
856
+ **Releases** lists the repositories you may read; each has a page of its Releases, newest first, with **Show older Releases** below the first hundred. A prerelease is marked as one, and **Full versions only** leaves prereleases out. Each Release names its branch, revision and previous full version, and each Deploy Target it went to: since when the target runs it, or that its latest deploy of it failed or it no longer runs it. It opens to its ChangeRequests, their Tasks and its notes, with links to the Run that cut it and to its release on the forge.
857
+
858
+ **Merged, not released** lists the repository's default branch and each branch it has a Release from or merged ChangeRequests into, each with the newest Release cut from it and the merged ChangeRequests and Tasks no Release contains: what the next Release from there ships. A branch cut from another counts from its own Releases, not those of the branch it was cut from. It is read from Kitman's records of merges and Releases, not from the forge. A ChangeRequest merged before the repository's first recorded Release counts as released. So does one that merged before the branch's newest Release was published, while the forge has not said which commit the ChangeRequest merged as; and one that merged before a Release from the branch, or one its newest Release follows, was published where Kitman has not read that Release's contents. A full version Kitman never recorded counts the same, as published with the first Release that follows it. One that merged before such a Release from elsewhere, or before the repository's newest Release was published, while the forge has not said which commit it merged as, is still listed, and the branch says some may already be released. When a ChangeRequest merged is what its forge says, else when Kitman first saw it merged. Where the newest Release is in a Team you may not see, the branch says so without naming it.
859
+
860
+ **Compare** shows what one Release has that an earlier one lacks: the ChangeRequests and Tasks of the newer and the Releases it follows by previous full version, less those of the older. It opens on the newest Release and its previous full version; a link to a comparison keeps its Releases, however old. Where a Release between them is not read yet, or Kitman's records do not link the newer back to the older, it says some may be missing or extra.
861
+
862
+ From a terminal, \`kitman release list [<repository>] [--no-prereleases]\` lists them newest first with where each is deployed and what it contains, \`--after\` the older ones it names at the end, and with a repository, what each branch merged that no Release contains. \`kitman release show <tag>\`, or \`kitman release show <repository> <tag>\` where more than one repository has the tag, shows the same of one, and \`--since <tag>\` compares it with an earlier Release. \`--json\` prints the data the page reads. Code Mode's \`releases.list\`, \`releases.get\`, \`releases.unreleased\` and \`releases.compare\` read the same. A ChangeRequest, Task or repository you may not see is left out.`
863
+ },
864
+ {
865
+ title: "Projects and Saved Views \u203A Where a Task's change is",
866
+ path: "projects-and-views#where-a-tasks-change-is",
867
+ level: 3,
868
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#where-a-tasks-change-is",
869
+ text: `### Where a Task's change is
870
+
871
+ A Task's page, under **Where it is**, lists each of its merged ChangeRequests with its repository: the branch it merged into; the prereleases that contain it, named as prereleases; the first full version that contains it; and the [Deploy Targets](#what-each-deploy-target-runs) that run it. Each Release links to its page on the forge. A Task's row in a list, its board card, its row on its Project's page and its row among its parent's sub-tasks name the same for each change, with the repository and number when the Task has several.
872
+
873
+ - Until a full version contains a change, it says "merged to \`<branch>\`, not released", which on a Project's or Milestone's own branch may stay so for weeks.
874
+ - It says "release not known" while a full version published since it merged may contain it and Kitman cannot tell: that version is [not yet read or unreadable](#what-each-release-contains), or Kitman has no record of it and knows it only as what a later Release starts after, or the forge has not said which commit the change merged as.
875
+ - A change a revert took out says so. It does not count as released, whatever version contained it before, and no Release cut after the revert counts as containing it. A Deploy Target on an earlier Release that contains it still runs it, and says so.
876
+ - A Deploy Target runs a change when the tag it runs is a Release that contains it, or comes after one that does. Kitman follows each Release back to the version it starts after, so a target that runs the change may be left out: where Kitman has no record of one of those versions, or you may not see it; where it does not know what one of them, or the Release the target runs, starts after, because that one is not yet read or was left unreadable first; where the Release that brought the change is [not yet read or unreadable](#what-each-release-contains), even for a target on a later one; where the forge has not said which commit the change merged as; and where the target's tag is no Release.
877
+
878
+ Code Mode's \`teamTasks.get\` gives the same in \`delivery\`, each change's targets in \`deployTargets\`. Its \`status\` is \`unreleased\` while one change is in no full version, else \`unknown\` while Kitman cannot tell for one, \`released\` once every change still in is in one, and \`reverted\` once every one was taken out.`
879
+ },
880
+ {
881
+ title: "Projects and Saved Views \u203A What each Deploy Target runs",
882
+ path: "projects-and-views#what-each-deploy-target-runs",
883
+ level: 3,
884
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#what-each-deploy-target-runs",
885
+ text: "### What each Deploy Target runs\n\nA Deploy Target is where a repository's Releases go, such as `staging` or `production`. Using one needs no setup: Kitman knows it from the first deploy recorded against it. A Loop records a deploy with its `recordDeploy` Step, and CI does by posting a `deploy` Event with the `tag` and `status`, and a `target` unless it deployed to `production`.\n\nWhat a target runs is the tag its latest successful deploy or rollback left it on. A failed deploy is kept and changes nothing. A `deploy` Event with a status Kitman does not know, such as `running`, records no deploy. Until its first, a target runs nothing Kitman knows.\n\nUnder **Settings \u2192 Delivery and releases**, list a repository's Deploy Targets in the order its Releases reach them, such as staging then production. A deploy to a target the list leaves out still works.\n\nFrom a terminal, `kitman deploy-target list <repository>` shows them with what each runs, `kitman deploy-target set <repository> <target>...` sets the list (`none` clears it), and `kitman deploy-target history [<repository> [<target>]]` lists the deploys newest first. Code Mode's `deployTargets.get`, `deployTargets.set` and `deploys.list` do the same. A repository you may not see is left out."
886
+ },
887
+ {
888
+ title: "Projects and Saved Views \u203A The Deploy Targets page",
889
+ path: "projects-and-views#the-deploy-targets-page",
890
+ level: 3,
891
+ link: "https://kitman.sh/knowledge/docs/projects-and-views#the-deploy-targets-page",
892
+ text: `### The Deploy Targets page
893
+
894
+ A repository's Releases page links to its **Deploy Targets**, which shows each target in the repository's order, then any other a deploy named. Each says which Release it runs and since when. Below that are the Releases published since that one which have not reached it, newest first, each with its ChangeRequests and Tasks and what became of its latest deploy there, such as a failure. A target that runs nothing Kitman knows lists every Release. Only the newest 20 are shown, and the page says when there are more. Then come the target's deploys, newest first: each deploy, failure and rollback, with a link to the Run that recorded it.
895
+
896
+ **Deploy** on a waiting Release starts the Deploy Loop (\`deploy\`) for that tag and that target alone, never promoting through the targets before it, once you confirm, in the repository's Team, and is offered only where that Team has the Loop. The Loop's guard still asks before it takes away work the target runs that the tag lacks.
897
+
898
+ From a terminal, \`kitman release targets [<repository>]\` shows the same for one repository, or for each that has a Deploy Target. Each waiting Release comes with the \`kitman run start deploy\` command that deploys it in the repository's Team, or in the Workspace for a repository no Team holds. \`--json\` prints the data the page reads, for every repository you may see when none is named, those with no Deploy Target included. Code Mode's \`deployTargets.view\` reads the same.`
666
899
  },
667
900
  {
668
901
  title: "Projects and Saved Views \u203A Filtering and arranging Tasks",
@@ -671,9 +904,9 @@ Deleting a Milestone or a Project takes its Tasks out of it; the Tasks stay.`
671
904
  link: "https://kitman.sh/knowledge/docs/projects-and-views#filtering-and-arranging-tasks",
672
905
  text: `## Filtering and arranging Tasks
673
906
 
674
- Every list of Tasks has **Filter**, **Group by** and **Order by** controls. A filter matches all or any of its conditions, and each condition can be negated. Filter on Team, state, state category, assignee (someone, nobody or you), creator, priority, Labels, repository, Project, Milestone, parent, Task Type, text, created and updated dates, and Run status: has an active Run, its latest Run needs a person, or it has no Run.
907
+ Every list of Tasks has **Filter**, **Group by** and **Order by** controls. A filter matches all or any of its conditions, and each condition can be negated. Filter on Team, state, state category, assignee (someone, nobody or you), creator, priority, Labels, repository, Project, Milestone, parent, Task Type, text, created and updated dates, Run status: has an active Run, its latest Run needs a person, or it has no Run, and Release: merged but not released, merged with the release not known, released, or reverted, as [where a Task's change is](#where-a-tasks-change-is) describes.
675
908
 
676
- Group by state, Task Type, assignee, priority, repository, Project or Milestone, and order by your manual order, priority, creation, last update or key. **Triage** includes Triage Tasks, which are left out otherwise.
909
+ Group by state, Task Type, assignee, priority, repository, Project, Milestone or Release, and order by your manual order, priority, creation, last update or key. **Triage** includes Triage Tasks, which are left out otherwise.
677
910
 
678
911
  Switch between the list and board layouts. A board has a column per Workflow State: drag a card to another column, or use **Move to** on a card from the keyboard. Dragging within a column changes the manual order.`
679
912
  },
@@ -689,6 +922,366 @@ Switch between the list and board layouts. A board has a column per Workflow Sta
689
922
  Find saved views under **Work \u2192 Views**. Open one, change it, and **Update view**, or **Save as new view** to keep both.
690
923
 
691
924
  **My tasks** lists the Tasks assigned to you, created by you, and those you subscribe to.`
925
+ },
926
+ {
927
+ title: "Release Flows",
928
+ path: "release-flows",
929
+ level: 1,
930
+ link: "https://kitman.sh/knowledge/docs/release-flows",
931
+ text: "Common release flows built from Kitman's pieces, as settings and as Kit code, and how to compose your own.\n\nKitman picks no release flow for you. A Team composes its own from three settings and the Release Loop's Inputs:\n\n- **Where work merges**: the repository's default branch, or the [target branch](/docs/projects-and-views#the-branch-a-projects-a-milestones-or-a-tasks-work-merges-into) a Project, a Milestone or a Task names.\n- **When Release runs**: the [Release Trigger](/docs/projects-and-views#when-a-project-releases): on each merge (`merge`), when a Milestone is done (`milestone`), when the Project is done (`project`), or only when a person, a Schedule or a Loop starts it (`manual`). It holds no work back and picks no branch or version.\n- **What a Release does**: its Inputs, which a Workspace, Team or Project sets as [Input Defaults](/docs/loop-operations#input-defaults), for every Release or for one When Clause: `milestone` for a Milestone that does not finish its Project, `project` for the Project's close. The ones the flows below use are `scheme`, the Version Scheme (`auto`, `project-name`, `semver-tags` or `calver`); `bumpPolicy` (`outcome`, `conventional-commits`, `labels` or `fixed`); `prerelease`, such as `rc`; `land`, the branch to merge into before tagging; and `deploy` and `deployTarget`.\n\nEach flow below shows the settings first, then the Kit code that does the same. The trigger and target branches are settings in both: Kit code replaces the Input Defaults, with a fork of Release whose When Clauses carry `values`, a Layer, or a Schedule. A When Clause's `values` sit below every Input Default, so a Project's own default still wins. Deploy a Team's Kit with `kitman deploy --team <team>`: its Release replaces the Workspace's for that Team, and its Agents and every other Loop still come from the Workspace's Kits. `kitman loop show release` lists every Input with its description and default.\n\nTwo things hold in every flow:\n\n- **Several repositories.** Each repository releases by itself. A finished Milestone or Project records one `release.due` for each repository its Tasks are in, and each starts its own Release, which gates, versions and tags that repository alone. A version read from the Project's name is the same in each; one read from tags is each repository's own. Kitman has no release that spans repositories.\n- **A Project that gets a target branch after its work merged.** Nothing moves. Work already merged into the default branch stays there and ships with that branch's next Release, open ChangeRequests keep the target they have, and only Runs that start afterwards take the new branch."
932
+ },
933
+ {
934
+ title: "Release Flows \u203A Flow 0: Versioned Projects, release candidates per Milestone, on trunk",
935
+ path: "release-flows#flow-0-versioned-projects-release-candidates-per-milestone-on-trunk",
936
+ level: 2,
937
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-0-versioned-projects-release-candidates-per-milestone-on-trunk",
938
+ text: "## Flow 0: Versioned Projects, release candidates per Milestone, on trunk\n\nName each Project by its version and a title, such as `0.14.0 - Release flows`, and work on the default branch.\n\n**Settings.**\n\n```sh\nkitman release team KIT milestone\nkitman loop input release --team KIT --when milestone scheme=project-name\nkitman loop input release --team KIT --when project scheme=project-name\n```\n\nThe two Input Defaults are optional: `auto`, the default scheme, already reads the version from a Project named by one, and falls back to semver from tags for a Project that is not.\n\n**Kit code.** None: the shipped Kit does this as it is.\n\n**What ships when.** Each Milestone that does not finish the Project cuts the next release candidate, `0.14.0-rc.1`, then `0.14.0-rc.2`, from the head of the default branch, and the Milestone that finishes the Project cuts `0.14.0`. A Task in no Project releases on its merge, as the next version from the tags. Every Release tags the default branch, so it ships everything merged there so far, other Projects' work included: the trigger says when, not what. Hold a Project's work on its own branch, as in flow 1, when that matters.\n\n**A hotfix** is a Task in no Project: it releases on merge as the next version from the tags, a patch for a bug. A Release a person starts can also release on merge for itself with `releaseTrigger=merge`.\n\n**Several repositories.** Each repository the Milestone's Tasks are in cuts its own candidate of the same version from its own default branch, numbered from its own `-rc.N` tags."
939
+ },
940
+ {
941
+ title: "Release Flows \u203A Flow 1: A release branch per Project, with candidates",
942
+ path: "release-flows#flow-1-a-release-branch-per-project-with-candidates",
943
+ level: 2,
944
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-1-a-release-branch-per-project-with-candidates",
945
+ text: `## Flow 1: A release branch per Project, with candidates
946
+
947
+ Keep the Project's work on a branch of its own, cut candidates from it, and land it at the Project's close.
948
+
949
+ **Settings.**
950
+
951
+ \`\`\`sh
952
+ kitman release team KIT milestone
953
+ kitman release project 'Checkout redesign' branch release/checkout
954
+ kitman loop input release --project 'Checkout redesign' --when milestone prerelease=rc deploy=false
955
+ kitman loop input release --project 'Checkout redesign' --when project land=true
956
+ \`\`\`
957
+
958
+ To try each candidate on staging instead, set \`deployTarget=staging\` for the \`milestone\` clause in place of \`deploy=false\`.
959
+
960
+ **Kit code.** A fork of Release whose When Clauses carry the same values, deployed to the Team:
961
+
962
+ \`\`\`ts
963
+ import { loops } from '@kitman-sh/software-engineering'
964
+ import { defineKit, defineLoop } from '@kitman-sh/sdk/loop'
965
+
966
+ const release = defineLoop({
967
+ ...loops.release,
968
+ when: (loops.release.when ?? []).map(clause => {
969
+ if (clause.name === 'milestone') return { ...clause, values: { prerelease: 'rc', deploy: false } }
970
+
971
+ if (clause.name === 'project') return { ...clause, values: { land: true } }
972
+
973
+ return clause
974
+ })
975
+ })
976
+
977
+ export default defineKit({ loops: [release] })
978
+ \`\`\`
979
+
980
+ **What ships when.** Each Task's ChangeRequest targets \`release/checkout\`, and Shepherd merges it there. Each Milestone that does not finish the Project gates and tags the head of \`release/checkout\` as the next candidate, such as \`0.15.0-rc.1\` for a Project named \`0.15.0 - Checkout redesign\`, or the next version from the tags with \`-rc.N\` for one named otherwise, and deploys nothing. The Project's close gates the branch, asks once to release the notes, lands \`release/checkout\` into the default branch with the Land Loop, and tags that merge with the full version, which deploys to production. Nothing on the default branch ships the Project's work before that.
981
+
982
+ The shipped Kit keeps the branch's ChangeRequest open and mergeable: the first merge into \`release/checkout\` opens its ChangeRequest into the default branch, and when that ChangeRequest conflicts, Land merges the default branch in and settles it, held, so it merges only at the close. A conflict Land cannot settle reaches the Project lead's Inbox.
983
+
984
+ **A hotfix** is a Task in no Project: its ChangeRequest targets the default branch, and it releases on merge. Shepherd then offers a Backport to \`release/checkout\`, the open Project's target branch, so the Project ships the fix too; \`kitman loop input shepherd --team KIT 'backportTo=["release/checkout"]'\` backports there without asking.
985
+
986
+ **Several repositories.** The target branch is one name, used in each repository the Project's Tasks work in. Each repository's Milestone Release tags its own \`release/checkout\`, and the close lands and tags each repository's branch by itself.
987
+
988
+ **A Project that gets its branch late.** Work it merged into the default branch before \`release/checkout\` was set stays there and ships with the default branch's next Release, and its open ChangeRequests keep targeting the default branch. Only Builds that start afterwards work on \`release/checkout\`.`
989
+ },
990
+ {
991
+ title: "Release Flows \u203A Flow 2: git-flow",
992
+ path: "release-flows#flow-2-git-flow",
993
+ level: 2,
994
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-2-git-flow",
995
+ text: `## Flow 2: git-flow
996
+
997
+ Work merges into \`develop\`, releases land \`develop\` into \`main\`, and a hotfix goes to \`main\` first.
998
+
999
+ **Settings.** Make \`develop\` the repository's default branch in Kitman (**Default branch** when you connect it, or \`--default-branch develop\` with \`kitman repo add\`), then:
1000
+
1001
+ \`\`\`sh
1002
+ kitman release team KIT manual
1003
+ kitman run start release --input land=main
1004
+ \`\`\`
1005
+
1006
+ Start that Release by hand. A Schedule comes from a Kit, not from settings: to start it on a calendar, deploy the Schedule in the Kit code below, bound to Release with the Input \`{ "land": "main" }\`.
1007
+
1008
+ **Kit code.** A Team Kit's Schedule:
1009
+
1010
+ \`\`\`ts
1011
+ import { defineKit } from '@kitman-sh/sdk/loop'
1012
+
1013
+ export default defineKit({
1014
+ loops: [],
1015
+ schedules: {
1016
+ 'weekly-release': {
1017
+ name: 'Weekly release',
1018
+ loop: 'release',
1019
+ input: { land: 'main' },
1020
+ rule: { frequency: 'weekly', daysOfWeek: [1], hour: 10, minute: 0 },
1021
+ timezone: 'Europe/Copenhagen'
1022
+ }
1023
+ }
1024
+ })
1025
+ \`\`\`
1026
+
1027
+ **What ships when.** Merges into \`develop\` start no Release. A Release gates the head of \`develop\`, reads the previous version on \`main\`, asks once, lands \`develop\` into \`main\`, with a merge commit where the forge allows one, and tags what landed.
1028
+
1029
+ **A hotfix** is a Task whose own target branch is \`main\`: \`kitman release task KIT-12 branch main\`. Its Build starts from \`main\`, and its ChangeRequest merges there. Release it with \`kitman run start release --input branch=main\`, which tags the head of \`main\`, then apply it to \`develop\` with \`kitman run start backport !123 --input branch=develop\`. Shepherd does not offer that Backport itself, because \`develop\` is the default branch.
1030
+
1031
+ **Several repositories.** Each is released by its own start: a Release started without \`repoBindingId\` releases its Task's repository, else its Team's default one, so give each repository a Schedule of its own with its \`repoBindingId\` in the Input.`
1032
+ },
1033
+ {
1034
+ title: "Release Flows \u203A Flow 3: Trunk, releasing per Milestone",
1035
+ path: "release-flows#flow-3-trunk-releasing-per-milestone",
1036
+ level: 2,
1037
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-3-trunk-releasing-per-milestone",
1038
+ text: `## Flow 3: Trunk, releasing per Milestone
1039
+
1040
+ Work on the default branch, release when a Milestone is done, and take versions from tags whatever a Project is called.
1041
+
1042
+ **Settings.**
1043
+
1044
+ \`\`\`sh
1045
+ kitman release team KIT milestone
1046
+ kitman loop input release --team KIT scheme=semver-tags
1047
+ \`\`\`
1048
+
1049
+ Add \`--when milestone prerelease=rc\` for a candidate per Milestone and a full version at the Project's close.
1050
+
1051
+ **Kit code.**
1052
+
1053
+ \`\`\`ts
1054
+ import { loops } from '@kitman-sh/software-engineering'
1055
+ import { defineKit, defineLoop } from '@kitman-sh/sdk/loop'
1056
+
1057
+ const release = defineLoop({
1058
+ ...loops.release,
1059
+ when: (loops.release.when ?? []).map(clause =>
1060
+ clause.event === 'release.due' ? { ...clause, values: { scheme: 'semver-tags' } } : clause
1061
+ )
1062
+ })
1063
+
1064
+ export default defineKit({ loops: [release] })
1065
+ \`\`\`
1066
+
1067
+ **What ships when.** Each finished Milestone tags the head of the default branch with the next version the tags give, bumped by the Bump Policy (\`outcome\` by default: minor when a Task is a feature, else patch). A Project with no Milestones releases once, at its close. A Task in no Project releases on merge. As in flow 0, each Release ships everything merged to the default branch so far.
1068
+
1069
+ **A hotfix** is a Task in no Project, released on merge, or any Release a person starts with \`releaseTrigger=merge\`.
1070
+
1071
+ **Several repositories.** Each repository the Milestone's Tasks are in takes the next version of its own tags, so their numbers differ.`
1072
+ },
1073
+ {
1074
+ title: "Release Flows \u203A Flow 4: Continuous delivery",
1075
+ path: "release-flows#flow-4-continuous-delivery",
1076
+ level: 2,
1077
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-4-continuous-delivery",
1078
+ text: `## Flow 4: Continuous delivery
1079
+
1080
+ Every merge releases and deploys.
1081
+
1082
+ **Settings.**
1083
+
1084
+ \`\`\`sh
1085
+ kitman release team KIT merge
1086
+ kitman loop input release --team KIT scheme=semver-tags bumpPolicy=conventional-commits
1087
+ \`\`\`
1088
+
1089
+ \`bumpPolicy=outcome\`, the default, bumps by each Task's Outcome instead of the commit messages.
1090
+
1091
+ **Kit code.** A fork that provides the shipped scheme and policy under the names Release uses when no Input names one:
1092
+
1093
+ \`\`\`ts
1094
+ import { loops } from '@kitman-sh/software-engineering'
1095
+ import {
1096
+ bumpPolicy,
1097
+ bumpPolicyLayer,
1098
+ defineKit,
1099
+ defineLoop,
1100
+ versionScheme,
1101
+ versionSchemeLayer
1102
+ } from '@kitman-sh/sdk/loop'
1103
+
1104
+ const release = defineLoop({
1105
+ ...loops.release,
1106
+ provide: [
1107
+ versionSchemeLayer({ ...versionScheme('semver-tags'), name: 'auto' }),
1108
+ bumpPolicyLayer({ ...bumpPolicy('conventional-commits'), name: 'outcome' })
1109
+ ]
1110
+ })
1111
+
1112
+ export default defineKit({ loops: [release] })
1113
+ \`\`\`
1114
+
1115
+ **What ships when.** After each merge Shepherd starts Release, which tags the next version, \`feat\` a minor, \`fix\` a patch and \`!\` or \`BREAKING CHANGE\` a major, and deploys it to production. A gated Team approves each Release's notes; a full-auto Team does not.
1116
+
1117
+ **A hotfix** is any other merge.
1118
+
1119
+ **Several repositories.** Each merge releases the repository it merged in, with that repository's next version.`
1120
+ },
1121
+ {
1122
+ title: "Release Flows \u203A Flow 5: Calendar releases",
1123
+ path: "release-flows#flow-5-calendar-releases",
1124
+ level: 2,
1125
+ link: "https://kitman.sh/knowledge/docs/release-flows#flow-5-calendar-releases",
1126
+ text: `## Flow 5: Calendar releases
1127
+
1128
+ Release on a calendar, with a CalVer version such as \`2026.11.0\`.
1129
+
1130
+ **Settings.**
1131
+
1132
+ \`\`\`sh
1133
+ kitman release team KIT manual
1134
+ kitman loop input release --team KIT scheme=calver calverFormat=YYYY.0M.MICRO
1135
+ \`\`\`
1136
+
1137
+ A Schedule comes from a Kit, not from settings, so deploy one bound to Release, such as the every-Monday-at-10:00 Schedule in the Kit code below. Its Runs take the Team's Input Defaults.
1138
+
1139
+ **Kit code.** A fork whose default scheme is CalVer, and the Schedule from flow 2 with no Input:
1140
+
1141
+ \`\`\`ts
1142
+ import { loops } from '@kitman-sh/software-engineering'
1143
+ import { defineKit, defineLoop, versionScheme, versionSchemeLayer } from '@kitman-sh/sdk/loop'
1144
+
1145
+ const release = defineLoop({
1146
+ ...loops.release,
1147
+ provide: versionSchemeLayer({ ...versionScheme('calver', { calverFormat: 'YYYY.0M.MICRO' }), name: 'auto' })
1148
+ })
1149
+
1150
+ export default defineKit({
1151
+ loops: [release],
1152
+ schedules: {
1153
+ 'weekly-release': {
1154
+ name: 'Weekly release',
1155
+ loop: 'release',
1156
+ input: {},
1157
+ rule: { frequency: 'weekly', daysOfWeek: [1], hour: 10, minute: 0 },
1158
+ timezone: 'Europe/Copenhagen'
1159
+ }
1160
+ }
1161
+ })
1162
+ \`\`\`
1163
+
1164
+ **What ships when.** Merges start no Release. Each scheduled Release tags the head of the default branch with the period's next version: \`2026.11.0\`, then \`2026.11.1\`, then \`2026.12.0\` in a new month. A Schedule's run when nothing merged since the last tag ends \`nothing_to_release\`.
1165
+
1166
+ **A hotfix** is a Release a person starts with \`kitman run start release\`, which cuts the period's next version.
1167
+
1168
+ **Several repositories.** Give each repository a Schedule of its own with its \`repoBindingId\`, as in flow 2; each counts MICRO from its own tags.`
1169
+ },
1170
+ {
1171
+ title: "Release Flows \u203A What protects production",
1172
+ path: "release-flows#what-protects-production",
1173
+ level: 2,
1174
+ link: "https://kitman.sh/knowledge/docs/release-flows#what-protects-production",
1175
+ text: "## What protects production\n\nA deploy that would take live work away asks first. Before each deploy the Deploy Loop compares what the Deploy Target runs with the tag. When the target runs ChangeRequests the tag lacks, a Question lists them and their Tasks and asks whether to deploy over them. It recommends not to, takes that answer when nobody answers within a day, and has no full-auto answer, so a full-auto Team's unattended Release deploys nothing. A tag that holds everything the target runs deploys with no Question.\n\nThat is a rule about what the tag holds, not what it is called, and it covers both ways a side branch can hurt:\n\n- **A tag cut from a side branch.** Production runs `0.14.2` from the default branch. A candidate `0.15.0-rc.1` cut from `release/checkout` lacks the hotfixes merged to the default branch since the branch was made, so deploying it to production asks first, naming them.\n- **A later Release of the base branch.** Production runs that candidate. The next `0.14.3` from the default branch lacks the Project's work, so deploying it asks first too, rather than quietly removing it.\n\nThis is why flow 1 cuts candidates with `deploy: false` or a staging Deploy Target. A Deploy started with the Deploy Loop's `rollback: true` Input skips the Question, since taking work away is what it is for."
1176
+ },
1177
+ {
1178
+ title: "Release Flows \u203A Composing your own",
1179
+ path: "release-flows#composing-your-own",
1180
+ level: 2,
1181
+ link: "https://kitman.sh/knowledge/docs/release-flows#composing-your-own",
1182
+ text: "## Composing your own\n\nA flow is just code, so a Team's own needs no change to Kitman. Reach for the smallest piece that does it:\n\n1. **A setting**: the Release Trigger and the target branches.\n2. **An Input Default**: what each Release does, for every Run or for one When Clause.\n3. **A Layer**: a Version Scheme, a Bump Policy or one Step of Release, replaced in a fork that keeps the rest.\n4. **A Loop of your own**: Release's Steps in another order, or with a Step of yours between two of them.\n\nThe examples below import from `@kitman-sh/software-engineering`, which exports its Loops as `loops`, the Steps they are built of as `steps`, and what Release's Steps end in, such as `Cut` and `VersionTaken`."
1183
+ },
1184
+ {
1185
+ title: "Release Flows \u203A A Version Scheme of your own",
1186
+ path: "release-flows#a-version-scheme-of-your-own",
1187
+ level: 3,
1188
+ link: "https://kitman.sh/knowledge/docs/release-flows#a-version-scheme-of-your-own",
1189
+ text: `### A Version Scheme of your own
1190
+
1191
+ A scheme gives the previous tag and the next one for each bump. This one reads semver from the tags but stays on \`0.x\`, so a breaking change bumps the minor:
1192
+
1193
+ \`\`\`ts
1194
+ import * as Effect from 'effect/Effect'
1195
+ import { loops } from '@kitman-sh/software-engineering'
1196
+ import { defineLoop, semverTags, versionSchemeLayer, type VersionSchemeService } from '@kitman-sh/sdk/loop'
1197
+
1198
+ const zeroVer: VersionSchemeService = {
1199
+ name: 'zerover',
1200
+ versions: request =>
1201
+ Effect.map(semverTags.versions(request), read =>
1202
+ read?.next.minor === undefined ? read : { ...read, next: { ...read.next, major: read.next.minor } }
1203
+ )
1204
+ }
1205
+
1206
+ export const release = defineLoop({ ...loops.release, provide: versionSchemeLayer(zeroVer) })
1207
+ \`\`\`
1208
+
1209
+ Name it in the Input, \`kitman loop input release --team KIT scheme=zerover\`. A scheme under a shipped name, such as \`auto\`, replaces that one, as flows 4 and 5 do. A Bump Policy of your own is the same with \`bumpPolicyLayer\`, named in \`bumpPolicy\`.`
1210
+ },
1211
+ {
1212
+ title: "Release Flows \u203A A fork that replaces one Step",
1213
+ path: "release-flows#a-fork-that-replaces-one-step",
1214
+ level: 3,
1215
+ link: "https://kitman.sh/knowledge/docs/release-flows#a-fork-that-replaces-one-step",
1216
+ text: "### A fork that replaces one Step\n\nEach of Release's Steps, `gate`, `cut`, `notes`, `approve`, `land`, `publish` and `deploy`, is replaced by a Layer of the same payload, result and error. This fork's `cut` asks the repository's own approved `next-version` command for the tag, and keeps every other Step:\n\n```ts\nimport * as Effect from 'effect/Effect'\nimport { Cut, loops, steps, VersionTaken } from '@kitman-sh/software-engineering'\nimport { command, compare, defineLoop, versions } from '@kitman-sh/sdk/loop'\n\nconst cutFromScript = ({ input, revision }: typeof steps.cut.payloadSchema.Type) =>\n Effect.gen(function* () {\n const previousTag = (yield* versions('tags', { revision })).previous?.tag ?? null\n const asked = yield* command('next-version', { run: 'next-version', args: [previousTag ?? 'none'], revision })\n const tag = input.tag ?? (asked.status === 'exited' && asked.exitCode === 0 ? asked.lastLine.trim() : '')\n\n if (tag === '') return yield* new VersionTaken({ reason: 'next-version gave no version' })\n\n const contents =\n previousTag === null ? undefined : (yield* compare('contents', { base: previousTag, head: revision })).ahead\n\n return new Cut({\n tag,\n previousTag,\n changeRequests: contents?.changeRequests ?? [],\n unlinked: contents?.unlinked ?? 0\n })\n })\n\nexport const release = defineLoop({\n ...loops.release,\n capabilities: [...loops.release.capabilities, 'run_command'],\n provide: steps.cut.layer(cutFromScript)\n})\n```\n\nThe fork adds `run_command`, since its `cut` runs a command the shipped one does not, and the repository approves `next-version` as a command. Release still holds the repository's release claim around `cut`, so two Releases never pick a version at once."
1217
+ },
1218
+ {
1219
+ title: "Release Flows \u203A A Loop of your own",
1220
+ path: "release-flows#a-loop-of-your-own",
1221
+ level: 3,
1222
+ link: "https://kitman.sh/knowledge/docs/release-flows#a-loop-of-your-own",
1223
+ text: `### A Loop of your own
1224
+
1225
+ A Loop can call Release's Steps itself, with one of its own between two of them. This one smoke-tests the gated revision after the notes are approved and before anything is tagged:
1226
+
1227
+ \`\`\`ts
1228
+ import * as Effect from 'effect/Effect'
1229
+ import * as Schema from 'effect/Schema'
1230
+ import { loops, steps } from '@kitman-sh/software-engineering'
1231
+ import { claim, command, defineLoop, runContext } from '@kitman-sh/sdk/loop'
1232
+
1233
+ export const smokeTestedRelease = defineLoop({
1234
+ id: 'smoke-tested-release',
1235
+ version: '1.0.0',
1236
+ title: 'Smoke-tested release',
1237
+ input: loops.release.input,
1238
+ output: Schema.Struct({ status: Schema.String, tag: Schema.optional(Schema.String) }),
1239
+ agents: { releaser: 'releaser' },
1240
+ checkout: 'read',
1241
+ capabilities: [...loops.release.capabilities, 'run_command'],
1242
+ run: input =>
1243
+ Effect.gen(function* () {
1244
+ const { revision } = yield* steps.gate(input.revision === undefined ? {} : { revision: input.revision })
1245
+ const { repository } = yield* runContext
1246
+
1247
+ // One Release of a repository picks a version at a time, as the shipped Release holds it.
1248
+ yield* claim('repository', { resource: \`release:\${repository?.repoBinding.id}\`, keep: 'run' })
1249
+
1250
+ const cut = yield* steps.cut({ input, revision })
1251
+ let drafted = yield* steps.notes({ cut, revision })
1252
+ let answer = yield* steps.approve({ tag: cut.tag, notes: drafted.notes, head: revision })
1253
+
1254
+ while (answer._tag === 'Edit') {
1255
+ drafted = yield* steps.notes({ cut, revision, redraft: { drafted, edit: answer.edit } })
1256
+ answer = yield* steps.approve({ tag: cut.tag, notes: drafted.notes, head: revision })
1257
+ }
1258
+
1259
+ const smoke = yield* command('smoke', { run: 'smoke', args: [cut.tag], revision })
1260
+
1261
+ if (smoke.status !== 'exited' || smoke.exitCode !== 0) return { status: 'smoke_failed', tag: cut.tag }
1262
+
1263
+ const published = yield* steps.publish({
1264
+ tag: cut.tag,
1265
+ revision,
1266
+ title: drafted.title,
1267
+ notes: drafted.notes,
1268
+ previousTag: cut.previousTag
1269
+ })
1270
+
1271
+ return { status: 'published', tag: published.tag }
1272
+ }).pipe(
1273
+ Effect.catchTags({
1274
+ GateFailed: () => Effect.succeed({ status: 'gate_failed' }),
1275
+ NothingToRelease: () => Effect.succeed({ status: 'nothing_to_release' }),
1276
+ VersionTaken: () => Effect.succeed({ status: 'version_taken' }),
1277
+ Rejected: () => Effect.succeed({ status: 'rejected' }),
1278
+ TagTaken: () => Effect.succeed({ status: 'tag_taken' })
1279
+ })
1280
+ )
1281
+ })
1282
+ \`\`\`
1283
+
1284
+ A Loop of your own starts only as you start it: by hand, from a Schedule, from its own When Clauses, or from another Loop. Shepherd's Release after a merge and the \`release.due\` starts stay the shipped Release's, or your fork's. Test each with \`testLoop\` before you deploy it.`
692
1285
  },
693
1286
  {
694
1287
  title: "Runner Operations Guide",
@@ -912,9 +1505,28 @@ A Task is a piece of work. Kitman is where Tasks live: people create, shape and
912
1505
 
913
1506
  Each Team has its own ordered Workflow States, each in one of these categories: triage, backlog, unstarted, started, completed, canceled and duplicate. A new Team starts with Triage, Backlog, Todo, Ready for agents, In Progress, In Review, Blocked, Done, Canceled and Duplicate, and new Tasks land in Backlog.
914
1507
 
915
- In the Team's settings, the **Workflow** tab adds, renames, recolours, reorders and removes states. Removing a state asks where its Tasks go. The same tab picks the default state for new Tasks, the states agents pick work up from (see [Handing work to agents](/docs/handing-work-to-agents)), and where milestones move Tasks: a Run starting, finishing, failing or being blocked, and a ChangeRequest opening or merging. A Task in Done, Canceled or Duplicate is never moved back by a milestone.
1508
+ In the Team's settings, the **Workflow** tab adds, renames, recolours, reorders and removes states. Removing a state asks where its Tasks go. The same tab picks the default state for new Tasks, the states agents pick work up from (see [Handing work to agents](/docs/handing-work-to-agents)), and where milestones move Tasks: a Run starting, finishing, failing or being blocked, a ChangeRequest opening or merging, and a full Release containing the Task's changes. A milestone set to nothing moves nothing. A Task in a completed, canceled or duplicate state is never moved by a milestone, except that \`released\` moves a completed Task to another completed state.
916
1509
 
917
1510
  A Team view has three tabs: Active shows unstarted and started Tasks, Backlog the backlog, and All every Task outside Triage, including completed and canceled ones.`
1511
+ },
1512
+ {
1513
+ title: "Tasks Guide \u203A When a change is released",
1514
+ path: "task-composition#when-a-change-is-released",
1515
+ level: 3,
1516
+ link: "https://kitman.sh/knowledge/docs/task-composition#when-a-change-is-released",
1517
+ text: `### When a change is released
1518
+
1519
+ A merged change is not yet released. The \`released\` milestone tells the two apart: Kitman applies it when it has read what a full [Release](/docs/projects-and-views#what-each-release-contains) contains and every merged ChangeRequest of the Task is in a full Release of its repository, leaving out those a revert took out. A Task with ChangeRequests in two repositories gets it once both are released. A commit or link Kitman learns of after the Release counts too. It applies once per Task and Release, and the Task's timeline names the Release that moved it to anyone who may see that Release.
1520
+
1521
+ A prerelease gives no \`released\`, and neither does a Release Kitman could not read. A tag published outside a Run, or read before its Run recorded it, is a prerelease when the code host or the tag's version says so; one Kitman took for a full Release has already moved its Tasks.
1522
+
1523
+ A ChangeRequest merged into another branch, such as an epic branch, is in a Release once that branch is merged with a merge commit. A squash or rebase gives its commits new ids, so the ChangeRequests merged into the branch are in no Release and their Tasks do not get \`released\`. Unlink one from a Task it holds back.
1524
+
1525
+ The default workflow maps \`released\` to nothing. To use it, add a state such as Released in the completed category and choose it for **A full Release contains its changes**.
1526
+
1527
+ Keep the states of both \`merged\` and \`released\` in the completed category. A Milestone or Project closes when its Tasks are in a completed state. If \`merged\` moves a Task to a started state and \`released\` to the done one, a Milestone or Project that [releases when it is done](/docs/projects-and-views) never closes: its Release waits for the close, and the close waits for the Release.
1528
+
1529
+ From a terminal, \`kitman team milestones <team>\` lists the mapping, and \`kitman team milestones <team> released <state>|none\` sets or clears it. In Code Mode, \`teams.get\` reads it as \`milestoneMapping\` and \`teams.setMilestoneMapping\` replaces the whole mapping.`
918
1530
  },
919
1531
  {
920
1532
  title: "Tasks Guide \u203A Creating and editing Tasks",
@@ -933,7 +1545,7 @@ Change a Task's state, priority, assignee, Labels, repository and Task Type from
933
1545
 
934
1546
  Select several Tasks to change their state, priority, Task Type, assignee, Labels, repository or Team in one action.
935
1547
 
936
- The timeline shows comments, every change and Run milestones together, each saying who made it: a person, a Triage Rule, triage duty or a Run. Mention a colleague in a comment or description to tell them.`
1548
+ The timeline shows comments, every change and Run milestones together, each saying who made it: a person, a Triage Rule, triage duty or a Run. A move a ChangeRequest or Release caused says so. Mention a colleague in a comment or description to tell them.`
937
1549
  },
938
1550
  {
939
1551
  title: "Tasks Guide \u203A Repositories",
@@ -1220,6 +1832,11 @@ export type LoopOutcome = typeof LoopOutcome.Type
1220
1832
  * such Run gets, so the Kit that declares the Loop for a Team sets them for that Team.
1221
1833
  */
1222
1834
  export type WhenClause = {
1835
+ /**
1836
+ * Kebab-case and unique in its Loop, such as \`milestone-done\`; settings for this clause name it. Left out, it is the
1837
+ * Event type in kebab-case, which a Loop with two clauses of one Event type must not leave to both.
1838
+ */
1839
+ readonly name?: string
1223
1840
  readonly event: string
1224
1841
  readonly filter?: EventFilter
1225
1842
  readonly input: { readonly [inputField: string]: string }
@@ -1247,23 +1864,9 @@ export type WhenClause = {
1247
1864
  /** The services a Loop's program runs with; a Runner or \`testLoop\` provides them. */
1248
1865
  export type LoopServices =
1249
1866
  | LoopRun
1867
+ | LoopRunContext
1250
1868
  | LoopHost
1251
- | ChangeRequestActivity
1252
- | WriteBackActivity
1253
- | ArtifactActivity
1254
- | FileActivity
1255
- | NoteActivity
1256
- | CommentActivity
1257
- | CreateTasksActivity
1258
- | AlertTaskActivity
1259
- | IntegrationBranchActivity
1260
- | MergeChangeRequestActivity
1261
- | ReleaseActivity
1262
- | TranscriptsActivity
1263
- | ChangeRequestReadActivity
1264
- | ProposeActivity
1265
- | ProjectActivityActivity
1266
- | DraftUpdateActivity
1869
+ | HostStepServices<KitmanHostStep>
1267
1870
  | WorkflowEngine.WorkflowEngine
1268
1871
  | WorkflowEngine.WorkflowInstance
1269
1872
  \`\`\``
@@ -1293,11 +1896,12 @@ export type LoopDefinition<In, Out, E> = {
1293
1896
  readonly outcome?: LoopOutcome
1294
1897
  /**
1295
1898
  * The role it plays, whose powers the control plane gives any Loop that declares it: \`review\` approves a
1296
- * ChangeRequest's head, is reused and covers a fix, as Kitman's Review does. Its Input and Output carry the role's
1297
- * fields, \`ReviewRoleInput\` and \`ReviewRoleOutput\`.
1899
+ * ChangeRequest's head, is reused and covers a fix, as Kitman's Review does; \`release\` delivers a Project, as
1900
+ * Kitman's Release does. Its Input and Output carry the role's fields, such as \`ReviewRoleInput\` and
1901
+ * \`ReviewRoleOutput\`.
1298
1902
  */
1299
1903
  readonly role?: LoopRole
1300
- /** Agent ids by role; \`agentWork\` names a role. */
1904
+ /** Agent ids by the Loop's own name for each, which \`agent\` takes. */
1301
1905
  readonly agents: { readonly [role: string]: string }
1302
1906
  readonly checkout: LoopCheckout
1303
1907
  readonly when?: readonly WhenClause[]
@@ -1308,7 +1912,9 @@ export type LoopDefinition<In, Out, E> = {
1308
1912
  * declares their capabilities, and \`call\`, besides the Loop's own.
1309
1913
  */
1310
1914
  readonly calls?: () => readonly CalledLoop[]
1311
- /** The Secrets the program reads with \`Config.Redacted\`, and \`agentWork\` may put into a Step's sandbox. */
1915
+ /** What it grants the Loops it calls by id, which \`calls\` cannot name; not counted as its own. */
1916
+ readonly lends?: readonly LoopCapability[]
1917
+ /** The Secrets the program reads with \`Config.Redacted\`, and an agent Step may put into a Step's sandbox. */
1312
1918
  readonly secrets?: readonly string[]
1313
1919
  /**
1314
1920
  * The hosts the program calls besides Kitman, or \`open\` for any; a shared Runner refuses the rest. An \`open\` Loop
@@ -1318,6 +1924,8 @@ export type LoopDefinition<In, Out, E> = {
1318
1924
  /** A Schedule a Workspace can turn on in one click; off until someone does. */
1319
1925
  readonly schedule?: { readonly rule: ScheduleRule; readonly timezone: string }
1320
1926
  readonly run: (input: In) => Effect.Effect<Out, E, LoopServices>
1927
+ /** Replaces defined Steps wherever \`run\` calls them, as \`green.layer(run)\` gives; a fork keeps the rest. */
1928
+ readonly provide?: Layer.Layer<never> | readonly Layer.Layer<never>[]
1321
1929
  /** Scripts a build runs twice, the second time from the journal; not part of the manifest. */
1322
1930
  readonly checks?: readonly LoopCheck[]
1323
1931
  }
@@ -1328,7 +1936,14 @@ export type LoopDefinition<In, Out, E> = {
1328
1936
  title: "@kitman-sh/sdk/loop \u203A CalledLoop",
1329
1937
  level: 2,
1330
1938
  link: "https://cdn.jsdelivr.net/npm/@kitman-sh/sdk/types/packages/sdk/src/loop/define.d.ts",
1331
- text: "```ts\n/** What a parent needs of a Loop it calls. A function, so Loops that call each other can name each other. */\nexport type CalledLoop = {\n readonly capabilities: readonly LoopCapability[]\n readonly calls?: () => readonly CalledLoop[]\n}\n```"
1939
+ text: `\`\`\`ts
1940
+ /** What a parent needs of a Loop it calls. A function, so Loops that call each other can name each other. */
1941
+ export type CalledLoop = {
1942
+ readonly capabilities: readonly LoopCapability[]
1943
+ readonly calls?: () => readonly CalledLoop[]
1944
+ readonly lends?: readonly LoopCapability[]
1945
+ }
1946
+ \`\`\``
1332
1947
  },
1333
1948
  {
1334
1949
  path: "sdk/loop/define#capabilitiesOf",
@@ -1345,11 +1960,11 @@ export const capabilitiesOf = (loop: CalledLoop): readonly LoopCapability[] => {
1345
1960
  if (seen.has(current)) return
1346
1961
  seen.add(current)
1347
1962
 
1348
- for (const capability of current.capabilities) granted.add(capability)
1963
+ for (const capability of [...current.capabilities, ...(current.lends ?? [])]) granted.add(capability)
1349
1964
 
1350
1965
  const called = current.calls?.() ?? []
1351
1966
 
1352
- if (called.length > 0) granted.add('call')
1967
+ if (called.length > 0 || (current.lends ?? []).length > 0) granted.add('call')
1353
1968
 
1354
1969
  for (const child of called) visit(child)
1355
1970
  }
@@ -1380,7 +1995,7 @@ export const capabilitiesOf = (loop: CalledLoop): readonly LoopCapability[] => {
1380
1995
  level: 2,
1381
1996
  link: "https://cdn.jsdelivr.net/npm/@kitman-sh/sdk/types/packages/sdk/src/loop/define.d.ts",
1382
1997
  text: `\`\`\`ts
1383
- export const jsonSchemaOf = <T>(loop: string, schema: LoopSchema<T>) =>
1998
+ export const jsonSchemaOf = (loop: string, schema: Schema.Top) =>
1384
1999
  Effect.try({
1385
2000
  try: () => Schema.toJsonSchemaDocument(schema),
1386
2001
  catch: error => new ManifestInvalid({ loop, message: \`Schema has no JSON Schema: \${String(error)}\` })
@@ -1434,10 +2049,12 @@ export const loopManifest = <In, Out, E>(
1434
2049
  ...(definition.role === undefined ? undefined : { role: definition.role }),
1435
2050
  agents: definition.agents,
1436
2051
  checkout: definition.checkout,
1437
- when: definition.when ?? [],
2052
+ when: yield* namedWhenClauses(definition.id, definition.when ?? []),
1438
2053
  offers: definition.offers ?? [],
1439
2054
  capabilities: capabilitiesOf(definition),
1440
- ...((definition.calls?.() ?? []).length === 0 ? undefined : { ownCapabilities: definition.capabilities }),
2055
+ ...((definition.calls?.() ?? []).length === 0 && (definition.lends ?? []).length === 0
2056
+ ? undefined
2057
+ : { ownCapabilities: definition.capabilities }),
1441
2058
  ...(definition.secrets === undefined ? undefined : { secrets: definition.secrets }),
1442
2059
  ...(definition.network === undefined ? undefined : { network: definition.network }),
1443
2060
  ...(definition.schedule === undefined ? undefined : { schedule: definition.schedule })
@@ -1578,7 +2195,7 @@ var pathOfLink = (link) => {
1578
2195
  return page === null ? link : page[1] || "index";
1579
2196
  };
1580
2197
  var UnpinnedSdkLink = "https://cdn.jsdelivr.net/npm/@kitman-sh/sdk/";
1581
- var pinnedLink2 = (link, version = "0.14.9") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
2198
+ var pinnedLink2 = (link, version = "0.15.0") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
1582
2199
  var pageOf = (path) => path.split("#")[0];
1583
2200
  var exportName = (section) => section.path.startsWith("sdk/") ? section.path.split("#")[1] ?? "" : "";
1584
2201
  function excerpt(text, queryTerms) {