erosolar-cli 1.6.13 → 1.6.14

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.
Files changed (2) hide show
  1. package/README.md +154 -858
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  ## AI Coding Agent Comparison
4
4
 
5
- A comparison of AI coding agents for building complete projects from scratch:
6
-
7
5
  | Agent | Screenshot |
8
6
  |-------|------------|
9
7
  | **Claude Code** | ![Claude](https://erosolar-public-assets.s3.amazonaws.com/images/Claude.png) |
@@ -28,964 +26,262 @@ A comparison of AI coding agents for building complete projects from scratch:
28
26
 
29
27
  ![Gemini](https://erosolar-public-assets.s3.amazonaws.com/images/Gemini.png)
30
28
 
31
- A unified AI agent framework for the command line. Multi-provider support with schema-driven tools, code intelligence, competitive RL, and transparent reasoning.
29
+ ---
30
+
31
+ ## What is Erosolar CLI?
32
+
33
+ **Erosolar CLI** is a unified AI coding agent for the command line that works with **any major AI provider**. It's designed to be model-agnostic—you bring your own API keys, and erosolar-cli handles the rest: tool orchestration, file editing, code search, bash execution, and autonomous task completion.
34
+
35
+ Think of it as a **universal interface** for AI-powered coding that doesn't lock you into a single provider.
32
36
 
33
37
  [![npm version](https://img.shields.io/npm/v/erosolar-cli.svg)](https://www.npmjs.com/package/erosolar-cli)
34
- [![PyPI version](https://img.shields.io/pypi/v/erosolar.svg)](https://pypi.org/project/erosolar/)
35
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
36
39
  [![Node.js Version](https://img.shields.io/node/v/erosolar-cli.svg)](https://nodejs.org)
37
40
 
38
- ```
39
- ┌─────────────────────────────────────────────────────────────────────┐
40
- │ EROSOLAR CLI │
41
- ├─────────────────────────────────────────────────────────────────────┤
42
- │ CORE (Always Available) │ PLUGINS (Optional) │
43
- │ ───────────────────────── │ ──────────────────── │
44
- │ • Filesystem (read/write/list) │ • alpha_zero (RL framework) │
45
- │ • Edit (surgical replacement) │ • coding (analysis tools) │
46
- │ • Bash (safe shell execution) │ • security (vuln scanning) │
47
- │ • Glob (pattern matching) │ │
48
- │ • Grep (regex search) │ │
49
- └─────────────────────────────────────────────────────────────────────┘
50
- ```
41
+ ---
51
42
 
52
- ## Table of Contents
53
-
54
- - [Installation](#installation)
55
- - [Quick Start](#quick-start)
56
- - [Supported Providers](#supported-providers)
57
- - [Core Concepts](#core-concepts)
58
- - [Plugin System](#plugin-system)
59
- - [Alpha Zero 2](#alpha-zero-2)
60
- - [Usage Guide](#usage-guide)
61
- - [Commands Reference](#commands-reference)
62
- - [Tool Capabilities](#tool-capabilities)
63
- - [Programmatic Usage](#programmatic-usage)
64
- - [Schema Architecture](#schema-architecture)
65
- - [Configuration](#configuration)
66
- - [Development](#development)
43
+ ## Key Features
44
+
45
+ - **Multi-Provider Support** - Switch between OpenAI, Anthropic, Google, xAI, DeepSeek, or run locally with Ollama
46
+ - **25+ Built-in Models** - From GPT-5 to Claude Opus to Gemini Pro to local Llama models
47
+ - **Full Filesystem Access** - Read, write, edit files with surgical precision
48
+ - **Safe Bash Execution** - Run shell commands with guardrails
49
+ - **Code Intelligence** - Glob patterns, regex search, AST-aware editing
50
+ - **Continuous Execution** - Runs autonomously until tasks are complete
51
+ - **Schema-Driven Architecture** - Extensible via JSON schemas and plugins
67
52
 
68
53
  ---
69
54
 
70
55
  ## Installation
71
56
 
72
- ### TypeScript/Node.js (npm)
73
-
74
57
  ```bash
75
58
  npm install -g erosolar-cli
76
59
  ```
77
60
 
78
- **Commands:** `erosolar-ts`, `erosolar-cli`, `erosolar`
79
-
80
- **Requirements:** Node.js 20+
81
-
82
- ### Python (PyPI)
83
-
61
+ Then run:
84
62
  ```bash
85
- pip install erosolar
86
- ```
87
-
88
- **Commands:** `erosolar-py`, `erosolar`, `bo-cli`, `bo`
89
-
90
- **Requirements:** Python 3.10+
91
-
92
- **Verify installation:**
93
-
94
- ```bash
95
- erosolar --version
96
- ```
97
-
98
- ---
99
-
100
- ## Quick Start
101
-
102
- ```bash
103
- # Start interactive session
104
- erosolar-cli
105
-
106
- # Or use the short alias
107
63
  erosolar
108
64
  ```
109
65
 
110
- On first run, you'll see available providers based on your configured API keys:
111
-
112
- ```
113
- ✓ Providers: anthropic (claude-sonnet-4-5) | openai (gpt-4o) | deepseek (deepseek-reasoner)
114
- ℹ Add: google: set GOOGLE_API_KEY, xai: set XAI_API_KEY
115
- ```
116
-
117
- ### Basic Workflow
118
-
119
- 1. **Ask a question or give a task** in natural language
120
- 2. **Watch the agent work** - see tool calls, reasoning, and results in real-time
121
- 3. **Iterate** - refine your request based on results
122
-
123
- ```
124
- > find all TODO comments in the codebase
125
-
126
- ⏺ I'll search for TODO comments across the codebase.
127
-
128
- ⏺ Grep(pattern: "TODO", output_mode: "content")
129
- ⎿ Found 23 matches in 8 files
130
-
131
- Here are the TODO comments I found:
132
- - src/api/handler.ts:45 - TODO: Add rate limiting
133
- - src/utils/cache.ts:12 - TODO: Implement TTL expiration
134
- ...
135
- ```
66
+ **Requirements:** Node.js 20+
136
67
 
137
68
  ---
138
69
 
139
- ## Supported Providers
140
-
141
- | Provider | Models | Environment Variable |
142
- |----------|--------|---------------------|
143
- | **Anthropic** | Claude Opus, Sonnet, Haiku | `ANTHROPIC_API_KEY` |
144
- | **OpenAI** | GPT-4o, GPT-4, o1, o1-mini | `OPENAI_API_KEY` |
145
- | **Google** | Gemini 2.0 Flash, 1.5 Pro | `GOOGLE_API_KEY` or `GEMINI_API_KEY` |
146
- | **DeepSeek** | deepseek-reasoner, deepseek-chat | `DEEPSEEK_API_KEY` |
147
- | **xAI** | Grok-2, Grok-beta | `XAI_API_KEY` |
148
- | **Ollama** | Llama, Qwen, Mistral (local) | `OLLAMA_BASE_URL` (optional) |
149
- | **Mistral** | Mistral Large, Codestral | `MISTRAL_API_KEY` |
150
- | **Groq** | Llama 3.1, Mixtral (fast) | `GROQ_API_KEY` |
151
- | **Together** | Various open models | `TOGETHER_API_KEY` |
152
- | **Fireworks** | Various open models | `FIREWORKS_API_KEY` |
70
+ ## Supported Providers & Models
153
71
 
154
- ### Setting Up API Keys
72
+ ### OpenAI
73
+ | Model | Description |
74
+ |-------|-------------|
75
+ | `gpt-5.1-codex` | Optimized for coding with the latest OpenAI weights |
76
+ | `gpt-5.1` | Balanced reasoning for code and analysis |
77
+ | `gpt-5-pro` | Flagship model for maximum depth and planning |
78
+ | `gpt-5-mini` | Faster turnarounds while staying code-aware |
79
+ | `gpt-5-nano` | Ultra-responsive for quick edits and summaries |
155
80
 
156
81
  ```bash
157
- # Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
158
- export ANTHROPIC_API_KEY="sk-ant-..."
159
- export OPENAI_API_KEY="sk-..."
160
- export DEEPSEEK_API_KEY="sk-..."
82
+ export OPENAI_API_KEY=your_key
83
+ erosolar
161
84
  ```
162
85
 
163
- ### Switching Providers
86
+ ### Anthropic (Claude)
87
+ | Model | Description |
88
+ |-------|-------------|
89
+ | `claude-sonnet-4-5-20250929` | Sonnet 4.5 for deep planning across large repos |
90
+ | `claude-opus-4.1` | Opus 4.1 for richest reasoning |
91
+ | `claude-haiku-4.5` | Haiku 4.5 for latency-sensitive workflows |
164
92
 
165
93
  ```bash
166
- # In the CLI
167
- /provider anthropic # Switch to Anthropic
168
- /provider deepseek # Switch to DeepSeek
169
- /providers # List all configured providers
170
- ```
171
-
172
- ---
173
-
174
- ## Core Concepts
175
-
176
- ### Transparent Reasoning
177
-
178
- Every action is visible. The agent narrates its thought process and shows tool execution in real-time:
179
-
94
+ export ANTHROPIC_API_KEY=your_key
95
+ erosolar
180
96
  ```
181
- ⏺ I'll analyze the authentication module for security issues.
182
-
183
- ⏺ Read(src/auth/login.ts)
184
- ⎿ Read 156 lines
185
97
 
186
- Grep(pattern: "password.*=", type: "ts")
187
- Found 3 matches
98
+ ### Google (Gemini)
99
+ | Model | Description |
100
+ |-------|-------------|
101
+ | `gemini-2.5-pro` | Multimodal deep reasoning with longer outputs |
102
+ | `gemini-2.5-flash` | Lower-latency for iterative coding |
103
+ | `gemini-3.0-pro-preview` | Next-gen multimodal reasoning (preview) |
188
104
 
189
- Based on my analysis, I found a potential issue at line 42...
105
+ ```bash
106
+ export GEMINI_API_KEY=your_key
107
+ erosolar
190
108
  ```
191
109
 
192
- ### Schema-Driven Tools
193
-
194
- All tools are defined in JSON schemas, making them:
195
- - **Provider-agnostic**: Same tools work across all LLM providers
196
- - **Self-documenting**: Schemas describe parameters and types
197
- - **Extensible**: Add custom tools via plugins or MCP servers
198
-
199
- ### Context Management
200
-
201
- The CLI tracks token usage and manages context efficiently:
110
+ ### xAI (Grok)
111
+ | Model | Description |
112
+ |-------|-------------|
113
+ | `grok-4` | Highest quality coding and reasoning |
114
+ | `grok-4.1-fast-reasoning` | Fast reasoning with enhanced thinking |
115
+ | `grok-4-fast-reasoning` | Lower latency with thinking enabled |
116
+ | `grok-4-fast-non-reasoning` | Concise edits and summaries |
117
+ | `grok-code-fast-1` | Tuned specifically for rapid coding |
202
118
 
119
+ ```bash
120
+ export XAI_API_KEY=your_key
121
+ erosolar
203
122
  ```
204
- • Context 45% used (52.3k tokens) • Ready for prompts
205
- ```
206
-
207
- - **Green** (<70%): Plenty of room
208
- - **Yellow** (70-90%): Getting full
209
- - **Red** (>90%): Approaching limit, consider `/clear`
210
123
 
211
- ### Session Persistence
212
-
213
- Sessions auto-save and restore. Use `/sessions` to manage:
124
+ ### DeepSeek
125
+ | Model | Description |
126
+ |-------|-------------|
127
+ | `deepseek-reasoner` | Chain-of-thought exploration with tool depth |
128
+ | `deepseek-chat` | Faster interactive editing and summarization |
214
129
 
215
130
  ```bash
216
- /sessions list # Show saved sessions
217
- /sessions load <name> # Load a session
218
- /sessions save <name> # Save current session
131
+ export DEEPSEEK_API_KEY=your_key
132
+ erosolar
219
133
  ```
220
134
 
221
- ### Automatic Context Management
222
-
223
- Erosolar automatically manages conversation context to prevent hitting token limits:
224
-
225
- - **Model-aware limits**: Each model has appropriate context thresholds (GPT-4o: 128K, Claude 3: 200K, etc.)
226
- - **Automatic summarization**: When context reaches 70% capacity, LLM-based summarization preserves key information
227
- - **Progressive warnings**: Visual indicators at 60% (info), 70% (pruning), 85% (critical)
228
-
229
- Preserved information includes file paths, function names, error solutions, user decisions, and work completed.
230
-
231
- ---
232
-
233
- ## Plugin System
234
-
235
- Plugins are **opt-in** extensions that add specialized capabilities beyond the core tools.
236
-
237
- ### Enabling Plugins
135
+ ### Ollama (Local/Air-Gapped)
136
+ | Model | Description |
137
+ |-------|-------------|
138
+ | `llama3.1:8b` | Meta Llama 3.1 8B - Strong general purpose (128K context) |
139
+ | `llama3.2:3b` | Meta Llama 3.2 3B - Efficient for quick responses |
140
+ | `qwen2.5:7b` | Alibaba Qwen 2.5 7B - Excellent multilingual support |
141
+ | `qwen2.5:14b` | Alibaba Qwen 2.5 14B - Enhanced reasoning |
142
+ | `mistral:7b` | Mistral 7B - Fast and efficient |
143
+ | `deepseek-coder:6.7b` | DeepSeek Coder - Specialized for programming |
144
+ | `codellama:7b` | Meta Code Llama - Optimized for code |
238
145
 
239
146
  ```bash
240
- # TypeScript
241
- erosolar --alpha-zero # Enable Alpha Zero 2
242
- erosolar --coding # Enable enhanced coding tools
243
- erosolar --all-plugins # Enable all plugins
244
-
245
- # Python
246
- erosolar-py --alpha-zero
247
- erosolar-py --interactive --coding
147
+ # Start Ollama first
148
+ ollama serve
149
+ erosolar --provider ollama
248
150
  ```
249
151
 
250
- ### Available Plugins
251
-
252
- | Plugin | Flag | Description |
253
- |--------|------|-------------|
254
- | **Alpha Zero 2** | `--alpha-zero` | Competitive RL framework with code metrics |
255
- | **Coding Tools** | `--coding` | Enhanced code analysis and refactoring |
256
- | **Security** | `--security` | Vulnerability scanning and security research |
257
-
258
- ### Coding Tools Plugin
259
-
260
- Enhanced code analysis and development assistance:
261
-
262
- | Tool | Description |
263
- |------|-------------|
264
- | `analyze_complexity` | Cyclomatic complexity, maintainability index |
265
- | `find_dependencies` | Import analysis (stdlib/third-party/local) |
266
- | `generate_docstring` | Auto-generate docstrings (Google/NumPy style) |
267
- | `suggest_refactorings` | Identify refactoring opportunities |
268
- | `generate_test_stub` | Create pytest/jest test templates |
269
-
270
- ### Security Tools Plugin
271
-
272
- Security research and vulnerability assessment:
273
-
274
- | Tool | Description |
275
- |------|-------------|
276
- | `dependency_audit` | Check dependencies for known vulnerabilities |
277
- | `code_security_scan` | Pattern-based security issue detection |
278
- | `analyze_attack_surface` | Project security posture analysis |
279
-
280
- **Detected Issues:** Hardcoded secrets, code injection risks, insecure deserialization, SQL injection, XSS risks
281
-
282
152
  ---
283
153
 
284
- ## Alpha Zero 2
285
-
286
- **Principal Investigator:** Bo Shang
287
-
288
- A competitive multi-agent reinforcement learning framework for code optimization that demonstrates practical recursive self-improvement in autonomous coding agents.
289
-
290
- ### Key Innovations
291
-
292
- 1. **Competitive Learning** - Agents improve faster when competing against each other
293
- 2. **Code Quality Metrics** - AST-based evaluation across 10+ dimensions
294
- 3. **Safe Self-Modification** - Version control with automatic rollback
295
- 4. **Meta-Learning** - Learning to improve the improvement process itself
296
-
297
- ### Code Quality Dimensions
298
-
299
- | Metric | Weight | Description |
300
- |--------|--------|-------------|
301
- | Code Quality | 25% | Structure, naming, organization |
302
- | Algorithm Efficiency | 20% | Data structures, complexity |
303
- | Error Handling | 20% | Try/catch, validation, edge cases |
304
- | Documentation | 15% | Docstrings, comments |
305
- | Maintainability | 10% | Function length, coupling |
306
- | Security | 10% | Injection risks, secrets handling |
307
-
308
- ### CLI Commands
154
+ ## Quick Start
309
155
 
310
156
  ```bash
311
- # Run a tournament
312
- erosolar alpha-zero tournament --rounds 10
157
+ # Set your API key
158
+ export OPENAI_API_KEY=your_key
313
159
 
314
- # Evaluate code quality
315
- erosolar alpha-zero evaluate myfile.py
160
+ # Start erosolar
161
+ erosolar
316
162
 
317
- # View competition history
318
- erosolar alpha-zero history
163
+ # Or specify a provider/model directly
164
+ erosolar --provider anthropic --model claude-sonnet-4-5-20250929
319
165
  ```
320
166
 
321
- ### Shell Commands
167
+ Once running, just describe what you want:
322
168
 
323
169
  ```
324
- /metrics Show performance metrics
325
- /suggestions Show improvement suggestions
326
- ```
170
+ > Create a REST API with Express that has user authentication
327
171
 
328
- ### Citation
172
+ > Find all files that import 'lodash' and refactor to use native methods
329
173
 
330
- ```bibtex
331
- @software{alpha_zero_2,
332
- title={Alpha Zero 2: Recursive Self-Improvement in Competitive Multi-Agent Systems},
333
- author={Bo Shang},
334
- year={2024},
335
- framework={erosolar-cli}
336
- }
174
+ > Run the tests, fix any failures, and commit the changes
337
175
  ```
338
176
 
339
177
  ---
340
178
 
341
- ## Usage Guide
342
-
343
- ### Natural Language Tasks
344
-
345
- Just describe what you want:
179
+ ## Core Tools
346
180
 
347
- ```
348
- > refactor the UserService class to use dependency injection
349
- > write tests for the authentication module
350
- > find and fix the memory leak in the event handler
351
- > explain how the caching system works
352
- ```
353
-
354
- ### File Operations
355
-
356
- ```
357
- > read src/config.ts
358
- > create a new utility file for date formatting
359
- > rename all instances of 'userId' to 'accountId' in the api folder
360
- ```
361
-
362
- ### Code Analysis
363
-
364
- ```
365
- > analyze the complexity of this codebase
366
- > find all functions with more than 50 lines
367
- > show the dependency graph for the auth module
368
- ```
369
-
370
- ### Git Operations
371
-
372
- ```
373
- > show recent commits
374
- > create a commit with a descriptive message
375
- > what changed in the last PR?
376
- ```
377
-
378
- ### Multi-Step Tasks
379
-
380
- For complex tasks, the agent uses a todo list to track progress:
381
-
382
- ```
383
- > implement user authentication with JWT, tests, and documentation
384
-
385
- ⏺ Creating task list...
386
-
387
- [1. [in_progress] Design JWT authentication flow
388
- 2. [pending] Implement login endpoint
389
- 3. [pending] Implement token refresh
390
- 4. [pending] Add middleware for protected routes
391
- 5. [pending] Write unit tests
392
- 6. [pending] Add API documentation]
393
- ```
181
+ | Tool | Description |
182
+ |------|-------------|
183
+ | **Read** | Read file contents with line numbers |
184
+ | **Write** | Create new files |
185
+ | **Edit** | Surgical string replacement in files |
186
+ | **Glob** | Find files by pattern (`**/*.ts`, `src/**/*.js`) |
187
+ | **Grep** | Regex search across codebase |
188
+ | **Bash** | Execute shell commands safely |
189
+ | **TodoWrite** | Track multi-step task progress |
190
+ | **AskUser** | Request clarification when needed |
394
191
 
395
192
  ---
396
193
 
397
- ## Commands Reference
398
-
399
- ### Provider & Model Commands
194
+ ## Slash Commands
400
195
 
401
196
  | Command | Description |
402
197
  |---------|-------------|
403
- | `/provider <name>` | Switch to a provider (openai, anthropic, etc.) |
404
- | `/providers` | List all configured providers |
405
- | `/model` | Interactive model selection menu |
406
- | `/discover` | Auto-discover models from provider APIs |
407
-
408
- ### Session Commands
409
-
410
- | Command | Description |
411
- |---------|-------------|
412
- | `/sessions list` | Show saved sessions |
413
- | `/sessions save <name>` | Save current session |
414
- | `/sessions load <name>` | Load a saved session |
415
- | `/clear` | Clear conversation history |
416
-
417
- ### Tool Commands
418
-
419
- | Command | Description |
420
- |---------|-------------|
421
- | `/tools` | Manage enabled tool suites |
422
- | `/doctor` | Diagnose environment and credentials |
423
- | `/checks` | Run repo validation (test/build/lint) |
424
-
425
- ### Display Commands
426
-
427
- | Command | Description |
428
- |---------|-------------|
429
- | `/shortcuts` or `/keys` | Show keyboard shortcuts |
430
- | `/thinking [mode]` | Set thinking display (concise/balanced/extended) |
431
- | `/changes` | Show file modifications this session |
432
- | `/metrics` | Show performance metrics |
433
-
434
- ### Other Commands
435
-
436
- | Command | Description |
437
- |---------|-------------|
438
- | `/context` | Refresh workspace context |
439
- | `/agents` | Switch agent profiles |
440
- | `/skills` | Load skill bundles |
441
- | `/local` | Manage local LLM providers |
442
-
443
- ### Keyboard Shortcuts
444
-
445
- | Shortcut | Action |
446
- |----------|--------|
447
- | `Ctrl+C` | Cancel current operation |
448
- | `Ctrl+D` | Exit (when input empty) |
449
- | `Ctrl+G` | Compose multi-line message |
450
- | `Ctrl+O` | Expand collapsed output |
451
- | `Up/Down` | Navigate command history |
198
+ | `/model` | Switch models mid-session |
199
+ | `/provider` | Switch AI providers |
200
+ | `/thinking` | Toggle extended thinking mode |
201
+ | `/tools` | Enable/disable specific tools |
202
+ | `/secrets` | Configure API keys |
203
+ | `/context` | Refresh workspace snapshot |
204
+ | `/sessions` | Manage conversation history |
205
+ | `/doctor` | Check environment readiness |
452
206
 
453
207
  ---
454
208
 
455
- ## Tool Capabilities
456
-
457
- ### Core Tools
458
-
459
- | Tool Suite | Tools | Description |
460
- |------------|-------|-------------|
461
- | **Filesystem** | `read_file`, `write_file`, `list_files` | File I/O operations |
462
- | **Edit** | `edit_file` | Surgical string replacement |
463
- | **Search** | `grep_search`, `find_definition` | Code and text search |
464
- | **Glob** | `glob_files` | Pattern-based file matching |
465
- | **Bash** | `execute_command` | Sandboxed shell execution |
466
-
467
- ### Analysis Tools
468
-
469
- | Tool Suite | Tools | Description |
470
- |------------|-------|-------------|
471
- | **Code Analysis** | `analyze_structure`, `dependency_graph` | AST and dependency analysis |
472
- | **Code Quality** | `lint_check`, `complexity_metrics` | Quality inspection |
473
- | **Refactoring** | `find_hotspots`, `impact_analysis` | Refactoring assistance |
474
- | **Testing** | `run_tests`, `coverage_report` | Test execution |
475
-
476
- ### Integration Tools
477
-
478
- | Tool Suite | Tools | Description |
479
- |------------|-------|-------------|
480
- | **Web** | `fetch_url`, `web_search` | HTTP and search |
481
- | **Git** | `git_status`, `git_diff`, `git_commit` | Version control |
482
- | **MCP** | Dynamic | Model Context Protocol servers |
483
- | **Agent Spawning** | `spawn_agent` | Sub-agent delegation |
484
-
485
- ### Task Management
486
-
487
- | Tool Suite | Tools | Description |
488
- |------------|-------|-------------|
489
- | **Todo** | `todo_write`, `todo_read` | Task tracking |
490
- | **Planning** | `create_plan`, `update_plan` | Multi-step planning |
491
- | **Interaction** | `ask_user` | User clarification |
492
-
493
- ---
494
-
495
- ## Programmatic Usage
496
-
497
- ### TypeScript/Node.js
498
-
499
- ```typescript
500
- import { AgentRuntime } from 'erosolar-cli/core/agent';
501
- import { createDefaultToolRuntime, ToolExecutionContext } from 'erosolar-cli/core/toolRuntime';
502
- import { createProvider } from 'erosolar-cli/providers/providerFactory';
503
-
504
- async function main() {
505
- // Create provider
506
- const provider = createProvider({
507
- provider: 'anthropic',
508
- model: 'claude-sonnet-4-5-20250929',
509
- });
510
-
511
- // Create tool runtime
512
- const context: ToolExecutionContext = {
513
- profileName: 'default',
514
- provider: 'anthropic',
515
- model: 'claude-sonnet-4-5-20250929',
516
- workspaceContext: '/path/to/workspace',
517
- };
518
- const toolRuntime = createDefaultToolRuntime(context, []);
519
-
520
- // Create agent
521
- const agent = new AgentRuntime({
522
- provider,
523
- toolRuntime,
524
- systemPrompt: 'You are a helpful coding assistant.',
525
- });
526
-
527
- // Send message
528
- const response = await agent.send('List all TypeScript files');
529
- console.log(response);
530
- }
531
- ```
532
-
533
- ### Python
534
-
535
- ```python
536
- import asyncio
537
- from erosolar_cli.core.agent import AgentRuntime, AgentOptions
538
- from erosolar_cli.core.tool_runtime import create_default_tool_runtime, ToolExecutionContext
539
- from erosolar_cli.providers.provider_factory import create_provider
540
-
541
- async def main():
542
- # Create provider
543
- provider = create_provider(provider="anthropic", model="claude-sonnet-4")
544
-
545
- # Create tool runtime with core tools
546
- context = ToolExecutionContext(
547
- profile_name="default",
548
- provider="anthropic",
549
- model="claude-sonnet-4",
550
- )
551
- tool_runtime = create_default_tool_runtime(context)
552
-
553
- # Create agent
554
- agent = AgentRuntime(AgentOptions(
555
- provider=provider,
556
- tool_runtime=tool_runtime,
557
- system_prompt="You are a helpful coding assistant.",
558
- ))
559
-
560
- # Send message
561
- response = await agent.send("List all Python files")
562
- print(response)
563
-
564
- asyncio.run(main())
565
- ```
566
-
567
- ### Alpha Zero 2 Direct Usage
568
-
569
- ```python
570
- from erosolar_cli.alpha_zero import (
571
- CompetitiveFramework,
572
- RewardSystem,
573
- TournamentRunner,
574
- TournamentConfig,
575
- )
576
- from pathlib import Path
577
-
578
- # Evaluate code quality
579
- reward_system = RewardSystem()
580
- metrics = await reward_system.evaluate_code('''
581
- def fibonacci(n):
582
- if n <= 1:
583
- return n
584
- return fibonacci(n-1) + fibonacci(n-2)
585
- ''')
586
-
587
- print(f"Quality Score: {metrics.code_quality_score * 100:.1f}/100")
588
- print(f"Efficiency: {metrics.algorithm_efficiency * 100:.1f}/100")
589
-
590
- # Run tournament
591
- config = TournamentConfig(
592
- tournament_id="test-tournament",
593
- task_prompts=[
594
- "Write an efficient prime number checker",
595
- "Implement merge sort with O(n log n) complexity",
596
- ],
597
- rounds_per_task=3,
598
- )
599
-
600
- runner = TournamentRunner(data_dir=Path("./tournaments"))
601
- result = await runner.run(config)
602
-
603
- print(f"Winner: Agent {1 if result.agent1_wins > result.agent2_wins else 2}")
604
- ```
605
-
606
- ### Creating Custom Plugins
607
-
608
- ```python
609
- from erosolar_cli.plugins import Plugin, PluginMetadata, PluginCategory, register_plugin
610
- from erosolar_cli.core.tool_runtime import ToolDefinition, ToolSuite
611
-
612
- @register_plugin
613
- class MyPlugin(Plugin):
614
- metadata = PluginMetadata(
615
- id="my_plugin",
616
- name="My Plugin",
617
- version="1.0.0",
618
- description="Description of what this plugin does",
619
- category=PluginCategory.CODING,
620
- author="Your Name",
621
- )
622
-
623
- def get_tool_suites(self) -> list[ToolSuite]:
624
- async def my_tool_handler(param: str) -> dict:
625
- return {"result": f"Processed: {param}"}
626
-
627
- return [ToolSuite(
628
- id="plugin.my_plugin",
629
- name="My Plugin",
630
- description="My plugin tools",
631
- tools=[
632
- ToolDefinition(
633
- name="my_tool",
634
- description="Does something useful",
635
- parameters={
636
- "type": "object",
637
- "properties": {
638
- "param": {"type": "string", "description": "Input"}
639
- },
640
- "required": ["param"]
641
- },
642
- handler=my_tool_handler,
643
- )
644
- ]
645
- )]
646
- ```
647
-
648
- ---
649
-
650
- ## Schema Architecture
651
-
652
- Erosolar CLI uses a **unified schema architecture** for configuration, providers, tools, and agent behavior. All schemas are JSON-based and version-controlled.
653
-
654
- ### Schema Hierarchy
655
-
656
- ```
657
- contracts/
658
- ├── unified-schema.json # Master schema - single source of truth
659
- ├── agent-schemas.json # Agent and model configurations
660
- ├── tools.schema.json # Tool capability definitions
661
- ├── agent-profiles.schema.json
662
- └── schemas/
663
- ├── agent.schema.json
664
- ├── agent-profile.schema.json
665
- ├── agent-rules.schema.json
666
- ├── agent-schemas.schema.json
667
- └── tool-selection.schema.json
668
- ```
669
-
670
- ### Unified Schema (unified-schema.json)
671
-
672
- The master schema defines all providers, models, and capabilities:
673
-
674
- ```json
675
- {
676
- "contractVersion": "2.0.0",
677
- "providers": [
678
- {
679
- "id": "anthropic",
680
- "label": "Anthropic",
681
- "baseUrl": "https://api.anthropic.com",
682
- "envVars": { "apiKey": "ANTHROPIC_API_KEY" },
683
- "capabilities": ["chat", "reasoning", "tools", "streaming", "vision"],
684
- "models": ["claude-opus-4-5-20251101", "claude-sonnet-4-5-20250929"],
685
- "defaultModel": "claude-sonnet-4-5-20250929"
686
- }
687
- ]
688
- }
689
- ```
690
-
691
- ### Provider Schema
209
+ ## How It Works
692
210
 
693
- Each provider defines:
211
+ 1. **You describe a task** in natural language
212
+ 2. **Erosolar analyzes** the request and plans an approach
213
+ 3. **Tools execute autonomously** - reading files, searching code, making edits
214
+ 4. **Validation runs** - tests, builds, linting
215
+ 5. **Results reported** with what changed and what to verify
694
216
 
695
- | Field | Description |
696
- |-------|-------------|
697
- | `id` | Unique identifier (e.g., "anthropic") |
698
- | `baseUrl` | API endpoint |
699
- | `envVars` | Required environment variables |
700
- | `capabilities` | Supported features (chat, tools, streaming, vision) |
701
- | `models` | Available model IDs |
702
- | `openaiCompatible` | If true, uses OpenAI-compatible API |
703
-
704
- ### Tool Schema (tools.schema.json)
705
-
706
- Tools are organized into capability suites:
707
-
708
- ```json
709
- {
710
- "options": [
711
- {
712
- "id": "filesystem",
713
- "label": "File operations",
714
- "defaultEnabled": true,
715
- "category": "core",
716
- "scopes": ["filesystem:read", "filesystem:write"],
717
- "pluginIds": ["tool.filesystem.local"]
718
- }
719
- ]
720
- }
721
- ```
722
-
723
- ### Agent Rules (agents/*.rules.json)
724
-
725
- Agent behavior is controlled by rules:
726
-
727
- ```json
728
- {
729
- "profile": "erosolar-code",
730
- "globalPrinciples": [
731
- {
732
- "id": "guardrail.snapshot_lock",
733
- "summary": "Require workspace snapshot before editing",
734
- "severity": "critical"
735
- },
736
- {
737
- "id": "guardrail.tool_transparency",
738
- "summary": "Narrate intent before running tools",
739
- "severity": "required"
740
- }
741
- ]
742
- }
743
- ```
744
-
745
- ### Type System (src/core/types.ts)
746
-
747
- TypeScript types mirror the JSON schemas:
748
-
749
- ```typescript
750
- export interface LLMProvider {
751
- readonly id: ProviderId;
752
- readonly model: string;
753
- generate(messages: ConversationMessage[], tools: ProviderToolDefinition[]): Promise<ProviderResponse>;
754
- generateStream?(messages: ConversationMessage[], tools: ProviderToolDefinition[]): AsyncIterableIterator<StreamChunk>;
755
- }
756
-
757
- export interface ProviderToolDefinition {
758
- name: string;
759
- description: string;
760
- parameters?: JSONSchemaObject;
761
- }
762
- ```
763
-
764
- ### Model Discovery
765
-
766
- Models can be statically defined or auto-discovered:
767
-
768
- ```typescript
769
- // Discover models from provider APIs
770
- const result = await discoverAllModels();
771
- // Returns models from OpenAI, Anthropic, Google, etc.
772
-
773
- // Get best model for a provider
774
- const best = getBestModel('anthropic', models);
775
- // Returns highest-priority model based on rankings
776
- ```
217
+ The AI operates within guardrails defined in `agents/*.rules.json`, ensuring safe, auditable behavior.
777
218
 
778
219
  ---
779
220
 
780
221
  ## Configuration
781
222
 
782
- ### Agent Profiles
783
-
784
- Profiles define provider, model, and behavior. Located in `agents/`:
785
-
786
- ```json
787
- {
788
- "profile": "erosolar-code",
789
- "label": "Erosolar Code",
790
- "defaultProvider": "openai",
791
- "defaultModel": "gpt-4o",
792
- "systemPrompt": "You are an expert coding assistant..."
793
- }
794
- ```
795
-
796
- ### MCP Servers
797
-
798
- Add Model Context Protocol servers via `.mcp.json` or `.erosolar/mcp.json`:
799
-
800
- ```json
801
- {
802
- "filesystem": {
803
- "command": "npx",
804
- "args": ["-y", "@modelcontextprotocol/server-filesystem", "${WORKSPACE_ROOT}"]
805
- },
806
- "github": {
807
- "command": "npx",
808
- "args": ["-y", "@modelcontextprotocol/server-github"],
809
- "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
810
- }
811
- }
812
- ```
813
-
814
- ### Skills
815
-
816
- Load reusable knowledge bundles from `SKILL.md` files:
817
-
818
- ```markdown
819
- <!-- SKILL.md -->
820
- # React Component Development
821
-
822
- ## Principles
823
- - Use functional components with hooks
824
- - Implement proper error boundaries
825
- - Follow accessibility guidelines
826
-
827
- ## Patterns
828
- ```typescript
829
- const Component: FC<Props> = ({ data }) => {
830
- const [state, setState] = useState(initial);
831
- // ...
832
- };
833
- ```
834
- ```
835
-
836
- Load with `/skill <name>` or reference in prompts.
837
-
838
- ### Tool Settings
839
-
840
- Configure which tools are enabled via `/tools` command or `~/.erosolar/tools.json`:
841
-
842
- ```json
843
- {
844
- "enabled": ["filesystem", "search", "bash", "edit"],
845
- "disabled": ["web"]
846
- }
847
- ```
848
-
849
- ---
850
-
851
- ## Development
852
-
853
- ### Setup
223
+ ### Environment Variables
854
224
 
855
225
  ```bash
856
- git clone https://github.com/ErosolarAI/erosolar-by-bo.git
857
- cd erosolar-by-bo
858
- npm install
859
- npm run build
860
- ```
226
+ # Choose your provider
227
+ export OPENAI_API_KEY=sk-...
228
+ export ANTHROPIC_API_KEY=sk-ant-...
229
+ export GEMINI_API_KEY=...
230
+ export XAI_API_KEY=...
231
+ export DEEPSEEK_API_KEY=...
861
232
 
862
- ### Development Mode
863
-
864
- ```bash
865
- npm run dev # Run with ts-node
866
- npm run build # Compile TypeScript
867
- npm run type-check # Check types only
233
+ # For local models
234
+ export OLLAMA_BASE_URL=http://localhost:11434
868
235
  ```
869
236
 
870
- ### Testing
237
+ ### Runtime Options
871
238
 
872
239
  ```bash
873
- npm test # Run test suite
874
- npm run lint # Run ESLint
875
- npm run health-check # Validate core components
876
- npm run quality-gate # All quality checks
877
- ```
878
-
879
- ### Project Structure
880
-
881
- ```
882
- src/
883
- ├── bin/ # CLI entry point
884
- ├── core/ # Core types, agent, context management
885
- │ ├── agent.ts
886
- │ ├── types.ts
887
- │ ├── modelDiscovery.ts
888
- │ └── unified/ # Unified schema runtime
889
- ├── providers/ # LLM provider implementations
890
- │ ├── anthropicProvider.ts
891
- │ ├── openaiResponsesProvider.ts
892
- │ └── googleProvider.ts
893
- ├── capabilities/ # Tool implementations
894
- │ ├── filesystemCapability.ts
895
- │ ├── searchCapability.ts
896
- │ └── bashCapability.ts
897
- ├── shell/ # Interactive shell
898
- │ ├── shellApp.ts
899
- │ └── interactiveShell.ts
900
- ├── ui/ # Display and theming
901
- ├── plugins/ # Plugin system
902
- ├── contracts/ # JSON schemas
903
- └── mcp/ # MCP client
904
- ```
240
+ erosolar --help
905
241
 
906
- ### Adding a Provider
907
-
908
- 1. Create provider in `src/providers/`:
909
-
910
- ```typescript
911
- export class CustomProvider implements LLMProvider {
912
- readonly id = 'custom';
913
- readonly model: string;
914
-
915
- async generate(messages, tools) {
916
- // Implementation
917
- }
918
-
919
- async *generateStream(messages, tools) {
920
- // Streaming implementation
921
- }
922
- }
242
+ Options:
243
+ --provider <name> AI provider (openai, anthropic, google, xai, deepseek, ollama)
244
+ --model <name> Specific model to use
245
+ --profile <name> Agent profile (general, erosolar-code)
246
+ --restore Resume last session
247
+ --version Show version
923
248
  ```
924
249
 
925
- 2. Register in `src/plugins/providers/`:
926
-
927
- ```typescript
928
- registerProvider('custom', (config) => new CustomProvider(config));
929
- ```
250
+ ---
930
251
 
931
- 3. Add to `unified-schema.json`:
252
+ ## Architecture
932
253
 
933
- ```json
934
- {
935
- "id": "custom",
936
- "label": "Custom Provider",
937
- "envVars": { "apiKey": "CUSTOM_API_KEY" },
938
- "capabilities": ["chat", "tools", "streaming"]
939
- }
940
254
  ```
941
-
942
- ### Adding a Tool
943
-
944
- 1. Create capability in `src/capabilities/`:
945
-
946
- ```typescript
947
- export function createCustomTools(): ProviderToolDefinition[] {
948
- return [{
949
- name: 'custom_tool',
950
- description: 'Does something useful',
951
- parameters: {
952
- type: 'object',
953
- properties: {
954
- input: { type: 'string', description: 'Input value' }
955
- },
956
- required: ['input']
957
- }
958
- }];
959
- }
960
-
961
- export async function executeCustomTool(args: { input: string }) {
962
- // Implementation
963
- return { result: 'success' };
964
- }
255
+ erosolar-cli/
256
+ ├── src/
257
+ │ ├── core/ # Agent runtime, tool execution
258
+ │ ├── providers/ # OpenAI, Anthropic, Google adapters
259
+ │ ├── tools/ # File, bash, search tools
260
+ │ ├── shell/ # Interactive CLI interface
261
+ │ └── capabilities/ # Tool registration system
262
+ ├── agents/
263
+ │ ├── general.rules.json # General agent guardrails
264
+ │ └── erosolar-code.rules.json # Coding specialist rules
265
+ └── contracts/
266
+ └── agent-schemas.json # Model & provider definitions
965
267
  ```
966
268
 
967
- 2. Register in tool registry
968
-
969
- 3. Add to `tools.schema.json`
970
-
971
269
  ---
972
270
 
973
271
  ## License
974
272
 
975
273
  MIT
976
274
 
275
+ ---
276
+
977
277
  ## Links
978
278
 
979
- - [npm Package (TypeScript)](https://www.npmjs.com/package/erosolar-cli)
980
- - [PyPI Package (Python)](https://pypi.org/project/erosolar/)
981
- - [GitHub Repository](https://github.com/ErosolarAI/erosolar-by-bo)
279
+ - [npm Package](https://www.npmjs.com/package/erosolar-cli)
280
+ - [GitHub](https://github.com/ErosolarAI/erosolar-by-bo)
982
281
  - [Issues](https://github.com/ErosolarAI/erosolar-by-bo/issues)
983
282
 
984
- ## Support
985
-
986
- - Email: support@ero.solar
987
- - GitHub Issues for bug reports and feature requests
283
+ ---
988
284
 
989
- ## Research
285
+ ## Author
990
286
 
991
- Alpha Zero 2 Research: See `src/alpha-zero/` (TypeScript) and `python-bo-cli/erosolar_cli/alpha_zero/` (Python)
287
+ Built by **Bo Shang** with assistance from Claude Code, OpenAI Codex CLI, and a lot of caffeine.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erosolar-cli",
3
- "version": "1.6.13",
3
+ "version": "1.6.14",
4
4
  "description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
5
5
  "main": "dist/bin/erosolar-optimized.js",
6
6
  "type": "module",