@bendyline/gezel-mcp 1.2.8 → 1.2.9

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 (3) hide show
  1. package/dist/harness.js +2031 -61
  2. package/dist/server.js +312 -227
  3. package/package.json +4 -4
package/dist/server.js CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  MIN_TASK_DESCRIPTION_LENGTH,
26
26
  ManageTaskInputSchema,
27
27
  MessageGezelInputSchema,
28
+ OUTCOME_TEAMMATE_SLUGS,
28
29
  ReadDocumentInputSchema,
29
30
  ReadTaskNotesInputSchema,
30
31
  ReplaceInFileInputSchema,
@@ -42,23 +43,18 @@ import {
42
43
  WriteTaskNoteInputSchema,
43
44
  craftbookInputParams as craftbookInputParams2,
44
45
  fillProjectTypeParams,
45
- findGezelInRoster,
46
- findProjectByReference,
47
46
  formatMediaClock,
48
47
  gezelNamesInUse,
49
- gezelNotFoundMessage,
50
- gezelRosterHint,
51
48
  isAnswerEnvelope,
52
49
  isOrdinalWorkOptionId,
53
50
  matchProjectTypeForBrief,
54
51
  normalizeArtifactPath,
55
52
  parseWorkOptionId,
53
+ plainRoleTitle,
56
54
  projectNameFromRequest,
57
- projectNotFoundMessage,
58
55
  projectTypeNamedByBrief,
59
56
  projectTypesMentionedByBrief,
60
57
  renderSuggestWorkResult,
61
- roleWithGloss,
62
58
  routingRequestText
63
59
  } from "@bendyline/gezel";
64
60
  import { readFileSync } from "fs";
@@ -101,7 +97,6 @@ import {
101
97
  inferDeliverableKind,
102
98
  inferScriptScope,
103
99
  isReservedShadowArtifactPath,
104
- isSafeEntityId,
105
100
  isTrustedConstrainedToolset,
106
101
  listArtifactsText,
107
102
  listDirMissingText,
@@ -129,6 +124,7 @@ import {
129
124
  stepInsertionIndex,
130
125
  stepOwnerGezelId,
131
126
  taskOwnedPrefixes,
127
+ taskPersonNoun,
132
128
  taskScopedWriteDeniedMessage,
133
129
  uniqueStepId,
134
130
  unknownTaskStepText,
@@ -1415,8 +1411,11 @@ function buildTypedKickoffStep(input) {
1415
1411
  const tools = input.tools && input.tools.length > 0 ? ` Your tools for it: ${input.tools.map(
1416
1412
  (t) => t.description ? `\`${t.name}\` (${t.description.replace(/\.$/, "")})` : `\`${t.name}\``
1417
1413
  ).join(", ")}. Call one for each piece rather than writing the file yourself.` : "";
1414
+ const setting = `setting up your ${input.typeName}`;
1418
1415
  return {
1419
1416
  name: "First draft",
1417
+ stage: "make",
1418
+ personLabel: setting.length <= 60 ? setting : "setting up your project",
1420
1419
  description: `You lead this ${input.typeName} project for the person. Their goal: ${goal}${where}${tools}${known}${unsaid} Make what they asked for; if something more would help, offer it in your reply instead of adding it. Do the real work this turn rather than describing it, and finish it before you ask anything. Then reply in two or three sentences: what you made, and at most one question.`
1421
1420
  };
1422
1421
  }
@@ -2400,6 +2399,100 @@ ${sections.join("\n\n")}`
2400
2399
  );
2401
2400
  }
2402
2401
 
2402
+ // src/entity-resolvers.ts
2403
+ import {
2404
+ findGezelInRoster,
2405
+ findProjectByReference,
2406
+ gezelNotFoundMessage,
2407
+ gezelRosterHint,
2408
+ isSafeEntityId,
2409
+ projectNotFoundMessage
2410
+ } from "@bendyline/gezel";
2411
+
2412
+ // src/task-ref.ts
2413
+ function strictParseTaskRef(ref) {
2414
+ const idx = ref.lastIndexOf("/");
2415
+ if (idx < 0) return null;
2416
+ const projectId2 = ref.slice(0, idx).trim();
2417
+ const numStr = ref.slice(idx + 1).trim();
2418
+ if (!projectId2) return null;
2419
+ const num = Number.parseInt(numStr, 10);
2420
+ if (!Number.isFinite(num) || num <= 0 || String(num) !== numStr) return null;
2421
+ return { projectId: projectId2, num };
2422
+ }
2423
+ function normalizeTaskRef(ref) {
2424
+ return ref.replace(/[`'"]/g, "").replace(/\s+/g, "").replace(/[#:](?=\d+$)/, "/");
2425
+ }
2426
+ function resolveTaskRef(ref, sessionTaskRef2) {
2427
+ const session = sessionTaskRef2?.trim() ? strictParseTaskRef(sessionTaskRef2.trim()) : null;
2428
+ const raw = (ref ?? "").trim();
2429
+ if (raw) {
2430
+ const bare = raw.replace(/^#/, "");
2431
+ if (session && /^\d+$/.test(bare)) {
2432
+ const num = Number.parseInt(bare, 10);
2433
+ if (num > 0) return { projectId: session.projectId, num };
2434
+ }
2435
+ const parsed = strictParseTaskRef(raw) ?? strictParseTaskRef(normalizeTaskRef(raw));
2436
+ if (parsed) {
2437
+ if (!session || parsed.projectId === session.projectId) return parsed;
2438
+ return session;
2439
+ }
2440
+ }
2441
+ if (session) return session;
2442
+ const hint = sessionTaskRef2?.trim() ? ` This session's task is "${sessionTaskRef2.trim()}".` : "";
2443
+ throw new Error(
2444
+ `invalid task ref "${ref ?? ""}" \u2014 expected projectId/num (e.g. "myproject/1").${hint}`
2445
+ );
2446
+ }
2447
+
2448
+ // src/entity-resolvers.ts
2449
+ function createEntityResolvers(deps) {
2450
+ const { api: api2, projectId: projectId2, sessionTaskRef: sessionTaskRef2 } = deps;
2451
+ async function resolveProjectId2(input, recoveryTools = []) {
2452
+ try {
2453
+ const p = await api2.getProject(input);
2454
+ return p.id;
2455
+ } catch {
2456
+ }
2457
+ let all;
2458
+ try {
2459
+ all = (await api2.listProjects()).projects;
2460
+ } catch (err) {
2461
+ if (/\b403\b/.test(err instanceof Error ? err.message : String(err))) {
2462
+ return projectId2;
2463
+ }
2464
+ throw err;
2465
+ }
2466
+ const match = findProjectByReference(all, input);
2467
+ if (match) return match.id;
2468
+ throw new Error(projectNotFoundMessage(input, all, recoveryTools));
2469
+ }
2470
+ async function resolveGezelId2(input) {
2471
+ const all = (await api2.listGezels()).gezels;
2472
+ const match = findGezelInRoster(all, input);
2473
+ if (match) return match.id;
2474
+ try {
2475
+ const g = await api2.getGezel(input);
2476
+ return g.id;
2477
+ } catch {
2478
+ }
2479
+ throw new Error(gezelNotFoundMessage(input, all));
2480
+ }
2481
+ async function availableGezelsHint2() {
2482
+ try {
2483
+ return gezelRosterHint((await api2.listGezels()).gezels);
2484
+ } catch {
2485
+ return "Call `list_gezels` for the roster.";
2486
+ }
2487
+ }
2488
+ async function parseRef2(ref) {
2489
+ const parsed = resolveTaskRef(ref, sessionTaskRef2);
2490
+ if (isSafeEntityId(parsed.projectId)) return parsed;
2491
+ return { ...parsed, projectId: await resolveProjectId2(parsed.projectId) };
2492
+ }
2493
+ return { resolveProjectId: resolveProjectId2, resolveGezelId: resolveGezelId2, availableGezelsHint: availableGezelsHint2, parseRef: parseRef2 };
2494
+ }
2495
+
2403
2496
  // src/generate-image-normalization.ts
2404
2497
  var AGENT_IMAGE_MAX_SIDE_PX = 1024;
2405
2498
  var SIZE_MULTIPLE = 64;
@@ -3178,6 +3271,9 @@ async function reanchorAfterEdit(args) {
3178
3271
  }
3179
3272
  }
3180
3273
 
3274
+ // src/relay-text.ts
3275
+ var PLAIN_WORDS_RELAY = "Use plain words; don't repeat task, project or craftbook ids.";
3276
+
3181
3277
  // src/repo-intake-policy.ts
3182
3278
  var GITHUB_REPO_URL_RE = /https?:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]*[A-Za-z0-9_-])(?:\.git)?(?:\/[^\s)"'`<>]*)?/i;
3183
3279
  function extractGitHubRepoUrl(text) {
@@ -3743,42 +3839,6 @@ function hasTypeOnlyModifier(node) {
3743
3839
  ) ?? false;
3744
3840
  }
3745
3841
 
3746
- // src/task-ref.ts
3747
- function strictParseTaskRef(ref) {
3748
- const idx = ref.lastIndexOf("/");
3749
- if (idx < 0) return null;
3750
- const projectId2 = ref.slice(0, idx).trim();
3751
- const numStr = ref.slice(idx + 1).trim();
3752
- if (!projectId2) return null;
3753
- const num = Number.parseInt(numStr, 10);
3754
- if (!Number.isFinite(num) || num <= 0 || String(num) !== numStr) return null;
3755
- return { projectId: projectId2, num };
3756
- }
3757
- function normalizeTaskRef(ref) {
3758
- return ref.replace(/[`'"]/g, "").replace(/\s+/g, "").replace(/[#:](?=\d+$)/, "/");
3759
- }
3760
- function resolveTaskRef(ref, sessionTaskRef2) {
3761
- const session = sessionTaskRef2?.trim() ? strictParseTaskRef(sessionTaskRef2.trim()) : null;
3762
- const raw = (ref ?? "").trim();
3763
- if (raw) {
3764
- const bare = raw.replace(/^#/, "");
3765
- if (session && /^\d+$/.test(bare)) {
3766
- const num = Number.parseInt(bare, 10);
3767
- if (num > 0) return { projectId: session.projectId, num };
3768
- }
3769
- const parsed = strictParseTaskRef(raw) ?? strictParseTaskRef(normalizeTaskRef(raw));
3770
- if (parsed) {
3771
- if (!session || parsed.projectId === session.projectId) return parsed;
3772
- return session;
3773
- }
3774
- }
3775
- if (session) return session;
3776
- const hint = sessionTaskRef2?.trim() ? ` This session's task is "${sessionTaskRef2.trim()}".` : "";
3777
- throw new Error(
3778
- `invalid task ref "${ref ?? ""}" \u2014 expected projectId/num (e.g. "myproject/1").${hint}`
3779
- );
3780
- }
3781
-
3782
3842
  // src/task-step-authority.ts
3783
3843
  function taskStepMutationRejection(scope) {
3784
3844
  const { taskRef, sessionStepId: sessionStepId2, activeStepId, transitionCompleted } = scope;
@@ -4850,12 +4910,19 @@ var sessionTaskNamingMode = {
4850
4910
  ...sessionId ? { launchSessionId: sessionId } : {}
4851
4911
  };
4852
4912
  var sessionTaskRef = process.env.GEZEL_TASK_REF ?? "";
4913
+ var receiptTaskRef = sessionTaskRef || (process.env.GEZEL_RECEIPT_TASK_REF ?? "");
4914
+ var taskTeammates = process.env.GEZEL_TASK_TEAMMATES === "1";
4853
4915
  var sessionCraftbookId = process.env.GEZEL_CRAFTBOOK_ID ?? "";
4854
4916
  var rawSessionContextWindow = Number(process.env.GEZEL_CONTEXT_WINDOW ?? "");
4855
4917
  var sessionContextWindow = Number.isFinite(rawSessionContextWindow) && rawSessionContextWindow > 0 ? rawSessionContextWindow : void 0;
4856
4918
  var certPath = process.env.GEZEL_CERT_PATH;
4857
4919
  var fetchImpl = local?.fetch ?? (certPath ? createTrustingFetch({ cert: readFileSync(certPath, "utf8") }) : createPatientFetch());
4858
4920
  var api = new GezelClient({ baseUrl, token, fetch: fetchImpl });
4921
+ var { resolveProjectId, resolveGezelId, availableGezelsHint, parseRef } = createEntityResolvers({
4922
+ api,
4923
+ projectId,
4924
+ sessionTaskRef
4925
+ });
4859
4926
  async function pickFreshGezelName() {
4860
4927
  const roster = await api.listGezels().then((response) => response.gezels).catch(() => []);
4861
4928
  return pickUnusedGezelName(gezelNamesInUse(roster));
@@ -4995,10 +5062,15 @@ function draftEditApi(client, packId) {
4995
5062
  };
4996
5063
  }
4997
5064
  var sessionTaskArtifactDir = (process.env.GEZEL_TASK_ARTIFACT_DIR ?? "").replace(/\/+$/, "");
5065
+ function sessionTaskArtifactPath(path) {
5066
+ if (!sessionTaskArtifactDir) return null;
5067
+ const p = path.replace(/\\/g, "/").replace(/^\.\//, "");
5068
+ return p === sessionTaskArtifactDir || p.startsWith(`${sessionTaskArtifactDir}/`) ? p : null;
5069
+ }
4998
5070
  function assertNotTaskArtifactNamespace(target) {
4999
- if (!sessionTaskArtifactDir || target.kind !== "current") return;
5000
- const p = target.path.replace(/\\/g, "/").replace(/^\.\//, "");
5001
- if (p === sessionTaskArtifactDir || p.startsWith(`${sessionTaskArtifactDir}/`)) {
5071
+ if (target.kind !== "current") return;
5072
+ const p = sessionTaskArtifactPath(target.path);
5073
+ if (p) {
5002
5074
  throw new Error(
5003
5075
  `\`${p}\` is this task's working folder in the ARTIFACTS DRAWER, not the project workspace. Write it with \`write_artifact({ path: ${JSON.stringify(p)}, ... })\` and read it back with \`read_artifact\` \u2014 the workspace file tools cannot reach the drawer.`
5004
5076
  );
@@ -6075,6 +6147,16 @@ server.tool(
6075
6147
  async ({ path, content }) => {
6076
6148
  const stale = await staleStepMutationResult();
6077
6149
  if (stale) return stale;
6150
+ const drawerPath = sessionTaskArtifactPath(path);
6151
+ if (drawerPath && toolIsAuthorizedForThisSession("write_artifact")) {
6152
+ const written = await writeArtifactToolCall({ path: drawerPath, content });
6153
+ const notice = `[Rerouted write_file \u2192 write_artifact]
6154
+ ${JSON.stringify(drawerPath)} is this task's working folder in the artifacts drawer, so it was written there. Use write_artifact and read_artifact for files in this folder.`;
6155
+ return {
6156
+ ...written,
6157
+ content: [{ type: "text", text: notice }, ...written.content]
6158
+ };
6159
+ }
6078
6160
  const raster = rasterImageWriteRefusal(path);
6079
6161
  if (raster) return raster;
6080
6162
  const scoped = await taskScopedWriteRefusal(path, "workspace");
@@ -6751,7 +6833,7 @@ server.tool(
6751
6833
  ...sessionId ? { sessionId } : {},
6752
6834
  // Receipt attribution for commandEvidence gates — env-derived, so a
6753
6835
  // model cannot stamp another step's receipt.
6754
- ...sessionTaskRef ? { taskRef: sessionTaskRef } : {},
6836
+ ...receiptTaskRef ? { taskRef: receiptTaskRef } : {},
6755
6837
  ...sessionStepId ? { stepId: sessionStepId } : {}
6756
6838
  });
6757
6839
  return commandToolResult(`npm run ${script}`, res);
@@ -6776,7 +6858,7 @@ server.tool(
6776
6858
  ...timeoutMs ? { timeoutMs } : {},
6777
6859
  ...gezelId ? { gezelId } : {},
6778
6860
  ...sessionId ? { sessionId } : {},
6779
- ...sessionTaskRef ? { taskRef: sessionTaskRef } : {},
6861
+ ...receiptTaskRef ? { taskRef: receiptTaskRef } : {},
6780
6862
  ...sessionStepId ? { stepId: sessionStepId } : {}
6781
6863
  });
6782
6864
  return commandToolResult(`npx ${bin}`, res);
@@ -7553,133 +7635,139 @@ server.tool(
7553
7635
  "Bypass the workspace-collision and source-code-extension guards. Only set when you deliberately want to stash a code-looking file in artifacts (rare \u2014 a mock, a scratch experiment you're not shipping)."
7554
7636
  )
7555
7637
  }).shape,
7556
- async ({ path, content: rawContent, jsonContent, force }) => {
7557
- const stale = await staleStepMutationResult();
7558
- if (stale) return stale;
7559
- const raster = rasterImageWriteRefusal(path);
7560
- if (raster) return raster;
7561
- const scoped = await taskScopedWriteRefusal(path, "artifacts");
7562
- if (scoped) return scoped;
7563
- if (rawContent === void 0 === (jsonContent === void 0)) {
7564
- return errorResult(
7565
- "Supply exactly one of content or jsonContent. Use jsonContent for a structured JSON report."
7566
- );
7567
- }
7568
- const value = jsonContent ?? rawContent;
7569
- const content = typeof value === "string" ? value : `${JSON.stringify(value, null, 2)}
7638
+ (args) => writeArtifactToolCall(args)
7639
+ );
7640
+ async function writeArtifactToolCall({
7641
+ path,
7642
+ content: rawContent,
7643
+ jsonContent,
7644
+ force
7645
+ }) {
7646
+ const stale = await staleStepMutationResult();
7647
+ if (stale) return stale;
7648
+ const raster = rasterImageWriteRefusal(path);
7649
+ if (raster) return raster;
7650
+ const scoped = await taskScopedWriteRefusal(path, "artifacts");
7651
+ if (scoped) return scoped;
7652
+ if (rawContent === void 0 === (jsonContent === void 0)) {
7653
+ return errorResult(
7654
+ "Supply exactly one of content or jsonContent. Use jsonContent for a structured JSON report."
7655
+ );
7656
+ }
7657
+ const value = jsonContent ?? rawContent;
7658
+ const content = typeof value === "string" ? value : `${JSON.stringify(value, null, 2)}
7570
7659
  `;
7571
- const clean = normalizeArtifactPath(path);
7572
- if (isReservedShadowArtifactPath(clean)) {
7660
+ const clean = normalizeArtifactPath(path);
7661
+ if (isReservedShadowArtifactPath(clean)) {
7662
+ return {
7663
+ content: [
7664
+ {
7665
+ type: "text",
7666
+ text: "artifacts/shadow/ is gezel's derived shadow-file cache (converted documents, image descriptions, transcripts), regenerated automatically by indexing \u2014 anything written there would be overwritten or swept. Write your artifact elsewhere, e.g. at the artifacts root or under reports/."
7667
+ }
7668
+ ],
7669
+ isError: true
7670
+ };
7671
+ }
7672
+ if (isProtectedConnectorArtifactPath(clean)) {
7673
+ return {
7674
+ content: [
7675
+ {
7676
+ type: "text",
7677
+ text: "The artifacts/data directory contains read-only connector mirrors. Editing a synced record can cause permanent data loss because its cursor has already advanced. Write analysis elsewhere in artifacts, or use draft_connector_action to propose a source change for the user."
7678
+ }
7679
+ ],
7680
+ isError: true
7681
+ };
7682
+ }
7683
+ if (!force) {
7684
+ const redirected = await redirectExpectedDeliverableWriteToWorkspace(
7685
+ clean,
7686
+ content,
7687
+ "write_artifact"
7688
+ );
7689
+ if (redirected) return redirected;
7690
+ }
7691
+ const verdict = !force ? classifyArtifactPath(clean) : { ok: true };
7692
+ if (!verdict.ok) {
7693
+ const normalizedContent = normalizeWorkspaceWriteContent(clean, content);
7694
+ const syntax = validateSourceContent(clean, normalizedContent);
7695
+ if (syntax && !syntax.ok) {
7696
+ return {
7697
+ content: [{ type: "text", text: syntax.message }],
7698
+ isError: true
7699
+ };
7700
+ }
7701
+ try {
7702
+ await api.writeProjectWorkspaceFile(projectId, {
7703
+ path: clean,
7704
+ content: normalizedContent,
7705
+ ...gezelId ? { gezelId } : {},
7706
+ ...sessionId ? { sessionId } : {}
7707
+ });
7573
7708
  return {
7574
7709
  content: [
7575
7710
  {
7576
7711
  type: "text",
7577
- text: "artifacts/shadow/ is gezel's derived shadow-file cache (converted documents, image descriptions, transcripts), regenerated automatically by indexing \u2014 anything written there would be overwritten or swept. Write your artifact elsewhere, e.g. at the artifacts root or under reports/."
7712
+ text: `Wrote ${clean} to the project workspace. Note: write_artifact is for scratch artifacts; use write_file directly for app/source deliverables.`
7578
7713
  }
7579
- ],
7714
+ ]
7715
+ };
7716
+ } catch (err) {
7717
+ return {
7718
+ content: [{ type: "text", text: explainWriteFailure(err) }],
7580
7719
  isError: true
7581
7720
  };
7582
7721
  }
7583
- if (isProtectedConnectorArtifactPath(clean)) {
7722
+ }
7723
+ if (!force) {
7724
+ const workspaceCollision = await workspaceCollisionForArtifactPath(clean);
7725
+ if (workspaceCollision) {
7584
7726
  return {
7585
7727
  content: [
7586
7728
  {
7587
7729
  type: "text",
7588
- text: "The artifacts/data directory contains read-only connector mirrors. Editing a synced record can cause permanent data loss because its cursor has already advanced. Write analysis elsewhere in artifacts, or use draft_connector_action to propose a source change for the user."
7730
+ text: `Refusing write_artifact({ path: "${clean}", ... }) because a workspace ${workspaceCollision.kind} already exists at that path. write_artifact would create a side-drawer copy, not update the project. Use write_file if you have workspace write access, or hand off to a developer. Set force: true only if you intentionally want an artifact copy with the same path.`
7589
7731
  }
7590
7732
  ],
7591
7733
  isError: true
7592
7734
  };
7593
7735
  }
7594
- if (!force) {
7595
- const redirected = await redirectExpectedDeliverableWriteToWorkspace(
7596
- clean,
7597
- content,
7598
- "write_artifact"
7599
- );
7600
- if (redirected) return redirected;
7601
- }
7602
- const verdict = !force ? classifyArtifactPath(clean) : { ok: true };
7603
- if (!verdict.ok) {
7604
- const normalizedContent = normalizeWorkspaceWriteContent(clean, content);
7605
- const syntax = validateSourceContent(clean, normalizedContent);
7606
- if (syntax && !syntax.ok) {
7607
- return {
7608
- content: [{ type: "text", text: syntax.message }],
7609
- isError: true
7610
- };
7611
- }
7612
- try {
7613
- await api.writeProjectWorkspaceFile(projectId, {
7614
- path: clean,
7615
- content: normalizedContent,
7616
- ...gezelId ? { gezelId } : {},
7617
- ...sessionId ? { sessionId } : {}
7618
- });
7619
- return {
7620
- content: [
7621
- {
7622
- type: "text",
7623
- text: `Wrote ${clean} to the project workspace. Note: write_artifact is for scratch artifacts; use write_file directly for app/source deliverables.`
7624
- }
7625
- ]
7626
- };
7627
- } catch (err) {
7628
- return {
7629
- content: [{ type: "text", text: explainWriteFailure(err) }],
7630
- isError: true
7631
- };
7632
- }
7633
- }
7634
- if (!force) {
7635
- const workspaceCollision = await workspaceCollisionForArtifactPath(clean);
7636
- if (workspaceCollision) {
7637
- return {
7638
- content: [
7639
- {
7640
- type: "text",
7641
- text: `Refusing write_artifact({ path: "${clean}", ... }) because a workspace ${workspaceCollision.kind} already exists at that path. write_artifact would create a side-drawer copy, not update the project. Use write_file if you have workspace write access, or hand off to a developer. Set force: true only if you intentionally want an artifact copy with the same path.`
7642
- }
7643
- ],
7644
- isError: true
7645
- };
7646
- }
7647
- }
7648
- if (!force) {
7649
- const syntax = validateSourceContent(clean, content);
7650
- if (syntax && !syntax.ok) {
7651
- return {
7652
- content: [{ type: "text", text: syntax.message }],
7653
- isError: true
7654
- };
7655
- }
7736
+ }
7737
+ if (!force) {
7738
+ const syntax = validateSourceContent(clean, content);
7739
+ if (syntax && !syntax.ok) {
7740
+ return {
7741
+ content: [{ type: "text", text: syntax.message }],
7742
+ isError: true
7743
+ };
7656
7744
  }
7657
- if (clean.toLowerCase().endsWith(".json")) {
7658
- try {
7659
- JSON.parse(content);
7660
- } catch (err) {
7661
- return {
7662
- content: [
7663
- {
7664
- type: "text",
7665
- text: `Refusing to replace ${clean}: the new content is not valid JSON (${err instanceof Error ? err.message : String(err)}). The previous artifact was left unchanged. Re-emit one complete valid JSON value; if it cannot fit in one tool call, split the deliverable or use a deterministic script to assemble it.`
7666
- }
7667
- ],
7668
- isError: true
7669
- };
7670
- }
7745
+ }
7746
+ if (clean.toLowerCase().endsWith(".json")) {
7747
+ try {
7748
+ JSON.parse(content);
7749
+ } catch (err) {
7750
+ return {
7751
+ content: [
7752
+ {
7753
+ type: "text",
7754
+ text: `Refusing to replace ${clean}: the new content is not valid JSON (${err instanceof Error ? err.message : String(err)}). The previous artifact was left unchanged. Re-emit one complete valid JSON value; if it cannot fit in one tool call, split the deliverable or use a deterministic script to assemble it.`
7755
+ }
7756
+ ],
7757
+ isError: true
7758
+ };
7671
7759
  }
7672
- const stored = clean.endsWith(".md") ? normalizeMarkdown(content) : content;
7673
- await api.writeProjectArtifact(projectId, clean, stored, {
7674
- ...gezelId ? { gezelId } : {},
7675
- ...sessionId ? { sessionId } : {}
7676
- });
7677
- const completionHint = sessionTaskRef && sessionStepId ? artifactCompletionHint(sessionStepCompletion, {
7678
- checkedByStep: sessionStepCheckedArtifacts.includes(clean)
7679
- }) : "";
7680
- return { content: [{ type: "text", text: `Wrote ${clean}${completionHint}` }] };
7681
7760
  }
7682
- );
7761
+ const stored = clean.endsWith(".md") ? normalizeMarkdown(content) : content;
7762
+ await api.writeProjectArtifact(projectId, clean, stored, {
7763
+ ...gezelId ? { gezelId } : {},
7764
+ ...sessionId ? { sessionId } : {}
7765
+ });
7766
+ const completionHint = sessionTaskRef && sessionStepId ? artifactCompletionHint(sessionStepCompletion, {
7767
+ checkedByStep: sessionStepCheckedArtifacts.includes(clean)
7768
+ }) : "";
7769
+ return { content: [{ type: "text", text: `Wrote ${clean}${completionHint}` }] };
7770
+ }
7683
7771
  server.tool(
7684
7772
  "run_playwright_script",
7685
7773
  "Run a Playwright script from the project's artifacts. **This is the main way gezels automate the browser.** The shape: call `write_artifact` to save a `.ts` file under `tests/` (test-runner mode, `*.spec.ts`) or `scripts/` (bare-script mode via Node's strip-types), then call this tool with the same path to run it. Use it for end-to-end tests, data extraction, multi-step automation, anything you'd want to re-run or tweak. The live `browser_navigate` / `browser_snapshot` tools exist too for quick interactive reads, but writing a short script and running it is usually the better shape \u2014 it leaves an artifact the team can build on. SECURITY: the script runs outside the script sandbox (it drives a real browser with network access), so the user approves each new or edited script before it runs; the approval covers that exact script and the local files it imports.",
@@ -7960,7 +8048,7 @@ server.tool(
7960
8048
  );
7961
8049
  server.tool(
7962
8050
  "apply_project_type",
7963
- "Apply a custom project type to an EXISTING project \u2014 renders its about/mission, creates its gezel(s) and sets the voorman, installs its scripts, and seeds its workspace. Use this to retrofit a plain project into a typed one. To create a fresh typed project in one call, use start_project_from_type instead.",
8051
+ "Apply a custom project type to an EXISTING project \u2014 renders its about/mission, creates its gezel(s) and sets the crew lead, installs its scripts, and seeds its workspace. Use this to retrofit a plain project into a typed one. To create a fresh typed project in one call, use start_project_from_type instead.",
7964
8052
  {
7965
8053
  typeId: z8.string().describe("Project type id (from list_project_types)."),
7966
8054
  project: z8.string().optional().describe("Project id or name. Defaults to the current project."),
@@ -7974,7 +8062,7 @@ server.tool(
7974
8062
  ...params ? { params } : {}
7975
8063
  });
7976
8064
  const gz = applied.gezelsCreated.map(
7977
- (g) => `${g.name}${g.voorman ? " (voorman)" : ""}${g.reused ? " (already on the crew)" : ""}`
8065
+ (g) => `${g.name}${g.voorman ? " (crew lead)" : ""}${g.reused ? " (already on the crew)" : ""}`
7978
8066
  ).join(", ");
7979
8067
  return {
7980
8068
  content: [
@@ -7996,12 +8084,12 @@ server.tool(
7996
8084
  );
7997
8085
  server.tool(
7998
8086
  "start_project_from_type",
7999
- `Create a fresh project from a custom project type in one call: makes the project, applies the type (its gezel becomes the voorman, its scripts/seed/dashboard are installed), and notifies the voorman to greet the user. Use when the user's goal matches a type from list_project_types (e.g. "I want to learn Spanish" \u2192 the language-trainer type). For a generic build of any size, use start_project.`,
8087
+ `Create a fresh project from a custom project type in one call: makes the project, applies the type (its gezel becomes the crew lead, its scripts/seed/dashboard are installed), and notifies the crew lead to greet the user. Use when the user's goal matches a type from list_project_types (e.g. "I want to learn Spanish" \u2192 the language-trainer type). For a generic build of any size, use start_project.`,
8000
8088
  {
8001
8089
  name: z8.string().describe('Project name, e.g. "Learn Spanish".'),
8002
8090
  typeId: z8.string().describe("Project type id (from list_project_types)."),
8003
8091
  params: z8.record(z8.string(), z8.any()).optional().describe('Param values the type asks for (e.g. { "language": "Spanish" }).'),
8004
- kickoffMessage: z8.string().optional().describe("Optional first message to send the voorman after setup.")
8092
+ kickoffMessage: z8.string().optional().describe("Optional first message to send the crew lead after setup.")
8005
8093
  },
8006
8094
  async ({ name, typeId, params, kickoffMessage }) => {
8007
8095
  let manifestName = typeId;
@@ -8030,20 +8118,20 @@ server.tool(
8030
8118
  const voorman = applied.gezelsCreated.find((g) => g.voorman) ?? applied.gezelsCreated[0];
8031
8119
  let voormanNote = "";
8032
8120
  if (voorman) {
8033
- const text = kickoffMessage ?? `You're the voorman of the new "${name}" project (${manifestName}). Greet the user warmly, explain what you'll help with, and get them started.`;
8121
+ const text = kickoffMessage ?? `You're the crew lead of the new "${name}" project (${manifestName}). Greet the user warmly, explain what you'll help with, and get them started.`;
8034
8122
  await api.messageGezel(voorman.id, {
8035
8123
  fromGezelId: gezelId,
8036
8124
  ...sessionId ? { fromSessionId: sessionId } : {},
8037
8125
  projectId: project.id,
8038
8126
  text
8039
8127
  });
8040
- voormanNote = ` ${voorman.name} is the voorman and will greet the user in the next turn.`;
8128
+ voormanNote = ` ${voorman.name} is the crew lead and will greet the user in the next turn.`;
8041
8129
  }
8042
8130
  return {
8043
8131
  content: [
8044
8132
  {
8045
8133
  type: "text",
8046
- text: `Started "${name}" (${project.id}) from the ${manifestName} project type.${voormanNote} Installed ${applied.scriptsInstalled.length} script(s); seeded ${applied.workspaceSeeded.length} file(s). Tell the user their ${manifestName} project is ready.`
8134
+ text: `Started "${name}" (${project.id}) from the ${manifestName} project type.${voormanNote} Installed ${applied.scriptsInstalled.length} script(s); seeded ${applied.workspaceSeeded.length} file(s). Tell the user their ${manifestName} project is ready. ${PLAIN_WORDS_RELAY}`
8047
8135
  }
8048
8136
  ]
8049
8137
  };
@@ -8654,7 +8742,7 @@ async function runInvokeCraftbook({
8654
8742
  }
8655
8743
  },
8656
8744
  {
8657
- text: `Invoked craftbook "${craftbookId}" \u2014 task ${created.ref} (${stepCount} step(s)). Active step ${created.activeStepId ?? "(none)"} was dispatched to the recipe-selected specialist.${installedText}${versionText}${idempotentText}`
8745
+ text: `Invoked craftbook "${craftbookId}" \u2014 task ${created.ref} (${stepCount} step(s)). Active step ${created.activeStepId ?? "(none)"} was dispatched to the recipe-selected specialist.${installedText}${versionText}${idempotentText} Tell the person that ${taskPersonNoun(created)} is underway. ${PLAIN_WORDS_RELAY}`
8658
8746
  }
8659
8747
  );
8660
8748
  } catch (err) {
@@ -9156,7 +9244,7 @@ server.tool(
9156
9244
  );
9157
9245
  server.tool(
9158
9246
  "export_task_craftbook",
9159
- "Promote a task's embedded craftbook into a reusable LOCAL craftbook template (the inverse of invoke_craftbook). Strips per-instance lifecycle state and mints a fresh template id. Use after the voorman has shaped a good craftbook on a task and you want to reuse it.",
9247
+ "Promote a task's embedded craftbook into a reusable LOCAL craftbook template (the inverse of invoke_craftbook). Strips per-instance lifecycle state and mints a fresh template id. Use after the crew lead has shaped a good craftbook on a task and you want to reuse it.",
9160
9248
  {
9161
9249
  task: z8.string().optional().describe("Task ref. Omit \u2192 session task."),
9162
9250
  id: z8.string().optional().describe("Preferred template id (slugified; deduped on collision)."),
@@ -9177,7 +9265,7 @@ server.tool(
9177
9265
  );
9178
9266
  server.tool(
9179
9267
  "list_project_local_gezels",
9180
- "List this project's own gezels \u2014 the `@project` gezel derived from the workspace AGENTS.md/CLAUDE.md (the project's default voorman) plus any others defined in the workspace `.gezel/` folder. Address the canonical one as `@project` in ask_gezel / message_gezel. These never appear in the global list_gezels roster.",
9268
+ "List this project's own gezels \u2014 the `@project` gezel derived from the workspace AGENTS.md/CLAUDE.md (the project's default crew lead) plus any others defined in the workspace `.gezel/` folder. Address the canonical one as `@project` in ask_gezel / message_gezel. These never appear in the global list_gezels roster.",
9181
9269
  {
9182
9270
  project: z8.string().optional().describe("Project id or name. Defaults to the current project.")
9183
9271
  },
@@ -9518,7 +9606,7 @@ var ROLE_TO_JOB_TITLE = {
9518
9606
  writer: "Copywriter",
9519
9607
  planner: "Planner",
9520
9608
  reviewer: "Reviewer",
9521
- voorman: "Voorman",
9609
+ voorman: "Crew Lead",
9522
9610
  // Must match the `image-generator` template's role string verbatim
9523
9611
  // so the role-tool-filter map keys hit and the gezel gets the
9524
9612
  // `images` group. Display name renders as "Image Generator" in
@@ -9527,10 +9615,10 @@ var ROLE_TO_JOB_TITLE = {
9527
9615
  };
9528
9616
  server.tool(
9529
9617
  "ask_specialist",
9530
- "Quick role-shaped consultation. Picks (or auto-creates) a gezel matching `role` and synchronously asks them `question` \u2014 their answer comes back as the tool result, ready to use inline within this turn. ONE call replaces the `ensure_gezel` \u2192 `ask_gezel` sequence. Use this for domain answers you need to keep working: 'researcher' for facts and prior art, 'designer' for visual / UX feedback, 'developer' or 'builder' for technical implementation calls, 'writer' for copy, 'planner' for breaking work down, 'reviewer' for QA on a draft, 'voorman' for project-status questions. Do NOT use this for shippable file or image deliverables (`index.html`, `review.md`, `logo.png`): first call `ensure_gezel`, then `message_gezel` with `expectedDeliverable: { kind: \"file\", filePath: \"<path>\" }` so the specialist works asynchronously and writes/renders the file. `ask_specialist` rejects file-shaped expectedDeliverable hints. The chosen specialist auto-joins your current project so the user can switch to their chat for follow-ups. For a specific known gezel use `ask_gezel`; for fan-out / fire-and-forget pings use `message_gezel`.",
9618
+ "Quick role-shaped consultation. Picks (or auto-creates) a gezel matching `role` and synchronously asks them `question` \u2014 their answer comes back as the tool result, ready to use inline within this turn. ONE call replaces the `ensure_gezel` \u2192 `ask_gezel` sequence. Use this for domain answers you need to keep working: 'researcher' for facts and prior art, 'designer' for visual / UX feedback, 'developer' or 'builder' for technical implementation calls, 'writer' for copy, 'planner' for breaking work down, 'reviewer' for QA on a draft, 'voorman' (the crew lead) for project-status questions. Do NOT use this for shippable file or image deliverables (`index.html`, `review.md`, `logo.png`): first call `ensure_gezel`, then `message_gezel` with `expectedDeliverable: { kind: \"file\", filePath: \"<path>\" }` so the specialist works asynchronously and writes/renders the file. `ask_specialist` rejects file-shaped expectedDeliverable hints. The chosen specialist auto-joins your current project so the user can switch to their chat for follow-ups. For a specific known gezel use `ask_gezel`; for fan-out / fire-and-forget pings use `message_gezel`.",
9531
9619
  {
9532
9620
  role: SPECIALIST_ROLES.describe(
9533
- "researcher = long-form analysis / facts / prior art (files a written report to disk by default), developer = team-oriented engineering, builder = solo product engineer, generalist = one gezel for a whole multi-step task of any craft, designer = visual/UX advice (does NOT render images), writer = copy/content, planner = strategy/decomposition, reviewer = QA/feedback (short structured verification reply by default), voorman = current-project lead, image-generator = render an actual PNG via generate_image (use this when you need a real image asset, not just visual feedback)."
9621
+ "researcher = long-form analysis / facts / prior art (files a written report to disk by default), developer = team-oriented engineering, builder = solo product engineer, generalist = one gezel for a whole multi-step task of any craft, designer = visual/UX advice (does NOT render images), writer = copy/content, planner = strategy/decomposition, reviewer = QA/feedback (short structured verification reply by default), voorman = crew lead of the current project, image-generator = render an actual PNG via generate_image (use this when you need a real image asset, not just visual feedback)."
9534
9622
  ),
9535
9623
  question: z8.string().min(1).describe(
9536
9624
  "What you want them to answer. Be specific \u2014 they only see this question, not your prior conversation."
@@ -9690,12 +9778,48 @@ var DELEGATION_ROLE_SPECS = [
9690
9778
  },
9691
9779
  {
9692
9780
  slug: "voorman",
9693
- jobTitle: "Voorman",
9694
- label: "voorman",
9781
+ jobTitle: "Crew Lead",
9782
+ label: "crew lead",
9695
9783
  hint: "project lead / coordination / status"
9696
9784
  },
9697
9785
  { slug: "meester", jobTitle: "Meester", label: "meester", hint: "top-level orchestration" }
9698
9786
  ];
9787
+ function isOutcomeTeammateSlug(slug) {
9788
+ return OUTCOME_TEAMMATE_SLUGS.includes(slug);
9789
+ }
9790
+ async function consultTaskTeammate(slug, label, question, timeoutMs) {
9791
+ const parsed = await parseRef(sessionTaskRef);
9792
+ const ask = await api.askTaskTeammate(parsed.projectId, parsed.num, {
9793
+ fromGezelId: gezelId,
9794
+ fromSessionId: sessionId,
9795
+ role: slug,
9796
+ question,
9797
+ ...typeof timeoutMs === "number" ? { timeoutMs } : {}
9798
+ });
9799
+ if (ask.outcome === "reply") {
9800
+ return {
9801
+ content: [
9802
+ {
9803
+ type: "text",
9804
+ text: `${ask.toGezelName} (${label}) answered:
9805
+
9806
+ ${ask.text}
9807
+
9808
+ Check any file they say they wrote before you rely on it.`
9809
+ }
9810
+ ]
9811
+ };
9812
+ }
9813
+ return {
9814
+ content: [
9815
+ {
9816
+ type: "text",
9817
+ text: JSON.stringify({ outcome: "error", reason: ask.reason, message: ask.message })
9818
+ }
9819
+ ],
9820
+ isError: true
9821
+ };
9822
+ }
9699
9823
  for (const { slug, jobTitle, label, hint } of DELEGATION_ROLE_SPECS) {
9700
9824
  server.tool(
9701
9825
  `delegate_${slug}`,
@@ -9765,7 +9889,7 @@ ${expectedDeliverable?.kind === "file" ? expectedDeliverable.filePath ?? "" : ""
9765
9889
  );
9766
9890
  server.tool(
9767
9891
  `consult_${slug}`,
9768
- `Ask a project's ${label} (${hint}) a question and get their answer back synchronously, this turn. Auto-creates a ${label} if none exists. For a project you created from Default, pass \`project\` so the answer uses the right files and memory. For handing off actual work or files, use \`delegate_${slug}\` instead.`,
9892
+ taskTeammates && isOutcomeTeammateSlug(slug) ? `Hand a self-contained piece of your task to a ${label} (${hint}) and get their answer back this turn. Auto-creates a ${label} if none exists. They work in this project and see only what you write here: name the files to read and the file to write. You stay responsible for the result, so check what they wrote.` : `Ask a project's ${label} (${hint}) a question and get their answer back synchronously, this turn. Auto-creates a ${label} if none exists. For a project you created from Default, pass \`project\` so the answer uses the right files and memory. For handing off actual work or files, use \`delegate_${slug}\` instead.`,
9769
9893
  {
9770
9894
  question: z8.string().min(1).describe(
9771
9895
  `What you want the ${label} to answer. Be specific \u2014 they only see this question.`
@@ -9794,6 +9918,9 @@ ${expectedDeliverable?.kind === "file" ? expectedDeliverable.filePath ?? "" : ""
9794
9918
  };
9795
9919
  }
9796
9920
  try {
9921
+ if (taskTeammates && sessionTaskRef && isOutcomeTeammateSlug(slug)) {
9922
+ return await consultTaskTeammate(slug, label, question, timeoutMs);
9923
+ }
9797
9924
  const resolvedProject = project ? await resolveProjectId(project) : projectId;
9798
9925
  const repoGuard = await repoIntakeGuardForProject({
9799
9926
  tool: `consult_${slug}`,
@@ -10339,7 +10466,7 @@ ${idempotent.resultText}`
10339
10466
  dispatchEntry: true
10340
10467
  });
10341
10468
  const entryName = await macroEntryAssigneeName(task, voorman.id, voorman.name);
10342
- const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${voorman.name} as voorman. Created task ${task.ref} ("${task.title}") and handed its entry step to ${entryName} \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (get_task / read_task_notes when the user asks). Tell the user ${entryName} is on it; they can watch the work in the ${brief.name} project.`;
10469
+ const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${voorman.name} as crew lead. Created task ${task.ref} ("${task.title}") and handed its entry step to ${entryName} \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (get_task / read_task_notes when the user asks). Tell the user ${entryName} is on it; they can watch the work in the ${brief.name} project. ${PLAIN_WORDS_RELAY}`;
10343
10470
  recordMacroResult("start_project", brief.name, project.id, resultText);
10344
10471
  return {
10345
10472
  content: [
@@ -10508,7 +10635,7 @@ Note from the meester: ${opts.kickoffMessage.trim()}` : "";
10508
10635
  dispatchEntry: true
10509
10636
  });
10510
10637
  const role = (await api.getGezel(lead.id).catch(() => null))?.role;
10511
- const resultText = `Started "${project.name}" (${project.id}) as a ${type.name} project. ${lead.name}${role ? ` (${roleWithGloss(role)})` : ""} leads it and is making the first draft now in a task-scoped session (task ${task.ref}); the project's Output page shows it as it fills in. No reply lands in this thread. Tell the person in a sentence or two that ${lead.name} is on it.`;
10638
+ const resultText = `Started "${project.name}" (${project.id}) as a ${type.name} project. ${lead.name}${role ? ` (${plainRoleTitle(role)})` : ""} leads it and is making the first draft now in a task-scoped session (task ${task.ref}); the project's Output page shows it as it fills in. No reply lands in this thread. Tell the person in a sentence or two that ${lead.name} is on it. ${PLAIN_WORDS_RELAY}`;
10512
10639
  recordMacroResult(opts.cacheTool, brief.name, project.id, resultText);
10513
10640
  return { content: [{ type: "text", text: resultText }] };
10514
10641
  } catch (err) {
@@ -10568,7 +10695,7 @@ async function runStartProject(input, tool) {
10568
10695
  content: [
10569
10696
  {
10570
10697
  type: "text",
10571
- text: `[runtime] A \`${idempotent.tool}\` call for "${brief.name}" completed moments ago \u2014 replaying the original result instead of creating a duplicate. END YOUR TURN; the voorman from the original call is already on it.
10698
+ text: `[runtime] A \`${idempotent.tool}\` call for "${brief.name}" completed moments ago \u2014 replaying the original result instead of creating a duplicate. END YOUR TURN; the crew lead from the original call is already on it.
10572
10699
 
10573
10700
  ${idempotent.resultText}`
10574
10701
  }
@@ -10630,7 +10757,7 @@ ${idempotent.resultText}`
10630
10757
  dispatchEntry: true
10631
10758
  });
10632
10759
  const entryName = await macroEntryAssigneeName(task, voorman.id, voorman.name);
10633
- const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${voorman.name} as voorman. Created task ${task.ref} ("${task.title}") and handed its entry step to ${entryName} \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (get_task / read_task_notes when the user asks). Tell the user ${entryName} is on it; they can watch the work in the ${brief.name} project.`;
10760
+ const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${voorman.name} as crew lead. Created task ${task.ref} ("${task.title}") and handed its entry step to ${entryName} \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (get_task / read_task_notes when the user asks). Tell the user ${entryName} is on it; they can watch the work in the ${brief.name} project. ${PLAIN_WORDS_RELAY}`;
10634
10761
  recordMacroResult(tool, brief.name, project.id, resultText);
10635
10762
  return {
10636
10763
  content: [
@@ -10767,7 +10894,7 @@ server.tool(
10767
10894
  "There is no request in this turn to start work for. Pass `details` with what the person asked for."
10768
10895
  );
10769
10896
  }
10770
- const resolvedProject = project ? await resolveProjectId(project) : (await rankingForTurn(projectId, said).catch(() => null))?.projectId ?? projectId;
10897
+ const resolvedProject = project ? await resolveProjectId(project, ["start_work"]) : (await rankingForTurn(projectId, said).catch(() => null))?.projectId ?? projectId;
10771
10898
  const parsed = parseWorkOptionId(option) ?? await resolveBareWorkOption(option, resolvedProject, said);
10772
10899
  if (!parsed) {
10773
10900
  const listed = await rankingForTurn(resolvedProject, said).catch(() => null);
@@ -10863,7 +10990,7 @@ async function toggleRecurringWork(project, key, pause) {
10863
10990
  content: [
10864
10991
  {
10865
10992
  type: "text",
10866
- text: `Paused "${item2.craftbookName ?? item2.craftbookId}"${item2.taskRef ? ` (host task ${item2.taskRef})` : ""}. Its history is kept; switching it back on resumes it. Tell the person it is off.`
10993
+ text: `Paused "${item2.craftbookName ?? item2.craftbookId}"${item2.taskRef ? ` (host task ${item2.taskRef})` : ""}. Its history is kept; switching it back on resumes it. Tell the person it is off. ${PLAIN_WORDS_RELAY}`
10867
10994
  }
10868
10995
  ]
10869
10996
  };
@@ -10874,7 +11001,7 @@ async function toggleRecurringWork(project, key, pause) {
10874
11001
  content: [
10875
11002
  {
10876
11003
  type: "text",
10877
- text: `Switched on "${item.craftbookName ?? item.craftbookId}" \u2014 it runs ${cadence}, host task ${task.ref}. Tell the person when it will first run.`
11004
+ text: `Switched on "${item.craftbookName ?? item.craftbookId}" \u2014 it runs ${cadence}, host task ${task.ref}. Tell the person when it will first run. ${PLAIN_WORDS_RELAY}`
10878
11005
  }
10879
11006
  ]
10880
11007
  };
@@ -11010,7 +11137,7 @@ ${idempotent.resultText}`
11010
11137
  ],
11011
11138
  dispatchEntry: true
11012
11139
  });
11013
- const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${builder.name} as lead (template: ${builder.templateId}). Created task ${task.ref} ("${task.title}") and handed ${builder.name} its entry step \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (notes, gates, status \u2014 get_task / read_task_notes when the user asks). Tell the user ${builder.name} is on it and they can watch the work in the ${brief.name} project.`;
11140
+ const resultText = `Started project "${brief.name}" (${project.id}). Recruited ${builder.name} as lead (template: ${builder.templateId}). Created task ${task.ref} ("${task.title}") and handed ${builder.name} its entry step \u2014 they are starting now in a task-scoped session. No reply lands in this thread; progress accrues on the task (notes, gates, status \u2014 get_task / read_task_notes when the user asks). Tell the user ${builder.name} is on it and they can watch the work in the ${brief.name} project. ${PLAIN_WORDS_RELAY}`;
11014
11141
  recordMacroResult(cacheTool, brief.name, project.id, resultText);
11015
11142
  return {
11016
11143
  content: [
@@ -11226,7 +11353,7 @@ server.tool(
11226
11353
  );
11227
11354
  server.tool(
11228
11355
  "remove_gezel_from_project",
11229
- "Drop a gezel from a project's roster. Advisory only \u2014 doesn't tear down their existing chat sessions, task assignments, or the project's voorman pointer; the gezel just stops showing up in the project's team list. Re-add via `add_gezel_to_project` (or any of the auto-add triggers will pull them back in).",
11356
+ "Drop a gezel from a project's roster. Advisory only \u2014 doesn't tear down their existing chat sessions, task assignments, or the project's crew lead pointer; the gezel just stops showing up in the project's team list. Re-add via `add_gezel_to_project` (or any of the auto-add triggers will pull them back in).",
11230
11357
  {
11231
11358
  gezel: z8.string().describe("Gezel id or display name"),
11232
11359
  project: z8.string().optional().describe("Project id or name \u2014 defaults to your current project")
@@ -11514,7 +11641,7 @@ server.tool(
11514
11641
  ref: z8.string(),
11515
11642
  title: z8.string().optional(),
11516
11643
  description: z8.string().optional(),
11517
- plan: z8.string().optional().describe("The voorman's evolving approach. Overwrites the existing plan."),
11644
+ plan: z8.string().optional().describe("The crew lead's evolving approach. Overwrites the existing plan."),
11518
11645
  assignee: assigneeArg().optional(),
11519
11646
  cron: z8.string().optional(),
11520
11647
  cronOverlap: cronOverlapEnum.optional(),
@@ -12212,48 +12339,6 @@ ${why}`) },
12212
12339
  );
12213
12340
  }
12214
12341
  );
12215
- async function resolveProjectId(input) {
12216
- try {
12217
- const p = await api.getProject(input);
12218
- return p.id;
12219
- } catch {
12220
- }
12221
- let all;
12222
- try {
12223
- all = (await api.listProjects()).projects;
12224
- } catch (err) {
12225
- if (/\b403\b/.test(err instanceof Error ? err.message : String(err))) {
12226
- return projectId;
12227
- }
12228
- throw err;
12229
- }
12230
- const match = findProjectByReference(all, input);
12231
- if (match) return match.id;
12232
- throw new Error(projectNotFoundMessage(input, all));
12233
- }
12234
- async function resolveGezelId(input) {
12235
- const all = (await api.listGezels()).gezels;
12236
- const match = findGezelInRoster(all, input);
12237
- if (match) return match.id;
12238
- try {
12239
- const g = await api.getGezel(input);
12240
- return g.id;
12241
- } catch {
12242
- }
12243
- throw new Error(gezelNotFoundMessage(input, all));
12244
- }
12245
- async function availableGezelsHint() {
12246
- try {
12247
- return gezelRosterHint((await api.listGezels()).gezels);
12248
- } catch {
12249
- return "Call `list_gezels` for the roster.";
12250
- }
12251
- }
12252
- async function parseRef(ref) {
12253
- const parsed = resolveTaskRef(ref, sessionTaskRef);
12254
- if (isSafeEntityId(parsed.projectId)) return parsed;
12255
- return { ...parsed, projectId: await resolveProjectId(parsed.projectId) };
12256
- }
12257
12342
  server.tool(
12258
12343
  "search_history",
12259
12344
  'Search the history log \u2014 gezel / project creation, settings changes, tool calls, chat session summaries, document changes. Your first stop when debugging "why is this the way it is?" or tracing what has happened recently.',
@@ -12960,7 +13045,7 @@ ${body}` }] };
12960
13045
  );
12961
13046
  server.tool(
12962
13047
  "file_review",
12963
- "The boekwachter's cliffs notes + health review for one file: what it does and how it flows, issues spotted (severity/category/message/line), and a 1-10 health score with its reason, judged against a per-file-type rubric. Call before deep-diving an unfamiliar file, or when outline_file shows low health. Issues are LEADS from a background model pass, not confirmed problems \u2014 verify each in the code.",
13048
+ "The Librarian's notes + health review for one file: what it does and how it flows, issues spotted (severity/category/message/line), and a 1-10 health score with its reason, judged against a per-file-type rubric. Call before deep-diving an unfamiliar file, or when outline_file shows low health. Issues are LEADS from a background model pass, not confirmed problems \u2014 verify each in the code.",
12964
13049
  {
12965
13050
  path: z8.string().min(1).describe("Workspace-relative file path, e.g. src/server.ts.")
12966
13051
  },
@@ -12982,7 +13067,7 @@ ${tracked.join("\n")}`
12982
13067
  ]
12983
13068
  };
12984
13069
  }
12985
- const why = res.eligible === false ? "this file type is not reviewed (no rubric covers its kind \u2014 e.g. data files, caches, media)" : res.pending ? "the boekwachter has not reviewed this file yet (it studies files when idle or during Night Shift)" : "file is not in the index";
13070
+ const why = res.eligible === false ? "this file type is not reviewed (no rubric covers its kind \u2014 e.g. data files, caches, media)" : res.pending ? "the Librarian has not reviewed this file yet (it studies files when idle or during Night Shift)" : "file is not in the index";
12986
13071
  return {
12987
13072
  content: [{ type: "text", text: `file_review: no review \u2014 ${why}.` }]
12988
13073
  };
@@ -13015,7 +13100,7 @@ ${issues.join("\n")}` : "issues: none",
13015
13100
  );
13016
13101
  server.tool(
13017
13102
  "get_file_issue",
13018
- "Retrieve the durable metadata for one Boekwachter issue by its BW reference: path, previous/current line state, lifecycle, read state, and linked task. Use this when a prompt or task mentions BW-N.",
13103
+ "Retrieve the durable metadata for one tracked issue by its BW reference: path, previous/current line state, lifecycle, read state, and linked task. Use this when a prompt or task mentions BW-N.",
13019
13104
  {
13020
13105
  ref: z8.string().regex(/^BW-[1-9]\d*$/).describe("Project-scoped reference, e.g. BW-17.")
13021
13106
  },
@@ -13046,7 +13131,7 @@ server.tool(
13046
13131
  );
13047
13132
  server.tool(
13048
13133
  "set_file_issue_status",
13049
- "Update a tracked Boekwachter issue by BW reference. Read/unread is independent of lifecycle. Use dismissed + not_an_issue only after verifying that the review lead is invalid; task completion normally resolves issues automatically.",
13134
+ "Update a tracked issue by BW reference. Read/unread is independent of lifecycle. Use dismissed + not_an_issue only after verifying that the review lead is invalid; task completion normally resolves issues automatically.",
13050
13135
  {
13051
13136
  ref: z8.string().regex(/^BW-[1-9]\d*$/).describe("Project-scoped reference, e.g. BW-17."),
13052
13137
  status: z8.enum(["open", "in_progress", "resolved", "dismissed"]).optional(),
@@ -13479,7 +13564,7 @@ ${lines.join("\n") || "(none matched)"}` }
13479
13564
  );
13480
13565
  server.tool(
13481
13566
  "list_file_issues",
13482
- "Quality issues the boekwachter review pass spotted across files (likely bugs, code smells, unclear naming; grammar/clarity in docs), filterable by severity, category, or path prefix. Severities are info|minor|major \u2014 a quality vocabulary, unrelated to security severities; use scan_findings for vulnerabilities. These are LEADS from a background model pass, not confirmed problems; verify each in the code.",
13567
+ "Quality issues the Librarian's review pass spotted across files (likely bugs, code smells, unclear naming; grammar/clarity in docs), filterable by severity, category, or path prefix. Severities are info|minor|major \u2014 a quality vocabulary, unrelated to security severities; use scan_findings for vulnerabilities. These are LEADS from a background model pass, not confirmed problems; verify each in the code.",
13483
13568
  {
13484
13569
  severity: z8.enum(["info", "minor", "major"]).optional(),
13485
13570
  category: z8.string().optional().describe("e.g. bug, smell, error-handling, grammar, clarity."),