@tablation/crew 0.156.0 → 0.157.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.
package/dist/cli.js CHANGED
@@ -4484,6 +4484,7 @@ function parseResolved(raw, m, where) {
4484
4484
  areaId: raw.areaId,
4485
4485
  shipsModelId: raw.shipsModelId,
4486
4486
  epicsModelId: raw.epicsModelId,
4487
+ mapsModelId: raw.mapsModelId,
4487
4488
  periscopesModelId: raw.periscopesModelId,
4488
4489
  locksModelId: raw.locksModelId,
4489
4490
  recordLinkViewId: raw.recordLinkViewId,
@@ -8223,6 +8224,7 @@ function forbiddenDetail(e, route2) {
8223
8224
  [r?.shipsModelId, "Ships"],
8224
8225
  [r?.locksModelId, "Locks"],
8225
8226
  [r?.epicsModelId, "Epics"],
8227
+ [r?.mapsModelId, "Maps"],
8226
8228
  [r?.periscopesModelId, "Periscopes"],
8227
8229
  [r?.reposModelId, "Repos"]
8228
8230
  ];
@@ -9021,6 +9023,15 @@ var DEFAULT_CONTRACT = {
9021
9023
  keyColumn: "epic_id",
9022
9024
  statuses: { planned: "planned", building: "in_progress", done: "done", cancelled: "cancelled" }
9023
9025
  },
9026
+ maps: {
9027
+ epicColumn: "epic_id",
9028
+ titleColumn: "title",
9029
+ contentColumn: "content",
9030
+ conversationColumn: "conversation",
9031
+ statusColumn: "status",
9032
+ versionColumn: "version",
9033
+ activeStatus: "active"
9034
+ },
9024
9035
  priorityOrder: ["p0", "p1", "p2", "p3"],
9025
9036
  severityOrder: ["s1", "s2", "s3", "s4"],
9026
9037
  unknownPriorityRank: 2,
@@ -9043,6 +9054,7 @@ function resolveContract(override) {
9043
9054
  ...override.epics,
9044
9055
  statuses: { ...DEFAULT_CONTRACT.epics.statuses, ...override.epics?.statuses }
9045
9056
  },
9057
+ maps: { ...DEFAULT_CONTRACT.maps, ...override.maps },
9046
9058
  priorityOrder: override.priorityOrder ?? DEFAULT_CONTRACT.priorityOrder,
9047
9059
  severityOrder: override.severityOrder ?? DEFAULT_CONTRACT.severityOrder,
9048
9060
  unknownPriorityRank: override.unknownPriorityRank ?? DEFAULT_CONTRACT.unknownPriorityRank,
@@ -9812,6 +9824,36 @@ var Tracker = class {
9812
9824
  return [];
9813
9825
  }
9814
9826
  }
9827
+ /** One Epics row, or `undefined` when the workspace has no Epics table or the row is gone (CREW-3444). */
9828
+ async epicRow(id) {
9829
+ const model = this.route.resolved?.epicsModelId;
9830
+ if (!model) return void 0;
9831
+ try {
9832
+ return await this.client.records.get(model, id);
9833
+ } catch {
9834
+ return void 0;
9835
+ }
9836
+ }
9837
+ /**
9838
+ * Every Maps row of one epic, whatever its status (CREW-3444). **Throws**,
9839
+ * unlike `epicRows()`: a brief must tell "this seat may not read Maps" from
9840
+ * "the epic has none", and swallowing the 403 would turn the first into
9841
+ * the second. Callers classify the error.
9842
+ */
9843
+ async mapRows(epicId) {
9844
+ const model = this.route.resolved?.mapsModelId;
9845
+ if (!model) return [];
9846
+ return this.client.records.list(model, {
9847
+ filters: encodeFilters([{ columnName: this.contract.maps.epicColumn, operator: "EQ", value: epicId }]),
9848
+ limit: 100
9849
+ });
9850
+ }
9851
+ /** One Maps row in full, for the document's text. Throws like `mapRows`. */
9852
+ async mapRow(id) {
9853
+ const model = this.route.resolved?.mapsModelId;
9854
+ if (!model) throw new ConfigError(`route "${this.route.route}" has no Maps table`);
9855
+ return this.client.records.get(model, id);
9856
+ }
9815
9857
  /**
9816
9858
  * The tickets of these epics that are closed (`closed: true`) or not
9817
9859
  * (`closed: false`), for the epic sync (CREW-1255).
@@ -9977,23 +10019,23 @@ var Tracker = class {
9977
10019
  this.onReadFailure?.(`reading status changes failed: ${err3 instanceof Error ? err3.message : String(err3)}`);
9978
10020
  return [];
9979
10021
  }
9980
- const str = (v) => typeof v === "string" && v ? v : null;
10022
+ const str2 = (v) => typeof v === "string" && v ? v : null;
9981
10023
  const out = [];
9982
10024
  for (const r of rows) {
9983
10025
  if (r.event_type !== "field_changed" || r.field !== this.contract.columns.status) continue;
9984
10026
  const meta = r.metadata && typeof r.metadata === "object" ? r.metadata : {};
9985
- const to = str(meta.to) ?? str(r.to_value);
9986
- const at = str(r.occurred_at) ?? str(r.created_at);
9987
- const record = str(r.record_id);
10027
+ const to = str2(meta.to) ?? str2(r.to_value);
10028
+ const at = str2(r.occurred_at) ?? str2(r.created_at);
10029
+ const record = str2(r.record_id);
9988
10030
  if (!to || !at || !record) continue;
9989
10031
  out.push({
9990
10032
  record_id: record,
9991
10033
  to,
9992
10034
  occurred_at: at,
9993
- actor_kind: str(r.actor_kind),
9994
- actor_id: str(r.actor_id),
9995
- actor_name: str(r.actor_name),
9996
- actor_record_id: str(r.actor_record_id)
10035
+ actor_kind: str2(r.actor_kind),
10036
+ actor_id: str2(r.actor_id),
10037
+ actor_name: str2(r.actor_name),
10038
+ actor_record_id: str2(r.actor_record_id)
9997
10039
  });
9998
10040
  }
9999
10041
  return out.sort((a, b) => Date.parse(b.occurred_at) - Date.parse(a.occurred_at));
@@ -13213,10 +13255,20 @@ async function linkReleaseSeat(route2, client2, agentsModel, userAgent, readOnly
13213
13255
  if (e instanceof CrewAgentFieldMissing) return { note: `Release: ${CREW_FIELD_MISSING_NOTE}` };
13214
13256
  throw e;
13215
13257
  }
13216
- const seatRow = await client2.records.get(crewModelId, seatId);
13258
+ const seatRow = await getSeatRow(client2, crewModelId, seatId);
13259
+ if (!seatRow) return { note: `Release: ${SEAT_MISSING_NOTE}` };
13217
13260
  if (seatRow[CREW_AGENT_COLUMN] !== agentId) await client2.records.update(crewModelId, seatId, { [columnName]: agentId });
13218
13261
  return { agentId };
13219
13262
  }
13263
+ var SEAT_MISSING_NOTE = "the configured Crew row no longer exists (deleted?) \u2014 re-run `crew connect` to pick a seat";
13264
+ async function getSeatRow(client2, crewModelId, seatId) {
13265
+ try {
13266
+ return await client2.records.get(crewModelId, seatId);
13267
+ } catch (e) {
13268
+ if (e instanceof TablationApiError && e.status === 404) return null;
13269
+ throw e;
13270
+ }
13271
+ }
13220
13272
  var NO_WRITE_NOTE = "this key has no write access to the Agents table";
13221
13273
  var CREW_FIELD_MISSING_NOTE = "Crew table has no Agent field yet \u2014 a workspace admin's `crew agents sync` adds it";
13222
13274
  var CrewAgentFieldMissing = class extends Error {
@@ -13251,7 +13303,11 @@ async function linkCrewSeats(route2, client2, agentsModelId, agentPersonas, user
13251
13303
  outcomes.push({ role, action: readOnly ? "no_agents_row" : "persona_diverged" });
13252
13304
  continue;
13253
13305
  }
13254
- const seatRow = await client2.records.get(crewModelId, seatId);
13306
+ const seatRow = await getSeatRow(client2, crewModelId, seatId);
13307
+ if (!seatRow) {
13308
+ outcomes.push({ role, action: "seat_missing" });
13309
+ continue;
13310
+ }
13255
13311
  if (seatRow[CREW_AGENT_COLUMN] === agentId) {
13256
13312
  outcomes.push({ role, action: "already_linked" });
13257
13313
  continue;
@@ -13328,6 +13384,8 @@ function describeCrewLink(o) {
13328
13384
  return `${label}: ${CREW_FIELD_MISSING_NOTE}`;
13329
13385
  case "no_agents_row":
13330
13386
  return `${label}: no Agents row to link yet \u2014 a workspace admin's \`crew agents sync\` creates it; run it here afterwards to link this seat`;
13387
+ case "seat_missing":
13388
+ return `${label}: ${SEAT_MISSING_NOTE}`;
13331
13389
  case "persona_diverged":
13332
13390
  return `${label}: persona has local edits and was not synced this pass \u2014 skipped linking until it's resolved`;
13333
13391
  }
@@ -19594,11 +19652,14 @@ function otherRunsRemoved(tickets, own) {
19594
19652
  function ownRunBanner(own) {
19595
19653
  const banner = `**Your ticket for this run: ${own.ticket.issue_id}.** Work this one. Any other ticket a live run on this ship is already working has been left out of this digest: it belongs to that run.`;
19596
19654
  const block = acceptanceChecklistBlock(acceptanceLines(own.ticket.description));
19597
- return block ? `${banner}
19655
+ const withBlock = block ? `${banner}
19598
19656
 
19599
19657
  \`\`\`
19600
19658
  ${block}
19601
19659
  \`\`\`` : banner;
19660
+ return own.mapBrief ? `${withBlock}
19661
+
19662
+ ${own.mapBrief}` : withBlock;
19602
19663
  }
19603
19664
  function writeDigest(o, d, role, stateDir, runId, own) {
19604
19665
  const me = o.route.resolved?.seats[role];
@@ -22737,6 +22798,169 @@ import { existsSync as existsSync48, mkdirSync as mkdirSync36, readFileSync as r
22737
22798
  import { join as join53 } from "path";
22738
22799
  import { randomBytes } from "crypto";
22739
22800
 
22801
+ // src/map-brief.ts
22802
+ var MAP_INLINE_LIMIT = 2e4;
22803
+ var str = (v) => typeof v === "string" ? v : "";
22804
+ function citedSections(...texts) {
22805
+ const out = [];
22806
+ const add = (n) => {
22807
+ if (n && !out.includes(n)) out.push(n);
22808
+ };
22809
+ const re = /§+\s*(\d+(?:\.\d+)*)((?:\s*(?:,|and|&|–|-|to)\s*§?\s*\d+(?:\.\d+)*)*)/g;
22810
+ for (const text2 of texts) {
22811
+ for (const m of (text2 ?? "").matchAll(re)) {
22812
+ const nums = [m[1]];
22813
+ const tail3 = m[2] ?? "";
22814
+ const parts = tail3.split(/\s*(?:,|and|&|–|-|to)\s*/).map((p) => p.replace(/^§\s*/, "").trim()).filter(Boolean);
22815
+ const isRange = /^\s*(?:–|-|to)\s*/.test(tail3) && parts.length === 1;
22816
+ if (isRange && /^\d+$/.test(m[1]) && /^\d+$/.test(parts[0])) {
22817
+ const lo = Number(m[1]), hi = Number(parts[0]);
22818
+ if (hi > lo && hi - lo <= 20) for (let n = lo + 1; n <= hi; n++) nums.push(String(n));
22819
+ } else nums.push(...parts);
22820
+ nums.forEach(add);
22821
+ }
22822
+ }
22823
+ return out;
22824
+ }
22825
+ function headingsOf(doc) {
22826
+ const out = [];
22827
+ let fenced = false;
22828
+ doc.split("\n").forEach((raw, line) => {
22829
+ if (/^\s*(```|~~~)/.test(raw)) {
22830
+ fenced = !fenced;
22831
+ return;
22832
+ }
22833
+ if (fenced) return;
22834
+ const m = /^(#{1,6})\s+(.*?)\s*#*\s*$/.exec(raw);
22835
+ if (!m) return;
22836
+ const num2 = /^§?\s*(\d+(?:\.\d+)*)\.?(?=\s|$)/.exec(m[2]);
22837
+ out.push({ line, level: m[1].length, number: num2 ? num2[1] : null, text: m[2] });
22838
+ });
22839
+ return out;
22840
+ }
22841
+ function sectionText(doc, n) {
22842
+ const hs = headingsOf(doc);
22843
+ const i = hs.findIndex((h) => h.number === n);
22844
+ if (i < 0) return null;
22845
+ const lines2 = doc.split("\n");
22846
+ const end = hs.slice(i + 1).find((h) => h.level <= hs[i].level)?.line ?? lines2.length;
22847
+ return lines2.slice(hs[i].line, end).join("\n").trimEnd();
22848
+ }
22849
+ function activeMap(rows, c) {
22850
+ const m = c.maps;
22851
+ const active = rows.filter((r) => str(r[m.statusColumn]) === m.activeStatus);
22852
+ if (!active.length) return null;
22853
+ const ver = (r) => typeof r[m.versionColumn] === "number" ? r[m.versionColumn] : 0;
22854
+ return [...active].sort((a, b) => ver(b) - ver(a) || str(b.updated_at).localeCompare(str(a.updated_at)))[0];
22855
+ }
22856
+ var fence = (s) => {
22857
+ let ticks = "````";
22858
+ while (s.includes(ticks)) ticks += "`";
22859
+ return `${ticks}markdown
22860
+ ${s}
22861
+ ${ticks}`;
22862
+ };
22863
+ var NO_SEARCH = "It is not in the repository, so do not search the checkout for it.";
22864
+ function howToRead(modelId, row, c) {
22865
+ return `Read the whole Map with the tracker MCP tool \`records_controller_find_one\` (\`dataModelId\` \`${modelId}\`, \`recordId\` \`${row.id}\`): its \`${c.maps.contentColumn}\` field is the document, and its \`${c.maps.conversationColumn}\` field is the interview record behind the decisions, which you read only when you need the reasoning.`;
22866
+ }
22867
+ var PRECEDENCE = "The Map is the planning decision this ticket was derived from. Where it differs from the ticket's own text or a later comment on the ticket, the ticket and its comments win.";
22868
+ function mapBriefSection(i) {
22869
+ const c = i.contract;
22870
+ const epicId = i.ticket[c.columns.epic];
22871
+ if (typeof epicId !== "string" || !epicId || !i.mapsModelId) return null;
22872
+ const label = i.epic ? str(i.epic.label) || epicLabel(i.epic, c) : String(epicId);
22873
+ const head = `### Map for ${label}`;
22874
+ if ("forbidden" in i.maps) {
22875
+ return `${head}
22876
+
22877
+ This ticket belongs to ${label}, whose Map holds the planning decisions behind it. Your seat is not allowed to read the Maps table, so the Map is not supplied. It lives in the tracker. ${NO_SEARCH} Work from the ticket and its comments; if you need something only the Map would say, ask on the ticket.`;
22878
+ }
22879
+ if ("failed" in i.maps) {
22880
+ return `${head}
22881
+
22882
+ This ticket belongs to ${label}, whose Map holds the planning decisions behind it. Reading it failed this run (${i.maps.failed}), so it is not supplied. It lives in the tracker's Maps table (\`${i.mapsModelId}\`), filtered to the epic's row \`${epicId}\`. ${NO_SEARCH}`;
22883
+ }
22884
+ const row = activeMap(i.maps.rows, c);
22885
+ if (!row) {
22886
+ const others = i.maps.rows.map((r) => `v${r[c.maps.versionColumn] ?? "?"} ${str(r[c.maps.statusColumn]) || "no status"}`);
22887
+ const have = others.length ? ` Its Maps are not active (${others.join(", ")}), and a Map that is not active is not a settled plan, so none is supplied.` : " It has no Map.";
22888
+ return `${head}
22889
+
22890
+ ${label} has no active Map.${have} ${NO_SEARCH} Work from the ticket and its comments.`;
22891
+ }
22892
+ const doc = str((i.full ?? row)[c.maps.contentColumn]);
22893
+ const title = str(row[c.maps.titleColumn]);
22894
+ const version = row[c.maps.versionColumn];
22895
+ const intro = `This ticket belongs to ${label}. Its active Map${title ? `, "${title}"` : ""}${version != null ? ` (version ${version})` : ""}, is below. It is a record in the tracker's Maps table, not a file in the repository, so a citation such as "Map v1 \xA711" in the ticket refers to this document. ${PRECEDENCE} The interview record is not included.`;
22896
+ if (!doc.trim()) {
22897
+ return `${head}
22898
+
22899
+ ${intro}
22900
+
22901
+ The document is empty. ${howToRead(i.mapsModelId, row, c)}`;
22902
+ }
22903
+ const cited = citedSections(i.ticket.title, i.ticket.description);
22904
+ const hs = headingsOf(doc);
22905
+ const where = cited.map((n) => {
22906
+ const h = hs.find((x) => x.number === n);
22907
+ return h ? `\xA7${n} is the section headed "${h.text}"` : `\xA7${n} has no section of that number in this document`;
22908
+ });
22909
+ const cites = where.length ? `
22910
+
22911
+ The ticket cites: ${where.join("; ")}.` : "";
22912
+ if (doc.length <= MAP_INLINE_LIMIT) {
22913
+ return `${head}
22914
+
22915
+ ${intro}${cites}
22916
+
22917
+ ${fence(doc)}
22918
+
22919
+ ${howToRead(i.mapsModelId, row, c)}`;
22920
+ }
22921
+ const parts = cited.map((n) => ({ n, text: sectionText(doc, n) })).filter((p) => p.text != null);
22922
+ const outline = hs.map((h) => `${" ".repeat(Math.max(0, h.level - 1))}- ${h.text}`).join("\n");
22923
+ const body = parts.length ? parts.map((p) => `#### \xA7${p.n}, in full
22924
+
22925
+ ${fence(p.text)}`).join("\n\n") : "The ticket cites no section that could be found, so none is included.";
22926
+ return `${head}
22927
+
22928
+ ${intro}${cites}
22929
+
22930
+ The document is ${doc.length.toLocaleString("en-US")} characters, too long to include whole. The sections the ticket cites follow in full; the outline lists every heading.
22931
+
22932
+ ${body}
22933
+
22934
+ #### Outline of the whole document
22935
+
22936
+ ${outline}
22937
+
22938
+ ${howToRead(i.mapsModelId, row, c)}`;
22939
+ }
22940
+ async function briefMapFor(src, ticket, mapsModelId, contract) {
22941
+ const epicId = ticket[contract.columns.epic];
22942
+ if (typeof epicId !== "string" || !epicId || !mapsModelId) return null;
22943
+ const epic = await src.epicRow(epicId).catch(() => void 0);
22944
+ let maps;
22945
+ try {
22946
+ maps = { rows: await src.mapRows(epicId) };
22947
+ } catch (e) {
22948
+ maps = isForbiddenError(e) ? { forbidden: true } : { failed: (e instanceof Error ? e.message : String(e)).split("\n")[0].slice(0, 160) };
22949
+ }
22950
+ let full = null;
22951
+ if ("rows" in maps) {
22952
+ const row = activeMap(maps.rows, contract);
22953
+ if (row) {
22954
+ try {
22955
+ full = await src.mapRow(row.id);
22956
+ } catch (e) {
22957
+ if (isForbiddenError(e)) maps = { forbidden: true };
22958
+ }
22959
+ }
22960
+ }
22961
+ return mapBriefSection({ ticket, epic, mapsModelId, maps, full, contract });
22962
+ }
22963
+
22740
22964
  // src/outage.ts
22741
22965
  var TRANSIENT_BACKOFF_MS = [15e3, 3e4, 6e4];
22742
22966
  var OUTAGE_ESCALATE_AFTER = 5;
@@ -24629,9 +24853,11 @@ async function runRoleAgentLocked(role, decision, ctx, hooks, held) {
24629
24853
  if (idx >= 0) decision.tickets[idx] = result.ticket;
24630
24854
  writeDigest({ route: route2, ship, state: ctx.state, emit }, decision, role, ship.stateDir);
24631
24855
  }
24856
+ const mapBrief = await briefMapFor(tracker, result.ticket, route2.resolved?.mapsModelId, contract).catch(() => null);
24632
24857
  writeDigest({ route: route2, ship, state: ctx.state, emit }, decision, role, ship.stateDir, runId, {
24633
24858
  ticket: result.ticket,
24634
- inFlight: (id) => ctx.state.ticketInFlight(id)
24859
+ inFlight: (id) => ctx.state.ticketInFlight(id),
24860
+ mapBrief
24635
24861
  });
24636
24862
  hooks?.ready(true);
24637
24863
  ticketHint = result.ticket.issue_id;
@@ -26086,6 +26312,7 @@ async function discover(o) {
26086
26312
  out.reposModelId = find("Repos");
26087
26313
  out.shipsModelId = find("Ships");
26088
26314
  out.epicsModelId = find("Epics");
26315
+ out.mapsModelId = find("Maps");
26089
26316
  out.periscopesModelId = find("Periscopes");
26090
26317
  out.locksModelId = find("Locks");
26091
26318
  try {
@@ -27336,6 +27563,7 @@ var SNAPSHOT_TABLES = [
27336
27563
  { key: "periscopesModelId", name: "Periscopes" },
27337
27564
  { key: "shipsModelId", name: "Ships" },
27338
27565
  { key: "epicsModelId", name: "Epics" },
27566
+ { key: "mapsModelId", name: "Maps" },
27339
27567
  { key: "locksModelId", name: "Locks" },
27340
27568
  { key: "reposModelId", name: "Repos" },
27341
27569
  { key: "areaModelId", name: "Projects" }
@@ -28021,7 +28249,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
28021
28249
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
28022
28250
  import { join as join60 } from "path";
28023
28251
  function builtVersion() {
28024
- return true ? "0.156.0" : null;
28252
+ return true ? "0.157.0" : null;
28025
28253
  }
28026
28254
  var REBUILD_HINT = "rebuild with npm run build";
28027
28255
  function newestMtime(path) {
@@ -34052,6 +34280,7 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
34052
34280
  areaId: found.areaId,
34053
34281
  shipsModelId: found.shipsModelId,
34054
34282
  epicsModelId: found.epicsModelId,
34283
+ mapsModelId: found.mapsModelId,
34055
34284
  periscopesModelId: found.periscopesModelId,
34056
34285
  locksModelId: found.locksModelId,
34057
34286
  recordLinkViewId: found.recordLinkViewId,
@@ -34820,18 +35049,18 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`);
34820
35049
  const repos = await resolvedRepos(rt);
34821
35050
  return (await tr.periscopeRows()).map(({ row, ticket }) => {
34822
35051
  const repo = repos.find((r) => r.id && r.id === ticket[tr.contract.columns.repo]) ?? (repos.length === 1 ? repos[0] : void 0);
34823
- const str = (v) => typeof v === "string" ? v : "";
35052
+ const str2 = (v) => typeof v === "string" ? v : "";
34824
35053
  return {
34825
35054
  id: row.id,
34826
35055
  ticketRecordId: ticket.id,
34827
35056
  ticket: ticket.issue_tag ?? ticket.issue_id,
34828
35057
  number: /(\d+)$/.exec(ticket.issue_id)?.[1] ?? "",
34829
35058
  repo: repo?.name ?? "?",
34830
- state: str(row.state),
34831
- url: str(row.url),
34832
- worktree: str(row.worktree),
34833
- branch: str(row.branch),
34834
- lastActivityAt: str(row.last_activity_at) || null,
35059
+ state: str2(row.state),
35060
+ url: str2(row.url),
35061
+ worktree: str2(row.worktree),
35062
+ branch: str2(row.branch),
35063
+ lastActivityAt: str2(row.last_activity_at) || null,
34835
35064
  localUrl: readPeriscopeSidecars(cfg.ship.stateDir).find((x) => x.ticketRecordId === ticket.id)?.localUrl
34836
35065
  };
34837
35066
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.156.0",
3
+ "version": "0.157.0",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -137,6 +137,28 @@ fetch the tracker yourself exactly as Steps 1 and 2 describe. Everything below
137
137
  works either way: the digest changes where the list comes from, never what
138
138
  you do with it.
139
139
 
140
+ ## A ticket's Map
141
+
142
+ A ticket filed from an epic's planning document cites it by name and section,
143
+ such as "Map v1 §11". That document is the epic's **Map**: a record in the
144
+ tracker's Maps table, linked to the epic, never a file in any repository. Do
145
+ not search the checkout for it.
146
+
147
+ When the ticket belongs to an epic and the workspace keeps Maps, your brief
148
+ ends its ticket banner with a "Map for <epic>" section. It holds the epic's
149
+ active Map, whole, or, when the document is too long, the sections the ticket
150
+ cites in full, an outline of every heading and the tracker call that reads the
151
+ rest. It may instead say the epic has no active Map, or that your seat may not
152
+ read it; believe that and carry on from the ticket. A draft or superseded Map
153
+ is never supplied in place of the active one.
154
+
155
+ The Map is the planning decision the ticket was derived from, so read the
156
+ sections the ticket cites before you scope the work. **The ticket wins:** where
157
+ the Map differs from the ticket's own text or from a later comment on the
158
+ ticket, follow the ticket and its comments. The Map's interview record is not
159
+ in the brief; read it (the Map's `conversation` field) only when you need the
160
+ reasoning behind a decision.
161
+
140
162
  ## Step 1 — check your own open tickets first
141
163
 
142
164
  Before picking up anything new, take the digest's "Step 1" table or, absent a
@@ -138,6 +138,28 @@ fetch the tracker yourself exactly as Steps 1 and 2 describe. Everything below
138
138
  works either way: the digest changes where the list comes from, never what
139
139
  you do with it.
140
140
 
141
+ ## A ticket's Map
142
+
143
+ A ticket filed from an epic's planning document cites it by name and section,
144
+ such as "Map v1 §11". That document is the epic's **Map**: a record in the
145
+ tracker's Maps table, linked to the epic, never a file in any repository. Do
146
+ not search the checkout for it.
147
+
148
+ When the ticket belongs to an epic and the workspace keeps Maps, your brief
149
+ ends its ticket banner with a "Map for <epic>" section. It holds the epic's
150
+ active Map, whole, or, when the document is too long, the sections the ticket
151
+ cites in full, an outline of every heading and the tracker call that reads the
152
+ rest. It may instead say the epic has no active Map, or that your seat may not
153
+ read it; believe that and carry on from the ticket. A draft or superseded Map
154
+ is never supplied in place of the active one.
155
+
156
+ The Map is the planning decision the ticket was derived from, so read the
157
+ sections the ticket cites before you scope the work. **The ticket wins:** where
158
+ the Map differs from the ticket's own text or from a later comment on the
159
+ ticket, follow the ticket and its comments. The Map's interview record is not
160
+ in the brief; read it (the Map's `conversation` field) only when you need the
161
+ reasoning behind a decision.
162
+
141
163
  ## Step 1 — check your own open tickets first
142
164
 
143
165
  Before picking up anything new, take the digest's "Step 1" table or, absent a