@triedotdev/mcp 1.0.169 → 1.0.170

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 (145) hide show
  1. package/README.md +54 -545
  2. package/dist/chunk-2YXOBNKW.js +619 -0
  3. package/dist/chunk-2YXOBNKW.js.map +1 -0
  4. package/dist/chunk-QR64Y5TI.js +363 -0
  5. package/dist/chunk-QR64Y5TI.js.map +1 -0
  6. package/dist/cli/main.d.ts +0 -15
  7. package/dist/cli/main.js +356 -3098
  8. package/dist/cli/main.js.map +1 -1
  9. package/dist/index.js +2 -34
  10. package/dist/index.js.map +1 -1
  11. package/dist/server/mcp-server.js +2 -34
  12. package/package.json +8 -31
  13. package/dist/autonomy-config-FSERX3O3.js +0 -30
  14. package/dist/autonomy-config-FSERX3O3.js.map +0 -1
  15. package/dist/chat-store-JNGNTDSN.js +0 -15
  16. package/dist/chat-store-JNGNTDSN.js.map +0 -1
  17. package/dist/chunk-2HF65EHQ.js +0 -311
  18. package/dist/chunk-2HF65EHQ.js.map +0 -1
  19. package/dist/chunk-3XR6WVAW.js +0 -4011
  20. package/dist/chunk-3XR6WVAW.js.map +0 -1
  21. package/dist/chunk-43X6JBEM.js +0 -36
  22. package/dist/chunk-43X6JBEM.js.map +0 -1
  23. package/dist/chunk-6NLHFIYA.js +0 -344
  24. package/dist/chunk-6NLHFIYA.js.map +0 -1
  25. package/dist/chunk-7IO4YUI3.js +0 -1827
  26. package/dist/chunk-7IO4YUI3.js.map +0 -1
  27. package/dist/chunk-AHD2CBQ7.js +0 -846
  28. package/dist/chunk-AHD2CBQ7.js.map +0 -1
  29. package/dist/chunk-BUTOP5EB.js +0 -931
  30. package/dist/chunk-BUTOP5EB.js.map +0 -1
  31. package/dist/chunk-DGUM43GV.js +0 -11
  32. package/dist/chunk-DGUM43GV.js.map +0 -1
  33. package/dist/chunk-EFWVF6TI.js +0 -267
  34. package/dist/chunk-EFWVF6TI.js.map +0 -1
  35. package/dist/chunk-F6WFNUAY.js +0 -216
  36. package/dist/chunk-F6WFNUAY.js.map +0 -1
  37. package/dist/chunk-FBNURWRY.js +0 -662
  38. package/dist/chunk-FBNURWRY.js.map +0 -1
  39. package/dist/chunk-FQ45QP5A.js +0 -361
  40. package/dist/chunk-FQ45QP5A.js.map +0 -1
  41. package/dist/chunk-FVRO5RN3.js +0 -1306
  42. package/dist/chunk-FVRO5RN3.js.map +0 -1
  43. package/dist/chunk-G2TGF6TR.js +0 -573
  44. package/dist/chunk-G2TGF6TR.js.map +0 -1
  45. package/dist/chunk-G3I7SZLW.js +0 -354
  46. package/dist/chunk-G3I7SZLW.js.map +0 -1
  47. package/dist/chunk-GTKYBOXL.js +0 -700
  48. package/dist/chunk-GTKYBOXL.js.map +0 -1
  49. package/dist/chunk-HVCDY3AK.js +0 -850
  50. package/dist/chunk-HVCDY3AK.js.map +0 -1
  51. package/dist/chunk-I2O5OYQT.js +0 -727
  52. package/dist/chunk-I2O5OYQT.js.map +0 -1
  53. package/dist/chunk-JVMBCWKS.js +0 -348
  54. package/dist/chunk-JVMBCWKS.js.map +0 -1
  55. package/dist/chunk-KCUOWRPX.js +0 -816
  56. package/dist/chunk-KCUOWRPX.js.map +0 -1
  57. package/dist/chunk-KDHN2ZQE.js +0 -313
  58. package/dist/chunk-KDHN2ZQE.js.map +0 -1
  59. package/dist/chunk-ME2OERF5.js +0 -345
  60. package/dist/chunk-ME2OERF5.js.map +0 -1
  61. package/dist/chunk-OBQ74FOU.js +0 -27
  62. package/dist/chunk-OBQ74FOU.js.map +0 -1
  63. package/dist/chunk-Q5EKA5YA.js +0 -254
  64. package/dist/chunk-Q5EKA5YA.js.map +0 -1
  65. package/dist/chunk-Q63FFI6D.js +0 -132
  66. package/dist/chunk-Q63FFI6D.js.map +0 -1
  67. package/dist/chunk-SASNMSB5.js +0 -12597
  68. package/dist/chunk-SASNMSB5.js.map +0 -1
  69. package/dist/chunk-T63OHG4Q.js +0 -440
  70. package/dist/chunk-T63OHG4Q.js.map +0 -1
  71. package/dist/chunk-TN5WEKWI.js +0 -173
  72. package/dist/chunk-TN5WEKWI.js.map +0 -1
  73. package/dist/chunk-VUL52BQL.js +0 -402
  74. package/dist/chunk-VUL52BQL.js.map +0 -1
  75. package/dist/chunk-VVITXIHN.js +0 -189
  76. package/dist/chunk-VVITXIHN.js.map +0 -1
  77. package/dist/chunk-WCN7S3EI.js +0 -14
  78. package/dist/chunk-WCN7S3EI.js.map +0 -1
  79. package/dist/chunk-XPZZFPBZ.js +0 -491
  80. package/dist/chunk-XPZZFPBZ.js.map +0 -1
  81. package/dist/chunk-ZJF5FTBX.js +0 -1396
  82. package/dist/chunk-ZJF5FTBX.js.map +0 -1
  83. package/dist/chunk-ZV2K6M7T.js +0 -74
  84. package/dist/chunk-ZV2K6M7T.js.map +0 -1
  85. package/dist/cli/create-agent.d.ts +0 -1
  86. package/dist/cli/create-agent.js +0 -1050
  87. package/dist/cli/create-agent.js.map +0 -1
  88. package/dist/cli/yolo-daemon.d.ts +0 -1
  89. package/dist/cli/yolo-daemon.js +0 -421
  90. package/dist/cli/yolo-daemon.js.map +0 -1
  91. package/dist/client-NJPZE5JT.js +0 -28
  92. package/dist/client-NJPZE5JT.js.map +0 -1
  93. package/dist/codebase-index-VAPF32XX.js +0 -12
  94. package/dist/codebase-index-VAPF32XX.js.map +0 -1
  95. package/dist/fast-analyzer-3GCCZMLK.js +0 -216
  96. package/dist/fast-analyzer-3GCCZMLK.js.map +0 -1
  97. package/dist/git-EO5SRFMN.js +0 -28
  98. package/dist/git-EO5SRFMN.js.map +0 -1
  99. package/dist/github-ingester-ZOKK6GRS.js +0 -11
  100. package/dist/github-ingester-ZOKK6GRS.js.map +0 -1
  101. package/dist/goal-manager-QUKX2W6C.js +0 -25
  102. package/dist/goal-manager-QUKX2W6C.js.map +0 -1
  103. package/dist/goal-validator-2SFSKKVU.js +0 -24
  104. package/dist/goal-validator-2SFSKKVU.js.map +0 -1
  105. package/dist/graph-B3NA4S7I.js +0 -10
  106. package/dist/graph-B3NA4S7I.js.map +0 -1
  107. package/dist/hypothesis-KCPBR652.js +0 -23
  108. package/dist/hypothesis-KCPBR652.js.map +0 -1
  109. package/dist/incident-index-EFNUSGWL.js +0 -11
  110. package/dist/incident-index-EFNUSGWL.js.map +0 -1
  111. package/dist/insight-store-EC4PLSAW.js +0 -22
  112. package/dist/insight-store-EC4PLSAW.js.map +0 -1
  113. package/dist/issue-store-YAXTNRRY.js +0 -36
  114. package/dist/issue-store-YAXTNRRY.js.map +0 -1
  115. package/dist/ledger-TWZTGDFA.js +0 -58
  116. package/dist/ledger-TWZTGDFA.js.map +0 -1
  117. package/dist/linear-ingester-XXPAZZRW.js +0 -11
  118. package/dist/linear-ingester-XXPAZZRW.js.map +0 -1
  119. package/dist/output-manager-RVJ37XKA.js +0 -13
  120. package/dist/output-manager-RVJ37XKA.js.map +0 -1
  121. package/dist/parse-goal-violation-SACGFG3C.js +0 -8
  122. package/dist/parse-goal-violation-SACGFG3C.js.map +0 -1
  123. package/dist/pattern-discovery-F7LU5K6E.js +0 -8
  124. package/dist/pattern-discovery-F7LU5K6E.js.map +0 -1
  125. package/dist/progress-SRQ2V3BP.js +0 -18
  126. package/dist/progress-SRQ2V3BP.js.map +0 -1
  127. package/dist/project-state-AHPA77SM.js +0 -28
  128. package/dist/project-state-AHPA77SM.js.map +0 -1
  129. package/dist/sync-M2FSWPBC.js +0 -12
  130. package/dist/sync-M2FSWPBC.js.map +0 -1
  131. package/dist/terminal-spawn-5YXDMUCF.js +0 -157
  132. package/dist/terminal-spawn-5YXDMUCF.js.map +0 -1
  133. package/dist/tiered-storage-DYNC5CQ6.js +0 -13
  134. package/dist/tiered-storage-DYNC5CQ6.js.map +0 -1
  135. package/dist/trie-agent-I3HAHY2G.js +0 -26
  136. package/dist/trie-agent-I3HAHY2G.js.map +0 -1
  137. package/dist/ui/chat.html +0 -1014
  138. package/dist/ui/goals.html +0 -967
  139. package/dist/ui/hypotheses.html +0 -1011
  140. package/dist/ui/ledger.html +0 -954
  141. package/dist/ui/nudges.html +0 -995
  142. package/dist/vibe-code-signatures-5ZULYP3D.js +0 -987
  143. package/dist/vibe-code-signatures-5ZULYP3D.js.map +0 -1
  144. package/dist/vulnerability-signatures-2URZSXAQ.js +0 -983
  145. package/dist/vulnerability-signatures-2URZSXAQ.js.map +0 -1
package/README.md CHANGED
@@ -1,602 +1,111 @@
1
- # Trie: Governance ledger for agent-human teams
1
+ # Trie Agent
2
2
 
3
- **Context that travels from Agents CLI CI/CD, keeping agents and humans aligned.**
3
+ **Cloud context bridge for Cursor and Claude Code.** Connects AI assistants to your Trie cloud workspace—signals, documents, ledger, and graph—so agents have the right context before editing.
4
4
 
5
5
  [![Download Workspace](https://img.shields.io/badge/Download-Trie%20Workspace-blue)](https://www.trie.dev) [![Follow on X](https://img.shields.io/badge/Follow-@louiskishfy-1DA1F2?logo=x)](https://x.com/louiskishfy)
6
6
 
7
- ## The Problem
8
-
9
- When agents and humans ship code together across Cursor, Claude Code, VS Code, and CI/CD, context fragments. An agent makes a decision in one tool, a human forgets it in another, and nothing prevents repeating the same mistake.
10
-
11
- **Traditional tools don't solve this:**
12
- - Linear tracks tasks, not decisions or reasoning
13
- - GitHub shows changes, not why they were made
14
- - Slack/Discord: context vanishes in chat history
15
- - No tool tells you if today's change conflicts with yesterday's decision
16
-
17
- ## The Solution
18
-
19
- Trie keeps a **governance ledger**—a tamper-evident record of decisions, incidents, and fixes that travels with your code. Every tool reads from the same ledger, so decisions persist and everyone stays aligned.
20
-
21
- - **`trie watch`** - Monitors your codebase 24/7, learns patterns autonomously
22
- - **`trie gotcha`** - Predicts problems before you ship based on past incidents
23
- - **Governance ledger** - Decision memory with Git-backed audit trail and digital signatures
24
- - **Cross-tool context** - Same ledger in Cursor, CLI, CI/CD—no coordination needed
25
-
26
- Think of it as **double-entry bookkeeping for code decisions**—tamper-evident accountability that works with Git and your existing workflow.
27
-
28
7
  ## Quick Start
29
8
 
30
9
  ### Install
31
10
 
32
11
  ```bash
33
- npm install -g trie
34
- cd your-project
35
- trie init
36
- ```
37
-
38
- ### Basic Workflow
39
-
40
- ```bash
41
- # 1. Report incidents as they happen
42
- trie tell "Users can't log in after password reset"
43
-
44
- # 2. Start autonomous monitoring
45
- trie watch
46
-
47
- # 3. Before pushing, check for risks
48
- trie gotcha
49
-
50
- # 4. Learn from your git history
51
- trie learn
52
-
53
- # 5. Give feedback
54
- trie ok # Prediction was helpful
55
- trie bad # Prediction was wrong
56
- ```
57
-
58
- ## Core Features
59
-
60
- ### 1. Autonomous Monitoring (`trie watch`)
61
-
62
- Real-time agent that monitors your codebase and enforces custom rules:
63
-
64
- ```bash
65
- # Set any quality rule you want enforced
66
- trie goal add "No console.log statements in production"
67
- trie goal add "All API endpoints must have rate limiting"
68
- trie goal add "We never truncate text in UI components"
69
-
70
- # Start watching
71
- trie watch
12
+ npm install -g @triedotdev/mcp
72
13
  ```
73
14
 
74
- **Features:**
75
- - **Interactive dashboard** with goals, memory, and analysis activity
76
- - **AI-powered goal checking** using semantic understanding (not just keywords)
77
- - **AI-powered Gotcha Prediction** - Automatically analyzes changed files for potential problems using Claude
78
- - **AI-powered Learning** - Learns from git history (fix/revert commits) every 10 file changes
79
- - **Signal extraction** - Extracts governance decisions, facts, and blockers from code changes
80
- - **Token-aware** to manage AI costs
81
- - **Smart caching** to avoid duplicate scans
82
- - **Real-time nudges** when violations are detected
83
-
84
- **How AI integration works in watch mode:**
85
- 1. When files change, AI extracts structured signals (governance, facts, blockers)
86
- 2. Gotcha Predictor analyzes changes for potential problems using Claude Sonnet 4
87
- 3. Learning Engine periodically learns from git history to improve predictions
88
- 4. All findings are stored in the governance ledger for future reference
15
+ ### Login
89
16
 
90
- Run in background with screen or tmux:
91
17
  ```bash
92
- screen -S trie-watch
93
- trie watch
94
- # Detach: Ctrl+A then D
95
- # Reattach: screen -r trie-watch
18
+ trie login
96
19
  ```
97
20
 
98
- ### 2. AI-Powered Predictive Analysis (`trie gotcha`)
99
-
100
- Uses Claude (Anthropic) to predict problems before you ship, combining:
101
- - **AI code analysis** - Semantic understanding of bugs, security issues, and anti-patterns
102
- - **Governance context** - Relevant decisions and blockers from the ledger
103
- - **Historical incidents** - Past regressions in the same files
104
- - **Active tickets** - Linear tickets that might conflict
105
-
106
- ```bash
107
- # Check current changes for risks (requires ANTHROPIC_API_KEY)
108
- trie gotcha
109
-
110
- # Connect to Linear for JIT defect prediction
111
- trie linear auth <your-api-key>
112
- trie linear sync
113
- ```
114
-
115
- **How it works:**
116
- 1. Analyzes changed files with Claude Sonnet 4
117
- 2. Checks against governance decisions and active blockers
118
- 3. Searches for similar past incidents
119
- 4. Returns structured predictions with risk levels and recommendations
120
- 5. Falls back gracefully if AI unavailable
121
-
122
- ### 3. Governance Ledger
123
-
124
- Tamper-evident record of all decisions, incidents, and fixes:
125
-
126
- **Architecture:**
127
- - **Governance ledger** (`.trie/memory/ledger.json`) - Append-only chain with Ed25519 signatures
128
- - **Issue memory** (`.trie/memory/issues.json`) - Fast searchable cache
129
-
130
- **Key properties:**
131
- - Never deleted, only corrected (full audit trail)
132
- - Digital signatures prove who (human or agent) created each entry
133
- - Auto-commits to Git for distributed backup
134
- - Works across Cursor, CLI, CI/CD—same ledger everywhere
135
-
136
- **Setup signing:**
137
- ```bash
138
- trie keys generate # Generate Ed25519 signing key
139
- trie keys status # Check if signing is configured
140
- ```
141
-
142
- **Ledger commands:**
143
- ```bash
144
- trie ledger verify # Validate chain integrity
145
- trie ledger history # Show blocks with author attribution
146
- trie ledger stats # Block counts, entries, severity breakdown
147
- ```
148
-
149
- **Corrections (not deletions):**
150
- ```bash
151
- # Mark false positive
152
- trie ledger correct <entry-id> -r "Expected behavior" -t false-positive
153
-
154
- # Mark as fixed
155
- trie ledger correct <entry-id> -r "Fixed in commit abc123"
156
-
157
- # View correction stats
158
- trie ledger corrections
159
- ```
160
-
161
- ## Integrations
162
-
163
- | Integration | Setup | Purpose |
164
- |-------------|-------|---------|
165
- | **Linear** | `trie linear auth <key>` | JIT defect prediction from active tickets |
166
- | **GitHub** | Set `GITHUB_TOKEN` env var | Sync PRs and issues into context graph |
167
- | **Slack** | `trie setup slack <webhook>` | Team notifications for critical issues |
168
- | **Cursor Cloud** | Set `CURSOR_API_KEY` | Verified automated fixes via cloud agent |
21
+ This opens a browser to authorize the CLI with your Trie account. After login, the MCP server can access your team's cloud context.
169
22
 
170
- ### Linear Integration
23
+ ### MCP Setup (Cursor / Claude Code)
171
24
 
172
- ```bash
173
- trie linear auth <your-api-key>
174
- trie linear sync
175
- ```
176
-
177
- Or via MCP: `trie_linear_sync` — syncs tickets into the context graph for gotcha predictions.
178
-
179
- ### GitHub Integration
180
-
181
- Sync open PRs and issues into the context graph:
182
-
183
- ```bash
184
- # Via MCP (Cursor/Claude)
185
- trie_github_sync
186
- trie_github_branches # See which branch has latest updates
187
- ```
188
-
189
- Requires `GITHUB_TOKEN` (repo scope for private repos, public_repo for public).
190
-
191
- ### Slack Integration
192
-
193
- ```bash
194
- # Show setup guide
195
- trie setup slack
196
-
197
- # Configure webhook
198
- trie setup slack <webhook-url> [#channel]
199
-
200
- # Test connection
201
- trie setup test-slack
202
- ```
25
+ Add to your MCP settings:
203
26
 
204
- Or manually add to `.trie/config.json`:
205
27
  ```json
206
28
  {
207
- "integrations": {
208
- "slack": {
209
- "enabled": true,
210
- "webhook": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
211
- "channel": "#security"
29
+ "mcpServers": {
30
+ "trie": {
31
+ "command": "trie",
32
+ "args": ["mcp"],
33
+ "env": {}
212
34
  }
213
35
  }
214
36
  }
215
37
  ```
216
38
 
217
- ### Cursor Cloud Agent
218
-
219
- Dispatch high-risk issues to Cursor's cloud for verified, test-passing fixes:
220
-
221
- ```bash
222
- # Via MCP
223
- trie_cloud_fix action:configure apiKey:"key-..."
224
- trie_cloud_fix action:dispatch issueIds:["issue-1"]
225
-
226
- # Force cloud dispatch (bypass triage)
227
- trie_cloud_fix action:dispatch forceCloud:true
228
-
229
- # Ad-hoc dispatch
230
- trie_cloud_fix action:dispatch file:"src/auth.ts" issue:"SQL injection" fix:"Use parameterized queries"
231
- ```
232
-
233
- The cloud agent runs in an isolated VM, applies the fix, runs tests, captures screenshots, and opens a PR.
234
-
235
- ### Pipeline View
236
-
237
- See work across Linear, GitHub, and Trie in one place:
238
-
239
- ```bash
240
- # Via MCP
241
- trie_pipeline # Full status: tickets, PRs, issues
242
- trie_pipeline action:coverage # Only Trie issues with no ticket/PR
243
- trie_pipeline action:create_tickets issueIds:["id1","id2"] # Open tickets
244
- ```
245
-
246
- ## AI Tool Integration (MCP)
247
-
248
- Trie provides Model Context Protocol tools for Claude, Cursor, and AI assistants.
249
-
250
- ### Setup for Cursor/Claude
251
-
252
- Add to your MCP settings:
39
+ If you use `npx` instead of a global install:
253
40
 
254
41
  ```json
255
42
  {
256
43
  "mcpServers": {
257
44
  "trie": {
258
- "command": "trie",
259
- "args": ["mcp"],
260
- "env": {
261
- "ANTHROPIC_API_KEY": "your-api-key",
262
- "LINEAR_API_KEY": "your-key",
263
- "GITHUB_TOKEN": "your-token",
264
- "CURSOR_API_KEY": "your-cursor-key"
265
- }
45
+ "command": "npx",
46
+ "args": ["-y", "@triedotdev/mcp", "mcp"],
47
+ "env": {}
266
48
  }
267
49
  }
268
50
  }
269
51
  ```
270
52
 
271
- ### Available Tools
272
-
273
- **Core:**
274
- - `trie_tell` - Report incidents and extract structured signals
275
- - `trie_check` - Quick risk assessment
276
- - `trie_watch` - Start/stop autonomous monitoring
277
- - `trie_memory` - Search incident history
278
- - `trie_fix` - Apply fixes (use `action:route` to see triage plan)
279
- - `trie_cloud_fix` - Dispatch to Cursor cloud agent
280
-
281
- **Integrations:**
282
- - `trie_linear_sync` - Sync active Linear tickets
283
- - `trie_github_sync` - Sync open PRs and issues
284
- - `trie_github_branches` - Fetch branches with latest commits
285
- - `trie_pipeline` - Consolidated view of tickets, PRs, issues
286
-
287
- **Query Tools (Targeted Context):**
288
- - `trie_get_governance` - Query decisions with filters
289
- - `trie_get_blockers` - Get active blockers only
290
- - `trie_get_nudges` - Get unresolved goal violations
291
- - `trie_get_related_governance` - Find related context
292
- - `trie_query_context` - Natural language queries across all signals
293
-
294
- **Why query tools matter**: Instead of dumping everything into context, agents ask for exactly what they need. This prevents context pollution and keeps agents focused.
295
-
296
- ## Advanced Features
297
-
298
- <details>
299
- <summary><b>Goals & Custom Rules</b></summary>
300
-
301
- Set improvement goals that are actively enforced in real-time:
53
+ ### Proactive Warnings
302
54
 
303
55
  ```bash
304
- # Add goals
305
- trie goal add "No hardcoded API keys"
306
- trie goal add "All async functions must handle errors"
307
- trie goal add "Every TODO must have a ticket reference"
308
-
309
- # View progress
310
- trie goal list
311
-
312
- # Get unresolved violations
313
- trie_get_nudges # Via MCP
314
- ```
315
-
316
- Goals use AI-powered semantic understanding to catch violations, not just keyword matching.
317
-
318
- </details>
319
-
320
- <details>
321
- <summary><b>Fix Triage System</b></summary>
322
-
323
- Trie routes each issue to one of three fix strategies:
324
-
325
- | Strategy | When | Action |
326
- |----------|------|--------|
327
- | **inline-auto** | Trivial fixes (score < 0) | Apply automatically |
328
- | **local-ai** | Moderate risk (score 0–3) | `trie_fix` — local AI applies fix |
329
- | **cloud-agent** | High risk (score ≥ 4) | `trie_cloud_fix` — Cursor cloud agent |
330
-
331
- See routing plan before applying:
332
- ```bash
333
- trie_fix action:route
334
- ```
335
-
336
- </details>
337
-
338
- <details>
339
- <summary><b>Team Sync (Shared Ledger)</b></summary>
340
-
341
- Sync ledger blocks across your team:
342
-
343
- ```bash
344
- trie sync init # Initialize shared storage
345
- trie sync pull # Pull shared updates
346
- trie sync push # Push local changes
347
- trie sync status # Show sync state
348
- trie sync hooks --install # Install auto-sync git hooks
349
- ```
350
-
351
- The shared ledger lives in `.trie-shared/` with hot/cold storage tiers and automatic compression.
352
-
353
- </details>
354
-
355
- <details>
356
- <summary><b>Memory Management</b></summary>
357
-
358
- ```bash
359
- # Search incident history
360
- trie memory search "authentication"
361
- trie memory stats
362
- trie memory recent
363
-
364
- # Clean up old issues (doesn't affect immutable ledger)
365
- trie memory purge smart # Remove resolved & old low-priority
366
- trie memory purge resolved # All resolved issues
367
- trie memory purge old # Older than 90 days
368
- ```
369
-
370
- </details>
371
-
372
- <details>
373
- <summary><b>Git Hooks</b></summary>
374
-
375
- Installed automatically with `trie init`:
376
-
377
- - **pre-commit** - Scan staged files, block on critical issues
378
- - **post-commit** - Update context graph
379
- - **pre-push** - Block push on critical issues
380
-
381
- **Bypass methods:**
382
- ```bash
383
- git push --no-verify # Skip all hooks
384
- TRIE_BYPASS=1 git push # Skip Trie but log bypass
385
- ```
386
-
387
- </details>
388
-
389
- ## How It Works
390
-
391
- ### Memory Architecture
392
-
393
- Trie maintains two complementary memory systems:
394
-
395
- **1. Governance Ledger** (`.trie/memory/ledger.json`)
396
- - Append-only chain with Ed25519 signatures
397
- - Tamper-evident, never deleted (only corrected)
398
- - Used for: audit trail, compliance, gotcha predictions
399
- - Auto-commits to Git for distributed backup
400
-
401
- **2. Issue Memory** (`.trie/memory/issues.json`)
402
- - Fast searchable cache of detected issues
403
- - Can be compacted and purged
404
- - Used for: pattern recognition, quick queries
405
- - Links back to ledger via `ledgerBlockHash`
406
-
407
- Both systems sync across your team and travel with your codebase via Git.
408
-
409
- ### Trie-Based Autocomplete
410
-
411
- Trie uses prefix trees (tries) for fast O(m) autocomplete on ledger data:
412
-
413
- **Ledger Trie** (`src/trie/ledger-trie.ts`)
414
- - Indexes governance tags for discovery (e.g., "auth" → "auth", "authentication", "authorization")
415
- - Indexes file paths from governance for quick lookups
416
- - Indexes agent names for history queries
417
- - Integrated into tiered storage for instant autocomplete
418
-
419
- **Usage in MCP:**
420
- - Agents can autocomplete tags when querying governance
421
- - Fast prefix search on file paths and agent names
422
- - Makes the ledger more discoverable and navigable
423
-
424
- ### File Structure
425
-
426
- ```
427
- your-project/
428
- ├── .trie/
429
- │ ├── memory/
430
- │ │ ├── ledger.json # Governance ledger (cryptographic chain)
431
- │ │ └── issues.json # Issue cache
432
- │ ├── warm/
433
- │ │ └── decisions.db # SQLite database for structured queries
434
- │ ├── context.json # Project knowledge graph
435
- │ ├── config.json # Settings
436
- │ └── keys/ # Ed25519 signing keys (never committed)
437
- ├── .trie-shared/ # Shared ledger for team sync (optional)
438
- │ ├── active/
439
- │ ├── archived/
440
- │ └── ledger-manifest.json
441
- └── .git/
442
- ```
443
-
444
- ### Signal Extraction & AI Analysis
445
-
446
- Trie uses AI throughout for intelligent analysis:
447
-
448
- **Signal Extraction** (`signal-extractor.ts`)
449
- Instead of dumping raw logs into context, Trie extracts structured signals:
450
-
451
- **Input:** Incident report, commit, conversation
452
- **Extraction:** AI (Claude Haiku/Sonnet) pulls out structured data:
453
- - **Governance**: "Chose bcrypt over sha256 for password hashing"
454
- - **Facts**: "Stripe requires TLS 1.2+ for EU transactions"
455
- - **Blockers**: "Missing VAT validation blocks EU checkout"
456
- - **Questions**: "Should we cache session tokens?"
457
-
458
- **Storage:** Goes to queryable database with trie-based indexing
459
- **Query:** Agents ask for targeted context via autocomplete, not everything at once
460
-
461
- **AI-Powered Learning** (`learning-engine.ts`)
462
- - Analyzes git `fix` and `revert` commits to understand root causes
463
- - Extracts patterns and categories (logic-error, null-check, race-condition)
464
- - Stores lessons in the ledger for future predictions
465
- - Falls back gracefully if AI unavailable
466
-
467
- **AI-Powered Gotcha** (`gotcha-predictor.ts`)
468
- - Analyzes code semantically for bugs and security issues
469
- - Considers governance context and active blockers
470
- - Returns structured predictions with risk levels
471
- - Uses Claude Sonnet 4 for deep code understanding
472
-
473
- This prevents context pollution and keeps agents focused on relevant signals.
474
-
475
- ## CLI Reference
476
-
477
- ### Basic Commands
478
-
479
- ```bash
480
- trie init # Set up Trie in your project
481
- trie status # View project health and memory stats
482
- trie tell # Report incidents (extracts decisions, facts, blockers)
483
- trie gotcha # Predict problems with current changes
484
- trie learn # Train from git history or feedback
485
- trie watch # Start interactive monitoring dashboard
56
+ trie init
486
57
  ```
487
58
 
488
- ### Goals
59
+ This adds Cursor rules and CLAUDE.md guidance so agents call `trie_check_file` before editing files and read `trie://context` at conversation start.
489
60
 
490
- ```bash
491
- trie goal add "<goal>" # Set improvement goal
492
- trie goal list # View progress
493
- ```
61
+ ## CLI Commands
494
62
 
495
- ### Memory
63
+ | Command | Description |
64
+ |---------|-------------|
65
+ | `trie init` | Add Cursor/Claude rules for proactive file checks |
66
+ | `trie login` | Sign in via browser (OAuth) |
67
+ | `trie logout` | Revoke session |
68
+ | `trie teams [list\|switch <teamId>]` | List or switch teams |
69
+ | `trie pull [context\|graph\|signals\|documents\|ledger\|all]` | Fetch cloud data (JSON) |
70
+ | `trie status` | Show auth and cache status |
496
71
 
497
- ```bash
498
- trie memory search "query" # Search incident history
499
- trie memory stats # View statistics
500
- trie memory recent # Recent issues
501
- trie memory purge smart # Clean up old/resolved
502
- ```
72
+ ## MCP Tools
503
73
 
504
- ### Ledger
74
+ | Tool | Description |
75
+ |------|-------------|
76
+ | `trie_context` | Consolidated context: hot zones, graph summary, recent signals/documents |
77
+ | `trie_check_file` | Risk assessment for a file (incidents, alerts, decisions) |
78
+ | `trie_graph` | Read ANT graph from cloud |
79
+ | `trie_signals` | Read signals feed |
80
+ | `trie_documents` | Read cloud documents |
81
+ | `trie_ledger` | Read cloud ledger entries |
82
+ | `trie_search` | Natural language search over cloud context |
505
83
 
506
- ```bash
507
- trie ledger verify # Validate chain integrity
508
- trie ledger history # Show blocks with authors
509
- trie ledger stats # Block counts, entries, severity
510
- trie ledger correct <id> # Mark entry as corrected
511
- trie ledger corrections # View correction stats
512
- ```
513
-
514
- ### Sync
515
-
516
- ```bash
517
- trie sync init # Initialize shared ledger
518
- trie sync pull # Pull from shared storage
519
- trie sync push # Push to shared storage
520
- trie sync status # Show sync state
521
- trie sync hooks --install # Install auto-sync git hooks
522
- ```
84
+ ## MCP Resources
523
85
 
524
- ### Keys
86
+ | URI | Description |
87
+ |-----|-------------|
88
+ | `trie://context` | Consolidated context with hot zones and active signals |
89
+ | `trie://graph` | Raw ANT graph from cloud |
525
90
 
526
- ```bash
527
- trie keys generate # Generate Ed25519 signing key
528
- trie keys status # Check if signing is configured
529
- trie keys public # Get your public key
530
- ```
91
+ **Usage:** Agents should read `trie://context` at conversation start and call `trie_check_file` before editing high-risk files.
531
92
 
532
- ### Feedback
93
+ ## Configuration
533
94
 
534
- ```bash
535
- trie ok # Pattern is good
536
- trie bad # Pattern is bad
537
- trie pause # Disable warnings for 1 hour
538
- ```
95
+ Auth and config are stored locally (keychain-backed where available). The API base URL defaults to `https://trie-api.vercel.app` and can be overridden with `TRIE_API_BASE_URL`.
539
96
 
540
- ### Setup
97
+ ## Development
541
98
 
542
99
  ```bash
543
- trie setup # Show setup guide
544
- trie setup slack <webhook> # Configure Slack
545
- trie setup test-slack # Test Slack connection
546
- trie linear auth <key> # Configure Linear
547
- trie linear sync # Sync Linear tickets
100
+ npm install
101
+ npm run build
102
+ npm test
548
103
  ```
549
104
 
550
- ## Configuration
551
-
552
- Create `.trie/config.json`:
553
-
554
- ```json
555
- {
556
- "scanOptions": {
557
- "maxConcurrency": 4,
558
- "timeoutMs": 30000
559
- },
560
- "integrations": {
561
- "slack": {
562
- "enabled": true,
563
- "webhook": "https://hooks.slack.com/...",
564
- "channel": "#security"
565
- }
566
- },
567
- "autoEscalation": {
568
- "enabled": true,
569
- "quietHours": { "start": "21:00", "end": "08:00" }
570
- }
571
- }
572
- ```
573
-
574
- ## Troubleshooting
575
-
576
- **Trie not finding issues**: You haven't taught Trie about your patterns yet. Use `trie tell` to report incidents.
577
-
578
- **Memory queries returning empty**: Report incidents with `trie tell` or run `trie learn` to extract from git history.
579
-
580
- **Query tools not working**: Make sure you've initialized with `trie init` and have `ANTHROPIC_API_KEY` set.
581
-
582
- **Hooks not working**: Reinstall with `trie init`. Check write permissions to `.git/hooks/`.
583
-
584
- **Goals showing but not detecting violations**: Goals may not be active in project state. Run `trie goal add "<goal>"` to activate.
585
-
586
- **Quick start:**
587
- 1. Fork and clone the repository
588
- 2. `npm install`
589
- 3. Copy `.env.example` to `.env.local` and add API keys
590
- 4. `npm run build`
591
- 5. `npm test`
592
-
593
105
  **Before submitting:**
594
- - All tests pass (`npm test`)
595
- - Type checking passes (`npm run typecheck`)
596
- - Follow code style (`npm run lint`)
597
- - Update docs for new features
598
- - Never commit secrets or API keys
599
-
106
+ - Tests pass (`npm test`)
107
+ - Typecheck passes (`npm run typecheck`)
108
+ - Lint passes (`npm run lint`)
600
109
 
601
110
  ## License
602
111