@newsails/veil-cli 1.0.1

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 (199) hide show
  1. package/.veil/agents/analyst/AGENT.md +21 -0
  2. package/.veil/agents/analyst/agent.json +23 -0
  3. package/.veil/agents/assistant/AGENT.md +15 -0
  4. package/.veil/agents/assistant/agent.json +19 -0
  5. package/.veil/agents/coder/AGENT.md +18 -0
  6. package/.veil/agents/coder/agent.json +19 -0
  7. package/.veil/agents/hello/AGENT.md +5 -0
  8. package/.veil/agents/hello/agent.json +13 -0
  9. package/.veil/agents/writer/AGENT.md +12 -0
  10. package/.veil/agents/writer/agent.json +17 -0
  11. package/.veil/memory/MEMORY.md +343 -0
  12. package/.veil/memory/agents/analyst/MEMORY.md +55 -0
  13. package/.veil/memory/agents/hello/MEMORY.md +12 -0
  14. package/.veil/runtime.pid +1 -0
  15. package/.veil/settings.json +10 -0
  16. package/.veil-studio/studio.db +0 -0
  17. package/.veil-studio/studio.db-shm +0 -0
  18. package/.veil-studio/studio.db-wal +0 -0
  19. package/PLAN/01-vision.md +26 -0
  20. package/PLAN/02-tech-stack.md +94 -0
  21. package/PLAN/03-agents.md +232 -0
  22. package/PLAN/04-runtime.md +171 -0
  23. package/PLAN/05-tools.md +211 -0
  24. package/PLAN/06-communication.md +243 -0
  25. package/PLAN/07-storage.md +218 -0
  26. package/PLAN/08-api-cli.md +153 -0
  27. package/PLAN/09-permissions.md +108 -0
  28. package/PLAN/10-ably.md +105 -0
  29. package/PLAN/11-file-formats.md +442 -0
  30. package/PLAN/12-folder-structure.md +205 -0
  31. package/PLAN/13-operations.md +212 -0
  32. package/PLAN/README.md +23 -0
  33. package/README.md +128 -0
  34. package/REPORT.md +174 -0
  35. package/TODO.md +45 -0
  36. package/ai-tests/FRONTEND_PROMPT.md +220 -0
  37. package/ai-tests/Research & Planning.md +814 -0
  38. package/ai-tests/prompt-001-basic-api.md +230 -0
  39. package/ai-tests/prompt-002-basic-flows.md +230 -0
  40. package/ai-tests/prompt-003-agent-behaviors.md +220 -0
  41. package/api/middleware.js +60 -0
  42. package/api/routes/agents.js +193 -0
  43. package/api/routes/chat.js +93 -0
  44. package/api/routes/completions.js +122 -0
  45. package/api/routes/daemons.js +80 -0
  46. package/api/routes/memory.js +169 -0
  47. package/api/routes/models.js +40 -0
  48. package/api/routes/remote-methods.js +74 -0
  49. package/api/routes/sessions.js +208 -0
  50. package/api/routes/settings.js +108 -0
  51. package/api/routes/system.js +50 -0
  52. package/api/routes/tasks.js +270 -0
  53. package/api/server.js +120 -0
  54. package/cli/formatter.js +70 -0
  55. package/cli/index.js +443 -0
  56. package/cli/parser.js +113 -0
  57. package/config/config.json +10 -0
  58. package/config/models.json +6826 -0
  59. package/core/agent.js +329 -0
  60. package/core/cancel.js +38 -0
  61. package/core/compaction.js +176 -0
  62. package/core/events.js +13 -0
  63. package/core/loop.js +564 -0
  64. package/core/memory.js +51 -0
  65. package/core/prompt.js +185 -0
  66. package/core/queue.js +96 -0
  67. package/core/registry.js +291 -0
  68. package/core/remote-methods.js +124 -0
  69. package/core/router.js +386 -0
  70. package/core/running-sessions.js +18 -0
  71. package/docs/api/01-system.md +84 -0
  72. package/docs/api/02-agents.md +374 -0
  73. package/docs/api/03-chat.md +269 -0
  74. package/docs/api/04-tasks.md +470 -0
  75. package/docs/api/05-sessions.md +444 -0
  76. package/docs/api/06-daemons.md +142 -0
  77. package/docs/api/07-memory.md +186 -0
  78. package/docs/api/08-settings.md +133 -0
  79. package/docs/api/09-models.md +119 -0
  80. package/docs/api/09-websocket.md +350 -0
  81. package/docs/api/10-completions.md +134 -0
  82. package/docs/api/README.md +116 -0
  83. package/docs/guide/01-quickstart.md +220 -0
  84. package/docs/guide/02-folder-structure.md +185 -0
  85. package/docs/guide/03-configuration.md +252 -0
  86. package/docs/guide/04-agents.md +267 -0
  87. package/docs/guide/05-cli.md +290 -0
  88. package/docs/guide/06-tools.md +643 -0
  89. package/docs/guide/07-permissions.md +236 -0
  90. package/docs/guide/08-memory.md +139 -0
  91. package/docs/guide/09-multi-agent.md +271 -0
  92. package/docs/guide/10-daemons.md +226 -0
  93. package/docs/guide/README.md +53 -0
  94. package/docs/index.html +623 -0
  95. package/examples/README.md +151 -0
  96. package/examples/agents/assistant/AGENT.md +31 -0
  97. package/examples/agents/assistant/SOUL.md +9 -0
  98. package/examples/agents/assistant/agent.json +74 -0
  99. package/examples/agents/hello/AGENT.md +15 -0
  100. package/examples/agents/hello/agent.json +14 -0
  101. package/examples/agents/monitor/AGENT.md +51 -0
  102. package/examples/agents/monitor/agent.json +33 -0
  103. package/examples/agents/monitor/heartbeats/monitor.md +24 -0
  104. package/examples/agents/orchestrator/AGENT.md +70 -0
  105. package/examples/agents/orchestrator/agent.json +30 -0
  106. package/examples/agents/researcher/AGENT.md +52 -0
  107. package/examples/agents/researcher/agent.json +49 -0
  108. package/examples/agents/researcher/skills/web-research.md +28 -0
  109. package/examples/skills/code-review.md +72 -0
  110. package/examples/skills/summarise.md +59 -0
  111. package/examples/skills/web-research.md +42 -0
  112. package/examples/tools/word-count/index.js +27 -0
  113. package/examples/tools/word-count/tool.json +18 -0
  114. package/infrastructure/database.js +563 -0
  115. package/infrastructure/scheduler.js +122 -0
  116. package/llm/client.js +206 -0
  117. package/migrations/001-initial.sql +121 -0
  118. package/migrations/002-debuggability.sql +13 -0
  119. package/migrations/003-drop-orphaned-columns.sql +72 -0
  120. package/migrations/004-session-message-token-fields.sql +78 -0
  121. package/migrations/005-session-thinking.sql +5 -0
  122. package/package.json +30 -0
  123. package/schemas/agent.json +143 -0
  124. package/schemas/settings.json +111 -0
  125. package/scripts/fetch-models.js +93 -0
  126. package/session-debug-scenario.md +248 -0
  127. package/settings/fields.js +52 -0
  128. package/system-prompts/base-core.md +7 -0
  129. package/system-prompts/environment.md +13 -0
  130. package/system-prompts/reminders/anti-drift.md +6 -0
  131. package/system-prompts/reminders/stall-recovery.md +10 -0
  132. package/system-prompts/safety-rules.md +25 -0
  133. package/system-prompts/task-heuristics.md +27 -0
  134. package/test/client.js +71 -0
  135. package/test/integration/01-health.test.js +25 -0
  136. package/test/integration/02-agents.test.js +80 -0
  137. package/test/integration/03-chat-hello.test.js +48 -0
  138. package/test/integration/04-chat-multiturn.test.js +61 -0
  139. package/test/integration/05-chat-writer.test.js +48 -0
  140. package/test/integration/06-task-basic.test.js +68 -0
  141. package/test/integration/07-task-tools.test.js +74 -0
  142. package/test/integration/08-task-code-analysis.test.js +69 -0
  143. package/test/integration/09-memory-analyst.test.js +63 -0
  144. package/test/integration/10-task-advanced.test.js +85 -0
  145. package/test/integration/11-sessions-advanced.test.js +84 -0
  146. package/test/integration/12-assistant-chat-tools.test.js +75 -0
  147. package/test/integration/13-edge-cases.test.js +99 -0
  148. package/test/integration/14-cancel.test.js +62 -0
  149. package/test/integration/15-debug.test.js +106 -0
  150. package/test/integration/16-memory-api.test.js +83 -0
  151. package/test/integration/17-settings-api.test.js +41 -0
  152. package/test/integration/18-tool-search-activation.test.js +119 -0
  153. package/test/results/.gitkeep +0 -0
  154. package/test/runner.js +206 -0
  155. package/test/smoke.js +216 -0
  156. package/tools/agent_message.js +85 -0
  157. package/tools/agent_send.js +80 -0
  158. package/tools/agent_spawn.js +44 -0
  159. package/tools/bash.js +49 -0
  160. package/tools/edit_file.js +41 -0
  161. package/tools/glob.js +64 -0
  162. package/tools/grep.js +82 -0
  163. package/tools/list_dir.js +63 -0
  164. package/tools/log_write.js +31 -0
  165. package/tools/memory_read.js +38 -0
  166. package/tools/memory_search.js +65 -0
  167. package/tools/memory_write.js +42 -0
  168. package/tools/read_file.js +48 -0
  169. package/tools/sleep.js +22 -0
  170. package/tools/task_create.js +41 -0
  171. package/tools/task_respond.js +37 -0
  172. package/tools/task_spawn.js +64 -0
  173. package/tools/task_status.js +39 -0
  174. package/tools/task_subscribe.js +37 -0
  175. package/tools/todo_read.js +26 -0
  176. package/tools/todo_write.js +38 -0
  177. package/tools/tool_activate.js +24 -0
  178. package/tools/tool_search.js +24 -0
  179. package/tools/web_fetch.js +50 -0
  180. package/tools/web_search.js +52 -0
  181. package/tools/write_file.js +28 -0
  182. package/ui/api.js +190 -0
  183. package/ui/app.js +281 -0
  184. package/ui/index.html +382 -0
  185. package/ui/views/agents.js +377 -0
  186. package/ui/views/chat.js +610 -0
  187. package/ui/views/connection.js +96 -0
  188. package/ui/views/daemons.js +129 -0
  189. package/ui/views/feed.js +194 -0
  190. package/ui/views/memory.js +263 -0
  191. package/ui/views/models.js +146 -0
  192. package/ui/views/sessions.js +314 -0
  193. package/ui/views/settings.js +142 -0
  194. package/ui/views/tasks.js +415 -0
  195. package/utils/context.js +49 -0
  196. package/utils/id.js +16 -0
  197. package/utils/models.js +88 -0
  198. package/utils/paths.js +213 -0
  199. package/utils/settings.js +172 -0
@@ -0,0 +1,267 @@
1
+ # Agent Configuration
2
+
3
+ An agent is a folder in `.veil/agents/<name>/` containing at minimum `agent.json` and `AGENT.md`.
4
+
5
+ ---
6
+
7
+ ## `agent.json` — Full Reference
8
+
9
+ ```json
10
+ {
11
+ "name": "assistant",
12
+ "description": "General-purpose agent with file and shell access",
13
+ "model": "moonshotai/kimi-k2.5",
14
+ "temperature": 0.7,
15
+ "reasoning": "medium",
16
+ "maxTokens": 4096,
17
+ "memory": {
18
+ "enabled": true,
19
+ "maxLines": 300
20
+ },
21
+ "skillDiscovery": false,
22
+ "modes": {
23
+ "chat": { ... },
24
+ "task": { ... },
25
+ "subagent": { ... },
26
+ "daemon": { ... }
27
+ }
28
+ }
29
+ ```
30
+
31
+ ### Top-level fields
32
+
33
+ | Field | Type | Required | Description |
34
+ |-------|------|----------|-------------|
35
+ | `name` | string | ✓ | Agent identifier. Must match the folder name. |
36
+ | `description` | string | | Human-readable description |
37
+ | `model` | string | ✓ | LLM model string (e.g. `moonshotai/kimi-k2.5`) |
38
+ | `temperature` | number | | 0–2. Sampling temperature. |
39
+ | `reasoning` | string | | Reasoning level: "minimal", "low", "medium", "high" |
40
+ | `maxTokens` | integer | | Max output tokens per LLM call |
41
+ | `memory.enabled` | boolean | | Whether memory files are injected. Overrides settings-level default. |
42
+ | `memory.maxLines` | integer | | Max lines to read from memory file |
43
+ | `skillDiscovery` | boolean | | Auto-discover skill files in the agent's folder |
44
+
45
+ ---
46
+
47
+ ## Mode Configuration
48
+
49
+ Every mode shares a common set of fields plus mode-specific ones.
50
+
51
+ ### Common mode fields
52
+
53
+ ```json
54
+ {
55
+ "enabled": true,
56
+ "tools": ["read_file", "list_dir", "bash"],
57
+ "disallowedTools": ["write_file"],
58
+ "skills": ["my-skill"],
59
+ "autoLoadSkills": ["boot-skill"],
60
+ "mcpServers": ["my-mcp"],
61
+ "allowedAgents": ["coder", "writer"],
62
+ "disallowedAgents": []
63
+ }
64
+ ```
65
+
66
+ | Field | Type | Description |
67
+ |-------|------|-------------|
68
+ | `enabled` | boolean | Whether this mode is active |
69
+ | `tools` | string[] | Whitelist: only these tools are offered to the LLM. Equivalent to `permissions.allow`. |
70
+ | `disallowedTools` | string[] | Blacklist: these tools are hidden from the LLM. Equivalent to `permissions.deny`. |
71
+ | `skills` | string[] | Skill files to load (by name) |
72
+ | `autoLoadSkills` | string[] | Skills auto-injected into the system prompt |
73
+ | `mcpServers` | string[] | MCP server names to load tools from |
74
+ | `allowedAgents` | string[] | Sub-agents this agent may spawn |
75
+ | `disallowedAgents` | string[] | Sub-agents explicitly blocked |
76
+ | `permissions.allow` | string[] | Runtime allow list — tools allowed to execute (checked at call time, supports glob patterns) |
77
+ | `permissions.deny` | string[] | Runtime deny list — tools blocked from executing (checked at call time, wins over allow) |
78
+
79
+ **`tools`/`disallowedTools` vs `permissions`**: `tools` and `disallowedTools` control which tools the LLM *sees* (the tool list sent in the API call). `permissions.allow`/`deny` control which tools are *allowed to execute* at runtime. You can use either, both, or combine them. See [Permissions](07-permissions.md).
80
+
81
+ ---
82
+
83
+ ## Chat Mode
84
+
85
+ ```json
86
+ {
87
+ "modes": {
88
+ "chat": {
89
+ "enabled": true,
90
+ "permissions": {
91
+ "allow": ["read_file", "list_dir"],
92
+ "deny": []
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ Chat mode is used by `POST /agents/:name/chat`. Each call is synchronous — the agent runs its full loop (including any tool calls) before returning.
100
+
101
+ ---
102
+
103
+ ## Task Mode
104
+
105
+ ```json
106
+ {
107
+ "modes": {
108
+ "task": {
109
+ "enabled": true,
110
+ "maxIterations": 20,
111
+ "maxDurationSeconds": 120,
112
+ "onExhausted": "fail",
113
+ "permissions": {
114
+ "allow": ["read_file", "list_dir", "bash", "write_file", "web_search"],
115
+ "deny": []
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ Task-specific fields:
123
+
124
+ | Field | Type | Default | Description |
125
+ |-------|------|---------|-------------|
126
+ | `maxIterations` | integer | settings default | Max LLM loop iterations (each tool call = 1 iteration) |
127
+ | `maxDurationSeconds` | integer | settings default | Wall-clock time limit |
128
+ | `onExhausted` | string | `"fail"` | What to do when limits are hit: `"fail"` (mark failed) or `"wait"` (pause, allow respond) |
129
+
130
+ ---
131
+
132
+ ## Subagent Mode
133
+
134
+ ```json
135
+ {
136
+ "modes": {
137
+ "subagent": {
138
+ "enabled": true,
139
+ "maxIterations": 10,
140
+ "maxDurationSeconds": 60,
141
+ "permissions": {
142
+ "allow": ["read_file", "bash"]
143
+ }
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ Subagent mode is triggered when another agent calls `agent_spawn` targeting this agent. It has the same fields as task mode. If not explicitly configured, subagent mode falls back to task mode config.
150
+
151
+ ---
152
+
153
+ ## Daemon Mode
154
+
155
+ ```json
156
+ {
157
+ "modes": {
158
+ "daemon": {
159
+ "enabled": true,
160
+ "cron": "*/15 * * * *",
161
+ "maxIterations": 10,
162
+ "maxDurationSeconds": 60,
163
+ "conflictPolicy": "skip",
164
+ "heartbeatFile": ".veil/heartbeats/monitor.md",
165
+ "alertRouting": "ops-agent",
166
+ "permissions": {
167
+ "allow": ["read_file", "bash", "web_fetch", "memory_write"]
168
+ }
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ Daemon-specific fields:
175
+
176
+ | Field | Type | Default | Description |
177
+ |-------|------|---------|-------------|
178
+ | `cron` | string | | Cron expression. Required for auto-start. E.g. `"*/5 * * * *"` (every 5 min) |
179
+ | `conflictPolicy` | string | `"skip"` | If a tick fires while the previous one is running: `"skip"`, `"queue"`, or `"restart"` |
180
+ | `heartbeatFile` | string | `.veil/heartbeats/<name>.md` | File containing daemon instructions, read each tick |
181
+ | `alertRouting` | string \| string[] | | Agent name(s) to notify on error |
182
+
183
+ See [Daemon Agents](10-daemons.md) for full setup guide.
184
+
185
+ ---
186
+
187
+ ## `AGENT.md`
188
+
189
+ The agent's system prompt. Plain Markdown, loaded and injected at the top of every conversation.
190
+
191
+ ### Variable substitution
192
+
193
+ | Variable | Value |
194
+ |----------|-------|
195
+ | `$AGENT_FOLDER` | Absolute path to this agent's folder |
196
+ | `$PROJECT_ROOT` | Absolute path to the workspace root |
197
+
198
+ ### Tips
199
+
200
+ - Keep it focused — describe the agent's role, constraints, and tool usage style.
201
+ - Avoid putting volatile data (dates, paths) directly — use variables.
202
+ - For long instructions, split between `AGENT.md` (capabilities) and `SOUL.md` (identity/tone).
203
+
204
+ Example:
205
+ ```markdown
206
+ You are Coder, a focused code analysis agent operating in $PROJECT_ROOT.
207
+
208
+ You specialise in:
209
+ - Reading and understanding source files
210
+ - Identifying patterns, bugs, and improvements
211
+ - Answering questions about code structure
212
+
213
+ Rules:
214
+ - Never write or modify files unless explicitly asked
215
+ - Always cite the file path and line number when referencing code
216
+ - Keep responses concise and technical
217
+ ```
218
+
219
+ ---
220
+
221
+ ## `SOUL.md`
222
+
223
+ Optional. Same format as `AGENT.md`. Appended to the system prompt after `AGENT.md`. Useful for separating stable capabilities from swappable persona/tone.
224
+
225
+ ---
226
+
227
+ ## Complete Example
228
+
229
+ `.veil/agents/assistant/agent.json`:
230
+ ```json
231
+ {
232
+ "name": "assistant",
233
+ "description": "General-purpose agent with file and shell access",
234
+ "model": "moonshotai/kimi-k2.5",
235
+ "temperature": 0.7,
236
+ "reasoning": "medium",
237
+ "memory": { "enabled": false },
238
+ "skillDiscovery": false,
239
+ "modes": {
240
+ "chat": {
241
+ "enabled": true,
242
+ "permissions": {
243
+ "allow": ["read_file", "list_dir", "bash", "grep", "glob"],
244
+ "deny": []
245
+ }
246
+ },
247
+ "task": {
248
+ "enabled": true,
249
+ "maxIterations": 20,
250
+ "maxDurationSeconds": 120,
251
+ "onExhausted": "fail",
252
+ "permissions": {
253
+ "allow": ["read_file", "list_dir", "bash", "grep", "glob", "write_file", "edit_file"],
254
+ "deny": []
255
+ }
256
+ }
257
+ }
258
+ }
259
+ ```
260
+
261
+ `.veil/agents/assistant/AGENT.md`:
262
+ ```markdown
263
+ You are Assistant, a capable general-purpose agent running in $PROJECT_ROOT.
264
+
265
+ You can read, write, and analyse files, run shell commands, and search the web.
266
+ Always explain what you are doing and why. Be direct and concise.
267
+ ```
@@ -0,0 +1,290 @@
1
+ # CLI Reference
2
+
3
+ The `veil` command controls the server and provides utilities for managing agents and credentials.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # From the VeilCli repo directory:
11
+ npm link # system-wide (requires npm prefix write access)
12
+ # or
13
+ ln -sf "$(pwd)/cli/index.js" ~/.local/bin/veil
14
+ chmod +x cli/index.js
15
+ ```
16
+
17
+ Verify:
18
+ ```bash
19
+ veil --version
20
+ # VeilCLI v0.1.0
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Commands
26
+
27
+ ### `veil start`
28
+
29
+ Start the REST API server in the current (or specified) directory.
30
+
31
+ ```bash
32
+ veil start [--port <n>] [--folder <path>] [--secret <token>] [--ably]
33
+ ```
34
+
35
+ | Flag | Default | Description |
36
+ |------|---------|-------------|
37
+ | `--port` | `5050` (or from settings.json) | Port to listen on |
38
+ | `--folder` | current directory | Workspace directory (must contain `.veil/`) |
39
+ | `--secret` | none | Require `X-Veil-Secret: <token>` on all API requests |
40
+ | `--ably` | false | Enable Ably remote access |
41
+
42
+ **What happens on start:**
43
+ 1. Loads settings from all layers (global → project → local → CLI flags)
44
+ 2. Runs SQLite startup recovery (marks stale processing tasks as failed)
45
+ 3. Starts the daemon scheduler
46
+ 4. Auto-starts any daemon agents with a `cron` field configured
47
+ 5. Starts the Express HTTP server
48
+ 6. Writes `.veil/runtime.pid`
49
+
50
+ The process stays in the foreground. Use SIGINT (Ctrl+C) or `veil stop` to shut down gracefully.
51
+
52
+ **Examples:**
53
+ ```bash
54
+ veil start
55
+ veil start --port 5051 --folder ~/projects/my-bot
56
+ veil start --secret supersecret123
57
+ ```
58
+
59
+ ---
60
+
61
+ ### `veil run`
62
+
63
+ Run a one-shot task and print the result to stdout. The process exits when the task completes. Useful for scripting and automation.
64
+
65
+ ```bash
66
+ veil run --agent <name> --input "<text>" [--timeout <seconds>]
67
+ ```
68
+
69
+ | Flag | Required | Description |
70
+ |------|----------|-------------|
71
+ | `--agent` | ✓ | Agent name |
72
+ | `--input` | ✓ | Task input text |
73
+ | `--timeout` | | Override `maxDurationSeconds` for this run |
74
+
75
+ **Output** (JSON to stdout):
76
+ ```json
77
+ {
78
+ "taskId": "task_c0ab38d8377cdd47",
79
+ "status": "finished",
80
+ "output": "The project has 5 dependencies: ..."
81
+ }
82
+ ```
83
+
84
+ On failure, exits with code 1 and prints the error to stderr.
85
+
86
+ **Examples:**
87
+ ```bash
88
+ veil run --agent hello --input "What is 2 + 2?"
89
+ veil run --agent coder --input "Summarise the main functions in src/index.js" --timeout 60
90
+ ```
91
+
92
+ ---
93
+
94
+ ### `veil stop`
95
+
96
+ Send SIGTERM to the running server. The server will clean up and exit gracefully.
97
+
98
+ ```bash
99
+ veil stop
100
+ ```
101
+
102
+ Reads `.veil/runtime.pid` to find the process. Must be run from the same workspace directory as `veil start`.
103
+
104
+ ---
105
+
106
+ ### `veil status`
107
+
108
+ Check whether the server is running.
109
+
110
+ ```bash
111
+ veil status
112
+ ```
113
+
114
+ Reads `.veil/runtime.pid` and checks if the process exists.
115
+
116
+ Output examples:
117
+ ```
118
+ ✓ Server is running (PID: 12345)
119
+ ! PID file exists but process 12345 is not running (stale PID file)
120
+ ! No running server (no PID file found)
121
+ ```
122
+
123
+ ---
124
+
125
+ ### `veil agents`
126
+
127
+ Manage agents in the current workspace.
128
+
129
+ #### `veil agents list`
130
+
131
+ List all agents:
132
+ ```bash
133
+ veil agents list
134
+ # or
135
+ veil agents
136
+ ```
137
+
138
+ Output (table):
139
+ ```
140
+ Agents (3)
141
+ name description model source
142
+ hello A simple conversational agent moonshotai/kimi-k2.5 project
143
+ assistant General-purpose agent moonshotai/kimi-k2.5 project
144
+ coder Code analysis agent moonshotai/kimi-k2.5 project
145
+ ```
146
+
147
+ #### `veil agents inspect <name>`
148
+
149
+ Show full details for a single agent including modes and the first 500 chars of `AGENT.md`:
150
+
151
+ ```bash
152
+ veil agents inspect assistant
153
+ ```
154
+
155
+ #### `veil agents create`
156
+
157
+ Interactive agent creation wizard. Currently shows instructions to create manually.
158
+
159
+ ---
160
+
161
+ ### `veil login`
162
+
163
+ Save an API key to `auth.json`.
164
+
165
+ ```bash
166
+ veil login --key <api-key> [--global]
167
+ ```
168
+
169
+ | Flag | Description |
170
+ |------|-------------|
171
+ | `--key` | API key to save (required) |
172
+ | `--global` | Save to `~/.veil/auth.json` instead of `.veil/auth.json` |
173
+
174
+ After login, manually edit `auth.json` to set the `model` field.
175
+
176
+ **Examples:**
177
+ ```bash
178
+ veil login --key sk-or-v1-... # project-level
179
+ veil login --key sk-or-v1-... --global # global (shared across workspaces)
180
+ ```
181
+
182
+ ---
183
+
184
+ ### `veil import`
185
+
186
+ Import agents from other formats (Claude Code, raw JSON). Not yet fully implemented — shows the source path for manual processing.
187
+
188
+ ```bash
189
+ veil import --type <type> --source <path>
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Global Flags
195
+
196
+ | Flag | Description |
197
+ |------|-------------|
198
+ | `--help`, `-h` | Show usage |
199
+ | `--version` | Show VeilCLI version |
200
+
201
+ ---
202
+
203
+ ## Interactive TUI Client
204
+
205
+ The `connect.js` client in `VeilCli_TESTS/cli-app/` is a separate interactive tool for exploring and testing a running server.
206
+
207
+ ### Usage
208
+
209
+ ```bash
210
+ # Open interactive menu (arrow keys or number keys)
211
+ node connect.js
212
+
213
+ # Jump straight to a chat REPL
214
+ node connect.js chat <agent>
215
+
216
+ # One-shot chat (print and exit)
217
+ node connect.js chat <agent> "Your message here"
218
+
219
+ # Run a task (live tool display)
220
+ node connect.js task <agent> "Your task instructions"
221
+
222
+ # Print tables and exit
223
+ node connect.js status
224
+ node connect.js agents
225
+ node connect.js sessions
226
+ node connect.js tasks
227
+
228
+ # Custom server URL
229
+ node connect.js --url http://localhost:5051 chat simple
230
+ ```
231
+
232
+ ### Interactive menu
233
+
234
+ When run with no arguments, shows a full-screen menu:
235
+
236
+ ```
237
+ ┌──────────────────────────────────────────┐
238
+ │ VeilCLI Connect http://localhost:5051│
239
+ ├──────────────────────────────────────────┤
240
+ │ Main Menu http://localhost:5051 │
241
+ ├──────────────────────────────────────────┤
242
+ │ │
243
+ │ ❯ 1. 💬 Chat Interactive … │
244
+ │ 2. ⚡ Run a Task Task with tools… │
245
+ │ 3. 🤖 Agents List available … │
246
+ │ 4. 📋 Sessions Recent chat … │
247
+ │ 5. 📊 Tasks Task history │
248
+ │ 6. ℹ️ Status Server info │
249
+ │ 7. ✕ Quit │
250
+ │ │
251
+ ├──────────────────────────────────────────┤
252
+ │ [↑↓ / number] move [Enter] select … │
253
+ └──────────────────────────────────────────┘
254
+ ```
255
+
256
+ **Navigation**: arrow keys or type the number, Enter to select, q to go back.
257
+
258
+ ### Chat REPL commands
259
+
260
+ Inside the chat interface:
261
+
262
+ | Command | Action |
263
+ |---------|--------|
264
+ | `/new` | Start a new session (clear history) |
265
+ | `/clear` | Clear the display |
266
+ | `/session` | Show current session ID |
267
+ | `/back` or Ctrl+C | Return to menu |
268
+
269
+ ### Task runner — live tool display
270
+
271
+ When running a task, tools are displayed as they execute:
272
+
273
+ ```
274
+ │ Task ID: task_c0ab38d8377cdd47
275
+ │──────────────────────────────────│
276
+ │ 🔧 list_dir /tmp
277
+ │ ✓ 75ms .ICE-unix/ .X11-unix/…
278
+ │ 🔧 bash ls -1 /tmp | wc -l
279
+ │ ✓ 69ms 306
280
+ │──────────────────────────────────│
281
+ │ ✓ Done — 3 iterations tokens in:21918 out:394
282
+ │ There are 306 files in /tmp.
283
+ ```
284
+
285
+ ### Environment variables
286
+
287
+ | Variable | Description |
288
+ |----------|-------------|
289
+ | `VEIL_URL` | Server URL (default: `http://localhost:5051`) |
290
+ | `VEIL_SECRET` | Auth secret header value |