@triedotdev/mcp 1.0.148 → 1.0.151

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +225 -78
  3. package/dist/{autonomy-config-ZCOSTMPD.js → autonomy-config-3APNC6QF.js} +3 -3
  4. package/dist/{chat-store-OJLJCJFI.js → chat-store-HMTDL7I2.js} +3 -3
  5. package/dist/{chunk-LD7ZEFNY.js → chunk-3KZBC3RJ.js} +2 -2
  6. package/dist/{chunk-SH7H3WRU.js → chunk-4TQQP7JD.js} +3 -3
  7. package/dist/{chunk-SH7H3WRU.js.map → chunk-4TQQP7JD.js.map} +1 -1
  8. package/dist/{chunk-N2EDZTKG.js → chunk-4UDBGYI3.js} +13 -13
  9. package/dist/{chunk-XTTZAQWJ.js → chunk-74R4XSFB.js} +5 -5
  10. package/dist/{chunk-T6PS3MXJ.js → chunk-7HYOJ4Q7.js} +8 -8
  11. package/dist/{chunk-T6PS3MXJ.js.map → chunk-7HYOJ4Q7.js.map} +1 -1
  12. package/dist/{chunk-3MUCUZ46.js → chunk-ABY2R7OK.js} +3 -3
  13. package/dist/chunk-ED7PLRQA.js +782 -0
  14. package/dist/chunk-ED7PLRQA.js.map +1 -0
  15. package/dist/{chunk-4MJ52WBH.js → chunk-EFWVF6TI.js} +4 -2
  16. package/dist/chunk-EFWVF6TI.js.map +1 -0
  17. package/dist/{chunk-23RJT5WT.js → chunk-F7BMFOZ6.js} +2 -2
  18. package/dist/{chunk-4PAAGLKO.js → chunk-G7Q23IGF.js} +36 -9
  19. package/dist/{chunk-4PAAGLKO.js.map → chunk-G7Q23IGF.js.map} +1 -1
  20. package/dist/{chunk-LT6VUZG2.js → chunk-GLY76TSI.js} +3 -3
  21. package/dist/{chunk-WMDFK7LI.js → chunk-IFBEAOHH.js} +5 -5
  22. package/dist/{chunk-YEIJW6X6.js → chunk-JIS2OCZR.js} +4 -4
  23. package/dist/{chunk-FG467PDD.js → chunk-LNUMECBJ.js} +2 -2
  24. package/dist/{chunk-FPEMP54L.js → chunk-OJXFQRUE.js} +2 -2
  25. package/dist/{chunk-5KJ4UJOY.js → chunk-QQG42HCI.js} +2 -2
  26. package/dist/{chunk-7OJ6JIPL.js → chunk-REHKDCI6.js} +7 -150
  27. package/dist/chunk-REHKDCI6.js.map +1 -0
  28. package/dist/{chunk-J7CEBSEB.js → chunk-SU3WCAC4.js} +102 -163
  29. package/dist/chunk-SU3WCAC4.js.map +1 -0
  30. package/dist/{chunk-4C67GV3O.js → chunk-TCNCNWGV.js} +2 -2
  31. package/dist/{chunk-NKHO34UZ.js → chunk-TU7D5DEW.js} +2 -2
  32. package/dist/{chunk-62POBLFC.js → chunk-TWPX6PHF.js} +453 -986
  33. package/dist/chunk-TWPX6PHF.js.map +1 -0
  34. package/dist/{chunk-FH335WL5.js → chunk-TWQPOVRA.js} +2 -2
  35. package/dist/{chunk-YOJGSRZK.js → chunk-V3O7C2LY.js} +2 -2
  36. package/dist/{chunk-V7AY2EJO.js → chunk-WOTLY5NA.js} +2 -2
  37. package/dist/cli/create-agent.js +8 -40
  38. package/dist/cli/create-agent.js.map +1 -1
  39. package/dist/cli/main.js +121 -164
  40. package/dist/cli/main.js.map +1 -1
  41. package/dist/cli/yolo-daemon.js +31 -155
  42. package/dist/cli/yolo-daemon.js.map +1 -1
  43. package/dist/{client-INNE2GGZ.js → client-5L64D5SQ.js} +3 -3
  44. package/dist/{codebase-index-FMIULFZQ.js → codebase-index-OOE7OAHP.js} +3 -3
  45. package/dist/{fast-analyzer-MWKCDRGD.js → fast-analyzer-FMU3X4AZ.js} +5 -5
  46. package/dist/github-ingester-C66ZRUYC.js +11 -0
  47. package/dist/{goal-manager-ZBWKWEML.js → goal-manager-VTBFFYN4.js} +8 -7
  48. package/dist/{goal-validator-DA3JQ6JN.js → goal-validator-EM5XVWVC.js} +7 -6
  49. package/dist/{graph-J4OGTYCO.js → graph-26JPZ3DF.js} +3 -3
  50. package/dist/{hypothesis-JCUMZKTG.js → hypothesis-4UPE7KXU.js} +8 -7
  51. package/dist/{incident-index-BWW2UEY7.js → incident-index-H6APJ4S3.js} +3 -3
  52. package/dist/index.js +116 -397
  53. package/dist/index.js.map +1 -1
  54. package/dist/{insight-store-A5XXMFD6.js → insight-store-QEEUQR5L.js} +4 -4
  55. package/dist/{issue-store-LZWZIGM7.js → issue-store-C6XYENE5.js} +7 -4
  56. package/dist/ledger-VNA4DX3Z.js +51 -0
  57. package/dist/linear-ingester-WIUBWF55.js +11 -0
  58. package/dist/{tiered-storage-VZL7KK64.js → tiered-storage-P6Z3NV2Q.js} +3 -3
  59. package/dist/trie-agent-GJJJCL6P.js +27 -0
  60. package/dist/trie-agent-GJJJCL6P.js.map +1 -0
  61. package/package.json +8 -6
  62. package/dist/chunk-4MJ52WBH.js.map +0 -1
  63. package/dist/chunk-62POBLFC.js.map +0 -1
  64. package/dist/chunk-7OJ6JIPL.js.map +0 -1
  65. package/dist/chunk-G76DYVGX.js +0 -136
  66. package/dist/chunk-G76DYVGX.js.map +0 -1
  67. package/dist/chunk-J7CEBSEB.js.map +0 -1
  68. package/dist/comprehension-46F7ZNKL.js +0 -821
  69. package/dist/comprehension-46F7ZNKL.js.map +0 -1
  70. package/dist/github-ingester-J2ZFYXVE.js +0 -11
  71. package/dist/linear-ingester-JRDQAIAA.js +0 -11
  72. package/dist/trie-agent-6A7YBNTQ.js +0 -26
  73. package/dist/workers/agent-worker.d.ts +0 -2
  74. package/dist/workers/agent-worker.js +0 -28
  75. package/dist/workers/agent-worker.js.map +0 -1
  76. /package/dist/{autonomy-config-ZCOSTMPD.js.map → autonomy-config-3APNC6QF.js.map} +0 -0
  77. /package/dist/{chat-store-OJLJCJFI.js.map → chat-store-HMTDL7I2.js.map} +0 -0
  78. /package/dist/{chunk-LD7ZEFNY.js.map → chunk-3KZBC3RJ.js.map} +0 -0
  79. /package/dist/{chunk-N2EDZTKG.js.map → chunk-4UDBGYI3.js.map} +0 -0
  80. /package/dist/{chunk-XTTZAQWJ.js.map → chunk-74R4XSFB.js.map} +0 -0
  81. /package/dist/{chunk-3MUCUZ46.js.map → chunk-ABY2R7OK.js.map} +0 -0
  82. /package/dist/{chunk-23RJT5WT.js.map → chunk-F7BMFOZ6.js.map} +0 -0
  83. /package/dist/{chunk-LT6VUZG2.js.map → chunk-GLY76TSI.js.map} +0 -0
  84. /package/dist/{chunk-WMDFK7LI.js.map → chunk-IFBEAOHH.js.map} +0 -0
  85. /package/dist/{chunk-YEIJW6X6.js.map → chunk-JIS2OCZR.js.map} +0 -0
  86. /package/dist/{chunk-FG467PDD.js.map → chunk-LNUMECBJ.js.map} +0 -0
  87. /package/dist/{chunk-FPEMP54L.js.map → chunk-OJXFQRUE.js.map} +0 -0
  88. /package/dist/{chunk-5KJ4UJOY.js.map → chunk-QQG42HCI.js.map} +0 -0
  89. /package/dist/{chunk-4C67GV3O.js.map → chunk-TCNCNWGV.js.map} +0 -0
  90. /package/dist/{chunk-NKHO34UZ.js.map → chunk-TU7D5DEW.js.map} +0 -0
  91. /package/dist/{chunk-FH335WL5.js.map → chunk-TWQPOVRA.js.map} +0 -0
  92. /package/dist/{chunk-YOJGSRZK.js.map → chunk-V3O7C2LY.js.map} +0 -0
  93. /package/dist/{chunk-V7AY2EJO.js.map → chunk-WOTLY5NA.js.map} +0 -0
  94. /package/dist/{client-INNE2GGZ.js.map → client-5L64D5SQ.js.map} +0 -0
  95. /package/dist/{codebase-index-FMIULFZQ.js.map → codebase-index-OOE7OAHP.js.map} +0 -0
  96. /package/dist/{fast-analyzer-MWKCDRGD.js.map → fast-analyzer-FMU3X4AZ.js.map} +0 -0
  97. /package/dist/{github-ingester-J2ZFYXVE.js.map → github-ingester-C66ZRUYC.js.map} +0 -0
  98. /package/dist/{goal-manager-ZBWKWEML.js.map → goal-manager-VTBFFYN4.js.map} +0 -0
  99. /package/dist/{goal-validator-DA3JQ6JN.js.map → goal-validator-EM5XVWVC.js.map} +0 -0
  100. /package/dist/{graph-J4OGTYCO.js.map → graph-26JPZ3DF.js.map} +0 -0
  101. /package/dist/{hypothesis-JCUMZKTG.js.map → hypothesis-4UPE7KXU.js.map} +0 -0
  102. /package/dist/{incident-index-BWW2UEY7.js.map → incident-index-H6APJ4S3.js.map} +0 -0
  103. /package/dist/{insight-store-A5XXMFD6.js.map → insight-store-QEEUQR5L.js.map} +0 -0
  104. /package/dist/{issue-store-LZWZIGM7.js.map → issue-store-C6XYENE5.js.map} +0 -0
  105. /package/dist/{linear-ingester-JRDQAIAA.js.map → ledger-VNA4DX3Z.js.map} +0 -0
  106. /package/dist/{tiered-storage-VZL7KK64.js.map → linear-ingester-WIUBWF55.js.map} +0 -0
  107. /package/dist/{trie-agent-6A7YBNTQ.js.map → tiered-storage-P6Z3NV2Q.js.map} +0 -0
package/dist/cli/main.js CHANGED
@@ -1,17 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  completeBootstrap,
4
- getSkillCategories,
5
4
  initProjectInfo,
6
5
  initializeBootstrapFiles,
7
6
  loadContextState,
8
7
  loadProjectInfo,
9
8
  needsBootstrap,
10
9
  projectInfoExists
11
- } from "../chunk-7OJ6JIPL.js";
10
+ } from "../chunk-REHKDCI6.js";
12
11
  import {
13
12
  LinearIngester
14
- } from "../chunk-LD7ZEFNY.js";
13
+ } from "../chunk-3KZBC3RJ.js";
15
14
  import {
16
15
  LearningEngine,
17
16
  exportToJson,
@@ -21,14 +20,14 @@ import {
21
20
  isTrieInitialized,
22
21
  perceiveCurrentChanges,
23
22
  reasonAboutChangesHumanReadable
24
- } from "../chunk-4PAAGLKO.js";
23
+ } from "../chunk-G7Q23IGF.js";
25
24
  import {
26
25
  loadConfig,
27
26
  saveConfig
28
- } from "../chunk-NKHO34UZ.js";
27
+ } from "../chunk-TU7D5DEW.js";
29
28
  import {
30
29
  IncidentIndex
31
- } from "../chunk-4C67GV3O.js";
30
+ } from "../chunk-TCNCNWGV.js";
32
31
  import "../chunk-ZV2K6M7T.js";
33
32
  import {
34
33
  GotchaPredictor,
@@ -38,64 +37,66 @@ import {
38
37
  listTrackedProjects,
39
38
  searchGlobalPatterns,
40
39
  updateGlobalMemoryMd
41
- } from "../chunk-WMDFK7LI.js";
40
+ } from "../chunk-IFBEAOHH.js";
42
41
  import {
43
42
  ContextGraph
44
- } from "../chunk-FH335WL5.js";
43
+ } from "../chunk-TWQPOVRA.js";
45
44
  import {
46
45
  measureInitialGoalValue
47
- } from "../chunk-T6PS3MXJ.js";
48
- import "../chunk-FPEMP54L.js";
46
+ } from "../chunk-7HYOJ4Q7.js";
47
+ import "../chunk-OJXFQRUE.js";
49
48
  import {
50
49
  getProjectState
51
- } from "../chunk-LT6VUZG2.js";
50
+ } from "../chunk-GLY76TSI.js";
52
51
  import "../chunk-F4NJ4CBP.js";
53
52
  import "../chunk-IXO4G4D3.js";
54
53
  import "../chunk-6NLHFIYA.js";
55
54
  import {
56
55
  getStorage
57
- } from "../chunk-FG467PDD.js";
56
+ } from "../chunk-LNUMECBJ.js";
58
57
  import {
59
58
  getAutonomyConfig,
60
59
  recordBypass,
61
60
  shouldAutoFix,
62
61
  shouldBlockPush,
63
62
  trackIssueOccurrence
64
- } from "../chunk-5KJ4UJOY.js";
63
+ } from "../chunk-QQG42HCI.js";
64
+ import {
65
+ getDailyLogs,
66
+ getMemoryStats,
67
+ getRecentIssues,
68
+ markIssueResolved,
69
+ purgeIssues,
70
+ searchIssues
71
+ } from "../chunk-ED7PLRQA.js";
72
+ import "../chunk-EFWVF6TI.js";
65
73
  import {
66
74
  compressOldBlocks,
67
- deleteAllBlocks,
68
- deleteBlocks,
75
+ correctLedgerEntries,
69
76
  detectLegacyLedger,
70
77
  formatAuditLog,
71
78
  getAuditStatistics,
72
- getDailyLogs,
79
+ getCorrectionStats,
80
+ getEntryCorrectionHistory,
73
81
  getLedgerBlocks,
74
82
  getLedgerSyncStatus,
75
- getMemoryStats,
76
83
  getRecentAuditLogs,
77
- getRecentIssues,
78
- getSkillAuditLogs,
79
84
  getStagedChanges,
80
85
  getStorageStats,
81
86
  getUncommittedChanges,
82
87
  initializeSharedLedger,
83
88
  isGitRepo,
84
- markIssueResolved,
85
89
  migrateLegacyLedger,
86
- purgeIssues,
87
90
  pushLedgerToShared,
88
- searchIssues,
89
91
  shouldCompress,
90
92
  syncLedgerFromShared,
91
93
  verifyLedger
92
- } from "../chunk-62POBLFC.js";
93
- import "../chunk-4MJ52WBH.js";
94
+ } from "../chunk-TWPX6PHF.js";
94
95
  import "../chunk-43X6JBEM.js";
95
96
  import {
96
97
  getTrieDirectory,
97
98
  getWorkingDirectory
98
- } from "../chunk-SH7H3WRU.js";
99
+ } from "../chunk-4TQQP7JD.js";
99
100
  import "../chunk-APMV77PU.js";
100
101
  import {
101
102
  __require
@@ -270,7 +271,7 @@ async function handleInitCommand(args) {
270
271
  \u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
271
272
  \u2551 \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
272
273
  \u2551 \u2551
273
- \u2551 Your code quality agent and skills registry \u2551
274
+ \u2551 Your code quality agent and tools registry \u2551
274
275
  \u2551 \u2551
275
276
  \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
276
277
 
@@ -313,29 +314,11 @@ async function handleInitCommand(args) {
313
314
  if (result.stack.database) console.log(` Database: ${result.stack.database}`);
314
315
  if (result.stack.auth) console.log(` Auth: ${result.stack.auth}`);
315
316
  if (result.stack.packageManager) console.log(` Package Manager: ${result.stack.packageManager}`);
316
- if (result.stack.suggestedSkills.length > 0) {
317
- const topSkills = result.stack.suggestedSkills.slice(0, 5);
318
- console.log("\nSuggested Skills (based on your stack):");
319
- for (const skill of topSkills) {
320
- console.log(` trie skills add ${skill}`);
321
- }
322
- if (result.stack.suggestedSkills.length > 5) {
323
- console.log(` ... and ${result.stack.suggestedSkills.length - 5} more: trie skills suggest`);
324
- }
325
- }
326
- const categories = getSkillCategories();
327
- const topCategories = categories.slice(0, 5);
328
- console.log("\nExplore skill categories:");
329
- for (const cat of topCategories) {
330
- console.log(` trie skills list ${cat.name.padEnd(15)} # ${cat.count} skills`);
331
- }
332
- console.log(` trie skills list categories # see all ${categories.length} categories`);
333
- console.log("\nBrowse all skills: https://skills.sh");
334
317
  console.log(`
335
318
  Quick Start:
336
- 1. trie scan # Analyze your codebase now
337
- 2. trie watch # Start watching (nudges as you code)
338
- 3. trie tell "what broke" # Teach Trie about past incidents
319
+ 1. trie watch # Start watching (nudges as you code)
320
+ 2. trie tell "what broke" # Teach Trie about past incidents
321
+ 3. trie check # Risk check before pushing
339
322
 
340
323
  Trie is now active via git hooks (pre-commit, pre-push).
341
324
  For real-time nudges while coding, run "trie watch" in a terminal.
@@ -1217,9 +1200,9 @@ For CURSOR (~/.cursor/mcp.json):
1217
1200
  }
1218
1201
  }
1219
1202
 
1220
- STEP 4: Start scanning!
1203
+ STEP 4: Get started!
1221
1204
  ${pc3.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")}
1222
- Ask your AI assistant: "Scan this with Trie" or "Use trie_scan"
1205
+ Ask your AI assistant: "Use trie" for the menu, or "Use trie_fix" for fixes
1223
1206
  `);
1224
1207
  }
1225
1208
  function getCurrentConfig() {
@@ -1378,8 +1361,8 @@ async function handleAutoFixCommand(args, issues) {
1378
1361
  const dryRun = args.includes("--dry-run");
1379
1362
  const skipConfirm = args.includes("--yes") || args.includes("-y");
1380
1363
  if (!issues || issues.length === 0) {
1381
- console.error(pc4.yellow("No issues provided. Run a scan first:"));
1382
- console.error(pc4.dim(" trie scan --fix"));
1364
+ console.error(pc4.yellow("No issues provided. Run trie watch first, or use trie_fix via MCP."));
1365
+ console.error(pc4.dim(" trie watch"));
1383
1366
  return;
1384
1367
  }
1385
1368
  let fixes = detectAutoFixes(issues);
@@ -2213,35 +2196,11 @@ async function handleAuditCommand(args) {
2213
2196
  const logs = await getRecentAuditLogs(limit);
2214
2197
  if (logs.length === 0) {
2215
2198
  console.log("\nNo audit logs found.");
2216
- console.log("Audit logs are created when skills are executed during scans.\n");
2199
+ console.log("Audit logs are created when tools execute commands.\n");
2217
2200
  return;
2218
2201
  }
2219
2202
  console.log(`
2220
- Recent Skill Executions (last ${logs.length}):
2221
- `);
2222
- for (const log of logs) {
2223
- console.log(formatAuditLog(log));
2224
- console.log("");
2225
- }
2226
- break;
2227
- }
2228
- case "skill": {
2229
- if (!rest[0]) {
2230
- console.log("Usage: trie audit skill <skill-name>");
2231
- console.log("");
2232
- console.log("View audit logs for a specific skill.");
2233
- return;
2234
- }
2235
- const skillName = rest[0];
2236
- const logs = await getSkillAuditLogs(skillName);
2237
- if (logs.length === 0) {
2238
- console.log(`
2239
- No audit logs found for skill: ${skillName}
2240
- `);
2241
- return;
2242
- }
2243
- console.log(`
2244
- Audit Logs for ${skillName} (${logs.length} executions):
2203
+ Recent Executions (last ${logs.length}):
2245
2204
  `);
2246
2205
  for (const log of logs) {
2247
2206
  console.log(formatAuditLog(log));
@@ -2257,7 +2216,7 @@ Audit Logs for ${skillName} (${logs.length} executions):
2257
2216
  console.log(` \u2705 Successful: ${stats.successfulExecutions}`);
2258
2217
  console.log(` \u274C Failed: ${stats.failedExecutions}`);
2259
2218
  console.log("");
2260
- console.log(`Unique skills executed: ${stats.uniqueSkills}`);
2219
+ console.log(`Unique tools executed: ${stats.uniqueSkills}`);
2261
2220
  console.log("");
2262
2221
  console.log(`Commands executed: ${stats.totalCommands}`);
2263
2222
  if (stats.blockedCommands > 0) {
@@ -2279,21 +2238,19 @@ Audit Logs for ${skillName} (${logs.length} executions):
2279
2238
  console.log(`
2280
2239
  Audit - View security audit logs
2281
2240
 
2282
- Trie logs all skill operations for security auditing. View what
2283
- skills have executed, what commands they ran, and any blocked operations.
2241
+ Trie logs tool operations for security auditing. View what
2242
+ commands were executed and any blocked operations.
2284
2243
 
2285
2244
  Commands:
2286
2245
  trie audit logs [count] Show recent audit logs (default: 20)
2287
- trie audit skill <name> Show logs for a specific skill
2288
2246
  trie audit stats Show audit statistics
2289
2247
 
2290
2248
  Examples:
2291
2249
  trie audit logs 50 Show last 50 executions
2292
- trie audit skill security Show all executions of security skill
2293
2250
  trie audit stats View overall statistics
2294
2251
 
2295
2252
  Audit logs are stored in .trie/audit/ and include:
2296
- \u2022 Skill name and source
2253
+ \u2022 Tool name and source
2297
2254
  \u2022 Commands executed
2298
2255
  \u2022 Network calls made
2299
2256
  \u2022 Files accessed/modified
@@ -2911,12 +2868,16 @@ import pc8 from "picocolors";
2911
2868
  import { Command as Command2 } from "commander";
2912
2869
  function createLedgerCommand() {
2913
2870
  const ledger = new Command2("ledger").description("Manage and inspect the ledger");
2914
- ledger.command("verify").description("Verify ledger chain integrity").action(async () => {
2871
+ ledger.command("verify").description("Verify ledger chain integrity and signatures").action(async () => {
2915
2872
  try {
2916
2873
  console.log("Verifying ledger chain...");
2874
+ console.log(" \u2022 Checking block hashes");
2875
+ console.log(" \u2022 Verifying Merkle roots");
2876
+ console.log(" \u2022 Validating Ed25519 signatures");
2917
2877
  const result = await verifyLedger();
2918
2878
  if (result.valid) {
2919
2879
  console.log(pc8.green("\u2713 Ledger chain is valid"));
2880
+ console.log(pc8.dim(" All blocks, hashes, and signatures verified"));
2920
2881
  } else {
2921
2882
  console.log(pc8.red(`\u2717 Ledger chain is invalid: ${result.error}`));
2922
2883
  process.exit(1);
@@ -2948,10 +2909,15 @@ function createLedgerCommand() {
2948
2909
  }
2949
2910
  console.log(`Entries: ${block.entries.length}`);
2950
2911
  console.log(`Hash: ${pc8.dim(block.blockHash.slice(0, 16))}...`);
2912
+ const signedEntries = block.entries.filter((e) => e.signature);
2913
+ if (signedEntries.length > 0) {
2914
+ console.log(`Signed: ${pc8.green(`${signedEntries.length}/${block.entries.length}`)}`);
2915
+ }
2951
2916
  if (block.entries.length > 0) {
2952
2917
  console.log("Issues:");
2953
2918
  for (const entry of block.entries) {
2954
- console.log(` \u2022 ${entry.severity} - ${entry.file} (${entry.agent})`);
2919
+ const signatureIndicator = entry.signature ? pc8.green("\u2713") : pc8.dim("\u25CB");
2920
+ console.log(` ${signatureIndicator} ${entry.severity} - ${entry.file} (${entry.agent})`);
2955
2921
  }
2956
2922
  }
2957
2923
  console.log("");
@@ -2980,7 +2946,9 @@ function createLedgerCommand() {
2980
2946
  if (blocks.length > 0) {
2981
2947
  const firstBlock = blocks[0];
2982
2948
  const lastBlock = blocks[blocks.length - 1];
2983
- console.log(`Date range: ${pc8.dim(`${firstBlock.date} to ${lastBlock.date}`)}`);
2949
+ if (firstBlock && lastBlock) {
2950
+ console.log(`Date range: ${pc8.dim(`${firstBlock.date} to ${lastBlock.date}`)}`);
2951
+ }
2984
2952
  }
2985
2953
  const authorCounts = /* @__PURE__ */ new Map();
2986
2954
  for (const block of blocks) {
@@ -3093,74 +3061,88 @@ ${pc8.yellow("\u{1F4A1} Tip:")} Run ${pc8.bold("trie ledger compress")} to archi
3093
3061
  process.exit(1);
3094
3062
  }
3095
3063
  });
3096
- ledger.command("delete").description("Delete specific blocks from the ledger (PERMANENT)").argument("<dates...>", "Block dates to delete (YYYY-MM-DD format)").option("--confirm", "Confirm the permanent deletion").action(async (dates, options) => {
3064
+ ledger.command("correct").description("Mark ledger entries as corrected (maintains immutability)").argument("<entry-ids...>", "Entry IDs to mark as corrected").option("-r, --reason <reason>", "Reason for the correction (required)").option("-t, --type <type>", "Correction type: corrected or false-positive", "corrected").action(async (entryIds, options) => {
3097
3065
  try {
3098
- const datePattern = /^\d{4}-\d{2}-\d{2}$/;
3099
- const invalidDates = dates.filter((date) => !datePattern.test(date));
3100
- if (invalidDates.length > 0) {
3101
- console.error(pc8.red("Invalid date format(s):"), invalidDates.join(", "));
3102
- console.error("Please use YYYY-MM-DD format");
3103
- process.exit(1);
3104
- }
3105
- if (!options.confirm) {
3106
- console.log(pc8.bold(pc8.red("\u26A0\uFE0F DANGER: PERMANENT DELETION")));
3107
- console.log("");
3108
- console.log(`You are about to permanently delete ${dates.length} block(s):`);
3109
- for (const date of dates) {
3110
- console.log(` \u2022 ${pc8.cyan(date)}`);
3111
- }
3066
+ if (!options.reason) {
3067
+ console.error(pc8.red("\u2717 Correction reason is required"));
3112
3068
  console.log("");
3113
- console.log(pc8.red("This operation cannot be undone and will permanently remove"));
3114
- console.log(pc8.red("all issues and data from these blocks."));
3069
+ console.log("Usage:");
3070
+ console.log(` ${pc8.dim('trie ledger correct <entry-id> -r "reason for correction"')}`);
3115
3071
  console.log("");
3116
- console.log(`To proceed, add the ${pc8.bold("--confirm")} flag:`);
3117
- console.log(` ${pc8.dim("trie ledger delete " + dates.join(" ") + " --confirm")}`);
3118
- return;
3072
+ console.log("Examples:");
3073
+ console.log(` ${pc8.dim('trie ledger correct abc123 -r "False positive - this is expected behavior"')}`);
3074
+ console.log(` ${pc8.dim('trie ledger correct xyz789 -r "Duplicate detection" -t false-positive')}`);
3075
+ process.exit(1);
3119
3076
  }
3120
- console.log(pc8.yellow("\u{1F5D1}\uFE0F Deleting blocks..."));
3121
- const result = await deleteBlocks(dates, void 0, true);
3077
+ const validTypes = ["corrected", "false-positive"];
3078
+ if (!validTypes.includes(options.type)) {
3079
+ console.error(pc8.red(`\u2717 Invalid correction type: ${options.type}`));
3080
+ console.log(`Valid types: ${validTypes.join(", ")}`);
3081
+ process.exit(1);
3082
+ }
3083
+ console.log(pc8.yellow(`\u{1F4DD} Marking ${entryIds.length} entry(ies) as ${options.type}...`));
3084
+ console.log(`Reason: ${pc8.dim(options.reason)}`);
3085
+ console.log("");
3086
+ const result = await correctLedgerEntries(
3087
+ entryIds,
3088
+ options.reason,
3089
+ options.type
3090
+ );
3122
3091
  if (result.success) {
3123
- console.log(pc8.green(`\u2713 Successfully deleted ${result.deletedBlocks} block(s)`));
3124
- if (result.warning) {
3125
- console.log(pc8.yellow(`\u26A0\uFE0F ${result.warning}`));
3126
- }
3092
+ console.log(pc8.green(`\u2713 Successfully corrected ${result.correctedEntries} entry(ies)`));
3093
+ console.log("");
3094
+ console.log(pc8.dim("Note: Original entries remain in the ledger for audit trail."));
3095
+ console.log(pc8.dim(" Queries will automatically filter out corrected entries."));
3127
3096
  } else {
3128
- console.error(pc8.red("\u2717 Deletion failed:"), result.error);
3097
+ console.error(pc8.red("\u2717 Correction failed:"), result.error);
3129
3098
  process.exit(1);
3130
3099
  }
3131
3100
  } catch (error) {
3132
- console.error(pc8.red("Failed to delete blocks:"), error);
3101
+ console.error(pc8.red("Failed to correct entries:"), error);
3133
3102
  process.exit(1);
3134
3103
  }
3135
3104
  });
3136
- ledger.command("clear").description("Delete ALL blocks from the ledger (PERMANENT)").option("--confirm", "Confirm the permanent deletion of all blocks").action(async (options) => {
3105
+ ledger.command("corrections").description("Show correction statistics and history").option("-e, --entries <ids...>", "Show correction history for specific entry IDs").action(async (options) => {
3137
3106
  try {
3138
- if (!options.confirm) {
3139
- console.log(pc8.bold(pc8.red("\u{1F6A8} DANGER: COMPLETE LEDGER DELETION")));
3140
- console.log("");
3141
- console.log(pc8.red("You are about to permanently delete ALL blocks in the ledger."));
3142
- console.log(pc8.red("This will completely erase the entire ledger history."));
3143
- console.log("");
3144
- console.log(pc8.red("This operation cannot be undone and will permanently remove"));
3145
- console.log(pc8.red("ALL issues and historical data."));
3146
- console.log("");
3147
- console.log(`To proceed, add the ${pc8.bold("--confirm")} flag:`);
3148
- console.log(` ${pc8.dim("trie ledger clear --confirm")}`);
3149
- return;
3150
- }
3151
- console.log(pc8.yellow("\u{1F5D1}\uFE0F Clearing entire ledger..."));
3152
- const result = await deleteAllBlocks(void 0, true);
3153
- if (result.success) {
3154
- console.log(pc8.green(`\u2713 Successfully deleted ${result.deletedBlocks} block(s)`));
3155
- if (result.warning) {
3156
- console.log(pc8.yellow(`\u26A0\uFE0F ${result.warning}`));
3107
+ if (options.entries && options.entries.length > 0) {
3108
+ const history = await getEntryCorrectionHistory(options.entries);
3109
+ if (history.size === 0) {
3110
+ console.log("No correction history found for the specified entries");
3111
+ return;
3112
+ }
3113
+ console.log(pc8.bold("Correction History\n"));
3114
+ for (const [entryId, data] of history) {
3115
+ console.log(pc8.bold(pc8.cyan(`Entry: ${entryId}`)));
3116
+ console.log(`Status: ${pc8.yellow(data.original.status || "active")}`);
3117
+ console.log(`File: ${pc8.dim(data.original.file)}`);
3118
+ console.log(`Agent: ${pc8.dim(data.original.agent)}`);
3119
+ if (data.original.correction) {
3120
+ console.log(`Correction: ${data.original.correction}`);
3121
+ }
3122
+ if (data.original.correctionTimestamp) {
3123
+ console.log(`Corrected at: ${pc8.dim(data.original.correctionTimestamp)}`);
3124
+ }
3125
+ if (data.corrections.length > 0) {
3126
+ console.log("\nCorrection Entries:");
3127
+ for (const correction of data.corrections) {
3128
+ console.log(` \u2022 ${correction.id} - ${correction.correction}`);
3129
+ }
3130
+ }
3131
+ console.log("");
3157
3132
  }
3158
3133
  } else {
3159
- console.error(pc8.red("\u2717 Clear operation failed:"), result.error);
3160
- process.exit(1);
3134
+ const stats = await getCorrectionStats();
3135
+ console.log(pc8.bold("Correction Statistics\n"));
3136
+ console.log(`Total entries: ${pc8.cyan(stats.totalEntries.toString())}`);
3137
+ console.log(`Active entries: ${pc8.green(stats.activeEntries.toString())}`);
3138
+ console.log(`Corrected entries: ${pc8.yellow(stats.correctedEntries.toString())}`);
3139
+ console.log(`False positives: ${pc8.yellow(stats.falsePositives.toString())}`);
3140
+ console.log(`Correction rate: ${pc8.cyan(`${stats.correctionRate}%`)}`);
3141
+ console.log("");
3142
+ console.log(pc8.dim("\u{1F4A1} Tip: Use --entries <id> to see correction history for specific entries"));
3161
3143
  }
3162
3144
  } catch (error) {
3163
- console.error(pc8.red("Failed to clear ledger:"), error);
3145
+ console.error(pc8.red("Failed to show corrections:"), error);
3164
3146
  process.exit(1);
3165
3147
  }
3166
3148
  });
@@ -3206,7 +3188,6 @@ USAGE:
3206
3188
 
3207
3189
  COMMANDS:
3208
3190
  init Initialize Trie in your project
3209
- scan Scan codebase once and exit
3210
3191
  watch Start watching (nudges as you code)
3211
3192
  Use screen/tmux to run in background
3212
3193
  check Run risk check before pushing
@@ -3238,7 +3219,6 @@ EXAMPLES:
3238
3219
  trie init # Initialize Trie in your project
3239
3220
  trie watch # Start watching (nudges as you code)
3240
3221
  trie watch # Run in background: screen -S trie-watch
3241
- trie scan # Scan your codebase now
3242
3222
 
3243
3223
  trie tell "users couldn't log in" # Report an incident
3244
3224
  trie ok # Mark current pattern as good
@@ -3258,7 +3238,6 @@ EXAMPLES:
3258
3238
 
3259
3239
  MCP TOOLS (use via Cursor/Claude Desktop):
3260
3240
  trie_linear_sync Sync active tickets from Linear
3261
- trie_scan Scan with decision ledger
3262
3241
  trie_fix Generate high-confidence fix prompts
3263
3242
  trie_explain Explain code, issues, or changes
3264
3243
  trie_watch Watch mode for autonomous reporting
@@ -3286,7 +3265,7 @@ ${pc9.bold("Last Scan:")} ${lastScanDate.toLocaleDateString()} (${daysAgo === 0
3286
3265
  console.log(pc9.dim(` Issues found: ${state.lastScan.issues.total} (${state.lastScan.issues.critical} critical, ${state.lastScan.issues.serious} serious)`));
3287
3266
  } else {
3288
3267
  console.log(`
3289
- ${pc9.bold("Last Scan:")} Never ${pc9.dim("(run `trie scan` to get started)")}`);
3268
+ ${pc9.bold("Last Scan:")} Never ${pc9.dim("(run `trie watch` to get started)")}`);
3290
3269
  }
3291
3270
  console.log(`
3292
3271
  ${pc9.bold("Memory Stats:")}`);
@@ -3319,7 +3298,7 @@ ${pc9.yellow("\u2B22 Notice:")} Memory usage high - consider running: ${pc9.bold
3319
3298
  }
3320
3299
  console.log(`
3321
3300
  ${pc9.bold("Quick Commands:")}`);
3322
- console.log(pc9.dim(" trie scan - Scan codebase now"));
3301
+ console.log(pc9.dim(" trie watch - Start watching for nudges"));
3323
3302
  console.log(pc9.dim(" trie memory stats - Detailed memory statistics"));
3324
3303
  console.log(pc9.dim(" trie project - View project information"));
3325
3304
  console.log("");
@@ -3416,25 +3395,6 @@ ${"-".repeat(68)}
3416
3395
  `);
3417
3396
  console.log(content);
3418
3397
  }
3419
- async function runScan(args) {
3420
- const { spawn } = await import("child_process");
3421
- let daemonPath;
3422
- if (__filename3.endsWith(".ts")) {
3423
- daemonPath = resolve2(__dirname3, "yolo-daemon.ts");
3424
- } else {
3425
- daemonPath = resolve2(__dirname3, "yolo-daemon.js");
3426
- }
3427
- const daemonArgs = ["--once", ...args];
3428
- const executor = daemonPath.endsWith(".ts") ? "npx" : "node";
3429
- const execArgs = daemonPath.endsWith(".ts") ? ["tsx", daemonPath, ...daemonArgs] : [daemonPath, ...daemonArgs];
3430
- const child = spawn(executor, execArgs, {
3431
- stdio: "inherit",
3432
- env: process.env
3433
- });
3434
- child.on("close", (code) => {
3435
- process.exit(code || 0);
3436
- });
3437
- }
3438
3398
  async function runWatch(args) {
3439
3399
  const { spawn } = await import("child_process");
3440
3400
  let daemonPath;
@@ -3506,9 +3466,6 @@ async function main() {
3506
3466
  case "-v":
3507
3467
  showVersion();
3508
3468
  break;
3509
- case "scan":
3510
- runScan(restArgs);
3511
- break;
3512
3469
  case "watch":
3513
3470
  runWatch(restArgs);
3514
3471
  break;