couchloop-eq-mcp 1.4.2 → 2.0.1
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 +31 -4
- package/dist/clients/shrinkChatClient.d.ts +4 -4
- package/dist/developer/managers/context-manager.d.ts +24 -45
- package/dist/developer/managers/context-manager.d.ts.map +1 -1
- package/dist/developer/managers/context-manager.js +177 -244
- package/dist/developer/managers/context-manager.js.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/tools/check-versions.d.ts +4 -4
- package/dist/tools/couchloop-v2.d.ts +52 -0
- package/dist/tools/couchloop-v2.d.ts.map +1 -0
- package/dist/tools/couchloop-v2.js +425 -0
- package/dist/tools/couchloop-v2.js.map +1 -0
- package/dist/tools/detect-build-context.d.ts +2 -2
- package/dist/tools/prevent-ai-errors.d.ts +3 -3
- package/dist/tools/primary-tools.d.ts +1 -85
- package/dist/tools/primary-tools.d.ts.map +1 -1
- package/dist/tools/primary-tools.js +36 -13
- package/dist/tools/primary-tools.js.map +1 -1
- package/dist/tools/smart-context.d.ts +1 -1
- package/dist/tools/status.d.ts +2 -2
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +2 -3
- package/dist/tools/status.js.map +1 -1
- package/dist/tools/verify.d.ts +4 -4
- package/dist/types/context.d.ts +4 -4
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/context.js +1 -1
- package/dist/types/context.js.map +1 -1
- package/dist/types/session.d.ts +2 -2
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -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 is
|
|
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.
|
|
35
35
|
|
|
36
36
|
## Why CouchLoop EQ?
|
|
37
37
|
|
|
@@ -48,6 +48,33 @@ 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
|
|
52
|
+
|
|
53
|
+
CouchLoop EQ has been completely redesigned from a monolithic router to a high-performance modular system:
|
|
54
|
+
|
|
55
|
+
### Architecture Evolution
|
|
56
|
+
```
|
|
57
|
+
V1: couchloop → regex patterns → direct tool execution (slow, rigid)
|
|
58
|
+
V2: Request → Classify → Policy → Plan → Execute → Compose (fast, flexible)
|
|
59
|
+
```
|
|
60
|
+
|
|
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
|
|
73
|
+
- **Execution Planner**: DAG generation for parallel operations
|
|
74
|
+
- **Tool Registry**: Real-time health tracking and circuit breakers
|
|
75
|
+
- **OpenTelemetry**: Distributed tracing across all stages
|
|
76
|
+
- **Feature Flags**: Gradual rollout control (0-100%)
|
|
77
|
+
|
|
51
78
|
## Key Safety Features
|
|
52
79
|
|
|
53
80
|
### Behavioral Governance
|
|
@@ -142,11 +169,11 @@ For local development:
|
|
|
142
169
|
- Use ngrok or deploy your own server
|
|
143
170
|
- Follow setup in [CHATGPT_SETUP.md](CHATGPT_SETUP.md)
|
|
144
171
|
|
|
145
|
-
## Available Tools (
|
|
172
|
+
## Available Tools (11 Primary - V2 Architecture)
|
|
146
173
|
|
|
147
|
-
CouchLoop EQ
|
|
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.
|
|
148
175
|
|
|
149
|
-
> **
|
|
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.
|
|
150
177
|
|
|
151
178
|
### Universal Entry Point
|
|
152
179
|
|
|
@@ -65,11 +65,11 @@ export declare const ShrinkResponseSchema: z.ZodObject<{
|
|
|
65
65
|
phone?: string | undefined;
|
|
66
66
|
}[] | undefined;
|
|
67
67
|
escalationPath?: string | undefined;
|
|
68
|
+
message?: string | undefined;
|
|
68
69
|
error?: string | undefined;
|
|
69
70
|
messageId?: string | undefined;
|
|
70
71
|
crisis_confidence?: number | undefined;
|
|
71
72
|
crisis_indicators?: string[] | undefined;
|
|
72
|
-
message?: string | undefined;
|
|
73
73
|
crisisDetected?: boolean | undefined;
|
|
74
74
|
reply?: string | undefined;
|
|
75
75
|
response_text?: string | undefined;
|
|
@@ -98,11 +98,11 @@ export declare const ShrinkResponseSchema: z.ZodObject<{
|
|
|
98
98
|
phone?: string | undefined;
|
|
99
99
|
}[] | undefined;
|
|
100
100
|
escalationPath?: string | undefined;
|
|
101
|
+
message?: string | undefined;
|
|
101
102
|
error?: string | undefined;
|
|
102
103
|
messageId?: string | undefined;
|
|
103
104
|
crisis_confidence?: number | undefined;
|
|
104
105
|
crisis_indicators?: string[] | undefined;
|
|
105
|
-
message?: string | undefined;
|
|
106
106
|
crisisDetected?: boolean | undefined;
|
|
107
107
|
reply?: string | undefined;
|
|
108
108
|
response_text?: string | undefined;
|
|
@@ -127,14 +127,14 @@ export declare const ErrorResponseSchema: z.ZodObject<{
|
|
|
127
127
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
128
128
|
}, "strip", z.ZodTypeAny, {
|
|
129
129
|
code?: string | undefined;
|
|
130
|
-
error?: string | undefined;
|
|
131
130
|
message?: string | undefined;
|
|
131
|
+
error?: string | undefined;
|
|
132
132
|
details?: unknown;
|
|
133
133
|
error_type?: string | undefined;
|
|
134
134
|
}, {
|
|
135
135
|
code?: string | undefined;
|
|
136
|
-
error?: string | undefined;
|
|
137
136
|
message?: string | undefined;
|
|
137
|
+
error?: string | undefined;
|
|
138
138
|
details?: unknown;
|
|
139
139
|
error_type?: string | undefined;
|
|
140
140
|
}>;
|
|
@@ -1,61 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
27
|
+
* Check context window usage and return store metadata.
|
|
28
28
|
*/
|
|
29
29
|
check(includeMetadata?: boolean): Promise<PreserveContextResponse>;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"context-manager.d.ts","sourceRoot":"","sources":["../../../src/developer/managers/context-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,mBAAmB,EAEnB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAOhC;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACG,UAAU,CACd,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IAgCnC;;;OAGG;IACG,QAAQ,CACZ,QAAQ,CAAC,EAAE,mBAAmB,EAC9B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,CAAC;IAuEnC;;OAEG;IACG,KAAK,CAAC,eAAe,UAAQ,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA+DtE;;OAEG;IACG,OAAO,CAAC,OAAO,SAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAmC7D,yFAAyF;IACzF,OAAO,CAAC,OAAO;IAWf,+EAA+E;IAC/E,OAAO,CAAC,QAAQ;CAQjB;AAKD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAKjE"}
|