@productbrain/mcp 0.0.1-beta.8626 → 0.0.1-beta.8637

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.
@@ -7582,11 +7582,11 @@ function formatRuleListRow(row) {
7582
7582
  function formatRuleListBucketLines(label, bucket, truncated) {
7583
7583
  if (!bucket || bucket.rows.length === 0) return [];
7584
7584
  const lines = [`${label}:`, ...bucket.rows.map((r) => ` - ${formatRuleListRow(r)}`)];
7585
- const named = (bucket.overCapEntryIds ?? []).map(sanitizeRuleListField);
7586
- const rest = Math.max(0, bucket.overCap - named.length);
7587
- const more = rest > 0 ? ` and ${rest} more` : "";
7588
- if (named.length > 0) lines.push(` (over the cap of ${bucket.rows.length}, not served: ${named.join(", ")}${more}${truncated ? "; the read was truncated, so more may exist" : ""})`);
7589
- else if (bucket.overCap > 0) lines.push(` (${truncated ? "at least " : ""}+${bucket.overCap} more, capped)`);
7585
+ if (bucket.overCap > 0) {
7586
+ const cap = bucket.rows.length - bucket.overCap;
7587
+ const atLeast = truncated ? "at least " : "";
7588
+ lines.push(` (${atLeast}${bucket.rows.length} rules on a list capped at ${cap}: retire ${atLeast}${bucket.overCap} to fit; until then accept refuses new rules here.)`);
7589
+ }
7590
7590
  return lines;
7591
7591
  }
7592
7592
  function formatRuleListTrailers(ruleLists) {
@@ -7594,6 +7594,9 @@ function formatRuleListTrailers(ruleLists) {
7594
7594
  if (ruleLists.truncated) {
7595
7595
  lines.push("(Some Current rules may be missing from these lists \u2014 the underlying read was truncated.)");
7596
7596
  }
7597
+ if (ruleLists.namesTruncated) {
7598
+ lines.push("(Some rules show no owner or verifier: this serve looked up at most 100 distinct names.)");
7599
+ }
7597
7600
  if (ruleLists.unassigned > 0) {
7598
7601
  const atLeast = ruleLists.truncated ? "at least " : "";
7599
7602
  lines.push(`(${atLeast}${ruleLists.unassigned} current rule(s) on no list reach no agent: a rule needs applies and one owner role; an everyone rule needs the root Team Lead as owner, a team rule an owner placed in a team.)`);
@@ -7616,7 +7619,14 @@ var RULE_LISTS_EVERYONE_ONLY_LABEL = "Rules (everyone list only; run `orient mod
7616
7619
  var RULE_LISTS_UNAVAILABLE_LINE = "Rules: unavailable \u2014 rule list fetch failed, retry `orient mode=full`";
7617
7620
  function buildEveryoneOnlyRuleListsLines(ruleLists) {
7618
7621
  if (!ruleLists) return [];
7619
- const everyoneOnly = { everyone: ruleLists.everyone, team: null, role: { rows: [], overCap: 0 }, unassigned: ruleLists.unassigned, truncated: ruleLists.truncated };
7622
+ const everyoneOnly = {
7623
+ everyone: ruleLists.everyone,
7624
+ team: null,
7625
+ role: { rows: [], overCap: 0 },
7626
+ unassigned: ruleLists.unassigned,
7627
+ truncated: ruleLists.truncated,
7628
+ ...ruleLists.namesTruncated ? { namesTruncated: true } : {}
7629
+ };
7620
7630
  const bucketLines = formatRuleListsLines(everyoneOnly);
7621
7631
  return [RULE_LISTS_EVERYONE_ONLY_LABEL, bucketLines.length > 0 ? bucketLines.join("\n") : "(none currently served)"];
7622
7632
  }
@@ -7778,7 +7788,12 @@ async function buildAlreadyOrientedResult(kernelQuery2, agentSessionId, taskGrou
7778
7788
  // and `ruleListsScope` says explicitly why, rather than shipping a shape a consumer could
7779
7789
  // misread as "this session has no team/role rules".
7780
7790
  ...ruleLists ? {
7781
- ruleLists: { everyone: ruleLists.everyone, unassigned: ruleLists.unassigned, truncated: ruleLists.truncated },
7791
+ ruleLists: {
7792
+ everyone: ruleLists.everyone,
7793
+ unassigned: ruleLists.unassigned,
7794
+ truncated: ruleLists.truncated,
7795
+ ...ruleLists.namesTruncated ? { namesTruncated: true } : {}
7796
+ },
7782
7797
  ruleListsScope: "everyone-only"
7783
7798
  } : {},
7784
7799
  // Round 1 review (PRRT_kwDORS4ils6mOeU8, TEN-3912): explicit `true` only on the rejection
@@ -13716,7 +13731,7 @@ var ALLOWED_RELATION_TYPES_LIST = [
13716
13731
  var ALLOWED_RELATION_TYPES = new Set(ALLOWED_RELATION_TYPES_LIST);
13717
13732
 
13718
13733
  // src/resources/agentCheatsheet.ts
13719
- var DATA_HANDLING_SECTION = "### How PB Handles Your Data\n- **The reply is the source of truth**: every reply carries `ok`; on failure it carries `code` and guidance. Read the reply, never an expectation.\n- **Empty-workspace safe**: the orientation resource and this cheatsheet render on a workspace with no entries and no collections.\n- **Workspace-agnostic**: PB is one product used by many teams. Nothing in these instructions is specific to your workspace; your own principles, standards and rules arrive through `productbrain://orientation`.\n- **Served, not installed**: these instructions, `productbrain://orientation` and `productbrain://agent-cheatsheet` are served over MCP.";
13734
+ var DATA_HANDLING_SECTION = "### How PB Handles Your Data\n- **The reply is the source of truth**: every reply carries `ok`; on failure it carries `code` and guidance. Read the reply, never an expectation.\n- **Empty-workspace safe**: the orientation resource and this cheatsheet render on a workspace with no entries and no collections.\n- **Workspace-agnostic**: PB is one product used by many teams. Nothing in these instructions is specific to your workspace; your own rules arrive as the rule lists that session start and orient serve you.\n- **Served, not installed**: these instructions, `productbrain://orientation` and `productbrain://agent-cheatsheet` are served over MCP.";
13720
13735
  var AGENT_CHEATSHEET = `# Product Brain \u2014 Agent Cheatsheet
13721
13736
 
13722
13737
  ## Core Tools (Serves 15 compound tools, always)
@@ -13741,8 +13756,7 @@ var AGENT_CHEATSHEET = `# Product Brain \u2014 Agent Cheatsheet
13741
13756
  This table lists actions only. See \`tools/list\` for each tool's input schema; a missing or invalid parameter is named in the call's own reply.
13742
13757
 
13743
13758
  ## Collection Prefixes
13744
- GLO (glossary), BR (business-rules), PRI (principles), STD (standards),
13745
- DEC (decisions), STR (strategy), TEN (tensions), FEAT (features),
13759
+ GLO (glossary), RULE (rules), DEC (decisions), STR (strategy), TEN (tensions), FEAT (features),
13746
13760
  BET (bets), INS (insights), ARCH (architecture), TEAM (teams),
13747
13761
  ROL (roles), MTRC (tracking-events), ST (semantic-types)
13748
13762
 
@@ -13756,7 +13770,11 @@ Write via \`update\`: \`draft\` | \`archived\` (\`accepted\` via \`commit\`, nev
13756
13770
  - **tensions:** open \u2192 processing \u2192 decided \u2192 closed
13757
13771
  - **decisions:** pending \u2192 decided
13758
13772
  - **bets:** shaped \u2192 bet \u2192 building \u2192 shipped
13759
- - **business-rules:** active | conflict | review
13773
+
13774
+ ## Rule Lists
13775
+ - Session start and \`orient action=task\` serve the rules that bind you, each as one sentence with its why.
13776
+ - A rule's \`applies\` and its one owner role place it on one list: everyone (cap 15), team (cap 5 per team) or role (cap 5 per role).
13777
+ - A rule on no list binds nobody; a full list refuses a new rule until one retires, and a list over its cap is served whole.
13760
13778
 
13761
13779
  ## Key Patterns
13762
13780
  - **Capture flow:** \`capture\` \u2192 \`relations action=suggest\` \u2192 \`relations action=batch-create\` \u2192 \`entries action=commit\`
@@ -14429,67 +14447,43 @@ Make sure the rule is consistent with existing rules and doesn't contradict them
14429
14447
  // src/server.ts
14430
14448
  var SERVER_VERSION = "0.7.2";
14431
14449
  var INSTRUCTIONS = [
14432
- "Product Brain \u2014 the single source of truth for product knowledge.",
14433
- "Terminology, standards, and core data all live here \u2014 no need to check external docs.",
14434
- "",
14435
- "## About Product Brain (PB)",
14450
+ "Product Brain (PB) is the single source of truth for your team's product knowledge: decisions, tensions, rules, work and the links between them.",
14436
14451
  "",
14437
- "PB is a knowledge management system used by many product teams.",
14438
- "These describe how PB works \u2014 not your product.",
14452
+ "## What session start hands you",
14439
14453
  "",
14440
- "### How PB Organizes Its Tools",
14441
- "- **Tools** are for actions with side-effects or dynamic computation (capture, accept, search).",
14442
- "- **Resources** are for stable, read-only data (orientation, terminology, collection schemas).",
14443
- "- **Prompts** are for multi-step choreography (workflows, guided capture, deep dives).",
14444
- "- Every tool, resource, and prompt works for ANY workspace \u2014 no bespoke logic.",
14445
- "- Resource templates (URI params) provide workspace-specific data through generic patterns.",
14446
- "- Tool count stays minimal: compound tools with `action` enums over many single-purpose tools.",
14454
+ "Call `session action=start` first. The reply names:",
14455
+ "- the workspace and the role you act as;",
14456
+ "- notices, including open questions routed to you;",
14457
+ "- the rule lists that bind you, each rule as one sentence with its why, its owner role and, when it has one, its date.",
14447
14458
  "",
14448
- DATA_HANDLING_SECTION,
14459
+ "Read those rules before you propose or build. If the work conflicts with one, stop, name the rule and ask the user before going on. Never design around a rule.",
14449
14460
  "",
14450
- "## Your Workspace Principles",
14461
+ "## What applies means",
14451
14462
  "",
14452
- "When you orient or start, PB surfaces active entries from your `principles`, `standards`,",
14453
- "and `business-rules` collections. These are YOUR team's guardrails \u2014 respect them during implementation.",
14454
- "If no principles exist yet, PB will tell you and suggest how to add them.",
14463
+ "Every rule (collection `rules`) declares whom it applies to, and its one owner role places it:",
14464
+ "- **everyone**: the whole workspace, owned by the root team's lead; capped at 15 rules;",
14465
+ "- **team**: its owner role's team; capped at 5 per team;",
14466
+ "- **role**: its owner role; capped at 5 per role.",
14455
14467
  "",
14456
- "The three governance collections:",
14457
- "- **Principles** (`principles`) \u2014 beliefs that guide decisions. 'We believe X.' You reason from a principle.",
14458
- "- **Standards** (`standards`) \u2014 conventions about how work is done. 'We do X this way.' You lint for a standard.",
14459
- "- **Business Rules** (`business-rules`) \u2014 system constraints. 'The system must do X.' You test for a rule.",
14468
+ "A rule on no list binds nobody. A full list refuses a new rule until one retires; a list already over its cap is served whole.",
14460
14469
  "",
14461
- "## Workflow",
14470
+ "## Pull the rest",
14462
14471
  "",
14463
- " 1. Start: call `session action=start` to open a tracked write session, then `orient action=start` \u2014 it returns a standup briefing for every workspace state, fresh or active. (`orient` orients the session; only `session action=start` creates one.)",
14464
- " 2. Re-orient: call `orient action=task` mid-session for task-scoped context or a compact status refresh.",
14465
- " 3. Discover: use `entries action=search` to find entries, or `entries action=list` to browse.",
14466
- ' 4. Drill in: use `entries action=get entryId="..."` for full details \u2014 data, labels, relations, history.',
14467
- " 5. Context: use `context action=gather` with an entryId or a task description.",
14468
- " 6. Capture: use `capture` to create entries \u2014 auto-links and scores in one call.",
14469
- " 7. Accept: use `entries action=commit` to send a draft for acceptance \u2014 read the reply's outcome/status field for what happened; read the capture reply first, since an entry that came back accepted needs no commit.",
14470
- " 8. Connect: use `relations action=suggest` then `relations action=create` to build the graph.",
14471
- " 9. Wrapup: call `session action=wrapup-review` before closing \u2014 reviews drafts, coaches quality, suggests links.",
14472
- " 10. Close: call `session action=close` when done \u2014 records session activity. Auto-nudges if wrapup was skipped.",
14472
+ '- `orient action=task task="<what you are doing>"`: context shaped to the task, with the rules for your team and role.',
14473
+ '- `entries action=get entryId="<ID>"`: one entry in full, with data, relations and history.',
14474
+ '- `entries action=search query="<noun>"`: find entries by what they are about.',
14473
14475
  "",
14474
- "Write tools (capture, entries action=update, relations, entries action=commit) require:",
14475
- " - An active agent session \u2014 call `session action=start` first, then `orient action=start` for context. Call `orient action=task` mid-session for a refresh.",
14476
- " - A readwrite API key scope",
14476
+ "## Writing",
14477
14477
  "",
14478
- "Alignment-first: before proposing or building anything, check orient's Workspace Governance",
14479
- "and Active work packages sections. These are constraints, not reference material.",
14480
- "If the proposal conflicts with a principle, standard, or business rule \u2014 stop, flag the conflict,",
14481
- "and get explicit user confirmation before proceeding. Do not design around governance.",
14482
- "If the work is outside the scope of active work packages \u2014 stop, name the gap, and ask the user",
14483
- "to confirm before designing. Do not propose implementation for out-of-scope work without a go-ahead.",
14478
+ "Write actions (capture, entries update and commit, relations create, batch-create, dismiss and delete) need an active session and a readwrite key.",
14479
+ "Use `capture` to create an entry and read its reply: an entry that came back accepted needs no `entries action=commit`.",
14480
+ "Link with `relations action=suggest`, then `relations action=create`.",
14481
+ "Finish with `session action=wrapup-review`, then `session action=close`.",
14482
+ "If the work falls outside the active work packages, name the gap and ask the user before designing it.",
14484
14483
  "",
14485
- "Workspace setup: use `collections action=update` to shape existing collections with the user.",
14486
- "Creating a brand-new collection is not self-serve \u2014 ask a platform admin to provision it, or",
14487
- "enable the module ontology pack that owns the drawer.",
14484
+ DATA_HANDLING_SECTION,
14488
14485
  "",
14489
- "Personalization: if you have context about the user from memory (prior work, recent",
14490
- "conversations, team context), use it to personalize recommendations. For example,",
14491
- "'Based on your recent pitch reviews, the gap most likely to matter is X.'",
14492
- "The orient/start output gives you the workspace state; your memory fills in the human context."
14486
+ "Every tool and action: `productbrain://agent-cheatsheet`."
14493
14487
  ].join("\n");
14494
14488
  function createProductBrainServer() {
14495
14489
  const server = new McpServer2(
@@ -14546,4 +14540,4 @@ export {
14546
14540
  createProductBrainServer,
14547
14541
  initFeatureFlags
14548
14542
  };
14549
- //# sourceMappingURL=chunk-KZI7DTMP.js.map
14543
+ //# sourceMappingURL=chunk-OZXZLLHS.js.map