stratum-cli 0.2.1-beta.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/.stratumrc.json.example +118 -0
- package/LICENSE +21 -0
- package/README.md +155 -0
- package/STRATUM.md +25 -0
- package/dist/index.js +13943 -0
- package/package.json +98 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"provider": {
|
|
3
|
+
"default": "local-ollama",
|
|
4
|
+
"providers": {
|
|
5
|
+
"local-ollama": {
|
|
6
|
+
"type": "openai-compatible",
|
|
7
|
+
"baseUrl": "http://localhost:11434/v1",
|
|
8
|
+
"model": "qwen3.5:9b",
|
|
9
|
+
"apiKey": "ollama",
|
|
10
|
+
"contextWindow": 32768
|
|
11
|
+
},
|
|
12
|
+
"litellm-proxy": {
|
|
13
|
+
"type": "openai-compatible",
|
|
14
|
+
"baseUrl": "http://localhost:4000/v1",
|
|
15
|
+
"model": "claude-sonnet-4-5",
|
|
16
|
+
"apiKey": "${LITELLM_API_KEY}",
|
|
17
|
+
"contextWindow": 200000
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"memory": {
|
|
22
|
+
"projectFile": "./STRATUM.md",
|
|
23
|
+
"globalFile": "~/.stratum/STRATUM.md",
|
|
24
|
+
"decisionsFile": "~/.stratum/memory/decisions.json",
|
|
25
|
+
"vectorDb": "~/.stratum/memory/vectors.db",
|
|
26
|
+
"embeddingModel": "Xenova/all-MiniLM-L6-v2",
|
|
27
|
+
"embeddingDimension": 384,
|
|
28
|
+
"embeddingEndpoint": {
|
|
29
|
+
"url": "http://localhost:11434/v1/embeddings",
|
|
30
|
+
"model": "all-minilm",
|
|
31
|
+
"apiKey": ""
|
|
32
|
+
},
|
|
33
|
+
"retrievalTopK": 5,
|
|
34
|
+
"similarityThreshold": 0.9,
|
|
35
|
+
"autoExtract": true,
|
|
36
|
+
"extractionModel": "qwen3.5:9b",
|
|
37
|
+
"embeddingWarmup": false
|
|
38
|
+
},
|
|
39
|
+
"tools": {
|
|
40
|
+
"confirmDestructive": true,
|
|
41
|
+
"bashTimeout": 30000,
|
|
42
|
+
"webSearch": {
|
|
43
|
+
"backend": "meta",
|
|
44
|
+
"tavilyApiKey": "${TAVILY_API_KEY}",
|
|
45
|
+
"maxResults": 10
|
|
46
|
+
},
|
|
47
|
+
"destructivePatterns": ["rm", "rmdir", "dd", "mkfs", "format", "DROP", "DELETE", "truncate", "shred", "wipefs"]
|
|
48
|
+
},
|
|
49
|
+
"mcp": {
|
|
50
|
+
"startup": "lazy",
|
|
51
|
+
"installDir": "~/.stratum/mcp",
|
|
52
|
+
"autoInstall": true,
|
|
53
|
+
"heartbeatInterval": 30000,
|
|
54
|
+
"servers": [
|
|
55
|
+
{
|
|
56
|
+
"name": "filesystem",
|
|
57
|
+
"package": "@modelcontextprotocol/server-filesystem@2025.8.21",
|
|
58
|
+
"args": ["/home/user/projects"],
|
|
59
|
+
"startupTimeout": 15000
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "chrome-devtools",
|
|
63
|
+
"package": "chrome-devtools-mcp@0.6.0"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "legacy-npx",
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "some-mcp-server@latest"]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"agent": {
|
|
73
|
+
"maxIterations": 50,
|
|
74
|
+
"maxToolRetries": 3,
|
|
75
|
+
"toolErrorFormat": "xml",
|
|
76
|
+
"compressionKeepRounds": 6
|
|
77
|
+
},
|
|
78
|
+
"agents": {
|
|
79
|
+
"defaultProfile": "general",
|
|
80
|
+
"maxConcurrency": 1
|
|
81
|
+
},
|
|
82
|
+
"logging": {
|
|
83
|
+
"level": "info",
|
|
84
|
+
"stderr": true,
|
|
85
|
+
"redact": true,
|
|
86
|
+
"file": {
|
|
87
|
+
"enabled": false,
|
|
88
|
+
"dir": "~/.stratum/logs",
|
|
89
|
+
"maxBytes": 5242880,
|
|
90
|
+
"maxFiles": 5
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"ssh": {
|
|
94
|
+
"auditLog": true,
|
|
95
|
+
"hosts": {
|
|
96
|
+
"bastion": {
|
|
97
|
+
"host": "bastion.example.com",
|
|
98
|
+
"port": 22,
|
|
99
|
+
"user": "javi",
|
|
100
|
+
"privateKey": "~/.ssh/id_ed25519"
|
|
101
|
+
},
|
|
102
|
+
"prod-web": {
|
|
103
|
+
"host": "192.168.1.10",
|
|
104
|
+
"port": 22,
|
|
105
|
+
"user": "javi",
|
|
106
|
+
"privateKey": "~/.ssh/id_ed25519",
|
|
107
|
+
"jumpHost": "bastion",
|
|
108
|
+
"confirmAll": true
|
|
109
|
+
},
|
|
110
|
+
"dev-server": {
|
|
111
|
+
"host": "10.0.0.5",
|
|
112
|
+
"port": 22,
|
|
113
|
+
"user": "javi",
|
|
114
|
+
"useAgent": true
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Javier (choruzo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/choruzo/CLI/main/assets/banner.png" alt="STRATUM" width="640" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div align="center">
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/stratum-cli)
|
|
8
|
+
[](https://nodejs.org)
|
|
9
|
+
[](https://github.com/choruzo/CLI/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
**Agente CLI extensible · Provider-agnostic · Local-first**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Stratum es un agente de línea de comandos construido sobre un loop **ReAct** (Reason → Act → Observe), con **plan-and-execute**, **subagentes** y **SSH nativo**. Funciona con cualquier API OpenAI-compatible: Ollama, llama.cpp, vLLM, LiteLLM y OpenAI nativo. No requiere ninguna cuenta ni API key propietaria.
|
|
18
|
+
|
|
19
|
+
## Instalación
|
|
20
|
+
|
|
21
|
+
Requiere **Node.js 22 o superior**.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g stratum-cli
|
|
25
|
+
stratum --help
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
También puedes ejecutarlo sin instalar:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx stratum-cli chat
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Inicio rápido
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 1. Apunta Stratum a tu backend (asistente interactivo)
|
|
38
|
+
stratum provider add
|
|
39
|
+
|
|
40
|
+
# 2. Genera STRATUM.md con el contexto del proyecto
|
|
41
|
+
stratum init
|
|
42
|
+
|
|
43
|
+
# 3. Sesión interactiva
|
|
44
|
+
stratum chat
|
|
45
|
+
|
|
46
|
+
# ...o una tarea one-shot
|
|
47
|
+
stratum run "Analiza ./src y resume la arquitectura"
|
|
48
|
+
|
|
49
|
+
# ...o modo plan-and-execute (planifica, aprueba, ejecuta)
|
|
50
|
+
stratum run --plan "Refactoriza el módulo de autenticación"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Capacidades
|
|
54
|
+
|
|
55
|
+
| Área | Detalle |
|
|
56
|
+
|---|---|
|
|
57
|
+
| Loop ReAct + streaming | Iteraciones con tool calls, compresión de contexto automática |
|
|
58
|
+
| Provider router | Fallback automático entre providers, health check en background, `/provider` en sesión |
|
|
59
|
+
| Tools built-in | `read_file`, `write_file`, `edit_file`, `glob`, `list_directory`, `grep`, `bash`, `web_search`, `web_fetch`, `question` |
|
|
60
|
+
| SSH nativo | `ssh_exec`, `ssh_upload`, `ssh_download` sobre `ssh2` — nunca invoca el binario `ssh` del sistema |
|
|
61
|
+
| Confirmación destructiva | Interactiva en `chat`, readline en `run`, deny automático sin TTY |
|
|
62
|
+
| Cliente MCP | Arranque lazy/eager, heartbeat, backoff, carpeta gestionada `~/.stratum/mcp/` |
|
|
63
|
+
| Memoria en 3 capas | `STRATUM.md` · `decisions.json` · índice semántico `vectors.db` |
|
|
64
|
+
| Plan & Execute | Planificación en 3 fases con aprobación interactiva y persistencia incremental |
|
|
65
|
+
| Multi-agente | `delegate_task`, perfiles markdown, ejecución paralela acotada, árbol vivo e inspector `/subagents` |
|
|
66
|
+
| Sesiones persistentes | `list`, `resume`, `delete`, `prune` |
|
|
67
|
+
|
|
68
|
+
## Configuración
|
|
69
|
+
|
|
70
|
+
`stratum init` y `stratum provider add` crean la configuración por ti. También puedes escribir `.stratumrc.json` a mano en la raíz del proyecto:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"provider": {
|
|
75
|
+
"default": "local-ollama",
|
|
76
|
+
"providers": {
|
|
77
|
+
"local-ollama": {
|
|
78
|
+
"type": "openai-compatible",
|
|
79
|
+
"baseUrl": "http://localhost:11434/v1",
|
|
80
|
+
"model": "qwen2.5-coder:32b",
|
|
81
|
+
"apiKey": "ollama",
|
|
82
|
+
"contextWindow": 32768
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> Las variables `${VAR_NAME}` se expanden desde el entorno al cargar la config.
|
|
90
|
+
> `contextWindow` debe reflejar el contexto **real** de tu servidor — un valor incorrecto degrada la calidad de `stratum init`.
|
|
91
|
+
> El ejemplo completo con todas las secciones está en [`.stratumrc.json.example`](https://github.com/choruzo/CLI/blob/main/stratum-cli/.stratumrc.json.example).
|
|
92
|
+
|
|
93
|
+
### Hosts remotos (SSH)
|
|
94
|
+
|
|
95
|
+
Las tools `ssh_exec`, `ssh_upload` y `ssh_download` **solo se registran si defines un inventario** — sin sección `ssh`, el modelo ni siquiera las ve. El agente se refiere a los hosts **solo por su alias**; las credenciales nunca pasan por el modelo.
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"ssh": {
|
|
100
|
+
"hosts": {
|
|
101
|
+
"bastion": { "host": "bastion.example.com", "user": "javi", "privateKey": "~/.ssh/id_ed25519" },
|
|
102
|
+
"prod-web": { "host": "192.168.1.10", "user": "javi", "privateKey": "~/.ssh/id_ed25519", "jumpHost": "bastion", "confirmAll": true }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
La primera conexión muestra el fingerprint y pregunta (TOFU); después verifica en silencio contra `~/.stratum/known_hosts.json`. Si la host key cambia, la conexión se **aborta siempre** — no hay override interactivo. Cada comando remoto queda registrado en `~/.stratum/logs/ssh-audit.jsonl`.
|
|
109
|
+
|
|
110
|
+
> **Sobre la detección de comandos destructivos:** es una red de seguridad blanda contra descuidos del modelo, no un control real — un `base64 -d | sh` la esquiva sin esfuerzo. La defensa de verdad en hosts de producción es `confirmAll: true`.
|
|
111
|
+
|
|
112
|
+
### Dependencias opcionales
|
|
113
|
+
|
|
114
|
+
La búsqueda semántica de memoria (capa 3) usa `@xenova/transformers`, `better-sqlite3` y `sqlite-vec`, declaradas como `optionalDependencies`. Si su compilación nativa falla o las omites, Stratum **sigue funcionando**: el índice degrada a una búsqueda brute-force en JS y `decisions.json` nunca se pierde.
|
|
115
|
+
|
|
116
|
+
## Comandos
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
stratum chat Sesión interactiva
|
|
120
|
+
stratum chat --resume <id> Reanuda una sesión guardada
|
|
121
|
+
stratum run "<tarea>" Tarea one-shot
|
|
122
|
+
stratum run --plan "<tarea>" Modo plan-and-execute
|
|
123
|
+
stratum run --allow-destructive "..." Aprueba tools destructivas automáticamente
|
|
124
|
+
stratum run --deny-destructive "..." Deniega tools destructivas automáticamente
|
|
125
|
+
stratum init [--force] [--dry-run] Genera/actualiza STRATUM.md
|
|
126
|
+
stratum config get|set <clave> [valor] Lee/escribe configuración
|
|
127
|
+
stratum sessions list|resume|delete|prune Gestión de sesiones
|
|
128
|
+
stratum memory list|search|forget Gestión de la memoria de decisiones
|
|
129
|
+
stratum mcp list|install [server] Servidores MCP
|
|
130
|
+
stratum providers Providers configurados
|
|
131
|
+
stratum ssh list|trust <alias> Inventario SSH y host keys
|
|
132
|
+
stratum logs path|tail [n] Fichero de logs (bug reports)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Dentro de `stratum chat`:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
/plan <tarea> Inicia el modo plan-and-execute
|
|
139
|
+
/subagents Inspector de transcripts de subagentes
|
|
140
|
+
/provider <name> Cambia de provider en la sesión activa
|
|
141
|
+
/model Selecciona modelo (descubrimiento en vivo)
|
|
142
|
+
/memory list|search|forget Memoria de decisiones desde el chat
|
|
143
|
+
/tools Tools disponibles, incluidas las MCP
|
|
144
|
+
/context · /compact · /clear Gestión del contexto de la conversación
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Enlaces
|
|
148
|
+
|
|
149
|
+
- **Código y documentación:** [github.com/choruzo/CLI](https://github.com/choruzo/CLI)
|
|
150
|
+
- **Roadmap y especificaciones:** [`STRATUM_PROJECT_DEFINITION.md`](https://github.com/choruzo/CLI/blob/main/STRATUM_PROJECT_DEFINITION.md)
|
|
151
|
+
- **Incidencias:** [github.com/choruzo/CLI/issues](https://github.com/choruzo/CLI/issues)
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
<div align="center"><sub>MIT License</sub></div>
|
package/STRATUM.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Stratum Memory
|
|
2
|
+
|
|
3
|
+
## Proyecto
|
|
4
|
+
<!-- Nombre del proyecto, descripción breve, propósito principal -->
|
|
5
|
+
|
|
6
|
+
## Stack Tecnológico
|
|
7
|
+
<!-- Lenguajes, frameworks, librerías principales, versiones clave -->
|
|
8
|
+
|
|
9
|
+
## Estructura
|
|
10
|
+
<!-- Árbol de directorios relevante con descripción de cada carpeta -->
|
|
11
|
+
|
|
12
|
+
## Convenciones
|
|
13
|
+
<!-- Estilo de código, naming, reglas de commits, patrones detectados -->
|
|
14
|
+
|
|
15
|
+
## Comandos Clave
|
|
16
|
+
<!-- Scripts de build, test, dev, lint — exactamente como aparecen en el manifiesto -->
|
|
17
|
+
|
|
18
|
+
## Instrucciones para el agente
|
|
19
|
+
<!-- Escribe aquí las instrucciones permanentes que el agente debe respetar en cada sesión.
|
|
20
|
+
Ejemplos:
|
|
21
|
+
- Confirmar siempre antes de ejecutar comandos destructivos
|
|
22
|
+
- Responder en español
|
|
23
|
+
- Al tocar archivos de configuración de VMware, mostrar un diff antes de aplicar
|
|
24
|
+
- Preferir editar archivos existentes antes de crear nuevos
|
|
25
|
+
-->
|