@nomad-e/bluma-cli 0.1.30 → 0.1.32
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 +435 -49
- package/dist/config/native_tools.json +12 -8
- package/dist/main.js +1459 -664
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<img src="https://pharmaseedevsa.blob.core.windows.net/pharmassee-dev-storage/bluma.png" alt="Screenshot BluMa CLI" width="1000"/>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
BluMa is a CLI-based model agent responsible for language-level code generation, refactoring and semantic transformations in the Factor AI stack. The project is a conversational assistant that interacts via terminal (CLI), built with React/Ink, supporting smart agents (LLM via
|
|
11
|
+
BluMa is a CLI-based model agent responsible for language-level code generation, refactoring and semantic transformations in the Factor AI stack. The project is a conversational assistant that interacts via terminal (CLI), built with React/Ink, supporting smart agents (LLM via FactorRouter), tool execution, persistent history, session management, coding memory, and extensibility through external plugins/tools and skills.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -25,8 +25,9 @@ BluMa is a CLI-based model agent responsible for language-level code generation,
|
|
|
25
25
|
- [Sandbox / Agent Mode](#sandbox-agent-mode)
|
|
26
26
|
- [Configuration and Environment Variables](#configuration-and-environment-variables)
|
|
27
27
|
- [Development and Build](#development-and-build)
|
|
28
|
-
- [Extensibility: Tools and Plugins](#extensibility-tools-and-plugins)
|
|
28
|
+
- [Extensibility: Tools, Skills and Plugins](#extensibility-tools-and-plugins)
|
|
29
29
|
- [Tests](#tests)
|
|
30
|
+
- [Coding Memory](#coding-memory)
|
|
30
31
|
- [Limitations / Next Steps](#️-limitations--next-steps)
|
|
31
32
|
- [Security Notes](#-security-notes)
|
|
32
33
|
- [Tech Stack Overview](#stack)
|
|
@@ -56,19 +57,21 @@ Choose BluMa for intelligent, efficient, and collaborative software engineering
|
|
|
56
57
|
## <a name="key-features"></a>Key Features
|
|
57
58
|
- **Rich CLI interface** using React/Ink 5, with interactive prompts and custom components.
|
|
58
59
|
- **Session management:** automatic persistence of conversation and tool history via files.
|
|
59
|
-
- **Central agent (LLM):** orchestrated by
|
|
60
|
+
- **Central agent (LLM):** orchestrated by FactorRouter, enabling natural language-driven automation.
|
|
60
61
|
- **Tool invocation:** native and via MCP SDK for running commands, code manipulation, file management, and more.
|
|
61
62
|
- **Dynamic prompts:** builds live conversational context, behavioral rules, and technical history.
|
|
62
63
|
- **Smart feedback component** with technical suggestions and checks.
|
|
63
64
|
- **ConfirmPrompt & Workflow Decision:** confirmations for sensitive operations, edit/code previews, always-accepted tool whitelists.
|
|
64
|
-
- **
|
|
65
|
+
- **Coding Memory:** persistent notes about the codebase, decisions, and context that survive across sessions.
|
|
66
|
+
- **Skills System:** pluggable knowledge modules for domain-specific expertise (git, testing, docker, etc.).
|
|
67
|
+
- **Extensible:** easily add new tools, skills, or integrate external SDK/plugins.
|
|
65
68
|
|
|
66
69
|
---
|
|
67
70
|
|
|
68
71
|
## <a name="requirements"></a>Requirements
|
|
69
72
|
- Node.js >= 18
|
|
70
73
|
- npm >= 9
|
|
71
|
-
-
|
|
74
|
+
- FactorRouter API key (get one from your FactorRouter admin)
|
|
72
75
|
|
|
73
76
|
---
|
|
74
77
|
|
|
@@ -98,17 +101,19 @@ If you get permission errors, EXAMPLES:
|
|
|
98
101
|
> Only use sudo to install, never to run the CLI.
|
|
99
102
|
|
|
100
103
|
### Setting Up Environment Variables
|
|
101
|
-
For BluMa CLI to operate, set the following environment
|
|
104
|
+
For BluMa CLI to operate, set the following environment variables globally in your system.
|
|
102
105
|
|
|
103
106
|
**Required:**
|
|
104
|
-
- `
|
|
107
|
+
- `FACTOR_ROUTER_KEY` — API key from your FactorRouter admin (e.g., `sk-fai-...`)
|
|
108
|
+
- `FACTOR_ROUTER_URL` — FactorRouter gateway base URL (e.g., `http://host:8003/router-api`)
|
|
105
109
|
|
|
106
110
|
#### How to set environment variables globally:
|
|
107
111
|
|
|
108
112
|
**Linux/macOS:**
|
|
109
113
|
Add to your `~/.bashrc`, `~/.zshrc`, or equivalent:
|
|
110
114
|
```sh
|
|
111
|
-
export
|
|
115
|
+
export FACTOR_ROUTER_KEY="your_factor_router_key"
|
|
116
|
+
export FACTOR_ROUTER_URL="http://host:8003/router-api"
|
|
112
117
|
```
|
|
113
118
|
Then run:
|
|
114
119
|
```sh
|
|
@@ -117,13 +122,15 @@ source ~/.bashrc # or whichever file you edited
|
|
|
117
122
|
|
|
118
123
|
**Windows (CMD):**
|
|
119
124
|
```cmd
|
|
120
|
-
setx
|
|
125
|
+
setx FACTOR_ROUTER_KEY "your_factor_router_key"
|
|
126
|
+
setx FACTOR_ROUTER_URL "http://host:8003/router-api"
|
|
121
127
|
```
|
|
122
128
|
(Only needs to be run once per variable. Restart the terminal after.)
|
|
123
129
|
|
|
124
130
|
**Windows (PowerShell):**
|
|
125
131
|
```powershell
|
|
126
|
-
[Environment]::SetEnvironmentVariable("
|
|
132
|
+
[Environment]::SetEnvironmentVariable("FACTOR_ROUTER_KEY", "your_factor_router_key", "Machine")
|
|
133
|
+
[Environment]::SetEnvironmentVariable("FACTOR_ROUTER_URL", "http://host:8003/router-api", "Machine")
|
|
127
134
|
```
|
|
128
135
|
|
|
129
136
|
### ℹ️ Global Installation of npm Packages in PowerShell (Windows)
|
|
@@ -166,7 +173,7 @@ Get up and running with BluMa in minutes:
|
|
|
166
173
|
```
|
|
167
174
|
|
|
168
175
|
2. **Configure Environment:**
|
|
169
|
-
Set your
|
|
176
|
+
Set your FactorRouter API key and URL (see [Configuration](#configuration-and-environment-variables)).
|
|
170
177
|
|
|
171
178
|
3. **Launch BluMa:**
|
|
172
179
|
```bash
|
|
@@ -411,17 +418,109 @@ Here's BluMa in action:
|
|
|
411
418
|
---
|
|
412
419
|
|
|
413
420
|
## <a name="project-structure"></a>Project Structure
|
|
421
|
+
|
|
414
422
|
```
|
|
415
|
-
bluma-
|
|
416
|
-
├── package.json # npm
|
|
417
|
-
├── tsconfig.json # TypeScript
|
|
418
|
-
├──
|
|
423
|
+
bluma-cli/
|
|
424
|
+
├── package.json # npm project config & dependencies
|
|
425
|
+
├── tsconfig.json # TypeScript configuration
|
|
426
|
+
├── babel.config.cjs # Babel presets for Jest/ESBuild
|
|
427
|
+
├── jest.config.cjs # Jest test configuration
|
|
428
|
+
├── scripts/
|
|
429
|
+
│ └── build.js # Build script using esbuild
|
|
419
430
|
├── src/
|
|
420
|
-
│ ├── main.ts # Entry point (
|
|
431
|
+
│ ├── main.ts # Entry point (CLI bootstrap & agent mode)
|
|
421
432
|
│ └── app/
|
|
422
|
-
│
|
|
423
|
-
│
|
|
433
|
+
│ ├── agent/ # Agent core & orchestration
|
|
434
|
+
│ │ ├── agent.ts # Main orchestrator (RouteManager integration)
|
|
435
|
+
│ │ ├── routeManager.ts # Route registration & dispatch
|
|
436
|
+
│ │ ├── bluma/
|
|
437
|
+
│ │ │ └── core/
|
|
438
|
+
│ │ │ └── bluma.ts # Core agent loop & state management
|
|
439
|
+
│ │ ├── config/
|
|
440
|
+
│ │ │ ├── native_tools.json # Native tool definitions
|
|
441
|
+
│ │ │ └── skills/ # Built-in skills (git-commit, git-pr, pdf, xlsx, skill-creator)
|
|
442
|
+
│ │ ├── core/
|
|
443
|
+
│ │ │ ├── context-api/ # Context management & token counting
|
|
444
|
+
│ │ │ │ ├── context_manager.ts
|
|
445
|
+
│ │ │ │ ├── history_anchor.ts
|
|
446
|
+
│ │ │ │ └── token_counter.ts
|
|
447
|
+
│ │ │ ├── llm/ # LLM client (FactorRouter/OpenAI SDK)
|
|
448
|
+
│ │ │ │ ├── llm.ts
|
|
449
|
+
│ │ │ │ └── tool_call_normalizer.ts
|
|
450
|
+
│ │ │ └── prompt/ # System prompt builder
|
|
451
|
+
│ │ │ └── prompt_builder.ts
|
|
452
|
+
│ │ ├── feedback/
|
|
453
|
+
│ │ │ └── feedback_system.ts # Smart feedback & suggestions
|
|
454
|
+
│ │ ├── session_manager/
|
|
455
|
+
│ │ │ └── session_manager.ts # Session persistence & history
|
|
456
|
+
│ │ ├── skills/
|
|
457
|
+
│ │ │ └── skill_loader.ts # Pluggable skill system
|
|
458
|
+
│ │ ├── subagents/ # Sub-agent implementations
|
|
459
|
+
│ │ │ ├── registry.ts # Sub-agent registration & lookup
|
|
460
|
+
│ │ │ ├── types.ts
|
|
461
|
+
│ │ │ ├── base_llm_subagent.ts
|
|
462
|
+
│ │ │ └── init/ # Init subagent (environment setup)
|
|
463
|
+
│ │ │ ├── init_subagent.ts
|
|
464
|
+
│ │ │ ├── init_system_prompt.ts
|
|
465
|
+
│ │ │ └── contracts.ts
|
|
466
|
+
│ │ ├── tools/
|
|
467
|
+
│ │ │ ├── mcp/
|
|
468
|
+
│ │ │ │ └── mcp_client.ts # MCP SDK integration
|
|
469
|
+
│ │ │ └── natives/ # Native tools (20+ tools)
|
|
470
|
+
│ │ │ ├── shell_command.ts
|
|
471
|
+
│ │ │ ├── edit.ts
|
|
472
|
+
│ │ │ ├── readLines.ts
|
|
473
|
+
│ │ │ ├── ls.ts
|
|
474
|
+
│ │ │ ├── grep_search.ts
|
|
475
|
+
│ │ │ ├── find_by_name.ts
|
|
476
|
+
│ │ │ ├── coding_memory.ts
|
|
477
|
+
│ │ │ ├── load_skill.ts
|
|
478
|
+
│ │ │ ├── message.ts
|
|
479
|
+
│ │ │ ├── todo.ts
|
|
480
|
+
│ │ │ ├── task_boundary.ts
|
|
481
|
+
│ │ │ └── ... (10 more)
|
|
482
|
+
│ │ ├── types/
|
|
483
|
+
│ │ │ └── index.ts # TypeScript type definitions
|
|
484
|
+
│ │ └── utils/
|
|
485
|
+
│ │ └── update_check.ts # Version update notifications
|
|
486
|
+
│ └── ui/ # Ink/React CLI interface
|
|
487
|
+
│ ├── App.tsx # Main React component
|
|
488
|
+
│ ├── layout.tsx # UI layout components
|
|
489
|
+
│ ├── components/ # Reusable UI components (20+)
|
|
490
|
+
│ │ ├── MarkdownRenderer.tsx
|
|
491
|
+
│ │ ├── ToolCallDisplay.tsx
|
|
492
|
+
│ │ ├── ToolResultCard.tsx
|
|
493
|
+
│ │ ├── InputPrompt.tsx
|
|
494
|
+
│ │ ├── ConfirmationPrompt.tsx
|
|
495
|
+
│ │ ├── SessionStats.tsx
|
|
496
|
+
│ │ └── ... (15 more)
|
|
497
|
+
│ ├── hooks/
|
|
498
|
+
│ │ └── useAtCompletion.ts # Autocomplete hook
|
|
499
|
+
│ ├── theme/
|
|
500
|
+
│ │ ├── blumaTerminal.ts
|
|
501
|
+
│ │ └── m3Layout.tsx
|
|
502
|
+
│ ├── utils/
|
|
503
|
+
│ │ ├── slashRegistry.ts
|
|
504
|
+
│ │ ├── terminalTitle.ts
|
|
505
|
+
│ │ └── ... (4 more)
|
|
506
|
+
│ └── Asci/
|
|
507
|
+
│ └── AsciiArt.ts
|
|
508
|
+
├── tests/ # Test suite (Jest 30)
|
|
509
|
+
│ ├── *.spec.ts # Unit & integration tests
|
|
510
|
+
│ └── *.spec.tsx # UI component tests
|
|
511
|
+
├── artifacts/ # Generated deliverables (runtime)
|
|
512
|
+
└── docs/ # Documentation
|
|
513
|
+
├── SKILLS.md # Skills system documentation
|
|
514
|
+
├── FACTOR_ROUTER_TURNS.md # FactorRouter integration details
|
|
515
|
+
└── assets/
|
|
516
|
+
└── bluma.png # Project logo
|
|
424
517
|
```
|
|
518
|
+
|
|
519
|
+
**Runtime directories** (created on first run):
|
|
520
|
+
- `~/.bluma/sessions/` — Persistent session history
|
|
521
|
+
- `~/.bluma/coding_memory.json` — Long-term coding notes
|
|
522
|
+
- `~/.bluma/skills/` — User-installed skills
|
|
523
|
+
- `~/.bluma/.env` — Optional local environment overrides
|
|
425
524
|
---
|
|
426
525
|
|
|
427
526
|
## <a name="development-and-build"></a>Development and Build
|
|
@@ -439,10 +538,97 @@ npm run dev # (If configured, hot-reload/TS watch)
|
|
|
439
538
|
|
|
440
539
|
---
|
|
441
540
|
|
|
442
|
-
## <a name="extensibility-tools-and-plugins"></a>Extensibility: Tools and Plugins
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
541
|
+
## <a name="extensibility-tools-and-plugins"></a>Extensibility: Tools, Skills and Plugins
|
|
542
|
+
|
|
543
|
+
### Native Tools (20+ Built-in)
|
|
544
|
+
|
|
545
|
+
BluMa ships with a comprehensive set of native tools for software engineering tasks:
|
|
546
|
+
|
|
547
|
+
**File Operations:**
|
|
548
|
+
- `edit_tool` — Precise text replacement with context-aware editing
|
|
549
|
+
- `read_file_lines` — Read specific line ranges from files
|
|
550
|
+
- `ls_tool` — List directory contents with filtering & pagination
|
|
551
|
+
- `count_file_lines` — Count total lines in a file
|
|
552
|
+
- `view_file_outline` — Show code structure (classes, functions, methods)
|
|
553
|
+
- `find_by_name` — Search files by name using glob patterns
|
|
554
|
+
|
|
555
|
+
**Code Intelligence:**
|
|
556
|
+
- `grep_search` — Search text patterns with regex support
|
|
557
|
+
- `coding_memory` — Persistent notes about codebase & decisions
|
|
558
|
+
|
|
559
|
+
**Shell & Process:**
|
|
560
|
+
- `shell_command` — Execute shell commands (background async)
|
|
561
|
+
- `command_status` — Check command progress & retrieve output
|
|
562
|
+
- `send_command_input` — Send stdin to running commands
|
|
563
|
+
- `kill_command` — Terminate running processes
|
|
564
|
+
|
|
565
|
+
**Agent Workflow:**
|
|
566
|
+
- `message` — Send messages to user (info or result)
|
|
567
|
+
- `todo` — Manage task lists with completion tracking
|
|
568
|
+
- `task_boundary` — Mark task phases (PLANNING, EXECUTION, VERIFICATION)
|
|
569
|
+
- `load_skill` — Load specialized knowledge modules
|
|
570
|
+
|
|
571
|
+
**UI & Navigation:**
|
|
572
|
+
- All tools render rich Ink/React components in the terminal
|
|
573
|
+
|
|
574
|
+
To add custom native tools, create a new file in `src/app/agent/tools/natives/` following the existing pattern.
|
|
575
|
+
|
|
576
|
+
### Skills System (Pluggable Expertise)
|
|
577
|
+
|
|
578
|
+
BluMa features a **pluggable skills system** that loads domain-specific knowledge modules:
|
|
579
|
+
|
|
580
|
+
**Built-in Skills:**
|
|
581
|
+
- `git-commit` — Professional Git commit workflows with Conventional Commits
|
|
582
|
+
- `git-pr` — Pull request creation, commit validation, and merge preparation
|
|
583
|
+
- `pdf` — PDF creation, manipulation, text extraction, merging, OCR
|
|
584
|
+
- `xlsx` — Excel spreadsheet manipulation, formulas, data cleaning
|
|
585
|
+
- `skill-creator` — Template and workflow for creating new skills
|
|
586
|
+
|
|
587
|
+
**Skill Structure:**
|
|
588
|
+
```
|
|
589
|
+
skills/
|
|
590
|
+
└── git-commit/
|
|
591
|
+
├── SKILL.md # Main workflow & instructions
|
|
592
|
+
├── LICENSE.txt # License terms
|
|
593
|
+
├── references/
|
|
594
|
+
│ └── REFERENCE.md # Additional documentation
|
|
595
|
+
└── scripts/
|
|
596
|
+
└── validate_commit_msg.py # Executable helper
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
**How Skills Work:**
|
|
600
|
+
1. Skills are stored in `src/app/agent/config/skills/` (built-in) or `~/.bluma/skills/` (user)
|
|
601
|
+
2. Each skill includes a `SKILL.md` with YAML frontmatter defining:
|
|
602
|
+
- `name`, `description`, `version`
|
|
603
|
+
- `depends_on` (other skills for delegation)
|
|
604
|
+
- `tools.required` and `tools.recommended`
|
|
605
|
+
3. Load a skill with: `load_skill({ skill_name: "git-commit" })`
|
|
606
|
+
4. Skill body provides workflows, examples, and decision trees
|
|
607
|
+
5. Skills can include `references/` (extra docs) and `scripts/` (Python helpers)
|
|
608
|
+
|
|
609
|
+
**Creating Custom Skills:**
|
|
610
|
+
Use the `skill-creator` skill to generate new skill templates. Skills are ideal for:
|
|
611
|
+
- Encoding domain-specific workflows (testing, deployment, frameworks)
|
|
612
|
+
- Packaging best practices and conventions
|
|
613
|
+
- Providing reusable scripts and reference documentation
|
|
614
|
+
|
|
615
|
+
### MCP Integration
|
|
616
|
+
|
|
617
|
+
BluMa integrates with the **Model Context Protocol (MCP)** SDK for:
|
|
618
|
+
- Connecting to external MCP servers
|
|
619
|
+
- Discovering and invoking remote tools
|
|
620
|
+
- Streaming tool results in real-time
|
|
621
|
+
|
|
622
|
+
MCP client is located at `src/app/agent/tools/mcp/mcp_client.ts`.
|
|
623
|
+
|
|
624
|
+
### Custom UI Components
|
|
625
|
+
|
|
626
|
+
Extend the interface by creating custom Ink components in `src/app/ui/components/`. The UI layer supports:
|
|
627
|
+
- React 18 with hooks
|
|
628
|
+
- Custom renderers for tool calls and results
|
|
629
|
+
- Streaming text and typewriter effects
|
|
630
|
+
- Progress bars, spinners, and notifications
|
|
631
|
+
- Markdown rendering with syntax highlighting
|
|
446
632
|
|
|
447
633
|
---
|
|
448
634
|
|
|
@@ -551,19 +737,74 @@ Enjoy, hack, and—if possible—contribute!
|
|
|
551
737
|
---
|
|
552
738
|
|
|
553
739
|
## 🏗 Architecture Diagram
|
|
554
|
-
|
|
740
|
+
|
|
741
|
+
BluMa's architecture is organized in **three layers**: UI, Agent Orchestration, and Core Services.
|
|
742
|
+
|
|
743
|
+
### High-Level Overview
|
|
555
744
|
```
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
745
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
746
|
+
│ UI Layer (Ink/React) │
|
|
747
|
+
│ main.ts → App.tsx → Components (20+) → Layout → Theme │
|
|
748
|
+
└─────────────────────────────────────────────────────────────┘
|
|
749
|
+
↓
|
|
750
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
751
|
+
│ Agent Orchestration Layer │
|
|
752
|
+
│ agent.ts → RouteManager → BluMaAgent (bluma.ts) │
|
|
753
|
+
│ ↓ │
|
|
754
|
+
│ SubAgents Registry | Feedback System | Session Manager │
|
|
755
|
+
└─────────────────────────────────────────────────────────────┘
|
|
756
|
+
↓
|
|
757
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
758
|
+
│ Core Services Layer │
|
|
759
|
+
│ ┌──────────────┬──────────────┬──────────────┐ │
|
|
760
|
+
│ │ Context API │ LLM Client │ Prompt Bld │ │
|
|
761
|
+
│ │ (context │ (Factor │ (system │ │
|
|
762
|
+
│ │ manager) │ Router) │ prompts) │ │
|
|
763
|
+
│ └──────────────┴──────────────┴──────────────┘ │
|
|
764
|
+
│ ┌──────────────┬──────────────┬──────────────┐ │
|
|
765
|
+
│ │ MCP Client │ Native Tools │ Skills │ │
|
|
766
|
+
│ │ (external │ (20+ tools) │ (pluggable) │ │
|
|
767
|
+
│ │ plugins) │ │ │ │
|
|
768
|
+
│ └──────────────┴──────────────┴──────────────┘ │
|
|
769
|
+
└─────────────────────────────────────────────────────────────┘
|
|
770
|
+
↓
|
|
771
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
772
|
+
│ External Integrations │
|
|
773
|
+
│ FactorRouter API | File System | Shell | MCP Servers │
|
|
774
|
+
└─────────────────────────────────────────────────────────────┘
|
|
565
775
|
```
|
|
566
|
-
|
|
776
|
+
|
|
777
|
+
### Key Architectural Concepts
|
|
778
|
+
|
|
779
|
+
**1. RouteManager Pattern**
|
|
780
|
+
- Central dispatch mechanism for command routing
|
|
781
|
+
- Registers custom route handlers (e.g., `/init`, `/status`)
|
|
782
|
+
- Falls back to core agent loop for unregistered commands
|
|
783
|
+
- Enables extensible command architecture
|
|
784
|
+
|
|
785
|
+
**2. SubAgents Registry**
|
|
786
|
+
- Pluggable sub-agent system for specialized tasks
|
|
787
|
+
- Each sub-agent declares capabilities via registry
|
|
788
|
+
- Init subagent handles environment setup
|
|
789
|
+
- Extensible via `registerSubAgent()` API
|
|
790
|
+
|
|
791
|
+
**3. Context Management**
|
|
792
|
+
- `ContextManager` handles conversation history
|
|
793
|
+
- `TokenCounter` tracks token usage (tiktoken)
|
|
794
|
+
- `HistoryAnchor` manages context window compression
|
|
795
|
+
- Automatic pruning to stay within LLM limits
|
|
796
|
+
|
|
797
|
+
**4. Session Persistence**
|
|
798
|
+
- `SessionManager` persists all interactions
|
|
799
|
+
- Stored in `~/.bluma/sessions/<session-id>.json`
|
|
800
|
+
- Survives across CLI restarts
|
|
801
|
+
- Includes full tool call history and results
|
|
802
|
+
|
|
803
|
+
**5. Skills System**
|
|
804
|
+
- Pluggable knowledge modules (`skill_loader.ts`)
|
|
805
|
+
- Built-in skills: `git-commit`, `git-pr`, `pdf`, `xlsx`, `skill-creator`
|
|
806
|
+
- Each skill includes `SKILL.md` with workflows
|
|
807
|
+
- Can include `references/` (docs) and `scripts/` (executables)
|
|
567
808
|
|
|
568
809
|
### Sequence Diagram
|
|
569
810
|
```mermaid
|
|
@@ -661,7 +902,7 @@ stateDiagram-v2
|
|
|
661
902
|
```mermaid
|
|
662
903
|
graph TD
|
|
663
904
|
CLI["CLI (BluMa)"] --> LocalFS[("Local File System")]
|
|
664
|
-
CLI -->
|
|
905
|
+
CLI --> FactorRouter[("FactorRouter API")]
|
|
665
906
|
CLI --> OtherAPIs[("Other External APIs")]
|
|
666
907
|
CLI --> MCPServer[("MCP Server / Plugins")]
|
|
667
908
|
```
|
|
@@ -688,23 +929,140 @@ flowchart LR
|
|
|
688
929
|
---
|
|
689
930
|
|
|
690
931
|
## 💡 Usage Examples
|
|
691
|
-
|
|
932
|
+
|
|
933
|
+
### Interactive CLI Mode
|
|
934
|
+
|
|
935
|
+
**1. Start a Conversation**
|
|
936
|
+
```bash
|
|
937
|
+
bluma
|
|
692
938
|
```
|
|
693
|
-
|
|
939
|
+
Then ask naturally:
|
|
940
|
+
- "Help me refactor this authentication module"
|
|
941
|
+
- "Run tests and fix any failures"
|
|
942
|
+
- "Create a PDF report from this data"
|
|
943
|
+
|
|
944
|
+
**2. Use Slash Commands**
|
|
945
|
+
```bash
|
|
946
|
+
/init # Initialize environment with init subagent
|
|
947
|
+
/todo # View current task list
|
|
948
|
+
/memory list # List all coding memory entries
|
|
949
|
+
/skills # List available skills
|
|
694
950
|
```
|
|
695
|
-
Executes the `init` subagent to prepare the working environment.
|
|
696
951
|
|
|
697
|
-
|
|
698
|
-
When the system prompts an `edit_tool` operation, review the preview and choose:
|
|
952
|
+
**3. Load Skills for Specialized Tasks**
|
|
699
953
|
```
|
|
700
|
-
|
|
954
|
+
# The agent will automatically load skills when needed
|
|
955
|
+
"Commit these changes with a proper message" → loads git-commit skill
|
|
956
|
+
"Create a pull request" → loads git-pr skill
|
|
957
|
+
"Generate a PDF report" → loads pdf skill
|
|
958
|
+
"Analyze this Excel file" → loads xlsx skill
|
|
701
959
|
```
|
|
702
960
|
|
|
703
|
-
|
|
704
|
-
|
|
961
|
+
**4. Live Overlays During Processing**
|
|
962
|
+
While the agent is working, type guidance:
|
|
705
963
|
```
|
|
706
|
-
[hint]
|
|
707
|
-
[constraint]
|
|
964
|
+
[hint] Focus on the authentication flow first
|
|
965
|
+
[constraint] Don't modify files in tests/ yet
|
|
966
|
+
[override] expected_replacements=2
|
|
967
|
+
[assume] target_database=postgresql
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
**5. Tool Confirmation Flow**
|
|
971
|
+
When the agent requests a sensitive operation:
|
|
972
|
+
```
|
|
973
|
+
┌─────────────────────────────────────────┐
|
|
974
|
+
│ EDIT PREVIEW │
|
|
975
|
+
│ File: src/auth/login.ts │
|
|
976
|
+
│ Lines 45-67 │
|
|
977
|
+
│ │
|
|
978
|
+
│ - old code │
|
|
979
|
+
│ + new code │
|
|
980
|
+
└─────────────────────────────────────────┘
|
|
981
|
+
|
|
982
|
+
[Accept] [Decline] [Accept Always] [Expand]
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
### Agent Mode (Sandbox / API Integration)
|
|
986
|
+
|
|
987
|
+
**6. Call BluMa from Another System**
|
|
988
|
+
```bash
|
|
989
|
+
BLUMA_SANDBOX=true BLUMA_SANDBOX_NAME="agiweb" \
|
|
990
|
+
node dist/main.js agent --input - << 'EOF'
|
|
991
|
+
{
|
|
992
|
+
"session_id": "conv-123",
|
|
993
|
+
"message_id": "job-456",
|
|
994
|
+
"from_agent": "agiweb",
|
|
995
|
+
"to_agent": "bluma",
|
|
996
|
+
"action": "generate_report",
|
|
997
|
+
"context": {
|
|
998
|
+
"user_request": "Create sales report PDF"
|
|
999
|
+
},
|
|
1000
|
+
"user_context": {
|
|
1001
|
+
"userId": "13",
|
|
1002
|
+
"userName": "Alex",
|
|
1003
|
+
"companyId": "4"
|
|
1004
|
+
},
|
|
1005
|
+
"metadata": { "sandbox": true }
|
|
1006
|
+
}
|
|
1007
|
+
EOF
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
**7. Parse JSONL Output**
|
|
1011
|
+
The agent outputs structured events:
|
|
1012
|
+
```json
|
|
1013
|
+
{"event_type":"log","level":"info","message":"Starting..."}
|
|
1014
|
+
{"event_type":"action_status","payload":{"action":"Thinking"}}
|
|
1015
|
+
{"event_type":"backend_message","backend_type":"tool_call",...}
|
|
1016
|
+
{"event_type":"result","status":"success","data":{"attachments":["/app/artifacts/report.pdf"]}}
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
**8. Retrieve Generated Artifacts**
|
|
1020
|
+
Check the `attachments` array in the final `result` event:
|
|
1021
|
+
```json
|
|
1022
|
+
{
|
|
1023
|
+
"event_type": "result",
|
|
1024
|
+
"status": "success",
|
|
1025
|
+
"data": {
|
|
1026
|
+
"message_id": "job-456",
|
|
1027
|
+
"last_assistant_message": "Report generated successfully",
|
|
1028
|
+
"attachments": [
|
|
1029
|
+
"/app/artifacts/sales_report.pdf",
|
|
1030
|
+
"/app/artifacts/sales_data.csv"
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
### Common Workflows
|
|
1037
|
+
|
|
1038
|
+
**9. Code Refactoring**
|
|
1039
|
+
```
|
|
1040
|
+
User: "Refactor this function to use async/await"
|
|
1041
|
+
→ Agent reads file with read_file_lines
|
|
1042
|
+
→ Plans changes with todo
|
|
1043
|
+
→ Applies edits with edit_tool (shows preview)
|
|
1044
|
+
→ Runs tests with shell_command
|
|
1045
|
+
→ Reports results
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
**10. Git Workflow**
|
|
1049
|
+
```
|
|
1050
|
+
User: "Commit my changes"
|
|
1051
|
+
→ Agent loads git-commit skill
|
|
1052
|
+
→ Runs git status --short
|
|
1053
|
+
→ Stages files with git add
|
|
1054
|
+
→ Writes conventional commit message
|
|
1055
|
+
→ Executes git commit
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
**11. Data Analysis & Reporting**
|
|
1059
|
+
```
|
|
1060
|
+
User: "Analyze sales.xlsx and create a summary"
|
|
1061
|
+
→ Agent loads xlsx skill
|
|
1062
|
+
→ Runs Python script to read Excel
|
|
1063
|
+
→ Processes data with pandas
|
|
1064
|
+
→ Generates PDF with charts
|
|
1065
|
+
→ Returns attachments array
|
|
708
1066
|
```
|
|
709
1067
|
|
|
710
1068
|
---
|
|
@@ -745,15 +1103,47 @@ We welcome contributions! For full details, read [CONTRIBUTING.md](CONTRIBUTING.
|
|
|
745
1103
|
|
|
746
1104
|
---
|
|
747
1105
|
|
|
1106
|
+
## Coding memory
|
|
1107
|
+
|
|
1108
|
+
BluMa includes a **persistent coding memory** system that stores notes about the codebase, decisions, and context that survive across sessions:
|
|
1109
|
+
|
|
1110
|
+
- Memory is stored in `~/.bluma/coding_memory.json`
|
|
1111
|
+
- Use the `coding_memory` tool to **add**, **list**, **search**, **update** (by id), or **remove** (one id at a time). There is **no** bulk “clear all” action.
|
|
1112
|
+
- Notes can be tagged for easy categorization (e.g., `['api', 'auth', 'performance']`)
|
|
1113
|
+
- Memory is loaded at session start and can be searched during tasks
|
|
1114
|
+
|
|
1115
|
+
### When to use Coding Memory:
|
|
1116
|
+
- After learning stable facts about architecture or conventions
|
|
1117
|
+
- To store important URLs, API endpoints, or design decisions
|
|
1118
|
+
- To remember user preferences that should persist across sessions
|
|
1119
|
+
- To document invariants or critical system behaviors
|
|
1120
|
+
|
|
1121
|
+
### Example:
|
|
1122
|
+
```json
|
|
1123
|
+
{
|
|
1124
|
+
"action": "add",
|
|
1125
|
+
"note": "Project uses FactorRouter for LLM routing with model auto-selection",
|
|
1126
|
+
"tags": ["llm", "architecture"]
|
|
1127
|
+
}
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
---
|
|
1131
|
+
|
|
748
1132
|
## ⚠️ Limitations / Next Steps
|
|
749
|
-
- Current LLM integration uses OpenRouter; add more providers.
|
|
750
1133
|
- Logging verbosity could be made configurable.
|
|
751
1134
|
- Potential for richer plugin lifecycle (install/remove at runtime).
|
|
752
1135
|
- Improve error reporting in subagents.
|
|
1136
|
+
- Expand skill library with more domain-specific modules.
|
|
753
1137
|
|
|
754
1138
|
---
|
|
755
1139
|
|
|
756
1140
|
## 🔒 Security Notes
|
|
1141
|
+
- **API Keys:** Never commit `.env` files or hardcode API keys in source code.
|
|
1142
|
+
- **File Operations:** `edit_tool` can modify files — always review previews before accepting changes.
|
|
1143
|
+
- **Sandbox Mode:** When `BLUMA_SANDBOX=true`, BluMa is forbidden from exposing environment variables, API keys, or infrastructure details.
|
|
1144
|
+
- **Permissions:** Use restricted permissions for API tokens wherever possible (principle of least privilege).
|
|
1145
|
+
- **Shared Systems:** If using on shared systems, ensure `.bluma` config directory is private (`chmod 700 ~/.bluma`).
|
|
1146
|
+
- **Input Validation:** All user inputs are validated and sanitized to prevent prompt injection attacks.
|
|
757
1147
|
|
|
758
1148
|
---
|
|
759
1149
|
|
|
@@ -824,7 +1214,3 @@ BluMa handles different classes of errors gracefully:
|
|
|
824
1214
|
- Add unit tests for all business logic.
|
|
825
1215
|
|
|
826
1216
|
---
|
|
827
|
-
- Protect your API keys: never commit `.env` files.
|
|
828
|
-
- `edit_tool` can modify files — review previews before accepting.
|
|
829
|
-
- Use restricted permissions for API tokens wherever possible.
|
|
830
|
-
- If using on shared systems, ensure `.bluma` config is private.
|