@triedotdev/mcp 1.0.166 → 1.0.168

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 (79) hide show
  1. package/README.md +333 -805
  2. package/dist/chunk-2HF65EHQ.js +311 -0
  3. package/dist/chunk-2HF65EHQ.js.map +1 -0
  4. package/dist/{chunk-JNUOW2JS.js → chunk-4MXH2ZPT.js} +12 -12
  5. package/dist/chunk-4MXH2ZPT.js.map +1 -0
  6. package/dist/{chunk-LR5M4RTN.js → chunk-575YT2SD.js} +1 -1
  7. package/dist/chunk-575YT2SD.js.map +1 -0
  8. package/dist/{chunk-ZKKKLRZZ.js → chunk-5BRRRTN6.js} +4 -4
  9. package/dist/{chunk-TQOO6A4G.js → chunk-7WITSO22.js} +3 -3
  10. package/dist/{chunk-ACU2RJUJ.js → chunk-F6WFNUAY.js} +2 -2
  11. package/dist/{chunk-VR4VWXXU.js → chunk-G2TGF6TR.js} +9 -2
  12. package/dist/chunk-G2TGF6TR.js.map +1 -0
  13. package/dist/{chunk-ZBXW244P.js → chunk-HVCDY3AK.js} +3 -3
  14. package/dist/chunk-HVCDY3AK.js.map +1 -0
  15. package/dist/{chunk-HOGKPDZA.js → chunk-LQIMKE3P.js} +678 -151
  16. package/dist/chunk-LQIMKE3P.js.map +1 -0
  17. package/dist/{chunk-2Z3TQNNK.js → chunk-MRHKX5M5.js} +3 -3
  18. package/dist/{chunk-OLNZJ3XV.js → chunk-Q63FFI6D.js} +2 -2
  19. package/dist/{chunk-S36IO3EE.js → chunk-XE6KQRKZ.js} +9 -8
  20. package/dist/chunk-XE6KQRKZ.js.map +1 -0
  21. package/dist/{chunk-GDWA3CH3.js → chunk-XPZZFPBZ.js} +30 -6
  22. package/dist/chunk-XPZZFPBZ.js.map +1 -0
  23. package/dist/{chunk-JEZ7XJQN.js → chunk-XTFWT2XM.js} +2 -2
  24. package/dist/{chunk-UXRW2YSP.js → chunk-YDHUCDHM.js} +18 -112
  25. package/dist/chunk-YDHUCDHM.js.map +1 -0
  26. package/dist/{chunk-LG5CBK6A.js → chunk-YZ6Y2H3P.js} +21 -196
  27. package/dist/chunk-YZ6Y2H3P.js.map +1 -0
  28. package/dist/{chunk-MVVPJ73K.js → chunk-ZJF5FTBX.js} +126 -358
  29. package/dist/chunk-ZJF5FTBX.js.map +1 -0
  30. package/dist/cli/create-agent.js +1 -1
  31. package/dist/cli/create-agent.js.map +1 -1
  32. package/dist/cli/main.js +194 -849
  33. package/dist/cli/main.js.map +1 -1
  34. package/dist/cli/yolo-daemon.js +15 -14
  35. package/dist/cli/yolo-daemon.js.map +1 -1
  36. package/dist/{fast-analyzer-NJQO3TFD.js → fast-analyzer-XXYMOXRK.js} +3 -3
  37. package/dist/git-EO5SRFMN.js +28 -0
  38. package/dist/{github-ingester-TFBDUDIY.js → github-ingester-ZOKK6GRS.js} +3 -3
  39. package/dist/{goal-manager-DVX24UPZ.js → goal-manager-YOB7VWK7.js} +5 -4
  40. package/dist/{goal-validator-6Y5CDEMJ.js → goal-validator-ULKIBDPX.js} +5 -4
  41. package/dist/{hypothesis-UKPGOYY2.js → hypothesis-7BFFT5JY.js} +5 -4
  42. package/dist/index.js +19 -18
  43. package/dist/index.js.map +1 -1
  44. package/dist/{issue-store-UZAPI5DU.js → issue-store-ZIRP23EP.js} +4 -3
  45. package/dist/{ledger-CNFCJKHX.js → ledger-TWZTGDFA.js} +3 -2
  46. package/dist/{linear-ingester-PLES2BRS.js → linear-ingester-XXPAZZRW.js} +3 -3
  47. package/dist/{output-manager-JNMEAXFO.js → output-manager-RVJ37XKA.js} +2 -2
  48. package/dist/server/mcp-server.js +19 -18
  49. package/dist/{tiered-storage-OP74NPJY.js → tiered-storage-Z3YCR465.js} +2 -2
  50. package/dist/{trie-agent-6SWUHCVO.js → trie-agent-3YDPEGHJ.js} +9 -8
  51. package/dist/trie-agent-3YDPEGHJ.js.map +1 -0
  52. package/package.json +3 -2
  53. package/dist/chunk-GDWA3CH3.js.map +0 -1
  54. package/dist/chunk-HOGKPDZA.js.map +0 -1
  55. package/dist/chunk-JNUOW2JS.js.map +0 -1
  56. package/dist/chunk-LG5CBK6A.js.map +0 -1
  57. package/dist/chunk-LR5M4RTN.js.map +0 -1
  58. package/dist/chunk-MVVPJ73K.js.map +0 -1
  59. package/dist/chunk-S36IO3EE.js.map +0 -1
  60. package/dist/chunk-UXRW2YSP.js.map +0 -1
  61. package/dist/chunk-VR4VWXXU.js.map +0 -1
  62. package/dist/chunk-ZBXW244P.js.map +0 -1
  63. /package/dist/{chunk-ZKKKLRZZ.js.map → chunk-5BRRRTN6.js.map} +0 -0
  64. /package/dist/{chunk-TQOO6A4G.js.map → chunk-7WITSO22.js.map} +0 -0
  65. /package/dist/{chunk-ACU2RJUJ.js.map → chunk-F6WFNUAY.js.map} +0 -0
  66. /package/dist/{chunk-2Z3TQNNK.js.map → chunk-MRHKX5M5.js.map} +0 -0
  67. /package/dist/{chunk-OLNZJ3XV.js.map → chunk-Q63FFI6D.js.map} +0 -0
  68. /package/dist/{chunk-JEZ7XJQN.js.map → chunk-XTFWT2XM.js.map} +0 -0
  69. /package/dist/{fast-analyzer-NJQO3TFD.js.map → fast-analyzer-XXYMOXRK.js.map} +0 -0
  70. /package/dist/{github-ingester-TFBDUDIY.js.map → git-EO5SRFMN.js.map} +0 -0
  71. /package/dist/{goal-manager-DVX24UPZ.js.map → github-ingester-ZOKK6GRS.js.map} +0 -0
  72. /package/dist/{goal-validator-6Y5CDEMJ.js.map → goal-manager-YOB7VWK7.js.map} +0 -0
  73. /package/dist/{hypothesis-UKPGOYY2.js.map → goal-validator-ULKIBDPX.js.map} +0 -0
  74. /package/dist/{issue-store-UZAPI5DU.js.map → hypothesis-7BFFT5JY.js.map} +0 -0
  75. /package/dist/{ledger-CNFCJKHX.js.map → issue-store-ZIRP23EP.js.map} +0 -0
  76. /package/dist/{linear-ingester-PLES2BRS.js.map → ledger-TWZTGDFA.js.map} +0 -0
  77. /package/dist/{output-manager-JNMEAXFO.js.map → linear-ingester-XXPAZZRW.js.map} +0 -0
  78. /package/dist/{tiered-storage-OP74NPJY.js.map → output-manager-RVJ37XKA.js.map} +0 -0
  79. /package/dist/{trie-agent-6SWUHCVO.js.map → tiered-storage-Z3YCR465.js.map} +0 -0
package/README.md CHANGED
@@ -1,642 +1,431 @@
1
- # Trie: A trainable AI agent with a cryptographic governance ledger and portable context
1
+ # Trie: Governance ledger for agent-human teams
2
2
 
3
-
4
- **The ledger that keeps agents and humans aligned when shipping together.**
3
+ **Context that travels from Agents → CLI → CI/CD, keeping agents and humans aligned.**
5
4
 
6
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)
7
6
 
8
- ## What Trie Does
9
-
10
- Trie is governance for teams where agents and humans ship together. Every decision, direction change, and tradeoff gets recorded in a governance ledger that every contributor—human or agent—reads from and writes to, across every tool in the stack.
11
-
12
- - **Autonomous Operation**: Run `trie watch` and the agent monitors your codebase 24/7
13
- - **Intelligent Extraction**: Automatically extracts decisions, facts, blockers from every change
14
- - **Governance ledger**: Tamper-evident chain with digital signatures—the shared memory that travels from Cursor/Claude Code → CLI → CI/CD
15
- - **Predictive Intelligence**: `trie gotcha` queries the ledger to predict problems before they happen
16
- - **Continuous Learning**: Feed it incidents with `trie tell`, teach it patterns with your history
17
-
18
- The work stays coherent not because someone held it together, but because the ledger did. When any contributor flags a direction change, the ledger surfaces the relevant history instantly. When an agent acts, it does so with full context of what was decided before and why.
19
-
20
- ### The Agent Coordination Problem
21
-
22
- **The problem**: When agents and humans ship code together across Cursor, Claude Code, VS Code, and CI/CD, who's accountable for what? An agent makes a decision in one tool; a human modifies it in another; a second agent undoes both. Without a shared record, coordination becomes chaos.
7
+ ## The Problem
23
8
 
24
- **The solution**: Trie's governance ledger provides a shared source of truth that both agents and humans can trust. Every decision, every incident, every fix gets recorded with cryptographic signatures proving who (or what) made each change. When an agent queries the ledger, it gets the full context. When you review changes, you see the reasoning. When something breaks, the ledger shows you exactly what led there.
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.
25
10
 
26
- Think of it as **double-entry bookkeeping for code decisions**—not blockchain-level immutability, but tamper-evident accountability that works with Git and your existing workflow.
27
-
28
- ## Why It Matters for Agent Collaboration
29
-
30
- When agents can ship production changes, you need governance that works for both humans and AI:
31
-
32
- **Traditional tools fall short:**
11
+ **Traditional tools don't solve this:**
33
12
  - Linear tracks tasks, not decisions or reasoning
34
13
  - GitHub shows changes, not why they were made
35
14
  - Slack/Discord: context vanishes in chat history
36
- - No tool tells you if an agent's change conflicts with yesterday's decision
15
+ - No tool tells you if today's change conflicts with yesterday's decision
37
16
 
38
- **Trie's ledger provides:**
39
- - **Tamper-evident history**: Ed25519 signatures detect if entries are modified
40
- - **Automatic recording**: Agents and humans write to the same ledger
41
- - **Cross-tool context**: Works in Cursor, CLI, CI/CD, MCP servers
42
- - **Accountability**: See who (human or agent) made each decision and when
43
- - **Pattern learning**: Every incident makes the system smarter
17
+ ## The Solution
44
18
 
45
- The ledger ensures nothing is lost. When an agent queries it, answers come with full provenance. When you review changes, you see the reasoning trail. When something breaks, the audit trail is already there.
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.
46
20
 
47
- ### How the Agent Works
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
48
25
 
49
- 1. **`trie watch`** - Start the agent, it monitors your codebase autonomously
50
- 2. **Agent Extracts** - Every file change → extract decisions, facts, blockers
51
- 3. **Agent Stores** - Builds decision ledger with signatures and metadata
52
- 4. **`trie gotcha`** - Agent queries ledger to predict problems in your current changes
53
- 5. **`trie tell`** - Feed agent incidents to improve its predictions
54
- 6. **Agent Learns** - Gets better at predicting what matters in YOUR codebase
55
-
56
- Your decisions persist across tools. Your edge cases don't get forgotten. The ledger keeps agents and humans aligned—so you ship the right thing every time.
26
+ Think of it as **double-entry bookkeeping for code decisions**—tamper-evident accountability that works with Git and your existing workflow.
57
27
 
58
28
  ## Quick Start
59
29
 
60
- ### 1. Install Trie
61
-
62
- Make sure you have Node.js installed, then:
30
+ ### Install
63
31
 
64
32
  ```bash
65
- # Install Trie globally
66
33
  npm install -g trie
67
-
68
- # Set up in your project
69
34
  cd your-project
70
35
  trie init
71
-
72
- # Configure integrations
73
- trie setup # Show setup guide
74
- trie setup slack <webhook> # Set up Slack notifications
75
36
  ```
76
37
 
77
- ### 2. Start Teaching Trie
78
-
79
- When bugs happen, tell Trie about them:
38
+ ### Basic Workflow
80
39
 
81
40
  ```bash
82
- # Report a specific incident (extracts structured signals)
41
+ # 1. Report incidents as they happen
83
42
  trie tell "Users can't log in after password reset"
84
43
 
85
- # Train Trie from your history (reverts/bugfixes)
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
86
51
  trie learn
87
52
 
88
- # Give feedback on predictions
53
+ # 5. Give feedback
89
54
  trie ok # Prediction was helpful
90
55
  trie bad # Prediction was wrong
91
56
  ```
92
57
 
93
- ## Why Trie Exists
94
-
95
- The real challenge isn't generating code—it's governance. When some of your teammates are agents and you're working with multiple humans, context fragments. An agent makes a decision in Cursor, a human forgets it in Claude Code, another agent ships something that breaks what you fixed last week. You're not just maintaining a codebase—you're coordinating a mixed team where work happens across tools, models, and people.
96
-
97
- The ledger is the answer. Trie keeps a tamper-evident record of decisions, incidents, and tradeoffs so everyone—human and agent—stays compliant with what you've already learned. Ship the right thing every time. That's the competitive advantage. Software margins are compressing; pure application software is becoming a fundamentally different, worse category. The teams that can coordinate agents and humans, that can scale contributors without losing coherence, will win.
98
-
99
- Cursor is building toward self-driving codebases—agents that merge PRs, manage rollouts, and monitor production. We're moving from a world where developers use agents to create diffs to one where agents ship tested features end-to-end. The closer we march toward self-driving systems and AGI, the more important governance becomes. That shift requires tooling that coordinates work across many agents and models that learn from past runs. Trie is optimized for coordination and collaboration with both humans and agents. It keeps your work compliant, scales your contributors (human and AI), and turns your decision history into durable institutional knowledge.
100
-
101
- Tools like Cursor Bugbot flag issues—but flagging doesn't help you avoid similar patterns in the future. Trie remembers what broke, learns across projects, and warns before you ship risky code. You end up architecting better and prompting better because the ledger enforces coherence.
102
-
103
- ## Key Features
58
+ ## Core Features
104
59
 
105
- ### Built for Agent + Human Collaboration
60
+ ### 1. Autonomous Monitoring (`trie watch`)
106
61
 
107
- - **Shared governance ledger** - Single source of truth that agents and humans both read from and write to
108
- - **Digital signatures** - Ed25519 signatures prove who (human or agent) created each entry (`trie keys generate`)
109
- - **Accountability trail** - See exactly what decisions agents made and when, verify authenticity
110
- - **Cross-tool context** - Works in Cursor, Claude Code, CLI, CI/CD—same ledger everywhere
111
- - **Tamper detection** - Signatures and Git history make modifications visible
112
- - **No coordination needed** - Agents and humans write concurrently; Git handles conflicts
62
+ Real-time agent that monitors your codebase and enforces custom rules:
113
63
 
114
- ### Governance That Scales
115
-
116
- - **Tamper-evident ledger** - Append-only chain with cryptographic signatures (not blockchain, think double-entry bookkeeping)
117
- - **Correction pattern** - Entries never deleted, only marked as corrected with full audit trail
118
- - **Decision memory** - Captures architectural choices, tradeoffs, and context across all tools
119
- - **Judgment artifacts** - Not just what shipped, but why, what was considered, and who (or what) decided
120
- - **Git integration** - Auto-commits ledger changes; distributed backup via Git history
121
-
122
- ### Intelligence That Compounds
123
-
124
- - **Predictive analysis** - `trie gotcha` queries the ledger to predict problems before they happen
125
- - **Pattern recognition** - Identifies recurring issues and edge cases from your actual incident history
126
- - **Cross-project learning** - Patterns discovered in one project help prevent bugs in others
127
- - **System coherence** - Tracks relationships between files, changes, incidents, fixes, and decisions
128
- - **Continuous learning** - Gets better at predicting what matters in YOUR codebase over time
129
-
130
- ### Integration Built for Speed
131
-
132
- - **Multiple interfaces** - CLI, MCP tools for Claude/Cursor, visual dashboards
133
- - **Git hooks** - Automatic checks before commits and pushes
134
- - **Watch mode** - Real-time monitoring while you code
135
- - **Fast performance** - Sub-500ms checks, won't slow down your workflow
136
- - **Flexible workflow** - Works with any editor, any git workflow, any deployment setup
137
-
138
- ## How It Works
139
-
140
- ### Memory Architecture
141
-
142
- Trie maintains two complementary memory systems that work together to provide both fast queries and tamper-evident governance:
143
-
144
- **1. Governance Ledger** (`.trie/memory/ledger.json`)
145
- - **Purpose**: Cryptographic chain of what was detected and when
146
- - **Properties**: Append-only, tamper-evident, never deleted
147
- - **Used for**: Audit trail, compliance, historical analysis, gotcha predictions
148
- - **Immutability**: Entries are marked as corrected, not deleted (see [Ledger Corrections](./docs/LEDGER_CORRECTIONS.md))
149
-
150
- **2. Issue Memory** (`.trie/memory/issues/`)
151
- - **Purpose**: Fast searchable cache of detected issues
152
- - **Properties**: Queryable, can be compacted and purged
153
- - **Used for**: `trie memory search`, pattern recognition, recent issue queries
154
- - **Lifecycle**: Subject to capacity limits; cleaned up via `trie memory purge` strategies
155
-
156
- Both systems sync across your team and travel with your codebase. The `.trie/` folder commits with your code, so your project's intelligence is preserved and shared across:
157
-
158
- Local development
159
- CI/CD pipelines
160
- Team members
161
- Cursor/Claude/VS Code
162
- Git hooks
163
-
164
- ### File Structure
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"
165
69
 
70
+ # Start watching
71
+ trie watch
166
72
  ```
167
- your-project/
168
- ├── .trie/
169
- │ ├── hot/ # In-memory current session
170
- │ ├── warm/ # Queryable governance DB
171
- │ │ └── decisions.db # SQLite database
172
- │ ├── cold/ # Archived history
173
- │ ├── memory/ # Issue cache + ledger.json (cryptographic ledger)
174
- │ ├── patterns/ # Learned patterns
175
- │ ├── context.json # Project knowledge graph
176
- │ └── config.json # Settings
177
- ├── .trie-shared/ # Shared ledger for team sync (optional)
178
- │ ├── active/ # Recent blocks
179
- │ ├── archived/ # Compressed old blocks
180
- │ └── ledger-manifest.json
181
- ├── src/
182
- └── .git/
183
- ```
184
-
185
- ### Decision Memory Across Tools
186
-
187
- Trie solves the context-across-tools problem with a **cryptographic governance ledger**: an append-only, tamper-evident chain of blocks that stores decisions, incidents, fixes, and tradeoffs. Every tool—Cursor, Claude, VS Code, CLI, CI/CD—reads from the same ledger in `.trie/`, so there is no context fragmentation.
188
-
189
- - **Decision nodes** store why you made certain choices and what tradeoffs were considered
190
- - **Cross-tool access** - Cursor, Claude, VS Code, CLI, and CI/CD all read from the same `.trie/` folder
191
- - **Context trail** - Knows which environment ran which analysis and when
192
- - **Relationship tracking** - Files ↔ Changes ↔ Incidents ↔ Fixes ↔ Decisions
193
-
194
- When you switch from Cursor to Claude Code to terminal—or when different agents and humans work in parallel—Trie remembers. Every tool shares the same ledger, so governance stays consistent.
195
-
196
- ### Signal Extraction: Context Without Pollution
197
-
198
- The Problem: Agents drown in raw data. Dumping 10,000 lines of logs, 500 Slack messages, and 200 commits into context is expensive and ineffective.
199
-
200
- **Trie's Solution**: Extract signal, not noise.
201
-
202
- #### Three-Tier Storage
203
-
204
- | Tier | What's Stored | Purpose |
205
- |------|---------------|---------|
206
- | **HOT** (In-Memory) | Current session data, active decisions | Instant access during work |
207
- | **WARM** (SQLite DB) | Recent decisions, facts, blockers | Query what you need: *"payment decisions in last 30 days"* |
208
- | **COLD** (Archived) | Full history, indexed but dormant | Auto-archives after 90 days of low access |
209
73
 
210
- #### How Extraction Works
211
-
212
- 1. **Raw Input** You report an incident or commit code
213
- 2. **Extraction** Cheap model (Haiku) pulls out structured signals:
214
- - **Decisions**: "Chose bcrypt over sha256 for password hashing"
215
- - **Facts**: "Stripe requires TLS 1.2+ for EU transactions"
216
- - **Blockers**: "Missing VAT validation blocks EU checkout"
217
- - **Questions**: "Should we cache session tokens?"
218
-
219
- 3. **Storage** → Structured data goes to WARM storage with embeddings
220
- 4. **Query** → Agents ask: `trie_get_decisions(relatedTo: "payments")`
221
- 5. **Targeted Context** → Agent gets 5 relevant decisions, not 5,000 raw logs
222
-
223
- #### MCP Query Tools
224
-
225
- Agents don't get dumps—they query for what they need:
226
-
227
- ```typescript
228
- // Agent queries decision ledger
229
- trie_get_decisions({
230
- relatedTo: "checkout/validator.ts",
231
- since: "30d",
232
- limit: 5
233
- })
74
+ **Features:**
75
+ - Interactive dashboard with goals, memory, and analysis activity
76
+ - AI-powered goal checking using semantic understanding (not just keywords)
77
+ - Token-aware to manage AI costs
78
+ - Smart caching to avoid duplicate scans
79
+ - Real-time nudges when violations are detected
234
80
 
235
- // Returns targeted context:
236
- // 1. "Always validate email before Stripe checkout" (3 weeks ago)
237
- // 2. "EU customers need VAT validation" (2 months ago)
81
+ Run in background with screen or tmux:
82
+ ```bash
83
+ screen -S trie-watch
84
+ trie watch
85
+ # Detach: Ctrl+A then D
86
+ # Reattach: screen -r trie-watch
238
87
  ```
239
88
 
240
- Why this matters: context management IS the product. Agents get the right information at the right moment, not everything dumped at once.
241
-
242
- ## Core Workflow
243
-
244
- ### 0. Planning Phase
89
+ ### 2. Predictive Analysis (`trie gotcha`)
245
90
 
246
- **Start every complex task by checking Trie first.** Just like starting in plan mode helps Claude 1-shot implementation, checking Trie before coding helps you avoid known pitfalls:
91
+ Predicts problems before you ship based on your actual incident history:
247
92
 
248
93
  ```bash
249
- # Before starting work on a feature, check what broke before
250
- trie gotcha # Predict risks for current changes
251
- trie memory search "payments" # See past incidents in this area
252
- trie status # Check overall project health
94
+ # Check current changes for risks
95
+ trie gotcha
253
96
 
254
- # Review past decisions and tradeoffs
255
- # Trie's Context Graph remembers why you made choices and what happened
97
+ # Connect to Linear for JIT defect prediction
98
+ trie linear auth <your-api-key>
99
+ trie linear sync
256
100
  ```
257
101
 
258
- Pro tip: The moment something goes sideways, check Trie again. Don't keep pushing—re-plan with historical context. Trie shows you what broke before, what decisions were made, and what edge cases caused issues. Use that knowledge to inform your plan, then let your AI tools implement it.
102
+ Trie warns you if your current changes correlate with:
103
+ - Historical regressions in the same files
104
+ - High-risk patterns from past incidents
105
+ - Active tickets that might conflict
259
106
 
260
- ### 1. Teaching Phase
107
+ ### 3. Governance Ledger
261
108
 
262
- ```bash
263
- # Something breaks in production
264
- trie tell "Payment processing failed for EU customers"
109
+ Tamper-evident record of all decisions, incidents, and fixes:
265
110
 
266
- # Trie learns: "payments/" + "EU" + "failed" = high risk pattern
267
- # Also records: decision context, affected files, tradeoffs made
268
- ```
111
+ **Architecture:**
112
+ - **Governance ledger** (`.trie/memory/ledger.json`) - Append-only chain with Ed25519 signatures
113
+ - **Issue memory** (`.trie/memory/issues.json`) - Fast searchable cache
269
114
 
270
- ### 2. Prevention Phase
115
+ **Key properties:**
116
+ - Never deleted, only corrected (full audit trail)
117
+ - Digital signatures prove who (human or agent) created each entry
118
+ - Auto-commits to Git for distributed backup
119
+ - Works across Cursor, CLI, CI/CD—same ledger everywhere
271
120
 
121
+ **Setup signing:**
272
122
  ```bash
273
- # Later, you modify payment code
274
- git add src/payments/eu-handler.js
275
- git commit -m "Update EU payment logic"
276
-
277
- # Trie warns: "This area broke 2 weeks ago with EU payments. Consider extra testing."
278
- # Context: Remembers the decision you made last time, the edge case that caused the issue
123
+ trie keys generate # Generate Ed25519 signing key
124
+ trie keys status # Check if signing is configured
279
125
  ```
280
126
 
281
- ### 3. Feedback Loop
282
-
127
+ **Ledger commands:**
283
128
  ```bash
284
- # Warning was helpful
285
- trie ok
286
-
287
- # Warning was wrong
288
- trie bad
289
-
290
- # Trie adjusts confidence for similar future warnings
291
- # Also updates: decision patterns, edge case recognition, tradeoff understanding
129
+ trie ledger verify # Validate chain integrity
130
+ trie ledger history # Show blocks with author attribution
131
+ trie ledger stats # Block counts, entries, severity breakdown
292
132
  ```
293
133
 
294
- ### 4. Governance Phase
295
-
296
- This is where Trie shines. As your team grows—more humans, more agents, more tools:
297
-
134
+ **Corrections (not deletions):**
298
135
  ```bash
299
- # Working in Cursor, an agent makes a decision about error handling
300
- # Trie records it in the ledger
136
+ # Mark false positive
137
+ trie ledger correct <entry-id> -r "Expected behavior" -t false-positive
301
138
 
302
- # A teammate switches to Claude Code later
303
- # Same ledger, same decisions, same compliance
304
-
305
- # Push from terminal
306
- # Git hooks check against your full history of decisions and incidents
139
+ # Mark as fixed
140
+ trie ledger correct <entry-id> -r "Fixed in commit abc123"
307
141
 
308
- # CI/CD runs
309
- # Same checks, same memory, same coherence
142
+ # View correction stats
143
+ trie ledger corrections
310
144
  ```
311
145
 
312
- Edge cases, tradeoffs, and system coherence—Trie handles governance by remembering what was decided, why it was decided, and what happened as a result. When agents and humans ship together, the ledger keeps everyone compliant.
313
-
314
- ## Advanced Features
146
+ ## Integrations
315
147
 
316
- ### Goals & Hypotheses
148
+ | Integration | Setup | Purpose |
149
+ |-------------|-------|---------|
150
+ | **Linear** | `trie linear auth <key>` | JIT defect prediction from active tickets |
151
+ | **GitHub** | Set `GITHUB_TOKEN` env var | Sync PRs and issues into context graph |
152
+ | **Slack** | `trie setup slack <webhook>` | Team notifications for critical issues |
153
+ | **Cursor Cloud** | Set `CURSOR_API_KEY` | Verified automated fixes via cloud agent |
317
154
 
318
- Set improvement goals and test theories. **Goals are actively enforced in real-time** as you code:
155
+ ### Linear Integration
319
156
 
320
157
  ```bash
321
- # Set a goal - any custom rule you want enforced
322
- trie goal add "No console.log statements in production"
323
- trie goal add "All API endpoints must have rate limiting"
324
- trie goal add "We never truncate text in UI components"
325
-
326
- # Add a hypothesis
327
- trie hypothesis add "Code reviews reduce bug rate"
328
-
329
- # View progress
330
- trie goal list
158
+ trie linear auth <your-api-key>
159
+ trie linear sync
331
160
  ```
332
161
 
333
- **How Goal Checking Works:**
334
-
335
- When you run `trie watch`, the system actively monitors your code for goal violations using AI-powered analysis:
336
-
337
- 1. **Custom & Flexible** - Goals can be any quality rule you define (no emojis, no TODOs, security patterns, UI standards, etc.)
338
- 2. **RAG-Based** - Uses semantic understanding, not just keyword matching
339
- 3. **Real-Time** - Checks every file change against ALL active goals
340
- 4. **Smart Caching** - Avoids re-scanning unchanged files
341
- 5. **Cost-Aware** - Token budgets and cooldowns prevent runaway AI costs
342
- 6. **High Confidence** - Only reports violations with strong confidence scores
343
-
344
- **Example Goal Violations Detected:**
345
- - "No emojis in code" → Finds any Unicode emoji anywhere in files
346
- - "All functions must have JSDoc" → Checks for missing documentation
347
- - "No inline styles in React" → Detects style attributes in JSX
348
- - "Every TODO must have a ticket reference" → Validates TODO format
349
-
350
- Goals are tracked over time with metrics (violations caught, fixed, progress percentage).
162
+ Or via MCP: `trie_linear_sync` — syncs tickets into the context graph for gotcha predictions.
351
163
 
352
- ### Watch Mode
164
+ ### GitHub Integration
353
165
 
354
- Real-time monitoring with **proactive goal violation detection**:
166
+ Sync open PRs and issues into the context graph:
355
167
 
356
168
  ```bash
357
- trie watch
169
+ # Via MCP (Cursor/Claude)
170
+ trie_github_sync
171
+ trie_github_branches # See which branch has latest updates
358
172
  ```
359
173
 
360
- **Features:**
361
- - **Interactive dashboard** with goals, memory, analysis activity panels
362
- - **AI-powered goal checking** - automatically detects violations of your custom rules
363
- - **Token-aware** - manages AI costs with budgets and cooldowns
364
- - **Smart prioritization** - focuses on high-risk files first
365
- - **Caching** - avoids duplicate scans of unchanged files
366
- - **Real-time nudges** - immediate feedback when violations are detected
174
+ Requires `GITHUB_TOKEN` (repo scope for private repos, public_repo for public).
367
175
 
368
- Running in Background: To keep trie watch running in the background, use screen or tmux:
176
+ ### Slack Integration
369
177
 
370
178
  ```bash
371
- # Using screen
372
- screen -S trie-watch
373
- trie watch
374
- # Press Ctrl+A then D to detach
375
- # Reattach with: screen -r trie-watch
179
+ # Show setup guide
180
+ trie setup slack
376
181
 
377
- # Using tmux
378
- tmux new -s trie-watch
379
- trie watch
380
- # Press Ctrl+B then D to detach
381
- # Reattach with: tmux attach -t trie-watch
182
+ # Configure webhook
183
+ trie setup slack <webhook-url> [#channel]
184
+
185
+ # Test connection
186
+ trie setup test-slack
382
187
  ```
383
188
 
384
- This allows you to keep the agent running while using other terminals. The interactive dashboard will be available when you reattach.
189
+ Or manually add to `.trie/config.json`:
190
+ ```json
191
+ {
192
+ "integrations": {
193
+ "slack": {
194
+ "enabled": true,
195
+ "webhook": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
196
+ "channel": "#security"
197
+ }
198
+ }
199
+ }
200
+ ```
385
201
 
386
- ### JIT Defect Prediction ("Gotchas")
202
+ ### Cursor Cloud Agent
387
203
 
388
- Trie connects to your issue tracker and project history to predict problems while you work:
204
+ Dispatch high-risk issues to Cursor's cloud for verified, test-passing fixes:
389
205
 
390
206
  ```bash
391
- # 1. Connect Linear
392
- trie linear auth <your-api-key>
393
- trie linear sync
207
+ # Via MCP
208
+ trie_cloud_fix action:configure apiKey:"key-..."
209
+ trie_cloud_fix action:dispatch issueIds:["issue-1"]
394
210
 
395
- # 2. Learn from history automatically
396
- trie learn
211
+ # Force cloud dispatch (bypass triage)
212
+ trie_cloud_fix action:dispatch forceCloud:true
397
213
 
398
- # 3. Predict for current changes
399
- trie gotcha
214
+ # Ad-hoc dispatch
215
+ trie_cloud_fix action:dispatch file:"src/auth.ts" issue:"SQL injection" fix:"Use parameterized queries"
400
216
  ```
401
217
 
402
- Trie will warn you if your current task correlates with historical regressions or high-risk signatures.
218
+ The cloud agent runs in an isolated VM, applies the fix, runs tests, captures screenshots, and opens a PR.
403
219
 
404
- ### Integrations: Linear, GitHub & Cursor Cloud Agent
220
+ ### Pipeline View
405
221
 
406
- **Linear** Sync active tickets for JIT defect prediction:
222
+ See work across Linear, GitHub, and Trie in one place:
407
223
 
408
224
  ```bash
409
- trie linear auth <your-api-key>
410
- trie linear sync
225
+ # Via MCP
226
+ trie_pipeline # Full status: tickets, PRs, issues
227
+ trie_pipeline action:coverage # Only Trie issues with no ticket/PR
228
+ trie_pipeline action:create_tickets issueIds:["id1","id2"] # Open tickets
411
229
  ```
412
230
 
413
- Or via MCP: `trie_linear_sync` — syncs tickets into the context graph for gotcha predictions.
231
+ ## AI Tool Integration (MCP)
414
232
 
415
- **GitHub** Sync open PRs and issues into the context graph:
233
+ Trie provides Model Context Protocol tools for Claude, Cursor, and AI assistants.
416
234
 
417
- ```bash
418
- # Via MCP (Cursor/Claude)
419
- trie_github_sync
420
- ```
235
+ ### Setup for Cursor/Claude
421
236
 
422
- Links PRs to changed files and to Linear tickets mentioned in PR descriptions. Requires `GITHUB_TOKEN` (repo scope for private repos, public_repo for public).
237
+ Add to your MCP settings:
423
238
 
424
- **Cursor Cloud Agent** — Dispatch high-risk issues to Cursor's cloud for verified, test-passing fixes:
239
+ ```json
240
+ {
241
+ "mcpServers": {
242
+ "trie": {
243
+ "command": "trie",
244
+ "args": ["mcp"],
245
+ "env": {
246
+ "ANTHROPIC_API_KEY": "your-api-key",
247
+ "LINEAR_API_KEY": "your-key",
248
+ "GITHUB_TOKEN": "your-token",
249
+ "CURSOR_API_KEY": "your-cursor-key"
250
+ }
251
+ }
252
+ }
253
+ }
254
+ ```
425
255
 
426
- ```bash
427
- # Via MCP
428
- trie_cloud_fix action:configure apiKey:"key-..."
429
- trie_cloud_fix action:dispatch issueIds:["issue-1", "issue-2"]
256
+ ### Available Tools
430
257
 
431
- # Force cloud dispatch (bypass triage when user explicitly wants cloud)
432
- trie_cloud_fix action:dispatch forceCloud:true
258
+ **Core:**
259
+ - `trie_tell` - Report incidents and extract structured signals
260
+ - `trie_check` - Quick risk assessment
261
+ - `trie_watch` - Start/stop autonomous monitoring
262
+ - `trie_memory` - Search incident history
263
+ - `trie_fix` - Apply fixes (use `action:route` to see triage plan)
264
+ - `trie_cloud_fix` - Dispatch to Cursor cloud agent
433
265
 
434
- # Ad-hoc dispatch (no scan issues — e.g. from trie_propose_fix)
435
- trie_cloud_fix action:dispatch file:"src/storage/tiered-storage.ts" issue:"Concurrent file writes corrupt ledger" fix:"Add file locking and atomic writes"
436
- ```
266
+ **Integrations:**
267
+ - `trie_linear_sync` - Sync active Linear tickets
268
+ - `trie_github_sync` - Sync open PRs and issues
269
+ - `trie_github_branches` - Fetch branches with latest commits
270
+ - `trie_pipeline` - Consolidated view of tickets, PRs, issues
437
271
 
438
- The cloud agent runs in an isolated VM, applies the fix, runs tests, captures screenshots, and opens a PR. Requires `CURSOR_API_KEY`. Use `trie_fix action:route` first to see which issues qualify. Add `forceCloud:true` to bypass triage when you explicitly want cloud.
272
+ **Query Tools (Targeted Context):**
273
+ - `trie_get_governance` - Query decisions with filters
274
+ - `trie_get_blockers` - Get active blockers only
275
+ - `trie_get_nudges` - Get unresolved goal violations
276
+ - `trie_get_related_governance` - Find related context
277
+ - `trie_query_context` - Natural language queries across all signals
439
278
 
440
- ### Fix Triage System
279
+ **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.
441
280
 
442
- Trie routes each issue to one of three fix strategies based on a scoring system:
281
+ ## Advanced Features
443
282
 
444
- | Strategy | When | Action |
445
- |----------|------|--------|
446
- | **inline-auto** | Trivial, auto-fixable (score < 0) | Apply fix automatically |
447
- | **local-ai** | Moderate risk (score 0–3) | `trie_fix` — local AI applies fix |
448
- | **cloud-agent** | High risk (score ≥ 4) | `trie_cloud_fix` — Cursor cloud agent |
283
+ <details>
284
+ <summary><b>Goals & Custom Rules</b></summary>
449
285
 
450
- Scoring signals: Issue shape (effort, severity, CWE, OWASP), code context (tests, auth/crypto/payments), occurrence history (how often seen), pipeline context (linked PR/ticket), and user config.
286
+ Set improvement goals that are actively enforced in real-time:
451
287
 
452
288
  ```bash
453
- # See routing plan before applying
454
- trie_fix action:route
455
- ```
289
+ # Add goals
290
+ trie goal add "No hardcoded API keys"
291
+ trie goal add "All async functions must handle errors"
292
+ trie goal add "Every TODO must have a ticket reference"
456
293
 
457
- ### Pipeline View
458
-
459
- Get a consolidated view of your work across Linear, GitHub, and Trie:
294
+ # View progress
295
+ trie goal list
460
296
 
461
- ```bash
462
- # Via MCP
463
- trie_pipeline # Full status: tickets, PRs, issues, coverage gaps
464
- trie_pipeline action:coverage # Only Trie issues with no ticket/PR
465
- trie_pipeline action:create_tickets issueIds:["id1","id2"] # Open Linear tickets for uncovered issues
297
+ # Get unresolved violations
298
+ trie_get_nudges # Via MCP
466
299
  ```
467
300
 
468
- ### Cryptographic Governance Ledger
301
+ Goals use AI-powered semantic understanding to catch violations, not just keyword matching.
469
302
 
470
- Trie uses a **chain-of-blocks ledger** for tamper-evident incident history and team sync. The ledger transforms from isolated per-developer chains into a collaborative, distributed cryptographic ledger that scales to teams while maintaining integrity.
303
+ </details>
471
304
 
472
- **Architecture:**
473
- - **Chained blocks** — Each block links to the previous via hash; genesis block starts the chain
474
- - **Merkle roots** — Block contents hashed for integrity verification
475
- - **Author attribution** — Each block records who added it; git commit correlation for developer attribution
476
- - **Version 2 format** — Syncable blocks with backwards compatibility for v1 ledgers
305
+ <details>
306
+ <summary><b>Fix Triage System</b></summary>
477
307
 
478
- **Shared storage** (`.trie-shared/`):
308
+ Trie routes each issue to one of three fix strategies:
479
309
 
480
- ```
481
- .trie-shared/
482
- ├── ledger-manifest.json # Global chain metadata + index
483
- ├── active/ # Hot storage (recent blocks)
484
- │ ├── 2024-01-20.json
485
- │ └── 2024-01-21.json
486
- └── archived/ # Cold storage (compressed)
487
- ├── 2024-01.tar.gz # Monthly archives
488
- └── 2023-12.tar.gz
489
- ```
310
+ | Strategy | When | Action |
311
+ |----------|------|--------|
312
+ | **inline-auto** | Trivial fixes (score < 0) | Apply automatically |
313
+ | **local-ai** | Moderate risk (score 0–3) | `trie_fix` — local AI applies fix |
314
+ | **cloud-agent** | High risk (score ≥ 4) | `trie_cloud_fix` — Cursor cloud agent |
490
315
 
491
- **Compression & scalability:**
492
- - Automatic archiving after 30 days
493
- - gzip compression with configurable levels (90%+ space savings)
494
- - Hot/cold storage tiers; lazy loading of archived content
316
+ See routing plan before applying:
317
+ ```bash
318
+ trie_fix action:route
319
+ ```
495
320
 
496
- **Conflict resolution:** Divergent chains merge with timestamp or longest-chain strategy; entry deduplication across developer chains.
321
+ </details>
497
322
 
498
- **Git integration:** Auto-sync via `trie sync hooks --install` — pre-push and post-merge hooks keep local and shared ledgers in sync. Commit correlation and developer attribution from git history.
323
+ <details>
324
+ <summary><b>Team Sync (Shared Ledger)</b></summary>
499
325
 
500
- **Backwards compatibility:** Automatic migration of v1 ledgers; legacy detection and zero-data-loss upgrade.
326
+ Sync ledger blocks across your team:
501
327
 
502
328
  ```bash
503
- # Sync commands
504
329
  trie sync init # Initialize shared storage
505
- trie sync pull # Pull shared updates (auto-migrates legacy)
330
+ trie sync pull # Pull shared updates
506
331
  trie sync push # Push local changes
507
- trie sync status # Show sync state, conflicts
508
- trie sync migrate # Manually migrate legacy v1 ledger
509
- trie sync hooks --install # Install pre-push/post-merge auto-sync hooks
510
-
511
- # Ledger commands
512
- trie ledger verify # Validate chain integrity
513
- trie ledger history # Show chain with author attribution
514
- trie ledger stats # Block counts, entries, severity breakdown
515
- trie ledger diff # Compare local vs shared
516
- trie ledger compress # Manually archive old blocks
517
- trie ledger storage # Detailed storage usage stats
332
+ trie sync status # Show sync state
333
+ trie sync hooks --install # Install auto-sync git hooks
518
334
  ```
519
335
 
520
- ### Integration with AI Coding Tools
521
-
522
- Trie provides MCP (Model Context Protocol) tools for seamless integration with Claude, Cursor, and other AI assistants:
336
+ The shared ledger lives in `.trie-shared/` with hot/cold storage tiers and automatic compression.
523
337
 
524
- **Core Tools:**
525
- trie_tell - Report incidents and extract structured signals
526
- trie_check - Quick risk assessment
527
- trie_memory - Search incident history
528
- trie_fix - Apply suggested fixes (use action:route to see triage plan)
529
- trie_cloud_fix - Dispatch to Cursor cloud agent for verified fixes
338
+ </details>
530
339
 
531
- **Integration Tools:**
532
- trie_linear_sync - Sync active Linear tickets
533
- trie_github_sync - Sync open PRs and issues from GitHub
534
- trie_github_branches - Fetch branches with latest commit info (which branch has latest updates)
535
- trie_pipeline - Consolidated view of tickets, PRs, issues, coverage gaps
340
+ <details>
341
+ <summary><b>Memory Management</b></summary>
536
342
 
537
- **Query Tools (Signal Extraction):**
538
- trie_get_decisions - Query decisions with filters (tags, time, file)
539
- trie_get_blockers - Get active blockers only
540
- trie_get_related_decisions - Find related context
541
- trie_query_context - Natural language queries across all signal types
343
+ ```bash
344
+ # Search incident history
345
+ trie memory search "authentication"
346
+ trie memory stats
347
+ trie memory recent
542
348
 
543
- **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 on relevant signal.
349
+ # Clean up old issues (doesn't affect immutable ledger)
350
+ trie memory purge smart # Remove resolved & old low-priority
351
+ trie memory purge resolved # All resolved issues
352
+ trie memory purge old # Older than 90 days
353
+ ```
544
354
 
545
- ## Installation & Setup
355
+ </details>
546
356
 
547
- ### Requirements
357
+ <details>
358
+ <summary><b>Git Hooks</b></summary>
548
359
 
549
- Node.js 16 or higher
550
- Git repository
360
+ Installed automatically with `trie init`:
551
361
 
552
- ### Installation
362
+ - **pre-commit** - Scan staged files, block on critical issues
363
+ - **post-commit** - Update context graph
364
+ - **pre-push** - Block push on critical issues
553
365
 
366
+ **Bypass methods:**
554
367
  ```bash
555
- # Install globally
556
- npm install -g trie
557
-
558
- # Or use npx for one-time runs
559
- npx trie watch
368
+ git push --no-verify # Skip all hooks
369
+ TRIE_BYPASS=1 git push # Skip Trie but log bypass
560
370
  ```
561
371
 
562
- ### Project Setup
372
+ </details>
563
373
 
564
- ```bash
565
- # Initialize in your project
566
- cd your-project
567
- trie init
568
-
569
- # This creates:
570
- # - .trie/ directory with initial config
571
- # - Git hooks for automatic checking
572
- # - Bootstrap files (optional)
573
- ```
574
-
575
- ### API Key Configuration
374
+ ## How It Works
576
375
 
577
- Trie works best with these keys:
376
+ ### Memory Architecture
578
377
 
579
- ANTHROPIC_API_KEY: Enables AI-powered analysis and explanations.
580
- LINEAR_API_KEY: Enables JIT defect prediction by syncing your active tickets.
378
+ Trie maintains two complementary memory systems:
581
379
 
582
- #### 1. Set via Environment (Recommended for MCP)
380
+ **1. Governance Ledger** (`.trie/memory/ledger.json`)
381
+ - Append-only chain with Ed25519 signatures
382
+ - Tamper-evident, never deleted (only corrected)
383
+ - Used for: audit trail, compliance, gotcha predictions
384
+ - Auto-commits to Git for distributed backup
583
385
 
584
- Add these to your .env file or shell config:
386
+ **2. Issue Memory** (`.trie/memory/issues.json`)
387
+ - Fast searchable cache of detected issues
388
+ - Can be compacted and purged
389
+ - Used for: pattern recognition, quick queries
390
+ - Links back to ledger via `ledgerBlockHash`
585
391
 
586
- ```bash
587
- export ANTHROPIC_API_KEY=sk-ant-...
588
- export LINEAR_API_KEY=lin_api_...
589
- ```
392
+ Both systems sync across your team and travel with your codebase via Git.
590
393
 
591
- #### 2. Set via CLI (Persistent per project)
394
+ ### File Structure
592
395
 
593
- ```bash
594
- trie linear auth <your-key>
595
396
  ```
596
-
597
- #### 3. Set in MCP Config (Cursor/Claude Code)
598
-
599
- Add to your MCP server configuration:
600
-
601
- ```json
602
- {
603
- "mcpServers": {
604
- "trie": {
605
- "command": "npx",
606
- "args": ["-y", "@triedotdev/mcp"],
607
- "env": {
608
- "ANTHROPIC_API_KEY": "your-key",
609
- "LINEAR_API_KEY": "your-key"
610
- }
611
- }
612
- }
613
- }
397
+ your-project/
398
+ ├── .trie/
399
+ │ ├── memory/
400
+ │ │ ├── ledger.json # Governance ledger (cryptographic chain)
401
+ │ │ └── issues.json # Issue cache
402
+ │ ├── warm/
403
+ │ │ └── decisions.db # SQLite database for structured queries
404
+ │ ├── context.json # Project knowledge graph
405
+ │ ├── config.json # Settings
406
+ │ └── keys/ # Ed25519 signing keys (never committed)
407
+ ├── .trie-shared/ # Shared ledger for team sync (optional)
408
+ │ ├── active/
409
+ │ ├── archived/
410
+ │ └── ledger-manifest.json
411
+ └── .git/
614
412
  ```
615
413
 
616
- ### AI Tool Integration
414
+ ### Signal Extraction
617
415
 
618
- For Claude (MCP): Add to your MCP settings:
416
+ Instead of dumping raw logs into context, Trie extracts structured signals:
619
417
 
620
- ```json
621
- {
622
- "mcpServers": {
623
- "trie": {
624
- "command": "trie",
625
- "args": ["mcp"],
626
- "env": {
627
- "ANTHROPIC_API_KEY": "your-api-key-here",
628
- "LINEAR_API_KEY": "your-key",
629
- "GITHUB_TOKEN": "your-github-token",
630
- "CURSOR_API_KEY": "your-cursor-key"
631
- }
632
- }
633
- }
634
- }
635
- ```
418
+ **Input:** Incident report, commit, conversation
419
+ **Extraction:** AI pulls out structured data:
420
+ - **Decisions**: "Chose bcrypt over sha256 for password hashing"
421
+ - **Facts**: "Stripe requires TLS 1.2+ for EU transactions"
422
+ - **Blockers**: "Missing VAT validation blocks EU checkout"
423
+ - **Questions**: "Should we cache session tokens?"
636
424
 
637
- For Cursor: Cursor has built-in MCP support. Add the above configuration to your Cursor MCP settings.
425
+ **Storage:** Goes to queryable database with embeddings
426
+ **Query:** Agents ask for targeted context, not everything at once
638
427
 
639
- Note: VS Code extension is coming soon.
428
+ This prevents context pollution and keeps agents focused on relevant signals.
640
429
 
641
430
  ## CLI Reference
642
431
 
@@ -644,386 +433,125 @@ Note: VS Code extension is coming soon.
644
433
 
645
434
  ```bash
646
435
  trie init # Set up Trie in your project
647
- trie setup # Show setup guide with integration status
648
- trie tell # Report incidents (extracts decisions, facts, blockers)
649
436
  trie status # View project health and memory stats
650
- trie learn # Train Trie from history or feedback
437
+ trie tell # Report incidents (extracts decisions, facts, blockers)
651
438
  trie gotcha # Predict problems with current changes
439
+ trie learn # Train from git history or feedback
440
+ trie watch # Start interactive monitoring dashboard
652
441
  ```
653
442
 
654
- ### Setup & Configuration
443
+ ### Goals
655
444
 
656
445
  ```bash
657
- trie setup # Show setup guide with status
658
- trie setup slack # Show Slack setup guide
659
- trie setup slack <webhook-url> [channel] # Configure Slack integration
660
- trie setup test-slack # Test Slack connection
446
+ trie goal add "<goal>" # Set improvement goal
447
+ trie goal list # View progress
661
448
  ```
662
449
 
663
- ### Memory Management
450
+ ### Memory
664
451
 
665
452
  ```bash
666
- trie memory search "database" # Search incident history
667
- trie memory stats # View memory statistics
668
- trie memory purge smart # Clean up old/resolved issues
669
- trie learn # Extract patterns from reverts/fixes
453
+ trie memory search "query" # Search incident history
454
+ trie memory stats # View statistics
455
+ trie memory recent # Recent issues
456
+ trie memory purge smart # Clean up old/resolved
670
457
  ```
671
458
 
672
- ### Goals & Learning
459
+ ### Ledger
673
460
 
674
461
  ```bash
675
- trie goal add "<goal>" # Set improvement goal
676
- trie hypothesis add "<theory>" # Test a hypothesis
677
- trie goal list # View progress
678
- trie linear sync # Sync Linear tickets for intent context
462
+ trie ledger verify # Validate chain integrity
463
+ trie ledger history # Show blocks with authors
464
+ trie ledger stats # Block counts, entries, severity
465
+ trie ledger correct <id> # Mark entry as corrected
466
+ trie ledger corrections # View correction stats
679
467
  ```
680
468
 
681
- ### Ledger & Sync
469
+ ### Sync
682
470
 
683
471
  ```bash
684
- trie ledger verify # Verify chain integrity
685
- trie ledger history # Show blocks with author attribution
686
- trie ledger stats # Block counts, entries, severity
687
- trie ledger diff # Compare local vs shared ledger
688
- trie ledger compress # Archive old blocks
689
- trie ledger storage # Storage usage stats
690
- trie sync init # Initialize shared ledger
691
- trie sync pull # Pull from shared storage
692
- trie sync push # Push local blocks to shared
693
- trie sync status # Show sync state and conflicts
694
- trie sync migrate # Migrate legacy v1 ledger
695
- trie sync hooks --install # Install auto-sync git hooks
472
+ trie sync init # Initialize shared ledger
473
+ trie sync pull # Pull from shared storage
474
+ trie sync push # Push to shared storage
475
+ trie sync status # Show sync state
476
+ trie sync hooks --install # Install auto-sync git hooks
696
477
  ```
697
478
 
698
- ### Feedback & Training
479
+ ### Keys
699
480
 
700
481
  ```bash
701
- trie ok # Pattern is good (alias: learn ok)
702
- trie bad # Pattern is bad (alias: learn bad)
703
- trie learn # Learn from your git history
704
- trie pause # Disable warnings for 1 hour
482
+ trie keys generate # Generate Ed25519 signing key
483
+ trie keys status # Check if signing is configured
484
+ trie keys public # Get your public key
705
485
  ```
706
486
 
707
- ### Watch Mode
487
+ ### Feedback
708
488
 
709
489
  ```bash
710
- trie watch # Start interactive monitoring dashboard
711
-
712
- # Run in background with screen/tmux:
713
- screen -S trie-watch && trie watch # Detach: Ctrl+A, D
714
- tmux new -s trie-watch && trie watch # Detach: Ctrl+B, D
490
+ trie ok # Pattern is good
491
+ trie bad # Pattern is bad
492
+ trie pause # Disable warnings for 1 hour
715
493
  ```
716
494
 
717
- ## Configuration
495
+ ### Setup
718
496
 
719
- ### Scan Behavior
497
+ ```bash
498
+ trie setup # Show setup guide
499
+ trie setup slack <webhook> # Configure Slack
500
+ trie setup test-slack # Test Slack connection
501
+ trie linear auth <key> # Configure Linear
502
+ trie linear sync # Sync Linear tickets
503
+ ```
720
504
 
721
- > **Note**: Trie no longer uses traditional "scans". Instead, it extracts structured signals from incidents, commits, and conversations. Configuration below is for legacy compatibility.
505
+ ## Configuration
722
506
 
723
- Create .trie/config.json:
507
+ Create `.trie/config.json`:
724
508
 
725
509
  ```json
726
510
  {
727
511
  "scanOptions": {
728
512
  "maxConcurrency": 4,
729
- "timeoutMs": 30000,
730
- "includeNodeModules": false
513
+ "timeoutMs": 30000
731
514
  },
732
- "autoEscalation": {
733
- "enabled": true,
734
- "webhookUrl": "https://hooks.slack.com/...",
735
- "quietHours": { "start": "21:00", "end": "08:00" }
736
- }
737
- }
738
- ```
739
-
740
- ### Git Hooks
741
-
742
- Installed automatically with trie init:
743
-
744
- - **pre-commit** - Quick scan of staged files
745
- - **post-commit** - Update context graph
746
- - **pre-push** - Block critical issues (can be bypassed)
747
-
748
- **Hook Commands** (called automatically by Git):
749
- ```bash
750
- trie pre-commit # Scan staged files, block on critical issues
751
- trie post-commit # Update context graph after commit
752
- trie pre-push # Block push on critical issues
753
- ```
754
-
755
- **Bypass Methods:**
756
- ```bash
757
- git push --no-verify # Skip all hooks
758
- TRIE_BYPASS=1 git push # Skip Trie but log bypass
759
- ```
760
-
761
- ### Slack Integration
762
-
763
- Trie sends notifications to Slack for team collaboration:
764
-
765
- **Quick Setup:**
766
- ```bash
767
- # Show setup guide
768
- trie setup slack
769
-
770
- # Configure webhook
771
- trie setup slack <webhook-url> [#channel]
772
-
773
- # Test integration
774
- trie setup test-slack
775
- ```
776
-
777
- **Manual Setup:**
778
- 1. Create a Slack webhook: https://api.slack.com/apps
779
- 2. Run: `trie setup slack <webhook-url> [#channel]`
780
-
781
- Or manually add to `.trie/config.json`:
782
-
783
- ```json
784
- {
785
515
  "integrations": {
786
516
  "slack": {
787
517
  "enabled": true,
788
- "webhook": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
789
- "channel": "#security" // Optional: default channel
518
+ "webhook": "https://hooks.slack.com/...",
519
+ "channel": "#security"
790
520
  }
791
521
  },
792
522
  "autoEscalation": {
793
523
  "enabled": true,
794
- "webhookUrl": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
795
524
  "quietHours": { "start": "21:00", "end": "08:00" }
796
525
  }
797
526
  }
798
527
  ```
799
528
 
800
- **What Trie sends to Slack:**
801
- - Decision extractions from incidents
802
- - Active blockers
803
- - Risk predictions from gotcha
804
- - Daily/weekly team summaries
805
- - Critical decision changes
806
- - Auto-escalation notifications
807
-
808
- ### Ledger Corrections (Immutable Audit Trail)
809
-
810
- The ledger is **append-only** - entries are never deleted. When mistakes happen, use corrections instead:
811
-
812
- **Mark entries as corrected:**
813
- ```bash
814
- # Correct a false positive
815
- trie ledger correct <entry-id> -r "Expected behavior, not a bug" -t false-positive
816
-
817
- # Mark as fixed
818
- trie ledger correct <entry-id> -r "Fixed in commit abc123"
819
-
820
- # Batch corrections
821
- trie ledger correct entry1 entry2 entry3 -r "Duplicate detections"
822
- ```
823
-
824
- **View correction stats:**
825
- ```bash
826
- # Show correction statistics
827
- trie ledger corrections
828
-
829
- # View history for specific entries
830
- trie ledger corrections --entries <entry-id1> <entry-id2>
831
- ```
832
-
833
- **What happens:**
834
- - Original entry preserved for audit trail
835
- - Entry marked with status (`corrected` or `false-positive`)
836
- - Correction metadata added (timestamp, reason, who)
837
- - New correction entry appended to ledger
838
- - Queries automatically filter out corrected entries
839
-
840
- **Why immutability matters:**
841
- - Full audit trail for compliance and trust
842
- - Tamper-evidence through cryptographic chain
843
- - Learn from false positives to improve detection
844
- - Track correction rates over time
845
-
846
- ## CI/CD Integration
847
-
848
- ### GitHub Actions
849
-
850
- ```bash
851
- # Generate workflow file
852
- trie ci github
853
-
854
- # Creates .github/workflows/trie.yml with:
855
- # - Decision ledger queries
856
- # - Memory caching for speed
857
- # - Risk prediction on PRs
858
- ```
859
-
860
- ### Custom CI
861
-
862
- ```bash
863
- # In your CI pipeline
864
- npm install -g trie
865
- # Query decision ledger for risks
866
-
867
- ## Memory Architecture
868
-
869
- Trie maintains two complementary memory systems that work together:
870
-
871
- ### 1. Governance Ledger (Primary Product)
872
-
873
- **Location:** `.trie/memory/ledger.json`
874
- **Purpose:** Tamper-evident record of decisions, incidents, and fixes
875
- **Architecture:** Append-only chain of blocks with Ed25519 signatures
876
-
877
- This is the **core governance layer** that:
878
- - Powers `trie gotcha` predictions
879
- - Provides accountability for agent and human decisions
880
- - Uses digital signatures to detect tampering
881
- - Never deleted, only corrected (see [Ledger Corrections](./docs/LEDGER_CORRECTIONS.md))
882
- - Auto-commits to Git for distributed backup
883
-
884
- **How it works:**
885
- - **Daily blocks** - One block per calendar day; all issues detected that day go into the same block
886
- - Every entry gets signed with Ed25519 (automatic once key exists)
887
- - Signatures prove who created each entry and detect modifications
888
- - Git integration provides distributed backup and history
889
- - Think: **double-entry bookkeeping**, not blockchain
890
-
891
- **Setting up Ed25519 signing:**
892
- ```bash
893
- # Option 1: Automatic (trie init generates a key)
894
- trie init
895
-
896
- # Option 2: Manual
897
- trie keys generate # Generate Ed25519 signing key
898
- trie keys status # Check if signing is configured
899
- trie keys public # Get your public key for verification
900
- ```
901
-
902
- Once a key exists, all new ledger entries are signed automatically. Keys are stored in `.trie/keys/` (never committed to git). Each team member generates their own key.
903
-
904
- **Security model:**
905
- - ✅ **Tamper-evident**: Signatures detect if entries are modified
906
- - ✅ **Accountability**: See who (human or agent) made each decision
907
- - ✅ **Git backup**: Distributed history via automatic commits
908
- - ✅ **Verification**: `trie ledger verify` checks integrity
909
- - ⚠️ **Not encrypted**: Ledger is plaintext (can add encryption if needed)
910
- - ⚠️ **Not access-controlled**: Standard file permissions apply
911
- - ⚠️ **Not deletion-proof**: Can still `rm .trie/` (but Git history remains)
912
-
913
- **Real protection comes from:** Git history + Team workflow + PR reviews
914
-
915
- Perfect for agent collaboration because:
916
- - Agents can trust ledger contents (signatures verify authenticity)
917
- - Humans can audit agent decisions (full provenance trail)
918
- - Cross-tool context works (same ledger in Cursor, CLI, CI/CD)
919
- - Conflicts are visible (Git shows competing changes)
920
-
921
- Learn more: [Signatures & Git Integration](./docs/SIGNATURES_AND_GIT.md)
922
-
923
- ### 2. Issue Memory (Query Cache)
924
-
925
- **Location:** `.trie/memory/issues.json`
926
- **Purpose:** Fast searchable cache for pattern queries
927
- **Complementary to:** The ledger
928
-
929
- Issue memory caches:
930
- - **Goal violations** caught by watch mode
931
- - **Learning extractions** from `trie learn` (git history analysis)
932
- - **Manual reports** via `trie tell` or chat
933
- - **Working state** - tracks resolved/open/fixed status
934
- - **Cross-project patterns** in `~/.trie/memory/`
935
-
936
- **Each issue links back to the ledger** via `ledgerBlockHash` for full audit trail.
937
-
938
- **Why both systems?**
939
- - **Ledger** = immutable historical record (what was detected, when)
940
- - **Issue memory** = mutable working state (resolved, open, metrics)
941
-
942
- The ledger ensures nothing is lost. Issue memory tracks current state and makes queries fast.
943
-
944
- ### Query Issue Memory
945
-
946
- ```bash
947
- # Search for patterns
948
- trie memory search "authentication"
949
-
950
- # View statistics
951
- trie memory stats
952
-
953
- # See recent detections
954
- trie memory recent
955
- ```
956
-
957
- **Note:** Issue memory can be cleaned up (`trie memory purge smart`) without affecting the immutable ledger. The ledger remains the source of truth.
958
-
959
529
  ## Troubleshooting
960
530
 
961
- ### Common Issues
962
-
963
- **Trie not finding issues**: You haven't taught Trie about your specific patterns yet. Use `trie tell` to report incidents and build your decision ledger.
964
-
965
- **Memory queries returning empty**: The warm storage is empty. Report some incidents with `trie tell` or run `trie learn` to extract from git history.
531
+ **Trie not finding issues**: You haven't taught Trie about your patterns yet. Use `trie tell` to report incidents.
966
532
 
967
- **Query tools not working**: Make sure you've initialized Trie with `trie init` and have ANTHROPIC_API_KEY set for signal extraction.
533
+ **Memory queries returning empty**: Report incidents with `trie tell` or run `trie learn` to extract from git history.
968
534
 
969
- **Hooks not working**: Reinstall with `trie init`. Make sure you have write permissions to .git/hooks/.
535
+ **Query tools not working**: Make sure you've initialized with `trie init` and have `ANTHROPIC_API_KEY` set.
970
536
 
971
- **Goals showing but not detecting violations**: This happens when goals appear in the UI but aren't active in project state. The Goals view will show a yellow warning box. To fix:
972
- ```bash
973
- # Quick fix - activate a specific goal
974
- node fix-goals.js "NO EMOJIS"
537
+ **Hooks not working**: Reinstall with `trie init`. Check write permissions to `.git/hooks/`.
975
538
 
976
- # Or use the proper CLI (recommended)
977
- trie goal add "NO EMOJIS"
978
- trie goal list
979
- ```
980
- ### Getting Help
981
- - Issues: [Report bugs and request features](https://x.com/louiskishfy)
539
+ **Goals showing but not detecting violations**: Goals may not be active in project state. Run `trie goal add "<goal>"` to activate.
982
540
 
983
- ## Contributing
541
+ **Quick start:**
542
+ 1. Fork and clone the repository
543
+ 2. `npm install`
544
+ 3. Copy `.env.example` to `.env.local` and add API keys
545
+ 4. `npm run build`
546
+ 5. `npm test`
984
547
 
985
- We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing feedback, your contributions help make Trie better for everyone.
986
-
987
- ### Quick Start for Contributors
988
-
989
- 1. **Fork and clone** the repository
990
- 2. **Install dependencies**: `npm install`
991
- 3. **Set up environment**: Copy `.env.example` to `.env.local` and add your API keys
992
- 4. **Build the project**: `npm run build`
993
- 5. **Run tests**: `npm test`
994
-
995
- ### Before Submitting
996
-
997
- - Ensure all tests pass (`npm test`)
998
- - Run type checking (`npm run typecheck`)
999
- - Follow our code style (`npm run lint`)
1000
- - Update documentation for new features
548
+ **Before submitting:**
549
+ - All tests pass (`npm test`)
550
+ - Type checking passes (`npm run typecheck`)
551
+ - Follow code style (`npm run lint`)
552
+ - Update docs for new features
1001
553
  - Never commit secrets or API keys
1002
554
 
1003
- **Read our full [Contributing Guide](CONTRIBUTING.md) for detailed guidelines.**
1004
-
1005
- ### Ways to Contribute
1006
-
1007
- - 🐛 **Report bugs** - Open an issue with reproduction steps
1008
- - 💡 **Suggest features** - Share ideas for improvements
1009
- - 📝 **Improve docs** - Fix typos, add examples, clarify instructions
1010
- - 🔧 **Submit PRs** - Fix bugs or implement features
1011
- - 🧪 **Add tests** - Improve test coverage
1012
- - 🔐 **Security** - Report vulnerabilities privately (see [SECURITY.md](SECURITY.md))
1013
-
1014
- ### Code of Conduct
1015
-
1016
- Be respectful, inclusive, and professional. We're building this together.
1017
-
1018
- ## Security
1019
-
1020
- Please report security vulnerabilities privately. See [SECURITY.md](SECURITY.md) for details.
1021
-
1022
- **Never commit:**
1023
- - API keys or secrets
1024
- - `.env.local` or `.env` files
1025
- - Private signing keys (`.trie/keys/`)
1026
- - Personal configuration
1027
555
 
1028
556
  ## License
1029
557