couchloop-eq-mcp 2.0.0 → 2.0.2

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CouchLoop EQ MCP Server
1
+ # CouchLoop EQ - MCP Server
2
2
 
3
3
  Behavioral governance layer for safer, more consistent AI conversations.
4
4
 
@@ -31,7 +31,7 @@ Behavioral governance layer for safer, more consistent AI conversations.
31
31
 
32
32
  ## What is CouchLoop EQ?
33
33
 
34
- CouchLoop EQ v2.0 is a **high-performance, modular orchestration system** for AI behavioral governance. Built on MCP (Model Context Protocol), it provides confidence-based routing, parallel execution, and comprehensive observability—while monitoring for hallucination, inconsistency, and unsafe reasoning patterns.
34
+ CouchLoop EQ is a behavioral governance layer for AI assistants. Built on MCP (Model Context Protocol), it monitors for hallucination, inconsistency, and unsafe reasoning patterns while managing stateful AI sessions.
35
35
 
36
36
  ## Why CouchLoop EQ?
37
37
 
@@ -48,32 +48,19 @@ Unlike raw LLMs that can hallucinate packages, generate insecure code, and lose
48
48
  | 🔍 **Sloppy AI code** | `verify` pre-checks AI responses for hallucinated APIs and bad imports |
49
49
  | 💡 **Unstructured thinking** | `brainstorm` helps think through trade-offs, compare options, decompose ideas |
50
50
 
51
- ## 🚀 New in v2.0: Modular Orchestration Architecture
51
+ ## Architecture
52
52
 
53
- CouchLoop EQ has been completely redesigned from a monolithic router to a high-performance modular system:
53
+ CouchLoop EQ uses a modular pipeline:
54
54
 
55
- ### Architecture Evolution
56
55
  ```
57
- V1: couchloop regex patterns direct tool execution (slow, rigid)
58
- V2: Request → Classify → Policy → Plan → Execute → Compose (fast, flexible)
56
+ Request -> Classify -> Policy -> Plan -> Execute -> Compose
59
57
  ```
60
58
 
61
- ### Performance Improvements
62
- | Metric | V1 | V2 | Improvement |
63
- |--------|-----|-----|------------|
64
- | **P95 Latency** | 4.5s | < 3.0s | 33% faster |
65
- | **Direct Routing** | 0% | 60%+ | Bypasses router for high confidence |
66
- | **Parallel Execution** | No | Yes | 2-4x throughput |
67
- | **Circuit Breakers** | No | Yes | Auto-recovery from failures |
68
- | **Observability** | Basic logs | Full tracing | 100% request visibility |
69
-
70
- ### V2 Core Components
71
- - **Intent Classifier**: Confidence-based routing (no more regex-only)
72
- - **Policy Engine**: Health-aware decisions with fallbacks
59
+ - **Intent Classifier**: Confidence-based routing with multi-intent detection
60
+ - **Policy Engine**: Health-aware routing with fallbacks and crisis override
73
61
  - **Execution Planner**: DAG generation for parallel operations
74
- - **Tool Registry**: Real-time health tracking and circuit breakers
62
+ - **Tool Registry**: Health tracking and circuit breakers
75
63
  - **OpenTelemetry**: Distributed tracing across all stages
76
- - **Feature Flags**: Gradual rollout control (0-100%)
77
64
 
78
65
  ## Key Safety Features
79
66
 
@@ -100,7 +87,7 @@ V2: Request → Classify → Policy → Plan → Execute → Compose (fast, flex
100
87
 
101
88
  ## Quick Start
102
89
 
103
- CouchLoop EQ is a standard MCP server that works with **any MCP-compatible client**—Claude Desktop, ChatGPT, Cursor, Windsurf, VS Code, and more.
90
+ CouchLoop EQ is a standard MCP server that works with **any MCP-compatible client** - Claude Desktop, ChatGPT, Cursor, Windsurf, VS Code, and more.
104
91
 
105
92
  ### Option 1: Connect to Hosted Server (Easiest)
106
93
 
@@ -121,7 +108,7 @@ For Claude Desktop (v0.7.0+), add to `~/Library/Application Support/Claude/claud
121
108
 
122
109
  Restart Claude and try: **"Start a daily reflection session"**
123
110
 
124
- ### Option 2: Run Locally (v1.2.0)
111
+ ### Option 2: Run Locally
125
112
 
126
113
  ```bash
127
114
  npm install -g couchloop-eq-mcp
@@ -142,7 +129,7 @@ Add to Claude Desktop configuration:
142
129
  }
143
130
  ```
144
131
 
145
- **New in v1.0.4**: Sessions automatically persist locally to `~/.couchloop-mcp/identity.json` - no signup required!
132
+ Sessions automatically persist locally to `~/.couchloop-mcp/identity.json` - no signup required.
146
133
 
147
134
  ### For ChatGPT (Developer Mode)
148
135
 
@@ -169,40 +156,44 @@ For local development:
169
156
  - Use ngrok or deploy your own server
170
157
  - Follow setup in [CHATGPT_SETUP.md](CHATGPT_SETUP.md)
171
158
 
172
- ## Available Tools (11 Primary - V2 Architecture)
159
+ ## Available Tools (10 Primary)
173
160
 
174
- CouchLoop EQ v2.0 uses a consolidated 11-tool architecture with intelligent routing. The `couchloop_router` is now **only used for ambiguous requests**—high-confidence intents go direct to tools for 60%+ faster execution.
175
-
176
- > **v2.0:** Direct routing for high confidence (bypasses router), parallel execution for multi-intent requests, circuit breakers for automatic recovery, and full OpenTelemetry tracing.
161
+ CouchLoop EQ provides 10 MCP tools with intelligent routing. The `couchloop` intent router handles ambiguous or multi-intent requests, while high-confidence intents can call tools directly.
177
162
 
178
163
  ### Universal Entry Point
179
164
 
180
165
  | Tool | Description |
181
166
  | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
182
- | `couchloop` | **Intent router** Routes any loose command to the right tool. Use for: "end session", "save this", "review code", "brainstorm this", "help me", etc. |
167
+ | `couchloop` | **Intent router** - Routes any loose command to the right tool. Use for: "end session", "save this", "review code", "brainstorm this", "help me", etc. |
168
+
169
+ ### Governance
170
+
171
+ | Tool | Description |
172
+ | ------- | -------------------------------------------------------------------------------------------------------- |
173
+ | `guard` | **Per-turn governance** - Evaluates draft responses before delivery. Actions: pass, modified, or blocked |
183
174
 
184
175
  ### Core Tools
185
176
 
186
177
  | Tool | Description |
187
178
  | --------------- | --------------------------------------------------------------------------------------------------------------------- |
188
- | `verify` | **Pre-delivery verification** Catches AI hallucinations, validates packages, checks code before presenting to users |
189
- | `status` | **Dashboard** Session progress, history, context window usage, protection status, preferences |
179
+ | `verify` | **Pre-delivery verification** - Catches AI hallucinations, validates packages, checks code before presenting to users |
180
+ | `status` | **Dashboard** - Session progress, history, context window usage, protection status, preferences |
190
181
  | `conversation` | AI conversation with crisis detection and session memory. Actions: start, send, end, resume, status |
191
- | `brainstorm` | **Standalone dev thinking partner** trade-off analysis, feature design, architecture decisions |
192
- | `code_review` | Complete code analysis security vulnerabilities, code smells, AI-generated errors |
193
- | `package_audit` | Dependency audit validates packages exist, checks versions, finds vulnerabilities |
182
+ | `brainstorm` | **Standalone dev thinking partner** - trade-off analysis, feature design, architecture decisions |
183
+ | `code_review` | Complete code analysis - security vulnerabilities, code smells, AI-generated errors |
184
+ | `package_audit` | Dependency audit - validates packages exist, checks versions, finds vulnerabilities |
194
185
  | `remember` | Save and recall context, checkpoints, insights across sessions |
195
- | `protect` | File protection backup, freeze, rollback, restore |
186
+ | `protect` | File protection - backup, freeze, rollback, restore |
196
187
 
197
188
  ### Usage Examples
198
189
 
199
190
  ```
200
191
  # Via intent router (recommended for loose commands)
201
- "end session" couchloop routes to conversation(action: end)
202
- "save this for later" couchloop routes to remember(action: save)
203
- "review my code" couchloop routes to code_review
204
- "brainstorm a feature" couchloop routes to brainstorm
205
- "what can you do" couchloop returns capabilities list
192
+ "end session" -> couchloop routes to conversation(action: end)
193
+ "save this for later" -> couchloop routes to remember(action: save)
194
+ "review my code" -> couchloop routes to code_review
195
+ "brainstorm a feature" -> couchloop routes to brainstorm
196
+ "what can you do" -> couchloop returns capabilities list
206
197
 
207
198
  # Direct tool calls (for precise control)
208
199
  conversation(action: "start", message: "Begin daily reflection")
@@ -214,7 +205,7 @@ code_review(code: "function foo()...") # Analyze code
214
205
 
215
206
  ## Real-World Usage
216
207
 
217
- CouchLoop EQ is actively used in production development. Here's what 2 weeks of actual usage looks like:
208
+ CouchLoop EQ is actively used in production development. Here is what 2 weeks of actual usage looked like:
218
209
 
219
210
  ### Usage Statistics
220
211
 
@@ -268,22 +259,22 @@ This insight was captured mid-debugging session, preserved across context window
268
259
 
269
260
  | Feature Size | Recommended Actions |
270
261
  | --------------------- | -------------------------------------------------------------------------------------------- |
271
- | **Small fix** | `save_insight` Quick note of what was done and why |
272
- | **Medium feature** | `save_insight` + `save_checkpoint` Capture decisions and state |
273
- | **Large feature set** | `preserve_context` + `save_checkpoint` + multiple `save_insight` Full architecture context |
262
+ | **Small fix** | `remember` with type `insight` - Quick note of what was done and why |
263
+ | **Medium feature** | `remember` with type `insight` + `checkpoint` - Capture decisions and state |
264
+ | **Large feature set** | Multiple `remember` calls (insight, checkpoint, decision) - Full architecture context |
274
265
 
275
- **Why this matters:** When you need to review or debug later, you can retrieve the exact context of what was just builteven weeks later, across different AI sessions.
266
+ **Why this matters:** When you need to review or debug later, you can retrieve the exact context of what was just built - even weeks later, across different AI sessions.
276
267
 
277
268
  ```
278
- "Get my insights tagged 'auth-refactor'" Instant recall of decisions made
279
- "Resume my Sprint 42 session" Pick up exactly where you left off
269
+ "Get my insights tagged 'auth-refactor'" -> Instant recall of decisions made
270
+ "Resume my Sprint 42 session" -> Pick up exactly where you left off
280
271
  ```
281
272
 
282
273
  ## Available Journeys
283
274
 
284
- - **Daily Reflection** (5 min) A brief check-in to process your day
285
- - **Gratitude Practice** (3 min) Notice and name three things you appreciate
286
- - **Weekly Review** (10 min) Look back on your week and set intentions
275
+ - **Daily Reflection** (5 min) - A brief check-in to process your day
276
+ - **Gratitude Practice** (3 min) - Notice and name three things you appreciate
277
+ - **Weekly Review** (10 min) - Look back on your week and set intentions
287
278
 
288
279
  ## Example Usage
289
280
 
@@ -1,61 +1,40 @@
1
- import { ContextEntry, ContextCategoryType, PreserveContextResponse } from '../../types/context.js';
2
- interface ContextStore {
3
- version: string;
4
- entries: ContextEntry[];
5
- metadata: {
6
- created_at: string;
7
- last_updated: string;
8
- };
9
- }
1
+ import { ContextCategoryType, PreserveContextResponse } from '../../types/context.js';
2
+ /**
3
+ * ContextManager — Supabase-backed context storage.
4
+ *
5
+ * Replaces the previous filesystem implementation (context-store.json)
6
+ * which failed in containerised deployments (Railway) where the application
7
+ * filesystem is read-only at runtime.
8
+ *
9
+ * Uses the existing getSupabase() singleton from db/client.ts — no new
10
+ * connections, no environment branching. Works identically in local dev,
11
+ * staging, and production as long as SUPABASE_* env vars are set.
12
+ *
13
+ * Falls back gracefully (degraded mode) when Supabase is unavailable so
14
+ * the MCP server can still respond to tool/list requests.
15
+ */
10
16
  export declare class ContextManager {
11
- private store;
12
- private isInitialized;
13
- constructor();
14
- /**
15
- * Initialize the context store from disk
16
- */
17
- initialize(): Promise<void>;
18
17
  /**
19
- * Store a context entry
18
+ * Store a context entry.
20
19
  */
21
20
  storeEntry(category: ContextCategoryType, content: string): Promise<PreserveContextResponse>;
22
21
  /**
23
- * Retrieve context entries by category or search term
22
+ * Retrieve context entries — optionally filtered by category and/or search term.
23
+ * Increments usage_count and updates last_accessed as a fire-and-forget side effect.
24
24
  */
25
25
  retrieve(category?: ContextCategoryType, searchTerm?: string): Promise<PreserveContextResponse>;
26
26
  /**
27
- * Check context window status and provide warnings if needed
27
+ * Check context window usage and return store metadata.
28
28
  */
29
29
  check(includeMetadata?: boolean): Promise<PreserveContextResponse>;
30
30
  /**
31
- * Get metadata about the context store
32
- */
33
- private getMetadata;
34
- /**
35
- * Clear old or unused context entries (cleanup)
31
+ * Remove entries older than `daysOld` days.
36
32
  */
37
33
  cleanup(daysOld?: number): Promise<PreserveContextResponse>;
38
- /**
39
- * Export all context for backup
40
- */
41
- export(): Promise<ContextStore>;
42
- /**
43
- * Import context from backup
44
- */
45
- import(store: ContextStore): Promise<void>;
46
- /**
47
- * Create default context store
48
- */
49
- private createDefaultStore;
50
- /**
51
- * Save store to disk
52
- */
53
- private save;
54
- /**
55
- * Ensure manager is initialized
56
- */
57
- private ensureInitialized;
34
+ /** Map a raw Supabase row to the ContextEntry shape used by the rest of the codebase. */
35
+ private toEntry;
36
+ /** Return a consistent degraded-mode response when Supabase is unavailable. */
37
+ private degraded;
58
38
  }
59
39
  export declare function getContextManager(): Promise<ContextManager>;
60
- export {};
61
40
  //# sourceMappingURL=context-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../../../src/developer/managers/context-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,mBAAmB,EAEnB,uBAA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