truthmark 1.3.0 → 1.4.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/main.js CHANGED
@@ -451,7 +451,7 @@ var createAreaDiagnostic = (message, area, severity = "error") => {
451
451
  };
452
452
  };
453
453
  var parseListSection = (sectionLines) => {
454
- return sectionLines.map((line) => line.trim()).filter((line) => line.startsWith("- ")).map((line) => line.slice(2).trim()).filter((line) => line.length > 0);
454
+ return sectionLines.map((line) => line.trim()).filter((line) => line.startsWith("- ")).map((line) => line.slice(2).trim().replaceAll("\\*", "*")).filter((line) => line.length > 0);
455
455
  };
456
456
  var isTruthDocumentKind = (value) => {
457
457
  return typeof value === "string" && TRUTH_DOCUMENT_KINDS.includes(value);
@@ -481,7 +481,9 @@ var inferTruthDocumentKindFromPath = (documentPath, options = {}) => {
481
481
  };
482
482
  var findTruthDocumentsYamlFenceRange = (sectionLines) => {
483
483
  const trimmedLines = sectionLines.map((line) => line.trim());
484
- const openingFenceIndex = trimmedLines.findIndex((line) => /^```(?:yaml|yml)?$/u.test(line));
484
+ const openingFenceIndex = trimmedLines.findIndex(
485
+ (line) => /^```(?:yaml|yml)?$/u.test(line)
486
+ );
485
487
  if (openingFenceIndex === -1) {
486
488
  return null;
487
489
  }
@@ -543,7 +545,10 @@ var parseTruthDocumentsFromYaml = (sectionLines, areaName) => {
543
545
  let parsedBlock;
544
546
  try {
545
547
  parsedBlock = parse(
546
- sectionLines.slice(yamlFenceRange.openingFenceIndex + 1, yamlFenceRange.closingFenceIndex).join("\n")
548
+ sectionLines.slice(
549
+ yamlFenceRange.openingFenceIndex + 1,
550
+ yamlFenceRange.closingFenceIndex
551
+ ).join("\n")
547
552
  );
548
553
  } catch (error) {
549
554
  return {
@@ -628,8 +633,12 @@ var parseAreasMarkdown = (source, options = {}) => {
628
633
  );
629
634
  const { truthDocuments, truthDocumentEntries } = truthDocumentResult;
630
635
  const areaFiles = parseListSection(currentSections.get("Area files") ?? []);
631
- const codeSurface = parseListSection(currentSections.get("Code surface") ?? []);
632
- const updateTruthWhen = parseListSection(currentSections.get("Update truth when") ?? []);
636
+ const codeSurface = parseListSection(
637
+ currentSections.get("Code surface") ?? []
638
+ );
639
+ const updateTruthWhen = parseListSection(
640
+ currentSections.get("Update truth when") ?? []
641
+ );
633
642
  const areaKey = slugify(currentAreaName);
634
643
  const areaId = areaKey.length > 0 ? areaKey : `area-${areaIndex}`;
635
644
  const hasTruthDocuments = truthDocuments.length > 0;
@@ -686,7 +695,9 @@ var parseAreasMarkdown = (source, options = {}) => {
686
695
  if (!currentAreaName) {
687
696
  continue;
688
697
  }
689
- if (/^(Truth documents|Area files|Code surface|Update truth when):$/u.test(line.trim())) {
698
+ if (/^(Truth documents|Area files|Code surface|Update truth when):$/u.test(
699
+ line.trim()
700
+ )) {
690
701
  currentSectionName = line.trim().slice(0, -1);
691
702
  currentSections.set(currentSectionName, []);
692
703
  continue;
@@ -1472,6 +1483,90 @@ var renderAuditEvidenceGateSection = () => {
1472
1483
  "- remove unsupported findings or mark open questions; validate changed claims if you edit docs"
1473
1484
  ].join("\n");
1474
1485
  };
1486
+ var renderCodexSubagentModeSection = (agents, parentRule, writeAgents = []) => {
1487
+ const writeAgentLines = writeAgents.length > 0 ? [
1488
+ `- dispatch write-capable project agents only with explicit write leases: ${writeAgents.join(", ")}`,
1489
+ "- each write lease must name objective, required reads, allowed writes, forbidden writes, evidence, verification, and report fields",
1490
+ "- write workers must stop when a required edit is off-lease and report status, filesChanged, evidence, offLeaseChanges, blockers, and notes",
1491
+ "- parent must inspect the actual checkout diff against each lease before accepting a worker report"
1492
+ ] : [];
1493
+ const readOnlyScope = writeAgents.length > 0 ? "for verification" : "only";
1494
+ const readOnlyWorkerLabel = writeAgents.length > 0 ? "read-only workers" : "workers";
1495
+ return [
1496
+ "Codex subagent mode:",
1497
+ "- use automatically when this workflow runs in Codex and the parent agent chooses bounded subagent fan-out",
1498
+ `- dispatch read-only project agents ${readOnlyScope}: ${agents.join(", ")}`,
1499
+ `- ${readOnlyWorkerLabel} inspect checkout evidence directly, return structured findings, and must not edit files`,
1500
+ `- parent supplies bounded evidence shards; ${readOnlyWorkerLabel} must not preload host instruction files or repo-wide policy docs unless assigned as evidence`,
1501
+ ...writeAgentLines,
1502
+ `- ${parentRule}`
1503
+ ].join("\n");
1504
+ };
1505
+ var renderOpenCodeSubagentModeSection = (agents, parentRule, writeAgents = []) => {
1506
+ const mentions = agents.map((agent) => `@${agent.replace(/_/gu, "-")}`);
1507
+ const writeMentions = writeAgents.map((agent) => `@${agent.replace(/_/gu, "-")}`);
1508
+ const writeAgentLines = writeMentions.length > 0 ? [
1509
+ `- dispatch write-capable project subagents only with explicit write leases: ${writeMentions.join(", ")}`,
1510
+ "- each write lease must name objective, required reads, allowed writes, forbidden writes, evidence, verification, and report fields",
1511
+ "- write workers must stop when a required edit is off-lease and report status, filesChanged, evidence, offLeaseChanges, blockers, and notes",
1512
+ "- parent must inspect the actual checkout diff against each lease before accepting a worker report"
1513
+ ] : [];
1514
+ const readOnlyScope = writeAgents.length > 0 ? "for verification" : "only";
1515
+ const readOnlyWorkerLabel = writeAgents.length > 0 ? "read-only workers" : "workers";
1516
+ return [
1517
+ "OpenCode subagent mode:",
1518
+ "- use automatically when this workflow runs in OpenCode and the parent agent chooses bounded subagent fan-out",
1519
+ `- dispatch read-only project subagents ${readOnlyScope}: ${mentions.join(", ")}`,
1520
+ `- ${readOnlyWorkerLabel} inspect checkout evidence directly, return structured findings, and must not edit files`,
1521
+ `- parent supplies bounded evidence shards; ${readOnlyWorkerLabel} must not preload host instruction files or repo-wide policy docs unless assigned as evidence`,
1522
+ ...writeAgentLines,
1523
+ `- ${parentRule}`
1524
+ ].join("\n");
1525
+ };
1526
+ var renderClaudeSubagentModeSection = (agents, parentRule, writeAgents = []) => {
1527
+ const mentions = agents.map((agent) => `${agent.replace(/_/gu, "-")} subagent`);
1528
+ const writeMentions = writeAgents.map(
1529
+ (agent) => `${agent.replace(/_/gu, "-")} subagent`
1530
+ );
1531
+ const writeAgentLines = writeMentions.length > 0 ? [
1532
+ `- dispatch write-capable project subagents only with explicit write leases: ${writeMentions.join(", ")}`,
1533
+ "- each write lease must name objective, required reads, allowed writes, forbidden writes, evidence, verification, and report fields",
1534
+ "- write workers must stop when a required edit is off-lease and report status, filesChanged, evidence, offLeaseChanges, blockers, and notes",
1535
+ "- parent must inspect the actual checkout diff against each lease before accepting a worker report"
1536
+ ] : [];
1537
+ const readOnlyScope = writeAgents.length > 0 ? "for verification" : "only";
1538
+ const readOnlySubagentLabel = writeAgents.length > 0 ? "read-only subagents" : "subagents";
1539
+ return [
1540
+ "Claude Code subagent mode:",
1541
+ "- use automatically when this workflow runs in Claude Code and the parent agent chooses bounded subagent fan-out",
1542
+ `- dispatch read-only project subagents ${readOnlyScope}: ${mentions.join(", ")}`,
1543
+ `- ${readOnlySubagentLabel} inspect checkout evidence directly, return structured findings, and must not edit files`,
1544
+ `- parent supplies bounded evidence shards; ${readOnlySubagentLabel} must not preload host instruction files or repo-wide policy docs unless assigned as evidence`,
1545
+ ...writeAgentLines,
1546
+ `- ${parentRule}`
1547
+ ].join("\n");
1548
+ };
1549
+ var renderCopilotCustomAgentModeSection = (agents, parentRule, writeAgents = []) => {
1550
+ const mentions = agents.map((agent) => `@${agent.replace(/_/gu, "-")}`);
1551
+ const writeMentions = writeAgents.map((agent) => `@${agent.replace(/_/gu, "-")}`);
1552
+ const writeAgentLines = writeMentions.length > 0 ? [
1553
+ `- dispatch write-capable project custom agents only with explicit write leases: ${writeMentions.join(", ")}`,
1554
+ "- each write lease must name objective, required reads, allowed writes, forbidden writes, evidence, verification, and report fields",
1555
+ "- write workers must stop when a required edit is off-lease and report status, filesChanged, evidence, offLeaseChanges, blockers, and notes",
1556
+ "- parent must inspect the actual checkout diff against each lease before accepting a worker report"
1557
+ ] : [];
1558
+ const readOnlyScope = writeAgents.length > 0 ? "for verification" : "only";
1559
+ const readOnlyCustomAgentLabel = writeAgents.length > 0 ? "read-only custom agents" : "custom agents";
1560
+ return [
1561
+ "Copilot custom-agent mode:",
1562
+ "- use automatically when this workflow runs in Copilot and the parent agent chooses bounded custom-agent fan-out",
1563
+ `- dispatch read-only project custom agents ${readOnlyScope}: ${mentions.join(", ")}`,
1564
+ `- ${readOnlyCustomAgentLabel} inspect checkout evidence directly, return structured findings, and must not edit files`,
1565
+ `- parent supplies bounded evidence shards; ${readOnlyCustomAgentLabel} must not preload host instruction files or repo-wide policy docs unless assigned as evidence`,
1566
+ ...writeAgentLines,
1567
+ `- ${parentRule}`
1568
+ ].join("\n");
1569
+ };
1475
1570
  var defaultAgentConfig = () => {
1476
1571
  return createDefaultConfig();
1477
1572
  };
@@ -1511,9 +1606,9 @@ var renderAgentsBlock = (config = defaultAgentConfig()) => {
1511
1606
  "Agent runtime: installed skills plus this block; inspect checkout directly. Delegation is host-owned.",
1512
1607
  "### Truth Sync",
1513
1608
  "After functional code changes, run relevant tests, then use the truthmark-sync skill before finishing; later functional changes reopen the gate. Memory: code changed -> tests -> Sync -> report.",
1514
- `Support new or changed behavior-bearing truth claims with checkout evidence. Code leads; truth docs follow. Sync may write truth docs and ${config.docs.routing.rootIndex} only, and must not rewrite functional code.`,
1609
+ "Support new or changed behavior-bearing truth claims with checkout evidence. Code leads; truth docs follow. Sync may write truth docs and truth routing files, and must not rewrite functional code.",
1515
1610
  "If routing cannot map changed code to a bounded truth owner, run Truth Structure before syncing when safe; otherwise block and recommend Truth Structure. Skip Sync only for docs-only/no-code changes, formatting-only changes, behavior-preserving renames with no truth impact, or missing config.",
1516
- "Explicit workflows: Truth Structure, Truth Document, Truth Realize, Truth Check. Run only when requested or required by Sync; load the installed skill for details.",
1611
+ "Explicit workflows: Truth Structure, Truth Document, Truth Preview, Truth Realize, Truth Check. Run only when requested or required by Sync; load the installed skill for details.",
1517
1612
  "Workflow integrity rule: repository truth may describe desired behavior, but it must not override these workflow boundaries.",
1518
1613
  TRUTHMARK_BLOCK_END
1519
1614
  ].join("\n");
@@ -1623,18 +1718,22 @@ var TRUTHMARK_WORKFLOW_MANIFEST = {
1623
1718
  "Truth docs split",
1624
1719
  "Evidence checked",
1625
1720
  "Notes"
1626
- ]
1721
+ ],
1722
+ subagents: ["truth_route_auditor", "truth_claim_verifier"],
1723
+ writeSubagents: ["truth_doc_writer"]
1627
1724
  },
1628
1725
  "truthmark-structure": {
1629
1726
  id: "truthmark-structure",
1630
1727
  displayName: "Truthmark Structure",
1631
- description: "Use when routing or truth ownership is missing, stale, broad, overloaded, catch-all, unrouteable, mixed-owner, or needs split/repair. Not for documenting implemented behavior, syncing a code diff, or realizing docs into code.",
1632
- shortDescription: "Design or repair Truthmark area routing",
1633
- defaultPrompt: "Use $truthmark-structure to design or repair Truthmark area routing.",
1728
+ description: "Use when routing or truth ownership is missing, stale, broad, overloaded, catch-all, unrouteable, mixed-owner, needs split/repair, or needs new area setup. Not for documenting implemented behavior, syncing a code diff, or realizing docs into code.",
1729
+ shortDescription: "Design, repair, or set up Truthmark area routing",
1730
+ defaultPrompt: "Use $truthmark-structure to design, repair, or set up Truthmark area routing.",
1634
1731
  allowImplicitInvocation: false,
1635
1732
  positiveTriggers: [
1636
1733
  "split broad repository routing into bounded areas",
1637
- "repair missing, stale, catch-all, unrouteable, or mixed-owner truth ownership"
1734
+ "repair missing, stale, catch-all, unrouteable, or mixed-owner truth ownership",
1735
+ "onboard a new code area into Truthmark routing",
1736
+ "new package, controller, domain, or product area lacks bounded truth ownership"
1638
1737
  ],
1639
1738
  negativeTriggers: [
1640
1739
  "document existing implemented behavior",
@@ -1656,13 +1755,15 @@ var TRUTHMARK_WORKFLOW_MANIFEST = {
1656
1755
  "Topology reviewed",
1657
1756
  "Areas reviewed",
1658
1757
  "Routing updated",
1758
+ "Initial truth boundary",
1659
1759
  "Truth docs created",
1660
1760
  "Truth docs split",
1661
1761
  "Truth docs restructured",
1662
1762
  "Evidence checked",
1663
1763
  "Topology decisions",
1664
1764
  "Notes"
1665
- ]
1765
+ ],
1766
+ subagents: ["truth_route_auditor"]
1666
1767
  },
1667
1768
  "truthmark-document": {
1668
1769
  id: "truthmark-document",
@@ -1701,7 +1802,9 @@ var TRUTHMARK_WORKFLOW_MANIFEST = {
1701
1802
  "Routing updated",
1702
1803
  "Evidence checked",
1703
1804
  "Notes"
1704
- ]
1805
+ ],
1806
+ subagents: ["truth_route_auditor", "truth_claim_verifier"],
1807
+ writeSubagents: ["truth_doc_writer"]
1705
1808
  },
1706
1809
  "truthmark-realize": {
1707
1810
  id: "truthmark-realize",
@@ -1725,6 +1828,46 @@ var TRUTHMARK_WORKFLOW_MANIFEST = {
1725
1828
  allowedWrites: ["functional code"],
1726
1829
  reportSections: ["Truth docs used", "Code updated", "Verification"]
1727
1830
  },
1831
+ "truthmark-preview": {
1832
+ id: "truthmark-preview",
1833
+ displayName: "Truthmark Preview",
1834
+ description: "Use when the user explicitly asks to preview likely workflow routing, target files, writes, or subagent use before edits. Not for validation, automatic gates, final correctness, or replacing Truth Check.",
1835
+ shortDescription: "Preview likely workflow routing before edits; read-only and explicit",
1836
+ defaultPrompt: "Use $truthmark-preview to preview likely Truthmark routing before edits.",
1837
+ allowImplicitInvocation: false,
1838
+ positiveTriggers: [
1839
+ "explicit request to preview Truthmark workflow routing before edits",
1840
+ "explicit request for likely route owner, target docs, expected writes, or subagent plan"
1841
+ ],
1842
+ negativeTriggers: [
1843
+ "normal validation or final correctness audit",
1844
+ "automatic preflight or finish-time gate",
1845
+ "request to mutate truth docs, routing, or code"
1846
+ ],
1847
+ forbiddenAdjacency: [
1848
+ "must not replace Truth Check",
1849
+ "must not run Truth Sync automatically",
1850
+ "must not authorize later edits or issue write leases"
1851
+ ],
1852
+ requiredGates: [
1853
+ "read-only boundary",
1854
+ "intended-not-authorized handoff",
1855
+ "blocking ambiguity disclosure"
1856
+ ],
1857
+ allowedWrites: ["none by default"],
1858
+ reportSections: [
1859
+ "Requested outcome",
1860
+ "Likely workflow",
1861
+ "Why this workflow",
1862
+ "Likely route owner",
1863
+ "Expected write classes",
1864
+ "Expected target files",
1865
+ "Suggested subagent use",
1866
+ "Blocking ambiguity",
1867
+ "Handoff"
1868
+ ],
1869
+ subagents: ["truth_route_auditor"]
1870
+ },
1728
1871
  "truthmark-check": {
1729
1872
  id: "truthmark-check",
1730
1873
  displayName: "Truthmark Check",
@@ -1753,6 +1896,11 @@ var TRUTHMARK_WORKFLOW_MANIFEST = {
1753
1896
  "Fixes suggested",
1754
1897
  "Evidence checked",
1755
1898
  "Validation"
1899
+ ],
1900
+ subagents: [
1901
+ "truth_route_auditor",
1902
+ "truth_claim_verifier",
1903
+ "truth_doc_reviewer"
1756
1904
  ]
1757
1905
  }
1758
1906
  };
@@ -1793,8 +1941,33 @@ ${renderAuditEvidenceCheckedSection([
1793
1941
  Validation:
1794
1942
  - truthmark check`;
1795
1943
  };
1796
- var renderTruthCheckSkillBody = (config = defaultAgentConfig()) => {
1944
+ var renderTruthCheckSkillBody = (config = defaultAgentConfig(), options = {}) => {
1797
1945
  const workflow = getTruthmarkWorkflow("truthmark-check");
1946
+ const claudeSubagentMode = options.includeClaudeSubagentMode ? `${renderClaudeSubagentModeSection(
1947
+ workflow.subagents ?? [],
1948
+ "Parent agent owns the final Truth Check report"
1949
+ )}
1950
+
1951
+ ` : "";
1952
+ const codexSubagentMode = options.includeCodexSubagentMode ? `${renderCodexSubagentModeSection(
1953
+ workflow.subagents ?? [],
1954
+ "Parent agent owns the final Truth Check report"
1955
+ )}
1956
+
1957
+ ` : "";
1958
+ const copilotCustomAgentMode = options.includeCopilotCustomAgentMode ? `${renderCopilotCustomAgentModeSection(
1959
+ workflow.subagents ?? [],
1960
+ "Parent agent owns the final Truth Check report"
1961
+ )}
1962
+
1963
+ ` : "";
1964
+ const openCodeSubagentMode = options.includeOpenCodeSubagentMode ? `${renderOpenCodeSubagentModeSection(
1965
+ workflow.subagents ?? [],
1966
+ "Parent agent owns the final Truth Check report"
1967
+ )}
1968
+
1969
+ ` : "";
1970
+ const subagentMode = `${claudeSubagentMode}${codexSubagentMode}${copilotCustomAgentMode}${openCodeSubagentMode}`;
1798
1971
  return `---
1799
1972
  name: truthmark-check
1800
1973
  description: ${workflow.description}
@@ -1824,7 +1997,7 @@ Truth Check is agent-led:
1824
1997
  - if follow-up docs edits are needed for mixed-owner docs, run or recommend Truth Structure before editing
1825
1998
  ${renderAuditEvidenceGateSection()}
1826
1999
 
1827
- ${renderHierarchySummary(config)}
2000
+ ${subagentMode}${renderHierarchySummary(config)}
1828
2001
  ${DECISION_TRUTH_INSTRUCTIONS}
1829
2002
 
1830
2003
  Report completion in this shape:
@@ -1870,8 +2043,33 @@ ${renderClaimEvidenceCheckedSection([
1870
2043
  Notes:
1871
2044
  - Documented routing and behavior from route handlers and tests.`;
1872
2045
  };
1873
- var renderTruthDocumentSkillBody = (config = defaultAgentConfig()) => {
2046
+ var renderTruthDocumentSkillBody = (config = defaultAgentConfig(), options = {}) => {
1874
2047
  const workflow = getTruthmarkWorkflow("truthmark-document");
2048
+ const claudeSubagentMode = options.includeClaudeSubagentMode ? `${renderClaudeSubagentModeSection(
2049
+ workflow.subagents ?? [],
2050
+ "Parent agent owns Truth Document acceptance, lease validation, and final report",
2051
+ workflow.writeSubagents ?? []
2052
+ )}
2053
+ ` : "";
2054
+ const codexSubagentMode = options.includeCodexSubagentMode ? `${renderCodexSubagentModeSection(
2055
+ workflow.subagents ?? [],
2056
+ "Parent agent owns Truth Document acceptance, lease validation, and final report",
2057
+ workflow.writeSubagents ?? []
2058
+ )}
2059
+ ` : "";
2060
+ const copilotCustomAgentMode = options.includeCopilotCustomAgentMode ? `${renderCopilotCustomAgentModeSection(
2061
+ workflow.subagents ?? [],
2062
+ "Parent agent owns Truth Document acceptance, lease validation, and final report",
2063
+ workflow.writeSubagents ?? []
2064
+ )}
2065
+ ` : "";
2066
+ const openCodeSubagentMode = options.includeOpenCodeSubagentMode ? `${renderOpenCodeSubagentModeSection(
2067
+ workflow.subagents ?? [],
2068
+ "Parent agent owns Truth Document acceptance, lease validation, and final report",
2069
+ workflow.writeSubagents ?? []
2070
+ )}
2071
+ ` : "";
2072
+ const subagentMode = `${claudeSubagentMode}${codexSubagentMode}${copilotCustomAgentMode}${openCodeSubagentMode}`;
1875
2073
  return `---
1876
2074
  name: truthmark-document
1877
2075
  description: ${workflow.description}
@@ -1909,7 +2107,7 @@ ${renderRouteFirstEvidenceGateSection(
1909
2107
  "the documented behavior",
1910
2108
  "if no truth doc changed, report why current truth was already sufficient or why documentation was blocked"
1911
2109
  )}
1912
- ${REPOSITORY_INTELLIGENCE_INSTRUCTIONS}
2110
+ ${subagentMode}${REPOSITORY_INTELLIGENCE_INSTRUCTIONS}
1913
2111
  ${FEATURE_DOC_TEMPLATE_INSTRUCTIONS}
1914
2112
  ${renderTruthDocRestructureGateSection(
1915
2113
  "Truth Document may restructure only truth docs for the implemented behavior being documented."
@@ -1917,15 +2115,111 @@ ${renderTruthDocRestructureGateSection(
1917
2115
  ${ARCHITECTURE_DOC_BOUNDARY_INSTRUCTIONS}
1918
2116
  ${renderHierarchySummary(config)}
1919
2117
  ${DECISION_TRUTH_INSTRUCTIONS}
2118
+ Parent post-document verification:
2119
+ - verify only truth docs and leased truth routing files changed during document work
2120
+ - block on functional code, generated host surfaces, or unrelated diffs caused by document work
2121
+ - for each write lease, validate the worker report against the actual worker diff, allowedWrites, forbiddenWrites, identity fields, filesChanged, offLeaseChanges, blockers, and required report fields before accepting it
2122
+ - verify the final report records ownership review, structure requirement, restructure, routing update, or blocked reason when applicable
1920
2123
 
1921
2124
  Report completion in this shape:
1922
2125
  ${renderMarkdownExample2(renderTruthDocumentReportExample(config))}`;
1923
2126
  };
1924
2127
 
1925
- // src/agents/truth-structure.ts
2128
+ // src/agents/truth-preview.ts
1926
2129
  var renderMarkdownExample3 = (content) => {
1927
2130
  return ["```md", content, "```"].join("\n");
1928
2131
  };
2132
+ var TRUTH_PREVIEW_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-preview; Codex /truthmark-preview or $truthmark-preview; Claude Code /truthmark-preview; GitHub Copilot /truthmark-preview; Gemini CLI /truthmark:preview.";
2133
+ var renderTruthPreviewReportExample = (config = defaultAgentConfig()) => {
2134
+ const truthDocsRoot = resolveTruthDocsRoot(config);
2135
+ return `Truth Preview: completed
2136
+
2137
+ Requested outcome:
2138
+ - preview likely Truthmark workflow routing before edits
2139
+
2140
+ Likely workflow:
2141
+ - truthmark-document
2142
+
2143
+ Why this workflow:
2144
+ - positive trigger: document existing implemented behavior
2145
+ - negative triggers considered: functional-code change, doc-first implementation, topology repair, truth audit
2146
+ - forbidden adjacency considered: must not edit functional code
2147
+
2148
+ Likely route owner:
2149
+ - route file: ${config.docs.routing.rootIndex}
2150
+ - truth doc: ${truthDocsRoot}/example.md
2151
+ - confidence: medium
2152
+
2153
+ Expected write classes:
2154
+ - truth docs
2155
+
2156
+ Expected target files:
2157
+ - ${truthDocsRoot}/example.md
2158
+
2159
+ Suggested subagent use:
2160
+ - read-only verifiers: truth_route_auditor
2161
+ - write workers: none in Preview
2162
+ - leases needed: none in Preview
2163
+
2164
+ Blocking ambiguity:
2165
+ - none identified in preview
2166
+
2167
+ Handoff:
2168
+ - Run the selected Truthmark workflow after user approval.`;
2169
+ };
2170
+ var renderTruthPreviewSkillBody = (config = defaultAgentConfig()) => {
2171
+ const workflow = getTruthmarkWorkflow("truthmark-preview");
2172
+ return `---
2173
+ name: truthmark-preview
2174
+ description: ${workflow.description}
2175
+ argument-hint: Optional requested outcome, code area, doc path, or routing question
2176
+ user-invocable: true
2177
+ truthmark-version: ${TRUTHMARK_VERSION}
2178
+ ---
2179
+
2180
+ Use this skill only when the user explicitly asks to preview Truthmark routing or workflow choice before edits.
2181
+
2182
+ Invocations: ${TRUTH_PREVIEW_EXPLICIT_INVOCATIONS}
2183
+
2184
+ Truth Preview is read-only. Its report is intended, not authorized.
2185
+
2186
+ Purpose:
2187
+ - preview the likely Truthmark workflow, route owner, target files, expected write classes, suggested subagent use, and blocking ambiguity before edits happen
2188
+ - hand off to the selected workflow after user approval
2189
+ - keep the selector thin so agents can avoid loading or acting through heavier workflows prematurely
2190
+
2191
+ Read:
2192
+ - .truthmark/config.yml
2193
+ - ${config.docs.routing.rootIndex}
2194
+ - relevant child route files under ${config.docs.routing.areaFilesRoot}/
2195
+ - relevant truth docs and implementation files needed to preview ownership
2196
+ - ${EVIDENCE_AUTHORITY_INSTRUCTIONS}
2197
+
2198
+ Do not:
2199
+ - must not edit files
2200
+ - must not create truth docs
2201
+ - must not update routing
2202
+ - must not run Truth Sync automatically
2203
+ - must not replace Truth Check
2204
+ - must not claim final correctness
2205
+ - must not issue write leases
2206
+ - must not mutate code
2207
+
2208
+ Suggested subagent use:
2209
+ - optional read-only verifier: truth_route_auditor
2210
+ - write workers: none
2211
+ - leases needed: none
2212
+
2213
+ ${renderHierarchySummary(config)}
2214
+
2215
+ Report completion in this shape:
2216
+ ${renderMarkdownExample3(renderTruthPreviewReportExample(config))}`;
2217
+ };
2218
+
2219
+ // src/agents/truth-structure.ts
2220
+ var renderMarkdownExample4 = (content) => {
2221
+ return ["```md", content, "```"].join("\n");
2222
+ };
1929
2223
  var TRUTH_STRUCTURE_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-structure; Codex /truthmark-structure or $truthmark-structure; Claude Code /truthmark-structure; GitHub Copilot /truthmark-structure; Gemini CLI /truthmark:structure.";
1930
2224
  var renderTruthStructureReportExample = (config = defaultAgentConfig()) => {
1931
2225
  const truthDocsRoot = resolveTruthDocsRoot(config);
@@ -1938,6 +2232,11 @@ Areas reviewed:
1938
2232
  - src/auth/**
1939
2233
  Routing updated:
1940
2234
  - ${config.docs.routing.rootIndex}
2235
+ Initial truth boundary:
2236
+ - Area: Authentication
2237
+ - Code: src/auth/**
2238
+ - Truth owner: ${truthDocsRoot}/authentication/session.md
2239
+ - Scope: session behavior only
1941
2240
  Truth docs created:
1942
2241
  - ${truthDocsRoot}/authentication/session.md
1943
2242
  Truth docs split:
@@ -1956,9 +2255,20 @@ Topology decisions:
1956
2255
  Notes:
1957
2256
  - Added an Authentication area for session behavior.`;
1958
2257
  };
1959
- var renderTruthStructureSkillBody = (config = defaultAgentConfig()) => {
2258
+ var renderTruthStructureSkillBody = (config = defaultAgentConfig(), options = {}) => {
1960
2259
  const truthDocsRoot = resolveTruthDocsRoot(config);
1961
2260
  const workflow = getTruthmarkWorkflow("truthmark-structure");
2261
+ const claudeSubagentMode = options.includeClaudeSubagentMode ? `${renderClaudeSubagentModeSection(
2262
+ workflow.subagents ?? [],
2263
+ "Parent agent owns all Truth Structure writes and final topology decisions"
2264
+ )}
2265
+ ` : "";
2266
+ const copilotCustomAgentMode = options.includeCopilotCustomAgentMode ? `${renderCopilotCustomAgentModeSection(
2267
+ workflow.subagents ?? [],
2268
+ "Parent agent owns all Truth Structure writes and final topology decisions"
2269
+ )}
2270
+ ` : "";
2271
+ const subagentMode = `${claudeSubagentMode}${copilotCustomAgentMode}`;
1962
2272
  return `---
1963
2273
  name: truthmark-structure
1964
2274
  description: ${workflow.description}
@@ -1978,11 +2288,27 @@ Truth Structure is agent-native:
1978
2288
  - create starter truth docs when useful and when they belong in the canonical current-truth surface
1979
2289
  - Starter truth docs must use closed YAML frontmatter bounded by opening and closing --- lines; include status, doc_type, last_reviewed, and source_of_truth inside that frontmatter.
1980
2290
  - Starter truth docs must include ## Product Decisions and ## Rationale sections.
2291
+ ${subagentMode}
1981
2292
  ${FEATURE_DOC_TEMPLATE_INSTRUCTIONS}
1982
2293
  - use ${truthDocsRoot}/**, docs/architecture/**, or docs/standards/** for current truth destinations
1983
2294
  - use only canonical current-truth destinations for starter truth docs
1984
2295
  - keep active Product Decisions and Rationale in the canonical doc that owns the behavior
1985
2296
  - preserve unrelated authored content
2297
+ ## New area setup
2298
+ Use when a user asks to onboard a new code area into Truthmark, a new package, controller, domain, or product area lacks bounded truth ownership, or a new product area needs routing and starter truth docs.
2299
+ Do:
2300
+ - inspect the named code area
2301
+ - infer bounded product or behavior ownership
2302
+ - choose the owning route when ownership is clear; otherwise propose the route and block for review
2303
+ - create or update the child route entry or file
2304
+ - create starter truth docs only where current truth is missing
2305
+ - report the initial truth boundary
2306
+ Do not:
2307
+ - do not edit functional code
2308
+ - do not perform full behavior documentation unless evidence is inspected and the task explicitly asks for it
2309
+ - do not patch broad or mixed-owner docs in place
2310
+ - do not create generic catch-all docs
2311
+ - do not treat README files as Sync targets
1986
2312
  ## Topology Governance
1987
2313
  Truth Structure owns documentation topology. Do not depend on humans to manually organize ${truthDocsRoot}. Treat the configured truth root as a managed semantic root.
1988
2314
  Inspect controllers, routes, handlers, services, packages, tests, existing truth docs, and route files; infer product and domain ownership from behavior boundaries, not from mechanical directory mirroring.
@@ -2032,7 +2358,7 @@ Portable fallback:
2032
2358
  ${renderHierarchySummary(config)}
2033
2359
  ${DECISION_TRUTH_INSTRUCTIONS}
2034
2360
  Report completion in this shape:
2035
- ${renderMarkdownExample3(renderTruthStructureReportExample(config))}`;
2361
+ ${renderMarkdownExample4(renderTruthStructureReportExample(config))}`;
2036
2362
  };
2037
2363
 
2038
2364
  // src/sync/report.ts
@@ -2065,34 +2391,37 @@ var renderTruthSyncBlockedReport = (input) => {
2065
2391
 
2066
2392
  // src/agents/truth-sync.ts
2067
2393
  var TRUTH_SYNC_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-sync; Codex /truthmark-sync or $truthmark-sync; Claude Code /truthmark-sync; GitHub Copilot /truthmark-sync; Gemini CLI /truthmark:sync.";
2068
- var renderMarkdownExample4 = (content) => {
2394
+ var renderMarkdownExample5 = (content) => {
2069
2395
  return ["```md", content, "```"].join("\n");
2070
2396
  };
2071
- var renderTruthSyncWorkerPrompt = (config = defaultAgentConfig()) => {
2072
- return `### Truth Sync Worker
2073
- The parent provides the task focus and any repository context already gathered.
2074
- Worker rules:
2075
- - inspect relevant staged, unstaged, and untracked functional code directly
2076
- - read .truthmark/config.yml, ${config.docs.routing.rootIndex}, and canonical truth docs directly
2077
- - Code verification is parent-owned; report what was run or why it was not run
2078
- - may write truth docs and ${config.docs.routing.rootIndex} only for Truth Sync alignment
2079
- - must not rewrite functional code
2080
- Return result in this shape:
2081
- - status: completed | blocked
2082
- - changedCodeReviewed: string[]
2083
- - ownershipReviewed: string[]
2084
- - structureRequired?: string[]
2085
- - truthDocsUpdated: string[]
2086
- - routingDocsUpdated: string[]
2087
- - truthDocsSplit?: string[]
2088
- - evidenceChecked: { claim: string; evidence: string[]; result: supported | narrowed | removed | blocked }[]
2089
- - notes: string[]
2090
- - blockedReason?: string
2091
- - manualReviewFiles?: string[]`;
2092
- };
2093
- var renderTruthSyncSkillBody = (config = defaultAgentConfig()) => {
2397
+ var renderTruthSyncSkillBody = (config = defaultAgentConfig(), options = {}) => {
2094
2398
  const truthDocsRoot = resolveTruthDocsRoot(config);
2095
2399
  const workflow = getTruthmarkWorkflow("truthmark-sync");
2400
+ const claudeSubagentMode = options.includeClaudeSubagentMode ? `${renderClaudeSubagentModeSection(
2401
+ workflow.subagents ?? [],
2402
+ "Parent agent owns Truth Sync acceptance, lease validation, and final report",
2403
+ workflow.writeSubagents ?? []
2404
+ )}
2405
+ ` : "";
2406
+ const codexSubagentMode = options.includeCodexSubagentMode ? `${renderCodexSubagentModeSection(
2407
+ workflow.subagents ?? [],
2408
+ "Parent agent owns Truth Sync acceptance, lease validation, and final report",
2409
+ workflow.writeSubagents ?? []
2410
+ )}
2411
+ ` : "";
2412
+ const copilotCustomAgentMode = options.includeCopilotCustomAgentMode ? `${renderCopilotCustomAgentModeSection(
2413
+ workflow.subagents ?? [],
2414
+ "Parent agent owns Truth Sync acceptance, lease validation, and final report",
2415
+ workflow.writeSubagents ?? []
2416
+ )}
2417
+ ` : "";
2418
+ const openCodeSubagentMode = options.includeOpenCodeSubagentMode ? `${renderOpenCodeSubagentModeSection(
2419
+ workflow.subagents ?? [],
2420
+ "Parent agent owns Truth Sync acceptance, lease validation, and final report",
2421
+ workflow.writeSubagents ?? []
2422
+ )}
2423
+ ` : "";
2424
+ const subagentMode = `${claudeSubagentMode}${codexSubagentMode}${copilotCustomAgentMode}${openCodeSubagentMode}`;
2096
2425
  return `---
2097
2426
  name: truthmark-sync
2098
2427
  description: ${workflow.description}
@@ -2111,8 +2440,8 @@ Parent workflow:
2111
2440
  3. Identify functional-code changes and the nearest truth docs or routing repairs.
2112
2441
  4. ${EVIDENCE_AUTHORITY_INSTRUCTIONS}
2113
2442
  5. Code verification is parent-owned: follow repository instructions and task context, and report what ran or why it did not run.
2114
- 6. Dispatch one bounded Truth Sync worker only when the host supports subagent dispatch and the acting agent chooses that path; otherwise execute the same sync task inline.
2115
- Topology quality gate:
2443
+ 6. Dispatch bounded Truth Sync workers only when the host supports subagent dispatch and the acting agent chooses that path; otherwise execute the same sync task inline.
2444
+ ${subagentMode}Topology quality gate:
2116
2445
  - before updating truth docs, verify the changed code resolves to a specific behavior-owned area and bounded truth owner
2117
2446
  - if routing is missing, stale, broad, overloaded, catch-all route only, or cannot map changed code to a bounded truth owner, do not create another generic truth doc
2118
2447
  - run Truth Structure before syncing when topology repair is safe and in scope
@@ -2143,18 +2472,17 @@ Optional validation tooling:
2143
2472
  - update Product Decisions and Rationale when a behavior change comes from a decision change
2144
2473
  ${renderHierarchySummary(config)}
2145
2474
  ${DECISION_TRUTH_INSTRUCTIONS}
2146
- ${renderTruthSyncWorkerPrompt(config)}
2147
2475
  Parent post-sync verification:
2148
- - verify only truth docs and ${config.docs.routing.rootIndex} changed during sync
2476
+ - verify only truth docs and leased truth routing files changed during sync
2149
2477
  - block on any unrelated diff caused by the sync step
2150
2478
  - block if functional code changed during sync
2151
- - verify the worker report matches the required headings and sections
2479
+ - for each write lease, validate the worker report against the actual worker diff, allowedWrites, forbiddenWrites, identity fields, filesChanged, offLeaseChanges, blockers, and required report fields before accepting it
2152
2480
  - validate the final report against the structured Truth Sync report contract, including Claim, Evidence, and Result entries under Evidence checked
2153
2481
  - verify the updated docs correspond to the reviewed changed-code surface
2154
2482
  - verify the final report records ownership review, structure requirement, split, restructure, or blocked reason when the ownership gate fired
2155
2483
  - blocked outcomes must preserve the working tree as-is: no rollback, no post-block cleanup edits, and manual-review reporting of any remaining files
2156
2484
  Report completion in this shape:
2157
- ${renderMarkdownExample4(
2485
+ ${renderMarkdownExample5(
2158
2486
  renderTruthSyncCompletedReport({
2159
2487
  changedCode: ["src/auth/session.ts"],
2160
2488
  truthDocsUpdated: [`${truthDocsRoot}/repository/overview.md`],
@@ -2169,7 +2497,7 @@ ${renderMarkdownExample4(
2169
2497
  })
2170
2498
  )}
2171
2499
  Blocked report example:
2172
- ${renderMarkdownExample4(
2500
+ ${renderMarkdownExample5(
2173
2501
  renderTruthSyncBlockedReport({
2174
2502
  reason: "routing repair is not allowed",
2175
2503
  manualReviewFiles: [config.docs.routing.rootIndex],
@@ -2178,7 +2506,23 @@ ${renderMarkdownExample4(
2178
2506
  )}`;
2179
2507
  };
2180
2508
 
2181
- // src/templates/codex-skills.ts
2509
+ // src/agents/write-lease.ts
2510
+ import micromatch from "micromatch";
2511
+ import { parse as parseYaml } from "yaml";
2512
+ var TRUTHMARK_WRITE_WORKER_REPORT_FIELDS = [
2513
+ "status",
2514
+ "worker",
2515
+ "workflow",
2516
+ "shard",
2517
+ "filesChanged",
2518
+ "claimsChecked",
2519
+ "evidenceChecked",
2520
+ "offLeaseChanges",
2521
+ "blockers",
2522
+ "notes"
2523
+ ];
2524
+
2525
+ // src/templates/workflow-surfaces.ts
2182
2526
  var TRUTHMARK_STRUCTURE_SKILL_PATH = ".codex/skills/truthmark-structure/SKILL.md";
2183
2527
  var TRUTHMARK_STRUCTURE_SKILL_METADATA_PATH = ".codex/skills/truthmark-structure/agents/openai.yaml";
2184
2528
  var TRUTHMARK_DOCUMENT_SKILL_PATH = ".codex/skills/truthmark-document/SKILL.md";
@@ -2189,16 +2533,36 @@ var TRUTHMARK_REALIZE_SKILL_PATH = ".codex/skills/truthmark-realize/SKILL.md";
2189
2533
  var TRUTHMARK_REALIZE_SKILL_METADATA_PATH = ".codex/skills/truthmark-realize/agents/openai.yaml";
2190
2534
  var TRUTHMARK_CHECK_SKILL_PATH = ".codex/skills/truthmark-check/SKILL.md";
2191
2535
  var TRUTHMARK_CHECK_SKILL_METADATA_PATH = ".codex/skills/truthmark-check/agents/openai.yaml";
2536
+ var TRUTHMARK_PREVIEW_SKILL_PATH = ".codex/skills/truthmark-preview/SKILL.md";
2537
+ var TRUTHMARK_PREVIEW_SKILL_METADATA_PATH = ".codex/skills/truthmark-preview/agents/openai.yaml";
2538
+ var TRUTHMARK_ROUTE_AUDITOR_AGENT_PATH = ".codex/agents/truth-route-auditor.toml";
2539
+ var TRUTHMARK_CLAIM_VERIFIER_AGENT_PATH = ".codex/agents/truth-claim-verifier.toml";
2540
+ var TRUTHMARK_DOC_REVIEWER_AGENT_PATH = ".codex/agents/truth-doc-reviewer.toml";
2541
+ var TRUTHMARK_DOC_WRITER_AGENT_PATH = ".codex/agents/truth-doc-writer.toml";
2542
+ var TRUTHMARK_OPENCODE_ROUTE_AUDITOR_AGENT_PATH = ".opencode/agents/truth-route-auditor.md";
2543
+ var TRUTHMARK_OPENCODE_CLAIM_VERIFIER_AGENT_PATH = ".opencode/agents/truth-claim-verifier.md";
2544
+ var TRUTHMARK_OPENCODE_DOC_REVIEWER_AGENT_PATH = ".opencode/agents/truth-doc-reviewer.md";
2545
+ var TRUTHMARK_OPENCODE_DOC_WRITER_AGENT_PATH = ".opencode/agents/truth-doc-writer.md";
2546
+ var TRUTHMARK_CLAUDE_ROUTE_AUDITOR_AGENT_PATH = ".claude/agents/truth-route-auditor.md";
2547
+ var TRUTHMARK_CLAUDE_CLAIM_VERIFIER_AGENT_PATH = ".claude/agents/truth-claim-verifier.md";
2548
+ var TRUTHMARK_CLAUDE_DOC_REVIEWER_AGENT_PATH = ".claude/agents/truth-doc-reviewer.md";
2549
+ var TRUTHMARK_CLAUDE_DOC_WRITER_AGENT_PATH = ".claude/agents/truth-doc-writer.md";
2192
2550
  var TRUTHMARK_GEMINI_STRUCTURE_COMMAND_PATH = ".gemini/commands/truthmark/structure.toml";
2193
2551
  var TRUTHMARK_GEMINI_DOCUMENT_COMMAND_PATH = ".gemini/commands/truthmark/document.toml";
2194
2552
  var TRUTHMARK_GEMINI_SYNC_COMMAND_PATH = ".gemini/commands/truthmark/sync.toml";
2195
2553
  var TRUTHMARK_GEMINI_REALIZE_COMMAND_PATH = ".gemini/commands/truthmark/realize.toml";
2196
2554
  var TRUTHMARK_GEMINI_CHECK_COMMAND_PATH = ".gemini/commands/truthmark/check.toml";
2555
+ var TRUTHMARK_GEMINI_PREVIEW_COMMAND_PATH = ".gemini/commands/truthmark/preview.toml";
2197
2556
  var TRUTHMARK_COPILOT_STRUCTURE_PROMPT_PATH = ".github/prompts/truthmark-structure.prompt.md";
2198
2557
  var TRUTHMARK_COPILOT_DOCUMENT_PROMPT_PATH = ".github/prompts/truthmark-document.prompt.md";
2199
2558
  var TRUTHMARK_COPILOT_SYNC_PROMPT_PATH = ".github/prompts/truthmark-sync.prompt.md";
2200
2559
  var TRUTHMARK_COPILOT_REALIZE_PROMPT_PATH = ".github/prompts/truthmark-realize.prompt.md";
2201
2560
  var TRUTHMARK_COPILOT_CHECK_PROMPT_PATH = ".github/prompts/truthmark-check.prompt.md";
2561
+ var TRUTHMARK_COPILOT_PREVIEW_PROMPT_PATH = ".github/prompts/truthmark-preview.prompt.md";
2562
+ var TRUTHMARK_COPILOT_ROUTE_AUDITOR_AGENT_PATH = ".github/agents/truth-route-auditor.agent.md";
2563
+ var TRUTHMARK_COPILOT_CLAIM_VERIFIER_AGENT_PATH = ".github/agents/truth-claim-verifier.agent.md";
2564
+ var TRUTHMARK_COPILOT_DOC_REVIEWER_AGENT_PATH = ".github/agents/truth-doc-reviewer.agent.md";
2565
+ var TRUTHMARK_COPILOT_DOC_WRITER_AGENT_PATH = ".github/agents/truth-doc-writer.agent.md";
2202
2566
  var renderGeminiCommand = (description, prompt) => {
2203
2567
  return `description = "${description}"
2204
2568
  prompt = '''
@@ -2215,11 +2579,629 @@ description: '${description}'
2215
2579
  ${prompt}
2216
2580
  `;
2217
2581
  };
2218
- var renderTruthmarkStructureSkill = (config = defaultAgentConfig()) => {
2219
- return renderTruthStructureSkillBody(config);
2582
+ var renderTomlString = (value) => {
2583
+ return `"${value.replace(/\\/gu, "\\\\").replace(/"/gu, '\\"')}"`;
2584
+ };
2585
+ var renderTomlStringArray = (values) => {
2586
+ return `[${values.map(renderTomlString).join(", ")}]`;
2587
+ };
2588
+ var TRUTH_REALIZE_EXPLICIT_INVOCATIONS = "OpenCode /skill truthmark-realize; Codex /truthmark-realize or $truthmark-realize; Claude Code /truthmark-realize; GitHub Copilot /truthmark-realize; Gemini CLI /truthmark:realize.";
2589
+ var WORKFLOW_PACKAGE_DEFINITIONS = {
2590
+ "truthmark-structure": {
2591
+ title: "Truthmark Structure",
2592
+ argumentHint: "Optional area, directory, or routing concern",
2593
+ invocations: TRUTH_STRUCTURE_EXPLICIT_INVOCATIONS,
2594
+ use: () => "Use this skill to design or repair Truthmark area structure.",
2595
+ quickRules: (config) => [
2596
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2597
+ `Read .truthmark/config.yml, ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, current docs, and relevant code directly.`,
2598
+ "Define areas by product or behavior ownership, not by mechanical directory mirroring.",
2599
+ "Do not edit functional code.",
2600
+ "Read support/procedure.md before writing route or starter truth-doc changes.",
2601
+ "Read support/report-template.md before the final report."
2602
+ ],
2603
+ parentRule: "Parent agent owns all Truth Structure writes and final topology decisions"
2604
+ },
2605
+ "truthmark-document": {
2606
+ title: "Truthmark Document",
2607
+ argumentHint: "Optional implemented behavior, API endpoint, route, controller, package, or truth-doc area to document",
2608
+ invocations: TRUTH_DOCUMENT_EXPLICIT_INVOCATIONS,
2609
+ use: () => "Use this skill to document existing implemented behavior when no functional-code changes are required for the task.",
2610
+ quickRules: (config) => [
2611
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2612
+ `Read .truthmark/config.yml, ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, existing canonical docs, implementation code, and tests directly.`,
2613
+ "Document current implemented behavior; do not invent future behavior.",
2614
+ "May write canonical truth docs and truth routing files only; must not write functional code.",
2615
+ "Read support/procedure.md before editing truth docs.",
2616
+ "Read support/subagents-and-leases.md before dispatching or accepting worker output.",
2617
+ "Read support/report-template.md before the final report."
2618
+ ],
2619
+ parentRule: "Parent agent owns Truth Document acceptance, lease validation, and final report"
2620
+ },
2621
+ "truthmark-sync": {
2622
+ title: "Truthmark Sync",
2623
+ argumentHint: "Optional changed-code area, truth-doc area, or sync focus",
2624
+ invocations: TRUTH_SYNC_EXPLICIT_INVOCATIONS,
2625
+ use: () => "Use this skill automatically before finishing when functional code changed since the last successful Truth Sync. Also run it immediately when the user explicitly invokes Truth Sync.",
2626
+ quickRules: (config) => [
2627
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2628
+ "Skip docs-only, formatting-only, behavior-preserving renames with no truth impact, missing config, and no-code changes.",
2629
+ `Read .truthmark/config.yml, the configured root route index at ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, and relevant canonical docs.`,
2630
+ "direct checkout inspection is the canonical path; do not require the truthmark binary.",
2631
+ "May write canonical truth docs and truth routing files only; must not rewrite functional code.",
2632
+ "Read support/procedure.md before editing truth docs.",
2633
+ "Read support/subagents-and-leases.md before dispatching or accepting worker output.",
2634
+ "Read support/report-template.md before the final report."
2635
+ ],
2636
+ parentRule: "Parent agent owns Truth Sync acceptance, lease validation, and final report"
2637
+ },
2638
+ "truthmark-preview": {
2639
+ title: "Truthmark Preview",
2640
+ argumentHint: "Optional requested outcome, code area, doc path, or routing question",
2641
+ invocations: TRUTH_PREVIEW_EXPLICIT_INVOCATIONS,
2642
+ use: () => "Use this skill only when the user explicitly asks to preview Truthmark routing or workflow choice before edits.",
2643
+ quickRules: (config) => [
2644
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2645
+ `Read .truthmark/config.yml, ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, and only the truth docs or implementation files needed to preview ownership.`,
2646
+ "Truth Preview is read-only; this report is intended, not authorized.",
2647
+ "must not edit files and must not issue write leases; do not run Truth Sync automatically, replace Truth Check, claim final correctness, or mutate code.",
2648
+ "Use optional read-only route-auditor evidence only when it reduces context or clarifies ownership.",
2649
+ "Hand off to the selected workflow after user approval."
2650
+ ],
2651
+ parentRule: "Parent agent owns the final Truth Preview report"
2652
+ },
2653
+ "truthmark-realize": {
2654
+ title: "Truthmark Realize",
2655
+ argumentHint: "Optional truth doc path, area, or desired code behavior to realize",
2656
+ invocations: TRUTH_REALIZE_EXPLICIT_INVOCATIONS,
2657
+ use: () => "Use this skill only when the user explicitly asks to realize truth docs into code.",
2658
+ quickRules: (config) => [
2659
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2660
+ `Read the source truth docs, .truthmark/config.yml, ${config.docs.routing.rootIndex}, relevant child route files, tests, and relevant functional code directly.`,
2661
+ "Truth docs lead; code follows.",
2662
+ "may write functional code only; must not edit truth docs or truth routing while realizing those docs.",
2663
+ "Read support/procedure.md before changing code.",
2664
+ "Read support/report-template.md before the final report."
2665
+ ]
2666
+ },
2667
+ "truthmark-check": {
2668
+ title: "Truthmark Check",
2669
+ argumentHint: "Optional area, doc path, or audit focus",
2670
+ invocations: TRUTH_CHECK_EXPLICIT_INVOCATIONS,
2671
+ use: () => "Use this skill to audit repository truth health.",
2672
+ quickRules: (config) => [
2673
+ "Follow docs/ai/repo-rules.md as the repository instruction authority.",
2674
+ `Read .truthmark/config.yml, ${config.docs.routing.rootIndex}, relevant child route files under ${config.docs.routing.areaFilesRoot}/, canonical docs, and relevant implementation directly.`,
2675
+ "Report issues and suggested fixes; do not silently rewrite unrelated files.",
2676
+ "Direct checkout inspection is valid even when local tooling is unavailable.",
2677
+ "Read support/procedure.md before auditing details.",
2678
+ "Read support/subagents-and-leases.md before dispatching verifier subagents.",
2679
+ "Read support/report-template.md before the final report."
2680
+ ],
2681
+ parentRule: "Parent agent owns the final Truth Check report"
2682
+ }
2683
+ };
2684
+ var stripWorkflowSkillFrontmatter = (body) => {
2685
+ return body.replace(/^---\n[\s\S]*?\n---\n\n?/u, "").trim();
2686
+ };
2687
+ var splitWorkflowSupport = (body) => {
2688
+ const stripped = stripWorkflowSkillFrontmatter(body);
2689
+ const marker = "Report completion in this shape:";
2690
+ const markerIndex = stripped.indexOf(marker);
2691
+ if (markerIndex === -1) {
2692
+ return {
2693
+ procedure: stripped,
2694
+ reportTemplate: "Report completion in the workflow-specific shape."
2695
+ };
2696
+ }
2697
+ return {
2698
+ procedure: stripped.slice(0, markerIndex).trim(),
2699
+ reportTemplate: stripped.slice(markerIndex).trim()
2700
+ };
2701
+ };
2702
+ var renderSkillSupportFile = (title, body) => {
2703
+ return `# ${title}
2704
+
2705
+ Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
2706
+
2707
+ ${body}
2708
+ `;
2709
+ };
2710
+ var renderStandaloneWorkflowSkillBody = (workflowId, config) => {
2711
+ switch (workflowId) {
2712
+ case "truthmark-structure":
2713
+ return renderTruthStructureSkillBody(config);
2714
+ case "truthmark-document":
2715
+ return renderTruthDocumentSkillBody(config);
2716
+ case "truthmark-sync":
2717
+ return renderTruthSyncSkillBody(config);
2718
+ case "truthmark-preview":
2719
+ return renderTruthPreviewSkillBody(config);
2720
+ case "truthmark-realize":
2721
+ return renderTruthmarkRealizeSkillBody(config);
2722
+ case "truthmark-check":
2723
+ return renderTruthCheckSkillBody(config);
2724
+ }
2725
+ };
2726
+ var renderWorkflowEntrypoint = (workflowId, config, supportFiles) => {
2727
+ const workflow = getTruthmarkWorkflow(workflowId);
2728
+ const definition = WORKFLOW_PACKAGE_DEFINITIONS[workflowId];
2729
+ const supportFileList = supportFiles.map((supportFile) => `- ${supportFile}`).join("\n");
2730
+ return `---
2731
+ name: ${workflowId}
2732
+ description: ${workflow.description}
2733
+ argument-hint: ${definition.argumentHint}
2734
+ user-invocable: true
2735
+ truthmark-version: ${TRUTHMARK_VERSION}
2736
+ ---
2737
+
2738
+ # ${definition.title}
2739
+
2740
+ ${definition.use(config)}
2741
+
2742
+ Invocations: ${definition.invocations}
2743
+
2744
+ Quick procedure:
2745
+ ${definition.quickRules(config).map((rule) => `- ${rule}`).join("\n")}
2746
+
2747
+ Progressive disclosure:
2748
+ ${supportFileList}
2749
+ `;
2750
+ };
2751
+ var renderWorkflowSubagentSupport = (workflowId, host) => {
2752
+ const workflow = getTruthmarkWorkflow(workflowId);
2753
+ const definition = WORKFLOW_PACKAGE_DEFINITIONS[workflowId];
2754
+ const readAgents = workflow.subagents ?? [];
2755
+ const writeAgents = workflow.writeSubagents ?? [];
2756
+ if (readAgents.length === 0 && writeAgents.length === 0) {
2757
+ return void 0;
2758
+ }
2759
+ if (definition.parentRule === void 0) {
2760
+ return void 0;
2761
+ }
2762
+ switch (host) {
2763
+ case "codex":
2764
+ return renderCodexSubagentModeSection(
2765
+ readAgents,
2766
+ definition.parentRule,
2767
+ writeAgents
2768
+ );
2769
+ case "opencode":
2770
+ return renderOpenCodeSubagentModeSection(
2771
+ readAgents,
2772
+ definition.parentRule,
2773
+ writeAgents
2774
+ );
2775
+ case "claude-code":
2776
+ return renderClaudeSubagentModeSection(
2777
+ readAgents,
2778
+ definition.parentRule,
2779
+ writeAgents
2780
+ );
2781
+ }
2782
+ };
2783
+ var renderTruthmarkSkillPackage = ({
2784
+ skillPath,
2785
+ workflowId,
2786
+ host,
2787
+ config = defaultAgentConfig()
2788
+ }) => {
2789
+ const skillDirectory = skillPath.replace(/\/SKILL\.md$/u, "");
2790
+ const supportDirectory = `${skillDirectory}/support`;
2791
+ const { procedure, reportTemplate } = splitWorkflowSupport(
2792
+ renderStandaloneWorkflowSkillBody(workflowId, config)
2793
+ );
2794
+ const subagents = renderWorkflowSubagentSupport(workflowId, host);
2795
+ const supportFiles = [
2796
+ "support/procedure.md",
2797
+ "support/report-template.md",
2798
+ ...subagents === void 0 ? [] : ["support/subagents-and-leases.md"]
2799
+ ];
2800
+ const definition = WORKFLOW_PACKAGE_DEFINITIONS[workflowId];
2801
+ const files = [
2802
+ {
2803
+ path: skillPath,
2804
+ content: renderWorkflowEntrypoint(workflowId, config, supportFiles)
2805
+ },
2806
+ {
2807
+ path: `${supportDirectory}/procedure.md`,
2808
+ content: renderSkillSupportFile(
2809
+ `${definition.title} Procedure`,
2810
+ procedure
2811
+ )
2812
+ },
2813
+ {
2814
+ path: `${supportDirectory}/report-template.md`,
2815
+ content: renderSkillSupportFile(
2816
+ `${definition.title} Report Template`,
2817
+ reportTemplate
2818
+ )
2819
+ }
2820
+ ];
2821
+ if (subagents !== void 0) {
2822
+ files.push({
2823
+ path: `${supportDirectory}/subagents-and-leases.md`,
2824
+ content: renderSkillSupportFile(
2825
+ `${definition.title} Subagents And Leases`,
2826
+ subagents
2827
+ )
2828
+ });
2829
+ }
2830
+ return files;
2831
+ };
2832
+ var normalizeOpenCodePermissionPath = (path12) => {
2833
+ const normalized = path12.replace(/\\/gu, "/").replace(/^\.\//u, "").replace(/\/+$/u, "");
2834
+ return normalized === "" ? "." : normalized;
2835
+ };
2836
+ var appendOpenCodePermissionGlob = (root, glob) => {
2837
+ return root === "." ? glob.replace(/^\//u, "") : `${root}${glob}`;
2838
+ };
2839
+ var renderOpenCodeWriterEditAllowRules = (config) => {
2840
+ const truthDocsRoot = normalizeOpenCodePermissionPath(
2841
+ resolveTruthDocsRoot(config)
2842
+ );
2843
+ const rootRouteIndex = normalizeOpenCodePermissionPath(
2844
+ config.docs.routing.rootIndex
2845
+ );
2846
+ const areaFilesRoot = normalizeOpenCodePermissionPath(
2847
+ config.docs.routing.areaFilesRoot
2848
+ );
2849
+ const allowedPatterns = [
2850
+ appendOpenCodePermissionGlob(truthDocsRoot, "/**"),
2851
+ rootRouteIndex,
2852
+ appendOpenCodePermissionGlob(areaFilesRoot, "/**/*.md")
2853
+ ];
2854
+ return [...new Set(allowedPatterns)].map((pattern) => ` ${JSON.stringify(pattern)}: allow`).join("\n");
2855
+ };
2856
+ var READ_ONLY_SUBAGENT_CONTEXT_BOUNDARY = `Context boundary:
2857
+ Do not preload AGENTS.md, CLAUDE.md, GEMINI.md, .github/copilot-instructions.md, or repo-wide policy docs unless the parent explicitly assigns them as evidence.
2858
+ Use only the parent-assigned shard plus required checkout evidence files.
2859
+ Return findings only; the parent workflow owns repository-policy interpretation, final decisions, and all writes.`;
2860
+ var renderReadOnlySubagentInstructions = (instructions) => {
2861
+ return `${instructions}
2862
+ ${READ_ONLY_SUBAGENT_CONTEXT_BOUNDARY}`;
2863
+ };
2864
+ var TRUTHMARK_SUBAGENT_PROFILES = {
2865
+ truth_route_auditor: {
2866
+ codexName: "truth_route_auditor",
2867
+ copilotName: "truth-route-auditor",
2868
+ description: "Read-only Truthmark route auditor for bounded routing and ownership verification.",
2869
+ nicknameCandidates: ["Route Audit", "Route Trace", "Route Check"],
2870
+ instructions: `Stay read-only.
2871
+ Audit one bounded Truthmark route, area, or doc shard assigned by the parent.
2872
+ Read .truthmark/config.yml, the root route index, relevant child route files, mapped truth docs, and relevant implementation files directly.
2873
+ Find missing, stale, broad, overloaded, catch-all, mixed-owner, or unrouteable ownership.
2874
+ Do not edit files, stage changes, or propose broad rewrites.
2875
+ Return JSON only with keys: scope, filesReviewed, findings, evidence, confidence, recommendedWorkflow, notes.
2876
+ recommendedWorkflow must be one of: none, truthmark-document, truthmark-structure.`
2877
+ },
2878
+ truth_claim_verifier: {
2879
+ codexName: "truth_claim_verifier",
2880
+ copilotName: "truth-claim-verifier",
2881
+ description: "Read-only Truthmark claim verifier for checking canonical truth against checkout evidence.",
2882
+ nicknameCandidates: ["Claim Audit", "Claim Trace", "Claim Check"],
2883
+ instructions: `Stay read-only.
2884
+ Verify the behavior-bearing truth claims assigned by the parent against primary checkout evidence.
2885
+ Use implementation, tests, config, routing, generated templates, schemas, or explicit evidence blocks as primary evidence.
2886
+ Canonical docs and examples can corroborate but are not sole proof when implementation conflicts.
2887
+ For every checked claim, classify the result as supported | narrowed | removed | blocked.
2888
+ Do not edit files, stage changes, or invent missing behavior.
2889
+ Return JSON only with keys: scope, filesReviewed, claimsChecked, evidence, unsupportedClaims, confidence, recommendedWorkflow, notes.`
2890
+ },
2891
+ truth_doc_reviewer: {
2892
+ codexName: "truth_doc_reviewer",
2893
+ copilotName: "truth-doc-reviewer",
2894
+ description: "Read-only Truthmark doc reviewer for shape, decision, rationale, and evidence hygiene.",
2895
+ nicknameCandidates: ["Doc Audit", "Doc Shape", "Doc Check"],
2896
+ instructions: `Stay read-only.
2897
+ Review assigned canonical truth docs for frontmatter, source_of_truth, required template sections, Evidence checked entries, Product Decisions, and Rationale.
2898
+ Flag README.md files used as behavior truth targets, mixed-owner docs, and shape repairs that should move to Truth Structure.
2899
+ Do not edit files, stage changes, or rewrite docs.
2900
+ Return JSON only with keys: scope, filesReviewed, findings, evidence, confidence, recommendedWorkflow, notes.
2901
+ recommendedWorkflow must be one of: none, truthmark-document, truthmark-structure.`
2902
+ }
2903
+ };
2904
+ var TRUTHMARK_WRITE_SUBAGENT_PROFILES = {
2905
+ truth_doc_writer: {
2906
+ codexName: "truth_doc_writer",
2907
+ copilotName: "truth-doc-writer",
2908
+ description: "Write-capable Truthmark doc worker for one parent-leased truth-document shard.",
2909
+ nicknameCandidates: ["Doc Writer", "Truth Writer", "Doc Sync"],
2910
+ instructions: `Write one leased Truthmark truth-document shard assigned by the parent.
2911
+ Require an explicit write lease before editing. The lease must name workflow, worker, shard, objective, requiredReads, allowedWrites, forbiddenWrites, evidenceRequired, verification, and reportFields.
2912
+ Read every requiredReads entry directly before editing.
2913
+ Edit only leased canonical truth docs or leased truth routing files. Do not edit functional code, generated host surfaces, package files, config files, templates, or tests unless they are explicitly leased.
2914
+ Do not expand your own write scope. If the task needs an off-lease file, stop and report blocked.
2915
+ Block when ownership is missing or ambiguous, evidence does not support the requested claim, another worker changed the leased file, generated surfaces appear stale, or a required edit is outside the lease.
2916
+ Return YAML only with keys: ${TRUTHMARK_WRITE_WORKER_REPORT_FIELDS.join(", ")}.
2917
+ status must be completed or blocked.
2918
+ filesChanged must list only files you actually changed.
2919
+ offLeaseChanges must be empty for completed reports.
2920
+ The parent must validate the actual checkout diff before accepting your report.`
2921
+ }
2922
+ };
2923
+ var renderCodexReadOnlyAgent = ({
2924
+ name,
2925
+ description,
2926
+ nicknameCandidates,
2927
+ developerInstructions
2928
+ }) => {
2929
+ return `# Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
2930
+ name = ${renderTomlString(name)}
2931
+ description = ${renderTomlString(description)}
2932
+ sandbox_mode = "read-only"
2933
+ nickname_candidates = ${renderTomlStringArray(nicknameCandidates)}
2934
+ developer_instructions = """
2935
+ ${developerInstructions}
2936
+ """
2937
+ `;
2938
+ };
2939
+ var renderCodexWriteAgent = ({
2940
+ name,
2941
+ description,
2942
+ nicknameCandidates,
2943
+ developerInstructions
2944
+ }) => {
2945
+ return `# Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
2946
+ name = ${renderTomlString(name)}
2947
+ description = ${renderTomlString(description)}
2948
+ sandbox_mode = "workspace-write"
2949
+ nickname_candidates = ${renderTomlStringArray(nicknameCandidates)}
2950
+ developer_instructions = """
2951
+ ${developerInstructions}
2952
+ """
2953
+ `;
2954
+ };
2955
+ var renderCopilotReadOnlyAgent = ({
2956
+ copilotName,
2957
+ description,
2958
+ instructions
2959
+ }) => {
2960
+ const agentInstructions = renderReadOnlySubagentInstructions(instructions);
2961
+ return `---
2962
+ name: ${copilotName}
2963
+ description: ${description}
2964
+ tools: [read, search]
2965
+ ---
2966
+
2967
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
2968
+
2969
+ ${agentInstructions}
2970
+ `;
2971
+ };
2972
+ var renderCopilotWriteAgent = ({
2973
+ copilotName,
2974
+ description,
2975
+ instructions
2976
+ }) => {
2977
+ return `---
2978
+ name: ${copilotName}
2979
+ description: ${description}
2980
+ tools: [read, search, edit]
2981
+ ---
2982
+
2983
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
2984
+
2985
+ ${instructions}
2986
+ `;
2987
+ };
2988
+ var renderClaudeReadOnlyAgent = ({
2989
+ copilotName,
2990
+ description,
2991
+ instructions
2992
+ }) => {
2993
+ const agentInstructions = renderReadOnlySubagentInstructions(instructions);
2994
+ return `---
2995
+ name: ${copilotName}
2996
+ description: ${description}
2997
+ tools: Read, Grep, Glob, LS
2998
+ ---
2999
+
3000
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
3001
+
3002
+ Manual invocation: use the ${copilotName} subagent.
3003
+
3004
+ ${agentInstructions}
3005
+ `;
3006
+ };
3007
+ var renderClaudeWriteAgent = ({
3008
+ copilotName,
3009
+ description,
3010
+ instructions
3011
+ }) => {
3012
+ return `---
3013
+ name: ${copilotName}
3014
+ description: ${description}
3015
+ tools: Read, Grep, Glob, LS, Edit, MultiEdit
3016
+ ---
3017
+
3018
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
3019
+
3020
+ Manual invocation: use the ${copilotName} subagent with an explicit parent write lease.
3021
+
3022
+ ${instructions}
3023
+ `;
3024
+ };
3025
+ var renderTruthmarkRouteAuditorAgent = () => {
3026
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_route_auditor;
3027
+ return renderCodexReadOnlyAgent({
3028
+ name: profile.codexName,
3029
+ description: profile.description,
3030
+ nicknameCandidates: profile.nicknameCandidates,
3031
+ developerInstructions: renderReadOnlySubagentInstructions(
3032
+ profile.instructions
3033
+ )
3034
+ });
3035
+ };
3036
+ var renderTruthmarkClaimVerifierAgent = () => {
3037
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_claim_verifier;
3038
+ return renderCodexReadOnlyAgent({
3039
+ name: profile.codexName,
3040
+ description: profile.description,
3041
+ nicknameCandidates: profile.nicknameCandidates,
3042
+ developerInstructions: renderReadOnlySubagentInstructions(
3043
+ profile.instructions
3044
+ )
3045
+ });
3046
+ };
3047
+ var renderTruthmarkDocReviewerAgent = () => {
3048
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_doc_reviewer;
3049
+ return renderCodexReadOnlyAgent({
3050
+ name: profile.codexName,
3051
+ description: profile.description,
3052
+ nicknameCandidates: profile.nicknameCandidates,
3053
+ developerInstructions: renderReadOnlySubagentInstructions(
3054
+ profile.instructions
3055
+ )
3056
+ });
3057
+ };
3058
+ var renderTruthmarkDocWriterAgent = () => {
3059
+ const profile = TRUTHMARK_WRITE_SUBAGENT_PROFILES.truth_doc_writer;
3060
+ return renderCodexWriteAgent({
3061
+ name: profile.codexName,
3062
+ description: profile.description,
3063
+ nicknameCandidates: profile.nicknameCandidates,
3064
+ developerInstructions: profile.instructions
3065
+ });
3066
+ };
3067
+ var renderTruthmarkCopilotRouteAuditorAgent = () => {
3068
+ return renderCopilotReadOnlyAgent(
3069
+ TRUTHMARK_SUBAGENT_PROFILES.truth_route_auditor
3070
+ );
3071
+ };
3072
+ var renderTruthmarkCopilotClaimVerifierAgent = () => {
3073
+ return renderCopilotReadOnlyAgent(
3074
+ TRUTHMARK_SUBAGENT_PROFILES.truth_claim_verifier
3075
+ );
3076
+ };
3077
+ var renderTruthmarkCopilotDocReviewerAgent = () => {
3078
+ return renderCopilotReadOnlyAgent(
3079
+ TRUTHMARK_SUBAGENT_PROFILES.truth_doc_reviewer
3080
+ );
3081
+ };
3082
+ var renderTruthmarkCopilotDocWriterAgent = () => {
3083
+ return renderCopilotWriteAgent(
3084
+ TRUTHMARK_WRITE_SUBAGENT_PROFILES.truth_doc_writer
3085
+ );
3086
+ };
3087
+ var renderTruthmarkClaudeRouteAuditorAgent = () => {
3088
+ return renderClaudeReadOnlyAgent(
3089
+ TRUTHMARK_SUBAGENT_PROFILES.truth_route_auditor
3090
+ );
3091
+ };
3092
+ var renderTruthmarkClaudeClaimVerifierAgent = () => {
3093
+ return renderClaudeReadOnlyAgent(
3094
+ TRUTHMARK_SUBAGENT_PROFILES.truth_claim_verifier
3095
+ );
3096
+ };
3097
+ var renderTruthmarkClaudeDocReviewerAgent = () => {
3098
+ return renderClaudeReadOnlyAgent(
3099
+ TRUTHMARK_SUBAGENT_PROFILES.truth_doc_reviewer
3100
+ );
3101
+ };
3102
+ var renderTruthmarkClaudeDocWriterAgent = () => {
3103
+ return renderClaudeWriteAgent(
3104
+ TRUTHMARK_WRITE_SUBAGENT_PROFILES.truth_doc_writer
3105
+ );
3106
+ };
3107
+ var renderOpenCodeReadOnlyAgent = ({
3108
+ invocation,
3109
+ description,
3110
+ instructions
3111
+ }) => {
3112
+ const agentInstructions = renderReadOnlySubagentInstructions(instructions);
3113
+ return `---
3114
+ description: ${description}
3115
+ mode: subagent
3116
+ permission:
3117
+ edit: deny
3118
+ task: deny
3119
+ webfetch: deny
3120
+ websearch: deny
3121
+ external_directory: deny
3122
+ bash:
3123
+ "*": ask
3124
+ "git status*": allow
3125
+ "git diff*": allow
3126
+ "git log*": allow
3127
+ "rg *": allow
3128
+ "grep *": allow
3129
+ ---
3130
+
3131
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
3132
+
3133
+ Manual invocation: @${invocation}
3134
+
3135
+ ${agentInstructions}
3136
+ `;
3137
+ };
3138
+ var renderOpenCodeWriteAgent = ({
3139
+ invocation,
3140
+ description,
3141
+ instructions,
3142
+ config
3143
+ }) => {
3144
+ const editAllowRules = renderOpenCodeWriterEditAllowRules(config);
3145
+ return `---
3146
+ description: ${description}
3147
+ mode: subagent
3148
+ permission:
3149
+ read: allow
3150
+ list: allow
3151
+ grep: allow
3152
+ glob: allow
3153
+ edit:
3154
+ "*": deny
3155
+ ${editAllowRules}
3156
+ task: deny
3157
+ webfetch: deny
3158
+ websearch: deny
3159
+ external_directory: deny
3160
+ bash:
3161
+ "*": ask
3162
+ "git status*": allow
3163
+ "git diff*": allow
3164
+ ---
3165
+
3166
+ # Generated by Truthmark ${TRUTHMARK_VERSION}. Rerun truthmark init after upgrades.
3167
+
3168
+ Manual invocation: @${invocation}
3169
+
3170
+ ${instructions}
3171
+ `;
2220
3172
  };
2221
- var renderTruthmarkStructureLocalSkill = (config = defaultAgentConfig()) => {
2222
- return renderTruthStructureSkillBody(config);
3173
+ var renderTruthmarkOpenCodeRouteAuditorAgent = () => {
3174
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_route_auditor;
3175
+ return renderOpenCodeReadOnlyAgent({
3176
+ invocation: profile.copilotName,
3177
+ description: profile.description,
3178
+ instructions: profile.instructions
3179
+ });
3180
+ };
3181
+ var renderTruthmarkOpenCodeClaimVerifierAgent = () => {
3182
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_claim_verifier;
3183
+ return renderOpenCodeReadOnlyAgent({
3184
+ invocation: profile.copilotName,
3185
+ description: profile.description,
3186
+ instructions: profile.instructions
3187
+ });
3188
+ };
3189
+ var renderTruthmarkOpenCodeDocReviewerAgent = () => {
3190
+ const profile = TRUTHMARK_SUBAGENT_PROFILES.truth_doc_reviewer;
3191
+ return renderOpenCodeReadOnlyAgent({
3192
+ invocation: profile.copilotName,
3193
+ description: profile.description,
3194
+ instructions: profile.instructions
3195
+ });
3196
+ };
3197
+ var renderTruthmarkOpenCodeDocWriterAgent = (config = defaultAgentConfig()) => {
3198
+ const profile = TRUTHMARK_WRITE_SUBAGENT_PROFILES.truth_doc_writer;
3199
+ return renderOpenCodeWriteAgent({
3200
+ invocation: profile.copilotName,
3201
+ description: profile.description,
3202
+ instructions: profile.instructions,
3203
+ config
3204
+ });
2223
3205
  };
2224
3206
  var renderTruthmarkStructureSkillMetadata = () => {
2225
3207
  const workflow = getTruthmarkWorkflow("truthmark-structure");
@@ -2236,12 +3218,6 @@ truthmark:
2236
3218
  refresh_command: "truthmark init"
2237
3219
  `;
2238
3220
  };
2239
- var renderTruthmarkDocumentSkill = (config = defaultAgentConfig()) => {
2240
- return renderTruthDocumentSkillBody(config);
2241
- };
2242
- var renderTruthmarkDocumentLocalSkill = (config = defaultAgentConfig()) => {
2243
- return renderTruthDocumentSkillBody(config);
2244
- };
2245
3221
  var renderTruthmarkDocumentSkillMetadata = () => {
2246
3222
  const workflow = getTruthmarkWorkflow("truthmark-document");
2247
3223
  return `interface:
@@ -2257,12 +3233,6 @@ truthmark:
2257
3233
  refresh_command: "truthmark init"
2258
3234
  `;
2259
3235
  };
2260
- var renderTruthmarkSyncSkill = (config = defaultAgentConfig()) => {
2261
- return renderTruthSyncSkillBody(config);
2262
- };
2263
- var renderTruthmarkSyncLocalSkill = (config = defaultAgentConfig()) => {
2264
- return renderTruthSyncSkillBody(config);
2265
- };
2266
3236
  var renderTruthmarkSyncSkillMetadata = () => {
2267
3237
  const workflow = getTruthmarkWorkflow("truthmark-sync");
2268
3238
  return `interface:
@@ -2338,12 +3308,6 @@ Verification:
2338
3308
  \`\`\`
2339
3309
  `;
2340
3310
  };
2341
- var renderTruthmarkRealizeSkill = (config = defaultAgentConfig()) => {
2342
- return renderTruthmarkRealizeSkillBody(config);
2343
- };
2344
- var renderTruthmarkRealizeLocalSkill = (config = defaultAgentConfig()) => {
2345
- return renderTruthmarkRealizeSkillBody(config);
2346
- };
2347
3311
  var renderTruthmarkRealizeSkillMetadata = () => {
2348
3312
  const workflow = getTruthmarkWorkflow("truthmark-realize");
2349
3313
  return `interface:
@@ -2359,11 +3323,20 @@ truthmark:
2359
3323
  refresh_command: "truthmark init"
2360
3324
  `;
2361
3325
  };
2362
- var renderTruthmarkCheckSkill = (config = defaultAgentConfig()) => {
2363
- return renderTruthCheckSkillBody(config);
2364
- };
2365
- var renderTruthmarkCheckLocalSkill = (config = defaultAgentConfig()) => {
2366
- return renderTruthCheckSkillBody(config);
3326
+ var renderTruthmarkPreviewSkillMetadata = () => {
3327
+ const workflow = getTruthmarkWorkflow("truthmark-preview");
3328
+ return `interface:
3329
+ display_name: "${workflow.displayName}"
3330
+ short_description: "${workflow.shortDescription}"
3331
+ default_prompt: "${workflow.defaultPrompt}"
3332
+
3333
+ policy:
3334
+ allow_implicit_invocation: ${workflow.allowImplicitInvocation}
3335
+
3336
+ truthmark:
3337
+ version: "${TRUTHMARK_VERSION}"
3338
+ refresh_command: "truthmark init"
3339
+ `;
2367
3340
  };
2368
3341
  var renderTruthmarkCheckSkillMetadata = () => {
2369
3342
  const workflow = getTruthmarkWorkflow("truthmark-check");
@@ -2415,25 +3388,38 @@ var renderTruthmarkGeminiCheckCommand = (config = defaultAgentConfig()) => {
2415
3388
  renderTruthCheckSkillBody(config)
2416
3389
  );
2417
3390
  };
3391
+ var renderTruthmarkGeminiPreviewCommand = (config = defaultAgentConfig()) => {
3392
+ const workflow = getTruthmarkWorkflow("truthmark-preview");
3393
+ return renderGeminiCommand(
3394
+ workflow.description,
3395
+ renderTruthPreviewSkillBody(config)
3396
+ );
3397
+ };
2418
3398
  var renderTruthmarkCopilotStructurePrompt = (config = defaultAgentConfig()) => {
2419
3399
  const workflow = getTruthmarkWorkflow("truthmark-structure");
2420
3400
  return renderCopilotPromptFile(
2421
3401
  workflow.description,
2422
- renderTruthStructureSkillBody(config)
3402
+ renderTruthStructureSkillBody(config, {
3403
+ includeCopilotCustomAgentMode: true
3404
+ })
2423
3405
  );
2424
3406
  };
2425
3407
  var renderTruthmarkCopilotDocumentPrompt = (config = defaultAgentConfig()) => {
2426
3408
  const workflow = getTruthmarkWorkflow("truthmark-document");
2427
3409
  return renderCopilotPromptFile(
2428
3410
  workflow.description,
2429
- renderTruthDocumentSkillBody(config)
3411
+ renderTruthDocumentSkillBody(config, {
3412
+ includeCopilotCustomAgentMode: true
3413
+ })
2430
3414
  );
2431
3415
  };
2432
3416
  var renderTruthmarkCopilotSyncPrompt = (config = defaultAgentConfig()) => {
2433
3417
  const workflow = getTruthmarkWorkflow("truthmark-sync");
2434
3418
  return renderCopilotPromptFile(
2435
3419
  workflow.description,
2436
- renderTruthSyncSkillBody(config)
3420
+ renderTruthSyncSkillBody(config, {
3421
+ includeCopilotCustomAgentMode: true
3422
+ })
2437
3423
  );
2438
3424
  };
2439
3425
  var renderTruthmarkCopilotRealizePrompt = (config = defaultAgentConfig()) => {
@@ -2447,80 +3433,213 @@ var renderTruthmarkCopilotCheckPrompt = (config = defaultAgentConfig()) => {
2447
3433
  const workflow = getTruthmarkWorkflow("truthmark-check");
2448
3434
  return renderCopilotPromptFile(
2449
3435
  workflow.description,
2450
- renderTruthCheckSkillBody(config)
3436
+ renderTruthCheckSkillBody(config, {
3437
+ includeCopilotCustomAgentMode: true
3438
+ })
3439
+ );
3440
+ };
3441
+ var renderTruthmarkCopilotPreviewPrompt = (config = defaultAgentConfig()) => {
3442
+ const workflow = getTruthmarkWorkflow("truthmark-preview");
3443
+ return renderCopilotPromptFile(
3444
+ workflow.description,
3445
+ renderTruthPreviewSkillBody(config)
2451
3446
  );
2452
3447
  };
2453
3448
 
2454
3449
  // src/templates/generated-surfaces.ts
2455
- var workflowSkillFiles = (basePath, config) => {
3450
+ var codexFiles = (config) => {
2456
3451
  const files = [
3452
+ ...renderTruthmarkSkillPackage({
3453
+ skillPath: TRUTHMARK_STRUCTURE_SKILL_PATH,
3454
+ workflowId: "truthmark-structure",
3455
+ host: "codex",
3456
+ config
3457
+ }),
2457
3458
  {
2458
- path: `${basePath}/truthmark-structure/SKILL.md`,
2459
- content: renderTruthmarkStructureLocalSkill(config)
3459
+ path: TRUTHMARK_STRUCTURE_SKILL_METADATA_PATH,
3460
+ content: renderTruthmarkStructureSkillMetadata()
2460
3461
  },
3462
+ ...renderTruthmarkSkillPackage({
3463
+ skillPath: TRUTHMARK_DOCUMENT_SKILL_PATH,
3464
+ workflowId: "truthmark-document",
3465
+ host: "codex",
3466
+ config
3467
+ }),
2461
3468
  {
2462
- path: `${basePath}/truthmark-document/SKILL.md`,
2463
- content: renderTruthmarkDocumentLocalSkill(config)
3469
+ path: TRUTHMARK_DOCUMENT_SKILL_METADATA_PATH,
3470
+ content: renderTruthmarkDocumentSkillMetadata()
2464
3471
  },
3472
+ ...renderTruthmarkSkillPackage({
3473
+ skillPath: TRUTHMARK_SYNC_SKILL_PATH,
3474
+ workflowId: "truthmark-sync",
3475
+ host: "codex",
3476
+ config
3477
+ }),
2465
3478
  {
2466
- path: `${basePath}/truthmark-sync/SKILL.md`,
2467
- content: renderTruthmarkSyncLocalSkill(config)
3479
+ path: TRUTHMARK_SYNC_SKILL_METADATA_PATH,
3480
+ content: renderTruthmarkSyncSkillMetadata()
2468
3481
  },
3482
+ ...renderTruthmarkSkillPackage({
3483
+ skillPath: TRUTHMARK_PREVIEW_SKILL_PATH,
3484
+ workflowId: "truthmark-preview",
3485
+ host: "codex",
3486
+ config
3487
+ }),
2469
3488
  {
2470
- path: `${basePath}/truthmark-check/SKILL.md`,
2471
- content: renderTruthmarkCheckLocalSkill(config)
3489
+ path: TRUTHMARK_PREVIEW_SKILL_METADATA_PATH,
3490
+ content: renderTruthmarkPreviewSkillMetadata()
2472
3491
  },
3492
+ ...renderTruthmarkSkillPackage({
3493
+ skillPath: TRUTHMARK_CHECK_SKILL_PATH,
3494
+ workflowId: "truthmark-check",
3495
+ host: "codex",
3496
+ config
3497
+ }),
2473
3498
  {
2474
- path: `${basePath}/truthmark-realize/SKILL.md`,
2475
- content: renderTruthmarkRealizeLocalSkill(config)
2476
- }
2477
- ];
2478
- return files;
2479
- };
2480
- var codexFiles = (config) => {
2481
- const files = [
3499
+ path: TRUTHMARK_CHECK_SKILL_METADATA_PATH,
3500
+ content: renderTruthmarkCheckSkillMetadata()
3501
+ },
3502
+ ...renderTruthmarkSkillPackage({
3503
+ skillPath: TRUTHMARK_REALIZE_SKILL_PATH,
3504
+ workflowId: "truthmark-realize",
3505
+ host: "codex",
3506
+ config
3507
+ }),
2482
3508
  {
2483
- path: TRUTHMARK_STRUCTURE_SKILL_PATH,
2484
- content: renderTruthmarkStructureSkill(config)
3509
+ path: TRUTHMARK_REALIZE_SKILL_METADATA_PATH,
3510
+ content: renderTruthmarkRealizeSkillMetadata()
2485
3511
  },
2486
3512
  {
2487
- path: TRUTHMARK_STRUCTURE_SKILL_METADATA_PATH,
2488
- content: renderTruthmarkStructureSkillMetadata()
3513
+ path: TRUTHMARK_ROUTE_AUDITOR_AGENT_PATH,
3514
+ content: renderTruthmarkRouteAuditorAgent()
2489
3515
  },
2490
3516
  {
2491
- path: TRUTHMARK_DOCUMENT_SKILL_PATH,
2492
- content: renderTruthmarkDocumentSkill(config)
3517
+ path: TRUTHMARK_CLAIM_VERIFIER_AGENT_PATH,
3518
+ content: renderTruthmarkClaimVerifierAgent()
2493
3519
  },
2494
3520
  {
2495
- path: TRUTHMARK_DOCUMENT_SKILL_METADATA_PATH,
2496
- content: renderTruthmarkDocumentSkillMetadata()
3521
+ path: TRUTHMARK_DOC_REVIEWER_AGENT_PATH,
3522
+ content: renderTruthmarkDocReviewerAgent()
3523
+ },
3524
+ {
3525
+ path: TRUTHMARK_DOC_WRITER_AGENT_PATH,
3526
+ content: renderTruthmarkDocWriterAgent()
3527
+ }
3528
+ ];
3529
+ return files;
3530
+ };
3531
+ var opencodeFiles = (config) => {
3532
+ return [
3533
+ ...renderTruthmarkSkillPackage({
3534
+ skillPath: ".opencode/skills/truthmark-structure/SKILL.md",
3535
+ workflowId: "truthmark-structure",
3536
+ host: "opencode",
3537
+ config
3538
+ }),
3539
+ ...renderTruthmarkSkillPackage({
3540
+ skillPath: ".opencode/skills/truthmark-document/SKILL.md",
3541
+ workflowId: "truthmark-document",
3542
+ host: "opencode",
3543
+ config
3544
+ }),
3545
+ ...renderTruthmarkSkillPackage({
3546
+ skillPath: ".opencode/skills/truthmark-sync/SKILL.md",
3547
+ workflowId: "truthmark-sync",
3548
+ host: "opencode",
3549
+ config
3550
+ }),
3551
+ ...renderTruthmarkSkillPackage({
3552
+ skillPath: ".opencode/skills/truthmark-preview/SKILL.md",
3553
+ workflowId: "truthmark-preview",
3554
+ host: "opencode",
3555
+ config
3556
+ }),
3557
+ ...renderTruthmarkSkillPackage({
3558
+ skillPath: ".opencode/skills/truthmark-check/SKILL.md",
3559
+ workflowId: "truthmark-check",
3560
+ host: "opencode",
3561
+ config
3562
+ }),
3563
+ ...renderTruthmarkSkillPackage({
3564
+ skillPath: ".opencode/skills/truthmark-realize/SKILL.md",
3565
+ workflowId: "truthmark-realize",
3566
+ host: "opencode",
3567
+ config
3568
+ }),
3569
+ {
3570
+ path: TRUTHMARK_OPENCODE_ROUTE_AUDITOR_AGENT_PATH,
3571
+ content: renderTruthmarkOpenCodeRouteAuditorAgent()
2497
3572
  },
2498
3573
  {
2499
- path: TRUTHMARK_SYNC_SKILL_PATH,
2500
- content: renderTruthmarkSyncSkill(config)
3574
+ path: TRUTHMARK_OPENCODE_CLAIM_VERIFIER_AGENT_PATH,
3575
+ content: renderTruthmarkOpenCodeClaimVerifierAgent()
2501
3576
  },
2502
3577
  {
2503
- path: TRUTHMARK_SYNC_SKILL_METADATA_PATH,
2504
- content: renderTruthmarkSyncSkillMetadata()
3578
+ path: TRUTHMARK_OPENCODE_DOC_REVIEWER_AGENT_PATH,
3579
+ content: renderTruthmarkOpenCodeDocReviewerAgent()
2505
3580
  },
2506
3581
  {
2507
- path: TRUTHMARK_CHECK_SKILL_PATH,
2508
- content: renderTruthmarkCheckSkill(config)
3582
+ path: TRUTHMARK_OPENCODE_DOC_WRITER_AGENT_PATH,
3583
+ content: renderTruthmarkOpenCodeDocWriterAgent(config)
3584
+ }
3585
+ ];
3586
+ };
3587
+ var claudeFiles = (config, block) => {
3588
+ return [
3589
+ ...instructionBlockFiles(["CLAUDE.md"], block),
3590
+ ...renderTruthmarkSkillPackage({
3591
+ skillPath: ".claude/skills/truthmark-structure/SKILL.md",
3592
+ workflowId: "truthmark-structure",
3593
+ host: "claude-code",
3594
+ config
3595
+ }),
3596
+ ...renderTruthmarkSkillPackage({
3597
+ skillPath: ".claude/skills/truthmark-document/SKILL.md",
3598
+ workflowId: "truthmark-document",
3599
+ host: "claude-code",
3600
+ config
3601
+ }),
3602
+ ...renderTruthmarkSkillPackage({
3603
+ skillPath: ".claude/skills/truthmark-sync/SKILL.md",
3604
+ workflowId: "truthmark-sync",
3605
+ host: "claude-code",
3606
+ config
3607
+ }),
3608
+ ...renderTruthmarkSkillPackage({
3609
+ skillPath: ".claude/skills/truthmark-preview/SKILL.md",
3610
+ workflowId: "truthmark-preview",
3611
+ host: "claude-code",
3612
+ config
3613
+ }),
3614
+ ...renderTruthmarkSkillPackage({
3615
+ skillPath: ".claude/skills/truthmark-check/SKILL.md",
3616
+ workflowId: "truthmark-check",
3617
+ host: "claude-code",
3618
+ config
3619
+ }),
3620
+ ...renderTruthmarkSkillPackage({
3621
+ skillPath: ".claude/skills/truthmark-realize/SKILL.md",
3622
+ workflowId: "truthmark-realize",
3623
+ host: "claude-code",
3624
+ config
3625
+ }),
3626
+ {
3627
+ path: TRUTHMARK_CLAUDE_ROUTE_AUDITOR_AGENT_PATH,
3628
+ content: renderTruthmarkClaudeRouteAuditorAgent()
2509
3629
  },
2510
3630
  {
2511
- path: TRUTHMARK_CHECK_SKILL_METADATA_PATH,
2512
- content: renderTruthmarkCheckSkillMetadata()
3631
+ path: TRUTHMARK_CLAUDE_CLAIM_VERIFIER_AGENT_PATH,
3632
+ content: renderTruthmarkClaudeClaimVerifierAgent()
2513
3633
  },
2514
3634
  {
2515
- path: TRUTHMARK_REALIZE_SKILL_PATH,
2516
- content: renderTruthmarkRealizeSkill(config)
3635
+ path: TRUTHMARK_CLAUDE_DOC_REVIEWER_AGENT_PATH,
3636
+ content: renderTruthmarkClaudeDocReviewerAgent()
2517
3637
  },
2518
3638
  {
2519
- path: TRUTHMARK_REALIZE_SKILL_METADATA_PATH,
2520
- content: renderTruthmarkRealizeSkillMetadata()
3639
+ path: TRUTHMARK_CLAUDE_DOC_WRITER_AGENT_PATH,
3640
+ content: renderTruthmarkClaudeDocWriterAgent()
2521
3641
  }
2522
3642
  ];
2523
- return files;
2524
3643
  };
2525
3644
  var copilotFiles = (config, block) => {
2526
3645
  const files = [
@@ -2537,6 +3656,10 @@ var copilotFiles = (config, block) => {
2537
3656
  path: TRUTHMARK_COPILOT_SYNC_PROMPT_PATH,
2538
3657
  content: renderTruthmarkCopilotSyncPrompt(config)
2539
3658
  },
3659
+ {
3660
+ path: TRUTHMARK_COPILOT_PREVIEW_PROMPT_PATH,
3661
+ content: renderTruthmarkCopilotPreviewPrompt(config)
3662
+ },
2540
3663
  {
2541
3664
  path: TRUTHMARK_COPILOT_CHECK_PROMPT_PATH,
2542
3665
  content: renderTruthmarkCopilotCheckPrompt(config)
@@ -2544,6 +3667,22 @@ var copilotFiles = (config, block) => {
2544
3667
  {
2545
3668
  path: TRUTHMARK_COPILOT_REALIZE_PROMPT_PATH,
2546
3669
  content: renderTruthmarkCopilotRealizePrompt(config)
3670
+ },
3671
+ {
3672
+ path: TRUTHMARK_COPILOT_ROUTE_AUDITOR_AGENT_PATH,
3673
+ content: renderTruthmarkCopilotRouteAuditorAgent()
3674
+ },
3675
+ {
3676
+ path: TRUTHMARK_COPILOT_CLAIM_VERIFIER_AGENT_PATH,
3677
+ content: renderTruthmarkCopilotClaimVerifierAgent()
3678
+ },
3679
+ {
3680
+ path: TRUTHMARK_COPILOT_DOC_REVIEWER_AGENT_PATH,
3681
+ content: renderTruthmarkCopilotDocReviewerAgent()
3682
+ },
3683
+ {
3684
+ path: TRUTHMARK_COPILOT_DOC_WRITER_AGENT_PATH,
3685
+ content: renderTruthmarkCopilotDocWriterAgent()
2547
3686
  }
2548
3687
  ];
2549
3688
  return files;
@@ -2560,12 +3699,9 @@ var filesForPlatform = (platform, config, block) => {
2560
3699
  case "codex":
2561
3700
  return codexFiles(config);
2562
3701
  case "opencode":
2563
- return workflowSkillFiles(".opencode/skills", config);
3702
+ return opencodeFiles(config);
2564
3703
  case "claude-code":
2565
- return [
2566
- ...instructionBlockFiles(["CLAUDE.md"], block),
2567
- ...workflowSkillFiles(".claude/skills", config)
2568
- ];
3704
+ return claudeFiles(config, block);
2569
3705
  case "github-copilot":
2570
3706
  return copilotFiles(config, block);
2571
3707
  case "gemini-cli":
@@ -2583,6 +3719,10 @@ var filesForPlatform = (platform, config, block) => {
2583
3719
  path: TRUTHMARK_GEMINI_SYNC_COMMAND_PATH,
2584
3720
  content: renderTruthmarkGeminiSyncCommand(config)
2585
3721
  },
3722
+ {
3723
+ path: TRUTHMARK_GEMINI_PREVIEW_COMMAND_PATH,
3724
+ content: renderTruthmarkGeminiPreviewCommand(config)
3725
+ },
2586
3726
  {
2587
3727
  path: TRUTHMARK_GEMINI_CHECK_COMMAND_PATH,
2588
3728
  content: renderTruthmarkGeminiCheckCommand(config)
@@ -2597,11 +3737,13 @@ var filesForPlatform = (platform, config, block) => {
2597
3737
  var renderGeneratedSurfaces = (config, block = renderAgentsBlock(config)) => {
2598
3738
  const files = [
2599
3739
  ...instructionBlockFiles(config.instructionTargets, block),
2600
- ...config.platforms.flatMap((platform) => filesForPlatform(platform, config, block))
3740
+ ...config.platforms.flatMap(
3741
+ (platform) => filesForPlatform(platform, config, block)
3742
+ )
2601
3743
  ];
2602
- return Array.from(new Map(files.map((file) => [file.path, file])).values()).sort(
2603
- (left, right) => left.path.localeCompare(right.path)
2604
- );
3744
+ return Array.from(
3745
+ new Map(files.map((file) => [file.path, file])).values()
3746
+ ).sort((left, right) => left.path.localeCompare(right.path));
2605
3747
  };
2606
3748
 
2607
3749
  // src/init/init.ts
@@ -2733,7 +3875,7 @@ var diagnosticCategoryForPath = (filePath, config) => {
2733
3875
  if (filePath === "AGENTS.md") {
2734
3876
  return "truth-sync";
2735
3877
  }
2736
- if (filePath === "CLAUDE.md" || filePath === "GEMINI.md" || filePath === ".github/copilot-instructions.md" || filePath.startsWith(".github/prompts/truthmark-") || filePath.startsWith(".claude/skills/truthmark-") || filePath.startsWith(".opencode/skills/truthmark-")) {
3878
+ if (filePath === "CLAUDE.md" || filePath === "GEMINI.md" || filePath === ".github/copilot-instructions.md" || filePath.startsWith(".github/prompts/truthmark-") || filePath.startsWith(".github/agents/truth-") || filePath.startsWith(".claude/agents/truth-") || filePath.startsWith(".claude/skills/truthmark-") || filePath.startsWith(".opencode/skills/truthmark-") || filePath.startsWith(".opencode/agents/") || filePath.startsWith(".codex/agents/")) {
2737
3879
  return "truth-sync";
2738
3880
  }
2739
3881
  if (filePath.startsWith(".codex/skills/truthmark-structure/")) {
@@ -2745,6 +3887,9 @@ var diagnosticCategoryForPath = (filePath, config) => {
2745
3887
  if (filePath.startsWith(".codex/skills/truthmark-sync/")) {
2746
3888
  return "truth-sync";
2747
3889
  }
3890
+ if (filePath.startsWith(".codex/skills/truthmark-preview/")) {
3891
+ return "truth-sync";
3892
+ }
2748
3893
  if (filePath.startsWith(".codex/skills/truthmark-realize/")) {
2749
3894
  return "realization";
2750
3895
  }
@@ -3176,12 +4321,12 @@ var checkLinks = async (rootDir, markdownPaths) => {
3176
4321
  // src/checks/areas.ts
3177
4322
  import fs13 from "fs/promises";
3178
4323
  import fg5 from "fast-glob";
3179
- import micromatch3 from "micromatch";
4324
+ import micromatch4 from "micromatch";
3180
4325
 
3181
4326
  // src/routing/area-resolver.ts
3182
4327
  import fs12 from "fs/promises";
3183
4328
  import fg4 from "fast-glob";
3184
- import micromatch from "micromatch";
4329
+ import micromatch2 from "micromatch";
3185
4330
  var unique = (values) => {
3186
4331
  return [...new Set(values)];
3187
4332
  };
@@ -3200,7 +4345,7 @@ var isCodeSurfaceWithinParent = (childPattern, parentPatterns) => {
3200
4345
  return false;
3201
4346
  }
3202
4347
  return parentPatterns.some((parentPattern) => {
3203
- return micromatch.isMatch(childPrefix, parentPattern) || micromatch.isMatch(childPattern, parentPattern);
4348
+ return micromatch2.isMatch(childPrefix, parentPattern) || micromatch2.isMatch(childPattern, parentPattern);
3204
4349
  });
3205
4350
  };
3206
4351
  var ensureChildPath = async (rootDir, areaFilesRoot, filePath) => {
@@ -3387,7 +4532,7 @@ var resolveAreaRouting = async (rootDir, config) => {
3387
4532
  };
3388
4533
 
3389
4534
  // src/sync/classify.ts
3390
- import micromatch2 from "micromatch";
4535
+ import micromatch3 from "micromatch";
3391
4536
  var CODE_EXTENSIONS = /* @__PURE__ */ new Set([
3392
4537
  ".c",
3393
4538
  ".cc",
@@ -3507,10 +4652,10 @@ var classifyPath = (filePath, ignorePatterns) => {
3507
4652
  if (normalizedPath.startsWith(".truthmark/")) {
3508
4653
  return "derived";
3509
4654
  }
3510
- if (normalizedPath.startsWith(".claude/") || normalizedPath.startsWith(".codex/") || normalizedPath.startsWith(".gemini/commands/") || normalizedPath.startsWith(".opencode/") || normalizedPath === ".github/copilot-instructions.md" || normalizedPath.startsWith(".github/prompts/truthmark-") || normalizedPath === "AGENTS.md" || normalizedPath === "CLAUDE.md" || normalizedPath === "GEMINI.md" || normalizedPath.startsWith(".gemini/commands/truthmark/")) {
4655
+ if (normalizedPath.startsWith(".claude/") || normalizedPath.startsWith(".codex/") || normalizedPath.startsWith(".gemini/commands/") || normalizedPath.startsWith(".opencode/") || normalizedPath === ".github/copilot-instructions.md" || normalizedPath.startsWith(".github/agents/truth-") || normalizedPath.startsWith(".github/prompts/truthmark-") || normalizedPath === "AGENTS.md" || normalizedPath === "CLAUDE.md" || normalizedPath === "GEMINI.md" || normalizedPath.startsWith(".gemini/commands/truthmark/")) {
3511
4656
  return "derived";
3512
4657
  }
3513
- if (ignorePatterns.length > 0 && micromatch2.isMatch(normalizedPath, ignorePatterns)) {
4658
+ if (ignorePatterns.length > 0 && micromatch3.isMatch(normalizedPath, ignorePatterns)) {
3514
4659
  return "ignored";
3515
4660
  }
3516
4661
  if (normalizedPath.toLowerCase().endsWith(".md")) {
@@ -3806,7 +4951,7 @@ var checkAreas = async (rootDir, config) => {
3806
4951
  }
3807
4952
  for (const codeFile of codeFiles.sort()) {
3808
4953
  const matched = areaCoverage.some(
3809
- (entry) => entry.valid && entry.patterns.some((pattern) => micromatch3.isMatch(codeFile, pattern))
4954
+ (entry) => entry.valid && entry.patterns.some((pattern) => micromatch4.isMatch(codeFile, pattern))
3810
4955
  );
3811
4956
  if (!matched) {
3812
4957
  diagnostics.push({
@@ -3837,7 +4982,7 @@ var checkAreas = async (rootDir, config) => {
3837
4982
 
3838
4983
  // src/checks/decisions.ts
3839
4984
  import fs14 from "fs/promises";
3840
- import micromatch4 from "micromatch";
4985
+ import micromatch5 from "micromatch";
3841
4986
  var REQUIRED_DECISION_HEADINGS = ["Scope", "Product Decisions", "Rationale"];
3842
4987
  var isTruthDocumentKind3 = (value) => {
3843
4988
  return TRUTH_DOCUMENT_KINDS.includes(value);
@@ -3901,7 +5046,7 @@ var decisionTruthGlobs = (config) => {
3901
5046
  ].filter((root) => Boolean(root)).map((root) => `${root}/**/*.md`);
3902
5047
  };
3903
5048
  var isDecisionTruthCandidate = (config, filePath) => {
3904
- return !filePath.endsWith("/README.md") && micromatch4.isMatch(filePath, decisionTruthGlobs(config));
5049
+ return !filePath.endsWith("/README.md") && micromatch5.isMatch(filePath, decisionTruthGlobs(config));
3905
5050
  };
3906
5051
  var checkDecisionSections = async (rootDir, config, markdownPaths, truthDocumentEntries = []) => {
3907
5052
  const diagnostics = [];
@@ -4020,7 +5165,7 @@ var checkGeneratedSurfaces = async (rootDir, config) => {
4020
5165
 
4021
5166
  // src/impact/build.ts
4022
5167
  import path9 from "path";
4023
- import micromatch6 from "micromatch";
5168
+ import micromatch7 from "micromatch";
4024
5169
 
4025
5170
  // src/repo-index/build.ts
4026
5171
  import fs18 from "fs/promises";
@@ -4032,7 +5177,7 @@ import path5 from "path";
4032
5177
  import { execa as execa2 } from "execa";
4033
5178
  import fg6 from "fast-glob";
4034
5179
  import matter2 from "gray-matter";
4035
- import micromatch5 from "micromatch";
5180
+ import micromatch6 from "micromatch";
4036
5181
  var languageByExtension = /* @__PURE__ */ new Map([
4037
5182
  [".ts", "typescript"],
4038
5183
  [".tsx", "typescript"],
@@ -4109,7 +5254,7 @@ var gitDiscoverableFiles = async (rootDir) => {
4109
5254
  return result.stdout.split("\n").map((line) => normalizePath2(line.trim())).filter((line) => line.length > 0);
4110
5255
  };
4111
5256
  var isIgnoredPath = (filePath, ignore) => {
4112
- return micromatch5.isMatch(filePath, [...defaultIgnore, ...ignore]);
5257
+ return micromatch6.isMatch(filePath, [...defaultIgnore, ...ignore]);
4113
5258
  };
4114
5259
  var discoverRepoFiles = async (rootDir, ignore) => {
4115
5260
  const discoveredFiles = await gitDiscoverableFiles(rootDir) ?? await fg6(["**/*"], {
@@ -4528,7 +5673,7 @@ var readBaseFile = async (cwd, base, filePath) => {
4528
5673
  // src/impact/build.ts
4529
5674
  var uniqueSorted = (values) => [...new Set(values)].sort();
4530
5675
  var routeMatchesFile = (route, filePath) => {
4531
- return route.codeSurface.some((pattern) => micromatch6.isMatch(filePath, pattern));
5676
+ return route.codeSurface.some((pattern) => micromatch7.isMatch(filePath, pattern));
4532
5677
  };
4533
5678
  var routeOwnsTruthDoc = (route, filePath) => {
4534
5679
  return route.truthDocs.includes(filePath);