@triedotdev/mcp 1.0.158 → 1.0.162

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JVMBCWKS.js";
4
4
  import {
5
5
  getTrieAgent
6
- } from "./chunk-UAQXKEMS.js";
6
+ } from "./chunk-ERMLZJTK.js";
7
7
  import {
8
8
  CodebaseIndex
9
9
  } from "./chunk-Q5EKA5YA.js";
@@ -30,11 +30,11 @@ import {
30
30
  } from "./chunk-TN5WEKWI.js";
31
31
  import {
32
32
  findCrossProjectPatterns
33
- } from "./chunk-E2DRW5XC.js";
33
+ } from "./chunk-HFVPHQL3.js";
34
34
  import {
35
35
  TieredStorage,
36
36
  getStorage
37
- } from "./chunk-IW7VZ2XD.js";
37
+ } from "./chunk-LLDZDU2Y.js";
38
38
  import {
39
39
  ContextGraph
40
40
  } from "./chunk-VUL52BQL.js";
@@ -457,6 +457,7 @@ function handleStreamUpdate(state, update) {
457
457
  const total = (update.data.governance || 0) + (update.data.facts || 0) + (update.data.blockers || 0) + (update.data.questions || 0);
458
458
  if (total > 0) {
459
459
  s = addActivity(s, `[+] Extracted ${total} signals (${update.data.governance}g, ${update.data.facts}f, ${update.data.blockers}b)`);
460
+ s.memoryTree = { ...s.memoryTree, loaded: false };
460
461
  }
461
462
  break;
462
463
  }
@@ -653,6 +654,21 @@ function dashboardReducer(state, action) {
653
654
  s = addActivity(s, `Cleared ${dismissedCount} dismissed insight${dismissedCount !== 1 ? "s" : ""}`);
654
655
  return s;
655
656
  }
657
+ case "CLEAR_ALL_INSIGHTS": {
658
+ const totalCount = state.agentInsights.filter((i) => !i.dismissed).length;
659
+ if (totalCount === 0) return addActivity(state, "No insights to clear");
660
+ const dismissed = state.agentInsights.map((i) => ({ ...i, dismissed: true }));
661
+ let s = {
662
+ ...state,
663
+ agentInsights: dismissed,
664
+ selectedInsight: 0,
665
+ expandedInsight: null,
666
+ unreadNudgesCount: 0,
667
+ scrollPositions: { ...state.scrollPositions, agent: 0 }
668
+ };
669
+ s = addActivity(s, `Cleared ${totalCount} nudge${totalCount !== 1 ? "s" : ""}`);
670
+ return s;
671
+ }
656
672
  case "SET_GOALS":
657
673
  return { ...state, goalsPanel: { ...state.goalsPanel, goals: action.goals } };
658
674
  case "SET_GOALS_INPUT_MODE":
@@ -676,6 +692,7 @@ function dashboardReducer(state, action) {
676
692
  case "SET_MEMORY_TREE": {
677
693
  const blocks = action.ledgerBlocks ?? state.memoryTree.ledgerBlocks;
678
694
  const gotchas = action.storageGotchas ?? state.memoryTree.storageGotchas;
695
+ const facts = action.storageFacts ?? state.memoryTree.storageFacts;
679
696
  const expanded = new Set(state.memoryTree.expandedNodes);
680
697
  if (blocks.length > 0) expanded.add("ledger-chain");
681
698
  if (gotchas.length > 0) expanded.add("gotchas");
@@ -687,6 +704,7 @@ function dashboardReducer(state, action) {
687
704
  snapshot: action.snapshot,
688
705
  globalPatterns: action.patterns,
689
706
  storageGovernance: action.storageGovernance ?? state.memoryTree.storageGovernance,
707
+ storageFacts: facts,
690
708
  storageGotchas: gotchas,
691
709
  ledgerBlocks: blocks,
692
710
  expandedNodes: expanded
@@ -952,7 +970,7 @@ function createInitialState() {
952
970
  },
953
971
  goalsPanel: { goals: [], selectedIndex: 0, selectedAchievedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningGoalId: null, scanningProgress: "" },
954
972
  hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningHypothesisId: null, scanningProgress: "" },
955
- memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageGotchas: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
973
+ memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageFacts: [], storageGotchas: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
956
974
  agentBrain: { loaded: false, governance: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
957
975
  chatState: { messages: [], inputBuffer: "", loading: false, progress: null, messageQueue: [], currentSessionId: null, currentSessionTitle: null },
958
976
  chatArchivePanel: { sessions: [], selectedIndex: 0, showArchived: false, loading: false, inputMode: "browse", inputBuffer: "" },
@@ -1156,10 +1174,27 @@ function Notification() {
1156
1174
  if (!notification || !notification.active) return null;
1157
1175
  if (notification.autoHideAt && Date.now() > notification.autoHideAt) return null;
1158
1176
  const color = notification.severity === "critical" ? "red" : notification.severity === "warning" ? "yellow" : "blue";
1159
- return /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, children: [
1160
- /* @__PURE__ */ jsx4(Text3, { color, bold: true, children: "\u25CF " }),
1161
- /* @__PURE__ */ jsx4(Text3, { wrap: "wrap", children: notification.message })
1162
- ] });
1177
+ const borderColor = notification.severity === "critical" ? "red" : notification.severity === "warning" ? "yellow" : "blue";
1178
+ return /* @__PURE__ */ jsx4(Box3, { marginY: 1, marginX: 1, children: /* @__PURE__ */ jsxs3(
1179
+ Box3,
1180
+ {
1181
+ borderStyle: "single",
1182
+ borderColor,
1183
+ paddingX: 2,
1184
+ paddingY: 1,
1185
+ flexDirection: "column",
1186
+ children: [
1187
+ /* @__PURE__ */ jsxs3(Text3, { wrap: "wrap", children: [
1188
+ /* @__PURE__ */ jsx4(Text3, { color, bold: true, children: "\u25CF " }),
1189
+ notification.message
1190
+ ] }),
1191
+ notification.file && /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
1192
+ " \u2192 ",
1193
+ notification.file
1194
+ ] })
1195
+ ]
1196
+ }
1197
+ ) });
1163
1198
  }
1164
1199
 
1165
1200
  // src/cli/dashboard/components/ConfigDialog.tsx
@@ -1625,8 +1660,9 @@ var VIEW_HELP = {
1625
1660
  { key: "j / \u2193", description: "Move down" },
1626
1661
  { key: "k / \u2191", description: "Move up" },
1627
1662
  { key: "enter", description: "Fix goal violation (or expand if not a violation)" },
1628
- { key: "f", description: "Force spawn Claude Code fix" },
1663
+ { key: "f", description: "Force spawn Claude Code to fix any nudge" },
1629
1664
  { key: "d", description: "Dismiss selected nudge" },
1665
+ { key: "c", description: "Clear all nudges" },
1630
1666
  { key: "tab", description: "Navigate between views" },
1631
1667
  { key: "s", description: "Open Settings" },
1632
1668
  { key: "q / esc", description: "Quit" }
@@ -1950,7 +1986,7 @@ function AgentView() {
1950
1986
  const { getInsightStore } = await import("./insight-store-EC4PLSAW.js");
1951
1987
  const store = getInsightStore(workDir);
1952
1988
  await store.dismissInsight(insight.id);
1953
- const { getStorage: getStorage2 } = await import("./tiered-storage-WWVVHGFR.js");
1989
+ const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
1954
1990
  const storage = getStorage2(workDir);
1955
1991
  await storage.dismissNudge(insight.id).catch(() => {
1956
1992
  });
@@ -1959,26 +1995,52 @@ function AgentView() {
1959
1995
  }
1960
1996
  dispatch({ type: "DISMISS_INSIGHT", index: selectedInsight });
1961
1997
  }, [selectedInsight, state, dispatch]);
1998
+ const clearAllNudges = useCallback(async () => {
1999
+ try {
2000
+ const workDir = getWorkingDirectory(void 0, true);
2001
+ const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
2002
+ const storage = getStorage2(workDir);
2003
+ await storage.clearAllNudges();
2004
+ dispatch({ type: "CLEAR_ALL_INSIGHTS" });
2005
+ dispatch({ type: "ADD_ACTIVITY", message: "Cleared all nudges" });
2006
+ } catch (error) {
2007
+ console.error("Failed to clear nudges:", error);
2008
+ dispatch({ type: "ADD_ACTIVITY", message: "Failed to clear nudges" });
2009
+ }
2010
+ }, [dispatch]);
1962
2011
  const spawnFixForInsight = useCallback(async () => {
1963
2012
  const visible = getVisibleInsights(state);
1964
2013
  const insight = visible[selectedInsight];
1965
2014
  if (!insight) return;
1966
- const parsed = parseGoalViolation(insight.message);
1967
- if (!parsed) {
1968
- dispatch({ type: "ADD_ACTIVITY", message: "Selected nudge is not a goal violation (cannot fix)" });
1969
- return;
1970
- }
1971
2015
  const workDir = getWorkingDirectory(void 0, true);
2016
+ const parsed = parseGoalViolation(insight.message);
1972
2017
  try {
1973
- const { spawnClaudeCodeFix } = await import("./terminal-spawn-P5M5PHAV.js");
1974
- await spawnClaudeCodeFix({
1975
- file: parsed.file,
1976
- goal: parsed.goal,
1977
- violation: parsed.violation,
1978
- ...insight.suggestedAction ? { suggestedFix: insight.suggestedAction } : {},
1979
- cwd: workDir
1980
- });
1981
- dispatch({ type: "ADD_ACTIVITY", message: `Spawned Claude Code to fix ${parsed.file}` });
2018
+ if (parsed) {
2019
+ const { spawnClaudeCodeFix } = await import("./terminal-spawn-5YXDMUCF.js");
2020
+ await spawnClaudeCodeFix({
2021
+ file: parsed.file,
2022
+ goal: parsed.goal,
2023
+ violation: parsed.violation,
2024
+ ...insight.suggestedAction ? { suggestedFix: insight.suggestedAction } : {},
2025
+ cwd: workDir
2026
+ });
2027
+ dispatch({ type: "ADD_ACTIVITY", message: `Spawned Claude Code to fix ${parsed.file}` });
2028
+ } else {
2029
+ const { spawnClaudeCodeFixIssue } = await import("./terminal-spawn-5YXDMUCF.js");
2030
+ let file;
2031
+ const fileMatch = insight.message.match(/(?:in|file|at)\s+([^\s:]+\.(?:ts|js|tsx|jsx|py|java|go|rs|cpp|c|h))/i);
2032
+ if (fileMatch) {
2033
+ file = fileMatch[1];
2034
+ }
2035
+ await spawnClaudeCodeFixIssue({
2036
+ message: insight.message,
2037
+ file,
2038
+ suggestedAction: insight.suggestedAction,
2039
+ cwd: workDir
2040
+ });
2041
+ const fileDisplay = file ? ` for ${file.split("/").pop()}` : "";
2042
+ dispatch({ type: "ADD_ACTIVITY", message: `Spawned Claude Code to fix issue${fileDisplay}` });
2043
+ }
1982
2044
  } catch (error) {
1983
2045
  const msg = error instanceof Error ? error.message : "Unknown error";
1984
2046
  dispatch({ type: "ADD_ACTIVITY", message: `Fix spawn failed: ${msg}` });
@@ -2000,6 +2062,7 @@ function AgentView() {
2000
2062
  }
2001
2063
  } else if (input === "d") void dismissInsight();
2002
2064
  else if (input === "f") void spawnFixForInsight();
2065
+ else if (input === "c") void clearAllNudges();
2003
2066
  });
2004
2067
  const alertCount = alerts.length;
2005
2068
  const decCount = decisions.length;
@@ -2756,7 +2819,7 @@ function timeAgo2(iso) {
2756
2819
  function MemoryTreeView() {
2757
2820
  const { state, dispatch } = useDashboard();
2758
2821
  const { memoryTree } = state;
2759
- const { snapshot, globalPatterns, storageGovernance, storageGotchas, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded } = memoryTree;
2822
+ const { snapshot, globalPatterns, storageGovernance, storageFacts, storageGotchas, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded } = memoryTree;
2760
2823
  const { stdout } = useStdout8();
2761
2824
  const cols = stdout?.columns || 80;
2762
2825
  const narrow = cols < 60;
@@ -2766,14 +2829,15 @@ function MemoryTreeView() {
2766
2829
  const workDir = getWorkingDirectory(void 0, true);
2767
2830
  const graph = new ContextGraph(workDir);
2768
2831
  const storage = new TieredStorage(workDir);
2769
- const [snap, patterns, governance2, gotchas, blocks] = await Promise.all([
2832
+ const [snap, patterns, governance2, facts, gotchas, blocks] = await Promise.all([
2770
2833
  graph.getSnapshot(),
2771
2834
  findCrossProjectPatterns(2),
2772
2835
  storage.queryGovernance({ limit: 20 }).catch(() => []),
2836
+ storage.queryFacts({ limit: 20 }).catch(() => []),
2773
2837
  storage.queryGotchas({ limit: 20, resolved: false }).catch(() => []),
2774
2838
  getLedgerBlocks(workDir).catch(() => [])
2775
2839
  ]);
2776
- dispatch({ type: "SET_MEMORY_TREE", snapshot: snap, patterns, storageGovernance: governance2, storageGotchas: gotchas, ledgerBlocks: blocks });
2840
+ dispatch({ type: "SET_MEMORY_TREE", snapshot: snap, patterns, storageGovernance: governance2, storageFacts: facts, storageGotchas: gotchas, ledgerBlocks: blocks });
2777
2841
  } catch (err) {
2778
2842
  dispatch({ type: "ADD_ACTIVITY", message: "Context graph load error" });
2779
2843
  }
@@ -2844,11 +2908,13 @@ function MemoryTreeView() {
2844
2908
  ...n.data.reasoning != null ? { reasoning: n.data.reasoning } : {},
2845
2909
  ...n.data.outcome != null ? { outcome: n.data.outcome } : {}
2846
2910
  }));
2911
+ const productGovernance = governance.filter((g) => g.who === "user");
2912
+ const learnedSignals = governance.filter((g) => g.who !== "user");
2847
2913
  const hotspots = fileNodes.filter((n) => n.data.riskLevel === "critical" || n.data.riskLevel === "high").sort((a, b) => {
2848
2914
  const order = { critical: 0, high: 1 };
2849
2915
  return (order[a.data.riskLevel] ?? 2) - (order[b.data.riskLevel] ?? 2);
2850
2916
  });
2851
- const totalEntries = governance.length + incidentNodes.length + patternNodes.length + globalPatterns.length + hotspots.length + ledgerBlocks.length;
2917
+ const totalEntries = productGovernance.length + learnedSignals.length + (storageFacts?.length ?? 0) + incidentNodes.length + patternNodes.length + globalPatterns.length + hotspots.length + ledgerBlocks.length;
2852
2918
  const expandedGovernance = expandedItemId?.startsWith("decision-") ? governance.find((g) => `decision-${g.id}` === expandedItemId) : null;
2853
2919
  const expandedIncident = expandedItemId?.startsWith("incident-") ? incidentNodes.find((n) => `incident-${n.id}` === expandedItemId) : null;
2854
2920
  const expandedGotcha = expandedItemId?.startsWith("gotcha-") ? storageGotchas.find((g) => `gotcha-${g.id}` === expandedItemId) ?? null : null;
@@ -3042,8 +3108,8 @@ function MemoryTreeView() {
3042
3108
  ] }) })
3043
3109
  ] }),
3044
3110
  /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
3045
- renderHeader("decisions", "Product Governance", governance.length, "-- use trie tell or chat"),
3046
- expandedNodes.has("decisions") && governance.slice(0, 10).map((g) => {
3111
+ renderHeader("decisions", "Product Governance", productGovernance.length, "-- use trie tell or chat"),
3112
+ expandedNodes.has("decisions") && productGovernance.slice(0, 10).map((g) => {
3047
3113
  const nodeId = `decision-${g.id}`;
3048
3114
  const decWidth = Math.max(30, contentWidth - 25);
3049
3115
  const dec = g.decision.length > decWidth ? g.decision.slice(0, decWidth - 3) + "..." : g.decision;
@@ -3114,31 +3180,88 @@ function MemoryTreeView() {
3114
3180
  ] })
3115
3181
  ] }, g.id);
3116
3182
  }),
3117
- renderHeader("patterns", "Learned Patterns", patternNodes.length, "-- Trie learns as you work"),
3118
- expandedNodes.has("patterns") && patternNodes.slice(0, 10).map((n) => {
3119
- const nodeId = `pattern-${n.id}`;
3120
- const conf = Math.round(n.data.confidence * 100);
3121
- const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
3122
- const descWidth = Math.max(30, contentWidth - 15);
3123
- const desc = n.data.description.length > descWidth ? n.data.description.slice(0, descWidth - 3) + "..." : n.data.description;
3124
- return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3125
- sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
3183
+ renderHeader("patterns", "Learned Signals", learnedSignals.length + (storageFacts?.length ?? 0) + patternNodes.length, learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && patternNodes.length === 0 ? "-- Trie learns as you work" : void 0),
3184
+ expandedNodes.has("patterns") && /* @__PURE__ */ jsxs10(Fragment6, { children: [
3185
+ learnedSignals.length > 0 && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
3186
+ /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3187
+ " ",
3188
+ " ",
3189
+ "Governance"
3190
+ ] }),
3191
+ learnedSignals.slice(0, 5).map((g) => {
3192
+ const descWidth = Math.max(30, contentWidth - 15);
3193
+ const desc = g.decision.length > descWidth ? g.decision.slice(0, descWidth - 3) + "..." : g.decision;
3194
+ return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3195
+ " ",
3196
+ /* @__PURE__ */ jsx11(Text10, { color: "cyan", children: "\u25CB" }),
3197
+ " ",
3198
+ /* @__PURE__ */ jsx11(Text10, { children: desc }),
3199
+ narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3200
+ " ",
3201
+ timeAgo2(g.when ?? "")
3202
+ ] })
3203
+ ] }, g.id);
3204
+ })
3205
+ ] }),
3206
+ (storageFacts?.length ?? 0) > 0 && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: learnedSignals.length > 0 ? 1 : 0, children: [
3207
+ /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3208
+ " ",
3209
+ " ",
3210
+ "Facts"
3211
+ ] }),
3212
+ storageFacts.slice(0, 5).map((f) => {
3213
+ const descWidth = Math.max(30, contentWidth - 15);
3214
+ const desc = f.fact.length > descWidth ? f.fact.slice(0, descWidth - 3) + "..." : f.fact;
3215
+ return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3216
+ " ",
3217
+ /* @__PURE__ */ jsx11(Text10, { color: "green", children: "\u25CB" }),
3218
+ " ",
3219
+ /* @__PURE__ */ jsx11(Text10, { children: desc }),
3220
+ narrow ? null : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3221
+ " ",
3222
+ timeAgo2(f.when)
3223
+ ] })
3224
+ ] }, f.id);
3225
+ })
3226
+ ] }),
3227
+ patternNodes.length > 0 && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: learnedSignals.length > 0 || (storageFacts?.length ?? 0) > 0 ? 1 : 0, children: [
3228
+ (learnedSignals.length > 0 || (storageFacts?.length ?? 0) > 0) && /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3229
+ " ",
3230
+ " ",
3231
+ "Patterns"
3232
+ ] }),
3233
+ patternNodes.slice(0, 10).map((n) => {
3234
+ const nodeId = `pattern-${n.id}`;
3235
+ const conf = Math.round(n.data.confidence * 100);
3236
+ const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
3237
+ const descWidth = Math.max(30, contentWidth - 15);
3238
+ const desc = n.data.description.length > descWidth ? n.data.description.slice(0, descWidth - 3) + "..." : n.data.description;
3239
+ const hasPreceding = learnedSignals.length > 0 || (storageFacts?.length ?? 0) > 0;
3240
+ return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3241
+ sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : hasPreceding ? " " : " ",
3242
+ !hasPreceding && " ",
3243
+ n.data.isAntiPattern ? /* @__PURE__ */ jsx11(Text10, { color: "red", children: "!" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
3244
+ " ",
3245
+ sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
3246
+ narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
3247
+ " ",
3248
+ confColor ? /* @__PURE__ */ jsxs10(Text10, { color: confColor, children: [
3249
+ conf,
3250
+ "%"
3251
+ ] }) : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3252
+ conf,
3253
+ "%"
3254
+ ] })
3255
+ ] })
3256
+ ] }, n.id);
3257
+ })
3258
+ ] }),
3259
+ patternNodes.length === 0 && learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3126
3260
  " ",
3127
- n.data.isAntiPattern ? /* @__PURE__ */ jsx11(Text10, { color: "red", children: "!" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
3128
- " ",
3129
- sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
3130
- narrow ? null : /* @__PURE__ */ jsxs10(Fragment6, { children: [
3131
- " ",
3132
- confColor ? /* @__PURE__ */ jsxs10(Text10, { color: confColor, children: [
3133
- conf,
3134
- "%"
3135
- ] }) : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3136
- conf,
3137
- "%"
3138
- ] })
3139
- ] })
3140
- ] }, n.id);
3141
- }),
3261
+ " ",
3262
+ "No signals learned yet. Trie will extract insights as you work."
3263
+ ] })
3264
+ ] }),
3142
3265
  renderHeader("cross-project", "Cross-Project", globalPatterns.length),
3143
3266
  expandedNodes.has("cross-project") && globalPatterns.slice(0, 8).map((pattern) => {
3144
3267
  const patternId = `global-${pattern.id}`;
@@ -7045,6 +7168,77 @@ var TrieQueryContextTool = class {
7045
7168
  };
7046
7169
  }
7047
7170
  };
7171
+ var TrieQueryLedgerBlocksTool = class {
7172
+ async execute(input) {
7173
+ const workDir = input.directory || getWorkingDirectory(void 0, true);
7174
+ const analysis = input.analysis || "issues";
7175
+ const limit = input.limit ?? 50;
7176
+ const blocks = await getLedgerBlocks(workDir);
7177
+ const limited = blocks.slice(-limit);
7178
+ if (blocks.length === 0) {
7179
+ return {
7180
+ content: [{
7181
+ type: "text",
7182
+ text: "No ledger blocks found. Ledger blocks are created when issues are recorded during watch mode or scans."
7183
+ }]
7184
+ };
7185
+ }
7186
+ let output = `Ledger Chain: ${blocks.length} block(s)
7187
+
7188
+ `;
7189
+ if (analysis === "summary" || analysis === "all") {
7190
+ output += "**Block summary:**\n";
7191
+ for (let i = 0; i < limited.length; i++) {
7192
+ const b = limited[i];
7193
+ const critical = b.entries.filter((e) => e.severity === "critical").length;
7194
+ output += ` Block ${blocks.length - limited.length + i + 1}: ${b.date} \u2014 ${b.entries.length} entries (${critical} critical)
7195
+ `;
7196
+ }
7197
+ output += "\n";
7198
+ }
7199
+ if (analysis === "issues" || analysis === "all") {
7200
+ const allEntries = limited.flatMap((b) => b.entries).filter((e) => e.status !== "false-positive");
7201
+ const total = allEntries.length;
7202
+ if (total === 0) {
7203
+ output += "No active entries in these blocks.\n";
7204
+ } else {
7205
+ const byFile = /* @__PURE__ */ new Map();
7206
+ const bySeverity = /* @__PURE__ */ new Map();
7207
+ const byAgent = /* @__PURE__ */ new Map();
7208
+ for (const e of allEntries) {
7209
+ byFile.set(e.file, (byFile.get(e.file) || 0) + 1);
7210
+ bySeverity.set(e.severity, (bySeverity.get(e.severity) || 0) + 1);
7211
+ byAgent.set(e.agent, (byAgent.get(e.agent) || 0) + 1);
7212
+ }
7213
+ const topFiles = [...byFile.entries()].sort((a, b) => b[1] - a[1]).slice(0, 10);
7214
+ const topSeverities = [...bySeverity.entries()].sort((a, b) => b[1] - a[1]);
7215
+ const topAgents = [...byAgent.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5);
7216
+ output += `**Most frequent issues across ${total} entries:**
7217
+
7218
+ `;
7219
+ output += "**By file:**\n";
7220
+ for (const [file, count] of topFiles) {
7221
+ const short = file.split("/").pop() || file;
7222
+ output += ` ${short}: ${count}
7223
+ `;
7224
+ }
7225
+ output += "\n**By severity:**\n";
7226
+ for (const [sev, count] of topSeverities) {
7227
+ output += ` ${sev}: ${count}
7228
+ `;
7229
+ }
7230
+ output += "\n**By agent:**\n";
7231
+ for (const [agent, count] of topAgents) {
7232
+ output += ` ${agent}: ${count}
7233
+ `;
7234
+ }
7235
+ }
7236
+ }
7237
+ return {
7238
+ content: [{ type: "text", text: output.trim() }]
7239
+ };
7240
+ }
7241
+ };
7048
7242
 
7049
7243
  // src/tools/checkpoint.ts
7050
7244
  async function handleCheckpointTool(input) {
@@ -7730,7 +7924,7 @@ var CHAT_TOOLS = [
7730
7924
  },
7731
7925
  {
7732
7926
  name: "trie_get_blockers",
7733
- description: "Query active blockers \u2014 known problems preventing progress.",
7927
+ description: 'Query active blockers \u2014 known problems preventing progress. NOT the same as "blocks" (ledger chain).',
7734
7928
  input_schema: {
7735
7929
  type: "object",
7736
7930
  properties: {
@@ -7738,6 +7932,17 @@ var CHAT_TOOLS = [
7738
7932
  }
7739
7933
  }
7740
7934
  },
7935
+ {
7936
+ name: "trie_query_ledger_blocks",
7937
+ description: 'Query the ledger chain blocks \u2014 the tamper-evident chain of recorded issues. Use when user asks about "blocks", "ledger chain", "what issues in my blocks", "most frequent issues in blocks", etc. Returns block summary and aggregation of issues by file, severity, and agent.',
7938
+ input_schema: {
7939
+ type: "object",
7940
+ properties: {
7941
+ analysis: { type: "string", enum: ["summary", "issues", "all"], description: "What to analyze: summary (block counts), issues (most frequent files/severities/agents), or all (default: issues)" },
7942
+ limit: { type: "number", description: "Max blocks to include (default: 50)" }
7943
+ }
7944
+ }
7945
+ },
7741
7946
  {
7742
7947
  name: "trie_query_context",
7743
7948
  description: 'Natural-language search across ALL Trie context: goals, hypotheses, nudges (goal violations), incidents, governance, blockers, facts, and questions. Use for "what are my goals", "show hypotheses", "any nudges", "show incidents", "recent governance", etc.',
@@ -8007,6 +8212,11 @@ async function executeTool(name, input, onProgress) {
8007
8212
  const result = await tool.execute(withDir);
8008
8213
  return textFromResult(result);
8009
8214
  }
8215
+ case "trie_query_ledger_blocks": {
8216
+ const tool = new TrieQueryLedgerBlocksTool();
8217
+ const result = await tool.execute(withDir);
8218
+ return textFromResult(result);
8219
+ }
8010
8220
  case "trie_query_context": {
8011
8221
  const tool = new TrieQueryContextTool();
8012
8222
  const result = await tool.execute(withDir);
@@ -8539,6 +8749,7 @@ var SYSTEM_PROMPT = `You are Trie, a code assistant embedded in a terminal TUI.
8539
8749
  - Check recent goal violations (nudges) in the provided project context
8540
8750
  - Record incidents, decisions, and feedback about the codebase
8541
8751
  - Query ALL stored context: goals, hypotheses, nudges, decisions, blockers via trie_query_context
8752
+ - Query ledger chain blocks (issues recorded in blocks) via trie_query_ledger_blocks \u2014 use for "blocks", "ledger chain", "most frequent issues"
8542
8753
  - Create and manage goals and hypotheses
8543
8754
  - Propose fixes for goal violations (requires user confirmation before spawning Claude Code)
8544
8755
  - Run AI-powered scans to detect goal violations across the entire codebase
@@ -8550,6 +8761,10 @@ var SYSTEM_PROMPT = `You are Trie, a code assistant embedded in a terminal TUI.
8550
8761
  - It uses AI analysis and is much more reliable than regex pattern matching
8551
8762
  - You also have trie_search_files but it requires ripgrep (often not installed)
8552
8763
 
8764
+ **CRITICAL - "blocks" vs "blockers" (different concepts):**
8765
+ - **Blocks** = Ledger chain blocks (Memory \u2192 Ledger Chain). Each block has entries (recorded issues). Use trie_query_ledger_blocks when user asks about "blocks", "ledger chain", "what issues in my blocks", "most frequent issues in blocks", etc.
8766
+ - **Blockers** = Things preventing progress (from governance). Use trie_get_blockers when user asks about "blockers" or "what's blocking me".
8767
+
8553
8768
  **When user asks "what are my goals", "show hypotheses", "any nudges", "latest decisions", etc.:**
8554
8769
  - The project context block already includes goals, hypotheses, nudges, decisions, blockers
8555
8770
  - 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")
@@ -8698,7 +8913,7 @@ function ChatView() {
8698
8913
  }
8699
8914
  const fixesToApply = isYesToAll ? allPendingFixes : lastFixes;
8700
8915
  if (fixesToApply.length > 0) {
8701
- const { spawnClaudeCodeFix } = await import("./terminal-spawn-P5M5PHAV.js");
8916
+ const { spawnClaudeCodeFix } = await import("./terminal-spawn-5YXDMUCF.js");
8702
8917
  const results = [];
8703
8918
  const errors = [];
8704
8919
  for (const fix of fixesToApply) {
@@ -9420,7 +9635,7 @@ function DashboardApp({ onReady }) {
9420
9635
  const loadPersistedNudges = useCallback7(async () => {
9421
9636
  try {
9422
9637
  const workDir = getWorkingDirectory(void 0, true);
9423
- const { getStorage: getStorage2 } = await import("./tiered-storage-WWVVHGFR.js");
9638
+ const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
9424
9639
  const storage = getStorage2(workDir);
9425
9640
  await storage.initialize();
9426
9641
  const nudges = await storage.queryNudges({ resolved: false, limit: 50 });
@@ -11011,7 +11226,7 @@ Use \`trie_watch start\` to begin autonomous scanning.`
11011
11226
  ).join("\n");
11012
11227
  let agencyStatus = "";
11013
11228
  try {
11014
- const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-ZLKBEWPW.js");
11229
+ const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-NYSPGZYS.js");
11015
11230
  const trieAgent = getTrieAgent2(this.watchedDirectory || getWorkingDirectory(void 0, true));
11016
11231
  await trieAgent.initialize();
11017
11232
  const status = await trieAgent.getAgencyStatus();
@@ -11142,10 +11357,11 @@ export {
11142
11357
  TrieGetRelatedGovernanceTool,
11143
11358
  TrieGetRelatedDecisionsTool,
11144
11359
  TrieQueryContextTool,
11360
+ TrieQueryLedgerBlocksTool,
11145
11361
  handleCheckpointTool,
11146
11362
  TriePipelineTool,
11147
11363
  GitHubBranchesTool,
11148
11364
  InteractiveDashboard,
11149
11365
  TrieWatchTool
11150
11366
  };
11151
- //# sourceMappingURL=chunk-NYYVYJPJ.js.map
11367
+ //# sourceMappingURL=chunk-Q4K7CFCK.js.map