pipebrain-mcp 0.30.0 → 0.32.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 (2) hide show
  1. package/dist/main.js +179 -169
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -429,6 +429,9 @@ function apiBindingLabel(apiBaseUrl) {
429
429
  return /\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(:|\/|$)/.test(apiBaseUrl) ? "LOCAL dev" : "production/remote";
430
430
  }
431
431
 
432
+ // ../../libs/agent-shared/dist/doctrine.js
433
+ var DOCTRINE = "# Pipebrain doctrine\n\nHow an agent works inside Pipebrain. These rules ship with the product and read the same in every organization, because each exists where disagreeing breaks something the product guarantees rather than merely changing house style.\n\nHow your organization *writes* is its own text, edited in Settings, and follows this document under a heading naming each scope.\n\n## Decisions are yours; escalate on consequence\n\nInside an approved requirement you choose the design, the libraries, the structure, and the sequencing. Do not ask, report, or seek ratification for the choice. Escalate on consequence, not uncertainty: a choice that changes what a user sees, costs money, or contradicts an approved requirement is filed as a question with the options you propose; everything else you decide and carry on. A technical choice worth keeping is a decision record, never a paragraph.\n\n## Every loose end has one destination, and none of them is prose\n\nAnything you notice that is not the work in front of you goes to exactly one of three places: a question, when the operator has to choose; a new issue at triage, when it is real work outside this item's scope; or nowhere. Nowhere is the default, and the right outcome whenever knowing the thing would change nothing anyone does. Never open a section called notes, caveats, observations, things to know, or next steps in a body or a comment. Filing is the report: an item recorded and then repeated in prose asks the operator to triage it twice.\n\n## A decision you need is filed as a question, never written into a body\n\nAn open decision belongs in a question on the issue, filed with `ask_questions`, carrying the options you propose. It does not belong in a body \u2014 not under a heading, and not in a field. A decision written into prose prompts nobody and records no answer, so the operator has no place to make it and a later session cannot tell whether it ever was. Retract one your own work has since settled, so nothing asks the operator to decide something nobody waits on.\n\n## Search before you create\n\nLook for the existing record before adding one. A duplicate splits one thing's history across two identifiers, and the split is permanent \u2014 nothing merges them afterward.\n\n## Link by key; never paste another record's text\n\nReference a requirement, a decision, or an issue by its key, with its title on first mention. Never paste its text into a body. The source changes and the copy does not, and the stale copy is what gets built.\n\n## Cross-cutting requirements arrive on their own\n\nThey bind every epic automatically and come back with a work-item read, at their latest approved revision. Never restate them in a body and never add them as explicit requirement links. An explicit link pins a document at an approved revision, which is a different act.\n\n## Verification modes follow what can be driven\n\nBefore assigning a mode, establish what this project can drive end to end: a harness, and the command that runs it. A criterion is `auto` when an evaluator can drive the input and read the result against the running system, including behavior shown in an interface wherever such a harness exists. What qualifies it is the evaluator's own run, never the existence of a test the implementer wrote.\n\nMark `manual` only when the verdict needs a person's judgment. A criterion you cannot describe as drivable is usually worded too vaguely: reword it against the observable rather than fall back to a person. A `manual` criterion carries instructions for whoever checks it by hand, written for someone who has not seen the code or the conversation that produced it.\n\nA manual criterion carrying no recorded artifact is the human gate working as designed rather than a coverage gap, so it is neither a finding nor weaker than one carrying evidence.\n\n## The bar for filing a bug\n\nFile a bug only when the observed behavior breaks an approved requirement or a defined acceptance criterion, and name which one before you file. Failing that, it is not a bug: code you find unclear, an edge case nobody specified, a performance number nobody set, and anything you would phrase as \"this could be better\" are opinions about the product, so file each as feedback or not at all. The bar exists because a queue holding both real defects and unshared taste has to be read entirely before any of it can be trusted.\n\n## A decision record is written once\n\nIt states what was decided and why, at the time it was decided, and is not edited as understanding moves. A superseding record replaces it, and the chain of the two is the account of how the thinking changed \u2014 which an edited record destroys. Read the existing records before re-opening a settled question.\n\n## A secret value never travels in a tool call\n\nNo tool here returns one, and that is deliberate rather than an omission to be fixed. Nor should you put one in: a value typed into a tool call is in the transcript before the server can encrypt it, so it is already disclosed and the only remedy left is rotation. Set values with the command-line tool, from a file or on standard input, and inject them at run time rather than reading them into context.\n\n## Setting an instruction replaces the whole body\n\nThere is no partial update. Writing an instruction stores exactly the body you supply and discards everything that was there, so a partial write destroys the rest of the text. The procedure is: read the live value, compose the complete replacement, write it, then read the live value again to confirm what landed.\n\nWhat you are reading now is a snapshot taken when this session started, and so are the tool descriptions. An edit reaches the next session, never this one, so reading the text back after a write shows the pre-edit value. An agent that reports a diff of what it just wrote has read the snapshot instead of the record.\n";
434
+
432
435
  // ../../libs/agent-shared/dist/resolve-agent-env.js
433
436
  function pick(env, primary, legacy) {
434
437
  const fromPrimary = env[primary];
@@ -16040,32 +16043,6 @@ var deleteOrgInstructionInputSchema = external_exports.strictObject({
16040
16043
  scope: instructionScopeSchema
16041
16044
  });
16042
16045
 
16043
- // ../../libs/domain/dist/instructions.js
16044
- var ISSUE_WRITE_TOOLS = [
16045
- "create_issue",
16046
- "update_issue",
16047
- "promote_feedback",
16048
- "open_review"
16049
- ];
16050
- var INSTRUCTION_SCOPE_TARGETS = {
16051
- general: { kind: "server" },
16052
- requirements: { kind: "tools", tools: ["create_requirement", "update_requirement"] },
16053
- content: {
16054
- kind: "tools",
16055
- tools: ["create_content", "update_content", "create_deliverable", "update_deliverable"]
16056
- },
16057
- "work.epic": { kind: "issue_tools", issueType: "epic", tools: ISSUE_WRITE_TOOLS },
16058
- "work.task": { kind: "issue_tools", issueType: "task", tools: ISSUE_WRITE_TOOLS },
16059
- "work.bug": { kind: "issue_tools", issueType: "bug", tools: ISSUE_WRITE_TOOLS },
16060
- "work.feedback": { kind: "issue_tools", issueType: "feedback", tools: ISSUE_WRITE_TOOLS }
16061
- };
16062
- function scopesForTool(tool) {
16063
- return instructionScopeSchema.options.filter((scope) => {
16064
- const target = INSTRUCTION_SCOPE_TARGETS[scope];
16065
- return target.kind !== "server" && target.tools.includes(tool);
16066
- });
16067
- }
16068
-
16069
16046
  // ../../libs/agent-shared/dist/token-shape.js
16070
16047
  function isAcceptedTokenShape(value) {
16071
16048
  return ACCEPTED_TOKEN_PREFIXES.some((prefix) => value.startsWith(prefix));
@@ -16884,6 +16861,19 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
16884
16861
 
16885
16862
  // ../../libs/mcp-server/dist/instructions.js
16886
16863
  var STARTUP_FETCH_TIMEOUT_MS = 5e3;
16864
+ var WORK_CONTEXT_RESULT_CHARS = 2e5;
16865
+ var GUIDANCE_POINTER = "The binding guidance for writing here \u2014 the product doctrine and this organization\u2019s own writing rules \u2014 is returned by `get_work_context`. Read it before you write.";
16866
+ function bindingBanner(apiBaseUrl) {
16867
+ return `Pipebrain MCP server, bound to the ${apiBindingLabel(apiBaseUrl)} API at ${apiBaseUrl}. Every tool reads and writes THAT environment \u2014 confirm it is the one you intend before mutating.`;
16868
+ }
16869
+ var INDEX_RULES = "Until you have it: an open decision is filed as a question with `ask_questions` and never written into a body; search for an existing record before creating one, because a duplicate splits one thing\u2019s history across two identifiers and nothing merges them afterward; and a secret value never travels in a tool call, because a value in a call is disclosed before the server can encrypt it.";
16870
+ function composeIndex(base) {
16871
+ return [
16872
+ base,
16873
+ "Call `get_work_context` before you write anything \u2014 it returns the binding guidance, the product doctrine and this organization\u2019s own writing rules, together with the work. Nothing else delivers that guidance in full; every other read only names this call.",
16874
+ INDEX_RULES
16875
+ ].join("\n\n");
16876
+ }
16887
16877
  async function fetchOrgInstructionsSafe(client2) {
16888
16878
  let timer;
16889
16879
  try {
@@ -16900,7 +16890,7 @@ async function fetchOrgInstructionsSafe(client2) {
16900
16890
  return map2;
16901
16891
  } catch (err) {
16902
16892
  const message = err instanceof Error ? err.message : String(err);
16903
- process.stderr.write(`pipebrain mcp: org instructions unavailable (${message}) \u2014 starting with base tool descriptions
16893
+ process.stderr.write(`pipebrain mcp: org instructions unavailable (${message}) \u2014 starting with the doctrine alone
16904
16894
  `);
16905
16895
  return /* @__PURE__ */ new Map();
16906
16896
  } finally {
@@ -16908,34 +16898,17 @@ async function fetchOrgInstructionsSafe(client2) {
16908
16898
  clearTimeout(timer);
16909
16899
  }
16910
16900
  }
16911
- function decorateDescription(toolName, base, instructions) {
16912
- let out = base;
16913
- const kindLines = [];
16914
- for (const scope of scopesForTool(toolName)) {
16901
+ function composeGuidance(base, instructions) {
16902
+ const blocks = [base, DOCTRINE.trim()];
16903
+ for (const scope of instructionScopeSchema.options) {
16915
16904
  const body = instructions.get(scope);
16916
16905
  if (body === void 0)
16917
16906
  continue;
16918
- const target = INSTRUCTION_SCOPE_TARGETS[scope];
16919
- if (target.kind === "issue_tools") {
16920
- kindLines.push(`[${target.issueType}] ${body}`);
16921
- } else {
16922
- out += `
16907
+ blocks.push(`## Organization instructions \u2014 ${scope}
16923
16908
 
16924
- Org instructions (${scope}):
16925
- ${body}`;
16926
- }
16927
- }
16928
- if (kindLines.length > 0) {
16929
- out += "\n\nOrg instructions by issue `type` \u2014 apply ONLY the block matching the `type` you pass:\n\n" + kindLines.join("\n\n");
16909
+ ${body}`);
16930
16910
  }
16931
- return out;
16932
- }
16933
- function withGeneralInstructions(base, instructions) {
16934
- const general = instructions.get("general");
16935
- return general === void 0 ? base : `${base}
16936
-
16937
- Org instructions:
16938
- ${general}`;
16911
+ return blocks.join("\n\n");
16939
16912
  }
16940
16913
 
16941
16914
  // ../../libs/mcp-server/dist/server.js
@@ -16945,8 +16918,13 @@ function successorNotice() {
16945
16918
  return armed === void 0 || armed === "" ? "" : SUCCESSOR_NOTICE;
16946
16919
  }
16947
16920
  var DEFAULT_VERSION = "0.0.0";
16948
- function ok(data) {
16949
- return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
16921
+ function ok(data, appended) {
16922
+ const content = [
16923
+ { type: "text", text: JSON.stringify(data, null, 2) }
16924
+ ];
16925
+ if (appended !== void 0)
16926
+ content.push({ type: "text", text: appended });
16927
+ return { content };
16950
16928
  }
16951
16929
  function toolError(err) {
16952
16930
  if (err instanceof ApiError) {
@@ -16961,9 +16939,9 @@ code: ${err.code}${detailText}` }]
16961
16939
  const message = err instanceof Error ? err.message : String(err);
16962
16940
  return { isError: true, content: [{ type: "text", text: message }] };
16963
16941
  }
16964
- async function run(body) {
16942
+ async function run(body, appended) {
16965
16943
  try {
16966
- return ok(await body());
16944
+ return ok(await body(), appended);
16967
16945
  } catch (err) {
16968
16946
  return toolError(err);
16969
16947
  }
@@ -16996,15 +16974,18 @@ async function resolveDeliverableTargetId(client2, projectKey, ref) {
16996
16974
  }
16997
16975
  function createMcpServer(client2, apiBaseUrl, orgInstructions2 = /* @__PURE__ */ new Map(), opts = {}) {
16998
16976
  const surface = opts.surface ?? "local";
16977
+ const banner = bindingBanner(apiBaseUrl);
16978
+ const guidance = composeGuidance(banner, orgInstructions2);
16999
16979
  const server2 = new McpServer({ name: "pipebrain", version: opts.version ?? DEFAULT_VERSION }, {
17000
- instructions: withGeneralInstructions(successorNotice() + `Pipebrain MCP server, bound to the ${apiBindingLabel(apiBaseUrl)} API at ${apiBaseUrl}. Every tool reads and writes THAT environment \u2014 confirm it is the one you intend (a local dev API vs production) before mutating. Tools are namespaced by this server's registration name in .mcp.json (e.g. pipebrain-local:* vs pipebrain:*).
17001
-
17002
- Technical decisions are yours. Inside an approved requirement you choose the design, the libraries, the structure, and the sequencing. Do not ask, do not report the choice, and do not seek ratification for it. Escalate on consequence, not on uncertainty: a choice that changes what a user sees, costs money, or contradicts an approved requirement is filed as a question with the options you propose, and everything else you decide and carry on. A technical choice worth keeping is recorded as a decision record, never as a paragraph.
17003
-
17004
- Every loose end has one destination, and none of them is prose. Anything you notice that is not the work in front of you goes to exactly one of three places: a question, when the operator has to choose; a new issue at triage, when it is real work outside this item\u2019s scope; or nowhere. Drop it unless it clears the bar for one of the first two \u2014 nowhere is the default, and it is the right outcome whenever knowing the thing would change nothing anyone does. Never open a section called notes, caveats, observations, things to know, or next steps in a body or a comment. Filing is the report: an item recorded and then repeated in prose asks the operator to triage it twice.`, orgInstructions2)
16980
+ // A BOUNDED INDEX, not a document container (PIPE-D30). The client truncates this
16981
+ // field at 2KB and shares roughly 4KB across all configured servers, so what goes
16982
+ // here is: which package is speaking (only when the legacy wrapper arms the notice),
16983
+ // which environment this is bound to, the call that returns the binding guidance,
16984
+ // and the three rules whose violation cannot be undone. Everything else comes from
16985
+ // `docs/DOCTRINE.md` and the org's saved texts, on the work-context read.
16986
+ instructions: composeIndex(successorNotice() + banner)
17005
16987
  });
17006
- const registerTool = (name, config3, cb) => server2.registerTool(name, { ...config3, description: decorateDescription(name, config3.description ?? "", orgInstructions2) }, cb);
17007
- registerTool("list_projects", {
16988
+ server2.registerTool("list_projects", {
17008
16989
  description: "List all projects with their key, environments, milestones (token, label, active), and open-issue counts \u2014 the project switcher and workflow entry point (\xA77).",
17009
16990
  // Optional pagination (§9) — bounds mirror list_issues/list_requirements; the
17010
16991
  // server defaults limit to 200 (max 500) and passes limit/offset as query params.
@@ -17012,8 +16993,8 @@ Every loose end has one destination, and none of them is prose. Anything you not
17012
16993
  limit: external_exports.number().int().min(1).max(500).optional(),
17013
16994
  offset: external_exports.number().int().nonnegative().optional()
17014
16995
  }
17015
- }, (args) => run(() => client2.listProjects(args)));
17016
- registerTool("create_project", {
16996
+ }, (args) => run(() => client2.listProjects(args), GUIDANCE_POINTER));
16997
+ server2.registerTool("create_project", {
17017
16998
  description: "Create a new project \u2014 the workflow bootstrap entry point, since issues and requirements are all project-scoped and nothing can be filed until a project exists. Both `name` (its display label) and `key` are required; the key is 2\u20135 uppercase letters (A\u2013Z, e.g. `DWB`), unique per org, and becomes the prefix of every display id in the project. Returns the created project (\xA77).",
17018
16999
  // Inline shape: @pipeline/domain has no standalone create-project schema — the
17019
17000
  // same `{ name, key }` pair lives only inside createOrgInputSchema.project, so
@@ -17024,7 +17005,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17024
17005
  key: projectKeySchema
17025
17006
  }
17026
17007
  }, (args) => run(() => client2.createProject(args)));
17027
- registerTool("list_waiting", {
17008
+ server2.registerTool("list_waiting", {
17028
17009
  description: "Every gate awaiting a PERSON across ALL projects in the token\u2019s org, longest wait first: a requirement revision awaiting approval, a question awaiting an answer, and work in `verify` holding at least one criterion not yet passed. Each entry names its project, the ref the action is taken on (`KEY-R{n}` for a revision, the ISSUE\u2019s `KEY-{n}` for a question or for work at verify), and `waitingSince` \u2014 the instant the wait began, not a duration. Nothing else is a gate: work in `triage` never appears, and neither does work in verify whose criteria have ALL passed. READ-ONLY, and there is no tool on this surface that clears any of the three \u2014 approving a revision, answering a question and marking a manual criterion are all decisions a person takes in the web app. Use it to see what your work is blocked on before asking, rather than to act on it."
17029
17010
  // NO arguments — not even an org. Org scope arrives from the token, exactly as
17030
17011
  // it does for `list_projects`, and an org parameter would open a cross-org read
@@ -17035,18 +17016,47 @@ Every loose end has one destination, and none of them is prose. Anything you not
17035
17016
  // array like the sibling list tools: AC-7 asks that an agent read the SAME set
17036
17017
  // the queue shows, and the two surfaces answering in the same shape is what
17037
17018
  // makes that comparable at a glance.
17038
- run(async () => ({ items: await client2.listWaiting() }))
17019
+ run(async () => ({ items: await client2.listWaiting() }), GUIDANCE_POINTER)
17039
17020
  ));
17040
- registerTool("get_work_context", {
17041
- description: "Everything a session needs before it starts work, in ONE read \u2014 assembled by the API and returned verbatim. Addressed by `issue` OR by `project`, never both and never neither: an issue names its own project, so the pair is refused rather than resolved for you (\xA77). Given an ISSUE: that issue\u2019s full detail \u2014 the same payload `get_issue` returns \u2014 PLUS the BODY TEXT of every requirement it links, AT THE REVISION THE LINK IS PINNED AT. That text is the round trip this removes: `get_issue` names which documents bind the work and at which revision, never what they SAY, so a session that has read the issue still owes one fetch per link \u2014 and the one it skips leaves it building against rules it never read. Comments come CAPPED at the newest `commentLimit`, with `commentCount` \u2014 the issue\u2019s TRUE total \u2014 beside them, so a shortened list reads AS shortened rather than as the whole history; read the issue directly for the rest. Given a PROJECT: `available`, the work a session could START right now. It EXCLUDES finished and abandoned work (`done`, `killed`), work another person has claimed, and anything blocked \u2014 the status guard would refuse to start that, and offering work that cannot be started is offering a refusal. Your OWN claims stay, and so does unscheduled work carrying no milestone. The item form carries no `available`; the project form carries no item. BOTH forms also carry the project half: the release currently being worked (the active milestone) and the project\u2019s cross-cutting requirements WITH their text \u2014 they bind every epic automatically, and each is otherwise a separate call a session can simply forget to make. READ-ONLY \u2014 this claims nothing, moves nothing and writes nothing. CALL IT when you begin a piece of work, or when you pick work up in a project \u2014 the whole pack, once, before you start. Read narrowly the rest of the time; that is the ordinary case and needs no justification.",
17042
- // The WHOLE domain schema rather than its `.shape`: the exactly-one-of rule is a
17043
- // refinement on the OBJECT, and a raw shape drops it — the SDK validates against
17044
- // what it is handed, so the shape alone would quietly accept both arguments and
17045
- // neither. Handing it the schema lets its refusal reach the caller verbatim,
17046
- // naming the two arguments it refused rather than a reworded stand-in.
17047
- inputSchema: getWorkContextInputSchema
17048
- }, (args) => run(() => client2.getWorkContext(args)));
17049
- registerTool("create_milestone", {
17021
+ server2.registerTool(
17022
+ "get_work_context",
17023
+ {
17024
+ // TRIMMED WHEN THE GUIDANCE MOVED HERE (PIPE-341, PIPE-D30). This description was
17025
+ // 1,922 characters against a 2KB cap that truncates silently, and it is now also the
17026
+ // one description loaded into EVERY session by `anthropic/alwaysLoad`. The clauses
17027
+ // that went were the ones arguing for the rule rather than stating it; what a caller
17028
+ // needs to predict a refusal all stayed.
17029
+ description: "Everything a session needs before it starts work, in ONE read \u2014 assembled by the API and returned verbatim, with the BINDING GUIDANCE appended after it: the product doctrine and this organization\u2019s own writing rules, in full. This is the one call that returns them; every other read only names it. CALL IT FIRST, before you write anything. Addressed by `issue` OR by `project`, never both and never neither: an issue names its own project, so the pair is refused rather than resolved for you (\xA77). Given an ISSUE: that issue\u2019s full detail \u2014 the same payload `get_issue` returns \u2014 PLUS the BODY TEXT of every requirement it links, at the revision the link is pinned at. That text is the round trip this removes: `get_issue` names which documents bind the work and at which revision, never what they SAY. Comments come CAPPED at the newest `commentLimit`, with `commentCount` \u2014 the issue\u2019s TRUE total \u2014 beside them; read the issue directly for the rest. Given a PROJECT: `available`, the work a session could START right now. It EXCLUDES finished and abandoned work (`done`, `killed`), work another person has claimed, and anything blocked \u2014 the status guard would refuse to start that. Your OWN claims stay, and so does unscheduled work carrying no milestone. The item form carries no `available`; the project form carries no item. BOTH forms also carry the project half: the release currently being worked (the active milestone) and the project\u2019s cross-cutting requirements WITH their text \u2014 they bind every epic automatically. READ-ONLY \u2014 this claims nothing, moves nothing and writes nothing.",
17030
+ // The WHOLE domain schema rather than its `.shape`: the exactly-one-of rule is a
17031
+ // refinement on the OBJECT, and a raw shape drops it — the SDK validates against
17032
+ // what it is handed, so the shape alone would quietly accept both arguments and
17033
+ // neither. Handing it the schema lets its refusal reach the caller verbatim,
17034
+ // naming the two arguments it refused rather than a reworded stand-in.
17035
+ inputSchema: getWorkContextInputSchema,
17036
+ // THE TWO ANNOTATIONS PIPE-D30 REQUIRES, and the reason each key is spelled out
17037
+ // rather than built: an unknown `_meta` key is IGNORED — no error, no warning — so a
17038
+ // typo leaves the tool silently un-annotated and nothing anywhere goes red.
17039
+ //
17040
+ // maxResultSizeChars — this tool's OWN result threshold, which applies for text
17041
+ // content independently of the operator's `MAX_MCP_OUTPUT_TOKENS`. Declared rather
17042
+ // than inherited: the default caps output at 25,000 tokens and the pack plus the
17043
+ // guidance can exceed that, and the default is a setting this server cannot see.
17044
+ //
17045
+ // alwaysLoad — tool search defers tool definitions until an agent searches for
17046
+ // them, and the one call a session is supposed to make FIRST must not require a
17047
+ // search step to become visible. It is the only tool here that gets it: every
17048
+ // upfront definition is context spent before the conversation starts.
17049
+ _meta: {
17050
+ "anthropic/maxResultSizeChars": WORK_CONTEXT_RESULT_CHARS,
17051
+ "anthropic/alwaysLoad": true
17052
+ }
17053
+ },
17054
+ // THE COMPOSED GUIDANCE RIDES THE RESULT, as a second text block after the API's JSON.
17055
+ // This is the delivery PIPE-D30 chose: a tool result is not subject to the 2KB cap that
17056
+ // cut the previous mechanism to a tenth of the document.
17057
+ (args) => run(() => client2.getWorkContext(args), guidance)
17058
+ );
17059
+ server2.registerTool("create_milestone", {
17050
17060
  description: "Create a milestone on a project. `token` is the short ref issues point at via their `milestone` field (e.g. `M1`) and is unique per project (a duplicate is rejected); `label` is its display name (e.g. `Feature Verification`). Optional `position` orders it (0-based, defaults to last); optional `active` marks it the current milestone \u2014 AT MOST ONE milestone per project is active, so `active: true` transactionally DEMOTES the previously active one rather than failing. Returns the created milestone (\xA77).",
17051
17061
  inputSchema: {
17052
17062
  project: projectKeySchema,
@@ -17056,7 +17066,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17056
17066
  active: external_exports.boolean().optional()
17057
17067
  }
17058
17068
  }, ({ project, ...input }) => run(() => client2.createMilestone(project, input)));
17059
- registerTool("update_milestone", {
17069
+ server2.registerTool("update_milestone", {
17060
17070
  description: "Rename or reorder a milestone, addressed by its token (e.g. `M1`) or uuid. Supply at least one of `token`, `label`, or `position` \u2014 an empty edit is rejected. Renaming the `token` does NOT rewrite issues pointing at the old one (`issues.milestone` is a loose ref), so prefer changing `label`. Use set_active_milestone to change `active` (\xA77).",
17061
17071
  inputSchema: {
17062
17072
  project: projectKeySchema,
@@ -17066,14 +17076,14 @@ Every loose end has one destination, and none of them is prose. Anything you not
17066
17076
  position: external_exports.number().int().nonnegative().optional()
17067
17077
  }
17068
17078
  }, ({ project, milestone, ...fields }) => run(async () => client2.updateMilestone(project, await resolveMilestoneId(client2, project, milestone), fields)));
17069
- registerTool("set_active_milestone", {
17079
+ server2.registerTool("set_active_milestone", {
17070
17080
  description: "Make a milestone the project\u2019s active one, addressed by its token (e.g. `M2`) or uuid. At most one milestone per project is active; this clears the previous one in the same transaction. Returns the activated milestone (\xA77).",
17071
17081
  inputSchema: {
17072
17082
  project: projectKeySchema,
17073
17083
  milestone: external_exports.string().min(1)
17074
17084
  }
17075
17085
  }, ({ project, milestone }) => run(async () => client2.activateMilestone(project, await resolveMilestoneId(client2, project, milestone))));
17076
- registerTool("delete_milestone", {
17086
+ server2.registerTool("delete_milestone", {
17077
17087
  description: "Soft-delete a milestone, addressed by its token (e.g. `M3`) or uuid; its token frees up for reuse. Issues still naming it are NOT rewritten and keep the now-dangling token (`issues.milestone` is a loose ref) \u2014 re-point them first. Returns confirmation metadata only (\xA77).",
17078
17088
  inputSchema: {
17079
17089
  project: projectKeySchema,
@@ -17084,7 +17094,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17084
17094
  await client2.deleteMilestone(project, id);
17085
17095
  return { deleted: true, project, milestone, id };
17086
17096
  }));
17087
- registerTool("create_deliverable_target", {
17097
+ server2.registerTool("create_deliverable_target", {
17088
17098
  description: "Add a deliverable target (platform) to a project. `slug` is the immutable lowercase-alphanumeric machine id a deliverable stores as its platform (e.g. `bsky`, `threads`) and is unique per project; `label` is its display name (e.g. `Bluesky`). Optional `position` orders it (0-based, defaults to last); optional `active` (default true) gates whether new deliverables can target it. Returns the created target.",
17089
17099
  inputSchema: {
17090
17100
  project: projectKeySchema,
@@ -17094,7 +17104,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17094
17104
  active: external_exports.boolean().optional()
17095
17105
  }
17096
17106
  }, ({ project, ...input }) => run(() => client2.createDeliverableTarget(project, input)));
17097
- registerTool("update_deliverable_target", {
17107
+ server2.registerTool("update_deliverable_target", {
17098
17108
  description: "Update a deliverable target, addressed by its slug (e.g. `bsky`) or uuid. Supply at least one of `label`, `position`, or `active` \u2014 an empty edit is rejected. The `slug` is immutable (it is the value stored on existing deliverables). Set `active: false` to remove it from the add-deliverable menu while keeping existing deliverables working.",
17099
17109
  inputSchema: {
17100
17110
  project: projectKeySchema,
@@ -17104,7 +17114,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17104
17114
  active: external_exports.boolean().optional()
17105
17115
  }
17106
17116
  }, ({ project, target, ...fields }) => run(async () => client2.updateDeliverableTarget(project, await resolveDeliverableTargetId(client2, project, target), fields)));
17107
- registerTool("delete_deliverable_target", {
17117
+ server2.registerTool("delete_deliverable_target", {
17108
17118
  description: "Delete a deliverable target, addressed by its slug (e.g. `bsky`) or uuid. Only a target with NO deliverables can be deleted; one already in use is rejected (deactivate it with update_deliverable_target instead). Returns confirmation metadata only.",
17109
17119
  inputSchema: {
17110
17120
  project: projectKeySchema,
@@ -17115,7 +17125,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17115
17125
  await client2.deleteDeliverableTarget(project, id);
17116
17126
  return { deleted: true, project, target, id };
17117
17127
  }));
17118
- registerTool(
17128
+ server2.registerTool(
17119
17129
  "list_issues",
17120
17130
  {
17121
17131
  description: `List issue summaries (display id, title, type, status, terminal, blocked, priority, milestone, claimer, criteria progress, updated_at) filtered by project, environment, status[], type[], claimedBy (me/unclaimed/uuid), priority[], milestone, text (title+body), parent, and blocked (\xA77). DEFAULT: with no status filter this returns BUILDABLE work only \u2014 ${OPEN_STATUSES.join(", ")}. Terminal work (done, killed) is excluded unless you ask for it by name: pass status explicitly, e.g. status: ["done","killed"] for finished and abandoned work, or list every value to see everything. An explicit status filter is used verbatim and the default is not merged into it. Every row also carries \`terminal\` (PIPE-R15 r4 rule 5). blocked: false returns only work with nothing blocking it, and every issue it returns can be moved to ready without refusal; blocked: true returns only blocked work.`,
@@ -17129,73 +17139,73 @@ Every loose end has one destination, and none of them is prose. Anything you not
17129
17139
  // API-level default would strip out the very rows those chips exist to reveal.
17130
17140
  // Only an OMITTED status is filled in — an explicit one, terminal values and
17131
17141
  // all, passes through untouched.
17132
- (args) => run(() => client2.listIssues(args.status === void 0 ? { ...args, status: [...OPEN_STATUSES] } : args))
17142
+ (args) => run(() => client2.listIssues(args.status === void 0 ? { ...args, status: [...OPEN_STATUSES] } : args), GUIDANCE_POINTER)
17133
17143
  );
17134
- registerTool("get_issue", {
17135
- description: "Full issue detail by display id or uuid: body, criteria (states, modes, evidence), explicit requirement links (pinned revision + staleness), the project\u2019s cross-cutting requirements at their latest approved revision, children, and comments (\xA77). Carries `terminal`: true when the issue is finished (`done`) or deliberately abandoned (`killed`) and is therefore NOT buildable work \u2014 check it before acting on an issue you were handed by key. Cross-cutting requirements bind every epic automatically and arrive with this payload at their latest approved revision \u2014 never restate them in a body; explicit requirement links pin the approved revision, so link by key rather than pasting a document\u2019s text. Reading criterion state: `state_evidence` is required only when a TOKEN sets one, so a `manual` criterion \u2014 settable only from a web session \u2014 carries none by design, and the attribution the server already stores (who set it, and when) IS its record. Absent evidence there is the human gate working rather than a gap: do not report it as a finding, do not call the criterion unverified or unevidenced, and do not weigh it below an `auto` criterion that carries evidence. What this payload tells you about ANOTHER issue goes stale. Reference that issue by key and say what you need from it; never restate its status, its criteria, or whether those criteria passed \u2014 such a sentence is true when written and wrong later, and a terminal issue is never revisited to correct it, so the stale reading is what the next reader inherits.",
17144
+ server2.registerTool("get_issue", {
17145
+ description: "Full issue detail by display id or uuid: body, criteria (states, modes, evidence), explicit requirement links (pinned revision + staleness), the project\u2019s cross-cutting requirements at their latest approved revision, children, and comments (\xA77). Carries `terminal`: true when the issue is finished (`done`) or deliberately abandoned (`killed`) and is therefore NOT buildable work \u2014 check it before acting on an issue you were handed by key. Reading criterion state: `state_evidence` is required only when a TOKEN sets one, so a `manual` criterion \u2014 settable only from a web session \u2014 carries none by design, and the attribution the server already stores (who set it, and when) IS its record. What this payload tells you about ANOTHER issue goes stale. Reference that issue by key and say what you need from it; never restate its status, its criteria, or whether those criteria passed \u2014 such a sentence is true when written and wrong later, and a terminal issue is never revisited to correct it, so the stale reading is what the next reader inherits.",
17136
17146
  inputSchema: { issue: issueRefSchema }
17137
- }, (args) => run(() => client2.getIssue(args.issue)));
17138
- registerTool("create_issue", {
17139
- description: 'Create an issue (epic/task/bug/feedback). Omitted status defaults to triage (still subject to \xA76 guards); omitted environment resolves explicit \u2192 parent\u2019s environment \u2192 project default (prod). Optional parent (self/cycle rejected), priority, milestone, requirement_links (pins each at its approved revision; a target with no approved revision is rejected), deliverable_links (content deliverables like DWB-C3/bsky \u2014 pins each at its current revision; the promotion path), and ordered {text, verification, howTo} criteria (\xA77). A `status` other than `triage` or `killed` REQUIRES `milestone` (PIPE-R10 rule 9): work past triage belongs to a release, and the create is refused (`milestone_required`) without one. Search before you create: `list_issues` takes a `text` filter \u2014 run it on the distinctive nouns first. Sessions do not see each other, so a duplicate is invisible until someone finds both; on a near match, comment or amend the existing record rather than filing again. The bar for filing a bug: file `type: bug` only when the observed behavior breaks an approved requirement or a defined acceptance criterion, and name which one before you file. If you cannot name one, this is not a bug \u2014 code you find unclear, an edge case nobody specified, a performance number nobody set, and anything you would phrase as "this could be better" are opinions about the product, so file each as `type: feedback`, or not at all. The bar exists because a queue holding both real defects and unshared taste has to be read entirely before any of it can be trusted. When the criterion you named is an acceptance criterion, pass its uuid as `criterionId` and the bug records which criterion it was filed against \u2014 the criterion then names what has already been reported (it arrives as `filedBugs` on every criteria read) beside the action that files again, so a duplicate is prevented by information rather than by removal. Filing a second bug against one criterion is a supported situation, not a mistake: one row can fail for two different reasons at once. Bugs only: any other type naming a criterion is refused (`criterion_requires_bug`). Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built. A decision you need from the operator is filed as a question via `ask_questions`, never written as an "Open questions" heading inside a body \u2014 a heading prompts nobody and records no answer, so a later session cannot tell whether the decision was made. Before assigning any verification mode, establish what this project can drive end to end \u2014 an end-to-end test harness and the command that runs it. A criterion is `auto` when an evaluator can drive the input and read the result against the running system, which includes behavior shown in the interface wherever such a harness exists; the mode follows from what can be driven, not from where the behavior appears. What qualifies a criterion as `auto` is the evaluator\u2019s own run, never the existence of a test the implementer wrote. Mark `manual` only when the verdict needs a person\u2019s judgment; a criterion you cannot describe as drivable is usually worded too vaguely, so reword it against the observable rather than fall back to a person. A `manual` criterion must also carry `howTo` \u2014 one or two sentences, not an essay, saying where to look, what to do, and what counts as passing for whoever checks it by hand. Writing or changing one without it is refused (`how_to_required`); so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug \u2014 because what they answer is how anyone knows the thing is done, and that question does not get easier as the work gets smaller; feedback is the one exception, refused with `criteria_not_supported`, because it is a report rather than agreed work and `promote_feedback` retypes it into work before anything is built. Cross-cutting requirements bind every epic automatically and arrive with `get_issue` \u2014 never restate them in a body and never add them to `requirement_links`; an explicit link pins the linked document\u2019s approved revision.',
17147
+ }, (args) => run(() => client2.getIssue(args.issue), GUIDANCE_POINTER));
17148
+ server2.registerTool("create_issue", {
17149
+ description: "Create an issue (epic/task/bug/feedback). Omitted status defaults to triage (still subject to \xA76 guards); omitted environment resolves explicit \u2192 parent\u2019s environment \u2192 project default (prod). Optional parent (self/cycle rejected), priority, milestone, requirement_links (pins each at its approved revision; a target with no approved revision is rejected), deliverable_links (content deliverables like DWB-C3/bsky \u2014 pins each at its current revision; the promotion path), and ordered {text, verification, howTo} criteria (\xA77). A `status` other than `triage` or `killed` REQUIRES `milestone` (PIPE-R10 rule 9): work past triage belongs to a release, and the create is refused (`milestone_required`) without one. A `manual` criterion must carry `howTo` \u2014 one or two sentences saying where to look, what to do, and what counts as passing; writing or changing one without it is refused (`how_to_required`), and so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug alike \u2014 with feedback the one exception, refused with `criteria_not_supported` because it is a report rather than agreed work; `promote_feedback` retypes it into work before anything is built. When a bug is filed against a defined acceptance criterion, pass that criterion\u2019s uuid as `criterionId` and the bug records which criterion it was filed against \u2014 the criterion then names what has already been reported (it arrives as `filedBugs` on every criteria read) beside the action that files again, so a duplicate is prevented by information rather than by removal. Filing a second bug against one criterion is a supported situation, not a mistake: one row can fail for two different reasons at once. Bugs only: any other type naming a criterion is refused (`criterion_requires_bug`). Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSearch before you create\u201D and \u201CThe bar for filing a bug\u201D.",
17140
17150
  inputSchema: createIssueInputSchema.shape
17141
17151
  }, (args) => run(() => client2.createIssue(args)));
17142
- registerTool("promote_feedback", {
17143
- description: 'Promote a FEEDBACK issue into a NEW epic or task (PIPE-143): creates the issue in the feedback\u2019s project (`title` + `type` required; omitted environment inherits the FEEDBACK\u2019s environment, not the project default; optional status/body/priority/milestone/requirement_links/criteria as in create_issue), records the feedback as its permanent source (`promotedFrom`/`promotedTo` on both details), closes the feedback as done, and comments the new key on it. The feedback\u2019s own title/body are never touched \u2014 write the new issue\u2019s body as real work, do not paste the feedback in. Rejected (409) for non-feedback, terminal, or already-promoted sources. Returns the created issue. A `status` other than `triage` or `killed` REQUIRES `milestone` (PIPE-R10 rule 9), exactly as in create_issue; the SOURCE feedback needs none to be closed by the promotion. Search before you promote: `list_issues` takes a `text` filter \u2014 run it on the feedback\u2019s distinctive nouns first; an issue covering it may already exist, and sessions do not see each other. On a near match, comment on or amend the existing issue rather than promoting a duplicate. The bar for promoting to a bug: choose `type: bug` only when the reported behavior breaks an approved requirement or a defined acceptance criterion, and name which one. If you cannot name one, promote it as `task` \u2014 or leave it as feedback. A queue holding both real defects and unshared taste has to be read entirely before any of it can be trusted. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built. A decision you need from the operator is filed as a question via `ask_questions`, never written as an "Open questions" heading inside a body \u2014 a heading prompts nobody and records no answer, so a later session cannot tell whether the decision was made. Before assigning any verification mode, establish what this project can drive end to end \u2014 an end-to-end test harness and the command that runs it. A criterion is `auto` when an evaluator can drive the input and read the result against the running system, which includes behavior shown in the interface wherever such a harness exists; the mode follows from what can be driven, not from where the behavior appears. What qualifies a criterion as `auto` is the evaluator\u2019s own run, never the existence of a test the implementer wrote. Mark `manual` only when the verdict needs a person\u2019s judgment; a criterion you cannot describe as drivable is usually worded too vaguely, so reword it against the observable rather than fall back to a person. A `manual` criterion must also carry `howTo` \u2014 one or two sentences, not an essay, saying where to look, what to do, and what counts as passing for whoever checks it by hand. Writing or changing one without it is refused (`how_to_required`); so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug \u2014 because what they answer is how anyone knows the thing is done, and that question does not get easier as the work gets smaller; feedback is the one exception, refused with `criteria_not_supported`, because it is a report rather than agreed work and `promote_feedback` retypes it into work before anything is built. Cross-cutting requirements bind every epic automatically and arrive with `get_issue` \u2014 never restate them in a body and never add them to `requirement_links`; an explicit link pins the linked document\u2019s approved revision.',
17152
+ server2.registerTool("promote_feedback", {
17153
+ description: "Promote a FEEDBACK issue into a NEW epic or task (PIPE-143): creates the issue in the feedback\u2019s project (`title` + `type` required; omitted environment inherits the FEEDBACK\u2019s environment, not the project default; optional status/body/priority/milestone/requirement_links/criteria as in create_issue), records the feedback as its permanent source (`promotedFrom`/`promotedTo` on both details), closes the feedback as done, and comments the new key on it. The feedback\u2019s own title/body are never touched \u2014 write the new issue\u2019s body as real work. Rejected (409) for non-feedback, terminal, or already-promoted sources. Returns the created issue. A `status` other than `triage` or `killed` REQUIRES `milestone` (PIPE-R10 rule 9), exactly as in create_issue; the SOURCE feedback needs none to be closed by the promotion. A `manual` criterion must carry `howTo` \u2014 one or two sentences saying where to look, what to do, and what counts as passing; writing or changing one without it is refused (`how_to_required`), and so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug alike \u2014 with feedback the one exception, refused with `criteria_not_supported` because it is a report rather than agreed work; this tool is what retypes it into work before anything is built. Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSearch before you create\u201D and \u201CThe bar for filing a bug\u201D.",
17144
17154
  inputSchema: {
17145
17155
  issue: external_exports.string().min(1),
17146
17156
  ...promoteFeedbackInputSchema.shape
17147
17157
  }
17148
17158
  }, ({ issue: issue2, ...fields }) => run(() => client2.promoteFeedback(issue2, fields)));
17149
- registerTool("open_review", {
17150
- description: "Open the COMPLETION REVIEW \u2014 the reading of an epic\u2019s WHOLE accumulated change as one body of work, by a third fresh session that neither built it nor evaluated it. It runs at one moment: once the epic\u2019s contract is green and nothing is left to check, and before anyone sets it `done`. It creates one ORDINARY `task` at `ready` carrying the review checklist as its body \u2014 no new record type. The epic form (`epic`) titles it `Completion review \u2014 <KEY-n> <epic title>`, files it as a CHILD of the epic and inherits the epic\u2019s milestone; the milestone form (`project` + `milestone`) titles it `Completion review \u2014 milestone <token>`, carries that token and has no parent \u2014 nothing here models a milestone as complete. Pass EXACTLY ONE of `epic` or `project` + `milestone`: both, or neither, is refused. One review at a time per scope \u2014 a second is refused (`review_already_open`) NAMING the standing one, so read, finish or kill that task instead \u2014 and a review opens only on an epic (`review_target_not_epic`). NO NEW GATE was added to `done`, and the whole mechanism depends on that: file each finding as ordinary work \u2014 a CHILD OF THE EPIC, a sibling of this review \u2014 and the children clause already on `done` holds the epic open until every finding is done or killed. A finding filed UNDER the review gates nothing, because that gate reads one level deep. Killing the review, or any finding, is the recorded waiver: deliberately ungated, and written to the status history with who did it and through which token. An epic that never opened a review still closes exactly as it did before.",
17159
+ server2.registerTool("open_review", {
17160
+ description: "Open the COMPLETION REVIEW \u2014 the reading of an epic\u2019s WHOLE accumulated change as one body of work, by a third fresh session that neither built it nor evaluated it. It runs at one moment: once the epic\u2019s contract is green and nothing is left to check, and before anyone sets it `done`. It creates one ORDINARY `task` at `ready` carrying the review checklist as its body \u2014 no new record type. The epic form (`epic`) titles it `Completion review \u2014 <KEY-n> <epic title>`, files it as a CHILD of the epic and inherits the epic\u2019s milestone; the milestone form (`project` + `milestone`) titles it `Completion review \u2014 milestone <token>`, carries that token and has no parent \u2014 nothing here models a milestone as complete. Pass EXACTLY ONE of `epic` or `project` + `milestone`: both, or neither, is refused. One review at a time per scope \u2014 a second is refused (`review_already_open`) NAMING the standing one, so read, finish or kill that task instead \u2014 and a review opens only on an epic (`review_target_not_epic`). NO NEW GATE was added to `done`, and the whole mechanism depends on that: file each finding as ordinary work \u2014 a CHILD OF THE EPIC, a sibling of this review \u2014 and the children clause already on `done` holds the epic open until every finding is done or killed. A finding filed UNDER the review gates nothing, because that gate reads one level deep. Killing the review, or any finding, is the recorded waiver: deliberately ungated, and written to the status history with who did it and through which token. An epic that never opened a review still closes exactly as it did before. Writing guidance for the checklist and for each finding lives in the product doctrine, which `get_work_context` returns.",
17151
17161
  // The WHOLE domain schema rather than its `.shape`, for `get_work_context`'s
17152
17162
  // reason: the exactly-one-of rule is a refinement on the OBJECT, and a raw
17153
17163
  // shape drops it — the refusal naming the two forms would never reach the
17154
17164
  // caller, and both arguments (or neither) would be accepted here.
17155
17165
  inputSchema: openReviewInputSchema
17156
17166
  }, (args) => run(() => client2.openReview(args)));
17157
- registerTool("update_issue", {
17158
- description: 'Update any subset of an issue\u2019s title, body, type, priority, milestone, environment, parent (self/cycle rejected), requirement_links (add/remove; adding a link to an unapproved requirement is rejected), deliverable_links (add/remove content-deliverable links, add pins at the current revision), or decision_links (add/remove decision records this work sits under \u2014 `KEY-D{n}`, from `list_decisions`). Changing type to `feedback` is rejected while the issue has criteria (\xA77), since feedback carries none; epic, task and bug interchange freely and the criteria ride along, keeping their AC-{n} numbers and their states. Clearing `milestone` (passing null) is rejected while the issue sits past `triage` \u2014 work already scheduled keeps a milestone (PIPE-R10 rule 9); swap it for a different one, or move the issue back to `triage` first. Cite the decision record a piece of work implements rather than restating what was decided in its body: the record is where the reasoning stays correct, and a body repeating it goes stale the moment the decision is superseded. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built. A decision you need from the operator is filed as a question via `ask_questions`, never written as an "Open questions" heading inside a body \u2014 a heading prompts nobody and records no answer, so a later session cannot tell whether the decision was made. Cross-cutting requirements bind every epic automatically and arrive with `get_issue` \u2014 never restate them in a body and never add them to `requirement_links`; an explicit link pins the linked document\u2019s approved revision.',
17167
+ server2.registerTool("update_issue", {
17168
+ description: "Update any subset of an issue\u2019s title, body, type, priority, milestone, environment, parent (self/cycle rejected), requirement_links (add/remove; adding a link to an unapproved requirement is rejected), deliverable_links (add/remove content-deliverable links, add pins at the current revision), or decision_links (add/remove decision records this work sits under \u2014 `KEY-D{n}`, from `list_decisions`). Changing type to `feedback` is rejected while the issue has criteria (\xA77), since feedback carries none; epic, task and bug interchange freely and the criteria ride along, keeping their AC-{n} numbers and their states. Clearing `milestone` (passing null) is rejected while the issue sits past `triage` \u2014 work already scheduled keeps a milestone (PIPE-R10 rule 9); swap it for a different one, or move the issue back to `triage` first. Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CLink by key; never paste another record\u2019s text\u201D and \u201CA decision you need is filed as a question, never written into a body\u201D.",
17159
17169
  inputSchema: updateIssueInputSchema.shape
17160
17170
  }, ({ issue: issue2, ...fields }) => run(() => client2.updateIssue(issue2, fields)));
17161
- registerTool("set_status", {
17171
+ server2.registerTool("set_status", {
17162
17172
  description: "Set an issue\u2019s status; the \xA76 guards apply and a guard failure returns the specific reason, naming the rows it refused on (\xA77). The criteria gates read whatever criteria the issue carries, whatever its type: verify needs every auto criterion passed, done needs every criterion passed. ONE guard remains EPIC-ONLY, and the asymmetry is the rule rather than an oversight \u2014 an epic that has stated NO criteria is refused at both gates, because an empty list would clear them having committed to nothing, while a task or a bug carrying none moves through both untouched (most work is stated adequately by its body). `done` additionally requires every child of the issue being closed to be terminal \u2014 an epic, a task and a bug alike \u2014 read from each child\u2019s STATUS and never from its criteria. A BLOCKED issue \u2014 one carrying an explicit mark or waiting on a blocker that is not yet `done`/`killed` \u2014 cannot move to `ready` or `in_progress`, and the refusal names the reason and every unresolved blocker, so clear the mark (`clear_blocked`) or finish, kill or `unlink_blocker` each blocker first; every other target still moves while blocked. An issue with NO milestone cannot move to any status but `triage` and `killed` (PIPE-R10 rule 9) \u2014 set one with `update_issue` first; `killed` is exempt, so work nobody scheduled can still be abandoned.",
17163
17173
  inputSchema: setStatusInputSchema.shape
17164
17174
  }, (args) => run(() => client2.setStatus(args.issue, args.status)));
17165
- registerTool("claim_issue", {
17175
+ server2.registerTool("claim_issue", {
17166
17176
  description: "Atomically claim an issue (\xA76 rule 1): succeeds only if unclaimed; under a race exactly one wins and the loser\u2019s error names the current claimer. Claim is orthogonal to status (\xA77).",
17167
17177
  inputSchema: { issue: issueRefSchema }
17168
17178
  }, (args) => run(() => client2.claimIssue(args.issue)));
17169
- registerTool("release_issue", {
17179
+ server2.registerTool("release_issue", {
17170
17180
  description: "Release an issue\u2019s claim, clearing claimed_by (\xA77).",
17171
17181
  inputSchema: { issue: issueRefSchema }
17172
17182
  }, (args) => run(() => client2.releaseIssue(args.issue)));
17173
- registerTool("add_comment", {
17174
- description: "Add a markdown comment to an issue, attributed to the operator (and token label over MCP). A comment EXPLAINS a blockage \u2014 the full account of what you hit and why you stopped \u2014 but never records one: `set_blocked` (with a reason) and `link_blocker` (when you are waiting on another issue) are what put an issue in the blocked state (\xA77/WORKFLOW).",
17183
+ server2.registerTool("add_comment", {
17184
+ description: "Add a markdown comment to an issue, attributed to the operator (and token label over MCP). A comment EXPLAINS a blockage \u2014 the full account of what you hit and why you stopped \u2014 but never records one: `set_blocked` (with a reason) and `link_blocker` (when you are waiting on another issue) are what put an issue in the blocked state (\xA77/WORKFLOW). Writing guidance for a comment lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CEvery loose end has one destination, and none of them is prose\u201D.",
17175
17185
  inputSchema: commentInputSchema.shape
17176
17186
  }, (args) => run(() => client2.addComment(args.issue, args.body)));
17177
- registerTool("set_blocked", {
17178
- description: "Record an issue as BLOCKED with a required human-readable `reason` \u2014 state on the issue, not a comment: it shows on the issue and counts on the project\u2019s Work page, and only clearing it (`clear_blocked`) ends it. Setting it again on an already-blocked issue replaces the standing reason and keeps the old one as history, attributed to whoever set it. The reason is one or two lines saying what the work is waiting on; the full account of what you tried still belongs in a comment. Returns the updated issue detail, whose `blocked` carries the reason and who set it.",
17187
+ server2.registerTool("set_blocked", {
17188
+ description: "Record an issue as BLOCKED with a required human-readable `reason` \u2014 state on the issue, not a comment: it shows on the issue and counts on the project\u2019s Work page, and only clearing it (`clear_blocked`) ends it. Setting it again on an already-blocked issue replaces the standing reason and keeps the old one as history, attributed to whoever set it. The reason is one or two lines saying what the work is waiting on; the full account of what you tried still belongs in a comment. Returns the updated issue detail, whose `blocked` carries the reason and who set it. Writing guidance for the reason lives in the product doctrine, which `get_work_context` returns.",
17179
17189
  inputSchema: setBlockedInputSchema.shape
17180
17190
  }, (args) => run(() => client2.setBlocked(args.issue, args.reason)));
17181
- registerTool("clear_blocked", {
17191
+ server2.registerTool("clear_blocked", {
17182
17192
  description: "Clear an issue\u2019s blocked mark \u2014 the blockage is over. Idempotent: clearing an issue that is not blocked is a no-op, not an error. The cleared mark is kept as history with who ended it, so a past blockage stays readable. Returns the updated issue detail (`blocked` is then null).",
17183
17193
  inputSchema: { issue: issueRefSchema }
17184
17194
  }, (args) => run(() => client2.clearBlocked(args.issue)));
17185
- registerTool("link_blocker", {
17195
+ server2.registerTool("link_blocker", {
17186
17196
  description: "Record that `issue` is WAITING ON `blocker` \u2014 the dependency between two issues, written from the waiting issue\u2019s side. One call records both directions: `get_issue` on the waiting issue lists it under `blockedBy` (with the blocker\u2019s display id, title, and whether it is already `done`/`killed`), and `get_issue` on the blocker lists it under `blocks`, so finishing work shows what it frees. Both issues must be in the SAME project. An issue cannot block itself, and an edge that would close a cycle (directly or through other issues) is refused with nothing recorded. Adding the same blocker twice records no second edge. Returns the waiting issue\u2019s updated detail.",
17187
17197
  inputSchema: linkBlockerInputSchema.shape
17188
17198
  }, (args) => run(() => client2.addBlocker(args.issue, args.blocker)));
17189
- registerTool("unlink_blocker", {
17199
+ server2.registerTool("unlink_blocker", {
17190
17200
  description: "Remove the blocked-by edge between `issue` and `blocker` \u2014 the dependency is gone, and one call clears it from BOTH issues\u2019 views. Idempotent: unlinking a pair that is not linked is a no-op, not an error. Returns the waiting issue\u2019s updated detail.",
17191
17201
  inputSchema: linkBlockerInputSchema.shape
17192
17202
  }, (args) => run(() => client2.removeBlocker(args.issue, args.blocker)));
17193
- registerTool("set_criteria", {
17194
- description: "Define or replace the ordered acceptance criteria list ({text, verification, howTo}) on a piece of work. Matched rows keep their stable AC-{n} number; new items get fresh never-reused numbers; removed items are soft-deleted. A matched row keeps its state only when BOTH its text and verification mode are unchanged \u2014 a mode flip resets it to pending (\xA77). Before assigning any verification mode, establish what this project can drive end to end \u2014 an end-to-end test harness and the command that runs it. A criterion is `auto` when an evaluator can drive the input and read the result against the running system, which includes behavior shown in the interface wherever such a harness exists; the mode follows from what can be driven, not from where the behavior appears. What qualifies a criterion as `auto` is the evaluator\u2019s own run, never the existence of a test the implementer wrote. Mark `manual` only when the verdict needs a person\u2019s judgment; a criterion you cannot describe as drivable is usually worded too vaguely, so reword it against the observable rather than fall back to a person. A `manual` criterion must also carry `howTo` \u2014 one or two sentences, not an essay, saying where to look, what to do, and what counts as passing for whoever checks it by hand. Writing or changing one without it is refused (`how_to_required`); so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug \u2014 because what they answer is how anyone knows the thing is done, and that question does not get easier as the work gets smaller; feedback is the one exception, refused with `criteria_not_supported`, because it is a report rather than agreed work and `promote_feedback` retypes it into work before anything is built. An evaluator RAISES a criterion from `manual` to `auto` only on a drive that actually succeeded \u2014 never on one it expects to succeed \u2014 and never lowers one. The flip both resets the state and clears the stored `howTo`, so a criterion moved to `auto` has lost its checking instructions \u2014 moving it back to `manual` does not restore them, and is refused (`how_to_required`) until you write new ones.",
17203
+ server2.registerTool("set_criteria", {
17204
+ description: "Define or replace the ordered acceptance criteria list ({text, verification, howTo}) on a piece of work. Matched rows keep their stable AC-{n} number; new items get fresh never-reused numbers; removed items are soft-deleted. A matched row keeps its state only when BOTH its text and verification mode are unchanged \u2014 a mode flip resets it to pending (\xA77). A `manual` criterion must carry `howTo` \u2014 one or two sentences saying where to look, what to do, and what counts as passing; writing or changing one without it is refused (`how_to_required`), and so is supplying it on an `auto` criterion, which a machine checks. Work of any kind carries criteria \u2014 an epic, a task, a bug alike \u2014 with feedback the one exception, refused with `criteria_not_supported` because it is a report rather than agreed work; `promote_feedback` retypes it into work before anything is built. Raising a criterion from `manual` to `auto` both resets its state and clears the stored `howTo`, so a criterion moved to `auto` has lost its checking instructions \u2014 moving it back to `manual` does not restore them, and is refused (`how_to_required`) until you write new ones. Writing guidance for a criterion, and for choosing its mode, lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CVerification modes follow what can be driven\u201D.",
17195
17205
  inputSchema: setCriteriaInputSchema.shape
17196
17206
  }, (args) => run(() => client2.setCriteria(args.issue, args.criteria)));
17197
- registerTool("set_criterion_state", {
17198
- description: "Set a criterion\u2019s state (pending/passed/failed) on whatever work carries it \u2014 an epic, a task and a bug alike \u2014 addressed by criterionId ALONE, or by issue + criterionNumber (the stable AC-{n}); exactly one form. Feedback never carries criteria, so neither address resolves to one. A token-authenticated call is REJECTED on a manual criterion (manual state is web-session-only, \xA74); evidence is required when a token marks passed/failed (\xA77).",
17207
+ server2.registerTool("set_criterion_state", {
17208
+ description: "Set a criterion\u2019s state (pending/passed/failed) on whatever work carries it \u2014 an epic, a task and a bug alike \u2014 addressed by criterionId ALONE, or by issue + criterionNumber (the stable AC-{n}); exactly one form. Feedback never carries criteria, so neither address resolves to one. A token-authenticated call is REJECTED on a manual criterion (manual state is web-session-only, \xA74); evidence is required when a token marks passed/failed (\xA77). Writing guidance for that evidence lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CVerification modes follow what can be driven\u201D.",
17199
17209
  // `issue` is OPTIONAL: the criterionId-only form needs no issue ref. The
17200
17210
  // exactly-one-of rule can't be expressed in a raw shape, so the handler
17201
17211
  // enforces it via the shared `@pipeline/domain` refine (mirror of §7).
@@ -17225,28 +17235,28 @@ Every loose end has one destination, and none of them is prose. Anything you not
17225
17235
  evidence: input.evidence
17226
17236
  });
17227
17237
  }));
17228
- registerTool("ask_questions", {
17229
- description: 'Ask the operator a BATCH of questions on an issue \u2014 `questions` takes 1 or more {text, options?}, and a session with one open decision usually has two or three, so ask them in ONE call rather than one at a time (a half-asked set costs the operator a second pass). `options` are the choices you propose, in the order you offer them; omit it to ask in open words. Each question gets a stable per-issue `Q-{n}` number that is NEVER reused, so an answer stays addressable in a later session. Returns the updated issue detail, and every issue read from then on carries `questions` with their answers \u2014 so read the answer in the `get_issue` you were going to make anyway, and READ the existing questions and answers BEFORE asking again rather than re-asking a decision already taken. Answering is reserved for a person in the web UI: there is deliberately no tool for it on this surface (PIPE-R22 rule 4). A decision you need from the operator is filed HERE, never written as an "Open questions" heading inside an issue body \u2014 a heading prompts nobody and records no answer, so a later session cannot tell whether the decision was made. Withdraw any question your own work has since settled, with `withdraw_question` \u2014 an open question the work already answered still asks the operator to decide something nobody is waiting on.',
17238
+ server2.registerTool("ask_questions", {
17239
+ description: "Ask the operator a BATCH of questions on an issue \u2014 `questions` takes 1 or more {text, options?}, and a session with one open decision usually has two or three, so ask them in ONE call rather than one at a time (a half-asked set costs the operator a second pass). `options` are the choices you propose, in the order you offer them; omit it to ask in open words. Each question gets a stable per-issue `Q-{n}` number that is NEVER reused. Returns the updated issue detail, and every issue read from then on carries `questions` with their answers \u2014 so read the answer in the `get_issue` you were going to make anyway, and READ the existing questions and answers BEFORE asking again rather than re-asking a decision already taken. Answering is reserved for a person in the web UI: there is deliberately no tool for it on this surface (PIPE-R22 rule 4). A question is withdrawn with `withdraw_question`. Writing guidance for a question lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CA decision you need is filed as a question, never written into a body\u201D.",
17230
17240
  inputSchema: askQuestionsInputSchema.shape
17231
17241
  }, (args) => run(() => client2.askQuestions(args.issue, args.questions)));
17232
- registerTool("withdraw_question", {
17242
+ server2.registerTool("withdraw_question", {
17233
17243
  description: "Withdraw a question by its stable `Q-{n}` number \u2014 asker only: the asker is the token\u2019s OWNING user, so another agent\u2019s question is not yours to clear. Deliberately NOT human-gated, because the point is to clear a question you no longer need \u2014 the work answered it, or it was wrong to ask \u2014 instead of leaving the operator to answer something nobody is waiting on. It is recorded, never an answer: the question is soft-deleted (kept for the audit trail), its number retires and is not reissued, and the next issue read no longer carries it in `questions`. Returns the updated issue detail.",
17234
17244
  inputSchema: withdrawQuestionInputSchema.shape
17235
17245
  }, (args) => run(() => client2.withdrawQuestion(args.issue, args.number)));
17236
- registerTool("list_requirements", {
17246
+ server2.registerTool("list_requirements", {
17237
17247
  description: "List requirements filtered by project and text: display id, title, summary (the latest revision\u2019s one/two-line outline description), area (product-area label), cross_cutting flag, lifecycle (draft/approved/amended), latest + approved revision numbers, and linked-epic count (\xA77).",
17238
17248
  inputSchema: listRequirementsFilterSchema.shape
17239
- }, (args) => run(() => client2.listRequirements(args)));
17240
- registerTool("get_requirement", {
17249
+ }, (args) => run(() => client2.listRequirements(args), GUIDANCE_POINTER));
17250
+ server2.registerTool("get_requirement", {
17241
17251
  description: "Get a requirement by display id or uuid. Defaults to the approved revision (latest if never approved) unless `revision` is given; includes lifecycle, revision list, approvals, and linked issues (\xA77).",
17242
17252
  inputSchema: { requirement: requirementRefSchema, revision: positiveIntSchema.optional() }
17243
- }, (args) => run(() => client2.getRequirement(args.requirement, args.revision)));
17244
- registerTool("create_requirement", {
17245
- description: 'Create a project-scoped requirement document with revision 1 (title, body). Optional summary is a short one/two-line outline description (versioned on the revision, like title/body); optional area is a free-text product-area label ("Backup", "Billing") used to group/filter the outline (metadata, like cross_cutting). Optional cross_cutting flags it as binding every epic in the project automatically \u2014 never link cross-cutting documents (\xA75 rule 6, \xA77). Search before you create: `list_requirements` takes a `text` filter \u2014 run it on the distinctive nouns first. Sessions do not see each other, so a duplicate is invisible until someone finds both; on a near match, amend the existing document rather than filing again. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built.',
17253
+ }, (args) => run(() => client2.getRequirement(args.requirement, args.revision), GUIDANCE_POINTER));
17254
+ server2.registerTool("create_requirement", {
17255
+ description: 'Create a project-scoped requirement document with revision 1 (title, body). Optional summary is a short one/two-line outline description (versioned on the revision, like title/body); optional area is a free-text product-area label ("Backup", "Billing") used to group/filter the outline (metadata, like cross_cutting). Optional cross_cutting flags it as binding every epic in the project automatically \u2014 never link cross-cutting documents (\xA75 rule 6, \xA77). Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSearch before you create\u201D and \u201CLink by key; never paste another record\u2019s text\u201D.',
17246
17256
  inputSchema: createRequirementInputSchema.shape
17247
17257
  }, (args) => run(() => client2.createRequirement(args)));
17248
- registerTool("update_requirement", {
17249
- description: "Update a requirement: title, body, and/or summary APPENDS a new revision (nothing is edited in place; summary versions like title/body); optional note records why. Optional area (product-area label), cross_cutting, and decision_links (add/remove decision records this rule sits under \u2014 `KEY-D{n}`, from `list_decisions`) are metadata changes (no revision) \u2014 toggling cross_cutting ON is rejected while explicit links exist; unlink first. Supplying none of title/body/summary/area/cross_cutting/decision_links is an empty edit (400) (\xA77). Cite the decision record a rule rests on rather than restating what was decided in its body: the record is where the reasoning stays correct, and a body repeating it goes stale the moment the decision is superseded. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built.",
17258
+ server2.registerTool("update_requirement", {
17259
+ description: "Update a requirement: title, body, and/or summary APPENDS a new revision (nothing is edited in place; summary versions like title/body); optional note records why. Optional area (product-area label), cross_cutting, and decision_links (add/remove decision records this rule sits under \u2014 `KEY-D{n}`, from `list_decisions`) are metadata changes (no revision) \u2014 toggling cross_cutting ON is rejected while explicit links exist; unlink first. Supplying none of title/body/summary/area/cross_cutting/decision_links is an empty edit (400) (\xA77). Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CLink by key; never paste another record\u2019s text\u201D.",
17250
17260
  // Inline shape (updateRequirementInputSchema is a refine, no .shape) — add
17251
17261
  // summary/area here explicitly (§210) and decisionLinks (PIPE-84 §6); the
17252
17262
  // empty-edit refine is enforced by the API, not this shape.
@@ -17261,56 +17271,56 @@ Every loose end has one destination, and none of them is prose. Anything you not
17261
17271
  decisionLinks: decisionLinkChangesSchema.optional()
17262
17272
  }
17263
17273
  }, ({ requirement, ...fields }) => run(() => client2.updateRequirement(requirement, fields)));
17264
- registerTool("approve_requirement", {
17274
+ server2.registerTool("approve_requirement", {
17265
17275
  description: "Approve (pin) a requirement\u2019s latest revision, or a specified `revision`, recording it in approvals history and advancing the approved revision that downstream links and reads build against (\xA75, \xA77).",
17266
17276
  inputSchema: approveRequirementInputSchema.shape
17267
17277
  }, (args) => run(() => client2.approveRequirement(args.requirement, args.revision)));
17268
- registerTool("create_decision", {
17269
- description: "Record ONE decision as a project-scoped decision record (`KEY-D{n}`): `title` names the decision and `body` says what was decided and why. A new record starts `proposed`; moving it to `accepted` IS the acceptance \u2014 there is no separate approval step. Returns the created record. A decision record is written ONCE. Title and body can be corrected only while it is `proposed`; from `accepted` onward the record is frozen, and the way to change a decision is to write a NEW record and `supersede_decision` the old one \u2014 which leaves the original readable and says where the current decision went. Nothing on any surface deletes one. Search before you create: `list_decisions` takes a `text` filter matching TITLE AND BODY \u2014 run it on the distinctive nouns first. Sessions do not see each other, so re-arguing a settled question leaves two answers on the ledger with nothing saying which one holds. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built.",
17278
+ server2.registerTool("create_decision", {
17279
+ description: "Record ONE decision as a project-scoped decision record (`KEY-D{n}`): `title` names the decision and `body` says what was decided and why. A new record starts `proposed`; moving it to `accepted` IS the acceptance \u2014 there is no separate approval step. Returns the created record. Title and body can be corrected only while the record is `proposed`; from `accepted` onward it is frozen, and the way to change a decision is to write a NEW record and `supersede_decision` the old one \u2014 which leaves the original readable and says where the current decision went. Nothing on any surface deletes one. Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CA decision record is written once\u201D and \u201CSearch before you create\u201D.",
17270
17280
  inputSchema: createDecisionInputSchema.shape
17271
17281
  }, (args) => run(() => client2.createDecision(args)));
17272
- registerTool("get_decision", {
17282
+ server2.registerTool("get_decision", {
17273
17283
  description: "Get a decision record by display id (`KEY-D{n}`) or uuid: title, body, lifecycle state (`proposed`/`accepted`/`superseded`), who accepted it and when, the record that replaced it, where the CURRENT decision lives when this one has been superseded, and everything that references it \u2014 every requirement and every work item, gathered from both directions.",
17274
17284
  inputSchema: getDecisionInputSchema.shape
17275
- }, (args) => run(() => client2.getDecision(args.decision)));
17276
- registerTool("list_decisions", {
17277
- description: "List decision records filtered by `project` and `text`: display id, title, lifecycle state, the replacement when superseded, and how many requirements and work items cite each one. `text` matches over TITLE AND BODY, so search on what a decision was about rather than on what someone chose to call it. Read the decisions before re-opening a settled question: an `accepted` record is the project\u2019s answer, and arguing it again inside an issue or requirement body produces a second answer with nothing saying which one holds. If the answer genuinely has changed, record a NEW decision and `supersede_decision` the old one rather than editing anything.",
17285
+ }, (args) => run(() => client2.getDecision(args.decision), GUIDANCE_POINTER));
17286
+ server2.registerTool("list_decisions", {
17287
+ description: "List decision records filtered by `project` and `text`: display id, title, lifecycle state, the replacement when superseded, and how many requirements and work items cite each one. `text` matches over TITLE AND BODY, so search on what a decision was about rather than on what someone chose to call it.",
17278
17288
  inputSchema: listDecisionsFilterSchema.shape
17279
- }, (args) => run(() => client2.listDecisions(args)));
17280
- registerTool("supersede_decision", {
17289
+ }, (args) => run(() => client2.listDecisions(args), GUIDANCE_POINTER));
17290
+ server2.registerTool("supersede_decision", {
17281
17291
  description: "Replace an ACCEPTED decision record with another one: `decision` moves to `superseded` and names `replacedBy` as where the current decision now lives, so whoever opens the old record is sent to the standing one. This is the only way a decision changes \u2014 the original is never edited and never removed, and the whole chain stays readable. Refused when the record is still `proposed` (nothing has been decided yet, so correct it instead), when a record is named as its own replacement, when the replacement belongs to another project, or when the replacement\u2019s own chain already leads back to this record. Returns the superseded record.",
17282
17292
  inputSchema: supersedeDecisionInputSchema.shape
17283
17293
  }, (args) => run(() => client2.supersedeDecision(args.decision, args.replacedBy)));
17284
- registerTool("list_content", {
17294
+ server2.registerTool("list_content", {
17285
17295
  description: "List content drafts filtered by project, text, area, and author: display id (KEY-C{n}), title, summary (latest revision), area, author, latest revision number, deliverable count, and linked-issue count. Content is a project-scoped sibling of requirements \u2014 raw material that gets promoted into work, not an issue type.",
17286
17296
  inputSchema: listContentFilterSchema.shape
17287
- }, (args) => run(() => client2.listContent(args)));
17288
- registerTool("get_content", {
17297
+ }, (args) => run(() => client2.listContent(args), GUIDANCE_POINTER));
17298
+ server2.registerTool("get_content", {
17289
17299
  description: "Get a content draft by display id (KEY-C{n}) or uuid: its revision history (default latest, or `revision` to pin) plus every per-platform deliverable with its own revisions, posted metadata (url/postedAt), linked issues (with staleness), and linked assets.",
17290
17300
  inputSchema: { content: contentRefSchema, revision: positiveIntSchema.optional() }
17291
- }, (args) => run(() => client2.getContent(args.content, args.revision)));
17292
- registerTool("create_content", {
17293
- description: 'Create a project-scoped content draft with revision 1 (title, body). Optional summary is a short outline description (versioned on the revision, like title/body); optional area is a free-text product-area label (metadata). Optional author is the editorial byline the draft is credited to (free text, e.g. "jason") \u2014 distinct from the acting operator, and the field the list filters by. Optional metadata is an open bag for capture provenance (tags, score, sensitivity, source refs) \u2014 stored passively, never acted on. This is the capture-sink target: a captured topic becomes a draft here. Search before you create: `list_content` takes a `text` filter \u2014 run it on the distinctive nouns first. Sessions do not see each other, so a duplicate is invisible until someone finds both; on a near match, amend the existing draft rather than filing again.',
17301
+ }, (args) => run(() => client2.getContent(args.content, args.revision), GUIDANCE_POINTER));
17302
+ server2.registerTool("create_content", {
17303
+ description: 'Create a project-scoped content draft with revision 1 (title, body). Optional summary is a short outline description (versioned on the revision, like title/body); optional area is a free-text product-area label (metadata). Optional author is the editorial byline the draft is credited to (free text, e.g. "jason") \u2014 distinct from the acting operator, and the field the list filters by. Optional metadata is an open bag for capture provenance (tags, score, sensitivity, source refs) \u2014 stored passively, never acted on. This is the capture-sink target: a captured topic becomes a draft here. Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSearch before you create\u201D.',
17294
17304
  inputSchema: createContentInputSchema.shape
17295
17305
  }, (args) => run(() => client2.createContent(args)));
17296
- registerTool("update_content", {
17297
- description: "Update a content draft: title, body, and/or summary APPENDS a new revision (nothing is edited in place); optional note records why. Optional area, author, and metadata are metadata changes (no revision). Supplying none of title/body/summary/area/author/metadata is an empty edit (400).",
17306
+ server2.registerTool("update_content", {
17307
+ description: "Update a content draft: title, body, and/or summary APPENDS a new revision (nothing is edited in place); optional note records why. Optional area, author, and metadata are metadata changes (no revision). Supplying none of title/body/summary/area/author/metadata is an empty edit (400). Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns.",
17298
17308
  inputSchema: updateContentInputSchema.shape
17299
17309
  }, ({ content, ...fields }) => run(() => client2.updateContent(content, fields)));
17300
- registerTool("create_deliverable", {
17301
- description: "Add a per-platform deliverable to a draft with revision 1 (the post text). `platform` is a slug configured for the project \u2014 one of its ACTIVE deliverable targets (see list_projects \u2192 deliverableTargets; defaults are bsky/x/reddit/hn/blog, but projects can add/remove them); an unconfigured slug is rejected. Optional body seeds revision 1. There is one deliverable per platform per draft \u2014 a variant is a revision (update_deliverable), not a second deliverable. Rendered id is DRAFT-KEY/platform (e.g. DWB-C3/bsky).",
17310
+ server2.registerTool("create_deliverable", {
17311
+ description: "Add a per-platform deliverable to a draft with revision 1 (the post text). `platform` is a slug configured for the project \u2014 one of its ACTIVE deliverable targets (see list_projects \u2192 deliverableTargets; defaults are bsky/x/reddit/hn/blog, but projects can add/remove them); an unconfigured slug is rejected. Optional body seeds revision 1. There is one deliverable per platform per draft \u2014 a variant is a revision (update_deliverable), not a second deliverable. Rendered id is DRAFT-KEY/platform (e.g. DWB-C3/bsky). Writing guidance for the post text lives in the product doctrine, which `get_work_context` returns.",
17302
17312
  inputSchema: createDeliverableInputSchema.shape
17303
17313
  }, ({ content, ...fields }) => run(() => client2.createDeliverable(content, fields)));
17304
- registerTool("update_deliverable", {
17305
- description: "Append a new revision (post text) to a deliverable, addressed as DRAFT-KEY/platform (e.g. DWB-C3/bsky); optional note records why. Platform identity is immutable \u2014 this only versions the post text.",
17314
+ server2.registerTool("update_deliverable", {
17315
+ description: "Append a new revision (post text) to a deliverable, addressed as DRAFT-KEY/platform (e.g. DWB-C3/bsky); optional note records why. Platform identity is immutable \u2014 this only versions the post text. Writing guidance for the post text lives in the product doctrine, which `get_work_context` returns.",
17306
17316
  inputSchema: updateDeliverableInputSchema.shape
17307
17317
  }, ({ deliverable, ...fields }) => run(() => client2.updateDeliverable(deliverable, fields)));
17308
- registerTool("record_post", {
17318
+ server2.registerTool("record_post", {
17309
17319
  description: "Record that a deliverable (DRAFT-KEY/platform) was posted: its public url and when (postedAt defaults to now), pinning the deliverable\u2019s current revision as the posted one. Pipebrain never posts \u2014 a human posts, then records the url here. Re-calling overwrites (a correction).",
17310
17320
  inputSchema: recordPostInputSchema.shape
17311
17321
  }, ({ deliverable, ...fields }) => run(() => client2.recordPost(deliverable, fields)));
17312
- registerTool("promote_deliverable", {
17313
- description: 'Promote a deliverable (DRAFT-KEY/platform, e.g. DWB-C3/bsky) to a NEW issue: creates the issue (`title` + `type` required; optional `status` defaults to triage; optional `body` seeds it \u2014 typically the current post text) AND a PROTECTED link pinning the deliverable\u2019s current revision. That link CANNOT be unlinked \u2014 the issue exists to ship this deliverable. (To link an EXISTING issue instead, use update_issue.deliverable_links, which stays removable.) Returns the created issue. Search before you promote: `list_issues` takes a `text` filter \u2014 run it on the deliverable\u2019s distinctive nouns first; an issue for this deliverable may already exist, and sessions do not see each other. Link another record by key plus title on first mention; never paste its text into a body \u2014 the source changes, the copy does not, and a stale copy gets built. The promoted deliverable itself is the exception: seeding the body with its text is the point of this tool, and the protected link pins the revision that text came from. A decision you need from the operator is filed as a question via `ask_questions`, never written as an "Open questions" heading inside a body \u2014 a heading prompts nobody and records no answer, so a later session cannot tell whether the decision was made.',
17322
+ server2.registerTool("promote_deliverable", {
17323
+ description: "Promote a deliverable (DRAFT-KEY/platform, e.g. DWB-C3/bsky) to a NEW issue: creates the issue (`title` + `type` required; optional `status` defaults to triage; optional `body` seeds it \u2014 typically the current post text) AND a PROTECTED link pinning the deliverable\u2019s current revision. That link CANNOT be unlinked \u2014 the issue exists to ship this deliverable. (To link an EXISTING issue instead, use update_issue.deliverable_links, which stays removable.) Returns the created issue. Seeding the body with the deliverable\u2019s own text is the exception to linking rather than pasting \u2014 it is the point of this tool, and the protected link pins the revision that text came from. Writing guidance for this tool lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSearch before you create\u201D and \u201CLink by key; never paste another record\u2019s text\u201D.",
17314
17324
  inputSchema: {
17315
17325
  deliverable: external_exports.string().min(1),
17316
17326
  title: external_exports.string().min(1),
@@ -17319,34 +17329,34 @@ Every loose end has one destination, and none of them is prose. Anything you not
17319
17329
  body: markdownSchema.optional()
17320
17330
  }
17321
17331
  }, ({ deliverable, ...fields }) => run(() => client2.promoteDeliverable(deliverable, fields)));
17322
- registerTool("list_assets", {
17332
+ server2.registerTool("list_assets", {
17323
17333
  description: "List project assets (S3-backed files of any type) filtered by project, status (pending/active/rejected), category (image/video/document), and filename text, sorted by date or size (asc/desc): id, filename, contentType, size, sha256, status, hasThumbnail, and linkCount (live references). Metadata only \u2014 the bytes move by path, never through this result.",
17324
17334
  inputSchema: listAssetsFilterSchema.shape
17325
- }, (args) => run(() => client2.listAssets(args)));
17326
- registerTool("get_asset", {
17335
+ }, (args) => run(() => client2.listAssets(args), GUIDANCE_POINTER));
17336
+ server2.registerTool("get_asset", {
17327
17337
  description: "Get an asset\u2019s metadata by uuid: filename, contentType, size, sha256 (client-computed, server-verified by read-back), status, hasThumbnail, linkCount (live references), and timestamps. Metadata only \u2014 no value/URL is returned over MCP. To get the bytes, use download_asset (a LOCAL server only \u2014 it writes to a path on the machine running the server) or `ppb assets download`.",
17328
17338
  inputSchema: { asset: uuidSchema }
17329
- }, (args) => run(() => client2.getAsset(args.asset)));
17339
+ }, (args) => run(() => client2.getAsset(args.asset), GUIDANCE_POINTER));
17330
17340
  if (surface === "local") {
17331
- registerTool("upload_asset", {
17341
+ server2.registerTool("upload_asset", {
17332
17342
  description: "Upload a LOCAL FILE (by path) as a project asset and activate it: reads and SHA-256-hashes the file locally, registers the asset, PUTs the bytes directly to storage, and completes (server verifies the digest by read-back). Returns the asset metadata (status active on success). Only the file PATH crosses the wire \u2014 the bytes never do; do NOT pass base64 or file contents. contentType is guessed from the extension when omitted. Then use link_asset to attach the returned asset to a deliverable revision or a content draft.",
17333
17343
  inputSchema: uploadAssetInputSchema.shape
17334
17344
  }, (args) => run(() => uploadAssetFromPath(client2, apiBaseUrl, args)));
17335
- registerTool("download_asset", {
17345
+ server2.registerTool("download_asset", {
17336
17346
  description: "Download an ACTIVE asset\u2019s bytes to a LOCAL FILE at `path` (created/overwritten), so you can read or view an uploaded image, mockup, or document. The bytes are written to disk and re-verified against the recorded sha256; the RESULT is metadata + the written path \u2014 never the bytes or a URL. Addressed by asset uuid (from list_assets, get_asset, or get_content).",
17337
17347
  inputSchema: downloadAssetInputSchema.shape
17338
17348
  }, (args) => run(() => downloadAssetToPath(client2, args)));
17339
17349
  }
17340
- registerTool("link_asset", {
17350
+ server2.registerTool("link_asset", {
17341
17351
  description: "Reference an active asset FROM a target. Two targets are wired: `deliverable_revision` (targetId is a content_deliverable_revision uuid, e.g. from get_content) and `content_draft` (targetId is a content_draft uuid \u2014 the asset attaches to the topic doc and is snapshot-copied onto deliverables when they are created). Rejects a non-active asset or a cross-project link.",
17342
17352
  inputSchema: linkAssetInputSchema.shape
17343
17353
  }, (args) => run(() => client2.linkAsset(args)));
17344
- registerTool("unlink_asset", {
17354
+ server2.registerTool("unlink_asset", {
17345
17355
  description: "Remove an asset reference by its link id (soft-delete). The asset itself is untouched \u2014 this only drops the reference from its target.",
17346
17356
  inputSchema: unlinkAssetInputSchema.shape
17347
17357
  }, (args) => run(() => client2.unlinkAsset(args.linkId)));
17348
- registerTool("set_secret", {
17349
- description: "Create a secret or add a new version under a project + environment (metadata only \u2014 the response NEVER echoes the value). For sensitive values use the `ppb` CLI instead (`ppb secrets set --from-file <f>` or pipe via stdin): a value typed here is placed in the chat transcript before the server can encrypt it. `name` is UPPER_SNAKE_CASE (e.g. API_KEY); `environment` is the environment slug (dev/prod); optional `description`.",
17358
+ server2.registerTool("set_secret", {
17359
+ description: "Create a secret or add a new version under a project + environment (metadata only \u2014 the response NEVER echoes the value). `name` is UPPER_SNAKE_CASE (e.g. API_KEY); `environment` is the environment slug (dev/prod); optional `description`.",
17350
17360
  inputSchema: {
17351
17361
  project: projectKeySchema,
17352
17362
  environment: external_exports.string().min(1),
@@ -17355,23 +17365,23 @@ Every loose end has one destination, and none of them is prose. Anything you not
17355
17365
  description: external_exports.string().optional()
17356
17366
  }
17357
17367
  }, ({ project, environment, name, value, description }) => run(() => client2.setSecret(project, { env: environment, name, value, description })));
17358
- registerTool("list_secrets", {
17368
+ server2.registerTool("list_secrets", {
17359
17369
  description: "List a project's secrets as METADATA ONLY (id, name, environment, description, current version, timestamps) \u2014 never any value. Optional `environment` slug filter.",
17360
17370
  inputSchema: {
17361
17371
  project: projectKeySchema,
17362
17372
  environment: external_exports.string().min(1).optional()
17363
17373
  }
17364
- }, ({ project, environment }) => run(() => client2.listSecrets(project, { env: environment })));
17365
- registerTool("describe_secret", {
17374
+ }, ({ project, environment }) => run(() => client2.listSecrets(project, { env: environment }), GUIDANCE_POINTER));
17375
+ server2.registerTool("describe_secret", {
17366
17376
  description: "Describe one secret: its metadata plus its version history (version, created_at, created_by, and whether each version has been crypto-shredded). METADATA ONLY \u2014 no value is ever returned.",
17367
17377
  inputSchema: {
17368
17378
  project: projectKeySchema,
17369
17379
  environment: external_exports.string().min(1),
17370
17380
  name: secretNameSchema
17371
17381
  }
17372
- }, ({ project, environment, name }) => run(() => client2.describeSecret(project, name, { env: environment })));
17373
- registerTool("rotate_secret", {
17374
- description: "Rotate an EXISTING secret: store a NEW version and advance the pointer (metadata only \u2014 the response NEVER echoes the value). For sensitive values use the `ppb` CLI instead (`ppb secrets set --from-file <f>` or pipe via stdin): a value typed here is placed in the chat transcript before the server can encrypt it.",
17382
+ }, ({ project, environment, name }) => run(() => client2.describeSecret(project, name, { env: environment }), GUIDANCE_POINTER));
17383
+ server2.registerTool("rotate_secret", {
17384
+ description: "Rotate an EXISTING secret: store a NEW version and advance the pointer (metadata only \u2014 the response NEVER echoes the value).",
17375
17385
  inputSchema: {
17376
17386
  project: projectKeySchema,
17377
17387
  environment: external_exports.string().min(1),
@@ -17379,8 +17389,8 @@ Every loose end has one destination, and none of them is prose. Anything you not
17379
17389
  value: external_exports.string().min(1)
17380
17390
  }
17381
17391
  }, ({ project, environment, name, value }) => run(() => client2.rotateSecret(project, name, { env: environment, value })));
17382
- registerTool("update_secret_description", {
17383
- description: "Update a secret's description (metadata-only edit \u2014 does not change the value or add a version).",
17392
+ server2.registerTool("update_secret_description", {
17393
+ description: "Update a secret's description (metadata-only edit \u2014 does not change the value or add a version). Writing guidance for that description lives in the product doctrine, which `get_work_context` returns.",
17384
17394
  inputSchema: {
17385
17395
  project: projectKeySchema,
17386
17396
  environment: external_exports.string().min(1),
@@ -17388,7 +17398,7 @@ Every loose end has one destination, and none of them is prose. Anything you not
17388
17398
  description: external_exports.string()
17389
17399
  }
17390
17400
  }, ({ project, environment, name, description }) => run(() => client2.updateSecretDescription(project, name, { env: environment, description })));
17391
- registerTool("delete_secret", {
17401
+ server2.registerTool("delete_secret", {
17392
17402
  description: "Delete a secret: soft-delete the entry and crypto-shred all its versions (the value becomes unrecoverable). Returns confirmation metadata only.",
17393
17403
  inputSchema: {
17394
17404
  project: projectKeySchema,
@@ -17399,14 +17409,14 @@ Every loose end has one destination, and none of them is prose. Anything you not
17399
17409
  await client2.deleteSecret(project, name, { env: environment });
17400
17410
  return { deleted: true, project, environment, name };
17401
17411
  }));
17402
- registerTool("list_org_instructions", {
17403
- description: "List the org\u2019s agent instructions \u2014 the per-scope texts appended to this server\u2019s tool descriptions (and, for `general`, its server instructions) at session start. Edits apply to NEW sessions only; use this to see the CURRENT saved values mid-session (at most one row per scope)."
17404
- }, () => run(() => client2.listOrgInstructions()));
17405
- registerTool("set_org_instruction", {
17406
- description: "Set (create or replace) one scope\u2019s org-level agent instruction text, max 4000 characters \u2014 over-cap is rejected, never truncated. Scopes: `general` (server-wide), `requirements`, `content`, and `work.<type>` (one per issue type, e.g. `work.epic`). Requires the ADMIN role in the token\u2019s org. Takes effect at the NEXT session start \u2014 running sessions keep the text they launched with. Returns the saved instruction. Organization instructions say how this organization writes, not how Pipebrain works: if a sentence would read identically for an organization that has never met yours, it is product behavior and belongs in the server\u2019s shipped tool descriptions, not here.",
17412
+ server2.registerTool("list_org_instructions", {
17413
+ description: "List the org\u2019s agent instructions \u2014 the per-scope texts this server composes into the guidance `get_work_context` returns, each under a heading naming its scope. Edits apply to NEW sessions only; use this to see the CURRENT saved values mid-session (at most one row per scope)."
17414
+ }, () => run(() => client2.listOrgInstructions(), GUIDANCE_POINTER));
17415
+ server2.registerTool("set_org_instruction", {
17416
+ description: "Set (create or replace) one scope\u2019s org-level agent instruction text, max 4000 characters \u2014 over-cap is rejected, never truncated. Scopes: `general` (server-wide), `requirements`, `content`, and `work.<type>` (one per issue type, e.g. `work.epic`). Requires the ADMIN role in the token\u2019s org. Takes effect at the NEXT session start \u2014 running sessions keep the text they launched with. Returns the saved instruction. Writing guidance for an instruction body lives in the product doctrine, which `get_work_context` returns \u2014 see \u201CSetting an instruction replaces the whole body\u201D.",
17407
17417
  inputSchema: setOrgInstructionInputSchema.shape
17408
17418
  }, (args) => run(() => client2.setOrgInstruction(args.scope, args.body)));
17409
- registerTool("delete_org_instruction", {
17419
+ server2.registerTool("delete_org_instruction", {
17410
17420
  description: "Clear one scope\u2019s org-level agent instruction (soft delete; an unset scope is an error naming it). Requires the ADMIN role in the token\u2019s org. Takes effect at the NEXT session start. Returns the cleared instruction.",
17411
17421
  inputSchema: deleteOrgInstructionInputSchema.shape
17412
17422
  }, (args) => run(() => client2.deleteOrgInstruction(args.scope)));
@@ -17475,7 +17485,7 @@ function loadMcpConfig() {
17475
17485
  }
17476
17486
 
17477
17487
  // src/version.ts
17478
- var VERSION = "0.30.0";
17488
+ var VERSION = "0.32.0";
17479
17489
 
17480
17490
  // src/main.ts
17481
17491
  var config2 = loadMcpConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipebrain-mcp",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "description": "Pipebrain MCP server for Claude Code and Claude Desktop — issues, requirements, content, assets, and metadata-only secrets over the Pipebrain API.",
5
5
  "type": "module",
6
6
  "license": "MIT",