@nomad-e/bluma-cli 0.1.84 → 0.3.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 CHANGED
@@ -1,1117 +1,371 @@
1
- # BluMa CLI — Base Language Unit · Model Agent
1
+ # BluMa CLI — AI Agent for Advanced Software Engineering
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@nomad-e/bluma-cli.svg?style=flat-square)](https://www.npmjs.com/package/@nomad-e/bluma-cli)
4
- [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
3
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%2.0-blue.svg?style=flat-square)](LICENSE)
5
4
  [![Node.js >=20](https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square)](https://nodejs.org/)
5
+ [![Version](https://img.shields.io/npm/v/@nomad-e/bluma-cli?style=flat-square)](https://www.npmjs.com/package/@nomad-e/bluma-cli)
6
6
 
7
- ![Factorai.sh Banner](assets/bg.png)
8
-
9
-
10
- **BluMa** is a CLI-based model agent for advanced software engineering workflows. Built with React/Ink 5, it provides an interactive terminal interface for LLM-powered automation, code generation, refactoring, and task execution. Features persistent sessions, contextual reasoning, smart feedback, coordinator mode for worker orchestration, and extensible tools/skills architecture.
11
-
12
- > **Credit:** BluMa was conceived and architected by **Alex Fonseca**.
13
-
14
- **Current Version:** 0.1.74
15
-
16
- ---
17
-
18
- ## Table of Contents
19
-
20
- - [Overview](#overview)
21
- - [Key Features](#key-features)
22
- - [Requirements](#requirements)
23
- - [Installation](#installation)
24
- - [Quick Start](#quick-start)
25
- - [Configuration](#configuration)
26
- - [Architecture](#architecture)
27
- - [Native Tools](#native-tools)
28
- - [Skills System](#skills-system)
29
- - [Runtime & Orchestration](#runtime--orchestration)
30
- - [Slash Commands](#slash-commands)
31
- - [Development](#development)
32
- - [Testing](#testing)
33
- - [Contributing](#contributing)
34
- - [License](#license)
35
-
36
- ---
37
-
38
- ## Overview
39
-
40
- BluMa operates as a **conversational agent** in the terminal, combining:
41
-
42
- - **Rich UI Layer**: React/Ink 5 components for interactive prompts, live overlays, and real-time feedback
43
- - **Agent Layer**: LLM orchestration via FactorRouter with tool invocation and context management
44
- - **Runtime Layer**: Task tracking, plugin system, hooks, diagnostics, session management, and coordinator mode
45
- - **Tool Layer**: 45+ native tools + MCP SDK integration for external tools
46
-
47
- The agent maintains persistent conversation history, workspace snapshots, and coding memory across sessions.
48
-
49
- ---
50
-
51
- ## Key Features
52
-
53
- ### Core Agent
54
- - **Interactive CLI**: Rich terminal UI with React/Ink 5
55
- - **Session Persistence**: Automatic save/load of conversation and tool history
56
- - **Context Management**: Token-aware context compression with history anchoring
57
- - **Smart Feedback**: Technical suggestions and automated checks
58
- - **Confirmation System**: Controlled execution with whitelists and previews
59
- - **Coding Memory**: Persistent notes about codebase decisions (`~/.bluma/coding_memory.json`)
60
-
61
- ### Runtime & Orchestration (v0.1.41+)
62
- - **Plugin System**: Load plugins from `.bluma/plugins/` or `~/.bluma/plugins/`
63
- - **Hook Registry**: Event-driven lifecycle tracking (tool calls, decisions, state changes)
64
- - **Task Store**: Persistent task management with PLANNING → EXECUTION → VERIFICATION flow
65
- - **Session Registry**: Multi-session support with process health monitoring
66
- - **Diagnostics**: Real-time system snapshot (tasks, hooks, plugins, sessions)
67
- - **Tool Execution Policy**: Intelligent decisions based on sandbox mode and safety
68
-
69
- ### Tools & Skills
70
- - **45+ Native Tools**: File operations, search, shell commands, web fetch, agent coordination, task management, MCP resources, cron scheduling, LSP queries, notebook editing
71
- - **Coordinator Mode**: Orchestrator playbook for delegating work to background workers
72
- - **MCP Integration**: Model Context Protocol SDK for external tool servers
73
- - **Skills System**: Pluggable knowledge modules (git, PDF, Excel, etc.)
74
- - **Agent Coordination**: Spawn/wait/list subagents for parallel work
75
-
76
- ### UI Components
77
- - **Slash Commands**: 20+ built-in commands (`/help`, `/model`, `/tasks`, `/plugins`, etc.)
78
- - **Live Overlays**: Working timers, progress indicators, streaming text
79
- - **Diff Previews**: Side-by-side code comparisons before edits
80
- - **Tool Result Cards**: Structured display of tool outputs
81
- - **Session Panels**: Real-time monitoring with log streaming
7
+ **BluMa** is an independent AI agent CLI for automation and advanced software engineering. It combines powerful tool orchestration, multi-agent coordination, and intelligent context management to help you build software faster and with higher quality.
82
8
 
83
9
  ---
84
10
 
85
- ## Requirements
86
-
87
- - **Node.js**: >= 20
88
- - **npm**: >= 9
89
- - **FactorRouter**: API key and URL for LLM backend
90
-
91
- ---
92
-
93
- ## Installation
94
-
95
- ### Global Installation (Recommended)
11
+ ## 🚀 Quick Start
96
12
 
97
13
  ```bash
14
+ # Install globally
98
15
  npm install -g @nomad-e/bluma-cli
99
- ```
100
16
 
101
- **Linux/macOS** (if permission errors):
102
- ```bash
103
- sudo npm install -g @nomad-e/bluma-cli
104
- ```
105
-
106
- > **macOS Note**: After installation, run `bluma` **without** sudo to avoid permission issues.
107
-
108
- ### Local Development
17
+ # Run BluMa
18
+ bluma
109
19
 
110
- ```bash
111
- git clone <repository-url>
112
- cd bluma-cli
20
+ # Or run from source
113
21
  npm install
114
22
  npm run build
115
- ```
116
-
117
- ### Environment Setup
118
-
119
- Set these environment variables globally:
120
-
121
- ```bash
122
- # Linux/macOS: Add to ~/.bashrc, ~/.zshrc, or ~/.bash_profile
123
- export FACTOR_ROUTER_KEY="sk-fai-your-key-here"
124
- export FACTOR_ROUTER_URL="http://host:8003/router-api"
125
-
126
- # Then reload
127
- source ~/.bashrc # or ~/.zshrc
128
- ```
129
-
130
- **Windows (PowerShell)**:
131
- ```powershell
132
- [Environment]::SetEnvironmentVariable("FACTOR_ROUTER_KEY", "sk-fai-your-key-here", "User")
133
- [Environment]::SetEnvironmentVariable("FACTOR_ROUTER_URL", "http://host:8003/router-api", "User")
134
- ```
135
-
136
- ---
137
-
138
- ## Quick Start
139
-
140
- ```bash
141
- # Launch BluMa
142
- bluma
143
-
144
- # Or from local development
145
23
  npm start
146
24
  ```
147
25
 
148
- ### First Interaction
149
-
150
- ```
151
- > help me create a React component
152
- > find all files containing "useEffect"
153
- > run npm test in the background
154
- > /tasks to see active tasks
155
- > /model to switch LLM model
156
- ```
157
-
158
26
  ---
159
27
 
160
- ## Configuration
161
-
162
- ### Runtime Settings (`~/.bluma/settings.json`)
163
-
164
- ```json
165
- {
166
- "model": "auto",
167
- "reasoningEffort": "medium",
168
- "outputStyle": "concise",
169
- "sandboxMode": "confirm",
170
- "alwaysAcceptTools": ["read_file_lines", "grep_search"],
171
- "theme": "default"
172
- }
173
- ```
174
-
175
- | Setting | Values | Description |
176
- |---------|--------|-------------|
177
- | `model` | `auto` | LLM model (FactorRouter decides) |
178
- | `reasoningEffort` | `low`, `medium`, `high` | Reasoning depth |
179
- | `outputStyle` | `concise`, `balanced`, `verbose` | Response style |
180
- | `sandboxMode` | `confirm`, `auto`, `strict` | Tool execution policy |
181
-
182
- ### Directory Structure
183
-
184
- ```
185
- ~/.bluma/
186
- ├── settings.json # Runtime configuration
187
- ├── coding_memory.json # Persistent coding notes
188
- ├── artifacts/ # Saved plans and documents
189
- ├── plugins/ # Global plugins
190
- └── sessions/ # Session history
191
- ```
28
+ ## ✨ Key Features
29
+
30
+ ### 🤖 **50+ Native Tools**
31
+ Comprehensive toolset for file operations, code analysis, web search, and more:
32
+ - **Filesystem**: `edit_tool`, `file_write`, `read_file_lines`, `ls_tool`, `find_by_name`, `grep_search`
33
+ - **Execution**: `shell_command`, `repl`, `command_status`, `kill_command`
34
+ - **Communication**: `ask_user_question`, `send_message`, `brief`, `signal_mailbox`
35
+ - **Planning**: `todo`, `task_boundary`, `task_create`, `task_update`, `enter_plan_mode`
36
+ - **Knowledge**: `search_web`, `web_fetch`, `coding_memory`, `ctx_inspect`
37
+ - **Agent Coordination**: `spawn_agent`, `wait_agent`, `list_agents`, `kill_agent`
38
+ - **Specialized**: `context_collapse`, `dream_engine`, `snip`, `lsp_query`, `notebook_edit`
39
+
40
+ ### 🧠 **Multi-Agent Orchestration**
41
+ - **Coordinator Mode**: Product Owner + Engineering Manager hybrid that delegates to specialist workers
42
+ - **Parallel Execution**: Launch multiple workers concurrently for research, implementation, and verification
43
+ - **Mailbox IPC**: Bidirectional communication between coordinator and workers
44
+ - **Worker Types**: Researchers, implementers, verifiers with specialized roles
45
+
46
+ ### 📝 **50+ Slash Commands**
47
+ Quick access to common operations:
48
+ - **Session**: `/undo`, `/redo`, `/diff`, `/clear`, `/sessions`, `/attach`, `/bridge`, `/logs`, `/resume`, `/kill`
49
+ - **Inspect**: `/explain`, `/fix`, `/editor`, `/config`, `/bug`, `/optimize`, `/refactor`, `/document`, `/search`, `/context`, `/token`, `/settings`, `/history`, `/alias`, `/macro`, `/template`, `/share`, `/copy`
50
+ - **Agent**: `/test`, `/chat`, `/code`, `/terminal`, `/file`
51
+ - **Git**: `/pr` (create PRs), `/release` (release engineering)
52
+ - **Input**: `/help`, Ctrl+V for images
53
+
54
+ ### 🎯 **Intelligent Context Management**
55
+ - **Auto Memory**: Persistent coding notes across sessions (`coding_memory`)
56
+ - **Context Collapse**: Advanced history compaction with token budget control
57
+ - **Snip Tool**: Extract and remove old conversation snippets
58
+ - **Dream Engine**: Background memory consolidation and deduplication
59
+ - **Token Tracking**: Real-time token usage monitoring with `ctx_inspect`
60
+
61
+ ### 🔧 **Plan Mode**
62
+ Structured problem-solving workflow with 3 phases:
63
+ 1. **PLANNING**: Research and design
64
+ 2. **EXECUTION**: Implementation
65
+ 3. **VERIFICATION**: Testing and validation
66
+
67
+ ### 🛠️ **Skills System**
68
+ Extendable expertise modules with progressive disclosure:
69
+ - **git-commit**: Conventional commits automation
70
+ - **git-pr**: Pull request creation and management
71
+ - **git-release**: Full release engineering workflow
72
+ - **pdf**: PDF generation and manipulation
73
+ - **xlsx**: Spreadsheet processing
74
+ - **skill-creator**: Create custom skills
75
+
76
+ ### 🎨 **Modern UI**
77
+ - Built with **Ink** (React for CLI)
78
+ - **Shimmer effects** for working states
79
+ - **Streamlined transcript** with syntax highlighting
80
+ - **Bottom dock** for status and controls
81
+ - **Workers overlay** for multi-agent visualization
82
+ - **Thread management** for multi-thread conversations
83
+
84
+ ### 🔒 **Sandbox Security**
85
+ - **Permission modes**: Local (auto-approve) vs Sandbox (confirmation required)
86
+ - **Policy enforcement**: `rm -rf` protection, sudo blocking, dangerous command detection
87
+ - **FactorAI integration**: Optional sandbox backend for isolated execution
88
+
89
+ ### 📦 **Native Performance**
90
+ - **Rust clipboard**: Cross-platform clipboard support (no wl-paste/xclip dependencies)
91
+ - **Native modules**: High-performance bindings for critical operations
92
+ - **TypeScript**: Full type safety with strict mode
93
+
94
+ ### 🔌 **MCP Support**
95
+ - **Model Context Protocol**: Connect to external MCP servers
96
+ - **Resource listing**: Discover and read MCP resources
97
+ - **SSE transport**: Server-Sent Events for real-time communication
192
98
 
193
99
  ---
194
100
 
195
- ## Architecture
101
+ ## 🏗️ Architecture
196
102
 
197
103
  ```
198
104
  ┌─────────────────────────────────────────────────────────────┐
199
- UI Layer
200
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
201
- │ │ App │ │ Input │ │ Slash │ │ ToolResult
202
- │ │ (Ink) │ Prompt │ │ Commands │ │ Display │ │
203
- │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────┬───────┘ │
204
- └───────┼────────────┼────────────┼──────────────┼───────────┘
205
- │ │ │ │
206
- └────────────┴────────────┴──────────────┘
207
-
208
- ┌────────────────────────┼────────────────────────────────────┐
209
- Agent Layer
210
- │ ┌──────────────┐ ┌──────────┐ ┌──────────────────────┐ │
211
- │ │ Agent │ │ BluMa │ │ RouteManager │ │
212
- │ │ Orchestrator│ │ Core │ │ (FactorRouter) │ │
213
- │ └──────┬───────┘ └────┬─────┘ └──────────┬───────────┘ │
214
- │ │ │ │ │
215
- │ ┌──────┴───────┐ ┌────┴────┐ ┌───────────┴──────────┐ │
216
- │ │ ToolInvoker │ │ LLM │ │ PromptBuilder │ │
217
- │ │ │ │ Client │ │ + ContextManager │ │
218
- │ └──────────────┘ └─────────┘ └──────────────────────┘ │
219
- └─────────────────────────────────────────────────────────────┘
220
-
221
- ┌────────────────────────┼────────────────────────────────────┐
222
- │ Runtime Layer │
223
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
224
- │ │TaskStore │ │HookReg. │ │PluginReg.│ │SessionReg. │ │
225
- │ │ │ │ │ │ │ │ │ │
226
- │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
227
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
228
- │ │Sandbox │ │ToolExec │ │Diagnostics│ │SessionView │ │
229
- │ │Policy │ │Policy │ │ │ │ │ │
230
- │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
231
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
232
- │ │Feature │ │Plan Mode │ │Tool Auto │ │Tool Permission│ │
233
- │ │Flags │ │Session │ │Approve │ │Classifier │ │
234
- │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
235
- └─────────────────────────────────────────────────────────────┘
236
-
237
- ┌────────────────────────┼────────────────────────────────────┐
238
- │ Tools Layer │
239
- │ ┌──────────────────────────────────────────────────────┐ │
240
- │ │ Native Tools (45+) │ │
241
- │ │ edit_tool, file_write, shell_command, grep_search, │ │
242
- │ │ spawn_agent, wait_agent, list_agents, │ │
243
- │ │ todo, task_boundary, task_create, task_list, │ │
244
- │ │ task_get, task_update, task_stop, │ │
245
- │ │ coding_memory, search_web, web_fetch, load_skill, │ │
246
- │ │ message, ask_user_question, │ │
247
- │ │ list_mcp_resources, read_mcp_resource, │ │
248
- │ │ cron_create, cron_list, cron_delete, │ │
249
- │ │ lsp_query, notebook_edit, │ │
250
- │ │ enter_plan_mode, exit_plan_mode, ... │ │
251
- │ └──────────────────────────────────────────────────────┘ │
252
- │ ┌──────────────────────────────────────────────────────┐ │
253
- │ │ MCP SDK Integration │ │
254
- │ │ External tool servers via MCP │ │
255
- │ └──────────────────────────────────────────────────────┘ │
105
+ BluMa CLI (Ink UI)
106
+ ├─────────────────────────────────────────────────────────────┤
107
+ BlumaShell BlumaViewport BlumaTranscript
108
+ BlumaBottomDock BlumaWorkersOverlay
109
+ ├─────────────────────────────────────────────────────────────┤
110
+ │ useBlumaSessionRuntime (Hook) │
111
+ ├─────────────────────────────────────────────────────────────┤
112
+ │ Message Queue │ Agent Core │ Tool Invoker │
113
+ │ Session Manager │ Prompt Builder
114
+ ├─────────────────────────────────────────────────────────────┤
115
+ Native Tools (50+) Skills │ MCP Clients │
256
116
  └─────────────────────────────────────────────────────────────┘
257
117
  ```
258
118
 
259
- ---
119
+ ### Core Components
260
120
 
261
- ## Native Tools
262
-
263
- BluMa includes **45+ built-in tools** organized by category:
264
-
265
- ### File Operations
266
- | Tool | Description |
267
- |------|-------------|
268
- | `edit_tool` | Replace text in files (precise, multi-line, batch edits) |
269
- | `file_write` | Create/overwrite entire files |
270
- | `read_file_lines` | Read specific line ranges (up to 2000 lines) |
271
- | `count_file_lines` | Get file line count |
272
- | `ls_tool` | List directories with filtering and pagination |
273
- | `find_by_name` | Glob-based file search |
274
- | `grep_search` | Text/regex search across files |
275
- | `view_file_outline` | Show code structure (classes, functions, interfaces) |
276
- | `notebook_edit` | Edit Jupyter `.ipynb` files (cells operations) |
277
-
278
- ### Shell & Commands
279
- | Tool | Description |
280
- |------|-------------|
281
- | `shell_command` | Execute background commands |
282
- | `command_status` | Check command progress/output |
283
- | `send_command_input` | Send input to running commands' stdin |
284
- | `kill_command` | Terminate running commands |
285
-
286
- ### Agent Coordination (v0.1.60+)
287
- | Tool | Description |
288
- |------|-------------|
289
- | `spawn_agent` | Create background worker agents |
290
- | `wait_agent` | Wait for agent completion |
291
- | `list_agents` | List active/completed agents |
292
- | `send_message` | Send follow-up to running worker (continue without re-spawn) |
293
- | `list_mailbox_messages` | Read messages from workers (progress, permission requests) |
294
- | `signal_mailbox` | Send ack/nack/progress signals to workers |
295
- | `poll_mailbox` | Poll mailbox for new messages (legacy polling mode) |
296
-
297
- ### Task & Project Management
298
- | Tool | Description |
299
- |------|-------------|
300
- | `todo` | Manage task lists |
301
- | `task_boundary` | Track task phases (PLANNING/EXECUTION/VERIFICATION) |
302
- | `task_create` | Create session-scoped tasks |
303
- | `task_list` | List all session tasks |
304
- | `task_get` | Get one task by id |
305
- | `task_update` | Update task fields |
306
- | `task_stop` | Cancel a task |
307
- | `create_artifact` | Save documents under `<workspace>/.bluma/artifacts/<session>/` (see `task_boundary` → `artifacts_dir`) |
308
- | `read_artifact` | Read artifacts from the current session directory under `.bluma/artifacts/` |
309
-
310
- ### Knowledge & Research
311
- | Tool | Description |
312
- |------|-------------|
313
- | `search_web` | Search programming solutions (Reddit, GitHub, StackOverflow) |
314
- | `web_fetch` | Fetch and analyze remote URLs |
315
- | `load_skill` | Activate domain-specific skills |
316
- | `coding_memory` | CRUD for persistent coding notes |
317
-
318
- ### Communication & Interaction
319
- | Tool | Description |
320
- |------|-------------|
321
- | `message` | Post user-visible chat (info/result types) |
322
- | `ask_user_question` | Ask multiple-choice questions in terminal |
323
-
324
- ### MCP & Resources
325
- | Tool | Description |
326
- |------|-------------|
327
- | `list_mcp_resources` | List resources from MCP servers |
328
- | `read_mcp_resource` | Read a resource URI from MCP server |
329
-
330
- ### Scheduling
331
- | Tool | Description |
332
- |------|-------------|
333
- | `cron_create` | Schedule one-shot or repeating reminders |
334
- | `cron_list` | List scheduled cron jobs |
335
- | `cron_delete` | Cancel scheduled job |
336
-
337
- ### Development Tools
338
- | Tool | Description |
339
- |------|-------------|
340
- | `lsp_query` | LSP go-to-definition or references (TS/JS) |
341
- | `repl` | Interactive code execution (Python, Node, Bash) |
342
- | `task_output` | Read task output in real-time |
343
-
344
- ### Specialized
345
- | Tool | Description |
346
- |------|-------------|
347
- | `context_collapse` | Collapse context window |
348
- | `dream_engine` | Auto-dream feature (coding memory consolidation) |
349
- | `brief` | Generate project brief |
350
- | `ctx_inspect` | Inspect current context |
351
- | `snip` | Code snippet management |
352
- | `coordinator_tools` | Coordinator mode utilities |
353
- | `create-next-app` | Scaffold Next.js project with shadcn/ui + Tailwind |
354
- | `deploy-app` | Deploy Next.js to Severino hosting |
355
-
356
- ### Plan Mode
357
- | Tool | Description |
358
- |------|-------------|
359
- | `enter_plan_mode` | Enter plan-only mode (edits require confirmation) |
360
- | `exit_plan_mode` | Leave plan mode |
121
+ - **`src/main.ts`**: Entry point
122
+ - **`src/app/ui/`**: React/Ink UI components
123
+ - `App.tsx`: Main orchestrator
124
+ - `BlumaSession.tsx`: Session management
125
+ - `components/`: Reusable UI elements
126
+ - **`src/app/agent/`**: AI agent core
127
+ - `core/`: Prompt building, context management
128
+ - `tools/`: Native tool implementations
129
+ - `runtime/`: Session runtime, sandbox policy
130
+ - `session_manager/`: Multi-session orchestration
131
+ - **`src/app/hooks/`**: React hooks for state management
132
+ - **`src/app/utils/`**: Utility functions and helpers
361
133
 
362
134
  ---
363
135
 
364
- ## Current Features
365
-
366
- ### Mailbox System (Bidirectional Communication)
367
- **Push-based communication** between coordinator and workers using EventEmitter:
368
-
369
- ```typescript
370
- // Coordinator sends follow-up to running worker
371
- send_message({
372
- to: "worker-session-id",
373
- message: "Fix the null pointer in src/auth/validate.ts:42..."
374
- })
375
-
376
- // Coordinator reads messages from workers
377
- list_mailbox_messages({
378
- from: "worker-session-id",
379
- type: "progress_update",
380
- unreadOnly: true
381
- })
382
-
383
- // Workers send progress/permission requests
384
- signal_mailbox({
385
- sessionId: "coordinator-session-id",
386
- type: "progress",
387
- data: { percent: 50 }
388
- })
389
- ```
390
-
391
- **Key Benefits:**
392
- - **No polling needed** - EventEmitter pushes messages instantly
393
- - **Permission requests** - Workers can request permissions mid-execution
394
- - **Progress tracking** - Real-time progress updates
395
- - **Follow-up commands** - Continue workers without re-spawn
396
-
397
- ### Permission System
398
- **Granular permission rules** with allow/deny patterns:
399
-
400
- ```typescript
401
- // Check permission for tool invocation
402
- permissionRulesEngine.checkPermission('edit_tool', {
403
- filepath: '/src/auth/validate.ts'
404
- })
405
- // Returns: 'allow' | 'deny' | 'ask'
406
-
407
- // Add custom rule
408
- permissionRulesEngine.addRule({
409
- type: 'allow',
410
- toolPattern: 'read_*',
411
- pathPattern: '**/*.md',
412
- scope: 'global'
413
- })
414
- ```
415
-
416
- **Features:**
417
- - **Tool patterns** - Wildcard matching for tool names
418
- - **Path patterns** - Glob-based file path matching
419
- - **Command patterns** - Shell command pattern matching
420
- - **Scopes** - global, workspace, session-level rules
136
+ ## 📋 Configuration
421
137
 
422
- ### Worker Context Isolation
423
- **AsyncLocalStorage-based context** for in-process workers:
138
+ ### Environment Variables
424
139
 
425
- ```typescript
426
- import { runWithWorkerContext, createWorkerContext } from './worker_context'
140
+ Create a `.env` file in your project root:
427
141
 
428
- const ctx = createWorkerContext({
429
- workerType: 'research',
430
- name: 'auth-investigation'
431
- })
142
+ ```bash
143
+ # Required for AI features
144
+ FACTOR_ROUTER_KEY=your_key
145
+ FACTOR_ROUTER_URL=https://api.factorai.sh
432
146
 
433
- await runWithWorkerContext(ctx, async () => {
434
- // Worker code runs with isolated context
435
- // Shares LLM/MCP clients but has unique context
436
- })
437
- ```
147
+ # Optional: MCP Server
148
+ MCP_SSE_URL=http://localhost:3000/sse
438
149
 
439
- ### REPL Tool
440
- **Interactive code execution** for rapid prototyping:
441
-
442
- ```typescript
443
- repl({
444
- language: 'python',
445
- code: `
446
- import pandas as pd
447
- df = pd.DataFrame({'a': [1, 2, 3]})
448
- print(df.sum())
449
- `,
450
- timeout: 30000
451
- })
150
+ # Optional: FactorAI Sandbox
151
+ FACTORAI_BASE_URL=http://localhost:8080
152
+ FACTORAI_API_KEY=your-sandbox-key
452
153
  ```
453
154
 
454
- **Supported languages:** Python, Node.js, Bash
455
-
456
- ### Context Auto-Compact
457
- **Automatic context compression** with history anchoring:
458
-
459
- - **Budget:** 240k tokens
460
- - **Trigger:** 70% of budget (168k tokens)
461
- - **Strategy:** Compress old turns, keep last 10 turns complete
462
- - **Anchor:** System message with compressed summary
463
-
464
- ```typescript
465
- const { messages, newAnchor } = await createApiContextWindow(
466
- fullHistory,
467
- currentAnchor,
468
- compressedTurnSliceCount,
469
- llmService,
470
- userContext
471
- )
472
- ```
155
+ ### Runtime Modes
473
156
 
474
- ### Session Memory Extractor
475
- **Automatic memory extraction** from conversations:
157
+ BluMa supports different permission modes:
476
158
 
477
- ```typescript
478
- const memories = await memoryExtractor.extractMemoriesFromSession(messages)
479
- // Returns: ExtractedMemory[] with type, content, confidence, tags
159
+ - **Local Mode**: Auto-approve safe operations
160
+ - **Sandbox Mode**: Require confirmation for write/execute operations
480
161
 
481
- // Get relevant memories for query
482
- const relevant = await memoryExtractor.getRelevantMemories('authentication')
162
+ Set via environment or runtime config:
163
+ ```bash
164
+ BLUMA_PERMISSION_MODE=sandbox
483
165
  ```
484
166
 
485
- **Memory types:** codebase_knowledge, preference, decision, pattern, bugfix, architecture
486
-
487
- ### Vim Mode
488
- **Vim-like keybindings** in input prompt:
167
+ ---
489
168
 
490
- - **Modes:** normal, insert, visual, command
491
- - **Motions:** h/j/k/l, w/b, 0/$, g/G
492
- - **Operators:** d (delete), c (change), y (yank)
493
- - **Commands:** `:w`, `:q`, etc.
169
+ ## 🛠️ Development
494
170
 
495
- ```typescript
496
- // Enable vim mode
497
- /vim toggle
498
- ```
171
+ ### Prerequisites
499
172
 
500
- ### Themes System
501
- **6 configurable UI themes:**
173
+ - Node.js >= 20
174
+ - npm >= 9
175
+ - Rust (for native clipboard module, optional)
502
176
 
503
- | Theme | Description |
504
- |-------|-------------|
505
- | `default` | Classic dark terminal |
506
- | `dracula` | Purple accents |
507
- | `github` | GitHub Dark mode |
508
- | `monokai` | Vibrant green accents |
509
- | `nord` | Arctic blue palette |
510
- | `tokyo` | Tokyo Night blue-purple |
177
+ ### Setup
511
178
 
512
179
  ```bash
513
- /theme dracula
514
- ```
180
+ # Clone the repository
181
+ git clone https://github.com/Nomad-e/bluma-cli.git
182
+ cd bluma-cli
515
183
 
516
- ### Init Subagent
517
- **Automatic BluMa.md generation:**
184
+ # Install dependencies
185
+ npm install
518
186
 
519
- ```bash
520
- /init
521
- ```
187
+ # Build the project
188
+ npm run build
189
+
190
+ # Or build with native modules
191
+ npm run build:all
522
192
 
523
- Scans repository and generates comprehensive codebase documentation including:
524
- - Project overview
525
- - Technology stack detection
526
- - Directory structure with annotations
527
- - Key configs and scripts
528
- - CLI commands
529
- - Operational notes
530
-
531
- ### Coding Memory Consolidate
532
- **Deduplication of coding memories:**
533
-
534
- ```typescript
535
- consolidateCodingMemoryFile()
536
- // Merges duplicate entries by normalized text
537
- // Keeps oldest ID, merges tags
538
- // Creates backup .bak file
193
+ # Start BluMa
194
+ npm start
539
195
  ```
540
196
 
541
- ---
197
+ ### Scripts
542
198
 
543
- ## Skills System
199
+ | Script | Description |
200
+ |--------|-------------|
201
+ | `npm run build` | TypeScript check + bundle |
202
+ | `npm run build:native` | Build Rust native modules |
203
+ | `npm run build:all` | Build native + TypeScript |
204
+ | `npm start` | Build + run BluMa |
205
+ | `npm test` | Run Jest tests |
206
+ | `npm run test:watch` | Watch mode for tests |
207
+ | `npm run test:parallel` | Parallel test execution |
208
+ | `npm run lint` | ESLint check |
209
+ | `npm run lint:fix` | Auto-fix lint errors |
544
210
 
545
- Skills are **self-contained knowledge modules** that extend BluMa with domain expertise. They use **Progressive Disclosure** to manage context efficiently.
211
+ ### Testing
546
212
 
547
- ### Skill Sources (Priority Order)
213
+ ```bash
214
+ # Run all tests
215
+ npm test
548
216
 
549
- | Priority | Source | Path |
550
- |----------|--------|------|
551
- | 1 | **Bundled** | `dist/config/skills/` |
552
- | 2 | **Project** | `{cwd}/.bluma/skills/` |
553
- | 3 | **Global** | `~/.bluma/skills/` |
217
+ # Run specific test file
218
+ npm test -- tests/tool_invocation.spec.ts
554
219
 
555
- ### Progressive Disclosure Levels
220
+ # Watch mode
221
+ npm run test:watch
556
222
 
557
- ```
558
- Level 1: description (frontmatter)
559
- Always visible. Cost: ~1 line per skill.
560
- Purpose: Let agent DECIDE to activate.
561
-
562
- ↓ agent calls load_skill(name)
563
-
564
- Level 2: SKILL.md body
565
- Injected when activated. Cost: 50-300 lines.
566
- Purpose: Core instructions and quick-start.
567
-
568
- ↓ agent reads reference or runs script (if needed)
569
-
570
- Level 3a: references/*.md
571
- Read on-demand. Cost: only when read.
572
- Purpose: Advanced documentation.
573
-
574
- Level 3b: scripts/*.py
575
- Executed on-demand. Cost: zero context.
576
- Purpose: Pre-built utilities.
223
+ # Parallel tests (faster)
224
+ npm run test:parallel:fast
577
225
  ```
578
226
 
579
- ### Available Skills
227
+ ### Contributing
580
228
 
581
- | Skill | Description |
582
- |-------|-------------|
583
- | `git-commit` | Conventional commits, staging, commit messages |
584
- | `git-pr` | Pull requests, code review preparation |
585
- | `git-release` | Version bumps, changelogs, git tags, GitHub releases |
586
- | `pdf` | PDF creation, extraction, merging, OCR |
587
- | `xlsx` | Spreadsheet operations, formulas, charts |
588
- | `skill-creator` | Author new BluMa skills |
229
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
589
230
 
590
- ### Loading Skills
591
-
592
- ```typescript
593
- // Via command
594
- > load the git-commit skill
231
+ ---
595
232
 
596
- // Via tool call
597
- load_skill({ skill_name: "git-commit" })
598
- ```
233
+ ## 📚 Documentation
599
234
 
600
- Skills inject domain knowledge and best practices into the agent's context. Each skill has:
601
- - **Frontmatter**: Description and dependencies (always visible)
602
- - **Body**: Core instructions (injected on activation)
603
- - **References**: Advanced docs (read on-demand)
604
- - **Scripts**: Executable utilities (zero context cost)
235
+ - **[Developer Guide](docs/BLUMA_DEVELOPER_GUIDE.md)**: Complete technical reference
236
+ - **[Skills Guide](docs/SKILLS.md)**: How to create and use skills
237
+ - **[Mailbox IPC](docs/MAILBOX_IPC.md)**: Multi-agent communication
238
+ - **[Plan Mode](docs/plan-mode/)**: Structured problem-solving workflow
239
+ - **[CI/CD](docs/CI-TEST.md)**: Continuous integration setup
605
240
 
606
241
  ---
607
242
 
608
- ## Runtime & Orchestration
609
-
610
- ### Task Store
243
+ ## 🎯 Use Cases
611
244
 
612
- Track work with PLANNING EXECUTION → VERIFICATION phases:
245
+ ### 1. **Code Analysis & Refactoring**
246
+ ```bash
247
+ # Ask BluMa to analyze your codebase
248
+ bluma
613
249
 
614
- ```typescript
615
- task_boundary({
616
- task_name: "Implementing Authentication",
617
- mode: "PLANNING",
618
- task_status: "Creating middleware structure"
619
- });
250
+ # Then use slash commands
251
+ /explain src/app/agent/core/prompt_builder.ts
252
+ /refactor src/utils/helpers.ts
253
+ /fix src/components/Button.tsx
620
254
  ```
621
255
 
622
- ### Hook Registry
623
-
624
- Event-driven lifecycle tracking:
256
+ ### 2. **Multi-Agent Development**
257
+ ```bash
258
+ # Coordinator mode: delegate to workers
259
+ "Build a new feature with research, implementation, and verification"
625
260
 
626
- ```typescript
627
- // Hooks fire on: tool_calls, decisions, state_changes
628
- registerHook('tool_calls', (event) => {
629
- console.log(`Tool ${event.toolName} executed`);
630
- });
261
+ # BluMa automatically spawns:
262
+ # - Researcher: Investigate codebase structure
263
+ # - Implementer: Write the code
264
+ # - Verifier: Run tests and validate
631
265
  ```
632
266
 
633
- ### Plugin Registry
634
-
635
- Load plugins from `.bluma/plugins/`:
636
-
267
+ ### 3. **Release Engineering**
637
268
  ```bash
638
- > /plugins list # Show loaded plugins
639
- > /plugins load my-plugin # Load a plugin
269
+ /release patch # Auto-detect version bump
270
+ /release minor --dry-run # Preview release
640
271
  ```
641
272
 
642
- ### Session Registry
643
-
644
- Multi-session support with health monitoring:
645
-
273
+ ### 4. **Pull Request Creation**
646
274
  ```bash
647
- > /sessions list # List all sessions
648
- > /sessions logs <id> # Stream session logs
649
- > /sessions kill <id> # Terminate session
275
+ /pr dev to main # Create PR from dev to main
276
+ /pr feature/auth to develop --draft # Draft PR
650
277
  ```
651
278
 
652
- ### Diagnostics
653
-
654
- Real-time system snapshot:
655
-
279
+ ### 5. **Context Management**
656
280
  ```bash
657
- > /diagnostics # Full system status
658
- > /diagnostics tasks # Task overview
659
- > /diagnostics hooks # Hook registry status
660
- > /diagnostics plugins # Plugin registry status
661
- > /diagnostics sessions # Active sessions
281
+ /context # Inspect current context
282
+ /token # View token usage
283
+ /summarize # Summarize conversation
662
284
  ```
663
285
 
664
- ### Runtime Files
665
-
666
- | File | Purpose |
667
- |------|---------|
668
- | `~/.bluma/task_state.json` | Persistent task tracking |
669
- | `~/.bluma/hooks.json` | Hook registry state |
670
- | `~/.bluma/sessions/` | Session history and logs |
671
- | `~/.bluma/plugins/` | Global plugin storage |
286
+ ---
672
287
 
673
- ### Tool Execution Policy
288
+ ## 🔧 Tool Categories
674
289
 
675
- BluMa uses intelligent tool execution based on sandbox mode:
290
+ ### Filesystem Tools (12)
291
+ `edit_tool`, `file_write`, `read_file_lines`, `ls_tool`, `find_by_name`, `grep_search`, `view_file_outline`, `count_file_lines`, `file_write`, `snip`, `ctx_inspect`, `workspace_snapshot`
676
292
 
677
- | Sandbox Mode | Behavior |
678
- |--------------|----------|
679
- | `confirm` | Prompt for dangerous tools (shell, edit, write) |
680
- | `auto` | Auto-approve safe tools, confirm risky ones |
681
- | `strict` | Require confirmation for all tools |
293
+ ### Execution Tools (6)
294
+ `shell_command`, `command_status`, `send_command_input`, `kill_command`, `repl`, `task_output`
682
295
 
683
- Safe tools (always auto-approved): `read_file_lines`, `grep_search`, `ls_tool`, `find_by_name`, `count_file_lines`, `view_file_outline`
296
+ ### Communication Tools (5)
297
+ `ask_user_question`, `send_message`, `list_mailbox_messages`, `signal_mailbox`, `brief`
684
298
 
685
- ---
299
+ ### Planning Tools (8)
300
+ `todo`, `task_boundary`, `task_create`, `task_update`, `task_stop`, `task_list`, `enter_plan_mode`, `exit_plan_mode`
686
301
 
687
- ## Slash Commands
688
-
689
- Built-in terminal commands (type `/` to see all):
690
-
691
- ### Session & UI
692
- | Command | Description |
693
- |---------|-------------|
694
- | `/clear` | Clear chat below welcome panel |
695
- | `/sessions` | Show registered sessions (current + historical) |
696
- | `/attach <id>` | Live-follow a session log stream |
697
- | `/follow <id>` | Alias of /attach for live session follow |
698
- | `/bridge` | Show session bridge state and follow instructions |
699
- | `/status <id>` | Show session status for a session id |
700
- | `/logs <id>` | Show recent logs for a session id |
701
- | `/resume <id>` | Resume a session from the current CLI |
702
- | `/kill <id>` | Send SIGTERM to a session by id |
703
- | `/tasks [list\|add\|complete\|update\|remove\|clear]` | Manage task list |
704
- | `/plan [show\|start\|end]` | Manage the active task boundary |
705
- | `/compact` | Manually compact conversation context |
706
- | `/export` | Export conversation as markdown |
707
-
708
- ### Agent
709
- | Command | Description |
710
- |---------|-------------|
711
- | `/img ./shot.png [question]` | Send local image(s) to the model |
712
- | `/image` | Alias of /img |
713
- | `/init` | Run init subagent — BluMa.md codebase documentation |
714
- | `/agent [default\|coordinator]` | Set prompt profile (coordinator playbook for worker orchestration) |
715
- | `/agents` | List worker/agent sessions (spawn_agent children) |
716
-
717
- ### Inspect
718
- | Command | Description |
719
- |---------|-------------|
720
- | `/plugins` | List installed plugins and plugin paths |
721
- | `/plugin <name>` | Inspect one plugin |
722
- | `/diagnostics` | Show a consolidated health snapshot |
723
- | `/permissions` | Inspect sandbox and tool rules; set mode |
724
- | `/hooks` | Inspect, enable, disable, or clear lifecycle hooks |
725
- | `/model [list\|name\|auto]` | Show, list, or set the active model |
726
- | `/effort [low\|medium\|high]` | Show or set reasoning effort |
727
- | `/style [default\|compact\|brief]` | Show or set output style |
728
- | `/sandbox [on\|off]` | Show or toggle sandbox mode |
729
- | `/worktree [path]` | Show or set workspace root |
730
- | `/statusline` | Show the current session statusline summary |
731
- | `/skills` | List load_skill modules, dirs, and conflicts |
732
- | `/tools [grep]` | List native tools (optional filter) |
733
- | `/mcp [fs]` | List MCP tools (optional filter) |
734
- | `/features` | Feature flags: `/features` or `/features <key> on\|off` |
735
- | `/debug-workers` | Show running workers, PIDs, memory, and event bus state |
736
- | `/cost` | Show session cost and token usage |
737
- | `/memory` | Manage session memories |
738
- | `/stats` | Detailed session statistics |
739
- | `/theme` | Change UI theme |
740
- | `/keybindings` | Show or configure keybindings |
741
- | `/vim` | Toggle vim mode |
742
-
743
- ### Help
744
- | Command | Description |
745
- |---------|-------------|
746
- | `/help` | List all slash commands (grouped) |
747
-
748
- ### Input (Keyboard Shortcuts)
749
- | Shortcut | Description |
750
- |----------|-------------|
751
- | `Ctrl+V / Cmd+V` | Paste from clipboard: image → cache `~/.cache/bluma/clipboard`; text; or file path as image |
752
- | `Ctrl+Shift+I` | Same as Ctrl+V (paste image, text, or file path) |
302
+ ### Knowledge Tools (6)
303
+ `search_web`, `web_fetch`, `coding_memory`, `ctx_inspect`, `dream_engine`, `load_skill`
753
304
 
754
- ---
305
+ ### Agent Coordination Tools (6)
306
+ `spawn_agent`, `wait_agent`, `list_agents`, `kill_agent`, `send_message`, `list_mailbox_messages`
755
307
 
756
- ## Development
308
+ ### Specialized Tools (7)
309
+ `context_collapse`, `snip`, `brief`, `lsp_query`, `notebook_edit`, `createNextApp`, `deployApp`
757
310
 
758
- ### Build
311
+ ### MCP Tools (2)
312
+ `list_mcp_resources`, `read_mcp_resource`
759
313
 
760
- ```bash
761
- npm run build # Production build
762
- npm start # Build + run
763
- ```
764
-
765
- ### Lint
314
+ ### Session Tools (3)
315
+ `cronCreate`, `cronList`, `cronDelete`
766
316
 
767
- ```bash
768
- npm run lint # Check code style
769
- npm run lint:fix # Auto-fix issues
770
- ```
317
+ ---
771
318
 
772
- ### Project Structure
319
+ ## 🎨 UI Components
773
320
 
774
- ```
775
- src/
776
- ├── app/
777
- │ ├── agent/
778
- │ │ ├── agent.ts # Main orchestrator
779
- │ │ ├── bluma/ # Core agent logic
780
- │ │ │ ├── core/
781
- │ │ │ │ ├── bluma.ts # BluMaAgent class
782
- │ │ │ │ └── turn_start_payload.ts
783
- │ │ │ ├── context/
784
- │ │ │ │ └── auto_compact.ts # Automatic context compaction
785
- │ │ │ ├── memory/
786
- │ │ │ │ └── session_memory.ts # Session memory
787
- │ │ │ └── types/
788
- │ │ │ └── errors.ts # Error type definitions
789
- │ │ ├── config/
790
- │ │ │ ├── native_tools.json # Tool definitions (45+)
791
- │ │ │ ├── skills/ # Bundled skills
792
- │ │ │ │ ├── git-commit/
793
- │ │ │ │ ├── git-pr/
794
- │ │ │ │ ├── git-release/ # Version bumps, changelogs, releases
795
- │ │ │ │ ├── pdf/
796
- │ │ │ │ ├── skill-creator/
797
- │ │ │ │ └── xlsx/
798
- │ │ │ │ └── scripts/
799
- │ │ │ │ └── office/ # Office document handling
800
- │ │ │ │ ├── pack.py
801
- │ │ │ │ ├── unpack.py
802
- │ │ │ │ ├── validate.py
803
- │ │ │ │ └── soffice.py
804
- │ │ ├── core/ # LLM, context, prompts
805
- │ │ │ ├── context-api/ # Context management
806
- │ │ │ │ ├── context_manager.ts # Token-aware context
807
- │ │ │ │ ├── history_anchor.ts # Conversation anchoring
808
- │ │ │ │ └── token_counter.ts # Tiktoken integration
809
- │ │ │ ├── llm/ # LLM client
810
- │ │ │ │ ├── llm.ts # FactorRouter client
811
- │ │ │ │ ├── llm_errors.ts # LLM error formatting
812
- │ │ │ │ ├── streaming_delta.ts # Streaming delta handling
813
- │ │ │ │ └── tool_call_normalizer.ts
814
- │ │ │ ├── prompt/ # Prompt engineering
815
- │ │ │ │ ├── prompt_builder.ts # Dynamic prompts
816
- │ │ │ │ ├── workspace_snapshot.ts
817
- │ │ │ │ ├── mcp_instructions.ts
818
- │ │ │ │ ├── model_info.ts
819
- │ │ │ │ ├── production_sandbox_prompt.ts
820
- │ │ │ │ ├── system_prompt_sections.ts
821
- │ │ │ │ ├── system_reminders.ts
822
- │ │ │ │ └── tool_guidance.ts
823
- │ │ │ └── context_viz.ts # Context visualization
824
- │ │ ├── docs/
825
- │ │ │ └── TOOL_PARITY.md # Tool parity documentation
826
- │ │ ├── feedback/
827
- │ │ │ └── feedback_system.ts # Smart feedback system
828
- │ │ │ └── feedback_scoring.ts # User feedback scoring
829
- │ │ ├── runtime/ # Orchestration layer (v0.1.41+)
830
- │ │ │ ├── diagnostics.ts # System snapshots
831
- │ │ │ ├── feature_flags.ts # Feature gates
832
- │ │ │ ├── hook_registry.ts # Event-driven hooks
833
- │ │ │ ├── native_tool_catalog.ts # Tool registry
834
- │ │ │ ├── permission_bridge.ts # Leader↔Worker permission system
835
- │ │ │ ├── permission_rules.ts # Permission rule definitions
836
- │ │ │ ├── tool_permission_classifier.ts
837
- │ │ │ ├── plan_mode_session.ts # Plan mode state
838
- │ │ │ ├── plugin_registry.ts # Plugin system
839
- │ │ │ ├── plugin_runtime.ts # Plugin execution
840
- │ │ │ ├── runtime_config.ts # Runtime settings
841
- │ │ │ ├── sandbox_policy.ts # Safety policies
842
- │ │ │ ├── session_registry.ts # Multi-session mgmt
843
- │ │ │ ├── session_view.ts # Session monitoring
844
- │ │ │ ├── task_store.ts # Task lifecycle
845
- │ │ │ ├── tool_auto_approve.ts # Auto-approve rules
846
- │ │ │ ├── tool_execution_policy.ts
847
- │ │ │ ├── tool_orchestration.ts # Parallel read eligibility
848
- │ │ │ ├── mailbox_registry.ts # Mailbox system
849
- │ │ │ ├── worker_context.ts # Worker context management
850
- │ │ │ └── factorai_context.ts # FactorAI app context
851
- │ │ ├── session_manager/
852
- │ │ │ └── session_manager.ts # Session persistence
853
- │ │ ├── skills/
854
- │ │ │ └── skill_loader.ts # 3-source skill loading
855
- │ │ ├── subagents/ # Subagent system
856
- │ │ │ ├── base_llm_subagent.ts
857
- │ │ │ ├── init/ # Init subagent (BluMa.md)
858
- │ │ │ │ ├── init_subagent.ts # Deep project analysis
859
- │ │ │ │ ├── init_system_prompt.ts
860
- │ │ │ │ └── contracts.ts
861
- │ │ │ ├── registry.ts
862
- │ │ │ ├── subagents_bluma.ts # SubAgent orchestration
863
- │ │ │ ├── types.ts # SubAgent type definitions
864
- │ │ │ └── worker_system_prompt.ts
865
- │ │ ├── tools/
866
- │ │ │ ├── mcp/
867
- │ │ │ │ └── mcp_client.ts # MCP SDK client
868
- │ │ │ ├── shared/
869
- │ │ │ │ └── token_utils.ts # Token utilities
870
- │ │ │ └── natives/ # 45+ native tool implementations
871
- │ │ │ ├── agent_coordination.ts
872
- │ │ │ ├── ask_user_question.ts
873
- │ │ │ ├── async_command.ts
874
- │ │ │ ├── coding_memory.ts
875
- │ │ │ ├── coding_memory_consolidate.ts
876
- │ │ │ ├── coordinator_tools.ts
877
- │ │ │ ├── count_lines.ts
878
- │ │ │ ├── edit.ts
879
- │ │ │ ├── file_write.ts
880
- │ │ │ ├── find_by_name.ts
881
- │ │ │ ├── grep_search.ts
882
- │ │ │ ├── load_skill.ts
883
- │ │ │ ├── ls.ts
884
- │ │ │ ├── lsp_query.ts
885
- │ │ │ ├── mcp_resources.ts
886
- │ │ │ ├── message.ts
887
- │ │ │ ├── notebook_edit.ts
888
- │ │ │ ├── plan_mode_tools.ts
889
- │ │ │ ├── readLines.ts
890
- │ │ │ ├── search_web.ts
891
- │ │ │ ├── session_cron.ts
892
- │ │ │ ├── shell_command.ts
893
- │ │ │ ├── task_boundary.ts
894
- │ │ │ ├── task_tools.ts
895
- │ │ │ ├── todo.ts
896
- │ │ │ ├── view_file_outline.ts
897
- │ │ │ └── web_fetch.ts
898
- │ │ ├── types/
899
- │ │ │ └── index.ts
900
- │ │ └── utils/
901
- │ │ ├── blumamd.ts # BluMa markdown utilities
902
- │ │ ├── coordinator_prompt.ts # Coordinator mode playbook
903
- │ │ ├── logger.ts # Logging utilities
904
- │ │ ├── update_check.ts
905
- │ │ └── user_message_images.ts
906
- │ └── ui/
907
- │ ├── App.tsx # Main UI component
908
- │ ├── Asci/
909
- │ │ └── AsciiArt.ts
910
- │ ├── components/ # 25+ UI components
911
- │ │ ├── AnimatedBorder.tsx
912
- │ │ ├── AskUserQuestionPrompt.tsx
913
- │ │ ├── AssistantMessageDisplay.tsx
914
- │ │ ├── CollapsibleResult.tsx
915
- │ │ ├── ConfirmationPrompt.tsx # Permission confirmation dialog
916
- │ │ ├── EditToolDiffPanel.tsx # Diff preview for edits
917
- │ │ ├── ErrorMessage.tsx
918
- │ │ ├── ExpandedPreviewBlock.tsx
919
- │ │ ├── InputPrompt.tsx # User input
920
- │ │ ├── InteractiveMenu.tsx # Interactive menu component
921
- │ │ ├── MarkdownRenderer.tsx
922
- │ │ ├── ProgressBar.tsx
923
- │ │ ├── ReasoningDisplay.tsx # LLM reasoning
924
- │ │ │ ├── SessionInfoConnectingMCP.tsx
925
- │ │ ├── SessionStats.tsx
926
- │ │ ├── SimpleDiff.tsx
927
- │ │ ├── SlashCommands.tsx # 30+ commands
928
- │ │ ├── StatusNotification.tsx
929
- │ │ ├── StartupUpdateGate.tsx # Update check gate
930
- │ │ ├── StreamingText.tsx # Live text output
931
- │ │ ├── TodoPlanDisplay.tsx # Task visualization
932
- │ │ ├── ToolCallDisplay.tsx
933
- │ │ ├── ToolInvocationBlock.tsx
934
- │ │ ├── ToolResultCard.tsx # Structured results
935
- │ │ ├── ToolResultDisplay.tsx
936
- │ │ ├── TypewriterText.tsx
937
- │ │ ├── UpdateNotice.tsx
938
- │ │ ├── WorkerOverlay.tsx # Worker status overlay
939
- │ │ ├── WorkerStatusList.tsx # Active workers list
940
- │ │ ├── WorkerTranscript.tsx # Worker conversation transcript
941
- │ │ ├── WorkingTimer.tsx # Work duration timer
942
- │ │ ├── streamingTextFlush.ts
943
- │ │ └── toolCallRenderers.tsx
944
- │ ├── constants/
945
- │ │ ├── historyLayout.ts # History layout constants
946
- │ │ ├── inputPaste.ts # Input paste constants
947
- │ │ └── toolUiPreview.ts # Tool UI preview constants
948
- │ │ └── toolUiSymbols.ts # Tool UI symbols
949
- │ ├── hooks/
950
- │ │ ├── useAtCompletion.ts # Completion hook
951
- │ │ └── useWorkerProgress.ts # Worker progress hook
952
- │ ├── prompts/
953
- │ │ └── initCommandPrompt.ts # Init command prompt
954
- │ ├── slash-commands/
955
- │ │ ├── SlashCommands.types.ts # Type definitions
956
- │ │ ├── commandHelpers.tsx # Command helpers
957
- │ │ ├── constants.ts # Slash command constants
958
- │ │ ├── SessionLivePanel.tsx # Session live panel
959
- │ │ ├── streamingTextFlush.ts # Streaming text flush
960
- │ │ └── renderers/
961
- │ │ ├── index.ts
962
- │ │ ├── configRenderers.tsx
963
- │ │ ├── infoRenderers.tsx
964
- │ │ ├── permissionRenderers.tsx
965
- │ │ ├── pluginRenderers.tsx
966
- │ │ ├── sessionRenderers.tsx
967
- │ │ ├── staticRenderers.tsx
968
- │ │ └── taskRenderers.tsx
969
- │ ├── theme/
970
- │ │ ├── blumaTerminal.ts
971
- │ │ ├── themes.ts # Theme definitions
972
- │ │ └── m3Layout.tsx # Material Design 3 layout
973
- │ └── utils/
974
- │ ├── clipboardImage.ts
975
- │ ├── editToolDiffUtils.ts
976
- │ ├── expandPreviewHotkey.ts
977
- │ ├── expandablePreviewStore.ts
978
- │ ├── formatTurnDurationMs.ts
979
- │ ├── inlineImageInputLabels.ts
980
- │ ├── pathDisplay.ts
981
- │ ├── shellToolNames.ts
982
- │ ├── slashRegistry.ts
983
- │ ├── terminalTitle.ts # Terminal title keeper
984
- │ ├── toolActionLabels.ts # Tool action labels
985
- │ ├── toolDisplayLabels.ts # Tool display labels
986
- │ ├── toolInvocationPairing.ts
987
- │ └── useSimpleInputBuffer.ts
988
- ├── main.ts # Entry point
989
- └── types/
990
- └── semver-functions.d.ts
991
- ```
321
+ - **BlumaShell**: Main application shell with header and footer
322
+ - **BlumaViewport**: Scrollable transcript view
323
+ - **BlumaTranscript**: Message rendering with syntax highlighting
324
+ - **BlumaBottomDock**: Status bar and controls
325
+ - **BlumaWorkersOverlay**: Worker status visualization
326
+ - **WorkingShimmerText**: Animated working state indicator
327
+ - **FilePathLink**: Clickable file paths
328
+ - **HighlightedCode**: Syntax-highlighted code blocks
329
+ - **CtrlOToExpand**: Expandable content indicator
992
330
 
993
331
  ---
994
332
 
995
- ## Testing
333
+ ## 🔐 Security
996
334
 
997
- ```bash
998
- npm test # Run all tests
999
- npm run test:watch # Watch mode
1000
- ```
1001
-
1002
- ### Test Structure
1003
-
1004
- ```
1005
- tests/ # 35+ test files (flat structure)
1006
- ├── agent_*.spec.ts # Agent routing, overlays, coordination
1007
- ├── edit_tool.spec.ts # File editing operations
1008
- ├── file_write.spec.ts # File write operations
1009
- ├── sandbox_policy.spec.ts # Tool execution policies
1010
- ├── task_runtime.integration.spec.ts # Task lifecycle
1011
- ├── context_compression.integration.spec.ts # Context management
1012
- ├── hook_registry.spec.ts # Hook system and event tracking
1013
- ├── plugin_registry.spec.ts # Plugin loading and lifecycle
1014
- ├── session_registry.spec.ts # Session management
1015
- ├── session_manager.spec.ts # Session lifecycle
1016
- ├── tool_execution_policy.spec.ts # Safe vs dangerous tool decisions
1017
- ├── diagnostics.spec.ts # System diagnostics
1018
- ├── runtime_config.spec.ts # Runtime configuration
1019
- ├── slash_routing.spec.ts # Slash command routing
1020
- ├── subagents_flow.integration.spec.ts # Subagent coordination
1021
- ├── prompt_builder.spec.ts # Prompt engineering
1022
- ├── token_counter.spec.ts # Token counting
1023
- ├── coding_memory.spec.ts # Persistent memory
1024
- ├── web_fetch.spec.ts # Web fetching
1025
- ├── workspace_snapshot.spec.ts # Workspace analysis
1026
- ├── ui_*.spec.ts(x) # UI component tests
1027
- ├── llm_stream_partial.spec.ts # LLM streaming partial handling
1028
- ├── llm_errors.spec.ts # LLM error handling
1029
- ├── jest-resolver.cjs # Jest resolver configuration
1030
- └── ... # Additional integration and unit tests
1031
- ```
335
+ - **Sandbox Policy**: Blocks dangerous commands (`rm -rf /`, `sudo`, etc.)
336
+ - **Permission Modes**: Configurable auto-approve vs confirmation
337
+ - **Input Validation**: JSON argument validation for tool calls
338
+ - **Error Handling**: User-friendly error messages with hints
339
+ - **Rate Limiting**: Web search and external API rate limiting
1032
340
 
1033
341
  ---
1034
342
 
1035
- ## Contributing
343
+ ## 📦 Package Info
1036
344
 
1037
- See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
345
+ - **Name**: `@nomad-e/bluma-cli`
346
+ - **Version**: `0.2.3`
347
+ - **License**: Apache 2.0
348
+ - **Engine**: Node.js >= 20
349
+ - **Type**: ES Modules
350
+ - **Main**: `dist/main.js`
351
+ - **Bin**: `bluma`
1038
352
 
1039
- ### Quick Contribution Guide
1040
-
1041
- 1. **Fork** the repository
1042
- 2. Create a branch: `feat/add-feature` or `fix/bug-description`
1043
- 3. Make changes following the style guide
1044
- 4. Add/update tests
1045
- 5. Ensure build passes: `npm run build && npm test`
1046
- 6. Open a Pull Request
353
+ ---
1047
354
 
1048
- ### Style Guide
355
+ ## 🤝 Community
1049
356
 
1050
- - Use **English** for code, comments, and commits
1051
- - 2-space indentation
1052
- - TypeScript with modern React patterns
1053
- - Follow existing code structure
357
+ - **Issues**: Report bugs and suggest features on GitHub
358
+ - **Discussions**: Open questions and community discussions
359
+ - **Contributions**: See [CONTRIBUTING.md](CONTRIBUTING.md)
1054
360
 
1055
361
  ---
1056
362
 
1057
- ## License
363
+ ## 📄 License
1058
364
 
1059
365
  Apache 2.0 — see [LICENSE](LICENSE) for details.
1060
366
 
1061
367
  ---
1062
368
 
1063
- ## Support
1064
-
1065
- - **Issues**: [GitHub Issues](https://github.com/nomad-e/bluma-cli/issues)
1066
- - **Documentation**: This README + `docs/` directory
1067
- - **Author & Architect**: Alex Fonseca (conceived and architected BluMa)
1068
- - **npm Package**: [@nomad-e/bluma-cli](https://www.npmjs.com/package/@nomad-e/bluma-cli)
1069
-
1070
- ### Runtime Modules (v0.1.41+)
1071
-
1072
- BluMa's runtime layer provides enterprise-grade orchestration:
1073
-
1074
- | Module | Purpose | Key Features |
1075
- |--------|---------|--------------|
1076
- | `task_store.ts` | Task lifecycle | PLANNING → EXECUTION → VERIFICATION phases, persistence |
1077
- | `hook_registry.ts` | Event system | Tool calls, decisions, state changes |
1078
- | `plugin_registry.ts` | Plugin system | Load from `.bluma/plugins/`, lifecycle management |
1079
- | `session_registry.ts` | Multi-session | Process health monitoring, session isolation |
1080
- | `sandbox_policy.ts` | Safety | Safe vs dangerous tool classification |
1081
- | `tool_execution_policy.ts` | Execution rules | Auto-approve, confirm, block decisions |
1082
- | `diagnostics.ts` | System snapshots | Tasks, hooks, plugins, sessions overview |
1083
- | `session_view.ts` | Session monitoring | Log streaming, status display |
1084
- | `native_tool_catalog.ts` | Tool registry | Discovery and metadata |
1085
- | `runtime_config.ts` | Settings | Runtime configuration management |
1086
- | `feature_flags.ts` | Feature gates | Opt-in features via env or settings |
1087
- | `plan_mode_session.ts` | Plan mode | Forces confirmation for edits/writes |
1088
- | `tool_auto_approve.ts` | Auto-approve | Effective approve rules |
1089
- | `tool_orchestration.ts` | Parallel reads | Eligibility for parallel execution |
1090
- | `tool_permission_classifier` | Tool classification | Classify tool invocations |
1091
- | `plugin_runtime.ts` | Plugin execution | Plugin runtime context |
1092
-
1093
- ### UI Components
1094
-
1095
- Key UI components that power the rich terminal experience:
1096
-
1097
- | Component | Purpose |
1098
- |-----------|---------|
1099
- | `EditToolDiffPanel.tsx` | Side-by-side diff previews before edits |
1100
- | `ToolResultCard.tsx` | Structured tool output display |
1101
- | `SlashCommands.tsx` | Command palette and help |
1102
- | `StreamingText.tsx` | Live text output with typing effects |
1103
- | `ReasoningDisplay.tsx` | LLM reasoning visualization |
1104
- | `TodoPlanDisplay.tsx` | Task list visualization |
1105
- | `SessionStats.tsx` | Session metrics and status |
1106
- | `AnimatedBorder.tsx` | Visual feedback for active elements |
1107
- | `CollapsibleResult.tsx` | Expandable result sections |
1108
- | `ProgressBar.tsx` | Progress indicators |
1109
- | `AskUserQuestionPrompt.tsx` | Multiple-choice question UI |
1110
- | `ToolInvocationBlock.tsx` | Tool call visualization |
1111
- | `AssistantMessageDisplay.tsx` | Assistant message formatting |
1112
-
1113
- ---
1114
-
1115
369
  <p align="center">
1116
- <sub>Built with ❤️ by NomadEngenuity</sub>
370
+ <sub>Built with ❤️ by <a href="https://github.com/Nomad-e">NomadEngenuity</a></sub>
1117
371
  </p>