openhorse 0.1.21 → 0.1.23

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 (127) hide show
  1. package/README.md +77 -420
  2. package/dist/cli.js +139 -23
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/index.d.ts.map +1 -1
  5. package/dist/commands/index.js +117 -20
  6. package/dist/commands/index.js.map +1 -1
  7. package/dist/commands/types.d.ts +1 -0
  8. package/dist/commands/types.d.ts.map +1 -1
  9. package/dist/commands/types.js.map +1 -1
  10. package/dist/framework/index.d.ts +2 -2
  11. package/dist/framework/index.d.ts.map +1 -1
  12. package/dist/framework/index.js +6 -1
  13. package/dist/framework/index.js.map +1 -1
  14. package/dist/framework/prompt.d.ts +2 -0
  15. package/dist/framework/prompt.d.ts.map +1 -1
  16. package/dist/framework/prompt.js +9 -0
  17. package/dist/framework/prompt.js.map +1 -1
  18. package/dist/framework/query.d.ts +2 -0
  19. package/dist/framework/query.d.ts.map +1 -1
  20. package/dist/framework/query.js +5 -2
  21. package/dist/framework/query.js.map +1 -1
  22. package/dist/harness/assembler.d.ts +14 -2
  23. package/dist/harness/assembler.d.ts.map +1 -1
  24. package/dist/harness/assembler.js +167 -32
  25. package/dist/harness/assembler.js.map +1 -1
  26. package/dist/harness/capsule.d.ts +2 -1
  27. package/dist/harness/capsule.d.ts.map +1 -1
  28. package/dist/harness/capsule.js +64 -0
  29. package/dist/harness/capsule.js.map +1 -1
  30. package/dist/harness/context-harness.d.ts +28 -3
  31. package/dist/harness/context-harness.d.ts.map +1 -1
  32. package/dist/harness/context-harness.js +116 -7
  33. package/dist/harness/context-harness.js.map +1 -1
  34. package/dist/harness/contract.d.ts +2 -2
  35. package/dist/harness/contract.d.ts.map +1 -1
  36. package/dist/harness/contract.js +7 -3
  37. package/dist/harness/contract.js.map +1 -1
  38. package/dist/harness/evidence.d.ts +15 -0
  39. package/dist/harness/evidence.d.ts.map +1 -0
  40. package/dist/harness/evidence.js +171 -0
  41. package/dist/harness/evidence.js.map +1 -0
  42. package/dist/harness/index.d.ts +9 -3
  43. package/dist/harness/index.d.ts.map +1 -1
  44. package/dist/harness/index.js +15 -1
  45. package/dist/harness/index.js.map +1 -1
  46. package/dist/harness/intent.d.ts +4 -0
  47. package/dist/harness/intent.d.ts.map +1 -0
  48. package/dist/harness/intent.js +139 -0
  49. package/dist/harness/intent.js.map +1 -0
  50. package/dist/harness/state.d.ts +12 -0
  51. package/dist/harness/state.d.ts.map +1 -0
  52. package/dist/harness/state.js +84 -0
  53. package/dist/harness/state.js.map +1 -0
  54. package/dist/harness/turn-summary.d.ts +25 -0
  55. package/dist/harness/turn-summary.d.ts.map +1 -0
  56. package/dist/harness/turn-summary.js +120 -0
  57. package/dist/harness/turn-summary.js.map +1 -0
  58. package/dist/harness/types.d.ts +104 -1
  59. package/dist/harness/types.d.ts.map +1 -1
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +6 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/services/compact/auto-compact.d.ts +3 -1
  65. package/dist/services/compact/auto-compact.d.ts.map +1 -1
  66. package/dist/services/compact/auto-compact.js +10 -0
  67. package/dist/services/compact/auto-compact.js.map +1 -1
  68. package/dist/services/compact/compact.d.ts +5 -1
  69. package/dist/services/compact/compact.d.ts.map +1 -1
  70. package/dist/services/compact/compact.js +11 -1
  71. package/dist/services/compact/compact.js.map +1 -1
  72. package/dist/services/config-dir.d.ts +2 -0
  73. package/dist/services/config-dir.d.ts.map +1 -1
  74. package/dist/services/config-dir.js +5 -0
  75. package/dist/services/config-dir.js.map +1 -1
  76. package/dist/services/config.d.ts +3 -0
  77. package/dist/services/config.d.ts.map +1 -1
  78. package/dist/services/config.js +4 -2
  79. package/dist/services/config.js.map +1 -1
  80. package/dist/services/global-config.d.ts +1 -1
  81. package/dist/services/global-config.d.ts.map +1 -1
  82. package/dist/services/global-config.js +13 -8
  83. package/dist/services/global-config.js.map +1 -1
  84. package/dist/services/session-storage.d.ts +9 -1
  85. package/dist/services/session-storage.d.ts.map +1 -1
  86. package/dist/services/session-storage.js +88 -6
  87. package/dist/services/session-storage.js.map +1 -1
  88. package/dist/skills/index.d.ts +1 -0
  89. package/dist/skills/index.d.ts.map +1 -1
  90. package/dist/skills/index.js +1 -0
  91. package/dist/skills/index.js.map +1 -1
  92. package/dist/skills/loader.d.ts.map +1 -1
  93. package/dist/skills/loader.js +33 -15
  94. package/dist/skills/loader.js.map +1 -1
  95. package/dist/skills/runtime.d.ts +36 -0
  96. package/dist/skills/runtime.d.ts.map +1 -0
  97. package/dist/skills/runtime.js +102 -0
  98. package/dist/skills/runtime.js.map +1 -0
  99. package/dist/skills/types.d.ts +4 -0
  100. package/dist/skills/types.d.ts.map +1 -1
  101. package/dist/skills/types.js.map +1 -1
  102. package/dist/tools/git.d.ts.map +1 -1
  103. package/dist/tools/git.js +13 -10
  104. package/dist/tools/git.js.map +1 -1
  105. package/dist/tools/index.d.ts +8 -0
  106. package/dist/tools/index.d.ts.map +1 -1
  107. package/dist/tools/index.js +38 -19
  108. package/dist/tools/index.js.map +1 -1
  109. package/dist/tools/lsp.d.ts.map +1 -1
  110. package/dist/tools/lsp.js +33 -0
  111. package/dist/tools/lsp.js.map +1 -1
  112. package/dist/tools/mcp.d.ts +18 -5
  113. package/dist/tools/mcp.d.ts.map +1 -1
  114. package/dist/tools/mcp.js +160 -27
  115. package/dist/tools/mcp.js.map +1 -1
  116. package/dist/tools/todo.d.ts.map +1 -1
  117. package/dist/tools/todo.js +14 -6
  118. package/dist/tools/todo.js.map +1 -1
  119. package/dist/ui-v2/components/session-picker.d.ts +2 -0
  120. package/dist/ui-v2/components/session-picker.d.ts.map +1 -1
  121. package/dist/ui-v2/components/session-picker.js +34 -5
  122. package/dist/ui-v2/components/session-picker.js.map +1 -1
  123. package/dist/ui-v2/state/sessions.d.ts +1 -0
  124. package/dist/ui-v2/state/sessions.d.ts.map +1 -1
  125. package/dist/ui-v2/state/sessions.js +18 -0
  126. package/dist/ui-v2/state/sessions.js.map +1 -1
  127. package/package.json +1 -1
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ---
12
12
 
13
- **🌍 Language**: English | [简体中文](README.zh-CN.md)
13
+ **🌍 Language**: [English](README.md) | [简体中文](README.zh-CN.md)
14
14
 
15
15
  ---
16
16
 
@@ -18,68 +18,15 @@
18
18
 
19
19
  **OpenHorse** is a terminal-based coding agent that wraps LLM APIs in a harness of safety checks, tool orchestration, session management, and context awareness.
20
20
 
21
- ### Core Design
22
-
23
21
  | Dimension | Description |
24
22
  |-----------|-------------|
25
23
  | **AI as Horse** | Powerful models need guidance and constraints |
26
24
  | **OpenHorse as Reins** | Precise control to prevent runaway behavior |
27
25
  | **Harness System** | Safety boundaries, task constraints, result validation |
28
26
  | **Tool Calling** | LLM autonomously invokes tools to complete tasks |
29
- | **Memory System** | Layered memory: Working / Short-term / Long-term / Semantic |
27
+ | **Memory System** | Layered memory with semantic search |
30
28
  | **MCP Protocol** | Connect external MCP servers for tool extension |
31
29
 
32
- ---
33
-
34
- ## Features
35
-
36
- | Feature | Description |
37
- |---------|-------------|
38
- | **Tool Orchestration** | 20+ built-in tools: file I/O, search, shell, web, memory, todo, plan |
39
- | **Multi-Model** | OpenAI, Claude, DashScope (GLM/Qwen/Kimi), custom endpoints |
40
- | **Context Awareness** | Per-model context windows, token-based auto-compact at 95% |
41
- | **Dynamic Discovery** | Auto-discovers models via `/models` endpoint at startup |
42
- | **MCP Protocol** | Full MCP server connection with heartbeat + reconnect |
43
- | **Memory System** | User / Project / Session memory with semantic search |
44
- | **Session Management** | Persistent sessions, history restore, summary generation |
45
- | **Safety Boundaries** | Bash safety checks, audit logging, permission modes |
46
- | **Streaming Output** | Real-time LLM responses with Markdown rendering |
47
- | **Status Bar** | Live token usage, cost, model, context % display |
48
- | **Simplified Config** | Only 4 user fields — agent controls internals |
49
-
50
- ---
51
-
52
- ## Architecture
53
-
54
- ```
55
- ┌─────────────────────────────────────────────────────────┐
56
- │ CLI Layer │
57
- │ readline + chalk + streaming Markdown + status bar │
58
- └────────────────────────────┬────────────────────────────┘
59
-
60
- ┌────────────────────────────▼────────────────────────────┐
61
- │ Harness Layer │
62
- │ Goal constraints │ Safety checks │ Result validation │
63
- └────────────────────────────┬────────────────────────────┘
64
-
65
- ┌────────────────────────────▼────────────────────────────┐
66
- │ Query Engine │
67
- │ LLM Stream │ Tool Calling │ Retry/Fallback │ Compact │
68
- └──────────┬─────────────────┬─────────────────┬──────────┘
69
- │ │ │
70
- ┌──────────▼─────┐ ┌─────────▼─────┐ ┌─────────▼──────────┐
71
- │ Tools │ │ MCP Client │ │ Skills │
72
- │ File/Bash/Web │ │ Server conn │ │ Builtin/User/Proj │
73
- └─────────────────┘ └───────────────┘ └───────────────────┘
74
-
75
- ┌────────────────────────────▼────────────────────────────┐
76
- │ Memory Layer │
77
- │ User │ Project │ Session │ Semantic Search │ Embeddings │
78
- └─────────────────────────────────────────────────────────┘
79
- ```
80
-
81
- ---
82
-
83
30
  ## Quick Start
84
31
 
85
32
  ### Requirements
@@ -90,48 +37,38 @@
90
37
  ### Install & Run
91
38
 
92
39
  ```bash
93
- # Clone
94
- git clone https://github.com/Linux2010/openhorse.git
95
- cd openhorse
40
+ # Install globally
41
+ npm install -g openhorse
96
42
 
97
- # Install
98
- npm install
99
-
100
- # Build
101
- npm run build
43
+ # Or from source
44
+ git clone https://github.com/Linux2010/openhorse.git
45
+ cd openhorse && npm install && npm run build
102
46
 
103
- # Configure API Key (choose one)
104
- # Option 1: Environment variable
47
+ # Configure API key
105
48
  export OPENHORSE_API_KEY=your-api-key
49
+ # or create ~/.openhorse/openhorse.json on first run
106
50
 
107
- # Option 2: .env file
108
- cp .env.example .env
109
- # Edit .env and set OPENHORSE_API_KEY
110
-
111
- # Option 3: ~/.openhorse/openhorse.json (recommended)
112
- # Created automatically on first run
113
-
114
- # Start interactive CLI
115
- npm start
116
- # or
117
- node dist/cli.js
118
- ```
119
-
120
- ### Global Install
121
-
122
- ```bash
123
- npm link
124
- # Run from any directory
51
+ # Start
125
52
  openhorse
126
53
  ```
127
54
 
128
- ---
55
+ ## Key Features
129
56
 
130
- ## Configuration
57
+ | Feature | Description |
58
+ |---------|-------------|
59
+ | **Tool Orchestration** | 20+ built-in tools: file I/O, shell, web, memory, git, LSP |
60
+ | **Multi-Model** | OpenAI, Claude, GLM, Qwen, DeepSeek, custom endpoints |
61
+ | **Context Awareness** | Per-model context windows, token-based auto-compact at 95% |
62
+ | **MCP Protocol** | stdio MCP servers with heartbeat + reconnect |
63
+ | **Memory System** | User / Project / Session memory with semantic search |
64
+ | **Session Management** | Persistent sessions with history restore |
65
+ | **Safety Boundaries** | Bash safety checks, audit logging, permission modes |
66
+ | **Streaming Output** | Real-time LLM responses with Markdown rendering |
67
+ | **Skills System** | Builtin, user, and project-level skill extensions |
131
68
 
132
- ### User Config (`~/.openhorse/openhorse.json`)
69
+ ## Configuration
133
70
 
134
- Only a small set of fields are user-configurable. The agent controls internal generation parameters.
71
+ Minimal user config the agent controls internal parameters.
135
72
 
136
73
  ```json
137
74
  {
@@ -143,84 +80,32 @@ Only a small set of fields are user-configurable. The agent controls internal ge
143
80
  }
144
81
  ```
145
82
 
146
- | Field | Required | Description |
147
- |-------|----------|-------------|
148
- | `apiKey` | Yes | LLM API key |
149
- | `apiBaseUrl` | No | API endpoint URL |
150
- | `defaultModel` | No | Default model (`glm-5`) |
151
- | `fallbackModel` | No | Fallback model on failure |
152
- | `toolConfirmation` | No | How to handle tools that ask for confirmation: `allow`, `deny`, or `ask`. Defaults to `allow` until the Ink UI can prompt interactively. |
153
- | `webSearch` | No | Optional WebSearch mode/provider overrides. `auto` uses provider MCP first, then adapter fallback (`tavily`, `brave`, `custom`, `ddg`). |
154
-
155
- ### Agent-Controlled Internals
156
-
157
- These parameters are managed by the agent, not exposed to users:
158
-
159
- | Parameter | Default | Description |
160
- |-----------|---------|-------------|
161
- | `maxTokens` | 8192 | Maximum output tokens |
162
- | `temperature` | 0.1 | Sampling temperature |
163
- | `maxRetries` | 3 | Retry attempts on failure |
164
- | `retryBaseDelay` | 1000ms | Base delay between retries |
83
+ | Field | Description |
84
+ |-------|-------------|
85
+ | `apiKey` | LLM API key |
86
+ | `apiBaseUrl` | API endpoint URL |
87
+ | `defaultModel` | Default model |
88
+ | `fallbackModel` | Fallback model on failure |
89
+ | `toolConfirmation` | Tool confirmation mode: `allow`, `deny`, or `ask` |
90
+ | `webSearch` | WebSearch mode/provider: `auto`, `tavily`, `brave`, `ddg` |
165
91
 
166
- ### Configuration Priority
167
-
168
- ```
169
- CLI flags > ~/.openhorse/openhorse.json > env vars > internal defaults
170
- ```
171
-
172
- ### Environment Variables
173
-
174
- | Variable | Default | Description |
175
- |----------|---------|-------------|
176
- | `OPENHORSE_API_KEY` | - | LLM API key |
177
- | `OPENHORSE_API_BASE_URL` | - | API base URL |
178
- | `OPENHORSE_MODEL` | `glm-5` | Default model |
179
- | `OPENHORSE_MODE` | `development` | Run mode |
180
- | `OPENHORSE_LOG_LEVEL` | `info` | Log level |
181
- | `OPENHORSE_TOOL_CONFIRMATION` | `allow` | Tool confirmation fallback: `allow`, `deny`, or `ask` |
182
- | `OPENHORSE_WEBSEARCH_PROVIDER` | `auto` | WebSearch mode/provider: `auto`, `native`, `bailian`, `zhipu`, `tavily-mcp`, `tavily`, `brave`, `custom`, `ddg` |
183
- | `OPENHORSE_WEBSEARCH_API_KEY` | configured API key | Provider-specific API key for MCP or adapters |
184
- | `OPENHORSE_WEBSEARCH_MCP_ENDPOINT` | provider default | WebSearch MCP endpoint override |
185
- | `OPENHORSE_WEBSEARCH_AUTH_TYPE` | `bearer` | MCP API key auth style: `bearer`, `header`, `query`, or `none` |
186
- | `OPENHORSE_EMBEDDING_PROVIDER` | - | Embedding service (ollama/openai) |
92
+ Configuration priority: `CLI flags > ~/.openhorse/openhorse.json > env vars > defaults`
187
93
 
188
94
  See [docs/config.md](docs/config.md) for full details.
189
95
 
190
- ---
191
-
192
96
  ## Models
193
97
 
194
- ### Supported Model Families
195
-
196
- | Provider | Models | Endpoint |
197
- |----------|--------|----------|
198
- | **GLM (智谱)** | `glm-5`, `glm-4` | DashScope coding |
199
- | **Qwen (通义)** | `qwen-turbo`, `qwen-plus`, `qwen-max`, `qwen-long` | DashScope coding |
200
- | **OpenAI** | `gpt-4o`, `gpt-4o-mini`, `gpt-4` | OpenAI API |
201
- | **Claude** | `claude-sonnet-4-6`, `claude-opus-4-8` | Anthropic API |
202
- | **DeepSeek** | `deepseek-chat`, `deepseek-reasoner` | DeepSeek API |
203
-
204
- ### Context Windows
98
+ OpenHorse supports OpenAI-compatible providers and auto-discovers model context windows at startup via the `/models` endpoint.
205
99
 
206
- OpenHorse tracks each model's context window and auto-compacts at **95% usage**:
100
+ | Provider | Example Models |
101
+ |----------|---------------|
102
+ | **GLM (智谱)** | `glm-5`, `glm-4` |
103
+ | **Qwen (通义)** | `qwen-turbo`, `qwen-plus`, `qwen-max`, `qwen-long` |
104
+ | **OpenAI** | `gpt-4o`, `gpt-4o-mini`, `gpt-4` |
105
+ | **Claude** | `claude-sonnet-4-6`, `claude-opus-4-8` |
106
+ | **DeepSeek** | `deepseek-chat`, `deepseek-reasoner` |
207
107
 
208
- | Model | Context | Max Output |
209
- |-------|---------|------------|
210
- | `glm-5` | 202,752 | 8,192 |
211
- | `qwen-long` | 1,000,000 | 8,192 |
212
- | `qwen-plus` | 131,072 | 8,192 |
213
- | `gpt-4o` | 128,000 | 16,384 |
214
- | `claude-sonnet-4-6` | 200,000 | 16,000 |
215
- | `claude-opus-4-8` | 200,000 | 32,000 |
216
-
217
- Unknown models default to **128,000** context.
218
-
219
- ### Dynamic Discovery
220
-
221
- At startup, OpenHorse queries the `/models` endpoint for context window data. If unsupported (e.g., DashScope coding returns 404), it falls back to the builtin database silently.
222
-
223
- ### Model Commands
108
+ Context usage is tracked in real tokens. When usage reaches **95%**, auto-compact generates a summary of early messages to free up space.
224
109
 
225
110
  ```bash
226
111
  /model # Show current model
@@ -228,301 +113,73 @@ At startup, OpenHorse queries the `/models` endpoint for context window data. If
228
113
  /model glm-5 # Switch to GLM-5
229
114
  ```
230
115
 
231
- ---
232
-
233
116
  ## Tools
234
117
 
235
- 20+ built-in tools available for LLM invocation:
236
-
237
- ### File Operations
238
-
239
- | Tool | Description |
240
- |------|-------------|
241
- | `read_file` | Read file contents |
242
- | `write_file` | Write to a file |
243
- | `edit_file` | Edit file (line replacement) |
244
- | `list_files` | List directory contents |
245
- | `glob` | Glob pattern file search |
246
- | `grep` | Regex search file contents |
247
-
248
- ### Shell
249
-
250
- | Tool | Description |
251
- |------|-------------|
252
- | `exec_command` | Execute shell command (with safety checks) |
253
-
254
- ### Network
255
-
256
- | Tool | Description |
257
- |------|-------------|
258
- | `web_fetch` | Fetch web page content |
259
- | `web_search` | Web search through configured provider MCP service |
260
-
261
- ### Memory
262
-
263
- | Tool | Description |
264
- |------|-------------|
265
- | `memory_save` | Save a memory entry |
266
- | `memory_recall` | Search memories |
267
- | `memory_forget` | Delete a memory entry |
268
-
269
- ### Task Management
118
+ 20+ built-in tools the LLM can invoke:
270
119
 
271
- | Tool | Description |
272
- |------|-------------|
273
- | `todo_write` | Create/update todo list |
274
- | `enter_plan_mode` | Enter plan mode |
275
- | `exit_plan_mode` | Exit plan mode |
276
-
277
- ---
278
-
279
- ## Context Management
280
-
281
- ### Auto-Compact
282
-
283
- When context usage reaches **95%**, OpenHorse automatically compacts the conversation history:
284
-
285
- 1. **Generates a summary** of early messages via the LLM
286
- 2. **Replaces** old messages with a `[Context Summary]` block
287
- 3. **Preserves** the system message and recent messages
288
- 4. **Displays** compact notification in the status bar
289
-
290
- ```
291
- Compact: 30 → 8 messages | Context: 45% → 12%
292
- ```
293
-
294
- ### Token-Based Threshold
295
-
296
- Unlike message-count-based approaches, OpenHorse uses **actual token counts** from the API response for precise context awareness:
297
-
298
- ```
299
- ctxPercent = (promptTokens / modelContextWindow) × 100
300
- ```
301
-
302
- Compact triggers only when `ctxPercent >= 95%`, not based on message count.
303
-
304
- ### 30-Second Interval
305
-
306
- To avoid over-compact, auto-compact runs at most once per 30 seconds. Manual `/compact` command bypasses this interval.
307
-
308
- ---
120
+ | Category | Tools |
121
+ |----------|-------|
122
+ | **File** | `read_file`, `write_file`, `edit_file`, `list_files`, `glob`, `grep` |
123
+ | **Shell** | `exec_command` (with safety checks) |
124
+ | **Network** | `web_fetch`, `web_search` |
125
+ | **Memory** | `memory_save`, `memory_recall`, `memory_forget` |
126
+ | **Task** | `todo_write`, `enter_plan_mode`, `exit_plan_mode` |
127
+ | **Git** | `git_command` |
128
+ | **MCP** | Connected MCP server tools (e.g. `mcp__filesystem__read_file`) |
309
129
 
310
130
  ## MCP Protocol
311
131
 
312
- Full support for MCP (Model Context Protocol) servers:
313
-
314
- ### Configure MCP Servers
315
-
316
- Create `~/.openhorse/mcp.json`:
132
+ OpenHorse connects stdio MCP servers and exposes their tools to the agent.
317
133
 
318
134
  ```json
135
+ // ~/.openhorse/mcp.json
319
136
  {
320
- "servers": {
137
+ "mcpServers": {
321
138
  "telegram": {
322
139
  "command": "node",
323
- "args": ["path/to/plugin-telegram/dist/index.js"],
324
- "env": {}
325
- },
326
- "filesystem": {
327
- "command": "npx",
328
- "args": ["-y", "@anthropic/mcp-server-filesystem", "/allowed/dir"]
140
+ "args": ["path/to/plugin-telegram/dist/index.js"]
329
141
  }
330
142
  }
331
143
  }
332
144
  ```
333
145
 
334
- ### MCP Commands
335
-
336
146
  ```bash
337
147
  /mcp # Show MCP server connection status
338
148
  ```
339
149
 
340
- Servers connect automatically at startup with heartbeat monitoring and exponential backoff reconnect.
341
-
342
- ---
343
-
344
150
  ## Interactive Commands
345
151
 
346
- | Command | Alias | Description |
347
- |---------|-------|-------------|
348
- | `/help` | `/h` | Show help information |
349
- | `/status` | `/s` | System status overview |
350
- | `/model` | - | View or switch models |
351
- | `/config` | - | Show current configuration |
352
- | `/cost` | - | Show session token usage and cost |
353
- | `/compact` | - | Manually trigger context compact |
354
- | `/sessions` | - | List recent sessions |
355
- | `/resume` | - | Resume last session |
356
- | `/memory` | - | Memory system status |
357
- | `/memory reindex` | - | Rebuild semantic search index |
358
- | `/skills` | - | List loaded skills |
359
- | `/mcp` | - | MCP server status |
360
- | `/agents` | - | List available agents |
361
- | `/safety` | - | Safety check configuration |
362
- | `/task` | - | Task management |
363
- | `/run` | - | Execute task via agent |
364
- | `/clear` | - | Clear screen |
365
- | `/clear-history` | `/reset` | Clear conversation history |
366
- | `/exit` | `/q` | Exit |
367
-
368
- ---
369
-
370
- ## Project Structure
371
-
372
- ```
373
- openhorse/
374
- ├── bin/
375
- │ └── openhorse # CLI entry point
376
- ├── src/
377
- │ ├── cli.ts # CLI interactive entry
378
- │ ├── commands/ # Slash commands
379
- │ │ ├── index.ts # Command registry
380
- │ │ ├── parser.ts # Input parser
381
- │ │ └── types.ts # Command types
382
- │ ├── core/ # Core logic
383
- │ │ ├── agent.ts # Agent base class
384
- │ │ ├── brain.ts # Decision engine
385
- │ │ └── strategy-tracker.ts # Strategy tracking
386
- │ ├── agents/ # Agent implementations
387
- │ │ ├── leader.ts # Coordinator agent
388
- │ │ ├── coder.ts # Coding agent
389
- │ │ └── router.ts # Agent router
390
- │ ├── framework/
391
- │ │ ├── store.ts # State management
392
- │ │ ├── query.ts # Query engine (async generator)
393
- │ │ └── tool-state.ts # Tool state
394
- │ ├── harness/ # Safety & constraints
395
- │ │ ├── safety.ts # Safety boundary checks
396
- │ │ └── bash-safety.ts # Bash command safety
397
- │ ├── memory/ # Memory system
398
- │ │ ├── storage.ts # Memory storage
399
- │ │ ├── semantic-search.ts # Semantic search
400
- │ │ ├── embeddings.ts # Embedding generation
401
- │ │ └── vector-store.ts # Vector store (SQLite vec0)
402
- │ ├── skills/ # Skill system
403
- │ │ ├── loader.ts # Skill loader
404
- │ │ └── registry.ts # Skill registry
405
- │ ├── services/
406
- │ │ ├── llm.ts # LLM service (retry/fallback)
407
- │ │ ├── config.ts # Config loading
408
- │ │ ├── global-config.ts # Global config
409
- │ │ ├── model-context.ts # Model context window DB + discovery
410
- │ │ ├── session-storage.ts # Session persistence
411
- │ │ ├── atomic-write.ts # Atomic file writes
412
- │ │ ├── agent-runner.ts # Agent runner
413
- │ │ ├── task-manager.ts # Task manager
414
- │ │ └── file-glob.ts # File matching
415
- │ ├── services/compact/ # Context compaction
416
- │ │ ├── auto-compact.ts # Token-based auto-compact
417
- │ │ ├── compact.ts # Compact implementation
418
- │ │ └── summary-generator.ts # Summary generation
419
- │ ├── tools/ # Tool implementations
420
- │ │ ├── index.ts # Tool registry
421
- │ │ ├── mcp.ts # MCP client
422
- │ │ ├── todo.ts # Todo tool
423
- │ │ ├── plan.ts # Plan tool
424
- │ │ ├── web.ts # Web tools
425
- │ │ └── memory.ts # Memory tools
426
- │ └── ui/ # UI components
427
- │ ├── box.ts # UI boxes
428
- │ ├── markdown.ts # Markdown rendering
429
- │ ├── status-bar.ts # Status bar
430
- │ ├── stream-markdown.ts # Streaming Markdown
431
- │ ├── tool-preview.ts # Tool preview cards
432
- │ └── suggestions.ts # Command suggestions
433
- ├── tests/ # Test suite
434
- ├── docs/ # Documentation
435
- │ ├── version/ # Version release notes
436
- │ ├── roadmap/ # Version roadmaps
437
- │ └── config.md # Configuration guide
438
- ├── .env.example # Environment template
439
- ├── package.json
440
- └── tsconfig.json
441
- ```
442
-
443
- ---
444
-
445
- ## Version History
446
-
447
- ### v0.1.16 (Current — in development)
448
-
449
- - **Token-based auto-compact** at 95% context usage (replaces message-count threshold)
450
- - **Model context awareness** — per-model context windows (15+ known models)
451
- - **Dynamic model discovery** — queries `/models` endpoint at startup
452
- - **Simplified user config** — core fields: `apiKey`, `apiBaseUrl`, `defaultModel`, `fallbackModel`, `toolConfirmation`
453
- - **Provider WebSearch** — `web_search` delegates to WebSearch MCP instead of scraping search engines locally
454
- - **Agent-controlled internals** — `maxTokens`, `temperature`, `retries` managed internally
455
- - **Fallback model** configurable by user
456
- - **Streamlined command panel** rendering
457
- - **Context harness workflow** for multi-agent context orchestration
458
-
459
- ### v0.1.15
460
-
461
- - **Full Markdown streaming** rendering with syntax highlighting
462
- - **CJK text width** calculation fix for terminal display
463
- - **Command panel** input clearing improvements
464
- - Table rendering removed (raw passthrough)
465
-
466
- ### v0.1.14
467
-
468
- - LSP crash fix, compact UI, concise agent output
469
-
470
- ### v0.1.10 — v0.1.13
471
-
472
- - MCP client with heartbeat/reconnect, semantic search, skills system, atomic writes, model aliases (Bailian), storage fixes
473
-
474
- ### v0.1.1 — v0.1.9
475
-
476
- - CLI framework, harness system, memory system, session management, tool orchestration
477
-
478
- See `docs/version/` for detailed release notes.
479
-
480
- ---
152
+ | Command | Description |
153
+ |---------|-------------|
154
+ | `/help` `/h` | Show help |
155
+ | `/status` `/s` | System status |
156
+ | `/model` | View or switch models |
157
+ | `/config` | Show configuration |
158
+ | `/cost` | Token usage and cost |
159
+ | `/compact` | Trigger context compact |
160
+ | `/sessions` | List recent sessions |
161
+ | `/resume` | Resume last session |
162
+ | `/memory` | Memory system status |
163
+ | `/skills` | List loaded skills |
164
+ | `/mcp` | MCP server status |
165
+ | `/clear` | Clear screen |
166
+ | `/exit` `/q` | Exit |
481
167
 
482
168
  ## Development
483
169
 
484
170
  ```bash
485
- # Install dependencies
486
- npm install
487
-
488
- # Development mode (hot reload)
489
- npm run dev
490
-
491
- # Build
492
- npm run build
493
-
494
- # Run tests
495
- npm test
496
-
497
- # Lint
498
- npm run lint
499
-
500
- # Format
501
- npm run format
171
+ npm install # Install dependencies
172
+ npm run dev # Development mode (hot reload)
173
+ npm run build # Build
174
+ npm test # Run tests
175
+ npm run lint # Lint
176
+ npm run format # Format
502
177
  ```
503
178
 
504
- ---
505
-
506
- ## Roadmap
507
-
508
- | Version | Target |
509
- |---------|--------|
510
- | v0.1.16 | Context awareness, auto-compact, config simplification |
511
- | v0.1.17 | Agent lifecycle improvements, enhanced tool orchestration |
512
- | v0.1.18 | Plugin/hook system for extensibility |
513
- | v0.1.19 | VS Code extension |
514
- | v0.1.20 | Web UI dashboard |
515
-
516
- See `docs/roadmap/` for details.
517
-
518
- ---
519
-
520
179
  ## Contributing
521
180
 
522
181
  Issues and Pull Requests are welcome!
523
182
 
524
- ---
525
-
526
183
  ## License
527
184
 
528
185
  MIT License — see [LICENSE](LICENSE) for details.