@helm-protocol/ttt-mcp 0.2.2 → 0.3.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 +327 -171
- package/dist/auth.js +1 -1
- package/dist/index.js +213 -166
- package/dist/server.js +136 -0
- package/dist/tools.js +376 -9
- package/package.json +26 -5
package/README.md
CHANGED
|
@@ -1,305 +1,461 @@
|
|
|
1
1
|
# @helm-protocol/ttt-mcp
|
|
2
2
|
|
|
3
|
-
> Reference implementation of [draft-helmprotocol-tttps
|
|
3
|
+
> Reference implementation of [draft-helmprotocol-tttps](https://datatracker.ietf.org/doc/draft-helmprotocol-tttps/) (IETF Experimental)
|
|
4
4
|
|
|
5
5
|
**MCP Server for OpenTTT — Proof of Time tools for AI agents**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Problem: Workflow Amnesia
|
|
10
|
+
|
|
11
|
+
Every Claude Code long-horizon workflow hits the same wall: **context compression erases action history.**
|
|
12
|
+
|
|
13
|
+
Agent B has no memory of what Agent A decided. Agent A resumes after compression with no record of its own prior steps. Duplicate work. Lost decisions. State corruption.
|
|
14
|
+
|
|
15
|
+
**ttt-mcp is the external causal chain that survives context compression.**
|
|
16
|
+
|
|
17
|
+
Every workflow step is anchored to a cryptographic timestamp on an **external server** — physically separate from Claude's context window. When compression happens, agents call `pot_query(eventId)` for O(1) exact step recall and resume with full causal context.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
Claude workflow → [context compressed] → agents call pot_query(eventId)
|
|
21
|
+
→ external server returns full timeline
|
|
22
|
+
→ workflow resumes, zero lost state
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Mathematical Guarantees
|
|
28
|
+
|
|
29
|
+
| Layer | Mechanism | Guarantee |
|
|
30
|
+
|-------|-----------|-----------|
|
|
31
|
+
| **Identity** | SHA-3 eventId (256-bit) | Collision probability 2⁻²⁵⁶ — practically zero |
|
|
32
|
+
| **Lookup** | O(1) exact retrieval | No context consumed by history reconstruction |
|
|
33
|
+
| **Ordering** | TTTPS causal timestamps | Total order on events — tamper-proof sequence proof |
|
|
34
|
+
| **Causal chain** | prevEventId DAG | O(depth) traversal — depth ~100 for 1B-token workflows |
|
|
35
|
+
| **Non-repudiation** | Ed25519 signature | Cryptographic proof of who acted when |
|
|
36
|
+
| **Resilience** | Erasure-coded cryptographic shards | ≥97% recovery at BER=0.05, 99.88% at BER=0.02 (theoretical) |
|
|
37
|
+
| **Persistence** | Redis AOF + 90-day TTL | Server survives context compression and restarts |
|
|
38
|
+
|
|
39
|
+
---
|
|
13
40
|
|
|
14
41
|
## Quick Start
|
|
15
42
|
|
|
43
|
+
### Claude Code
|
|
44
|
+
|
|
16
45
|
```bash
|
|
17
|
-
|
|
46
|
+
claude mcp add ttt -- npx -y @helm-protocol/ttt-mcp@0.3.0
|
|
18
47
|
```
|
|
19
48
|
|
|
49
|
+
With an API key (raises the free limit to your plan's monthly quota):
|
|
50
|
+
```bash
|
|
51
|
+
claude mcp add ttt -e TTT_API_KEY=your-key -- npx -y @helm-protocol/ttt-mcp@0.3.0
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Claude Desktop
|
|
55
|
+
|
|
56
|
+
Add to `claude_desktop_config.json`:
|
|
57
|
+
|
|
20
58
|
```json
|
|
21
|
-
// claude_desktop_config.json
|
|
22
59
|
{
|
|
23
60
|
"mcpServers": {
|
|
24
61
|
"ttt": {
|
|
25
62
|
"command": "npx",
|
|
26
|
-
"args": ["@helm-protocol/ttt-mcp"]
|
|
63
|
+
"args": ["-y", "@helm-protocol/ttt-mcp@0.3.0"],
|
|
64
|
+
"env": { "TTT_API_KEY": "your-key" }
|
|
27
65
|
}
|
|
28
66
|
}
|
|
29
67
|
}
|
|
30
68
|
```
|
|
31
69
|
|
|
32
|
-
|
|
70
|
+
### Cursor
|
|
33
71
|
|
|
34
|
-
|
|
72
|
+
[](https://cursor.com/install-mcp?name=ttt&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBoZWxtLXByb3RvY29sL3R0dC1tY3BAMC4zLjAiXX0=)
|
|
35
73
|
|
|
36
|
-
|
|
37
|
-
|------|-------------|
|
|
38
|
-
| `pot_generate` | Generate a Proof of Time for a transaction |
|
|
39
|
-
| `pot_verify` | Verify a Proof of Time using its hash and GRG shards |
|
|
40
|
-
| `pot_query` | Query PoT history from local log and on-chain subgraph |
|
|
41
|
-
| `pot_stats` | Get turbo/full mode statistics for a time period |
|
|
42
|
-
| `pot_health` | Check system health: time sources, subgraph sync, uptime |
|
|
74
|
+
One-click install, or add the same `mcpServers` block above to `.cursor/mcp.json`.
|
|
43
75
|
|
|
44
|
-
|
|
76
|
+
Free tier: 100 calls/day per IP — no signup needed.
|
|
45
77
|
|
|
46
|
-
|
|
78
|
+
---
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
## 5-Minute Test
|
|
49
81
|
|
|
50
|
-
|
|
51
|
-
|-----------|------|----------|-------------|
|
|
52
|
-
| txHash | string | Yes | Transaction hash (hex with 0x prefix) |
|
|
53
|
-
| chainId | number | Yes | Chain ID (e.g. 8453 for Base, 84532 for Base Sepolia) |
|
|
54
|
-
| poolAddress | string | Yes | DEX pool contract address |
|
|
82
|
+
Once connected, run this sequence in Claude:
|
|
55
83
|
|
|
56
|
-
|
|
84
|
+
**Step 1 — Stamp a workflow step:**
|
|
85
|
+
|
|
86
|
+
Just tell Claude naturally:
|
|
87
|
+
> "Stamp this step as my-first-step"
|
|
88
|
+
> "Record what I just did as refactor-auth-step1"
|
|
89
|
+
|
|
90
|
+
Claude calls `pot_generate` automatically. Or call it directly:
|
|
91
|
+
```
|
|
92
|
+
pot_generate(eventId: "my-first-step")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Step 2 — Simulate context compression:** start a new Claude session
|
|
96
|
+
|
|
97
|
+
**Step 3 — Recover in the new session:**
|
|
98
|
+
|
|
99
|
+
Tell Claude:
|
|
100
|
+
> "What did I do in my-first-step?"
|
|
101
|
+
> "Recover my last workflow state"
|
|
102
|
+
|
|
103
|
+
Or call directly:
|
|
104
|
+
```
|
|
105
|
+
pot_query(eventId: "my-first-step")
|
|
106
|
+
```
|
|
107
|
+
→ Returns exact record. Amnesia gone.
|
|
108
|
+
|
|
109
|
+
**Step 4 — Build a causal chain:**
|
|
110
|
+
```
|
|
111
|
+
pot_generate(eventId: "step-2", prevEventId: "my-first-step")
|
|
112
|
+
pot_graph(eventId: "step-2", depth: 5)
|
|
113
|
+
```
|
|
114
|
+
→ Full backward chain. Cryptographically ordered.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 7 Tools
|
|
119
|
+
|
|
120
|
+
| Tool | Purpose |
|
|
121
|
+
|------|---------|
|
|
122
|
+
| `pot_generate` | Stamp a workflow step with a cryptographic timestamp |
|
|
123
|
+
| `pot_verify` | Verify a PoT signature |
|
|
124
|
+
| `pot_query` | O(1) exact lookup by eventId — core amnesia recovery |
|
|
125
|
+
| `pot_graph` | Traverse causal DAG (backward + forward chain) |
|
|
126
|
+
| `pot_checkpoint` | Roll up events into a compressed summary — use every ~100 events or before long tasks |
|
|
127
|
+
| `pot_stats` | Server statistics and mode status |
|
|
128
|
+
| `pot_health` | Health check |
|
|
57
129
|
|
|
58
|
-
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Tool Parameters
|
|
133
|
+
|
|
134
|
+
### pot_generate
|
|
135
|
+
|
|
136
|
+
Stamp a workflow step with a cryptographic timestamp. For Claude Code: use `eventId` + `prevEventId`. For DeFi: use `txHash` + `chainId` + `poolAddress`. One of `eventId` or `txHash` is required.
|
|
59
137
|
|
|
60
138
|
| Parameter | Type | Required | Description |
|
|
61
139
|
|-----------|------|----------|-------------|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
140
|
+
| eventId | string | Either/or | Workflow step identifier. E.g. `"refactor_auth_step1"` |
|
|
141
|
+
| prevEventId | string | No | Previous step's eventId — links steps into a causal chain |
|
|
142
|
+
| txHash | string | Either/or | Transaction hash (DeFi, hex with 0x prefix) |
|
|
143
|
+
| chainId | number | No | EVM chain ID (DeFi) |
|
|
144
|
+
| poolAddress | string | No | DEX pool contract address (DeFi) |
|
|
66
145
|
|
|
67
146
|
### pot_query
|
|
68
147
|
|
|
69
|
-
Query Proof of Time
|
|
148
|
+
Query Proof of Time records. Use `eventId` for O(1) exact lookup after context compression.
|
|
70
149
|
|
|
71
150
|
| Parameter | Type | Required | Description |
|
|
72
151
|
|-----------|------|----------|-------------|
|
|
152
|
+
| eventId | string | No | Exact step lookup — collision probability 2⁻²⁵⁶ |
|
|
73
153
|
| startTime | number | No | Start time (unix ms). Default: 24h ago |
|
|
74
154
|
| endTime | number | No | End time (unix ms). Default: now |
|
|
75
155
|
| limit | number | No | Max entries to return. Default: 100, max: 1000 |
|
|
76
156
|
|
|
77
|
-
###
|
|
157
|
+
### pot_graph
|
|
78
158
|
|
|
79
|
-
|
|
159
|
+
Traverse the causal chain from any step. Returns backward chain (ancestors) and forward chain (descendants).
|
|
80
160
|
|
|
81
161
|
| Parameter | Type | Required | Description |
|
|
82
162
|
|-----------|------|----------|-------------|
|
|
83
|
-
|
|
|
163
|
+
| eventId | string | Yes | Step to traverse from |
|
|
164
|
+
| depth | number | No | Max backward depth. Default: 10, max: 100 |
|
|
84
165
|
|
|
85
|
-
|
|
166
|
+
**Returns:**
|
|
167
|
+
- `backwardChain` — ancestors in chronological order (depth-compressed for large chains)
|
|
168
|
+
- `forwardChain` — steps that follow the given eventId
|
|
169
|
+
- `chainBroken` — `true` if a gap is detected (ancestor was evicted from ring buffer, or the chain root references an unknown entry)
|
|
170
|
+
- `brokenAt` — `"server_restart"` if the gap was caused by a server restart clearing in-memory state; otherwise the eventId at which the break occurred; `null` if chain is intact
|
|
171
|
+
- `reachableDepth` — number of ancestors successfully traversed before the gap (or chain root)
|
|
172
|
+
|
|
173
|
+
**Causal chain gap causes:**
|
|
174
|
+
- **`server_restart`**: the server restarted and the in-memory DAG was cleared. If Redis is available and `REDIS_URL` is set, the DAG is rebuilt from Redis on startup — reducing restart gaps.
|
|
175
|
+
- **Ring-buffer eviction**: the ring buffer holds the most recent 10,000 events in memory. Ancestors beyond that window show as `chainBroken: true` with `brokenAt` set to the oldest reachable eventId.
|
|
86
176
|
|
|
87
|
-
|
|
177
|
+
**Recovering from a gap**: call `pot_checkpoint` before long tasks to compress and preserve the chain within the token budget, or use Redis persistence to survive restarts.
|
|
178
|
+
|
|
179
|
+
### pot_verify
|
|
88
180
|
|
|
89
181
|
| Parameter | Type | Required | Description |
|
|
90
182
|
|-----------|------|----------|-------------|
|
|
91
|
-
|
|
|
183
|
+
| potHash | string | Yes | PoT hash to verify (hex with 0x prefix) |
|
|
184
|
+
| grgShards | string[] | Yes | Array of hex-encoded cryptographic integrity shards |
|
|
185
|
+
| chainId | number | Yes | EVM chain ID |
|
|
186
|
+
| poolAddress | string | Yes | Uniswap V4 pool address |
|
|
92
187
|
|
|
93
|
-
|
|
188
|
+
### pot_stats
|
|
94
189
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
txHash: "0xabc123...",
|
|
99
|
-
chainId: 84532,
|
|
100
|
-
poolAddress: "0xdef456..."
|
|
101
|
-
});
|
|
190
|
+
| Parameter | Type | Required | Description |
|
|
191
|
+
|-----------|------|----------|-------------|
|
|
192
|
+
| period | `"day"` \| `"week"` \| `"month"` | Yes | Time period for statistics |
|
|
102
193
|
|
|
103
|
-
|
|
104
|
-
// pot.grgShards — GRG integrity shards for verification
|
|
105
|
-
// pot.timestamp — synthesized nanosecond timestamp
|
|
106
|
-
// pot.mode — "turbo" (honest) or "full" (requires full verification)
|
|
194
|
+
### pot_health
|
|
107
195
|
|
|
108
|
-
|
|
109
|
-
potHash: pot.potHash,
|
|
110
|
-
grgShards: pot.grgShards
|
|
111
|
-
});
|
|
112
|
-
// verification.valid — true if integrity shards reconstruct correctly
|
|
113
|
-
```
|
|
196
|
+
No parameters.
|
|
114
197
|
|
|
115
|
-
|
|
198
|
+
### pot_checkpoint
|
|
116
199
|
|
|
117
|
-
|
|
118
|
-
2. **GRG Pipeline** — Encodes transaction data through a multi-layer integrity pipeline, producing verifiable shards
|
|
119
|
-
3. **Ed25519 Signing** — Signs the PoT hash for non-repudiation
|
|
120
|
-
4. **Adaptive Mode** — Honest builders get `turbo` mode (fast, profitable); tampered sequences get `full` mode (slow, costly) — natural economic selection
|
|
200
|
+
Creates a compressed rollup checkpoint of workflow history.
|
|
121
201
|
|
|
122
|
-
|
|
202
|
+
**Use when:** Approaching context limit, before long tasks, or every ~100 events.
|
|
123
203
|
|
|
124
|
-
|
|
204
|
+
| Parameter | Type | Required | Description |
|
|
205
|
+
|-----------|------|----------|-------------|
|
|
206
|
+
| fromEventId | string | No | Start of range — first eventId in the causal chain to include |
|
|
207
|
+
| toEventId | string | No | End of range — last eventId in the causal chain to include |
|
|
208
|
+
| startTime | number | No | Unix ms. Default: 1 hour ago |
|
|
209
|
+
| endTime | number | No | Unix ms. Default: now |
|
|
210
|
+
| maxTokens | number | No | Approximate max tokens for rollup output. Default: 2000 |
|
|
211
|
+
|
|
212
|
+
**Returns:**
|
|
213
|
+
- `checkpointId` — unique checkpoint identifier
|
|
214
|
+
- `rollup` — compressed event history (depth-adaptive: full/compact/minimal/rollup)
|
|
215
|
+
- `summary` — human-readable one-line summary of the checkpoint
|
|
216
|
+
- `chainIntact` — whether the causal chain is unbroken
|
|
217
|
+
- `nextCheckpointHint` — recommended events before next checkpoint
|
|
218
|
+
|
|
219
|
+
**Depth-adaptive compression:**
|
|
220
|
+
|
|
221
|
+
| Depth | Format | ~Tokens |
|
|
222
|
+
|-------|--------|---------|
|
|
223
|
+
| 1–5 | Full entry | ~200/event |
|
|
224
|
+
| 6–20 | Compact (id+hash+ts) | ~80/event |
|
|
225
|
+
| 21–50 | Minimal (id+ts) | ~30/event |
|
|
226
|
+
| 51+ | Rollup string | ~10/event |
|
|
125
227
|
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
"mcpServers": {
|
|
129
|
-
"ttt": {
|
|
130
|
-
"command": "npx",
|
|
131
|
-
"args": ["@helm-protocol/ttt-mcp"]
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
228
|
+
---
|
|
136
229
|
|
|
137
|
-
|
|
138
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
139
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
140
|
-
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
230
|
+
## Use Cases
|
|
141
231
|
|
|
142
|
-
|
|
232
|
+
### 1. Claude Code Workflow — Amnesia Prevention
|
|
143
233
|
|
|
144
|
-
-
|
|
145
|
-
- Network access for time synthesis (HTTPS to time.nist.gov, time.google.com, time.cloudflare.com)
|
|
234
|
+
**Problem**: A 20-agent Dynamic Workflow refactors a 500K-line codebase over hours. After each context compression, agents have no memory of what they already processed. Duplicate work. State corruption.
|
|
146
235
|
|
|
147
|
-
|
|
236
|
+
**Solution**: Each agent stamps its steps with `pot_generate(eventId, prevEventId)`. After compression, it calls `pot_query(eventId)` to recover its exact action history — what ran, when, in what order — from the external server. The server is outside Claude's context window; compression never touches it.
|
|
148
237
|
|
|
149
|
-
|
|
238
|
+
```typescript
|
|
239
|
+
// Agent starts a workflow step
|
|
240
|
+
const pot = await client.callTool({
|
|
241
|
+
name: "pot_generate",
|
|
242
|
+
arguments: {
|
|
243
|
+
eventId: "refactor_auth_module_step3",
|
|
244
|
+
prevEventId: "refactor_auth_module_step2"
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
// pot.potHash — cryptographic proof this step happened at this time
|
|
150
248
|
|
|
151
|
-
|
|
249
|
+
// After context compression, agent recovers its history:
|
|
250
|
+
const history = await client.callTool({
|
|
251
|
+
name: "pot_query",
|
|
252
|
+
arguments: { eventId: "refactor_auth_module_step3" }
|
|
253
|
+
});
|
|
254
|
+
// history.local[0] — exact record: timestamp, prevEventId, potHash
|
|
255
|
+
// history.found: true — O(1) lookup, collision probability 2⁻²⁵⁶
|
|
152
256
|
|
|
153
|
-
|
|
257
|
+
// Traverse full causal chain:
|
|
258
|
+
const chain = await client.callTool({
|
|
259
|
+
name: "pot_graph",
|
|
260
|
+
arguments: { eventId: "refactor_auth_module_step3", depth: 20 }
|
|
261
|
+
});
|
|
262
|
+
// chain.backwardChain — all ancestor steps in chronological order
|
|
263
|
+
// chain.forwardChain — steps that follow this one
|
|
264
|
+
// chain.chainBroken — true if a gap was detected in the ancestor chain
|
|
265
|
+
// chain.brokenAt — "server_restart" if the server restarted and cleared
|
|
266
|
+
// the in-memory DAG; otherwise the eventId of the oldest
|
|
267
|
+
// reachable ancestor before the gap; null if chain intact
|
|
268
|
+
// chain.reachableDepth — how many ancestors were recovered before the gap
|
|
269
|
+
|
|
270
|
+
// Handle a server-restart gap:
|
|
271
|
+
if (chain.chainBroken && chain.brokenAt === "server_restart") {
|
|
272
|
+
// Server cleared in-memory state; ancestors before the gap are gone unless
|
|
273
|
+
// Redis was configured (REDIS_URL) — in that case the DAG was rebuilt on
|
|
274
|
+
// restart and chainBroken will be false.
|
|
275
|
+
// Recover by querying the most recent checkpoint or restarting from a known step.
|
|
276
|
+
}
|
|
277
|
+
```
|
|
154
278
|
|
|
155
|
-
**
|
|
279
|
+
**Before a long task or every ~100 events — create a checkpoint:**
|
|
156
280
|
|
|
157
281
|
```typescript
|
|
158
|
-
//
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
282
|
+
// Compress workflow history before context fills up — by causal range:
|
|
283
|
+
const checkpoint = await client.callTool({
|
|
284
|
+
name: "pot_checkpoint",
|
|
285
|
+
arguments: {
|
|
286
|
+
fromEventId: "refactor_auth_module_step1",
|
|
287
|
+
toEventId: "refactor_auth_module_step3"
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
// checkpoint.checkpointId — store this; resume from it after compression
|
|
291
|
+
// checkpoint.rollup — depth-adaptive compressed history (10–200 tokens/event)
|
|
292
|
+
// checkpoint.chainIntact: true — causal chain verified unbroken
|
|
293
|
+
// checkpoint.nextCheckpointHint: 87 — suggested events before next checkpoint
|
|
294
|
+
|
|
295
|
+
// Or compress by time window with a token budget:
|
|
296
|
+
const checkpoint = await client.callTool({
|
|
297
|
+
name: "pot_checkpoint",
|
|
298
|
+
arguments: {
|
|
299
|
+
startTime: Date.now() - 3_600_000, // last 1 hour
|
|
300
|
+
maxTokens: 1500
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// After context compression, restore from checkpoint instead of re-querying all events:
|
|
305
|
+
const history = await client.callTool({
|
|
306
|
+
name: "pot_query",
|
|
307
|
+
arguments: { eventId: checkpoint.checkpointId }
|
|
308
|
+
});
|
|
309
|
+
// Full causal context restored in a single call
|
|
162
310
|
```
|
|
163
311
|
|
|
164
|
-
**
|
|
312
|
+
**Outcome**: Zero duplicate work. Full workflow timeline recoverable even after complete context resets.
|
|
165
313
|
|
|
166
314
|
---
|
|
167
315
|
|
|
168
|
-
### 2.
|
|
316
|
+
### 2. MEV Bot — Transaction Ordering Proof
|
|
169
317
|
|
|
170
|
-
**Problem**:
|
|
318
|
+
**Problem**: You got front-run. You can't prove it — mempool timestamps are per-node, unsigned, non-authoritative.
|
|
171
319
|
|
|
172
|
-
**Solution**:
|
|
320
|
+
**Solution**: Call `pot_generate` before every submission. The PoT receipt is cryptographically signed using three independent time sources (NIST, Google, Cloudflare). The on-chain hash can be anchored via a separate Base Sepolia TTT ERC-1155 contract. If front-running occurs, you have a timestamped record predating the attacker's block inclusion.
|
|
173
321
|
|
|
174
322
|
```typescript
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
323
|
+
const pot = await client.callTool({
|
|
324
|
+
name: "pot_generate",
|
|
325
|
+
arguments: { txHash: pendingTxHash, chainId: 8453, poolAddress: "0x..." }
|
|
326
|
+
});
|
|
327
|
+
// pot.potHash — your evidence, timestamped by NIST+Google+Cloudflare
|
|
179
328
|
```
|
|
180
329
|
|
|
181
|
-
**
|
|
330
|
+
> **Note:** The DeFi path (`txHash` + `chainId` + `poolAddress`) requires a server-side build with the integrity-shard pipeline enabled. It is not available in the public `openttt` npm package; calls without it will throw. The Claude Code path (`eventId`) works out of the box.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### 3. DEX Protocol — Sandwich Deterrence
|
|
335
|
+
|
|
336
|
+
**Solution**: Integrate `TTTHookSimple` (Uniswap V4 hook, Base Sepolia: `0x8C633b05b833a476925F7d9818da6E215760F2c7`). Honest builders get `turbo` mode. Tampered sequences get `full` mode (penalty delay). Economics, not governance.
|
|
337
|
+
|
|
338
|
+
> **Note:** Shard-based verification (`pot_verify` with `grgShards`) requires a server-side build with the integrity-shard pipeline enabled — not available in the public `openttt` npm package.
|
|
182
339
|
|
|
183
340
|
---
|
|
184
341
|
|
|
185
|
-
###
|
|
342
|
+
### 4. Hedge Fund / Prop Desk — MiFIR Art.22c Compliance
|
|
186
343
|
|
|
187
|
-
**Problem**: MiFIR Article 22c / RTS 25 requires microsecond-precision UTC-synchronized timestamps
|
|
344
|
+
**Problem**: MiFIR Article 22c / RTS 25 requires microsecond-precision UTC-synchronized timestamps. Hardware PTP appliances cost $50K–$500K.
|
|
188
345
|
|
|
189
|
-
**Solution**: `pot_generate` produces an Ed25519-signed timestamp with uncertainty bound
|
|
346
|
+
**Solution**: `pot_generate` produces an Ed25519-signed timestamp with an uncertainty bound and multi-source attestation. Structurally compatible with the RTS 25 audit record format. One API call per trade.
|
|
190
347
|
|
|
191
348
|
```typescript
|
|
192
349
|
const audit = await client.callTool({
|
|
193
350
|
name: "pot_generate",
|
|
194
|
-
arguments: { txHash: tradeHash, chainId: 8453
|
|
351
|
+
arguments: { txHash: tradeHash, chainId: 8453 }
|
|
195
352
|
});
|
|
196
|
-
// audit.timestamp:
|
|
197
|
-
// audit.uncertainty:
|
|
353
|
+
// audit.timestamp: high-resolution timestamp
|
|
354
|
+
// audit.uncertainty: ± bound (RTS 25 uncertainty field)
|
|
198
355
|
// audit.confidence: fraction of sources that agreed
|
|
199
|
-
// audit.ed25519_sig: non-repudiation signature
|
|
200
|
-
// Export to your compliance system — same format, every trade
|
|
201
356
|
```
|
|
202
357
|
|
|
203
|
-
**
|
|
358
|
+
> **Precision note:** The default network time sources (Roughtime / NTP) provide a few-millisecond uncertainty bound. The MiFIR Art. 22c / RTS 25 ±1ms (and tighter) requirement is met only with an added GEO time source (KTSat); this is a roadmap configuration, not the default deployment.
|
|
359
|
+
|
|
360
|
+
**Outcome**: Structurally compatible audit trail. IETF specification: `draft-helmprotocol-tttps`.
|
|
204
361
|
|
|
205
362
|
---
|
|
206
363
|
|
|
207
|
-
###
|
|
364
|
+
### 5. Multi-Agent Coordination — Causal Order Proof
|
|
208
365
|
|
|
209
|
-
**Problem**:
|
|
366
|
+
**Problem**: When multiple AI agents interact in a pipeline, the causal order matters for debugging and audit. Agent logs are unverifiable.
|
|
210
367
|
|
|
211
|
-
**Solution**:
|
|
368
|
+
**Solution**: Each agent stamps its action with `pot_generate`. The potHash chain is independently verifiable. `pot_graph` reconstructs who did what and in what order.
|
|
212
369
|
|
|
213
|
-
|
|
214
|
-
// On liquidity add
|
|
215
|
-
const entryPot = await client.callTool({ name: "pot_generate", arguments: { txHash: addLiqTx, chainId: 8453 } });
|
|
370
|
+
---
|
|
216
371
|
|
|
217
|
-
|
|
218
|
-
const exitPot = await client.callTool({ name: "pot_generate", arguments: { txHash: removeLiqTx, chainId: 8453 } });
|
|
372
|
+
## How It Differs — A Different Job, Not "Better"
|
|
219
373
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
374
|
+
| Tool | Integration | What it recalls | Integrity | Hot-path cost |
|
|
375
|
+
|------|-------------|-----------------|-----------|---------------|
|
|
376
|
+
| Letta (MemGPT) | owns the agent loop | self-editing semantic memory | none | embedding + vector search per memory op |
|
|
377
|
+
| LangGraph / LangMem | LangGraph only | graph state / semantic | none | checkpoint I/O (+ embeddings) |
|
|
378
|
+
| RAG / vector DB | bolt-on | fuzzy similarity | none | embed + vector search per item |
|
|
379
|
+
| **ttt-mcp** | **2-min MCP retrofit** | **exact causal step (by eventId)** | **Ed25519 + TTTPS timestamp** | **sign + hash + write — 0 embedding calls** |
|
|
380
|
+
|
|
381
|
+
**The cost difference is structural, not incidental.**
|
|
382
|
+
|
|
383
|
+
Letta and Mem0 treat agent memory as a semantic search problem — every recall forces an LLM embedding call and a vector search. ttt-mcp bypasses the LLM/embedding layer entirely: state recovery is an O(1) cryptographic hash lookup. Marginal cost is commodity CPU + storage, not API tokens.
|
|
384
|
+
|
|
385
|
+
**Scope**: agents stamp the steps worth checkpointing — not every token, not every query. Volume tracks decisions, not total chat traffic.
|
|
386
|
+
|
|
387
|
+
If you need fuzzy semantic search over past conversations, use Letta or a vector DB. If you need a zero-embedding, deterministic state recovery layer for long-horizon workflows that survives context compaction, use ttt-mcp.
|
|
224
388
|
|
|
225
389
|
---
|
|
226
390
|
|
|
227
|
-
|
|
391
|
+
## Pricing
|
|
228
392
|
|
|
229
|
-
|
|
393
|
+
| Tier | Price | Calls/month |
|
|
394
|
+
|------|-------|-------------|
|
|
395
|
+
| Free | $0 | 100/day per IP — no signup |
|
|
396
|
+
| Dev | $29/mo | 100K |
|
|
397
|
+
| Pro | $99/mo | 1M |
|
|
398
|
+
| Team | $299/mo | 10M + $0.01/1K overage |
|
|
399
|
+
| Enterprise | $999+/mo | 100M calls/mo · $0.001/1K overage · SLA 99.9% |
|
|
400
|
+
| Platform License | Negotiated ($2M+/yr) | Volume cap negotiated · native integration |
|
|
230
401
|
|
|
231
|
-
**
|
|
402
|
+
**Subscribe:**
|
|
232
403
|
|
|
233
|
-
|
|
234
|
-
// Agent A (signal generator)
|
|
235
|
-
const signalPot = await client.callTool({ name: "pot_generate", arguments: { txHash: signalId } });
|
|
404
|
+
Dev **$29/mo** · Pro **$99/mo** · Team **$299/mo** — to subscribe, email [peter@kenosian.com](mailto:peter@kenosian.com).
|
|
236
405
|
|
|
237
|
-
|
|
238
|
-
const execPot = await client.callTool({
|
|
239
|
-
name: "pot_generate",
|
|
240
|
-
arguments: { txHash: execId, precedingPotHash: signalPot.potHash }
|
|
241
|
-
});
|
|
406
|
+
Enterprise & Platform License: [peter@kenosian.com](mailto:peter@kenosian.com)
|
|
242
407
|
|
|
243
|
-
|
|
244
|
-
const verified = await client.callTool({ name: "pot_verify", arguments: { potHash: execPot.potHash, precedingHash: signalPot.potHash } });
|
|
245
|
-
```
|
|
408
|
+
Contact: peter@kenosian.com
|
|
246
409
|
|
|
247
|
-
**
|
|
410
|
+
**Quota mechanics — stdio vs HTTP:**
|
|
411
|
+
|
|
412
|
+
- **HTTP mode** (Glama / Smithery container, `PORT` set): the per-IP free tier limit (100 calls/day) is enforced locally in the server process.
|
|
413
|
+
- **stdio mode** (Claude Code `npx`, Claude Desktop): there is no per-IP counter. Tool calls are delegated to `api.kenosian.com` via `X-TTT-API-Key`; quota is enforced server-side against your plan's monthly allowance. Without `TTT_API_KEY` the local fallback runs with no daily cap, but plan features (server-side DAG persistence, multi-session causal chains) are unavailable.
|
|
248
414
|
|
|
249
415
|
---
|
|
250
416
|
|
|
251
|
-
##
|
|
417
|
+
## Requirements
|
|
252
418
|
|
|
253
|
-
|
|
254
|
-
|
|
419
|
+
- Node.js >= 18
|
|
420
|
+
- Network access for time synthesis (HTTPS to time.nist.gov, time.google.com, time.cloudflare.com)
|
|
255
421
|
|
|
256
|
-
|
|
257
|
-
const result = await client.callTool({
|
|
258
|
-
name: "pot_generate",
|
|
259
|
-
arguments: {
|
|
260
|
-
txHash: "0xabc123...",
|
|
261
|
-
chainId: 8453,
|
|
262
|
-
poolAddress: "0xdef456..."
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
// Returns: { potHash, timestamp, stratum, grg_shards }
|
|
266
|
-
```
|
|
422
|
+
**Time source tiers (automatic fallback):**
|
|
267
423
|
|
|
268
|
-
|
|
424
|
+
| Tier | Source | Stratum | Notes |
|
|
425
|
+
|------|--------|---------|-------|
|
|
426
|
+
| 1 (preferred) | PTP / hardware clock | 0–1 | Requires local PTP daemon |
|
|
427
|
+
| 2 | Roughtime / NTP (NIST, Google, Cloudflare) | 2–4 | Default for most deployments |
|
|
428
|
+
| 3 (offline fallback) | Local system clock | 16 | RFC 5905 unsynchronized stratum — used when all network sources are unreachable |
|
|
269
429
|
|
|
270
|
-
|
|
271
|
-
import subprocess, json
|
|
430
|
+
The server falls through to stratum 16 automatically; no manual configuration needed. The `stratum` field in every `pot_generate` response indicates which tier was used.
|
|
272
431
|
|
|
273
|
-
|
|
274
|
-
["npx", "-y", "@helm-protocol/ttt-mcp"],
|
|
275
|
-
input=json.dumps({
|
|
276
|
-
"tool": "pot_verify",
|
|
277
|
-
"potHash": "0x...",
|
|
278
|
-
"expectedChainId": 8453
|
|
279
|
-
}),
|
|
280
|
-
capture_output=True, text=True
|
|
281
|
-
)
|
|
282
|
-
```
|
|
432
|
+
**Redis persistence (optional):**
|
|
283
433
|
|
|
284
|
-
|
|
434
|
+
Redis is not required. The in-memory DAG is authoritative at runtime. If `REDIS_URL` is set, events are written to Redis with a 90-day TTL and the DAG is rebuilt from Redis on server restart — reducing `server_restart` chain gaps. Without Redis, the in-memory DAG is cleared on restart.
|
|
285
435
|
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Production Tips
|
|
439
|
+
|
|
440
|
+
**Cold Start warm-up** — On first startup, BatchSigner requires one request to initialize. Call `pot_health` or send a single dummy `pot_generate` before your load balancer health check goes live. Without this, the first request may see p99 ~500ms; subsequent requests stabilize to <10ms.
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Kubernetes / Docker: add to your startup script
|
|
444
|
+
curl -s http://your-server/pot/health > /dev/null
|
|
286
445
|
```
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
Commercial: peter@kenosian.com (hedge funds, DEX protocols, OTC desks)
|
|
290
|
-
```
|
|
446
|
+
|
|
447
|
+
---
|
|
291
448
|
|
|
292
449
|
## Learn More
|
|
293
450
|
|
|
294
451
|
- [OpenTTT SDK](https://www.npmjs.com/package/openttt) — The underlying SDK
|
|
295
|
-
- [IETF Draft: draft-helmprotocol-tttps
|
|
452
|
+
- [IETF Draft: draft-helmprotocol-tttps](https://datatracker.ietf.org/doc/draft-helmprotocol-tttps/) — TTTPS Protocol Specification
|
|
296
453
|
- [Helm Protocol](https://github.com/Helm-Protocol) — GitHub
|
|
297
454
|
|
|
298
455
|
## License
|
|
299
456
|
|
|
300
457
|
BSL-1.1 — free for non-commercial use.
|
|
301
458
|
|
|
302
|
-
**Commercial use** (production bots, hedge funds, prop desks) requires a license.
|
|
303
|
-
→ [kenosian.com/pricing](https://kenosian.com/pricing)
|
|
459
|
+
**Commercial use** (production bots, hedge funds, prop desks) requires a license.
|
|
304
460
|
|
|
305
461
|
Change Date: 2029-05-28 → Apache 2.0
|
package/dist/auth.js
CHANGED
|
@@ -66,7 +66,7 @@ function writeUsageFile(entry) {
|
|
|
66
66
|
}
|
|
67
67
|
function checkRateLimit(apiKey, clientIp) {
|
|
68
68
|
if (apiKey && apiKey.trim().length > 0) {
|
|
69
|
-
return { allowed: true, remaining: -1, tier: "paid" };
|
|
69
|
+
return { allowed: true, remaining: -1, tier: "paid", serverDelegated: true };
|
|
70
70
|
}
|
|
71
71
|
const now = Date.now();
|
|
72
72
|
if (clientIp === "stdio") {
|