cascade-ai 0.2.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/README.md +676 -0
- package/bin/cascade.js +3 -0
- package/completions/cascade.bash +23 -0
- package/completions/cascade.fish +20 -0
- package/completions/cascade.zsh +32 -0
- package/dist/cli.cjs +10442 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +10395 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +7544 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1578 -0
- package/dist/index.d.ts +1578 -0
- package/dist/index.js +7452 -0
- package/dist/index.js.map +1 -0
- package/dist/keytar-F4YAPN53.node +0 -0
- package/package.json +135 -0
- package/web/dist/assets/index-DO_ICahS.css +1 -0
- package/web/dist/assets/index-qNI_hqt1.js +216 -0
- package/web/dist/assets/react-Cpp6qqoq.js +1 -0
- package/web/dist/assets/reactflow-B1e2RnXD.js +48 -0
- package/web/dist/assets/socketio-BcxXcwBL.js +1 -0
- package/web/dist/index.html +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
# ◈ Cascade AI
|
|
2
|
+
|
|
3
|
+
> Multi-tier AI orchestration CLI — built for developers who think in systems.
|
|
4
|
+
|
|
5
|
+
Cascade is an open-source CLI tool that runs your prompts through a hierarchical three-tier agent system (T1 → T2 → T3), automatically routing work across the best available models, executing tools, and compiling a single coherent result. Inspired by Claude Code, Gemini CLI, and GitHub Copilot CLI — but uniquely structured around orchestration.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
cascade "Refactor the auth module to use JWT, add tests, and open a PR"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [How It Works](#how-it-works)
|
|
16
|
+
- [Features](#features)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Quick Start](#quick-start)
|
|
19
|
+
- [Configuration](#configuration)
|
|
20
|
+
- [AI Providers](#ai-providers)
|
|
21
|
+
- [Tools](#tools)
|
|
22
|
+
- [CLI Reference](#cli-reference)
|
|
23
|
+
- [Slash Commands](#slash-commands)
|
|
24
|
+
- [Themes](#themes)
|
|
25
|
+
- [Web Dashboard](#web-dashboard)
|
|
26
|
+
- [SDK / Programmatic Use](#sdk--programmatic-use)
|
|
27
|
+
- [MCP Support](#mcp-support)
|
|
28
|
+
- [Hooks](#hooks)
|
|
29
|
+
- [Memory & Identity](#memory--identity)
|
|
30
|
+
- [Security](#security)
|
|
31
|
+
- [Shell Completions](#shell-completions)
|
|
32
|
+
- [Architecture](#architecture)
|
|
33
|
+
- [Roadmap](#roadmap)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
Every task runs through three agent tiers:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
User prompt
|
|
43
|
+
│
|
|
44
|
+
▼
|
|
45
|
+
┌─────────────────────────────────────────────┐
|
|
46
|
+
│ T1 Administrator │
|
|
47
|
+
│ • Analyzes complexity │
|
|
48
|
+
│ • Selects models for all tiers │
|
|
49
|
+
│ • Decomposes task into n sections │
|
|
50
|
+
│ • Compiles final output │
|
|
51
|
+
└──────────────┬──────────────────────────────┘
|
|
52
|
+
│ dispatches in parallel
|
|
53
|
+
┌──────────┼──────────┐
|
|
54
|
+
▼ ▼ ▼
|
|
55
|
+
┌───────┐ ┌───────┐ ┌───────┐
|
|
56
|
+
│ T2 │ │ T2 │ │ T2 │ Managers
|
|
57
|
+
│ Sec.1 │ │ Sec.2 │ │ Sec.3 │ • Own one section
|
|
58
|
+
└───┬───┘ └───┬───┘ └───┬───┘ • Spawn T3 workers
|
|
59
|
+
│ │ │ • Aggregate results
|
|
60
|
+
T3s T3s T3s Workers
|
|
61
|
+
execute execute execute • Run tools
|
|
62
|
+
subtasks subtasks subtasks • Self-test output
|
|
63
|
+
• Escalate if needed
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Complexity → tier count:**
|
|
67
|
+
|
|
68
|
+
| Complexity | T2 Managers |
|
|
69
|
+
|----------------|-------------|
|
|
70
|
+
| Simple | 1 |
|
|
71
|
+
| Moderate | 2–3 |
|
|
72
|
+
| Complex | 3–5 |
|
|
73
|
+
| Highly Complex | 5+ |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
### Core
|
|
80
|
+
- **Hierarchical orchestration** — T1/T2/T3 agents with structured escalation
|
|
81
|
+
- **Token-by-token streaming** — live output as agents work
|
|
82
|
+
- **Live agent tree** — real-time T1→T2→T3 execution graph in the terminal
|
|
83
|
+
- **Approval prompts** — explicit y/n for destructive tool operations
|
|
84
|
+
- **Provider failover** — auto-switches provider on rate limits (exponential backoff)
|
|
85
|
+
- **Context auto-summarization** — compresses history when the context window fills
|
|
86
|
+
- **Conversation branching** — fork a session to try parallel approaches
|
|
87
|
+
|
|
88
|
+
### AI Providers
|
|
89
|
+
- Anthropic (Claude Opus 4, Sonnet 4, Haiku 3.5)
|
|
90
|
+
- OpenAI (GPT-4o, GPT-4o Mini)
|
|
91
|
+
- Google Gemini (1.5 Pro, 2.0 Flash)
|
|
92
|
+
- Azure OpenAI (any deployment)
|
|
93
|
+
- OpenAI-compatible endpoints (Groq, Together, custom)
|
|
94
|
+
- Ollama — local models, **T3 workers prefer local for cost savings**
|
|
95
|
+
|
|
96
|
+
### Tools (T3 Workers)
|
|
97
|
+
- **Shell** — execute commands with allowlist/blocklist
|
|
98
|
+
- **File** — read, write, edit (exact string replace), delete
|
|
99
|
+
- **Diff** — inline side-by-side diffs before applying edits
|
|
100
|
+
- **Git** — status, diff, log, add, commit, branch, push, pull
|
|
101
|
+
- **GitHub / GitLab** — create PRs, list/comment on issues
|
|
102
|
+
- **Browser** — Playwright automation (multimodal models only)
|
|
103
|
+
- **Image** — analyze images (vision-capable models only)
|
|
104
|
+
|
|
105
|
+
### Developer Experience
|
|
106
|
+
- **6 color themes** — cascade, dark, light, dracula, nord, solarized
|
|
107
|
+
- **`CASCADE.md`** — project-level instructions for agents
|
|
108
|
+
- **`.cascadeignore`** — files agents cannot touch
|
|
109
|
+
- **MCP support** — connect any Model Context Protocol server
|
|
110
|
+
- **Hooks** — shell scripts on pre/post tool use
|
|
111
|
+
- **Session history** — searchable, exportable (markdown / JSON)
|
|
112
|
+
- **Audit log** — every tool call, file change, and agent decision
|
|
113
|
+
- **Cost tracker** — real-time per-session token + USD cost
|
|
114
|
+
- **Scheduled tasks** — cron-based automated runs
|
|
115
|
+
- **Desktop notifications** — alert when background tasks finish
|
|
116
|
+
- **Webhooks** — POST to Slack / Discord / custom URL on completion
|
|
117
|
+
|
|
118
|
+
### Web Dashboard
|
|
119
|
+
- Real-time agent execution graph (ReactFlow)
|
|
120
|
+
- Session browser with cost/token stats
|
|
121
|
+
- Config viewer
|
|
122
|
+
- JWT auth (password-protected)
|
|
123
|
+
- Single-tenant and multi-tenant team modes
|
|
124
|
+
- WebSocket live updates
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Installation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm install -g cascade-ai
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> Requires **Node.js ≥ 18**.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Quick Start
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 1. Initialize a project
|
|
142
|
+
cd my-project
|
|
143
|
+
cascade init
|
|
144
|
+
|
|
145
|
+
# 2. Set API keys (or add to .env)
|
|
146
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
147
|
+
export OPENAI_API_KEY=sk-...
|
|
148
|
+
export GOOGLE_API_KEY=AIza...
|
|
149
|
+
|
|
150
|
+
# 3. Check everything is working
|
|
151
|
+
cascade doctor
|
|
152
|
+
|
|
153
|
+
# 4. Start the interactive REPL
|
|
154
|
+
cascade
|
|
155
|
+
|
|
156
|
+
# 5. Or run a one-shot prompt
|
|
157
|
+
cascade run "explain the auth module in this repo"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
Cascade loads config from `.cascade/config.json` in your project directory.
|
|
165
|
+
|
|
166
|
+
```jsonc
|
|
167
|
+
// .cascade/config.json
|
|
168
|
+
{
|
|
169
|
+
"version": "1.0",
|
|
170
|
+
"providers": [
|
|
171
|
+
{ "type": "anthropic", "apiKey": "sk-ant-..." },
|
|
172
|
+
{ "type": "openai", "apiKey": "sk-..." },
|
|
173
|
+
{ "type": "gemini", "apiKey": "AIza..." },
|
|
174
|
+
{ "type": "ollama" }
|
|
175
|
+
],
|
|
176
|
+
"models": {
|
|
177
|
+
"t1": "claude-opus-4",
|
|
178
|
+
"t2": "claude-sonnet-4",
|
|
179
|
+
"t3": "llama3.2:3b"
|
|
180
|
+
},
|
|
181
|
+
"tools": {
|
|
182
|
+
"shellAllowlist": [],
|
|
183
|
+
"shellBlocklist": ["sudo rm", "rm -rf", "mkfs"],
|
|
184
|
+
"requireApprovalFor": ["shell", "file_write", "file_delete"],
|
|
185
|
+
"browserEnabled": false
|
|
186
|
+
},
|
|
187
|
+
"dashboard": {
|
|
188
|
+
"port": 4891,
|
|
189
|
+
"auth": true,
|
|
190
|
+
"teamMode": "single"
|
|
191
|
+
},
|
|
192
|
+
"theme": "cascade",
|
|
193
|
+
"telemetry": { "enabled": false }
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
API keys are also read from environment variables:
|
|
198
|
+
|
|
199
|
+
| Provider | Environment Variable |
|
|
200
|
+
|----------|-----------------------|
|
|
201
|
+
| Anthropic | `ANTHROPIC_API_KEY` |
|
|
202
|
+
| OpenAI | `OPENAI_API_KEY` |
|
|
203
|
+
| Gemini | `GOOGLE_API_KEY` |
|
|
204
|
+
| Azure | `AZURE_OPENAI_KEY` |
|
|
205
|
+
|
|
206
|
+
### CASCADE.md
|
|
207
|
+
|
|
208
|
+
Create a `CASCADE.md` in your project root to give agents project-specific instructions — just like `CLAUDE.md`. Run `cascade init` to generate a template.
|
|
209
|
+
|
|
210
|
+
### .cascadeignore
|
|
211
|
+
|
|
212
|
+
List files and directories agents cannot read or modify. Syntax is identical to `.gitignore`. Secrets (`.env`, `*.pem`, `*.key`) and Cascade internals (`.cascade/keystore.enc`) are protected by default.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## AI Providers
|
|
217
|
+
|
|
218
|
+
### Model routing (auto-selected at startup)
|
|
219
|
+
|
|
220
|
+
| Tier | Priority order |
|
|
221
|
+
|------|---------------|
|
|
222
|
+
| T1 | Anthropic → OpenAI → Google *(no local)* |
|
|
223
|
+
| T2 | Anthropic → OpenAI → Google → Local (≥70B) |
|
|
224
|
+
| T3 | **Local first** → Anthropic → OpenAI → Google |
|
|
225
|
+
|
|
226
|
+
T3 workers prefer local Ollama models for cost savings. Override with `"models"` in your config.
|
|
227
|
+
|
|
228
|
+
### Multimodal / Vision
|
|
229
|
+
|
|
230
|
+
Images are only processed by vision-capable models. When you attach an image:
|
|
231
|
+
- **T1** analyzes it as part of understanding your top-level request
|
|
232
|
+
- **T3** analyzes it when image processing is the actual subtask
|
|
233
|
+
|
|
234
|
+
### Ollama (local models)
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Install Ollama then pull a model
|
|
238
|
+
ollama pull llama3.2:3b # T3 workers
|
|
239
|
+
ollama pull llava # T3 vision tasks
|
|
240
|
+
ollama pull llama3:70b # T2 managers
|
|
241
|
+
|
|
242
|
+
# Cascade auto-detects Ollama at localhost:11434
|
|
243
|
+
cascade doctor # confirms detection
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Azure OpenAI
|
|
247
|
+
|
|
248
|
+
```jsonc
|
|
249
|
+
{
|
|
250
|
+
"providers": [{
|
|
251
|
+
"type": "azure",
|
|
252
|
+
"apiKey": "...",
|
|
253
|
+
"baseUrl": "https://YOUR_RESOURCE.openai.azure.com",
|
|
254
|
+
"deploymentName": "gpt-4o",
|
|
255
|
+
"apiVersion": "2024-08-01-preview"
|
|
256
|
+
}]
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### OpenAI-compatible endpoints (Groq, Together, etc.)
|
|
261
|
+
|
|
262
|
+
```jsonc
|
|
263
|
+
{
|
|
264
|
+
"providers": [{
|
|
265
|
+
"type": "openai-compatible",
|
|
266
|
+
"apiKey": "...",
|
|
267
|
+
"baseUrl": "https://api.groq.com/openai/v1",
|
|
268
|
+
"model": "llama-3.1-70b-versatile"
|
|
269
|
+
}]
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Tools
|
|
276
|
+
|
|
277
|
+
T3 workers have access to the following tools. All destructive operations require explicit approval unless disabled in config.
|
|
278
|
+
|
|
279
|
+
| Tool | Description | Dangerous |
|
|
280
|
+
|---------------|--------------------------------------------------|-----------|
|
|
281
|
+
| `shell` | Execute shell commands | ✓ |
|
|
282
|
+
| `file_read` | Read file contents with optional line range | |
|
|
283
|
+
| `file_write` | Write / overwrite a file | ✓ |
|
|
284
|
+
| `file_edit` | Exact-string in-place edit | ✓ |
|
|
285
|
+
| `file_delete` | Delete a file | ✓ |
|
|
286
|
+
| `git` | status, diff, log, add, commit, push, pull, etc. | ✓ |
|
|
287
|
+
| `github` | Create PRs, list/comment issues (GitHub/GitLab) | ✓ |
|
|
288
|
+
| `browser` | Playwright automation (vision models only) | ✓ |
|
|
289
|
+
| `image_analyze` | Describe an image file | |
|
|
290
|
+
|
|
291
|
+
### Shell allowlist / blocklist
|
|
292
|
+
|
|
293
|
+
```jsonc
|
|
294
|
+
"tools": {
|
|
295
|
+
"shellAllowlist": ["npm", "git", "python"], // only these prefixes allowed
|
|
296
|
+
"shellBlocklist": ["sudo", "curl http://"] // always blocked
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## CLI Reference
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
cascade [options] Start interactive REPL
|
|
306
|
+
cascade run <prompt> Run a single prompt and exit
|
|
307
|
+
cascade init [path] Initialize Cascade in a directory
|
|
308
|
+
cascade doctor Diagnose API keys, Ollama, config
|
|
309
|
+
cascade update Update to the latest version
|
|
310
|
+
cascade dashboard Launch the web dashboard
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Options:**
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
-p, --prompt <text> Single prompt (non-interactive mode)
|
|
317
|
+
-t, --theme <name> Color theme (cascade|dark|light|dracula|nord|solarized)
|
|
318
|
+
-w, --workspace <path> Workspace path (default: cwd)
|
|
319
|
+
-v, --version Show version
|
|
320
|
+
--no-color Disable colors
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Slash Commands
|
|
326
|
+
|
|
327
|
+
Type any of these inside the REPL:
|
|
328
|
+
|
|
329
|
+
| Command | Description |
|
|
330
|
+
|--------------|-----------------------------------------------|
|
|
331
|
+
| `/help` | List all slash commands |
|
|
332
|
+
| `/clear` | Clear conversation history |
|
|
333
|
+
| `/exit` | Exit Cascade |
|
|
334
|
+
| `/theme <name>` | Switch color theme |
|
|
335
|
+
| `/model` | Show active models per tier |
|
|
336
|
+
| `/cost` | Toggle session cost / token usage panel |
|
|
337
|
+
| `/export [markdown\|json]` | Export session to file |
|
|
338
|
+
| `/rollback` | Undo all file changes made in this session |
|
|
339
|
+
| `/branch` | Fork the session into parallel branches |
|
|
340
|
+
| `/compact` | Summarize and compress context now |
|
|
341
|
+
| `/identity` | Switch active identity |
|
|
342
|
+
| `/sessions` | List and resume past sessions |
|
|
343
|
+
| `/status` | Show live agent tree status |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Themes
|
|
348
|
+
|
|
349
|
+
Switch with `/theme <name>` in the REPL or set `"theme"` in config.
|
|
350
|
+
|
|
351
|
+
| Theme | Style |
|
|
352
|
+
|-------------|------------------------------|
|
|
353
|
+
| `cascade` | Cascade violet — default |
|
|
354
|
+
| `dark` | Blue-accented dark |
|
|
355
|
+
| `light` | Clean light mode |
|
|
356
|
+
| `dracula` | Dracula palette |
|
|
357
|
+
| `nord` | Arctic Nord palette |
|
|
358
|
+
| `solarized` | Solarized dark |
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Web Dashboard
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
cascade dashboard
|
|
366
|
+
# → http://localhost:4891
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Default password: set `CASCADE_DASHBOARD_PASSWORD` env var (default: `cascade`).
|
|
370
|
+
|
|
371
|
+
**Features:**
|
|
372
|
+
- Live agent execution graph powered by ReactFlow
|
|
373
|
+
- Session browser (view, delete, inspect cost/tokens)
|
|
374
|
+
- Real-time streaming log
|
|
375
|
+
- Config inspector
|
|
376
|
+
- JWT authentication
|
|
377
|
+
- Team mode: `"single"` (shared workspace) or `"multi"` (per-user isolation)
|
|
378
|
+
|
|
379
|
+
**Custom port:**
|
|
380
|
+
```bash
|
|
381
|
+
cascade dashboard --port 8080
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## SDK / Programmatic Use
|
|
387
|
+
|
|
388
|
+
```typescript
|
|
389
|
+
import { runCascade, createCascade, streamCascade } from 'cascade-ai';
|
|
390
|
+
|
|
391
|
+
// Simple run
|
|
392
|
+
const result = await runCascade('Write a Fibonacci function in TypeScript');
|
|
393
|
+
console.log(result.output);
|
|
394
|
+
|
|
395
|
+
// Streaming
|
|
396
|
+
await streamCascade('Explain this codebase', (token) => process.stdout.write(token));
|
|
397
|
+
|
|
398
|
+
// Full control
|
|
399
|
+
const cascade = createCascade({
|
|
400
|
+
providers: [{ type: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY }],
|
|
401
|
+
theme: 'dark',
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
await cascade.init();
|
|
405
|
+
|
|
406
|
+
const result = await cascade.run({
|
|
407
|
+
prompt: 'Refactor the auth module',
|
|
408
|
+
workspacePath: '/my/project',
|
|
409
|
+
approvalCallback: async (req) => {
|
|
410
|
+
console.log(`Allow ${req.toolName}?`);
|
|
411
|
+
return true;
|
|
412
|
+
},
|
|
413
|
+
streamCallback: (chunk) => process.stdout.write(chunk.text),
|
|
414
|
+
});
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## MCP Support
|
|
420
|
+
|
|
421
|
+
Cascade supports the [Model Context Protocol](https://modelcontextprotocol.io). Connect any MCP server and its tools become available to T3 workers automatically.
|
|
422
|
+
|
|
423
|
+
```jsonc
|
|
424
|
+
// .cascade/config.json — MCP servers (coming in a future config key)
|
|
425
|
+
// Currently connected programmatically:
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
```typescript
|
|
429
|
+
import { McpClient } from 'cascade-ai';
|
|
430
|
+
|
|
431
|
+
const mcp = new McpClient();
|
|
432
|
+
await mcp.connect({
|
|
433
|
+
name: 'filesystem',
|
|
434
|
+
command: 'npx',
|
|
435
|
+
args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
|
|
436
|
+
});
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Hooks
|
|
442
|
+
|
|
443
|
+
Run shell scripts before or after tool use. Defined in `.cascade/config.json`:
|
|
444
|
+
|
|
445
|
+
```jsonc
|
|
446
|
+
"hooks": {
|
|
447
|
+
"preToolUse": [
|
|
448
|
+
{
|
|
449
|
+
"command": "echo 'Tool: $CASCADE_TOOL' >> .cascade/audit.log",
|
|
450
|
+
"tools": ["shell", "file_write"]
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
"postToolUse": [
|
|
454
|
+
{
|
|
455
|
+
"command": "npm run lint --silent || true",
|
|
456
|
+
"tools": ["file_write", "file_edit"],
|
|
457
|
+
"timeout": 15000
|
|
458
|
+
}
|
|
459
|
+
],
|
|
460
|
+
"postTask": [
|
|
461
|
+
{ "command": "git add -A && git status" }
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Environment variables injected: `CASCADE_TOOL`, `CASCADE_INPUT`, `CASCADE_OUTPUT`.
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Memory & Identity
|
|
471
|
+
|
|
472
|
+
Cascade stores session history, identities, and audit logs in `.cascade/memory.db` (SQLite).
|
|
473
|
+
|
|
474
|
+
### Identities
|
|
475
|
+
|
|
476
|
+
Create multiple named identities with different system prompts and default models:
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Coming: cascade identity create --name "Code Reviewer" --prompt "You are strict about best practices..."
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Session export
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
/export markdown → session-2026-04-02.md
|
|
486
|
+
/export json → session-2026-04-02.json
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## Security
|
|
492
|
+
|
|
493
|
+
### Encrypted keystore
|
|
494
|
+
|
|
495
|
+
API keys stored in `.cascade/keystore.enc` are encrypted with **AES-256-GCM** using PBKDF2 key derivation (100,000 iterations). The file is useless without your master password.
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
# Coming: cascade keys set anthropic sk-ant-...
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### .cascadeignore
|
|
502
|
+
|
|
503
|
+
Always-protected by default (cannot be overridden):
|
|
504
|
+
- `.env`, `.env.*`
|
|
505
|
+
- `*.pem`, `*.key`, `id_rsa`, `id_ed25519`
|
|
506
|
+
- `.cascade/keystore.enc`
|
|
507
|
+
- `.cascade/memory.db`
|
|
508
|
+
|
|
509
|
+
### Approval prompts
|
|
510
|
+
|
|
511
|
+
Any tool marked as dangerous requires explicit `y` / `n` before execution. Configure which tools require approval in `.cascade/config.json → tools.requireApprovalFor`.
|
|
512
|
+
|
|
513
|
+
### Command allowlist/blocklist
|
|
514
|
+
|
|
515
|
+
```jsonc
|
|
516
|
+
"tools": {
|
|
517
|
+
"shellAllowlist": ["npm", "git", "python3"],
|
|
518
|
+
"shellBlocklist": ["sudo", "curl", "wget", "nc"]
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## Shell Completions
|
|
525
|
+
|
|
526
|
+
**Bash** — add to `~/.bashrc`:
|
|
527
|
+
```bash
|
|
528
|
+
source /usr/local/lib/node_modules/cascade-ai/completions/cascade.bash
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
**Zsh** — add to `~/.zshrc`:
|
|
532
|
+
```zsh
|
|
533
|
+
fpath=(/usr/local/lib/node_modules/cascade-ai/completions $fpath)
|
|
534
|
+
autoload -Uz compinit && compinit
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**Fish**:
|
|
538
|
+
```fish
|
|
539
|
+
cp /usr/local/lib/node_modules/cascade-ai/completions/cascade.fish \
|
|
540
|
+
~/.config/fish/completions/
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## Architecture
|
|
546
|
+
|
|
547
|
+
```
|
|
548
|
+
src/
|
|
549
|
+
├── core/
|
|
550
|
+
│ ├── tiers/ T1Administrator, T2Manager, T3Worker
|
|
551
|
+
│ ├── router/ CascadeRouter, ModelSelector, FailoverManager
|
|
552
|
+
│ ├── context/ ContextManager (auto-summarization)
|
|
553
|
+
│ ├── messages/ Inter-tier JSON schema (Zod)
|
|
554
|
+
│ └── cascade.ts Main Cascade class (EventEmitter facade)
|
|
555
|
+
├── providers/ Anthropic, OpenAI, Gemini, Azure, Ollama, OpenAI-compat
|
|
556
|
+
├── tools/ Shell, File (CRUD), Diff, Git, GitHub, Browser, Image
|
|
557
|
+
├── cli/
|
|
558
|
+
│ ├── repl/ ink REPL + AgentTree, ChatMessage, StatusBar, Approval
|
|
559
|
+
│ ├── slash/ Slash command registry
|
|
560
|
+
│ ├── themes/ 6 color themes
|
|
561
|
+
│ └── commands/ init, doctor, update, dashboard
|
|
562
|
+
├── config/ ConfigManager, Keystore (AES-256), CASCADE.md, .cascadeignore
|
|
563
|
+
├── memory/ SQLite store (sessions, identities, audit, scheduler)
|
|
564
|
+
├── dashboard/ Express server, JWT auth, Socket.io
|
|
565
|
+
├── hooks/ Pre/post tool hook runner
|
|
566
|
+
├── mcp/ MCP client
|
|
567
|
+
├── scheduler/ node-cron task scheduler
|
|
568
|
+
├── notifications/ Desktop notifications + webhooks
|
|
569
|
+
├── telemetry/ Opt-in PostHog
|
|
570
|
+
├── sdk/ runCascade(), createCascade(), streamCascade()
|
|
571
|
+
└── index.ts Full package exports
|
|
572
|
+
|
|
573
|
+
web/
|
|
574
|
+
├── src/
|
|
575
|
+
│ ├── App.tsx Dashboard SPA (login, dashboard, sessions, settings)
|
|
576
|
+
│ ├── components/ AgentGraph (ReactFlow)
|
|
577
|
+
│ └── hooks/ useWebSocket (Socket.io)
|
|
578
|
+
└── vite.config.ts Vite + Tailwind build
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## Roadmap
|
|
584
|
+
|
|
585
|
+
| Status | Feature |
|
|
586
|
+
|--------|---------|
|
|
587
|
+
| ✓ | T1/T2/T3 hierarchical orchestration |
|
|
588
|
+
| ✓ | 6 AI providers + Ollama |
|
|
589
|
+
| ✓ | Provider failover |
|
|
590
|
+
| ✓ | Streaming REPL (ink) |
|
|
591
|
+
| ✓ | Live agent tree visualization |
|
|
592
|
+
| ✓ | AES-256 encrypted keystore |
|
|
593
|
+
| ✓ | Web dashboard + WebSocket |
|
|
594
|
+
| ✓ | MCP client |
|
|
595
|
+
| ✓ | Hooks system |
|
|
596
|
+
| ✓ | Scheduler + notifications |
|
|
597
|
+
| ✓ | SDK |
|
|
598
|
+
| 🔜 | VSCode extension (`cascade-vscode`) |
|
|
599
|
+
| 🔜 | JetBrains extension (`cascade-jetbrains`) |
|
|
600
|
+
| 🔜 | Cascade Cloud (hosted dashboard) |
|
|
601
|
+
| 🔜 | Plugin marketplace |
|
|
602
|
+
| 🔜 | Voice input (STT) |
|
|
603
|
+
| 🔜 | Multi-workspace support |
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## Contributing
|
|
608
|
+
|
|
609
|
+
### Prerequisites
|
|
610
|
+
|
|
611
|
+
| Tool | Required Version |
|
|
612
|
+
|------|-----------------|
|
|
613
|
+
| Node.js | ≥ 20.x |
|
|
614
|
+
| npm | ≥ 10.x |
|
|
615
|
+
|
|
616
|
+
### Setup
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
git clone https://github.com/Varun-SV/Cascade-AI.git
|
|
620
|
+
cd Cascade-AI
|
|
621
|
+
npm install # installs root + web via npm workspaces
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Development commands
|
|
625
|
+
|
|
626
|
+
```bash
|
|
627
|
+
npm run dev # watch mode for the CLI
|
|
628
|
+
npm run build # build CLI + web dashboard
|
|
629
|
+
npm run dev:web # hot-reload dashboard at web/
|
|
630
|
+
npm test # vitest
|
|
631
|
+
npm run lint # tsc --noEmit
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Architecture notes
|
|
635
|
+
|
|
636
|
+
**Permission escalation.** When a T3 Worker needs to execute a dangerous tool the
|
|
637
|
+
request travels `T3 → PermissionEscalator → T2 → T1 → User`. Read-only tools are
|
|
638
|
+
auto-approved by rule; dangerous ones use a max-10-token LLM inference at each
|
|
639
|
+
tier. Session-wide approvals are cached by `${t2Id}:${toolName}`.
|
|
640
|
+
|
|
641
|
+
**Adding a tool.** Create `src/tools/my-tool.ts` extending `BaseTool`; implement
|
|
642
|
+
`getDefinition()`, `execute()`, and optionally `isDangerous()`; register in
|
|
643
|
+
`src/tools/registry.ts` → `registerDefaults()`; if approval is required, add the
|
|
644
|
+
tool name to `DEFAULT_APPROVAL_REQUIRED` in `src/constants.ts`.
|
|
645
|
+
|
|
646
|
+
**Adding a plugin.** Use the `ToolPlugin` interface from
|
|
647
|
+
`src/tools/registry.ts` to bundle one or more tools.
|
|
648
|
+
|
|
649
|
+
### Testing
|
|
650
|
+
|
|
651
|
+
- Coverage target: 80% lines, 75% functions, 70% branches.
|
|
652
|
+
- Co-locate `*.test.ts` alongside the source file they test.
|
|
653
|
+
- Mock external I/O (`fs`, network) with `vi.mock()`; don't mock internal logic.
|
|
654
|
+
|
|
655
|
+
### Code style
|
|
656
|
+
|
|
657
|
+
- TypeScript strict mode is enforced.
|
|
658
|
+
- Use `async/await`, not `.then()` chains.
|
|
659
|
+
- Wrap external calls (shell, git, GitHub API) with `withRetry()` from
|
|
660
|
+
`src/utils/retry.ts`.
|
|
661
|
+
- Raise tool failures as `CascadeToolError` so they carry a `.userMessage`.
|
|
662
|
+
|
|
663
|
+
### Pull request checklist
|
|
664
|
+
|
|
665
|
+
- [ ] Tests added / updated for changed code
|
|
666
|
+
- [ ] `npm test` passes
|
|
667
|
+
- [ ] `npm run build` succeeds
|
|
668
|
+
- [ ] New public APIs have JSDoc
|
|
669
|
+
- [ ] No hardcoded API keys or secrets
|
|
670
|
+
- [ ] `.cascadeignore` patterns respected for file tools
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## License
|
|
675
|
+
|
|
676
|
+
MIT © Cascade AI Contributors
|
package/bin/cascade.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Cascade AI — Bash completions
|
|
3
|
+
# Install: source <(cascade completions bash)
|
|
4
|
+
|
|
5
|
+
_cascade_completions() {
|
|
6
|
+
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
7
|
+
local commands="init doctor update dashboard run --help --version"
|
|
8
|
+
local flags="--prompt --theme --workspace --no-color"
|
|
9
|
+
local themes="cascade dark light dracula nord solarized"
|
|
10
|
+
|
|
11
|
+
if [[ "${COMP_WORDS[COMP_CWORD-1]}" == "--theme" ]]; then
|
|
12
|
+
COMPREPLY=($(compgen -W "$themes" -- "$cur"))
|
|
13
|
+
return
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [[ "$cur" == -* ]]; then
|
|
17
|
+
COMPREPLY=($(compgen -W "$flags" -- "$cur"))
|
|
18
|
+
else
|
|
19
|
+
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
|
20
|
+
fi
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
complete -F _cascade_completions cascade
|