[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7326CEYFD0YJ6PD9JZ281JN":3,"skill-same:01M7326CEYFD0YJ6PD9JZ281JN":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7326CEYFD0YJ6PD9JZ281JN","scarn-pipeline",null,"Create scarn pipeline definitions from a natural-language description of steps, with a user-review gate before pushing","scarn-io\u002Fscarn","scarn-io","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F349431421?v=4","01M7325PJ73SR84SK4TFHP11CD","scarn.io","01M7325PJWA1XV9T952Z4FWN5G",1,"MIT","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fscarn-pipeline\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: scarn-pipeline\ndescription: Create scarn pipeline definitions from a natural-language description of steps, with a user-review gate before pushing\n---\n\n## What I do\n\nI translate a plain-language description of an agentic pipeline into a working TypeScript pipeline definition file using the scarn SDK. I then pause for the user to review the definition before any push happens.\n\n## When to use me\n\nInvoke me when a user says something like \"create a pipeline that first investigates an issue, then triages it, then sends a report\" — any request to build or modify a scarn pipeline from a description of steps.\n\n---\n\n## Workflow\n\n1. If `.scarn\u002Fpipeline-builder\u002F` does not exist, run `scarn pipelines init` to scaffold it.\n2. Create or edit a `.ts` file inside `.scarn\u002Fpipeline-builder\u002F`. Each file must export a default `pipeline(...).step(...).advance(...).build()` chain.\n3. Present the pipeline definition to the user for review. Summarize the steps, input bindings, and advancement rules so the user can verify intent without re-reading the file.\n4. Wait for explicit approval. Do not run `scarn pipelines push` until the user confirms. If they request changes, iterate on the file and re-surface for review.\n5. Once approved, ask whether the user wants to push themselves or have me push. Only run `scarn pipelines push` (or `scarn pipelines push \u003CprojectId>`) if they choose the latter. The CLI auto-pushes any step definitions it finds in the same directory first.\n\n---\n\n## Imports\n\n```typescript\nimport { z } from \"zod\";\nimport { defineStep, Features } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fsteps\";\nimport { pipeline } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\n```\n\n---\n\n## Defining steps\n\nEach step represents one unit of agent work. Define every step before the pipeline builder.\n\n```typescript\nexport const myStep = defineStep({\n  key: \"my-step\", \u002F\u002F lowercase kebab-case, unique per project\n  name: \"My Step\", \u002F\u002F display name\n  description: \"...\", \u002F\u002F optional\n  version: 1, \u002F\u002F increment when schema changes\n  status: \"active\", \u002F\u002F \"draft\" | \"active\" (default: \"active\")\n\n  \u002F\u002F Static prompt text for the step agent:\n  agentPrompt: \"You are an analyst. Evaluate the input and return a score.\",\n\n  \u002F\u002F Optional Zod schema for extra step fields beyond the default work item context.\n  \u002F\u002F Every step already receives `workItemTitle` and `workItemDescription`\n  \u002F\u002F automatically in the mapper context. Only use `additionalInput` for extra\n  \u002F\u002F fields you want to bind, such as prior-step signals, literals, or\n  \u002F\u002F pipeline-level input.\n  additionalInput: z.object({\n    content: z.string(),\n  }),\n\n  \u002F\u002F Zod schema for what the step produces\n  result: z.object({\n    summary: z.string(),\n    confidence: z.number(),\n    approved: z.boolean(),\n  }),\n\n  \u002F\u002F Signals: named values extracted from the result, usable in advancement rules\n  \u002F\u002F and as bindings for downstream steps.\n  \u002F\u002F key defaults to sourcePath if omitted.\n  \u002F\u002F type is inferred from the result schema if omitted.\n  signals: [\n    { sourcePath: \"confidence\" }, \u002F\u002F key = \"confidence\", type = \"number\"\n    { key: \"ok\", sourcePath: \"approved\" }, \u002F\u002F explicit key\n  ],\n\n  \u002F\u002F Optional: MCP servers available as tools during this step\n  mcpServers: {\n    postgres: {\n      type: \"local\",\n      command: [\"uvx\", \"postgres-mcp\", \"--access-mode=unrestricted\"],\n      environment: { DATABASE_URI: \"{env:DATABASE_URI}\" },\n    },\n  },\n\n  \u002F\u002F Optional: add built-in feature plugins\n  features: [Features.feedbackRequests()],\n});\n```\n\n### Signal types\n\n`\"string\"` | `\"number\"` | `\"boolean\"` | `\"object\"` | `\"array\"`\n\n### `Features.feedbackRequests()`\n\nAdds a `feedbackRequests?: FeedbackRequestItem[]` field to the result and injects a prompt instructing the agent to surface questions for human review. Use when a step may need to escalate unclear cases.\n\n---\n\n## Defining a pipeline\n\nPipelines use a fluent builder. The chain is: `pipeline(meta)` → `.step(step, mapper, configFn?)` → `.advance(ctx => ...)` → repeat or `.build()`.\n\n`.advance()` is required after every `.step()` before you can add another step or call `.build()`.\n\n```typescript\nexport default pipeline({\n  key: \"my-pipeline\", \u002F\u002F lowercase kebab-case, unique per project\n  name: \"My Pipeline\",\n  description: null, \u002F\u002F optional\n  version: 1,\n  status: \"active\", \u002F\u002F \"draft\" | \"active\" (default: \"active\")\n  input: z.object({ body: z.string(), userId: z.string() }),\n})\n  .step(stepOne, ({ input }) => ({\n    content: input.body,\n  }))\n  .advance(({ signal }) => ({\n    default: \"block\",\n    rules: [signal(\"confidence\").gte(0.8).then(\"continue\")],\n  }))\n  .step(stepTwo, ({ signal, output }) => ({\n    priorSummary: signal(stepOne, \"summary\"),\n    fullResult: output(stepOne),\n  }))\n  .advance(() => ({ default: \"continue\" }))\n  .build();\n```\n\n---\n\n## Step input bindings\n\nEach `.step(step, mapper)` mapper receives a context object `{ input, signal, output, literal }` and must return a record mapping the step's input fields to bindings.\n\n### `input.\u003Cpath>` — pipeline-level input plus default work item fields\n\n`input` is a typed proxy bound to the schema passed to `pipeline(...)`. It also\nalways includes `input.workItemTitle` and `input.workItemDescription`.\n\nImportant distinction:\n\n- `workItemTitle` and `workItemDescription` are default context available to every step mapper automatically.\n- `additionalInput` on `defineStep(...)` is only for extra named fields that the step needs beyond that default context.\n\nIf a step only needs the work item title\u002Fdescription, omit `additionalInput`\nentirely. If it needs another field like `summary`, `userId`, or\n`browserReproductionSummary`, declare only those fields in `additionalInput`.\n\nEach `input.\u003Cpath>` access returns a binding for that path.\n\n```typescript\n.step(investigate, ({ input }) => ({\n  \u002F\u002F pipeline-level fields also work when declared on pipeline(...):\n  userId: input.userId,\n}))\n```\n\nMinimal step with no `additionalInput`:\n\n```typescript\nexport const summarizeTicket = defineStep({\n  key: \"summarize-ticket\",\n  name: \"Summarize Ticket\",\n  version: 1,\n  agentPrompt: \"Summarize the work item.\",\n  result: z.object({ summary: z.string() }),\n  signals: [{ sourcePath: \"summary\" }],\n});\n```\n\nStep with extra inputs declared via `additionalInput`:\n\n```typescript\nexport const triage = defineStep({\n  key: \"triage\",\n  name: \"Triage\",\n  version: 1,\n  agentPrompt: \"Triage the issue.\",\n  additionalInput: z.object({\n    priorSummary: z.string(),\n  }),\n  result: z.object({ priority: z.string() }),\n});\n\n.step(triage, ({ signal }) => ({\n  priorSummary: signal(investigate, \"summary\"),\n}))\n```\n\nDo **not** spread or coerce the accessor (`${input.code}`, `{ ...input.metadata }`) — it will throw at build time.\n\n### `signal(priorStep, signalKey)` — a named signal from an earlier step\n\n```typescript\n.step(triage, ({ signal }) => ({\n  confidence: signal(investigate, \"confidence\"),\n}))\n```\n\n`signalKey` is TypeScript-validated against the prior step's declared signals.\n\n### `output(priorStep)` — the entire result object of a prior step\n\n```typescript\n.step(report, ({ output }) => ({\n  data: output(investigate),\n}))\n```\n\nPrefer `signal` for stability; use `output` when you need the full object.\n\n### `literal(value)` — hard-coded step input\n\n```typescript\n.step(myStep, ({ literal }) => ({\n  retryCount: literal(3),\n}))\n```\n\nUse `literal(...)` when a step input should receive a fixed value.\n\n---\n\n## Advancement policies\n\n`.advance(callback)` attaches a policy to the most recently added step. The callback receives a context with typed helpers and must return `{ default, rules? }`.\n\n```typescript\n.advance(({ signal }) => ({\n  default: \"block\",\n  rules: [\n    signal(\"confidence\").gte(0.8).then(\"continue\"),\n  ],\n}))\n```\n\n### Outcomes\n\n| Outcome          | Meaning                                |\n| ---------------- | -------------------------------------- |\n| `\"continue\"`     | Advance to the next step automatically |\n| `\"block\"`        | Pause; wait for human intervention     |\n| `\"needs_review\"` | Flag for review before proceeding      |\n| `\"complete\"`     | End the pipeline here                  |\n\nTo route to another pipeline:\n\n```typescript\nsignal(\"flagged\")\n  .eq(true)\n  .then(route(\"triage-pipeline\", { reason: \"flagged\" }));\n```\n\n### Signal references\n\n`signal(key)` returns a `SignalRef`. Chain a comparator, then `.then(outcome)` to produce a rule:\n\n```typescript\nsignal(\"score\").gte(0.8).then(\"continue\");\n```\n\nThe `stepSignals` property map is an alternative shorthand — both are equivalent:\n\n```typescript\n\u002F\u002F These are identical:\nsignal(\"score\").gte(0.8).then(\"continue\");\nstepSignals.score.gte(0.8).then(\"continue\");\n```\n\n### Comparators on `SignalRef`\n\n| Method               | Operator               |\n| -------------------- | ---------------------- |\n| `.eq(value)`         | `equal`                |\n| `.ne(value)`         | `notEqual`             |\n| `.gt(n)`             | `greaterThan`          |\n| `.gte(n)`            | `greaterThanInclusive` |\n| `.lt(n)`             | `lessThan`             |\n| `.lte(n)`            | `lessThanInclusive`    |\n| `.in(values)`        | `in`                   |\n| `.notIn(values)`     | `notIn`                |\n| `.contains(value)`   | `contains`             |\n| `.doesNotContain(v)` | `doesNotContain`       |\n\n### Grouping with `all` and `any`\n\n```typescript\n.advance(({ signal, all, any }) => ({\n  default: \"block\",\n  rules: [\n    all(\n      signal(\"score\").gte(0.8),\n      any(\n        signal(\"reviewerApproved\").eq(true),\n        signal(\"autoApproved\").eq(true),\n      ),\n    ).then(\"continue\"),\n  ],\n}))\n```\n\nGroups are nestable arbitrarily. Call `.then(outcome)` to close the rule.\n\n### Computed signals\n\nAggregate multiple signals into a derived value inline — no separate declaration on the step required. Factories accept 2+ `signal(key)` or `stepSignals.key` references:\n\n```typescript\n.advance(({ avg, stepSignals }) => ({\n  default: \"block\",\n  rules: [\n    avg(stepSignals.score1, stepSignals.score2).gte(0.7).then(\"continue\"),\n  ],\n}))\n```\n\nThe same call across multiple rules is deduplicated into a single computed-signal definition at build time.\n\n| Factory            | Description                          | Signal types |\n| ------------------ | ------------------------------------ | ------------ |\n| `avg(...)`         | Arithmetic mean                      | `number`     |\n| `weightedAvg(...)` | Weighted mean                        | `number`     |\n| `sum(...)`         | Sum                                  | `number`     |\n| `min(...)`         | Minimum                              | `number`     |\n| `max(...)`         | Maximum                              | `number`     |\n| `count(...)`       | Count of truthy\u002Fpresent values       | any          |\n| `booleanAny(...)`  | `true` if any input is truthy        | `boolean`    |\n| `booleanAll(...)`  | `true` only if all inputs are truthy | `boolean`    |\n\n---\n\n## Timeouts\n\nPass a third `configFn` argument to `.step()` to cap how long a worker can spend on that step:\n\n```typescript\n.step(\n  heavyAnalysisStep,\n  ({ input }) => ({ payload: input.payload }),\n  (cfg) => { cfg.timeout = 900; },   \u002F\u002F seconds\n)\n```\n\n---\n\n## Complete example\n\n```typescript\nimport { z } from \"zod\";\nimport { defineStep } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fsteps\";\nimport { pipeline } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\n\nexport const investigate = defineStep({\n  key: \"investigate\",\n  name: \"Investigate\",\n  version: 1,\n  agentPrompt: \"Analyze the work item and produce a summary with confidence.\",\n  additionalInput: z.object({\n    reporterId: z.string(),\n  }),\n  result: z.object({ summary: z.string(), confidence: z.number() }),\n  signals: [{ sourcePath: \"confidence\" }, { sourcePath: \"summary\" }],\n});\n\nexport const triage = defineStep({\n  key: \"triage\",\n  name: \"Triage\",\n  version: 1,\n  agentPrompt:\n    \"Given the investigation summary, assign a priority: low, medium, or high.\",\n  additionalInput: z.object({ summary: z.string() }),\n  result: z.object({ priority: z.string() }),\n  signals: [{ sourcePath: \"priority\" }],\n});\n\nexport default pipeline({\n  key: \"issue-pipeline\",\n  name: \"Issue Pipeline\",\n  version: 1,\n  input: z.object({ userId: z.string() }),\n})\n  .step(investigate, ({ input }) => ({\n    reporterId: input.userId,\n  }))\n  .advance(({ signal }) => ({\n    default: \"block\",\n    rules: [signal(\"confidence\").gte(0.8).then(\"continue\")],\n  }))\n  .step(triage, ({ signal }) => ({\n    summary: signal(investigate, \"summary\"),\n  }))\n  .advance(() => ({ default: \"continue\" }))\n  .build();\n```\n\n---\n\n## Default pipeline assignment\n\nA project can have a single routing policy that automatically starts a pipeline when a work item arrives. This lives in the reserved file `.scarn\u002Fpipeline-builder\u002Fdefault-pipeline-assignment.ts`.\n\n**File rules:**\n- Reserved filename — the push scanner ignores it as a pipeline definition.\n- Only `defaultPipelineAssignment` is imported from the SDK; everything else comes from the callback context.\n- `scarn pipelines push` syncs it to the server after pipelines are pushed. If the file is absent, server config is left unchanged.\n- `scarn pipelines pull` writes or removes the file to match server state.\n\n### Authoring\n\n```typescript\nimport { defaultPipelineAssignment } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\nimport bugTriage from \".\u002Fbug-triage\";\nimport regressionReview from \".\u002Fregression-review\";\n\nexport default defaultPipelineAssignment(({ workItem, context, any, assign, skip }) => ({\n  default: assign(bugTriage),\n  rules: [\n    any(\n      workItem.field(\"status\").eq(\"resolved\"),\n      workItem.field(\"status\").eq(\"manual support\"),\n    ).then(skip()),\n    workItem.field(\"issueType\").eq(\"bug\").then(assign(bugTriage)),\n    workItem.field(\"labels\").contains(\"regression\").then(assign(regressionReview)),\n    context.isNew.eq(true).then(assign(bugTriage)),\n  ],\n}));\n```\n\n### Context helpers\n\n| Helper | Description |\n|--------|-------------|\n| `workItem.field(name)` | Comparator ref for the named work item field |\n| `context.isNew` | Comparator ref; `true` when the work item is being created for the first time |\n| `assign(pipeline)` | Outcome: start the given pipeline. Pass the default-exported spec from a pipeline file. |\n| `skip()` | Outcome: do not assign any pipeline |\n| `all(...refs)` | All nested conditions must match |\n| `any(...refs)` | Any nested condition must match |\n\n### Return shape\n\n```typescript\n{\n  default: assign(myPipeline) | skip(),  \u002F\u002F fallback when no rule matches\n  rules: [                               \u002F\u002F evaluated in order; first match wins\n    workItem.field(\"issueType\").eq(\"bug\").then(assign(myPipeline)),\n    workItem.field(\"status\").eq(\"resolved\").then(skip()),\n  ],\n}\n```\n\nAll comparators from advancement policies work here: `.eq`, `.ne`, `.gt`, `.gte`, `.lt`, `.lte`, `.in`, `.notIn`, `.contains`, `.doesNotContain`.\n\n---\n\n## Deploying\n\nOnly push after the user has reviewed and approved the pipeline definition. Once approved, ask whether the user wants to push themselves or wants me to run the push.\n\n```bash\n# First time setup (creates .scarn\u002Fpipeline-builder\u002F with example files)\nscarn pipelines init\n\n# Fetch existing definitions from the server as editable TypeScript\nscarn pipelines pull\n\n# Push all pipeline definitions (also pushes step definitions automatically)\n# Also syncs default-pipeline-assignment.ts if present\nscarn pipelines push\n\n# Push to a specific project\nscarn pipelines push \u003CprojectId>\n```\n\nSteps referenced in a pipeline must exist on the server. The `push` command handles this automatically by pushing all step definitions found in `.scarn\u002Fpipeline-builder\u002F` before pushing pipelines.\n\nIncrementing `version` in `defineStep` or `pipeline()` creates a new entity on the server rather than updating the existing one.\n","## What I do\n\nI translate a plain-language description of an agentic pipeline into a working TypeScript pipeline definition file using the scarn SDK. I then pause for the user to review the definition before any push happens.\n\n## When to use me\n\nInvoke me when a user says something like \"create a pipeline that first investigates an issue, then triages it, then sends a report\" — any request to build or modify a scarn pipeline from a description of steps.\n\n---\n\n## Workflow\n\n1. If `.scarn\u002Fpipeline-builder\u002F` does not exist, run `scarn pipelines init` to scaffold it.\n2. Create or edit a `.ts` file inside `.scarn\u002Fpipeline-builder\u002F`. Each file must export a default `pipeline(...).step(...).advance(...).build()` chain.\n3. Present the pipeline definition to the user for review. Summarize the steps, input bindings, and advancement rules so the user can verify intent without re-reading the file.\n4. Wait for explicit approval. Do not run `scarn pipelines push` until the user confirms. If they request changes, iterate on the file and re-surface for review.\n5. Once approved, ask whether the user wants to push themselves or have me push. Only run `scarn pipelines push` (or `scarn pipelines push \u003CprojectId>`) if they choose the latter. The CLI auto-pushes any step definitions it finds in the same directory first.\n\n---\n\n## Imports\n\n```typescript\nimport { z } from \"zod\";\nimport { defineStep, Features } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fsteps\";\nimport { pipeline } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\n```\n\n---\n\n## Defining steps\n\nEach step represents one unit of agent work. Define every step before the pipeline builder.\n\n```typescript\nexport const myStep = defineStep({\n  key: \"my-step\", \u002F\u002F lowercase kebab-case, unique per project\n  name: \"My Step\", \u002F\u002F display name\n  description: \"...\", \u002F\u002F optional\n  version: 1, \u002F\u002F increment when schema changes\n  status: \"active\", \u002F\u002F \"draft\" | \"active\" (default: \"active\")\n\n  \u002F\u002F Static prompt text for the step agent:\n  agentPrompt: \"You are an analyst. Evaluate the input and return a score.\",\n\n  \u002F\u002F Optional Zod schema for extra step fields beyond the default work item context.\n  \u002F\u002F Every step already receives `workItemTitle` and `workItemDescription`\n  \u002F\u002F automatically in the mapper context. Only use `additionalInput` for extra\n  \u002F\u002F fields you want to bind, such as prior-step signals, literals, or\n  \u002F\u002F pipeline-level input.\n  additionalInput: z.object({\n    content: z.string(),\n  }),\n\n  \u002F\u002F Zod schema for what the step produces\n  result: z.object({\n    summary: z.string(),\n    confidence: z.number(),\n    approved: z.boolean(),\n  }),\n\n  \u002F\u002F Signals: named values extracted from the result, usable in advancement rules\n  \u002F\u002F and as bindings for downstream steps.\n  \u002F\u002F key defaults to sourcePath if omitted.\n  \u002F\u002F type is inferred from the result schema if omitted.\n  signals: [\n    { sourcePath: \"confidence\" }, \u002F\u002F key = \"confidence\", type = \"number\"\n    { key: \"ok\", sourcePath: \"approved\" }, \u002F\u002F explicit key\n  ],\n\n  \u002F\u002F Optional: MCP servers available as tools during this step\n  mcpServers: {\n    postgres: {\n      type: \"local\",\n      command: [\"uvx\", \"postgres-mcp\", \"--access-mode=unrestricted\"],\n      environment: { DATABASE_URI: \"{env:DATABASE_URI}\" },\n    },\n  },\n\n  \u002F\u002F Optional: add built-in feature plugins\n  features: [Features.feedbackRequests()],\n});\n```\n\n### Signal types\n\n`\"string\"` | `\"number\"` | `\"boolean\"` | `\"object\"` | `\"array\"`\n\n### `Features.feedbackRequests()`\n\nAdds a `feedbackRequests?: FeedbackRequestItem[]` field to the result and injects a prompt instructing the agent to surface questions for human review. Use when a step may need to escalate unclear cases.\n\n---\n\n## Defining a pipeline\n\nPipelines use a fluent builder. The chain is: `pipeline(meta)` → `.step(step, mapper, configFn?)` → `.advance(ctx => ...)` → repeat or `.build()`.\n\n`.advance()` is required after every `.step()` before you can add another step or call `.build()`.\n\n```typescript\nexport default pipeline({\n  key: \"my-pipeline\", \u002F\u002F lowercase kebab-case, unique per project\n  name: \"My Pipeline\",\n  description: null, \u002F\u002F optional\n  version: 1,\n  status: \"active\", \u002F\u002F \"draft\" | \"active\" (default: \"active\")\n  input: z.object({ body: z.string(), userId: z.string() }),\n})\n  .step(stepOne, ({ input }) => ({\n    content: input.body,\n  }))\n  .advance(({ signal }) => ({\n    default: \"block\",\n    rules: [signal(\"confidence\").gte(0.8).then(\"continue\")],\n  }))\n  .step(stepTwo, ({ signal, output }) => ({\n    priorSummary: signal(stepOne, \"summary\"),\n    fullResult: output(stepOne),\n  }))\n  .advance(() => ({ default: \"continue\" }))\n  .build();\n```\n\n---\n\n## Step input bindings\n\nEach `.step(step, mapper)` mapper receives a context object `{ input, signal, output, literal }` and must return a record mapping the step's input fields to bindings.\n\n### `input.\u003Cpath>` — pipeline-level input plus default work item fields\n\n`input` is a typed proxy bound to the schema passed to `pipeline(...)`. It also\nalways includes `input.workItemTitle` and `input.workItemDescription`.\n\nImportant distinction:\n\n- `workItemTitle` and `workItemDescription` are default context available to every step mapper automatically.\n- `additionalInput` on `defineStep(...)` is only for extra named fields that the step needs beyond that default context.\n\nIf a step only needs the work item title\u002Fdescription, omit `additionalInput`\nentirely. If it needs another field like `summary`, `userId`, or\n`browserReproductionSummary`, declare only those fields in `additionalInput`.\n\nEach `input.\u003Cpath>` access returns a binding for that path.\n\n```typescript\n.step(investigate, ({ input }) => ({\n  \u002F\u002F pipeline-level fields also work when declared on pipeline(...):\n  userId: input.userId,\n}))\n```\n\nMinimal step with no `additionalInput`:\n\n```typescript\nexport const summarizeTicket = defineStep({\n  key: \"summarize-ticket\",\n  name: \"Summarize Ticket\",\n  version: 1,\n  agentPrompt: \"Summarize the work item.\",\n  result: z.object({ summary: z.string() }),\n  signals: [{ sourcePath: \"summary\" }],\n});\n```\n\nStep with extra inputs declared via `additionalInput`:\n\n```typescript\nexport const triage = defineStep({\n  key: \"triage\",\n  name: \"Triage\",\n  version: 1,\n  agentPrompt: \"Triage the issue.\",\n  additionalInput: z.object({\n    priorSummary: z.string(),\n  }),\n  result: z.object({ priority: z.string() }),\n});\n\n.step(triage, ({ signal }) => ({\n  priorSummary: signal(investigate, \"summary\"),\n}))\n```\n\nDo **not** spread or coerce the accessor (`${input.code}`, `{ ...input.metadata }`) — it will throw at build time.\n\n### `signal(priorStep, signalKey)` — a named signal from an earlier step\n\n```typescript\n.step(triage, ({ signal }) => ({\n  confidence: signal(investigate, \"confidence\"),\n}))\n```\n\n`signalKey` is TypeScript-validated against the prior step's declared signals.\n\n### `output(priorStep)` — the entire result object of a prior step\n\n```typescript\n.step(report, ({ output }) => ({\n  data: output(investigate),\n}))\n```\n\nPrefer `signal` for stability; use `output` when you need the full object.\n\n### `literal(value)` — hard-coded step input\n\n```typescript\n.step(myStep, ({ literal }) => ({\n  retryCount: literal(3),\n}))\n```\n\nUse `literal(...)` when a step input should receive a fixed value.\n\n---\n\n## Advancement policies\n\n`.advance(callback)` attaches a policy to the most recently added step. The callback receives a context with typed helpers and must return `{ default, rules? }`.\n\n```typescript\n.advance(({ signal }) => ({\n  default: \"block\",\n  rules: [\n    signal(\"confidence\").gte(0.8).then(\"continue\"),\n  ],\n}))\n```\n\n### Outcomes\n\n| Outcome          | Meaning                                |\n| ---------------- | -------------------------------------- |\n| `\"continue\"`     | Advance to the next step automatically |\n| `\"block\"`        | Pause; wait for human intervention     |\n| `\"needs_review\"` | Flag for review before proceeding      |\n| `\"complete\"`     | End the pipeline here                  |\n\nTo route to another pipeline:\n\n```typescript\nsignal(\"flagged\")\n  .eq(true)\n  .then(route(\"triage-pipeline\", { reason: \"flagged\" }));\n```\n\n### Signal references\n\n`signal(key)` returns a `SignalRef`. Chain a comparator, then `.then(outcome)` to produce a rule:\n\n```typescript\nsignal(\"score\").gte(0.8).then(\"continue\");\n```\n\nThe `stepSignals` property map is an alternative shorthand — both are equivalent:\n\n```typescript\n\u002F\u002F These are identical:\nsignal(\"score\").gte(0.8).then(\"continue\");\nstepSignals.score.gte(0.8).then(\"continue\");\n```\n\n### Comparators on `SignalRef`\n\n| Method               | Operator               |\n| -------------------- | ---------------------- |\n| `.eq(value)`         | `equal`                |\n| `.ne(value)`         | `notEqual`             |\n| `.gt(n)`             | `greaterThan`          |\n| `.gte(n)`            | `greaterThanInclusive` |\n| `.lt(n)`             | `lessThan`             |\n| `.lte(n)`            | `lessThanInclusive`    |\n| `.in(values)`        | `in`                   |\n| `.notIn(values)`     | `notIn`                |\n| `.contains(value)`   | `contains`             |\n| `.doesNotContain(v)` | `doesNotContain`       |\n\n### Grouping with `all` and `any`\n\n```typescript\n.advance(({ signal, all, any }) => ({\n  default: \"block\",\n  rules: [\n    all(\n      signal(\"score\").gte(0.8),\n      any(\n        signal(\"reviewerApproved\").eq(true),\n        signal(\"autoApproved\").eq(true),\n      ),\n    ).then(\"continue\"),\n  ],\n}))\n```\n\nGroups are nestable arbitrarily. Call `.then(outcome)` to close the rule.\n\n### Computed signals\n\nAggregate multiple signals into a derived value inline — no separate declaration on the step required. Factories accept 2+ `signal(key)` or `stepSignals.key` references:\n\n```typescript\n.advance(({ avg, stepSignals }) => ({\n  default: \"block\",\n  rules: [\n    avg(stepSignals.score1, stepSignals.score2).gte(0.7).then(\"continue\"),\n  ],\n}))\n```\n\nThe same call across multiple rules is deduplicated into a single computed-signal definition at build time.\n\n| Factory            | Description                          | Signal types |\n| ------------------ | ------------------------------------ | ------------ |\n| `avg(...)`         | Arithmetic mean                      | `number`     |\n| `weightedAvg(...)` | Weighted mean                        | `number`     |\n| `sum(...)`         | Sum                                  | `number`     |\n| `min(...)`         | Minimum                              | `number`     |\n| `max(...)`         | Maximum                              | `number`     |\n| `count(...)`       | Count of truthy\u002Fpresent values       | any          |\n| `booleanAny(...)`  | `true` if any input is truthy        | `boolean`    |\n| `booleanAll(...)`  | `true` only if all inputs are truthy | `boolean`    |\n\n---\n\n## Timeouts\n\nPass a third `configFn` argument to `.step()` to cap how long a worker can spend on that step:\n\n```typescript\n.step(\n  heavyAnalysisStep,\n  ({ input }) => ({ payload: input.payload }),\n  (cfg) => { cfg.timeout = 900; },   \u002F\u002F seconds\n)\n```\n\n---\n\n## Complete example\n\n```typescript\nimport { z } from \"zod\";\nimport { defineStep } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fsteps\";\nimport { pipeline } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\n\nexport const investigate = defineStep({\n  key: \"investigate\",\n  name: \"Investigate\",\n  version: 1,\n  agentPrompt: \"Analyze the work item and produce a summary with confidence.\",\n  additionalInput: z.object({\n    reporterId: z.string(),\n  }),\n  result: z.object({ summary: z.string(), confidence: z.number() }),\n  signals: [{ sourcePath: \"confidence\" }, { sourcePath: \"summary\" }],\n});\n\nexport const triage = defineStep({\n  key: \"triage\",\n  name: \"Triage\",\n  version: 1,\n  agentPrompt:\n    \"Given the investigation summary, assign a priority: low, medium, or high.\",\n  additionalInput: z.object({ summary: z.string() }),\n  result: z.object({ priority: z.string() }),\n  signals: [{ sourcePath: \"priority\" }],\n});\n\nexport default pipeline({\n  key: \"issue-pipeline\",\n  name: \"Issue Pipeline\",\n  version: 1,\n  input: z.object({ userId: z.string() }),\n})\n  .step(investigate, ({ input }) => ({\n    reporterId: input.userId,\n  }))\n  .advance(({ signal }) => ({\n    default: \"block\",\n    rules: [signal(\"confidence\").gte(0.8).then(\"continue\")],\n  }))\n  .step(triage, ({ signal }) => ({\n    summary: signal(investigate, \"summary\"),\n  }))\n  .advance(() => ({ default: \"continue\" }))\n  .build();\n```\n\n---\n\n## Default pipeline assignment\n\nA project can have a single routing policy that automatically starts a pipeline when a work item arrives. This lives in the reserved file `.scarn\u002Fpipeline-builder\u002Fdefault-pipeline-assignment.ts`.\n\n**File rules:**\n- Reserved filename — the push scanner ignores it as a pipeline definition.\n- Only `defaultPipelineAssignment` is imported from the SDK; everything else comes from the callback context.\n- `scarn pipelines push` syncs it to the server after pipelines are pushed. If the file is absent, server config is left unchanged.\n- `scarn pipelines pull` writes or removes the file to match server state.\n\n### Authoring\n\n```typescript\nimport { defaultPipelineAssignment } from \"@scarn\u002Fsdk\u002Fdefinitions\u002Fpipelines\";\nimport bugTriage from \".\u002Fbug-triage\";\nimport regressionReview from \".\u002Fregression-review\";\n\nexport default defaultPipelineAssignment(({ workItem, context, any, assign, skip }) => ({\n  default: assign(bugTriage),\n  rules: [\n    any(\n      workItem.field(\"status\").eq(\"resolved\"),\n      workItem.field(\"status\").eq(\"manual support\"),\n    ).then(skip()),\n    workItem.field(\"issueType\").eq(\"bug\").then(assign(bugTriage)),\n    workItem.field(\"labels\").contains(\"regression\").then(assign(regressionReview)),\n    context.isNew.eq(true).then(assign(bugTriage)),\n  ],\n}));\n```\n\n### Context helpers\n\n| Helper | Description |\n|--------|-------------|\n| `workItem.field(name)` | Comparator ref for the named work item field |\n| `context.isNew` | Comparator ref; `true` when the work item is being created for the first time |\n| `assign(pipeline)` | Outcome: start the given pipeline. Pass the default-exported spec from a pipeline file. |\n| `skip()` | Outcome: do not assign any pipeline |\n| `all(...refs)` | All nested conditions must match |\n| `any(...refs)` | Any nested condition must match |\n\n### Return shape\n\n```typescript\n{\n  default: assign(myPipeline) | skip(),  \u002F\u002F fallback when no rule matches\n  rules: [                               \u002F\u002F evaluated in order; first match wins\n    workItem.field(\"issueType\").eq(\"bug\").then(assign(myPipeline)),\n    workItem.field(\"status\").eq(\"resolved\").then(skip()),\n  ],\n}\n```\n\nAll comparators from advancement policies work here: `.eq`, `.ne`, `.gt`, `.gte`, `.lt`, `.lte`, `.in`, `.notIn`, `.contains`, `.doesNotContain`.\n\n---\n\n## Deploying\n\nOnly push after the user has reviewed and approved the pipeline definition. Once approved, ask whether the user wants to push themselves or wants me to run the push.\n\n```bash\n# First time setup (creates .scarn\u002Fpipeline-builder\u002F with example files)\nscarn pipelines init\n\n# Fetch existing definitions from the server as editable TypeScript\nscarn pipelines pull\n\n# Push all pipeline definitions (also pushes step definitions automatically)\n# Also syncs default-pipeline-assignment.ts if present\nscarn pipelines push\n\n# Push to a specific project\nscarn pipelines push \u003CprojectId>\n```\n\nSteps referenced in a pipeline must exist on the server. The `push` command handles this automatically by pushing all step definitions found in `.scarn\u002Fpipeline-builder\u002F` before pushing pipelines.\n\nIncrementing `version` in `defineStep` or `pipeline()` creates a new entity on the server rather than updating the existing one.\n",{"name":5,"description":7},"main","3edb638e3fa2ca7d17aabe685b43bb584fefe11c",".opencode\u002Fskills\u002Fscarn-pipeline",0,"https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn","https:\u002F\u002Fscarn-io.github.io\u002Fscarn\u002F","https:\u002F\u002Fgithub.com\u002Fscarn-io","2026-11-14 09:58:25",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add scarn-io\u002Fscarn --skill scarn-pipeline",{"tool":38,"command":39},"bunx","bunx skills add scarn-io\u002Fscarn --skill scarn-pipeline",{"tool":41,"command":42},"pnpm","pnpm dlx skills add scarn-io\u002Fscarn --skill scarn-pipeline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fscarn-pipeline\u002FSKILL.md",true,[],[47,54,61,67,74,80],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7326W1WF3615P5F03P5KBKQ","release","Cut a release: tag, changelog, publish.","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fworker\u002Ftests\u002Fproject\u002Fagent-tools\u002Funit\u002Ffixtures\u002Fevery-format\u002F.opencode\u002Fskills\u002Frelease\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7326TEBXBSJSA1Y9GPXFVJ2","triage","Triage an incoming bug report.","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fworker\u002Ftests\u002Fproject\u002Fagent-tools\u002Funit\u002Ffixtures\u002Fevery-format\u002F.opencode\u002Fskill\u002Ftriage\u002FSKILL.md",[],[],{"skillNo":62,"name":56,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7326Q11TKXYV1MPFY2CCQ0M","A shadowed triage skill.","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fworker\u002Ftests\u002Fproject\u002Fagent-tools\u002Funit\u002Ffixtures\u002Fevery-format\u002F.claude\u002Fskills\u002Ftriage\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7326N7CA1GPMFS7YGN500C7","no-name","Uses its directory name.","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fworker\u002Ftests\u002Fproject\u002Fagent-tools\u002Funit\u002Ffixtures\u002Fevery-format\u002F.agents\u002Fskills\u002Fno-name\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7326MESPPC3FVE9B4BKF44K","broken","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fworker\u002Ftests\u002Fproject\u002Fagent-tools\u002Funit\u002Ffixtures\u002Fevery-format\u002F.agents\u002Fskills\u002Fbroken\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7326J1MDKJSB2PBAVN5S61E","grilling","Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.","https:\u002F\u002Fgithub.com\u002Fscarn-io\u002Fscarn\u002Fblob\u002Fmain\u002Fpackages\u002Fopencode-plugin\u002Fskills\u002Fgrilling\u002FSKILL.md",[],[]]