@triedotdev/mcp 1.0.164 → 1.0.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +16 -2
  2. package/dist/{chunk-5TRCQAOE.js → chunk-2Z3TQNNK.js} +16 -5
  3. package/dist/chunk-2Z3TQNNK.js.map +1 -0
  4. package/dist/{chunk-5BYSJ7XT.js → chunk-GTKYBOXL.js} +13 -2
  5. package/dist/{chunk-5BYSJ7XT.js.map → chunk-GTKYBOXL.js.map} +1 -1
  6. package/dist/{chunk-D6E4Q4I6.js → chunk-HOGKPDZA.js} +302 -58
  7. package/dist/chunk-HOGKPDZA.js.map +1 -0
  8. package/dist/{chunk-LR46VMIE.js → chunk-JEZ7XJQN.js} +5 -5
  9. package/dist/{chunk-ERMLZJTK.js → chunk-JNUOW2JS.js} +13 -13
  10. package/dist/{chunk-62JD7MIS.js → chunk-LG5CBK6A.js} +15 -35
  11. package/dist/chunk-LG5CBK6A.js.map +1 -0
  12. package/dist/{chunk-LLDZDU2Y.js → chunk-LR5M4RTN.js} +79 -1
  13. package/dist/chunk-LR5M4RTN.js.map +1 -0
  14. package/dist/{chunk-Y4B3VEL7.js → chunk-MVVPJ73K.js} +438 -202
  15. package/dist/chunk-MVVPJ73K.js.map +1 -0
  16. package/dist/chunk-OBQ74FOU.js +27 -0
  17. package/dist/chunk-OBQ74FOU.js.map +1 -0
  18. package/dist/{chunk-IRZXBQVQ.js → chunk-S36IO3EE.js} +134 -101
  19. package/dist/chunk-S36IO3EE.js.map +1 -0
  20. package/dist/{chunk-HFVPHQL3.js → chunk-TQOO6A4G.js} +9 -9
  21. package/dist/{chunk-OKK4QNK3.js → chunk-UXRW2YSP.js} +86 -12
  22. package/dist/chunk-UXRW2YSP.js.map +1 -0
  23. package/dist/{chunk-ACU3IXZG.js → chunk-ZKKKLRZZ.js} +7 -7
  24. package/dist/cli/main.js +215 -57
  25. package/dist/cli/main.js.map +1 -1
  26. package/dist/cli/yolo-daemon.js +15 -14
  27. package/dist/cli/yolo-daemon.js.map +1 -1
  28. package/dist/{fast-analyzer-LLZ6FLP5.js → fast-analyzer-NJQO3TFD.js} +3 -3
  29. package/dist/{goal-manager-D6XKE3FY.js → goal-manager-DVX24UPZ.js} +5 -5
  30. package/dist/{goal-validator-4DDL7NBP.js → goal-validator-6Y5CDEMJ.js} +5 -5
  31. package/dist/{hypothesis-RI3Q33JB.js → hypothesis-UKPGOYY2.js} +5 -5
  32. package/dist/index.js +16 -15
  33. package/dist/index.js.map +1 -1
  34. package/dist/{issue-store-DUR5UTYK.js → issue-store-UZAPI5DU.js} +3 -3
  35. package/dist/{ledger-ZTR63P3L.js → ledger-CNFCJKHX.js} +8 -2
  36. package/dist/project-state-AHPA77SM.js +28 -0
  37. package/dist/server/mcp-server.js +16 -15
  38. package/dist/sync-M2FSWPBC.js +12 -0
  39. package/dist/{tiered-storage-FHHAJR4P.js → tiered-storage-OP74NPJY.js} +2 -2
  40. package/dist/tiered-storage-OP74NPJY.js.map +1 -0
  41. package/dist/{trie-agent-NYSPGZYS.js → trie-agent-6SWUHCVO.js} +12 -12
  42. package/dist/trie-agent-6SWUHCVO.js.map +1 -0
  43. package/package.json +1 -1
  44. package/dist/chunk-5TRCQAOE.js.map +0 -1
  45. package/dist/chunk-62JD7MIS.js.map +0 -1
  46. package/dist/chunk-D6E4Q4I6.js.map +0 -1
  47. package/dist/chunk-IRZXBQVQ.js.map +0 -1
  48. package/dist/chunk-LLDZDU2Y.js.map +0 -1
  49. package/dist/chunk-OKK4QNK3.js.map +0 -1
  50. package/dist/chunk-Y4B3VEL7.js.map +0 -1
  51. /package/dist/{chunk-LR46VMIE.js.map → chunk-JEZ7XJQN.js.map} +0 -0
  52. /package/dist/{chunk-ERMLZJTK.js.map → chunk-JNUOW2JS.js.map} +0 -0
  53. /package/dist/{chunk-HFVPHQL3.js.map → chunk-TQOO6A4G.js.map} +0 -0
  54. /package/dist/{chunk-ACU3IXZG.js.map → chunk-ZKKKLRZZ.js.map} +0 -0
  55. /package/dist/{fast-analyzer-LLZ6FLP5.js.map → fast-analyzer-NJQO3TFD.js.map} +0 -0
  56. /package/dist/{goal-manager-D6XKE3FY.js.map → goal-manager-DVX24UPZ.js.map} +0 -0
  57. /package/dist/{goal-validator-4DDL7NBP.js.map → goal-validator-6Y5CDEMJ.js.map} +0 -0
  58. /package/dist/{hypothesis-RI3Q33JB.js.map → hypothesis-UKPGOYY2.js.map} +0 -0
  59. /package/dist/{issue-store-DUR5UTYK.js.map → issue-store-UZAPI5DU.js.map} +0 -0
  60. /package/dist/{ledger-ZTR63P3L.js.map → ledger-CNFCJKHX.js.map} +0 -0
  61. /package/dist/{tiered-storage-FHHAJR4P.js.map → project-state-AHPA77SM.js.map} +0 -0
  62. /package/dist/{trie-agent-NYSPGZYS.js.map → sync-M2FSWPBC.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JVMBCWKS.js";
4
4
  import {
5
5
  getTrieAgent
6
- } from "./chunk-ERMLZJTK.js";
6
+ } from "./chunk-JNUOW2JS.js";
7
7
  import {
8
8
  parseGoalViolation
9
9
  } from "./chunk-WCN7S3EI.js";
@@ -18,7 +18,6 @@ import {
18
18
  } from "./chunk-T63OHG4Q.js";
19
19
  import {
20
20
  LearningEngine,
21
- exportToJson,
22
21
  formatFriendlyError,
23
22
  getLastCheckpoint,
24
23
  isTrieInitialized,
@@ -26,10 +25,13 @@ import {
26
25
  perceiveCurrentChanges,
27
26
  reasonAboutChangesHumanReadable,
28
27
  saveCheckpoint
29
- } from "./chunk-62JD7MIS.js";
28
+ } from "./chunk-LG5CBK6A.js";
30
29
  import {
31
30
  measureInitialGoalValue
32
- } from "./chunk-ACU3IXZG.js";
31
+ } from "./chunk-ZKKKLRZZ.js";
32
+ import {
33
+ exportToJson
34
+ } from "./chunk-OBQ74FOU.js";
33
35
  import {
34
36
  loadConfig,
35
37
  saveConfig
@@ -39,14 +41,14 @@ import {
39
41
  } from "./chunk-TN5WEKWI.js";
40
42
  import {
41
43
  findCrossProjectPatterns
42
- } from "./chunk-HFVPHQL3.js";
43
- import {
44
- TieredStorage,
45
- getStorage
46
- } from "./chunk-LLDZDU2Y.js";
44
+ } from "./chunk-TQOO6A4G.js";
47
45
  import {
48
46
  ContextGraph
49
47
  } from "./chunk-VUL52BQL.js";
48
+ import {
49
+ TieredStorage,
50
+ getStorage
51
+ } from "./chunk-LR5M4RTN.js";
50
52
  import {
51
53
  getKeyFromKeychain,
52
54
  isAIAvailable,
@@ -54,22 +56,26 @@ import {
54
56
  runAIWithTools,
55
57
  setAPIKey
56
58
  } from "./chunk-FQ45QP5A.js";
57
- import {
58
- getProjectState
59
- } from "./chunk-5BYSJ7XT.js";
60
59
  import {
61
60
  storeIssues
62
- } from "./chunk-IRZXBQVQ.js";
61
+ } from "./chunk-S36IO3EE.js";
62
+ import {
63
+ getProjectState
64
+ } from "./chunk-GTKYBOXL.js";
63
65
  import {
64
66
  getAutonomyConfig,
65
67
  loadAutonomyConfig,
66
68
  saveAutonomyConfig
67
69
  } from "./chunk-ME2OERF5.js";
68
70
  import {
71
+ generateKeyPair,
69
72
  getChangedFilesSinceTimestamp,
70
73
  getGitChangedFiles,
71
- getLedgerBlocks
72
- } from "./chunk-Y4B3VEL7.js";
74
+ getLedgerBlocks,
75
+ getPublicKey,
76
+ hasSigningKey,
77
+ saveKeyPair
78
+ } from "./chunk-MVVPJ73K.js";
73
79
  import {
74
80
  getTrieDirectory,
75
81
  getWorkingDirectory
@@ -728,6 +734,8 @@ function dashboardReducer(state, action) {
728
734
  return { ...state, memoryTree: { ...state.memoryTree, selectedNode: action.nodeId } };
729
735
  case "SET_MEMORY_EXPANDED_ITEM":
730
736
  return { ...state, memoryTree: { ...state.memoryTree, expandedItemId: action.itemId } };
737
+ case "TOGGLE_SIGNALS_VIEW_ALL":
738
+ return { ...state, memoryTree: { ...state.memoryTree, signalsViewAll: !state.memoryTree.signalsViewAll } };
731
739
  case "TOGGLE_MEMORY_NODE": {
732
740
  const expandable = ["decisions", "incidents", "patterns", "cross-project", "hotspots", "ledger-chain"];
733
741
  if (expandable.includes(action.nodeId)) {
@@ -981,7 +989,7 @@ function createInitialState() {
981
989
  },
982
990
  goalsPanel: { goals: [], selectedIndex: 0, selectedAchievedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningGoalId: null, scanningProgress: "" },
983
991
  hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningHypothesisId: null, scanningProgress: "" },
984
- memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageFacts: [], storageGotchas: [], storageNudges: [], storageInsights: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
992
+ memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageFacts: [], storageGotchas: [], storageNudges: [], storageInsights: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0, signalsViewAll: false },
985
993
  agentBrain: { loaded: false, governance: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
986
994
  chatState: { messages: [], inputBuffer: "", loading: false, progress: null, messageQueue: [], currentSessionId: null, currentSessionTitle: null },
987
995
  chatArchivePanel: { sessions: [], selectedIndex: 0, showArchived: false, loading: false, inputMode: "browse", inputBuffer: "" },
@@ -1120,6 +1128,8 @@ function Footer() {
1120
1128
  hints = narrow ? "d r" : "d delete \xB7 r resolve";
1121
1129
  } else if (ledgerBlockSelected) {
1122
1130
  hints = narrow ? "enter" : "Enter details \xB7 Esc close";
1131
+ } else if (view === "memory" && memoryTree.expandedNodes.has("patterns")) {
1132
+ hints = memoryTree.signalsViewAll ? narrow ? "a" : "a collapse" : narrow ? "a" : "a view all";
1123
1133
  } else if (view === "goals" && goalsPanel.goals.filter((g) => g.status === "achieved").length > 0 && goalsPanel.goals.filter((g) => g.status === "active").length === 0) {
1124
1134
  hints = narrow ? "U" : "U reactivate all achieved";
1125
1135
  } else {
@@ -1221,6 +1231,8 @@ function ConfigDialog({ onClose }) {
1221
1231
  const [cursorKeyDisplay, setCursorKeyDisplay] = useState("Not set");
1222
1232
  const [linearKeyDisplay, setLinearKeyDisplay] = useState("Not set");
1223
1233
  const [githubKeyDisplay, setGithubKeyDisplay] = useState("Not set");
1234
+ const [signingKeyStatus, setSigningKeyStatus] = useState({ hasKey: false, pubKey: null });
1235
+ const [generatingKey, setGeneratingKey] = useState(false);
1224
1236
  const config = state.agentConfig;
1225
1237
  React3.useEffect(() => {
1226
1238
  const loadApiKeys = async () => {
@@ -1242,6 +1254,14 @@ function ConfigDialog({ onClose }) {
1242
1254
  setLinearKeyDisplay("Not set");
1243
1255
  setGithubKeyDisplay("Not set");
1244
1256
  }
1257
+ try {
1258
+ const workDir = getWorkingDirectory(void 0, true);
1259
+ const hasKey = hasSigningKey(workDir);
1260
+ const pubKey = hasKey ? getPublicKey(workDir) : null;
1261
+ setSigningKeyStatus({ hasKey, pubKey });
1262
+ } catch {
1263
+ setSigningKeyStatus({ hasKey: false, pubKey: null });
1264
+ }
1245
1265
  };
1246
1266
  void loadApiKeys();
1247
1267
  }, []);
@@ -1282,6 +1302,7 @@ function ConfigDialog({ onClose }) {
1282
1302
  const keyActive = isAIAvailable();
1283
1303
  const mainMenu = [
1284
1304
  { label: "API Keys", key: "apiKeys", value: keyActive ? "Active" : "Not set", section: "main" },
1305
+ { label: "Signing Keys", key: "signingKeys", value: signingKeyStatus.hasKey ? "Active (Ed25519)" : "Not set", section: "main" },
1285
1306
  { label: "Codebase Index", key: "codebaseIndex", value: "Stats & Re-index", section: "main" },
1286
1307
  { label: "AI Watcher", key: "aiWatcher", value: config.aiWatcher.enabled ? `${(config.aiWatcher.hourlyTokenLimit / 1e3).toFixed(0)}k/hr` : "Off", section: "main" },
1287
1308
  { label: "Performance", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
@@ -1321,7 +1342,8 @@ function ConfigDialog({ onClose }) {
1321
1342
  { label: "Re-index Codebase", key: "reindex", value: "Rebuild full index", section: "codebaseIndex" },
1322
1343
  { label: "Clear Index", key: "clearIndex", value: "Delete index cache", section: "codebaseIndex" }
1323
1344
  ];
1324
- const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : section === "codebaseIndex" ? codebaseIndexItems : mainMenu;
1345
+ const signingKeysItems = signingKeyStatus.hasKey ? [{ label: "Regenerate Key", key: "regenerate", value: "WARNING: invalidates signatures", section: "signingKeys" }] : [{ label: "Generate Key", key: "generate", value: "Create Ed25519 signing key", section: "signingKeys" }];
1346
+ const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : section === "codebaseIndex" ? codebaseIndexItems : section === "signingKeys" ? signingKeysItems : mainMenu;
1325
1347
  useInput((_input, key) => {
1326
1348
  if (showConfirmClear) {
1327
1349
  if (_input === "y" || _input === "Y") {
@@ -1467,6 +1489,19 @@ function ConfigDialog({ onClose }) {
1467
1489
  dispatch({ type: "ADD_ACTIVITY", message: "Failed to clear index" });
1468
1490
  });
1469
1491
  }
1492
+ } else if (section === "signingKeys") {
1493
+ const item = items[selectedIndex];
1494
+ if (item && (item.key === "generate" || item.key === "regenerate")) {
1495
+ setGeneratingKey(true);
1496
+ generateSigningKey().then((pubKey) => {
1497
+ setSigningKeyStatus({ hasKey: true, pubKey });
1498
+ dispatch({ type: "ADD_ACTIVITY", message: "Ed25519 signing key generated" });
1499
+ setGeneratingKey(false);
1500
+ }).catch(() => {
1501
+ dispatch({ type: "ADD_ACTIVITY", message: "Failed to generate signing key" });
1502
+ setGeneratingKey(false);
1503
+ });
1504
+ }
1470
1505
  } else {
1471
1506
  const item = items[selectedIndex];
1472
1507
  if (item) {
@@ -1489,7 +1524,7 @@ function ConfigDialog({ onClose }) {
1489
1524
  }
1490
1525
  }
1491
1526
  });
1492
- const sectionTitle = section === "main" ? "Settings" : section === "apiKeys" ? "API Keys" : section === "aiWatcher" ? "AI Watcher" : section === "performance" ? "Performance" : section === "riskThresholds" ? "Risk Thresholds" : section === "memory" ? "Memory" : section === "codebaseIndex" ? "Codebase Index" : "Settings";
1527
+ const sectionTitle = section === "main" ? "Settings" : section === "apiKeys" ? "API Keys" : section === "aiWatcher" ? "AI Watcher" : section === "performance" ? "Performance" : section === "riskThresholds" ? "Risk Thresholds" : section === "memory" ? "Memory" : section === "codebaseIndex" ? "Codebase Index" : section === "signingKeys" ? "Ed25519 Signing Keys" : "Settings";
1493
1528
  async function clearMemory() {
1494
1529
  const workDir = getWorkingDirectory(void 0, true);
1495
1530
  const trieDir = getTrieDirectory(workDir);
@@ -1516,6 +1551,12 @@ function ConfigDialog({ onClose }) {
1516
1551
  await rm(indexFile, { force: true });
1517
1552
  }
1518
1553
  }
1554
+ async function generateSigningKey() {
1555
+ const workDir = getWorkingDirectory(void 0, true);
1556
+ const keyPair = await generateKeyPair();
1557
+ saveKeyPair(keyPair, workDir);
1558
+ return keyPair.publicKey;
1559
+ }
1519
1560
  async function reindexCodebase() {
1520
1561
  const workDir = getWorkingDirectory(void 0, true);
1521
1562
  const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-index-VAPF32XX.js");
@@ -1590,6 +1631,40 @@ function ConfigDialog({ onClose }) {
1590
1631
  }),
1591
1632
  indexing ? /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Re-indexing codebase..." }) }) : /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to execute \xB7 esc back" }) })
1592
1633
  ] }),
1634
+ !showConfirmClear && section === "signingKeys" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1635
+ /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Ed25519 Signing for Governance Ledger" }),
1636
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: signingKeyStatus.hasKey ? /* @__PURE__ */ jsx5(Fragment, { children: /* @__PURE__ */ jsxs4(Text4, { children: [
1637
+ " Status: ",
1638
+ /* @__PURE__ */ jsx5(Text4, { color: "green", children: "\u2713 Active" })
1639
+ ] }) }) : /* @__PURE__ */ jsxs4(Text4, { children: [
1640
+ " Status: ",
1641
+ /* @__PURE__ */ jsx5(Text4, { color: "yellow", children: "\u25CB Not configured" })
1642
+ ] }) }),
1643
+ signingKeyStatus.hasKey && signingKeyStatus.pubKey && /* @__PURE__ */ jsxs4(Text4, { children: [
1644
+ " Public key: ",
1645
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1646
+ signingKeyStatus.pubKey.slice(0, 16),
1647
+ "...",
1648
+ signingKeyStatus.pubKey.slice(-8)
1649
+ ] })
1650
+ ] }),
1651
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Signing provides:" }) }),
1652
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Authenticity - prove who created each entry" }),
1653
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Tamper-evidence - detect if entries are modified" }),
1654
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Accountability - track decisions to humans/agents" }),
1655
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: signingKeysItems.map((item, idx) => {
1656
+ const isSelected = selectedIndex === idx;
1657
+ return /* @__PURE__ */ jsxs4(Text4, { children: [
1658
+ isSelected ? /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "> " }) : " ",
1659
+ item.key === "regenerate" ? /* @__PURE__ */ jsx5(Text4, { bold: isSelected, color: "yellow", children: item.label }) : /* @__PURE__ */ jsx5(Text4, { bold: isSelected, children: item.label }),
1660
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1661
+ " ",
1662
+ item.value
1663
+ ] })
1664
+ ] }, item.key);
1665
+ }) }),
1666
+ generatingKey ? /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Generating key..." }) }) : /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to execute \xB7 esc back" }) })
1667
+ ] }),
1593
1668
  !showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1594
1669
  apiKeysItems.map((item, idx) => {
1595
1670
  const isSelected = selectedIndex === idx;
@@ -1619,7 +1694,7 @@ function ConfigDialog({ onClose }) {
1619
1694
  ] }) }),
1620
1695
  /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter save \xB7 esc cancel" })
1621
1696
  ] }),
1622
- !showConfirmClear && section !== "apiKeys" && section !== "memory" && section !== "codebaseIndex" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1697
+ !showConfirmClear && section !== "apiKeys" && section !== "memory" && section !== "codebaseIndex" && section !== "signingKeys" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1623
1698
  items.map((item, idx) => {
1624
1699
  const isSelected = selectedIndex === idx;
1625
1700
  return /* @__PURE__ */ jsxs4(Text4, { children: [
@@ -1985,7 +2060,7 @@ function AgentView() {
1985
2060
  const { getInsightStore: getInsightStore2 } = await import("./insight-store-EC4PLSAW.js");
1986
2061
  const store = getInsightStore2(workDir);
1987
2062
  await store.dismissInsight(insight.id);
1988
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
2063
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
1989
2064
  const storage = getStorage2(workDir);
1990
2065
  await storage.dismissNudge(insight.id).catch(() => {
1991
2066
  });
@@ -1997,7 +2072,7 @@ function AgentView() {
1997
2072
  const clearAllNudges = useCallback(async () => {
1998
2073
  try {
1999
2074
  const workDir = getWorkingDirectory(void 0, true);
2000
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
2075
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
2001
2076
  const storage = getStorage2(workDir);
2002
2077
  await storage.clearAllNudges();
2003
2078
  dispatch({ type: "CLEAR_ALL_INSIGHTS" });
@@ -2033,8 +2108,8 @@ function AgentView() {
2033
2108
  }
2034
2109
  await spawnClaudeCodeFixIssue({
2035
2110
  message: insight.message,
2036
- file,
2037
- suggestedAction: insight.suggestedAction,
2111
+ ...file !== void 0 && { file },
2112
+ ...insight.suggestedAction !== void 0 && { suggestedAction: insight.suggestedAction },
2038
2113
  cwd: workDir
2039
2114
  });
2040
2115
  const fileDisplay = file ? ` for ${file.split("/").pop()}` : "";
@@ -2371,7 +2446,7 @@ function GoalsView() {
2371
2446
  dispatch({ type: "SET_GOAL_SCANNING", goalId, progress: "Starting scan..." });
2372
2447
  dispatch({ type: "ADD_ACTIVITY", message: `Scanning goal: ${goalSummary.description}...` });
2373
2448
  dispatch({ type: "SET_GOAL_SCANNING", goalId, progress: "Loading goal configuration..." });
2374
- const { checkFilesForGoalViolations } = await import("./goal-validator-4DDL7NBP.js");
2449
+ const { checkFilesForGoalViolations } = await import("./goal-validator-6Y5CDEMJ.js");
2375
2450
  const agentState = getProjectState(workDir);
2376
2451
  await agentState.load();
2377
2452
  const fullGoal = agentState.getAllGoals().find((g) => g.id === goalId);
@@ -2646,7 +2721,7 @@ function HypothesesView() {
2646
2721
  dispatch({ type: "SET_HYPOTHESIS_SCANNING", hypothesisId: hypoId, progress: "Gathering evidence..." });
2647
2722
  dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement}` });
2648
2723
  dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
2649
- const { gatherEvidenceForHypothesis } = await import("./hypothesis-RI3Q33JB.js");
2724
+ const { gatherEvidenceForHypothesis } = await import("./hypothesis-UKPGOYY2.js");
2650
2725
  const evidence = await gatherEvidenceForHypothesis(hypoId, workDir, signal);
2651
2726
  scanAbortRef.current = null;
2652
2727
  dispatch({ type: "SET_HYPOTHESIS_SCANNING", hypothesisId: null, progress: "" });
@@ -2818,7 +2893,7 @@ function timeAgo2(iso) {
2818
2893
  function MemoryTreeView() {
2819
2894
  const { state, dispatch } = useDashboard();
2820
2895
  const { memoryTree } = state;
2821
- const { snapshot, globalPatterns, storageGovernance, storageFacts, storageGotchas, storageNudges, storageInsights, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded } = memoryTree;
2896
+ const { snapshot, globalPatterns, storageGovernance, storageFacts, storageGotchas, storageNudges, storageInsights, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded, signalsViewAll } = memoryTree;
2822
2897
  const { stdout } = useStdout8();
2823
2898
  const cols = stdout?.columns || 80;
2824
2899
  const narrow = cols < 60;
@@ -2884,6 +2959,10 @@ function MemoryTreeView() {
2884
2959
  dispatch({ type: "INVALIDATE_MEMORY_TREE" });
2885
2960
  return;
2886
2961
  }
2962
+ if (expandedNodes.has("patterns") && (_input === "a" || _input === "A")) {
2963
+ dispatch({ type: "TOGGLE_SIGNALS_VIEW_ALL" });
2964
+ return;
2965
+ }
2887
2966
  if (key.upArrow || _input === "k") dispatch({ type: "NAVIGATE_UP" });
2888
2967
  else if (key.downArrow || _input === "j") dispatch({ type: "NAVIGATE_DOWN" });
2889
2968
  else if (key.return) dispatch({ type: "TOGGLE_MEMORY_NODE", nodeId: selectedNode });
@@ -2925,7 +3004,7 @@ function MemoryTreeView() {
2925
3004
  const blockIndex = parseInt(expandedItemId.replace("ledger-block-", ""), 10);
2926
3005
  return ledgerBlocks[blockIndex] || null;
2927
3006
  })() : null;
2928
- function renderHeader(id, label, count, emptyHint) {
3007
+ function renderHeader(id, label, count, emptyHint, viewHint) {
2929
3008
  const expanded = expandedNodes.has(id);
2930
3009
  const isEmpty = count === 0;
2931
3010
  return /* @__PURE__ */ jsxs10(Text10, { children: [
@@ -2940,6 +3019,10 @@ function MemoryTreeView() {
2940
3019
  ] }) : isEmpty && emptyHint ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
2941
3020
  " ",
2942
3021
  emptyHint
3022
+ ] }) : null,
3023
+ count > 0 && viewHint ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3024
+ " ",
3025
+ viewHint
2943
3026
  ] }) : null
2944
3027
  ] });
2945
3028
  }
@@ -3038,7 +3121,40 @@ function MemoryTreeView() {
3038
3121
  ] }) })
3039
3122
  ] }),
3040
3123
  expandedLedgerBlock && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, borderStyle: "single", borderColor: "magenta", paddingX: 1, paddingY: 1, children: [
3041
- /* @__PURE__ */ jsx11(Text10, { bold: true, color: "magenta", children: "Ledger Block Details \xB7 d delete \xB7 Esc close" }),
3124
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: "magenta", children: "Ledger Block Details \xB7 Esc close" }),
3125
+ (() => {
3126
+ const syncBlock = expandedLedgerBlock;
3127
+ const blockAuthor = syncBlock.author;
3128
+ const gitCommit = syncBlock.gitCommit;
3129
+ const signedCount = expandedLedgerBlock.entries.filter((e) => e.signature).length;
3130
+ const totalEntries2 = expandedLedgerBlock.entries.length;
3131
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3132
+ blockAuthor ? /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3133
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Block author:" }),
3134
+ " ",
3135
+ /* @__PURE__ */ jsx11(Text10, { color: "cyan", children: blockAuthor }),
3136
+ " ",
3137
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "(person or agent who created block)" })
3138
+ ] }) }) : null,
3139
+ gitCommit ? /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3140
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Git commit:" }),
3141
+ " ",
3142
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: gitCommit.slice(0, 8) })
3143
+ ] }) }) : null,
3144
+ /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3145
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Ed25519 signatures:" }),
3146
+ " ",
3147
+ /* @__PURE__ */ jsxs10(Text10, { color: signedCount === totalEntries2 ? "green" : signedCount > 0 ? "yellow" : "dim", children: [
3148
+ signedCount,
3149
+ "/",
3150
+ totalEntries2,
3151
+ " signed"
3152
+ ] }),
3153
+ " ",
3154
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "(\u2713 = signed, \u25CB = unsigned)" })
3155
+ ] }) })
3156
+ ] });
3157
+ })(),
3042
3158
  (() => {
3043
3159
  const aiAgents = /* @__PURE__ */ new Set(["goal-violation", "claude", "agent", "ai"]);
3044
3160
  const hasAIAgents = expandedLedgerBlock.entries.some((e) => aiAgents.has(e.agent));
@@ -3105,6 +3221,35 @@ function MemoryTreeView() {
3105
3221
  ] }) })
3106
3222
  ] });
3107
3223
  })(),
3224
+ /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Entries (who made/changed what):" }) }),
3225
+ expandedLedgerBlock.entries.slice(0, 15).map((entry, idx) => {
3226
+ const sigIcon = entry.signature ? "\u2713" : "\u25CB";
3227
+ const sigColor = entry.signature ? "green" : "dim";
3228
+ const fileShort = entry.file.split("/").pop() || entry.file;
3229
+ const corrected = entry.status === "corrected" || entry.correctedBy;
3230
+ return /* @__PURE__ */ jsx11(Box10, { marginTop: 0, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3231
+ /* @__PURE__ */ jsx11(Text10, { color: sigColor, children: sigIcon }),
3232
+ " ",
3233
+ /* @__PURE__ */ jsx11(Text10, { ...entry.severity === "critical" ? { color: "red" } : entry.severity === "high" ? { color: "yellow" } : {}, children: entry.severity }),
3234
+ " ",
3235
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: fileShort }),
3236
+ " ",
3237
+ /* @__PURE__ */ jsxs10(Text10, { color: "cyan", children: [
3238
+ "by ",
3239
+ entry.agent
3240
+ ] }),
3241
+ entry.signedAt ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3242
+ " \xB7 signed ",
3243
+ timeAgo2(entry.signedAt)
3244
+ ] }) : null,
3245
+ corrected ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " \xB7 corrected" }) : null
3246
+ ] }) }, entry.id || idx);
3247
+ }),
3248
+ expandedLedgerBlock.entries.length > 15 && /* @__PURE__ */ jsx11(Box10, { marginTop: 0, children: /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3249
+ " \u2026 and ",
3250
+ expandedLedgerBlock.entries.length - 15,
3251
+ " more"
3252
+ ] }) }),
3108
3253
  /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3109
3254
  "Created: ",
3110
3255
  expandedLedgerBlock.createdAt
@@ -3183,15 +3328,20 @@ function MemoryTreeView() {
3183
3328
  ] })
3184
3329
  ] }, g.id);
3185
3330
  }),
3186
- renderHeader("patterns", "Learned Signals", (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length, (storageInsights?.length ?? 0) === 0 && learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && (storageNudges?.length ?? 0) === 0 && patternNodes.length === 0 ? "-- Trie learns as you work" : void 0),
3331
+ renderHeader("patterns", "Learned Signals", (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length, (storageInsights?.length ?? 0) === 0 && learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && (storageNudges?.length ?? 0) === 0 && patternNodes.length === 0 ? "-- Trie learns as you work" : void 0, (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length > 5 ? signalsViewAll ? "\xB7 a collapse" : "\xB7 a view all" : void 0),
3187
3332
  expandedNodes.has("patterns") && /* @__PURE__ */ jsxs10(Fragment6, { children: [
3333
+ signalsViewAll && /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3334
+ " ",
3335
+ " ",
3336
+ "Showing all \xB7 a to collapse"
3337
+ ] }),
3188
3338
  (storageInsights?.length ?? 0) > 0 && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
3189
3339
  /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3190
3340
  " ",
3191
3341
  " ",
3192
3342
  "Learnings"
3193
3343
  ] }),
3194
- storageInsights.slice(0, 5).map((insight) => {
3344
+ (signalsViewAll ? storageInsights : storageInsights.slice(0, 5)).map((insight) => {
3195
3345
  const descWidth = Math.max(30, contentWidth - 15);
3196
3346
  const desc = insight.message.length > descWidth ? insight.message.slice(0, descWidth - 3) + "..." : insight.message;
3197
3347
  const categoryLabel = insight.category === "security" ? "[sec]" : insight.category === "performance" ? "[perf]" : insight.category === "quality" ? "[qual]" : "[learn]";
@@ -3215,7 +3365,7 @@ function MemoryTreeView() {
3215
3365
  " ",
3216
3366
  (storageInsights?.length ?? 0) > 0 ? "Raw Detections" : "AI Detections"
3217
3367
  ] }),
3218
- storageNudges.slice(0, (storageInsights?.length ?? 0) > 0 ? 3 : 5).map((n) => {
3368
+ (signalsViewAll ? storageNudges : storageNudges.slice(0, (storageInsights?.length ?? 0) > 0 ? 3 : 5)).map((n) => {
3219
3369
  const descWidth = Math.max(30, contentWidth - 15);
3220
3370
  const desc = n.message.length > descWidth ? n.message.slice(0, descWidth - 3) + "..." : n.message;
3221
3371
  const severityColor = n.severity === "critical" ? "red" : n.severity === "high" ? "yellow" : "cyan";
@@ -3237,7 +3387,7 @@ function MemoryTreeView() {
3237
3387
  " ",
3238
3388
  "Governance"
3239
3389
  ] }),
3240
- learnedSignals.slice(0, 5).map((g) => {
3390
+ (signalsViewAll ? learnedSignals : learnedSignals.slice(0, 5)).map((g) => {
3241
3391
  const descWidth = Math.max(30, contentWidth - 15);
3242
3392
  const desc = g.decision.length > descWidth ? g.decision.slice(0, descWidth - 3) + "..." : g.decision;
3243
3393
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
@@ -3258,7 +3408,7 @@ function MemoryTreeView() {
3258
3408
  " ",
3259
3409
  "Facts"
3260
3410
  ] }),
3261
- storageFacts.slice(0, 5).map((f) => {
3411
+ (signalsViewAll ? storageFacts : storageFacts.slice(0, 5)).map((f) => {
3262
3412
  const descWidth = Math.max(30, contentWidth - 15);
3263
3413
  const desc = f.fact.length > descWidth ? f.fact.slice(0, descWidth - 3) + "..." : f.fact;
3264
3414
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
@@ -3279,7 +3429,7 @@ function MemoryTreeView() {
3279
3429
  " ",
3280
3430
  "Patterns"
3281
3431
  ] }),
3282
- patternNodes.slice(0, 10).map((n) => {
3432
+ (signalsViewAll ? patternNodes : patternNodes.slice(0, 10)).map((n) => {
3283
3433
  const nodeId = `pattern-${n.id}`;
3284
3434
  const conf = Math.round(n.data.confidence * 100);
3285
3435
  const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
@@ -3380,6 +3530,9 @@ function MemoryTreeView() {
3380
3530
  const topAgent = Object.keys(agentCounts).sort((a, b) => (agentCounts[b] ?? 0) - (agentCounts[a] ?? 0))[0];
3381
3531
  const blkShort = block.blockHash?.slice(0, 6) || "\u2014";
3382
3532
  const mkShort = block.merkleRoot?.slice(0, 6) || "\u2014";
3533
+ const signedCount = block.entries.filter((e) => e.signature).length;
3534
+ const allSigned = signedCount === block.entries.length && block.entries.length > 0;
3535
+ const blockAuthor = block.author;
3383
3536
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3384
3537
  sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
3385
3538
  " ",
@@ -3438,7 +3591,24 @@ function MemoryTreeView() {
3438
3591
  topAgent
3439
3592
  ] })
3440
3593
  ] }) : null,
3441
- sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " [Enter: details, d: delete]" }) : null
3594
+ !narrow && blockAuthor ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
3595
+ " ",
3596
+ /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3597
+ "\xB7 author: ",
3598
+ blockAuthor
3599
+ ] })
3600
+ ] }) : null,
3601
+ !narrow && block.entries.length > 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
3602
+ " ",
3603
+ allSigned ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "\u2713 Ed25519" }) : signedCount > 0 ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3604
+ "(",
3605
+ signedCount,
3606
+ "/",
3607
+ block.entries.length,
3608
+ " signed)"
3609
+ ] }) : null
3610
+ ] }) : null,
3611
+ sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " [Enter: details]" }) : null
3442
3612
  ] }, nodeId);
3443
3613
  })
3444
3614
  ] })
@@ -6432,7 +6602,7 @@ function getPendingFixes() {
6432
6602
  }
6433
6603
  async function loadPendingFixesFromMemory() {
6434
6604
  try {
6435
- const { getRecentIssues } = await import("./issue-store-DUR5UTYK.js");
6605
+ const { getRecentIssues } = await import("./issue-store-UZAPI5DU.js");
6436
6606
  pendingFixes.clear();
6437
6607
  const recentIssues = await getRecentIssues({ limit: 50, includeResolved: false });
6438
6608
  for (const storedIssue of recentIssues) {
@@ -6735,7 +6905,7 @@ var TrieCloudFixTool = class {
6735
6905
  if (pending.length === 0) {
6736
6906
  try {
6737
6907
  console.log("Loading issues from memory...");
6738
- const { getRecentIssues } = await import("./issue-store-DUR5UTYK.js");
6908
+ const { getRecentIssues } = await import("./issue-store-UZAPI5DU.js");
6739
6909
  const recentIssues = await getRecentIssues({ limit: 50, includeResolved: false });
6740
6910
  console.log(`Found ${recentIssues.length} recent issues in memory`);
6741
6911
  const memoryIssues = recentIssues.map((storedIssue) => ({
@@ -7033,8 +7203,8 @@ var TrieGetNudgesTool = class {
7033
7203
  const limit = input.limit ?? 20;
7034
7204
  const nudges = await storage.queryNudges({
7035
7205
  resolved: false,
7036
- severity: input.severity,
7037
- file: input.file,
7206
+ ...input.severity !== void 0 && { severity: input.severity },
7207
+ ...input.file !== void 0 && { file: input.file },
7038
7208
  limit
7039
7209
  });
7040
7210
  if (nudges.length === 0) {
@@ -7281,8 +7451,12 @@ var TrieQueryLedgerBlocksTool = class {
7281
7451
  output += "**Block summary:**\n";
7282
7452
  for (let i = 0; i < limited.length; i++) {
7283
7453
  const b = limited[i];
7454
+ const syncB = b;
7284
7455
  const critical = b.entries.filter((e) => e.severity === "critical").length;
7285
- output += ` Block ${blocks.length - limited.length + i + 1}: ${b.date} \u2014 ${b.entries.length} entries (${critical} critical)
7456
+ const signed = b.entries.filter((e) => e.signature).length;
7457
+ const authorPart = syncB.author ? ` \xB7 author: ${syncB.author}` : "";
7458
+ const sigPart = b.entries.length > 0 ? ` \xB7 ${signed}/${b.entries.length} Ed25519 signed` : "";
7459
+ output += ` Block ${blocks.length - limited.length + i + 1}: ${b.date} \u2014 ${b.entries.length} entries (${critical} critical)${authorPart}${sigPart}
7286
7460
  `;
7287
7461
  }
7288
7462
  output += "\n";
@@ -8586,7 +8760,7 @@ ${truncated}`;
8586
8760
  const goalId = input.goalId ? String(input.goalId).trim() : void 0;
8587
8761
  try {
8588
8762
  onProgress?.("Loading goals...");
8589
- const { getActiveGoals } = await import("./goal-validator-4DDL7NBP.js");
8763
+ const { getActiveGoals } = await import("./goal-validator-6Y5CDEMJ.js");
8590
8764
  const agentState = getProjectState(directory);
8591
8765
  await agentState.load();
8592
8766
  const allGoals = await getActiveGoals(directory);
@@ -8595,7 +8769,7 @@ ${truncated}`;
8595
8769
  return goalId ? `No active goal found with ID: ${goalId}` : "No active goals to check. Add goals in the Goals view first.";
8596
8770
  }
8597
8771
  onProgress?.("Scanning codebase for violations...");
8598
- const { analyzeFilesRapidly } = await import("./fast-analyzer-LLZ6FLP5.js");
8772
+ const { analyzeFilesRapidly } = await import("./fast-analyzer-NJQO3TFD.js");
8599
8773
  const analysisOptions = {
8600
8774
  maxFiles: 50,
8601
8775
  enableSmartBatching: true
@@ -8609,7 +8783,7 @@ ${truncated}`;
8609
8783
  const cacheInfo2 = analysisResult.cacheHitRatio > 0 ? ` (${Math.round(analysisResult.cacheHitRatio * 100)}% cache hit, ${analysisResult.timeMs}ms)` : ` (${analysisResult.timeMs}ms)`;
8610
8784
  return `\u2713 Scan complete! No violations found for ${goalsToCheck.length} goal(s).${cacheInfo2}`;
8611
8785
  }
8612
- const { storeIssues: storeIssues2 } = await import("./issue-store-DUR5UTYK.js");
8786
+ const { storeIssues: storeIssues2 } = await import("./issue-store-UZAPI5DU.js");
8613
8787
  const { basename: basename2 } = await import("path");
8614
8788
  const issuesToStore = violations.map((v, i) => ({
8615
8789
  id: `goal-violation-${Date.now()}-${i}`,
@@ -8688,7 +8862,7 @@ ${truncated}`;
8688
8862
  }
8689
8863
  try {
8690
8864
  onProgress?.("Gathering evidence for hypothesis...");
8691
- const { gatherEvidenceForHypothesis } = await import("./hypothesis-RI3Q33JB.js");
8865
+ const { gatherEvidenceForHypothesis } = await import("./hypothesis-UKPGOYY2.js");
8692
8866
  const evidence = await gatherEvidenceForHypothesis(hypothesisId, directory);
8693
8867
  if (evidence.length === 0) {
8694
8868
  return `No evidence found for this hypothesis yet. The codebase may not have enough data to validate it \u2014 try running trie_scan_for_goal_violations first to populate issues, or add more context.`;
@@ -8778,6 +8952,23 @@ async function buildContext(workDir, dashboardState) {
8778
8952
  } catch (error) {
8779
8953
  console.error("Failed to load project state:", error);
8780
8954
  }
8955
+ try {
8956
+ const { getLedgerBlocks: getLedgerBlocks2 } = await import("./ledger-CNFCJKHX.js");
8957
+ const blocks = await getLedgerBlocks2(workDir);
8958
+ const allEntries = blocks.flatMap((b) => b.entries);
8959
+ const recentEntries = allEntries.filter((e) => e.status !== "false-positive" && e.issue).slice(-20);
8960
+ if (recentEntries.length > 0) {
8961
+ parts.push("Recent issues from ledger (learn from these patterns):\n" + recentEntries.map((e) => {
8962
+ const severity = e.severity === "critical" ? "\u{1F534}" : e.severity === "high" ? "\u{1F7E0}" : e.severity === "moderate" ? "\u{1F7E1}" : "\u{1F535}";
8963
+ const file = e.file.split("/").pop() || e.file;
8964
+ const issue = e.issue || "No description";
8965
+ const fix = e.fix ? ` \u2192 Fix: ${e.fix}` : "";
8966
+ return ` ${severity} [${file}] ${issue}${fix}`;
8967
+ }).join("\n"));
8968
+ }
8969
+ } catch (error) {
8970
+ console.error("Failed to load ledger entries:", error);
8971
+ }
8781
8972
  try {
8782
8973
  const storage = new TieredStorage(workDir);
8783
8974
  try {
@@ -8863,6 +9054,11 @@ var SYSTEM_PROMPT = `You are Trie, a code assistant embedded in a terminal TUI.
8863
9054
  - Run AI-powered scans to detect goal violations across the entire codebase
8864
9055
  - Save work checkpoints
8865
9056
 
9057
+ **AUTONOMOUS AWARENESS:**
9058
+ - The project context includes "Recent issues from ledger" \u2014 these are patterns you should AVOID in new code
9059
+ - Learn from past mistakes: If you see repeated issues in the ledger, proactively suggest preventive measures
9060
+ - When coding or reviewing code, check if similar issues appear in the ledger history
9061
+
8866
9062
  **IMPORTANT - Finding Code Issues:**
8867
9063
  - You have a trie_scan_for_goal_violations tool - use this to scan the codebase for goal violations
8868
9064
  - This is the BEST way to find emojis, TODOs, or other patterns that violate goals
@@ -8874,7 +9070,7 @@ var SYSTEM_PROMPT = `You are Trie, a code assistant embedded in a terminal TUI.
8874
9070
  - **Blockers** = Things preventing progress (from governance). Use trie_get_blockers when user asks about "blockers" or "what's blocking me".
8875
9071
 
8876
9072
  **When user asks "what are my goals", "show hypotheses", "any nudges", "latest decisions", etc.:**
8877
- - The project context block already includes goals, hypotheses, nudges, decisions, blockers
9073
+ - The project context block already includes goals, hypotheses, nudges, decisions, blockers, and recent ledger entries
8878
9074
  - If the user wants more detail or the context seems stale: Call trie_query_context with the relevant query (e.g. query: "goals", type: "goals")
8879
9075
  - trie_query_context returns goals, hypotheses, nudges, decisions, and blockers \u2014 use it for any "what do I have" questions
8880
9076
 
@@ -9627,7 +9823,7 @@ ${content}
9627
9823
  fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
9628
9824
  }
9629
9825
  await writeFile2(fullPath, fixedContent, "utf-8");
9630
- const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-4DDL7NBP.js");
9826
+ const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-6Y5CDEMJ.js");
9631
9827
  const goals = await getActiveGoals(projectPath);
9632
9828
  const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
9633
9829
  if (matchedGoal) {
@@ -9743,7 +9939,7 @@ function DashboardApp({ onReady }) {
9743
9939
  const loadPersistedNudges = useCallback7(async () => {
9744
9940
  try {
9745
9941
  const workDir = getWorkingDirectory(void 0, true);
9746
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
9942
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
9747
9943
  const storage = getStorage2(workDir);
9748
9944
  await storage.initialize();
9749
9945
  const nudges = await storage.queryNudges({ resolved: false, limit: 50 });
@@ -10372,6 +10568,7 @@ var TrieWatchTool = class _TrieWatchTool {
10372
10568
  try {
10373
10569
  const storage = getStorage(directory);
10374
10570
  await storage.initialize();
10571
+ await this.validateAndCleanNudges(storage, directory);
10375
10572
  const unresolvedNudges = await storage.queryNudges({ resolved: false });
10376
10573
  console.debug(`[Watch] Found ${unresolvedNudges.length} unresolved nudges in storage`);
10377
10574
  for (const nudge of unresolvedNudges) {
@@ -10739,7 +10936,7 @@ ${f.content.slice(0, 1e3)}`
10739
10936
  async checkAndGenerateHypotheses(projectPath) {
10740
10937
  if (!isAIAvailable()) return;
10741
10938
  try {
10742
- const { getHypothesisEngine } = await import("./hypothesis-RI3Q33JB.js");
10939
+ const { getHypothesisEngine } = await import("./hypothesis-UKPGOYY2.js");
10743
10940
  const { getOutputManager: getOutputManager2 } = await import("./output-manager-JNMEAXFO.js");
10744
10941
  const hypothesisEngine = getHypothesisEngine(projectPath);
10745
10942
  const recentIssues = Array.from(this.state.issueCache.values()).flat();
@@ -10804,7 +11001,7 @@ ${f.content.slice(0, 1e3)}`
10804
11001
  */
10805
11002
  async discoverPatternsFromIssues(projectPath) {
10806
11003
  try {
10807
- const { searchIssues } = await import("./issue-store-DUR5UTYK.js");
11004
+ const { searchIssues } = await import("./issue-store-UZAPI5DU.js");
10808
11005
  const allIssues = await searchIssues("", {
10809
11006
  workDir: projectPath,
10810
11007
  limit: 1e3,
@@ -10879,7 +11076,7 @@ ${f.content.slice(0, 1e3)}`
10879
11076
  }
10880
11077
  }
10881
11078
  if (patternsAdded > 0) {
10882
- const { exportToJson: exportToJson2 } = await import("./graph-B3NA4S7I.js");
11079
+ const { exportToJson: exportToJson2 } = await import("./sync-M2FSWPBC.js");
10883
11080
  await exportToJson2(graph);
10884
11081
  if (!isInteractiveMode()) {
10885
11082
  console.error(` [\u2713] Discovered ${patternsAdded} pattern(s) from ${allIssues.length} issues`);
@@ -10965,7 +11162,7 @@ ${f.content.slice(0, 1e3)}`
10965
11162
  if (remaining < 500) return;
10966
11163
  try {
10967
11164
  const graph = new ContextGraph(projectPath);
10968
- const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-4DDL7NBP.js");
11165
+ const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-6Y5CDEMJ.js");
10969
11166
  console.debug("[AI Watcher] Loading active goals...");
10970
11167
  const activeGoals = await getActiveGoals(projectPath);
10971
11168
  const hasGoals = activeGoals.length > 0;
@@ -11220,7 +11417,7 @@ ${filesBlock}`,
11220
11417
  const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
11221
11418
  console.debug("[Initial Hypothesis] Starting initial hypothesis generation", { projectPath });
11222
11419
  try {
11223
- const { getHypothesisEngine } = await import("./hypothesis-RI3Q33JB.js");
11420
+ const { getHypothesisEngine } = await import("./hypothesis-UKPGOYY2.js");
11224
11421
  const hypothesisEngine = getHypothesisEngine(projectPath);
11225
11422
  console.debug("[Initial Hypothesis] Running AI-powered hypothesis generation...");
11226
11423
  const generated = await hypothesisEngine.generateHypothesesWithAI({
@@ -11278,7 +11475,7 @@ ${filesBlock}`,
11278
11475
  const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
11279
11476
  console.debug("[Initial Scan] Starting initial goal compliance scan", { projectPath });
11280
11477
  try {
11281
- const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-4DDL7NBP.js");
11478
+ const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-6Y5CDEMJ.js");
11282
11479
  const activeGoals = await getActiveGoals(projectPath);
11283
11480
  console.debug("[Initial Scan] Loaded goals for initial scan:", {
11284
11481
  goalCount: activeGoals.length,
@@ -11421,9 +11618,9 @@ ${filesBlock}`,
11421
11618
  this.streamingManager.reportLedgerUpdate(issuesToStore.length, "goal-violation");
11422
11619
  }
11423
11620
  }
11424
- const { resolveGoalViolation } = await import("./issue-store-DUR5UTYK.js");
11425
- const { recordGoalViolationFixed } = await import("./goal-validator-4DDL7NBP.js");
11426
- const scannedFiles = new Set(issues.map((i) => i.file));
11621
+ const { resolveGoalViolation } = await import("./issue-store-UZAPI5DU.js");
11622
+ const { recordGoalViolationFixed } = await import("./goal-validator-6Y5CDEMJ.js");
11623
+ const scannedFiles = new Set(valid.map((f) => f.path));
11427
11624
  const filesWithViolations = new Set(issuesToStore.map((i) => i.file));
11428
11625
  for (const scannedFile of scannedFiles) {
11429
11626
  if (!filesWithViolations.has(scannedFile)) {
@@ -11575,7 +11772,7 @@ Use \`trie_watch start\` to begin autonomous scanning.`
11575
11772
  ).join("\n");
11576
11773
  let agencyStatus = "";
11577
11774
  try {
11578
- const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-NYSPGZYS.js");
11775
+ const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-6SWUHCVO.js");
11579
11776
  const trieAgent = getTrieAgent2(this.watchedDirectory || getWorkingDirectory(void 0, true));
11580
11777
  await trieAgent.initialize();
11581
11778
  const status = await trieAgent.getAgencyStatus();
@@ -11724,6 +11921,53 @@ To get a full report, run \`trie watch\` on your codebase.`
11724
11921
  }]
11725
11922
  };
11726
11923
  }
11924
+ /**
11925
+ * Validate existing nudges and resolve ones that are no longer valid.
11926
+ * This runs at watch startup to clean up stale nudges.
11927
+ *
11928
+ * Type-agnostic auto-resolution strategy:
11929
+ * 1. Files that no longer exist -> resolve immediately
11930
+ * 2. Goals that are achieved/deleted -> resolve immediately
11931
+ * 3. All other nudges -> kept until next scan shows the file is clean
11932
+ *
11933
+ * The actual goal validation happens during scans - when a file is scanned
11934
+ * and no violations are found, existing nudges for that file are auto-resolved.
11935
+ */
11936
+ async validateAndCleanNudges(storage, directory) {
11937
+ let totalResolved = 0;
11938
+ try {
11939
+ const missingResolved = await storage.resolveNudgesForMissingFiles();
11940
+ if (missingResolved > 0) {
11941
+ totalResolved += missingResolved;
11942
+ console.log(`[Watch] Resolved ${missingResolved} nudge(s) for deleted files`);
11943
+ }
11944
+ } catch (e) {
11945
+ console.debug("[Watch] resolveNudgesForMissingFiles failed:", e);
11946
+ }
11947
+ try {
11948
+ const { getActiveGoals } = await import("./goal-validator-6Y5CDEMJ.js");
11949
+ const { getProjectState: getProjectState2 } = await import("./project-state-AHPA77SM.js");
11950
+ const projectState = getProjectState2(directory);
11951
+ await projectState.load();
11952
+ const allGoals = projectState.getAllGoals();
11953
+ const activeGoals = await getActiveGoals(directory);
11954
+ const activeGoalIds = new Set(activeGoals.map((g) => g.id));
11955
+ for (const goal of allGoals) {
11956
+ if (goal.status === "achieved" || !activeGoalIds.has(goal.id)) {
11957
+ const goalResolved = await storage.resolveNudgesForGoal(goal.description);
11958
+ if (goalResolved > 0) {
11959
+ totalResolved += goalResolved;
11960
+ console.log(`[Watch] Resolved ${goalResolved} nudge(s) for ${goal.status === "achieved" ? "achieved" : "inactive"} goal: "${goal.description.slice(0, 40)}..."`);
11961
+ }
11962
+ }
11963
+ }
11964
+ } catch (e) {
11965
+ console.debug("[Watch] Goal validation check failed:", e);
11966
+ }
11967
+ if (totalResolved > 0) {
11968
+ console.log(`[Watch] \u2713 Cleaned up ${totalResolved} stale nudge(s)`);
11969
+ }
11970
+ }
11727
11971
  };
11728
11972
 
11729
11973
  export {
@@ -11750,4 +11994,4 @@ export {
11750
11994
  InteractiveDashboard,
11751
11995
  TrieWatchTool
11752
11996
  };
11753
- //# sourceMappingURL=chunk-D6E4Q4I6.js.map
11997
+ //# sourceMappingURL=chunk-HOGKPDZA.js.map