mythos-router 1.0.0 → 1.1.0

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 thewaltero
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 thewaltero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,229 +1,317 @@
1
- <div align="center">
2
-
3
- # MYTHOS
4
-
5
- ### Capybara Tier · Claude Opus 4.6 · Strict Write Discipline
6
-
7
- **The leaked Anthropic reasoning protocol. Running locally.**
8
-
9
- [![npm](https://img.shields.io/npm/v/mythos-router?style=flat-square&color=cc785c)](https://www.npmjs.com/package/mythos-router)
10
- [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
11
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://typescriptlang.org)
12
- [![Claude](https://img.shields.io/badge/Claude-Opus_4.6-cc785c?style=flat-square)](https://anthropic.com)
13
- [![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)](./LICENSE)
14
- [![GitHub stars](https://img.shields.io/github/stars/thewaltero/mythos-router?style=social)](https://github.com/thewaltero/mythos-router)
15
-
16
- <p align="center">
17
- <img src="assets/demo.png" alt="mythos-router terminal demo" width="700" />
18
- </p>
19
-
20
- ```bash
21
- # Try it now
22
- npx mythos-router chat
23
- ```
24
-
25
- </div>
26
-
27
- ---
28
-
29
- ## What is this?
30
-
31
- **mythos-router** is a local CLI power tool that implements the *leaked Anthropic "Capybara" reasoning protocol* — the specialized tier designed for PhD-level reasoning and cybersecurity analysis.
32
-
33
- Unlike standard Claude wrappers, mythos-router enforces **Strict Write Discipline (SWD)**: every file operation the AI claims to perform is *verified against the actual filesystem*. If the model hallucinates a write, it gets a Correction Turn. If it fails twice, it yields to the human.
34
-
35
- Zero slop. Zero hallucinated state. Full adaptive thinking.
36
-
37
- ---
38
-
39
- ## Features
40
-
41
- | Feature | Description |
42
- |---------|-------------|
43
- | 🧠 **Adaptive Thinking** | Opus 4.6 with configurable effort levels (high/medium/low) |
44
- | 🔒 **Strict Write Discipline** | Pre/post filesystem snapshots verify every model claim |
45
- | 💤 **Self-Healing Memory** | `MEMORY.md` logs every action; auto-compresses via "Dream" |
46
- | ⟲ **Correction Turns** | Model gets 2 retries to match filesystem reality, then yields |
47
- | 📋 **Drift Detection** | `verify` command syncs codebase state with memory |
48
- | 🚀 **Zero Build** | Runs directly via `tsx` — no compile step in dev |
49
-
50
- ---
51
-
52
- ## Installation
53
-
54
- ### Quick Start (npm)
55
-
56
- ```bash
57
- # Install globally
58
- npm install -g mythos-router
59
-
60
- # Set your API key
61
- export ANTHROPIC_API_KEY="sk-ant-..."
62
- # Windows: $env:ANTHROPIC_API_KEY = "sk-ant-..."
63
-
64
- # Go
65
- mythos chat
66
- ```
67
-
68
- ### Or try without installing
69
-
70
- ```bash
71
- npx mythos-router chat
72
- ```
73
-
74
- ### From Source
75
-
76
- ```bash
77
- git clone https://github.com/thewaltero/mythos-router.git
78
- cd mythos-router
79
- npm install
80
- npm run chat
81
- ```
82
-
83
- ---
84
-
85
- ## Usage
86
-
87
- ### `mythos chat` — Interactive Capybara Session
88
-
89
- ```bash
90
- mythos chat # Full power (high effort)
91
- mythos chat --effort low # Budget mode
92
- mythos chat --effort medium # Balanced
93
- ```
94
-
95
- In-session commands:
96
- - `/exit` — End session
97
- - `/memory` — Show memory status
98
- - `/clear` — Clear conversation (memory persists)
99
-
100
- ### `mythos verify` Zero-Drift Codebase Scan
101
-
102
- ```bash
103
- mythos verify
104
- ```
105
-
106
- Scans every file in your project and cross-references against `MEMORY.md`:
107
- - ✅ **Verified** — File state matches memory
108
- - ⚠️ **Drift**File changed but memory doesn't reflect it
109
- - ❌ **Missing** — Memory references a file that doesn't exist
110
-
111
- ### `mythos dream` Memory Compression
112
-
113
- ```bash
114
- mythos dream # Auto-compress when needed
115
- mythos dream --force # Force compression
116
- ```
117
-
118
- When `MEMORY.md` exceeds 100 entries, older logs are compressed into a summary block using Claude (low effort, minimal token burn). Recent entries are preserved intact.
119
-
120
- ---
121
-
122
- ## Architecture
123
-
124
- ```
125
- mythos-router/
126
- ├── src/
127
- │ ├── cli.ts # Commander.js entry point
128
- │ ├── config.ts # Capybara system prompt + constants
129
- │ ├── client.ts # Anthropic SDK (adaptive thinking)
130
- │ ├── swd.ts # Strict Write Discipline engine
131
- │ ├── memory.ts # MEMORY.md self-healing manager
132
- │ ├── utils.ts # Terminal formatting (zero-dep)
133
- │ └── commands/
134
- │ ├── chat.ts # Interactive REPL
135
- │ ├── verify.ts # Codebase Memory scanner
136
- │ └── dream.ts # Memory compression
137
- ├── .mythosignore # SWD scan exclusions
138
- ├── MEMORY.md # Auto-generated agentic memory
139
- └── AGENTS.md # Project conventions
140
- ```
141
-
142
- ### The SWD Protocol
143
-
144
- ```
145
- User Input
146
-
147
-
148
- [Pre-Snapshot] ── filesystem state captured
149
-
150
-
151
- [Claude Opus 4.6] ── adaptive thinking (high effort)
152
-
153
-
154
- [Parse FILE_ACTION blocks] ── extract claimed operations
155
-
156
-
157
- [Post-Snapshot] ── filesystem state re-captured
158
-
159
-
160
- [Verify] ── before vs. after vs. model claims
161
-
162
- ├── ✅ All verified → Log to MEMORY.md
163
-
164
- └── Mismatch Correction Turn (max 2 retries)
165
-
166
- └── Still failing Yield to human
167
- ```
168
-
169
- ---
170
-
171
- ## MEMORY.md — Should You Commit It?
172
-
173
- **Yes.** `MEMORY.md` is designed to be committed to your repository. It becomes a "collaborative brain" where:
174
- - Multiple developers can see what the AI did in previous sessions
175
- - Different AI agents can reference past context
176
- - You get a full audit trail of every AI-assisted file operation
177
-
178
- If you prefer to keep it private, add `MEMORY.md` to your `.gitignore`.
179
-
180
- ---
181
-
182
- ## The Capybara System Prompt
183
-
184
- The system prompt implements the leaked Anthropic protocol:
185
-
186
- > **Tier: Capybara** (Specialized in Cybersecurity & PhD Reasoning)
187
- >
188
- > Follow 'Strict Write Discipline' and never hallucinate filesystem state.
189
- > Every file operation must be wrapped in `[FILE_ACTION]` blocks for verification.
190
-
191
- The model is instructed to emit machine-readable delimiters around every file operation, making SWD verification 100% reliable.
192
-
193
- ---
194
-
195
- ## Configuration
196
-
197
- | Env Variable | Required | Description |
198
- |-------------|----------|-------------|
199
- | `ANTHROPIC_API_KEY` | ✅ | Your Anthropic API key |
200
-
201
- | File | Purpose |
202
- |------|---------|
203
- | `.mythosignore` | Patterns to exclude from SWD scanning |
204
- | `MEMORY.md` | Auto-generated agentic memory log |
205
-
206
- ---
207
-
208
- ## Token Usage
209
-
210
- | Mode | Typical Cost Per Turn |
211
- |------|----------------------|
212
- | `--effort high` | Full Opus 4.6 pricing (deep reasoning) |
213
- | `--effort medium` | Balanced — good for most tasks |
214
- | `--effort low` | Minimal thinking — quick answers |
215
- | `dream` | Low effort summarization (~500 tokens) |
216
-
217
- Token counts are displayed after every chat response.
218
-
219
- ---
220
-
221
- ## License
222
-
223
- MIT
224
-
225
- ---
226
-
227
- <div align="center">
228
- <sub>Built with the leaked Capybara protocol. No affiliation with Anthropic. Use responsibly.</sub>
229
- </div>
1
+ <div align="center">
2
+
3
+ ```
4
+ ███╗ ███╗██╗ ██╗████████╗██╗ ██╗ ██████╗ ███████╗
5
+ ████╗ ████║╚██╗ ██╔╝╚══██╔══╝██║ ██║██╔═══██╗██╔════╝
6
+ ██╔████╔██║ ╚████╔╝ ██║ ███████║██║ ██║███████╗
7
+ ██║╚██╔╝██║ ╚██╔╝ ██║ ██╔══██║██║ ██║╚════██║
8
+ ██║ ╚═╝ ██║ ██║ ██║ ██║ ██║╚██████╔╝███████║
9
+ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
10
+ ```
11
+
12
+ ### Capybara Tier · Claude Opus 4.6 · Strict Write Discipline
13
+
14
+ **The leaked Anthropic reasoning protocol. Running locally.**
15
+
16
+ [![npm](https://img.shields.io/npm/v/mythos-router?style=flat-square&color=cc785c)](https://www.npmjs.com/package/mythos-router)
17
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
18
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://typescriptlang.org)
19
+ [![Claude](https://img.shields.io/badge/Claude-Opus_4.6-cc785c?style=flat-square)](https://anthropic.com)
20
+ [![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)](./LICENSE)
21
+ [![GitHub stars](https://img.shields.io/github/stars/thewaltero/mythos-router?style=social)](https://github.com/thewaltero/mythos-router)
22
+
23
+ <p align="center">
24
+ <img src="assets/demo.png" alt="mythos-router terminal demo" width="700" />
25
+ </p>
26
+
27
+ ```bash
28
+ # Try it now
29
+ npx mythos-router chat
30
+ ```
31
+
32
+ </div>
33
+
34
+ ---
35
+
36
+ ## What is this?
37
+
38
+ **mythos-router** is a local CLI power tool that implements the *leaked Anthropic "Capybara" reasoning protocol* — the specialized tier designed for PhD-level reasoning and cybersecurity analysis.
39
+
40
+ Unlike standard Claude wrappers, mythos-router enforces **Strict Write Discipline (SWD)**: every file operation the AI claims to perform is *verified against the actual filesystem*. If the model hallucinates a write, it gets a Correction Turn. If it fails twice, it yields to the human.
41
+
42
+ Zero slop. Zero hallucinated state. Full adaptive thinking.
43
+
44
+ ---
45
+
46
+ ## Features
47
+
48
+ | Feature | Description |
49
+ |---------|-------------|
50
+ | 🧠 **Adaptive Thinking** | Opus 4.6 with configurable effort levels (high/medium/low) |
51
+ | 🔒 **Strict Write Discipline** | Pre/post filesystem snapshots verify every model claim |
52
+ | 💤 **Self-Healing Memory** | `MEMORY.md` logs every action; auto-compresses via "Dream" |
53
+ | ⟲ **Correction Turns** | Model gets 2 retries to match filesystem reality, then yields |
54
+ | 📋 **Drift Detection** | `verify` command syncs codebase state with memory |
55
+ | 💰 **Token Limiter** | Budget cap with graceful save — progress saved to MEMORY.md, never lose work |
56
+ | 🔍 **Dry-Run Mode** | Preview every file operation before it executes — full transparency |
57
+ | 📊 **Verbose Tracing** | See exactly what the AI is parsing, thinking, and verifying |
58
+ | 🚀 **Zero Build** | Runs directly via `tsx` — no compile step in dev |
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ ### Quick Start (npm)
65
+
66
+ ```bash
67
+ # Install globally
68
+ npm install -g mythos-router
69
+
70
+ # Set your API key
71
+ export ANTHROPIC_API_KEY="sk-ant-..."
72
+ # Windows: $env:ANTHROPIC_API_KEY = "sk-ant-..."
73
+
74
+ # Go
75
+ mythos chat
76
+ ```
77
+
78
+ ### Or try without installing
79
+
80
+ ```bash
81
+ npx mythos-router chat
82
+ ```
83
+
84
+ ### From Source
85
+
86
+ ```bash
87
+ git clone https://github.com/thewaltero/mythos-router.git
88
+ cd mythos-router
89
+ npm install
90
+ npm run chat
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Usage
96
+
97
+ ### `mythos chat` Interactive Capybara Session
98
+
99
+ ```bash
100
+ mythos chat # Full power (high effort)
101
+ mythos chat --effort low # Budget mode
102
+ mythos chat --effort medium # Balanced
103
+ mythos chat --dry-run # Preview all file changes before executing
104
+ mythos chat --verbose # See full SWD traces and thinking
105
+ mythos chat --dry-run --verbose # Maximum transparency
106
+ ```
107
+
108
+ #### 💰 Financial Safety Never Burn Money Again
109
+
110
+ ```bash
111
+ mythos chat # Default: 500K tokens, 25 turns
112
+ mythos chat --max-tokens 100000 # Cap at 100K tokens
113
+ mythos chat --max-turns 10 # Cap at 10 turns
114
+ mythos chat --max-tokens 50000 --max-turns 5 # Tight budget
115
+ mythos chat --no-budget # Expert mode (no limits)
116
+ ```
117
+
118
+ The budget limiter tracks every token, turn, and estimated cost in real-time:
119
+
120
+ ```
121
+ budget: [████████░░░░░░░░░░░░] 78,342/500,000 tokens · [██████░░░░] 12/25 turns · ~$1.2340 · 4m 32s
122
+ ```
123
+
124
+ At 80%, you get a yellow warning. At 100%, the session performs a **graceful save** — current progress is written to `MEMORY.md` so you can resume context in your next session. No work lost. Use `--no-budget` to disable (at your own risk).
125
+
126
+ #### 🔍 Dry-Run Mode — The Trust Builder
127
+
128
+ ```bash
129
+ mythos chat --dry-run
130
+ ```
131
+
132
+ In dry-run mode, every file operation is previewed before execution:
133
+
134
+ ```
135
+ DRY-RUN ── File Action Preview ──
136
+ 2 file action(s) detected. Review each:
137
+
138
+ 1/2 MODIFY src/index.ts
139
+ Description: Change 'axios' to 'fetch'
140
+ Current state: 1,832 bytes, hash: 7a3f2c1e...
141
+ DRY-RUN Accept MODIFY on src/index.ts? [Y/n] y
142
+ Accepted: MODIFY src/index.ts
143
+
144
+ 2/2 CREATE src/utils.ts
145
+ Description: Add helper utilities
146
+ Current state: does not exist
147
+ DRY-RUN Accept CREATE on src/utils.ts? [Y/n] n
148
+ Rejected: CREATE src/utils.ts
149
+ ```
150
+
151
+ In-session commands:
152
+ - `/exit` — End session (shows final budget summary)
153
+ - `/memory` — Show memory status
154
+ - `/budget` Show current budget consumption
155
+ - `/clear` — Clear conversation (memory persists)
156
+
157
+ ### `mythos verify` Zero-Drift Codebase Scan
158
+
159
+ ```bash
160
+ mythos verify # Scan and log results to MEMORY.md
161
+ mythos verify --dry-run # Scan without writing to MEMORY.md
162
+ ```
163
+
164
+ Scans every file in your project and cross-references against `MEMORY.md`:
165
+ - ✅ **Verified** — File state matches memory
166
+ - ⚠️ **Drift** File changed but memory doesn't reflect it
167
+ - ❌ **Missing** — Memory references a file that doesn't exist
168
+
169
+ ### `mythos dream` — Memory Compression
170
+
171
+ ```bash
172
+ mythos dream # Auto-compress when needed
173
+ mythos dream --force # Force compression
174
+ mythos dream --dry-run # Preview without writing
175
+ ```
176
+
177
+ When `MEMORY.md` exceeds 100 entries, older logs are compressed into a summary block using Claude (low effort, minimal token burn). Recent entries are preserved intact.
178
+
179
+ ---
180
+
181
+ ## Architecture
182
+
183
+ ```
184
+ mythos-router/
185
+ ├── src/
186
+ │ ├── cli.ts # Commander.js entry point
187
+ │ ├── config.ts # Capybara system prompt + constants + budget defaults
188
+ │ ├── client.ts # Anthropic SDK (adaptive thinking)
189
+ │ ├── budget.ts # Session budget limiter (token cap, turn cap)
190
+ │ ├── swd.ts # Strict Write Discipline + dry-run preview
191
+ │ ├── memory.ts # MEMORY.md self-healing manager (dry-run aware)
192
+ │ ├── utils.ts # Terminal formatting, badges, prompts (zero-dep)
193
+ │ └── commands/
194
+ │ ├── chat.ts # Interactive REPL (budget + dry-run + verbose)
195
+ │ ├── verify.ts # Codebase ↔ Memory scanner (dry-run aware)
196
+ │ └── dream.ts # Memory compression (dry-run aware)
197
+ ├── .mythosignore # SWD scan exclusions
198
+ ├── MEMORY.md # Auto-generated agentic memory
199
+ └── AGENTS.md # Project conventions
200
+ ```
201
+
202
+ ### The SWD Protocol
203
+
204
+ ```
205
+ User Input
206
+
207
+
208
+ [Pre-Snapshot] ── filesystem state captured
209
+
210
+
211
+ [Claude Opus 4.6] ── adaptive thinking (high effort)
212
+
213
+
214
+ [Parse FILE_ACTION blocks] ── extract claimed operations
215
+
216
+
217
+ [Post-Snapshot] ── filesystem state re-captured
218
+
219
+
220
+ [Verify] ── before vs. after vs. model claims
221
+
222
+ ├── ✅ All verified → Log to MEMORY.md
223
+
224
+ └── ❌ Mismatch → Correction Turn (max 2 retries)
225
+
226
+ └── Still failing → Yield to human
227
+ ```
228
+
229
+ ---
230
+
231
+ ## MEMORY.md — Should You Commit It?
232
+
233
+ **Yes.** `MEMORY.md` is designed to be committed to your repository. It becomes a "collaborative brain" where:
234
+ - Multiple developers can see what the AI did in previous sessions
235
+ - Different AI agents can reference past context
236
+ - You get a full audit trail of every AI-assisted file operation
237
+
238
+ If you prefer to keep it private, add `MEMORY.md` to your `.gitignore`.
239
+
240
+ ---
241
+
242
+ ## The Capybara System Prompt
243
+
244
+ The system prompt implements the leaked Anthropic protocol:
245
+
246
+ > **Tier: Capybara** (Specialized in Cybersecurity & PhD Reasoning)
247
+ >
248
+ > Follow 'Strict Write Discipline' and never hallucinate filesystem state.
249
+ > Every file operation must be wrapped in `[FILE_ACTION]` blocks for verification.
250
+
251
+ The model is instructed to emit machine-readable delimiters around every file operation, making SWD verification 100% reliable.
252
+
253
+ ---
254
+
255
+ ## Configuration
256
+
257
+ | Env Variable | Required | Description |
258
+ |-------------|----------|-------------|
259
+ | `ANTHROPIC_API_KEY` | ✅ | Your Anthropic API key |
260
+
261
+ | File | Purpose |
262
+ |------|---------|
263
+ | `.mythosignore` | Patterns to exclude from SWD scanning |
264
+ | `MEMORY.md` | Auto-generated agentic memory log |
265
+
266
+ ---
267
+
268
+ ## Token Usage & Budget
269
+
270
+ ### Opus 4.6 Pricing (as of 2026-04)
271
+
272
+ | Rate | USD |
273
+ |------|-----|
274
+ | Input tokens | $15.00 / 1M tokens |
275
+ | Output tokens | $75.00 / 1M tokens |
276
+
277
+ > Pricing constants live in `src/config.ts`. When Anthropic updates rates, change two lines — no budget math to refactor.
278
+
279
+ | Mode | Typical Cost Per Turn |
280
+ |------|----------------------|
281
+ | `--effort high` | Full Opus 4.6 pricing (deep reasoning) |
282
+ | `--effort medium` | Balanced — good for most tasks |
283
+ | `--effort low` | Minimal thinking — quick answers |
284
+ | `dream` | Low effort summarization (~500 tokens) |
285
+
286
+ | Budget Setting | Default |
287
+ |---------------|--------|
288
+ | `--max-tokens` | 500,000 per session |
289
+ | `--max-turns` | 25 per session |
290
+ | Warning threshold | 80% consumption |
291
+ | `--no-budget` | Disables all limits |
292
+
293
+ ### Graceful Save
294
+
295
+ When the budget is reached, mythos doesn't just kill your session — it performs a **graceful save**:
296
+
297
+ ```
298
+ ⏸ BUDGET REACHED — Graceful Save
299
+ 498,231 tokens consumed across 25 turns (~$7.4200).
300
+ Progress saved to MEMORY.md. Resume with mythos chat to continue.
301
+ Increase limits: mythos chat --max-tokens 1000000 --max-turns 50
302
+ Disable limits: mythos chat --no-budget
303
+ ```
304
+
305
+ Token counts, estimated cost, and budget status are displayed after every chat response.
306
+
307
+ ---
308
+
309
+ ## License
310
+
311
+ MIT
312
+
313
+ ---
314
+
315
+ <div align="center">
316
+ <sub>Built with the leaked Capybara protocol. No affiliation with Anthropic. Use responsibly.</sub>
317
+ </div>
@@ -0,0 +1,47 @@
1
+ export interface BudgetConfig {
2
+ maxTokens: number;
3
+ maxTurns: number;
4
+ warnAtPercent: number;
5
+ /** Cost per input token in USD (update when Anthropic changes pricing) */
6
+ costPerInputToken: number;
7
+ /** Cost per output token in USD (update when Anthropic changes pricing) */
8
+ costPerOutputToken: number;
9
+ }
10
+ export interface BudgetCheck {
11
+ ok: boolean;
12
+ reason?: string;
13
+ tokensPercent: number;
14
+ turnsPercent: number;
15
+ warning: boolean;
16
+ /** True when budget is exhausted — signals the caller to perform a graceful save */
17
+ exhausted: boolean;
18
+ }
19
+ export interface BudgetSnapshot {
20
+ totalTokens: number;
21
+ inputTokens: number;
22
+ outputTokens: number;
23
+ turns: number;
24
+ maxTokens: number;
25
+ maxTurns: number;
26
+ startedAt: number;
27
+ elapsedMs: number;
28
+ /** Estimated cost in USD based on configured token pricing */
29
+ estimatedCostUSD: number;
30
+ }
31
+ export declare class SessionBudget {
32
+ private config;
33
+ private totalInput;
34
+ private totalOutput;
35
+ private turnCount;
36
+ private startedAt;
37
+ private enabled;
38
+ constructor(config?: Partial<BudgetConfig>, enabled?: boolean);
39
+ record(inputTokens: number, outputTokens: number): void;
40
+ check(): BudgetCheck;
41
+ status(): BudgetSnapshot;
42
+ isEnabled(): boolean;
43
+ formatBar(width?: number): string;
44
+ formatWarning(): string | null;
45
+ formatSessionSummary(): string;
46
+ }
47
+ //# sourceMappingURL=budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../src/budget.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,oFAAoF;IACpF,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAGD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAU;gBAEb,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,UAAO;IAa1D,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAOvD,KAAK,IAAI,WAAW;IA6CpB,MAAM,IAAI,cAAc;IAkBxB,SAAS,IAAI,OAAO;IAKpB,SAAS,CAAC,KAAK,SAAK,GAAG,MAAM;IAkC7B,aAAa,IAAI,MAAM,GAAG,IAAI;IA6B9B,oBAAoB,IAAI,MAAM;CAQ/B"}