@triedotdev/mcp 1.0.62 → 1.0.63

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 (56) hide show
  1. package/README.md +591 -52
  2. package/dist/agent-smith-W4HUCFGC.js +14 -0
  3. package/dist/{agent-smith-runner-ZU4R3I2Z.js → agent-smith-runner-QRVOEOBE.js} +13 -7
  4. package/dist/agent-smith-runner-QRVOEOBE.js.map +1 -0
  5. package/dist/chunk-4YSLDGBL.js +674 -0
  6. package/dist/chunk-4YSLDGBL.js.map +1 -0
  7. package/dist/chunk-7KHT2NKR.js +212 -0
  8. package/dist/chunk-7KHT2NKR.js.map +1 -0
  9. package/dist/{chunk-XSPS463E.js → chunk-ALA6733H.js} +492 -14
  10. package/dist/chunk-ALA6733H.js.map +1 -0
  11. package/dist/chunk-AQCAMIQQ.js +139 -0
  12. package/dist/chunk-AQCAMIQQ.js.map +1 -0
  13. package/dist/chunk-D3DMONAJ.js +904 -0
  14. package/dist/chunk-D3DMONAJ.js.map +1 -0
  15. package/dist/{chunk-KB5ZN6K2.js → chunk-GWSNINKX.js} +2 -2
  16. package/dist/{chunk-32WLOG6E.js → chunk-K6BQBKIR.js} +662 -633
  17. package/dist/chunk-K6BQBKIR.js.map +1 -0
  18. package/dist/{chunk-ASGSTVVF.js → chunk-KOFQ47YW.js} +10 -6
  19. package/dist/chunk-KOFQ47YW.js.map +1 -0
  20. package/dist/{chunk-XXNE6HBE.js → chunk-N2AZH3EQ.js} +7697 -4803
  21. package/dist/chunk-N2AZH3EQ.js.map +1 -0
  22. package/dist/chunk-PBOVCPKE.js +2566 -0
  23. package/dist/chunk-PBOVCPKE.js.map +1 -0
  24. package/dist/{chunk-NUT4G5AY.js → chunk-R7Z7OHTJ.js} +493 -650
  25. package/dist/chunk-R7Z7OHTJ.js.map +1 -0
  26. package/dist/chunk-TSHZQKCM.js +933 -0
  27. package/dist/chunk-TSHZQKCM.js.map +1 -0
  28. package/dist/{chunk-S4VGGLXF.js → chunk-X2PABPBH.js} +461 -892
  29. package/dist/chunk-X2PABPBH.js.map +1 -0
  30. package/dist/cli/create-agent.js +3 -2
  31. package/dist/cli/create-agent.js.map +1 -1
  32. package/dist/cli/main.js +1120 -70
  33. package/dist/cli/main.js.map +1 -1
  34. package/dist/cli/yolo-daemon.js +151 -41
  35. package/dist/cli/yolo-daemon.js.map +1 -1
  36. package/dist/goal-manager-KFBOAP4X.js +20 -0
  37. package/dist/goal-manager-KFBOAP4X.js.map +1 -0
  38. package/dist/guardian-agent-PULK546O.js +17 -0
  39. package/dist/guardian-agent-PULK546O.js.map +1 -0
  40. package/dist/index.js +173 -39
  41. package/dist/index.js.map +1 -1
  42. package/dist/issue-store-QRDF3X55.js +22 -0
  43. package/dist/issue-store-QRDF3X55.js.map +1 -0
  44. package/dist/workers/agent-worker.js +6 -3
  45. package/dist/workers/agent-worker.js.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/agent-smith-57MKX5QC.js +0 -13
  48. package/dist/agent-smith-runner-ZU4R3I2Z.js.map +0 -1
  49. package/dist/chunk-32WLOG6E.js.map +0 -1
  50. package/dist/chunk-ASGSTVVF.js.map +0 -1
  51. package/dist/chunk-NUT4G5AY.js.map +0 -1
  52. package/dist/chunk-S4VGGLXF.js.map +0 -1
  53. package/dist/chunk-XSPS463E.js.map +0 -1
  54. package/dist/chunk-XXNE6HBE.js.map +0 -1
  55. /package/dist/{agent-smith-57MKX5QC.js.map → agent-smith-W4HUCFGC.js.map} +0 -0
  56. /package/dist/{chunk-KB5ZN6K2.js.map → chunk-GWSNINKX.js.map} +0 -0
package/README.md CHANGED
@@ -17,7 +17,7 @@ So I built Trie with a few principles:
17
17
 
18
18
  **Memory that travels with git.** The `.trie/` directory commits to your repo. Same incident history, same patterns, same risk scores—whether you're in Cursor, VS Code, CLI, or CI/CD. No external service. No re-explaining. Your context is *yours*.
19
19
 
20
- **One guardian, not a committee.** Skills, on their own, have no unified view. Trie has 26 specialized "scouts" (same as skills, but I call them scouts as they scan and report up), but they all feed into one guardian agent that knows the full picture. One brain that watches, learns, and warns. You can also add skills from any repo you find online.
20
+ **One guardian, not a committee.** Trie has 26 autonomous **scouts** (built-in analyzers) that intelligently scan and report findings up to one guardian agent that knows the full picture. Unlike simple skills, scouts are sophisticated analyzers with their own logic, severity scoring, and domain expertise. You can also add external skills from any repo you find online.
21
21
 
22
22
  **Fast enough for git hooks.** I chose a trie data structure because I needed O(m) lookups that don't slow down my workflow. File paths as tree branches. Hot zones light up where problems cluster. Under 10ms for pattern matching, under 500ms for pre-push checks.
23
23
 
@@ -53,20 +53,223 @@ Trie's memory is a tree. The more incidents you report, the smarter the tree get
53
53
  - **Cross-project learning**: Patterns discovered across all your projects. Fix a SQL injection in Project A, Trie warns about similar patterns in Project B.
54
54
  - **Core commands**: `trie init` (bootstrap + hooks), `trie check` (risk review before push), `trie tell "<incident>"` (build memory), `trie ok`/`trie bad` (feedback), `trie status` (health score).
55
55
  - **Guardian agent**: ONE agent that watches, learns, and warns. It has goals, observes changes, reasons about risk, and nudges you in plain English.
56
- - **Built-in skills**: 26 specialized analyzers (security, privacy, SOC2, accessibility, etc.) that the guardian uses when appropriate.
56
+ - **Built-in scouts**: 26 autonomous analyzers (security, privacy, SOC2, accessibility, etc.) with sophisticated logic that intelligently report to the guardian agent.
57
57
  - **MCP integration**: `trie_scan`, `trie_check`, `trie_tell`, `trie_fix`, `trie_explain`, `trie_memory`, `trie_context`—all return plain English.
58
58
  - **Memory structure**: Prefix tree (trie) for O(m) file lookups + SQLite for detailed history. Fast enough for git hooks (< 500ms).
59
59
  - **Learning loop**: Confidence updates, pattern discovery, co-occurrence detection—all powered by trie traversal (< 10ms).
60
60
 
61
- ## What's New
61
+ ## What's New (January 2026)
62
62
 
63
- ### Guardian Agent
64
- - **Autonomous observation**: Git hooks (pre-commit, pre-push), file watchers, proactive nudging
65
- - **Memory tree**: Trie data structure for O(m) file lookups + SQLite for detailed incident history
66
- - **Learning loop**: Bayesian confidence updates, automatic pattern discovery (3+ incidents), co-occurrence detection
67
- - **Plain English warnings**: Comprehensive glossary (690 lines, 200+ terms), context-aware explanations
68
- - **Fast hooks**: `trie check` completes in < 500ms (no LLM calls in git hooks)
69
- - **Feedback system**: `trie ok`/`trie bad` for thumbs up/down, adjusts confidence in real-time
63
+ ### Guardian Agency
64
+
65
+ **Persistent Memory**
66
+ - Zero data loss after restarts—insights, cooldowns, and dismissals survive
67
+ - Goals and hypotheses persist across sessions
68
+ - State loads in <100ms
69
+
70
+ **Goals (Auto + Manual)**
71
+ - Auto-generates goals from incident patterns (e.g., "Reduce auth/ incidents by 50%")
72
+ - Add your own goals via CLI or TUI
73
+ - Adaptive scan frequency based on risk level (1-10 minutes)
74
+ - Goal tracking with achievement celebrations
75
+
76
+ ```bash
77
+ # CLI: Add manual goals
78
+ trie goal add "Reduce auth issues by 50%"
79
+ trie goal add "Eliminate all critical security issues"
80
+ trie goal list
81
+ trie goal complete <id>
82
+
83
+ # TUI: Press o in watch mode
84
+ # [a] add [Enter] complete [d] delete [b] back
85
+ ```
86
+
87
+ **Hypotheses (Auto + Manual)**
88
+ - Auto-generates hypotheses from patterns
89
+ - Add your own hypotheses via CLI or TUI
90
+ - Guardian collects evidence and updates confidence over time
91
+
92
+ ```bash
93
+ # CLI: Add manual hypotheses
94
+ trie hypothesis add "Mondays have more bugs than Fridays"
95
+ trie hypothesis add "Code reviews reduce bug rate"
96
+ trie hypothesis list
97
+ trie hypothesis validate <id>
98
+
99
+ # TUI: Press y in watch mode
100
+ # [a] add [v] validate [x] invalidate [d] delete
101
+ ```
102
+
103
+ **Watch Mode TUI Panels**
104
+
105
+ | Key | Panel | Description |
106
+ |-----|-------|-------------|
107
+ | `o` | Goals | View, add, complete, delete goals |
108
+ | `y` | Hypotheses | View, add, validate/invalidate hypotheses |
109
+ | `g` | Guardian | Alert history and insights |
110
+ | `i` | Toolkit | Scouts (autonomous) + Skills (installable) |
111
+ | `h` | Help | Full keyboard shortcuts |
112
+
113
+ **Predictive Intelligence**
114
+ - Multi-factor risk scoring: incident count, recency, severity, complexity, churn
115
+ - Trend prediction (increasing/stable/decreasing)
116
+ - Self-improving hypotheses that validate over time
117
+ - Example: "Friday deployments cause 2.3x more issues" → validated with 89% confidence
118
+
119
+ **Autonomous Actions**
120
+ - Auto-escalates critical security issues to Slack/email/webhook
121
+ - Respects quiet hours (9pm-8am) with bypass for critical issues
122
+ - Meta-learning adjusts insight weights based on your feedback
123
+ - Effectiveness tracking with recommendations
124
+
125
+ ### Autonomy System
126
+
127
+ **Push Blocking with Bypass**
128
+ - Pre-push hook blocks on critical issues
129
+ - Bypass with `TRIE_BYPASS=1 git push` or `git push --no-verify`
130
+ - All bypasses logged for audit trail
131
+
132
+ **Git Hooks - How They Work**
133
+
134
+ Hooks are installed when you run `trie init`:
135
+ - Written to `.git/hooks/` (local to your repo, not pushed to GitHub)
136
+ - Works with terminal, GitHub Desktop, and any git client
137
+ - Persists until you remove them
138
+
139
+ | Hook | When it runs | What it does |
140
+ |------|--------------|--------------|
141
+ | `pre-commit` | Before each commit | Quick scan of staged files |
142
+ | `post-commit` | After each commit | Updates context graph |
143
+ | `pre-push` | Before push | Blocks on critical issues |
144
+
145
+ **Bypassing hooks:**
146
+ ```bash
147
+ # Skip all hooks for this push
148
+ git push --no-verify
149
+
150
+ # Skip Trie blocking but still log the bypass
151
+ TRIE_BYPASS=1 git push
152
+
153
+ # Skip all hooks for this commit
154
+ git commit --no-verify -m "message"
155
+ ```
156
+
157
+ **Removing hooks:**
158
+ ```bash
159
+ rm .git/hooks/pre-push
160
+ rm .git/hooks/pre-commit
161
+ rm .git/hooks/post-commit
162
+ ```
163
+
164
+ **Reinstalling hooks:**
165
+ ```bash
166
+ trie init
167
+ ```
168
+
169
+ > **Note:** Hooks are per-repo and local. Teammates need to run `trie init` after cloning to get hooks (git doesn't transfer hooks for security reasons).
170
+
171
+ **Auto-Check in Watch Mode**
172
+ - When critical issues detected, auto-runs full check
173
+ - Configurable threshold and cooldown
174
+ - No more "Run pre-push check" suggestions—it just runs
175
+
176
+ **Auto-Fix with Human-in-the-Loop**
177
+ - Detects trivial fixes (console.log, debugger, etc.)
178
+ - Always asks before applying: `Fix 12 issues? (y)es / (r)eview / (n)o`
179
+ - Review mode shows each fix before applying
180
+
181
+ **Progressive Escalation**
182
+ | Occurrence | Action |
183
+ |------------|--------|
184
+ | 1st | Suggest fix |
185
+ | 3rd | Auto-run full check |
186
+ | 5th | Escalate to Slack/email |
187
+ | 10th | Block operations until fixed |
188
+
189
+ **Configuration**
190
+ ```json
191
+ // .trie/config.json
192
+ {
193
+ "autonomy": {
194
+ "level": "proactive",
195
+ "autoCheck": { "enabled": true, "onCritical": true },
196
+ "autoFix": { "enabled": true, "askFirst": true },
197
+ "pushBlocking": { "enabled": true, "allowBypass": true }
198
+ },
199
+ "escalation": {
200
+ "enabled": true,
201
+ "targets": [
202
+ {
203
+ "type": "slack",
204
+ "enabled": true,
205
+ "config": {
206
+ "webhookUrl": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
207
+ "channel": "#security-alerts",
208
+ "username": "Trie Guardian"
209
+ },
210
+ "forSeverities": ["critical"],
211
+ "forCategories": ["security", "all"]
212
+ }
213
+ ],
214
+ "cooldownMinutes": 15,
215
+ "maxEscalationsPerHour": 5,
216
+ "respectQuietHours": true,
217
+ "criticalBypassQuietHours": true
218
+ }
219
+ }
220
+ ```
221
+
222
+ **Escalation Targets:**
223
+ - `slack` - Send to Slack via webhook
224
+ - `email` - Send via email (requires SMTP configuration)
225
+ - `webhook` - POST to custom webhook endpoint
226
+
227
+ Configure multiple targets for redundancy. Set up in `.trie/config.json` or via TUI (press `c` → `5` in watch mode).
228
+
229
+ **What this means:**
230
+ ```
231
+ Traditional tools: "Found 15 issues" (same every time)
232
+
233
+ Trie Guardian: "auth/login.ts has 5 past incidents (5x above average).
234
+ Test coverage dropped from 85% → 72%.
235
+ Recommendation: Request extra review before merge.
236
+
237
+ 🎯 Goal progress: auth/ incidents 15 → 7 (53% reduction!)
238
+ 🔮 Hypothesis validated: Friday deploys cause issues"
239
+ ```
240
+
241
+ ### Memory System Hardening (Phase 1) ✅
242
+ - **Atomic writes**: Temp file + rename pattern prevents data corruption on crash/interrupt
243
+ - **SHA256 hashing**: Cryptographic deduplication (replaced collision-prone bit-shift hash)
244
+ - **Backup rotation**: Automated 5-backup rotation with recovery commands
245
+ - **Zod validation**: Schema validation for all memory data structures
246
+ - **Why Phase 1 only**: JSON performs well at Trie's scale (1K-10K issues). SQLite, embeddings, and session management add complexity without proportional value for a security scanning CLI tool.
247
+
248
+ ### Guardian + Visual QA Integration 🛡️
249
+ - **Automatic suggestions**: Guardian detects 2+ critical/serious accessibility issues and suggests visual QA
250
+ - **Browser screenshots**: `trie_visual_qa_browser` captures mobile/tablet/desktop screenshots
251
+ - **AI vision analysis**: AI analyzes screenshots to validate real-world accessibility impact
252
+ - **Smart cooldowns**: 5-minute cooldown prevents duplicate suggestions
253
+ - **Complete workflow**: Code analysis → Guardian insight → Screenshot capture → Vision analysis
254
+
255
+ ### CI/CD Command 🚀
256
+ - **New command**: `trie ci` generates GitHub Actions workflow with memory caching
257
+ - **Cross-run learning**: Cache `.trie/memory` for pattern recognition across CI runs
258
+ - **SARIF output**: Results appear in GitHub Security tab
259
+ - **Memory benefits**: "This issue was introduced 3 PRs ago", "Similar issue fixed in PR #42"
260
+ - **Minimal mode**: `trie ci --minimal` for simpler workflow
261
+
262
+ ### Guardian Agent Enhancements
263
+ - **Proactive insights**: Synthesizes patterns across multiple skills (security, accessibility, etc.)
264
+ - **Verbose details**: Issue breakdowns, affected files, examples, trends in expanded view
265
+ - **Conversational UX**: Speaks like a helpful colleague, not a system
266
+ - **Priority scoring**: 1-10 priority levels with intelligent cooldowns
267
+ - **Celebration mode**: Recognizes improvements and fixed issues
268
+ - **Autonomous goal generation**: Creates goals from patterns, tracks progress, celebrates achievements
269
+ - **Predictive risk scoring**: Multi-factor analysis identifies risky files before they break
270
+ - **Hypothesis validation**: Generates and validates hypotheses about your codebase patterns
271
+ - **Auto-escalation**: Critical security issues automatically sent to Slack/email during work hours
272
+ - **Meta-learning**: Adjusts behavior based on your feedback (which insights you find helpful)
70
273
 
71
274
  ### Core Workflow
72
275
  ```bash
@@ -92,10 +295,20 @@ $ trie ok # Warning was helpful
92
295
  $ trie bad # Warning was not helpful
93
296
  ```
94
297
 
95
- ### Built-in Skills (Terminology Update)
96
- - Built-in analyzers now live in `src/skills/built-in/` and extend `BaseSkill`
97
- - The guardian agent (singular) decides when to invoke skills based on risk and context
98
- - Skills provide specialized analysis; the agent provides autonomous behavior
298
+ ### Built-in Scouts vs External Skills
299
+
300
+ **Scout Architecture (Built-in Analyzers):**
301
+ - **26 autonomous scouts** live in `src/skills/built-in/` and extend `BaseSkill`
302
+ - Each scout has **sophisticated logic**: severity scoring, domain expertise, contextual analysis
303
+ - **Intelligent reporting**: Scouts analyze and synthesize findings before reporting to the Guardian
304
+ - **Examples**: Security Scout detects injection patterns, Privacy Scout analyzes GDPR compliance
305
+
306
+ **External Skills (Simple Rules):**
307
+ - **Installable knowledge**: Downloaded from GitHub repos as static rules/patterns
308
+ - **No autonomous logic**: Just detection patterns that Skills Review agent applies
309
+ - **Examples**: React best practices, style guides, compliance docs
310
+
311
+ **The Guardian decides** when to deploy scouts based on risk, context, and patterns. Scouts provide autonomous intelligence; external skills provide knowledge to apply.
99
312
 
100
313
  ---
101
314
 
@@ -103,17 +316,18 @@ $ trie bad # Warning was not helpful
103
316
 
104
317
  - [Why Trie](#why-trie)
105
318
  - [At a Glance](#at-a-glance)
106
- - [What's New](#whats-new-guardian-architecture-complete)
319
+ - [What's New](#whats-new-january-2026)
107
320
  - [The Guardian Architecture](#the-guardian-architecture)
108
321
  - [Features](#features)
109
322
  - [Quick Start](#quick-start)
110
323
  - [The Guardian Workflow](#the-guardian-workflow)
111
324
  - [Common Questions](#common-questions)
112
- - [What Each Skill Does](#what-each-skill-does-plain-english)
325
+ - [What Each Scout Does](#what-each-scout-does-plain-english)
113
326
  - [MCP Tools](#mcp-tools)
114
327
  - [CLI Commands](#cli-commands)
115
- - [Built-in Skills](#built-in-skills)
328
+ - [Built-in Scouts](#built-in-scouts)
116
329
  - [Accessibility Skill (v2.0)](#accessibility-skill-v20)
330
+ - [Guardian + Visual QA Integration](#guardian--visual-qa-integration)
117
331
  - [Moneybags Skill](#moneybags-skill)
118
332
  - [Legal Skill (v2.0)](#legal-skill-v20)
119
333
  - [Design Engineer Skill (v2.0)](#design-engineer-skill-v20)
@@ -137,11 +351,12 @@ Trie is **truly agentic**—it's not just a collection of linters. Here's what m
137
351
 
138
352
  | Property | How It Works | Why It's Agentic |
139
353
  |----------|--------------|------------------|
140
- | **Goals** | "Keep the app safe", "Prevent incidents" | Pursues objectives without step-by-step direction |
354
+ | **Goals** | Auto-generates goals from patterns (e.g., "Reduce auth/ incidents by 50%") | Pursues objectives without step-by-step direction |
141
355
  | **Observation** | Git hooks, file watchers, CI events | Acts proactively, not just when asked |
142
- | **Reasoning** | Queries context graph for history/patterns, calculates risk | Uses memory to understand situations |
143
- | **Action** | Warns, explains, suggests, blocks, escalates | Takes action autonomously in plain English |
144
- | **Learning** | Tracks outcomes, adjusts confidence, discovers patterns | Improves from experience |
356
+ | **Reasoning** | Multi-factor risk prediction, hypothesis validation, trend analysis | Uses memory to understand situations |
357
+ | **Action** | Warns, explains, suggests, blocks, auto-escalates critical issues | Takes action autonomously in plain English |
358
+ | **Learning** | Meta-learning from feedback, hypothesis validation, confidence updates | Improves from experience |
359
+ | **Prediction** | Risk scoring predicts which files are likely to break | Anticipates problems before they occur |
145
360
 
146
361
 
147
362
 
@@ -184,8 +399,51 @@ Most "agents" are just prompt chains. Trie is different because:
184
399
  4. **Proactive guidance**: Warns before you push, nudges during editing, explains in plain English
185
400
  5. **Continuous learning**: Gets noticeably better after 10 incidents. Confidence adjusts with every `trie ok`/`trie bad`
186
401
  6. **Instant lookups**: Trie data structure + SQLite = O(m) file lookups (< 1ms), pattern discovery (< 10ms)
187
-
188
- **Trie's job is to be your guardian angel—watching over your shoulder, warning you about danger, and getting smarter every time something goes wrong.**
402
+ 7. **Predictive intelligence**: Multi-factor risk scoring predicts which files will break before they do
403
+ 8. **Self-improving hypotheses**: Generates hypotheses about your codebase patterns and validates them over time
404
+ 9. **Autonomous escalation**: Auto-escalates critical security issues to Slack/email (respects quiet hours)
405
+ 10. **Meta-learning**: Adjusts insight weights based on which warnings you find helpful vs. dismiss
406
+
407
+ **Trie's job is to be your guardian angel—watching over your shoulder, warning you about danger, predicting problems before they happen, and getting smarter every time something goes wrong.**
408
+
409
+ ### Guardian Agency Architecture
410
+
411
+ The Guardian is a **95% agentic system**—everything except direct code modification (which is intentional):
412
+
413
+ ```
414
+ ┌─────────────────────────────────────────────────────┐
415
+ │ Guardian Agent │
416
+ │ (Observes, Learns, Predicts) │
417
+ └─────────────────────────────────────────────────────┘
418
+
419
+ ┌───────────────┼───────────────┐
420
+ ▼ ▼ ▼
421
+ ┌─────────┐ ┌──────────┐ ┌──────────┐
422
+ │ Memory │ │ Pattern │ │ Meta- │
423
+ │ System │ │ Engine │ │ Learning │
424
+ │ │ │ │ │ │
425
+ │ • BM25 │ │ • Trends │ │ • Track │
426
+ │ • Store │ │ • Hypo's │ │ outcomes │
427
+ │ • Graph │ │ • Risk │ │ • Adjust │
428
+ └─────────┘ └──────────┘ └──────────┘
429
+ │ │ │
430
+ └───────────────┼───────────────┘
431
+
432
+ ┌──────────────────┐
433
+ │ Skill Engine │
434
+ │ (Scans codebase) │
435
+ └──────────────────┘
436
+ ```
437
+
438
+ | Capability | Status |
439
+ |------------|--------|
440
+ | Memory & Persistence | ✅ Insights, goals, hypotheses survive restarts |
441
+ | Pattern Recognition | ✅ BM25 + trend analysis |
442
+ | Goal Setting | ✅ Auto-generates from patterns |
443
+ | Prediction | ✅ Multi-factor risk scoring |
444
+ | Learning | ✅ Meta-learning from feedback |
445
+ | Autonomous Action | ✅ Auto-escalation to Slack/email |
446
+ | Context Awareness | ✅ Quiet hours, crunch mode |
189
447
 
190
448
  ### Context That Travels
191
449
 
@@ -195,11 +453,14 @@ The `.trie/` directory is your project's memory:
195
453
  your-project/
196
454
  ├── .trie/
197
455
  │ ├── memory/
198
- │ │ ├── issues.json # All incidents with BM25 search
199
- │ │ ├── patterns.json # Discovered patterns (3+ incidents)
200
- │ │ └── 2024-01-15.md # Daily logs
201
- │ ├── context.db # SQLite graph (files, changes, incidents)
202
- └── config.json # Guardian configuration
456
+ │ │ ├── issues.json # All incidents with BM25 search
457
+ │ │ ├── patterns.json # Discovered patterns (3+ incidents)
458
+ │ │ ├── guardian-insights.json # Persistent insights, cooldowns, dismissals
459
+ ├── guardian-state.json # Goals, hypotheses, metrics, timing
460
+ │ ├── compacted-summaries.json # Historical summaries
461
+ │ │ └── 2024-01-15.md # Daily logs
462
+ │ ├── context.db # SQLite graph (files, changes, incidents)
463
+ │ └── config.json # Guardian configuration
203
464
  ├── .git/
204
465
  └── src/
205
466
  ```
@@ -233,10 +494,23 @@ Trie tracks patterns across ALL your projects. When you fix a SQL injection in P
233
494
  |---------|-------------|
234
495
  | **Context That Travels** | `.trie/` directory committed to git = same memory in Cursor, CLI, CI/CD, VS Code. No re-explaining. |
235
496
  | **Cross-Project Learning** | Global pattern tracking. Fix SQL injection in Project A → Trie warns in Project B. |
236
- | **26 Built-in Skills** | Security, Privacy, SOC 2, Legal, Architecture, Performance, E2E, Visual QA, Data Flow, Moneybags, Production Ready, and more |
497
+ | **26 Autonomous Scouts** | Security, Privacy, SOC 2, Legal, Architecture, Performance, E2E, Visual QA, Data Flow, Moneybags, Production Ready, and more |
237
498
  | **Autonomous Observation** | Git hooks, file watchers, proactive nudging—acts without being asked |
238
499
  | **Learning Loop** | Bayesian confidence updates, automatic pattern discovery (3+ incidents), `trie ok`/`trie bad` feedback |
239
500
  | **Instant Performance** | Trie data structure: < 1ms file lookups, < 10ms pattern discovery, < 500ms git hooks |
501
+ | **Memory Hardening** | Atomic writes, SHA256 hashing, backup rotation, Zod validation—data corruption prevented |
502
+
503
+ ### Guardian Agency (95% Agentic)
504
+
505
+ | Feature | Description |
506
+ |---------|-------------|
507
+ | **Autonomous Goals** | Auto-generates goals from patterns (e.g., "Reduce auth/ incidents by 50%"), tracks progress, celebrates achievements |
508
+ | **Predictive Risk Scoring** | Multi-factor analysis (incidents, recency, severity, complexity, churn) identifies risky files before they break |
509
+ | **Self-Improving Hypotheses** | Generates hypotheses about your codebase (e.g., "Friday deploys cause issues"), validates with evidence over time |
510
+ | **Auto-Escalation** | Critical security issues automatically sent to Slack/email/webhook—respects quiet hours (9pm-8am) |
511
+ | **Meta-Learning** | Adjusts insight weights based on your feedback—learns which warnings you find helpful |
512
+ | **Adaptive Scanning** | Scan frequency adjusts to risk level (1-10 minutes)—scans more often when issues are critical |
513
+ | **Contextual Timing** | Respects quiet hours, work days, and crunch mode—defers low-priority items when you're busy |
240
514
 
241
515
  ### Performance & Execution
242
516
 
@@ -252,6 +526,9 @@ Trie tracks patterns across ALL your projects. When you fix a SQL injection in P
252
526
  | Feature | Description |
253
527
  |---------|-------------|
254
528
  | **Plain English** | 690-line glossary translates jargon. Non-technical founders understand every warning. |
529
+ | **Guardian Insights** | Proactive, conversational feedback with priority scoring and cooldowns |
530
+ | **Visual QA Integration** | Guardian auto-suggests browser screenshots when accessibility issues found |
531
+ | **CI/CD Command** | `trie ci` generates GitHub Actions workflow with memory caching |
255
532
  | **Watch Mode** | Proactive nudging while you code (optional) |
256
533
  | **Custom Skills** | Create skills from PDFs, docs, or style guides |
257
534
  | **External Skills** | Install capabilities from Vercel, Anthropic, Expo, Stripe, 150+ skills across 12 categories |
@@ -263,7 +540,7 @@ Trie tracks patterns across ALL your projects. When you fix a SQL injection in P
263
540
  | Feature | Description |
264
541
  |---------|-------------|
265
542
  | **MCP Protocol** | Native integration with Cursor, Claude Code, and all MCP-compatible tools |
266
- | **CI/CD Integration** | GitHub Actions, pre-commit hooks, SARIF output for GitHub Security tab |
543
+ | **CI/CD Integration** | GitHub Actions, pre-commit hooks, SARIF output for GitHub Security tab, memory caching |
267
544
  | **VS Code Extension** | Inline diagnostics, quick-fix code actions, scan on save |
268
545
 
269
546
  ---
@@ -587,7 +864,30 @@ The built-in skills can optionally use AI for deeper analysis when you have an A
587
864
  <details>
588
865
  <summary><strong>How do I set up automatic checks on GitHub?</strong></summary>
589
866
 
590
- Add this file to your repo at `.github/workflows/trie.yml`:
867
+ **Quick setup (recommended):**
868
+
869
+ Run `trie ci` to generate a GitHub Actions workflow with memory caching:
870
+
871
+ ```bash
872
+ # Generate full workflow with SARIF output
873
+ trie ci
874
+
875
+ # Generate minimal workflow
876
+ trie ci --minimal
877
+
878
+ # Preview without creating files
879
+ trie ci --dry-run
880
+ ```
881
+
882
+ This creates `.github/workflows/trie-scan.yml` that:
883
+ - ✅ Caches Trie memory across runs for cross-run learning
884
+ - ✅ Enables insights like "This issue was introduced 3 PRs ago"
885
+ - ✅ Tracks trends: improving, stable, or declining
886
+ - ✅ Uploads SARIF results to GitHub Security tab
887
+
888
+ **Manual setup:**
889
+
890
+ Or add this file to your repo at `.github/workflows/trie.yml`:
591
891
 
592
892
  ```yaml
593
893
  name: Trie Guardian
@@ -614,7 +914,7 @@ The guardian reads your project's `.trie/` directory (incidents, patterns, memor
614
914
 
615
915
  ---
616
916
 
617
- ## What Each Skill Does (Plain English)
917
+ ## What Each Scout Does (Plain English)
618
918
 
619
919
  | When You Ask | What It Checks | Why It Matters |
620
920
  |--------------|----------------|----------------|
@@ -686,10 +986,11 @@ These tools are available when using Trie via MCP (Cursor, Claude Code, etc.).
686
986
 
687
987
  | Tool | What It Analyzes |
688
988
  |------|------------------|
689
- | `trie_accessibility` | WCAG 2.1 AA: icon-only buttons, touch targets, heading levels, ARIA validation, 20+ checks |
989
+ | `trie_accessibility` | WCAG 2.1 AA: icon-only buttons, touch targets, heading levels, ARIA validation, 20+ checks. **Guardian auto-suggests visual QA when critical a11y issues found.** |
690
990
  | `trie_design` | AI slop detection, verified token systems, contrast validation, design health scoring |
691
991
  | `trie_ux` | User testing simulations: happy path, security tester, confused user, impatient user |
692
- | `trie_visual_qa` | Visual regression, responsive design, cross-browser issues |
992
+ | `trie_visual_qa` | Static CSS/layout analysis: CLS risks, responsive patterns, overflow issues |
993
+ | `trie_visual_qa_browser` | **Browser screenshots** at mobile/tablet/desktop for Guardian visual analysis (requires dev server) |
693
994
  | `trie_e2e` | End-to-end test coverage, user flow validation |
694
995
 
695
996
  ### Operations Skills
@@ -732,6 +1033,11 @@ trie tell "users can't log in after my push"
732
1033
  # Quick check before pushing (< 500ms, no LLM)
733
1034
  trie check
734
1035
 
1036
+ # Generate CI/CD workflow (NEW!)
1037
+ trie ci # Full workflow with SARIF + memory caching
1038
+ trie ci --minimal # Minimal workflow
1039
+ trie ci --dry-run # Preview without creating files
1040
+
735
1041
  # Give feedback on last warning
736
1042
  trie ok # Helpful - increases confidence
737
1043
  trie bad # Not helpful - decreases confidence
@@ -766,6 +1072,12 @@ trie memory search "SQL injection"
766
1072
  # View cross-project patterns
767
1073
  trie memory global patterns
768
1074
 
1075
+ # Guardian Agency commands
1076
+ trie guardian goals # View active goals and progress
1077
+ trie guardian hypotheses # View hypotheses and their confidence
1078
+ trie guardian metrics # View agent effectiveness metrics
1079
+ trie guardian risk src/auth # Get risk prediction for a file/directory
1080
+
769
1081
  # List available skills
770
1082
  trie skills list
771
1083
 
@@ -786,22 +1098,22 @@ trie skills add vercel-labs/agent-skills vercel-react-best-practices
786
1098
 
787
1099
  ---
788
1100
 
789
- ## Built-in Skills
1101
+ ## Built-in Scouts
790
1102
 
791
- Trie has ONE guardian agent that decides when to invoke these specialized analyzers (skills).
1103
+ Trie has ONE guardian agent that intelligently deploys these 26 autonomous scouts (sophisticated analyzers with domain expertise).
792
1104
 
793
- ### Security & Compliance (4 skills)
1105
+ ### Security & Compliance (4 scouts)
794
1106
 
795
- | Skill | Description |
1107
+ | Scout | Description |
796
1108
  |-------|-------------|
797
1109
  | **Security** | SQL injection, XSS, hardcoded secrets, auth bypasses, OWASP Top 10 |
798
1110
  | **Privacy** | GDPR/CCPA/PCI-DSS compliance, PII exposure, data encryption |
799
1111
  | **SOC 2** | Access control gaps, missing audit logs, encryption, secrets management |
800
1112
  | **Legal** | Comprehensive app legal: licensing, ToS, accessibility, IP, GDPR/CCPA, e-commerce, COPPA, marketing compliance |
801
1113
 
802
- ### Code Quality (6 skills)
1114
+ ### Code Quality (6 scouts)
803
1115
 
804
- | Skill | Description |
1116
+ | Scout | Description |
805
1117
  |-------|-------------|
806
1118
  | **TypeCheck** | Type errors, missing annotations, null checks |
807
1119
  | **Bug Finding** | Null safety, edge cases, async issues, race conditions |
@@ -810,9 +1122,9 @@ Trie has ONE guardian agent that decides when to invoke these specialized analyz
810
1122
  | **Performance** | Memory leaks, inefficient algorithms, bundle size |
811
1123
  | **Trie Clean** | Clean up AI-generated "vibe code": find common mistakes and quick fixes |
812
1124
 
813
- ### UI/UX (5 skills)
1125
+ ### UI/UX (5 scouts)
814
1126
 
815
- | Skill | Description |
1127
+ | Scout | Description |
816
1128
  |-------|-------------|
817
1129
  | **Accessibility** | WCAG 2.1 AA compliance: icon-only buttons, touch targets, heading levels, ARIA validation, color-only indicators, keyboard nav, focus management, 20+ checks |
818
1130
  | **Design Engineer** | AI slop detection, verified token systems, contrast validation, design health scoring, domain-aware recommendations |
@@ -820,9 +1132,9 @@ Trie has ONE guardian agent that decides when to invoke these specialized analyz
820
1132
  | **Visual QA** | Visual regression, responsive design, cross-browser issues |
821
1133
  | **E2E** | End-to-end test coverage, user flow validation |
822
1134
 
823
- ### Operations (6 skills)
1135
+ ### Operations (6 scouts)
824
1136
 
825
- | Skill | Description |
1137
+ | Scout | Description |
826
1138
  |-------|-------------|
827
1139
  | **DevOps** | Config issues, logging, environment variables, deployment patterns |
828
1140
  | **Data Flow** | Data flow analysis, state management, API contracts |
@@ -931,15 +1243,76 @@ MODERATE (2 issues)
931
1243
  ───────────────────
932
1244
  [A11Y] Line 67: Skipped heading level: h1 to h3
933
1245
  <h3>Features</h3>
934
- Fix: Use h2 after h1
935
- WCAG: 2.4.6 Headings and Labels
936
1246
 
937
- ═══════════════════════════════════════════════════
938
- SUMMARY: 2 critical, 1 serious, 2 moderate
939
- Score: 55/100
940
- ═══════════════════════════════════════════════════
1247
+ Accessibility Score: 65/100
1248
+ ℹ️ Consider running 'trie_visual_qa_browser' to capture screenshots for Guardian visual analysis of these accessibility issues.
1249
+ ```
1250
+
1251
+ ### Guardian + Visual QA Integration
1252
+
1253
+ When the accessibility skill finds **critical or multiple serious issues**, the **Guardian agent automatically suggests** running browser-based visual QA:
1254
+
1255
+ ```bash
1256
+ # Guardian detects accessibility issues during scan
1257
+ $ trie scan src/components/
1258
+
1259
+ 🛡️ Guardian Insight
1260
+ Priority: 7 | Category: quality
1261
+
1262
+ Found 5 accessibility issues that could block users.
1263
+ Screenshots would help validate real impact.
1264
+
1265
+ Suggested Action: Capture screenshots for visual analysis
1266
+ Command: trie_visual_qa_browser url:"http://localhost:3000"
1267
+
1268
+ Affected Files:
1269
+ • Button.tsx
1270
+ • Modal.tsx
1271
+ • Form.tsx
1272
+
1273
+ Issue Breakdown:
1274
+ • critical: 2
1275
+ • serious: 3
941
1276
  ```
942
1277
 
1278
+ **How it works:**
1279
+
1280
+ 1. **Accessibility skill** runs static analysis on UI code (JSX, TSX, Vue, etc.)
1281
+ 2. Finds critical/serious WCAG violations (missing alt text, no focus indicators, etc.)
1282
+ 3. **Guardian** sees pattern: accessibility issues that need visual validation
1283
+ 4. **Guardian suggests** running `trie_visual_qa_browser` to capture screenshots
1284
+ 5. Run the command (requires your dev server running)
1285
+ 6. **Guardian analyzes screenshots** with AI vision to verify real-world impact
1286
+ 7. Get actionable feedback on actual rendering issues
1287
+
1288
+ **Example workflow:**
1289
+
1290
+ ```bash
1291
+ # 1. Start your dev server
1292
+ $ npm run dev
1293
+ # Dev server running on http://localhost:3000
1294
+
1295
+ # 2. Scan finds accessibility issues
1296
+ $ trie scan src/components/
1297
+ # Guardian: "Screenshots would help validate real impact"
1298
+
1299
+ # 3. Capture screenshots at multiple viewports
1300
+ $ trie_visual_qa_browser url:"http://localhost:3000"
1301
+ # 📸 Capturing: mobile (375x812), tablet (768x1024), desktop (1440x900)
1302
+
1303
+ # 4. Guardian analyzes with vision AI
1304
+ # Returns: "Focus indicators invisible on mobile, icon button
1305
+ # has no visible label, heading hierarchy broken causing
1306
+ # screen reader confusion"
1307
+ ```
1308
+
1309
+ **Why this matters:**
1310
+
1311
+ - **Static analysis** finds code patterns but can't see the rendered page
1312
+ - **Browser screenshots** show what users actually experience
1313
+ - **AI vision** validates whether issues truly impact accessibility
1314
+ - **Guardian synthesizes** both code analysis + visual evidence for better insights
1315
+
943
1316
  ### Usage
944
1317
 
945
1318
  ```bash
@@ -1232,7 +1605,7 @@ Run trie_super_reviewer on this PR
1232
1605
 
1233
1606
  ### Agent Smith
1234
1607
 
1235
- The ultimate AI code enforcer—43 specialized hunters targeting AI-generated anti-patterns. Runs a swarm of sub-agents to find "vibe-coded" patterns.
1608
+ The ultimate AI code enforcer—35+ specialized pattern hunters targeting AI-generated anti-patterns. Runs a swarm of hunters to find "vibe-coded" patterns.
1236
1609
 
1237
1610
  ```
1238
1611
  Run trie_agent_smith on this codebase
@@ -1562,6 +1935,16 @@ trie://team # Team ownership info
1562
1935
 
1563
1936
  Trie stores all detected incidents for search, pattern discovery, and cross-project learning. Uses BM25 ranking (same algorithm as Elasticsearch) for intelligent search.
1564
1937
 
1938
+ ### Memory System
1939
+
1940
+ **Data Integrity Improvements:**
1941
+ - **Atomic writes**: Temp file + rename pattern prevents corruption on crash/interrupt
1942
+ - **SHA256 hashing**: Cryptographic deduplication (no collision risk)
1943
+ - **Backup rotation**: 5 automated backups with recovery commands
1944
+ - **Zod validation**: Schema validation catches malformed data early
1945
+
1946
+ JSON files perform well at Trie's scale (1,000-10,000 issues). SQLite, vector embeddings, and session management add complexity without proportional value for a security scanning CLI tool.
1947
+
1565
1948
  ### Local Memory (`.trie/memory/`)
1566
1949
 
1567
1950
  Incidents from each `trie tell` command are stored locally:
@@ -1825,9 +2208,45 @@ When AI is enabled, you'll see:
1825
2208
 
1826
2209
  The guardian agent works in CI/CD by reading your project's `.trie/` directory—the same memory, patterns, and incident history you've built locally.
1827
2210
 
2211
+ ### Quick Setup (Recommended)
2212
+
2213
+ Use the `trie ci` command to generate a GitHub Actions workflow:
2214
+
2215
+ ```bash
2216
+ # Generate full workflow with SARIF + memory caching
2217
+ trie ci
2218
+
2219
+ # Generate minimal workflow
2220
+ trie ci --minimal
2221
+
2222
+ # Preview without creating files
2223
+ trie ci --dry-run
2224
+ ```
2225
+
2226
+ **What it creates:**
2227
+
2228
+ `.github/workflows/trie-scan.yml` with:
2229
+ - ✅ Memory caching across runs (enables cross-run learning)
2230
+ - ✅ SARIF output for GitHub Security tab
2231
+ - ✅ Pattern recognition: "This issue was introduced 3 PRs ago"
2232
+ - ✅ Trend tracking: improving, stable, or declining
2233
+ - ✅ Historical context: "Similar issue fixed in PR #42"
2234
+
2235
+ **Next steps after running `trie ci`:**
2236
+
2237
+ 1. Add `ANTHROPIC_API_KEY` to GitHub Secrets (Settings → Secrets → Actions)
2238
+ 2. Commit and push:
2239
+ ```bash
2240
+ git add .github/workflows/trie-scan.yml
2241
+ git commit -m "Add Trie security scan with memory"
2242
+ git push
2243
+ ```
2244
+
1828
2245
  ### GitHub Actions
1829
2246
 
1830
- Add to `.github/workflows/trie.yml`:
2247
+ **Manual setup (alternative):**
2248
+
2249
+ Or manually add to `.github/workflows/trie.yml`:
1831
2250
 
1832
2251
  ```yaml
1833
2252
  name: Trie Guardian
@@ -1854,6 +2273,27 @@ jobs:
1854
2273
  4. **Plain English**: Reports warnings just like locally
1855
2274
  5. **Fails build**: If critical issues detected (configurable)
1856
2275
 
2276
+ ### Memory Caching Benefits
2277
+
2278
+ When you use `trie ci` to generate workflows, memory is cached across runs:
2279
+
2280
+ - **Pattern recognition**: "This issue was introduced 3 PRs ago"
2281
+ - **Historical context**: "Similar issue was fixed in PR #42"
2282
+ - **Trend tracking**: Improving, stable, or declining
2283
+ - **Resolution tracking**: Knows when issues get fixed
2284
+ - **Cross-PR learning**: Patterns from one PR inform future PRs
2285
+
2286
+ ### Advanced Examples
2287
+
2288
+ See `.github/workflows/examples.md` for comprehensive workflow examples:
2289
+ - Multi-environment scanning (dev/staging/prod)
2290
+ - Scheduled security audits
2291
+ - Custom output processing
2292
+ - Integration with existing tools (ESLint, Snyk, etc.)
2293
+ - Memory persistence strategies
2294
+ - Organization-wide memory sharing
2295
+ - Compliance reporting (SOC2, etc.)
2296
+
1857
2297
  ### Full Skill Scan
1858
2298
 
1859
2299
  For deeper analysis (security, privacy, etc.), add a weekly/nightly job:
@@ -1889,6 +2329,105 @@ jobs:
1889
2329
  | `streaming` | Stream progress updates | `true` |
1890
2330
  | `workers` | Use worker threads | `true` |
1891
2331
 
2332
+ ### Auto-Escalation Setup
2333
+
2334
+ Auto-escalate critical security issues to Slack, email, or webhooks.
2335
+
2336
+ **Quick Setup:**
2337
+
2338
+ 1. Create `.trie/config.json` in your project root
2339
+ 2. Add escalation configuration:
2340
+
2341
+ ```json
2342
+ {
2343
+ "escalation": {
2344
+ "enabled": true,
2345
+ "targets": [
2346
+ {
2347
+ "type": "slack",
2348
+ "enabled": true,
2349
+ "config": {
2350
+ "webhookUrl": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
2351
+ "channel": "#security-alerts",
2352
+ "username": "Trie Guardian"
2353
+ },
2354
+ "forSeverities": ["critical"],
2355
+ "forCategories": ["security", "all"]
2356
+ }
2357
+ ],
2358
+ "cooldownMinutes": 15,
2359
+ "maxEscalationsPerHour": 5,
2360
+ "respectQuietHours": true,
2361
+ "criticalBypassQuietHours": true
2362
+ }
2363
+ }
2364
+ ```
2365
+
2366
+ **Target Types:**
2367
+
2368
+ | Type | Description | Required Config |
2369
+ |------|-------------|-----------------|
2370
+ | `slack` | Slack webhook | `webhookUrl`, optional `channel`, `username` |
2371
+ | `webhook` | Custom POST endpoint | `webhookUrl` |
2372
+ | `email` | Email notification | `email` (SMTP config in env) |
2373
+
2374
+ **Get Slack Webhook URL:**
2375
+
2376
+ 1. Go to https://api.slack.com/apps
2377
+ 2. Create new app or select existing
2378
+ 3. Enable "Incoming Webhooks"
2379
+ 4. Add webhook to workspace
2380
+ 5. Copy webhook URL
2381
+
2382
+ **Multiple Targets:**
2383
+
2384
+ ```json
2385
+ {
2386
+ "escalation": {
2387
+ "targets": [
2388
+ {
2389
+ "type": "slack",
2390
+ "enabled": true,
2391
+ "config": { "webhookUrl": "..." },
2392
+ "forSeverities": ["critical"],
2393
+ "forCategories": ["security"]
2394
+ },
2395
+ {
2396
+ "type": "webhook",
2397
+ "enabled": true,
2398
+ "config": { "webhookUrl": "https://your-api.com/alerts" },
2399
+ "forSeverities": ["critical", "serious"],
2400
+ "forCategories": ["all"]
2401
+ }
2402
+ ]
2403
+ }
2404
+ }
2405
+ ```
2406
+
2407
+ **Configuration Options:**
2408
+
2409
+ | Option | Description | Default |
2410
+ |--------|-------------|---------|
2411
+ | `enabled` | Enable auto-escalation | `true` |
2412
+ | `cooldownMinutes` | Minutes between escalations of same file | `15` |
2413
+ | `maxEscalationsPerHour` | Max escalations per hour | `5` |
2414
+ | `respectQuietHours` | Respect quiet hours (9pm-8am) | `true` |
2415
+ | `criticalBypassQuietHours` | Critical issues bypass quiet hours | `true` |
2416
+
2417
+ **Test Your Configuration:**
2418
+
2419
+ ```bash
2420
+ # Watch mode will show escalation status
2421
+ trie watch
2422
+
2423
+ # Check Guardian insights panel (press 'g')
2424
+ # You'll see "Auto-escalation: enabled (1 target)" if configured correctly
2425
+ ```
2426
+
2427
+ **TUI Configuration:**
2428
+
2429
+ Press `c` in watch mode to open Guardian Agent configuration menu (escalation configuration UI coming soon).
2430
+
1892
2431
  ### Example
1893
2432
 
1894
2433
  ```