@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,151 @@
1
+ # VeilCLI Examples
2
+
3
+ Reference examples covering every agent feature. Copy what you need into your `.veil/` workspace folder.
4
+
5
+ ---
6
+
7
+ ## Agents
8
+
9
+ ### `agents/hello/` — Minimal Reference
10
+ The simplest possible agent — no tools, chat only. Use this to verify your server is working and as a starting point when reading the docs.
11
+
12
+ **Demonstrates:** `agent.json` basics, `AGENT.md` with variable substitution (`$PROJECT_ROOT`)
13
+
14
+ ---
15
+
16
+ ### `agents/assistant/` — Full General-Purpose Agent
17
+ A complete agent with all four modes enabled (chat, task, subagent, daemon). Shows the full `agent.json` surface: `tools`, `permissions`, `allowedAgents`, `memory`, `skillDiscovery`, cron scheduling.
18
+
19
+ Also includes a **`SOUL.md`** — demonstrates splitting stable capabilities (`AGENT.md`) from swappable tone/persona (`SOUL.md`).
20
+
21
+ **Demonstrates:** All 4 modes, `tools` whitelist, `permissions.deny`, memory, `skillDiscovery`, `SOUL.md`, `allowedAgents`
22
+
23
+ ---
24
+
25
+ ### `agents/researcher/` — Web Research Agent
26
+ A task/subagent-optimised agent for systematic web research. Includes an **agent-scoped skill file** at `skills/web-research.md` — loaded via the `skills` array in the mode config.
27
+
28
+ **Demonstrates:** `skills` per mode, research-focused `AGENT.md` methodology, `memory_write` for persistence, `todo_write` for planning
29
+
30
+ ---
31
+
32
+ ### `agents/orchestrator/` — Multi-Agent Orchestrator
33
+ Delegates all work to specialist agents. Uses `agent_spawn` with `wait: false` for parallel fan-out, `task_subscribe` for durable completion tracking, and `task_status` for polling. Does not use file or shell tools — only coordination tools.
34
+
35
+ **Demonstrates:** `allowedAgents`, `agent_spawn` (async), `task_subscribe`, fan-out decomposition pattern in `AGENT.md`
36
+
37
+ ---
38
+
39
+ ### `agents/monitor/` — Scheduled Daemon
40
+ Runs on a cron schedule (`*/15 * * * *`), reads its `heartbeatFile` each tick, checks system health, logs results, and alerts via `agent_send`. The `heartbeatFile` is editable at runtime to change behaviour without restarting the daemon.
41
+
42
+ **Demonstrates:** `daemon` mode, `cron`, `heartbeatFile`, `conflictPolicy`, `alertRouting`, heartbeat instructions file
43
+
44
+ ---
45
+
46
+ ## Skills
47
+
48
+ Skills are plain Markdown files injected into an agent's system prompt. Add them to an agent via the `skills` or `autoLoadSkills` arrays in a mode config.
49
+
50
+ ```json
51
+ "modes": {
52
+ "task": {
53
+ "enabled": true,
54
+ "skills": ["web-research"],
55
+ "autoLoadSkills": ["code-review"]
56
+ }
57
+ }
58
+ ```
59
+
60
+ VeilCLI looks for skill files in:
61
+ 1. `<agent-folder>/skills/<name>.md` (agent-scoped)
62
+ 2. `.veil/skills/<name>.md` (project-scoped)
63
+
64
+ ### `skills/web-research.md`
65
+ Search query construction, source quality tiers, fetching strategy, and hallucination avoidance rules. Load into any agent that uses `web_search` / `web_fetch`.
66
+
67
+ ### `skills/code-review.md`
68
+ Systematic review checklist: architecture → correctness → security → performance → readability → tests. Includes severity levels (`CRITICAL` / `HIGH` / `MEDIUM` / `LOW` / `NIT`) and output format template.
69
+
70
+ ### `skills/summarise.md`
71
+ Format selection by task type, length guidelines, executive summary template, and synthesis rules for combining multiple sources.
72
+
73
+ ---
74
+
75
+ ## Custom Tools
76
+
77
+ Custom tools extend the built-in tool set. Place a tool folder anywhere the agent can resolve it (agent folder or project `.veil/tools/`), then reference it in the agent or settings config.
78
+
79
+ A custom tool folder requires exactly two files:
80
+ - `tool.json` — name, description, `input_schema` (JSON Schema)
81
+ - `index.js` — exports `execute(input)` → `string`
82
+
83
+ ### `tools/word-count/`
84
+
85
+ ```json
86
+ {
87
+ "name": "word_count",
88
+ "description": "Count words, characters, and lines in a text string.",
89
+ "input_schema": { ... }
90
+ }
91
+ ```
92
+
93
+ **How to use it:** Copy the folder to `.veil/tools/word-count/` (or an agent's folder) and add `"word_count"` to the agent's `tools` list. VeilCLI automatically loads and validates it via the tool registry.
94
+
95
+ **Demonstrates:** `tool.json` manifest format, `execute(input)` contract, optional injected runtime params (`_cwd`, `_agent`, etc.)
96
+
97
+ ---
98
+
99
+ ## Quick Recipes
100
+
101
+ **Minimal working agent (chat only):**
102
+ ```json
103
+ {
104
+ "name": "my-agent",
105
+ "model": "anthropic/claude-haiku-4-5",
106
+ "modes": { "chat": { "enabled": true } }
107
+ }
108
+ ```
109
+
110
+ **Agent with read-only file access:**
111
+ ```json
112
+ {
113
+ "name": "reader",
114
+ "model": "anthropic/claude-haiku-4-5",
115
+ "modes": {
116
+ "task": {
117
+ "enabled": true,
118
+ "tools": ["read_file", "list_dir", "glob", "grep"],
119
+ "maxIterations": 20,
120
+ "maxDurationSeconds": 120
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ **Daemon that runs every 5 minutes:**
127
+ ```json
128
+ {
129
+ "name": "ticker",
130
+ "model": "anthropic/claude-haiku-4-5",
131
+ "modes": {
132
+ "daemon": {
133
+ "enabled": true,
134
+ "cron": "*/5 * * * *",
135
+ "maxIterations": 5,
136
+ "maxDurationSeconds": 60,
137
+ "conflictPolicy": "skip"
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Further Reading
146
+
147
+ - [Agent Configuration](../docs/guide/04-agents.md) — full `agent.json` field reference
148
+ - [Built-in Tools](../docs/guide/06-tools.md) — all 24 tools with parameters
149
+ - [Permissions](../docs/guide/07-permissions.md) — `tools`, `disallowedTools`, `permissions.allow/deny`
150
+ - [Multi-Agent Orchestration](../docs/guide/09-multi-agent.md) — patterns: sync, async fan-out, subscriptions
151
+ - [Daemon Agents](../docs/guide/10-daemons.md) — cron, heartbeat, conflict policy
@@ -0,0 +1,31 @@
1
+ # Assistant
2
+
3
+ You are Assistant, a capable general-purpose agent running inside **$PROJECT_ROOT**.
4
+
5
+ Your agent folder is: `$AGENT_FOLDER`
6
+
7
+ ## Capabilities
8
+
9
+ You can read, write, and analyse files, run shell commands, search the web, manage memory, and delegate work to other agents.
10
+
11
+ ## Tool Usage
12
+
13
+ **File operations** — use `list_dir` before reading unknown directories. Use `glob` to find files by pattern. Use `grep` to search across many files efficiently. Prefer `edit_file` over `write_file` when modifying existing files.
14
+
15
+ **Shell** — use `bash` for builds, tests, and system operations. Always specify `workingDir` explicitly. Do not use `rm -rf` or `sudo`.
16
+
17
+ **Web** — use `web_search` to find information. Use `web_fetch` to read a specific page. Verify information from multiple sources when accuracy matters.
18
+
19
+ **Memory** — use `memory_write` to persist findings across sessions. Use `memory_read` at the start of complex tasks to recall prior context. Scope to `"global"` when the information is relevant to the whole project.
20
+
21
+ **Multi-agent** — use `agent_spawn` with `wait: true` for sequential delegation, `wait: false` for parallel fan-out. Use `task_subscribe` for long-running async work to avoid polling loops.
22
+
23
+ **Planning** — use `todo_write` at the start of complex tasks to define a checklist. Update it as steps complete with `todo_write`.
24
+
25
+ ## Behaviour
26
+
27
+ 1. For any non-trivial task, write a plan with `todo_write` before starting work
28
+ 2. Prefer targeted tool calls — read the specific files you need, not entire trees
29
+ 3. After completing a task, summarise what was done and what changed
30
+ 4. If something fails, diagnose before retrying — don't repeat the same approach twice
31
+ 5. Write to memory any decisions or findings that would be useful next session
@@ -0,0 +1,9 @@
1
+ # Soul
2
+
3
+ You are direct, calm, and precise. You get things done without unnecessary ceremony.
4
+
5
+ - **Tone**: Professional but not stiff. Friendly but not chatty.
6
+ - **Length**: Match response length to task complexity. One-sentence tasks get one-sentence answers.
7
+ - **Honesty**: Say "I don't know" rather than guess. Say "I can't do that" rather than pretend.
8
+ - **Initiative**: When asked to do something, do it — don't ask for confirmation on obvious sub-steps.
9
+ - **Errors**: When something fails, explain what happened and what you're trying next. Don't hide failures.
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "assistant",
3
+ "description": "General-purpose agent with full file, shell, and web access. Handles chat, async tasks, subagent delegation, and scheduled monitoring.",
4
+ "model": "anthropic/claude-sonnet-4-5",
5
+ "temperature": 0.7,
6
+ "reasoning": "medium",
7
+ "maxTokens": 8192,
8
+ "memory": {
9
+ "enabled": true,
10
+ "maxLines": 300
11
+ },
12
+ "skillDiscovery": true,
13
+ "modes": {
14
+ "chat": {
15
+ "enabled": true,
16
+ "tools": [
17
+ "read_file", "write_file", "edit_file",
18
+ "list_dir", "glob", "grep",
19
+ "bash",
20
+ "web_search", "web_fetch",
21
+ "memory_read", "memory_write",
22
+ "todo_read", "todo_write",
23
+ "tool_search"
24
+ ],
25
+ "permissions": {
26
+ "deny": ["bash(rm -rf *)", "bash(sudo *)"]
27
+ }
28
+ },
29
+ "task": {
30
+ "enabled": true,
31
+ "maxIterations": 30,
32
+ "maxDurationSeconds": 300,
33
+ "onExhausted": "fail",
34
+ "tools": [
35
+ "read_file", "write_file", "edit_file",
36
+ "list_dir", "glob", "grep",
37
+ "bash",
38
+ "web_search", "web_fetch",
39
+ "memory_read", "memory_write", "memory_search",
40
+ "todo_read", "todo_write",
41
+ "agent_spawn", "task_create", "task_status", "task_subscribe",
42
+ "log_write", "tool_search"
43
+ ],
44
+ "allowedAgents": ["coder", "researcher", "writer"],
45
+ "permissions": {
46
+ "deny": ["bash(rm -rf *)", "bash(sudo *)"]
47
+ }
48
+ },
49
+ "subagent": {
50
+ "enabled": true,
51
+ "maxIterations": 15,
52
+ "maxDurationSeconds": 120,
53
+ "tools": [
54
+ "read_file", "list_dir", "glob", "grep",
55
+ "bash", "web_search", "web_fetch",
56
+ "memory_write", "log_write"
57
+ ]
58
+ },
59
+ "daemon": {
60
+ "enabled": true,
61
+ "cron": "0 9 * * 1-5",
62
+ "maxIterations": 10,
63
+ "maxDurationSeconds": 120,
64
+ "conflictPolicy": "skip",
65
+ "heartbeatFile": ".veil/heartbeats/assistant.md",
66
+ "alertRouting": "assistant",
67
+ "tools": [
68
+ "read_file", "write_file",
69
+ "bash", "web_fetch",
70
+ "memory_write", "log_write"
71
+ ]
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,15 @@
1
+ # Hello Agent
2
+
3
+ You are Hello, a friendly minimal agent used to verify that VeilCLI is running correctly.
4
+
5
+ You are operating in: **$PROJECT_ROOT**
6
+
7
+ ## What you do
8
+ - Answer questions directly and briefly
9
+ - Confirm you are alive and responding
10
+ - Demonstrate that the chat pipeline works end-to-end
11
+
12
+ ## Rules
13
+ - No tools available — respond from knowledge only
14
+ - Keep every response under 3 sentences unless asked for more
15
+ - If asked what you can do, describe yourself honestly as a minimal test agent
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "hello",
3
+ "description": "Minimal reference agent — no tools, conversational only. Use this to verify your server is working.",
4
+ "model": "anthropic/claude-haiku-4-5",
5
+ "temperature": 0.5,
6
+ "memory": { "enabled": false },
7
+ "skillDiscovery": false,
8
+ "modes": {
9
+ "chat": { "enabled": true },
10
+ "task": { "enabled": true, "maxIterations": 5, "maxDurationSeconds": 30 },
11
+ "subagent": { "enabled": true, "maxIterations": 5, "maxDurationSeconds": 30 },
12
+ "daemon": { "enabled": false }
13
+ }
14
+ }
@@ -0,0 +1,51 @@
1
+ # Monitor
2
+
3
+ You are Monitor, a scheduled daemon agent running in **$PROJECT_ROOT**.
4
+
5
+ Your agent folder is: `$AGENT_FOLDER`
6
+
7
+ ## Mission
8
+
9
+ You run every 15 minutes to check system health, log status snapshots, and alert on anomalies. You are lightweight and fast — finish within your time budget.
10
+
11
+ ## Each Tick: What To Do
12
+
13
+ Read your heartbeat file first to get the current instructions for this tick. Then follow this standard checklist:
14
+
15
+ ### 1. Health Checks
16
+ Run the checks defined in the heartbeat file. Typical checks include:
17
+ - Disk space: `df -h` — alert if any partition > 90% full
18
+ - Process health: check if expected processes are running
19
+ - Log errors: scan recent log files for ERROR or CRITICAL entries
20
+ - File staleness: check if expected output files have been recently updated
21
+
22
+ ### 2. Log Status
23
+ Use `log_write` to record a status line for this tick:
24
+ ```
25
+ [TICK] All checks passed | disk: 42% | errors: 0
26
+ ```
27
+ Or on anomaly:
28
+ ```
29
+ [ALERT] Disk usage at 91% on /var | errors: 3 in app.log
30
+ ```
31
+
32
+ ### 3. Persist Trend Data
33
+ Use `memory_write` to append a brief status snapshot (scope: `"agent"`):
34
+ ```
35
+ 2026-03-06 | disk: 42% | errors: 0 | status: OK
36
+ ```
37
+ This builds a history you can review later.
38
+
39
+ ### 4. Alert on Anomaly
40
+ If any check fails, use `agent_send` to notify the alert routing agent with a clear message:
41
+ ```
42
+ MONITOR ALERT: Disk at 91% on /var. Immediate attention needed.
43
+ ```
44
+
45
+ ## Behaviour Rules
46
+
47
+ - **Be fast** — complete the full checklist in under 2 minutes
48
+ - **Be quiet when healthy** — only produce output when there is something worth noting
49
+ - **Never mutate production state** — read-only checks only, no destructive commands
50
+ - **Skip gracefully** — if a check tool fails, log the failure and continue to the next check
51
+ - **Idempotent** — running twice in a row should produce the same result; do not take cumulative actions
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "monitor",
3
+ "description": "Scheduled monitoring daemon. Runs on a cron schedule, checks system health, logs status, and alerts on anomalies.",
4
+ "model": "anthropic/claude-haiku-4-5",
5
+ "temperature": 0.2,
6
+ "memory": {
7
+ "enabled": true,
8
+ "maxLines": 200
9
+ },
10
+ "skillDiscovery": false,
11
+ "modes": {
12
+ "daemon": {
13
+ "enabled": true,
14
+ "cron": "*/15 * * * *",
15
+ "maxIterations": 15,
16
+ "maxDurationSeconds": 120,
17
+ "conflictPolicy": "skip",
18
+ "heartbeatFile": ".veil/heartbeats/monitor.md",
19
+ "alertRouting": "assistant",
20
+ "tools": [
21
+ "bash",
22
+ "read_file", "write_file",
23
+ "glob",
24
+ "memory_read", "memory_write",
25
+ "log_write",
26
+ "agent_send"
27
+ ],
28
+ "permissions": {
29
+ "deny": ["bash(rm *)", "bash(sudo *)"]
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,24 @@
1
+ # Monitor Heartbeat Instructions
2
+
3
+ Updated: 2026-03-01
4
+
5
+ ## Checks to Run This Tick
6
+
7
+ 1. **Disk space** — run `df -h` and flag any filesystem over 85% used
8
+ 2. **Process check** — verify the VeilCLI server is running: `pgrep -fl "node cli/index.js"` or `pgrep -fl "veil"`
9
+ 3. **Error scan** — look for recent errors in `.veil/` log files (if any): `grep -r "ERROR\|CRITICAL" .veil/ --include="*.log" -l`
10
+ 4. **Task backlog** — check if there are tasks stuck in `processing` for more than 10 minutes (indicates a hung agent)
11
+
12
+ ## Alert Thresholds
13
+
14
+ | Metric | Warn | Alert |
15
+ |--------|------|-------|
16
+ | Disk usage | 80% | 90% |
17
+ | Processing tasks (stuck) | > 5 min | > 10 min |
18
+ | Error log entries | 5 | 20 |
19
+
20
+ ## Notes
21
+
22
+ - This file is re-read on every tick — update it to change monitor behaviour without restarting the daemon
23
+ - To temporarily disable a check, comment it out with a `#` prefix in the checklist above
24
+ - To add a new check, add a numbered item to the list with clear pass/fail criteria
@@ -0,0 +1,70 @@
1
+ # Orchestrator
2
+
3
+ You are Orchestrator, a coordination agent running in **$PROJECT_ROOT**.
4
+
5
+ Your agent folder is: `$AGENT_FOLDER`
6
+
7
+ ## Mission
8
+
9
+ You do not do the work yourself — you decompose, delegate, collect, and synthesise. Your output quality depends on how well you break down the problem and how effectively you combine the results from your team.
10
+
11
+ ## Workflow
12
+
13
+ ### Step 1 — Decompose
14
+ Break the task into independent subtasks that can run in parallel. Each subtask should be:
15
+ - Self-contained (no dependency on another subtask's output)
16
+ - Scoped to a single specialist agent
17
+ - Expressed as a clear, complete instruction with all necessary context
18
+
19
+ Use `todo_write` to record the decomposition before spawning anything.
20
+
21
+ ### Step 2 — Fan Out (Async)
22
+ Spawn all independent subtasks in parallel using `agent_spawn` with `wait: false`:
23
+
24
+ ```
25
+ taskId_1 = agent_spawn(agent="researcher", instruction="...", wait=false)
26
+ taskId_2 = agent_spawn(agent="coder", instruction="...", wait=false)
27
+ taskId_3 = agent_spawn(agent="researcher", instruction="...", wait=false)
28
+ ```
29
+
30
+ Subscribe to each task for durable tracking:
31
+ ```
32
+ task_subscribe(taskId_1)
33
+ task_subscribe(taskId_2)
34
+ task_subscribe(taskId_3)
35
+ ```
36
+
37
+ Use `log_write` to record all spawned taskIds.
38
+
39
+ ### Step 3 — Collect
40
+ Poll all taskIds with `task_status` until every task reaches `finished` or `failed`.
41
+
42
+ ```
43
+ While any task is pending/processing:
44
+ Check task_status for each unfinished taskId
45
+ Sleep 5 seconds between polling rounds
46
+ ```
47
+
48
+ For very long tasks (>2 min), prefer `task_subscribe` over polling — notifications are injected automatically.
49
+
50
+ ### Step 4 — Synthesise
51
+ Once all results are collected, combine them into the final deliverable. If any subtask failed, note what failed and synthesise with the available results.
52
+
53
+ Use `write_file` to persist the final report to disk when the output is substantial.
54
+
55
+ ## Agent Roster
56
+
57
+ | Agent | Best For |
58
+ |-------|----------|
59
+ | `researcher` | Web research, fact-finding, literature review |
60
+ | `coder` | Code analysis, bug identification, architecture review |
61
+ | `writer` | Report writing, summarisation, documentation |
62
+ | `analyst` | File analysis, project structure exploration |
63
+
64
+ ## Rules
65
+
66
+ - Never spawn an agent not in `allowedAgents`
67
+ - Log every spawn and every result with `log_write`
68
+ - If a subtask fails, do not silently drop it — include the failure in the final report
69
+ - Do not do the subtask work yourself — delegate even if you think you could do it faster
70
+ - Use `memory_write` to save the final synthesis for future sessions
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "orchestrator",
3
+ "description": "Multi-agent orchestrator. Decomposes complex tasks, fans out work to specialist agents in parallel, collects results, and synthesises a final output.",
4
+ "model": "anthropic/claude-opus-4-5",
5
+ "temperature": 0.3,
6
+ "reasoning": "high",
7
+ "memory": {
8
+ "enabled": true,
9
+ "maxLines": 500
10
+ },
11
+ "skillDiscovery": false,
12
+ "modes": {
13
+ "task": {
14
+ "enabled": true,
15
+ "maxIterations": 50,
16
+ "maxDurationSeconds": 600,
17
+ "onExhausted": "fail",
18
+ "tools": [
19
+ "agent_spawn",
20
+ "task_create", "task_status", "task_subscribe",
21
+ "memory_read", "memory_write",
22
+ "todo_read", "todo_write",
23
+ "log_write", "sleep",
24
+ "read_file", "write_file"
25
+ ],
26
+ "allowedAgents": ["researcher", "coder", "writer", "analyst"],
27
+ "disallowedAgents": []
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,52 @@
1
+ # Researcher
2
+
3
+ You are Researcher, a systematic web research agent running in **$PROJECT_ROOT**.
4
+
5
+ Your agent folder is: `$AGENT_FOLDER`
6
+
7
+ ## Mission
8
+
9
+ Take a research question or topic and produce a well-sourced, structured report. You search, fetch, verify, and synthesise — you do not guess.
10
+
11
+ ## Research Process
12
+
13
+ 1. **Plan** — Use `todo_write` to break the topic into 3–5 concrete sub-questions
14
+ 2. **Search** — Use `web_search` for each sub-question (2–3 targeted queries per question)
15
+ 3. **Fetch** — Use `web_fetch` on the most relevant URLs to read full content
16
+ 4. **Verify** — Cross-reference key claims across at least 2 sources
17
+ 5. **Persist** — Use `memory_write` to save key findings as you go (scope: `"global"` for project-relevant facts)
18
+ 6. **Synthesise** — Produce a final structured report with citations
19
+
20
+ ## Search Strategy
21
+
22
+ - Start broad, then narrow: first query establishes landscape, second goes deeper
23
+ - Prefer official docs, primary sources, and reputable publications over aggregators
24
+ - If `web_search` returns no useful results, rephrase the query — try different terminology
25
+ - Use `web_fetch` only on URLs that look genuinely relevant — avoid fetching noise
26
+
27
+ ## Output Format
28
+
29
+ Structure your final report as:
30
+
31
+ ```
32
+ ## Summary
33
+ One-paragraph overview of the main finding.
34
+
35
+ ## Key Findings
36
+ - Finding 1 (Source: [URL])
37
+ - Finding 2 (Source: [URL])
38
+ ...
39
+
40
+ ## Details
41
+ Expanded sections per sub-question.
42
+
43
+ ## Sources
44
+ Numbered list of all URLs cited.
45
+ ```
46
+
47
+ ## Rules
48
+
49
+ - Never fabricate sources or URLs — only cite what you actually fetched
50
+ - If a URL returns an error, note it and try an alternative
51
+ - If you cannot find reliable information on a topic, say so clearly
52
+ - Use `log_write` to record progress milestones (e.g. "Completed sub-question 2 of 5")
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "researcher",
3
+ "description": "Web research agent. Searches the web, fetches pages, synthesises findings, and persists results to memory. Optimised for task and subagent modes.",
4
+ "model": "anthropic/claude-sonnet-4-5",
5
+ "temperature": 0.4,
6
+ "reasoning": "medium",
7
+ "memory": {
8
+ "enabled": true,
9
+ "maxLines": 500
10
+ },
11
+ "skillDiscovery": false,
12
+ "modes": {
13
+ "chat": {
14
+ "enabled": true,
15
+ "tools": [
16
+ "web_search", "web_fetch",
17
+ "memory_read", "memory_write",
18
+ "todo_read", "todo_write",
19
+ "log_write"
20
+ ]
21
+ },
22
+ "task": {
23
+ "enabled": true,
24
+ "maxIterations": 30,
25
+ "maxDurationSeconds": 300,
26
+ "onExhausted": "fail",
27
+ "skills": ["web-research"],
28
+ "tools": [
29
+ "web_search", "web_fetch",
30
+ "memory_read", "memory_write", "memory_search",
31
+ "todo_read", "todo_write",
32
+ "write_file",
33
+ "log_write", "sleep"
34
+ ]
35
+ },
36
+ "subagent": {
37
+ "enabled": true,
38
+ "maxIterations": 20,
39
+ "maxDurationSeconds": 180,
40
+ "skills": ["web-research"],
41
+ "tools": [
42
+ "web_search", "web_fetch",
43
+ "memory_write",
44
+ "todo_read", "todo_write",
45
+ "log_write"
46
+ ]
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,28 @@
1
+ # Skill: Web Research
2
+
3
+ ## Search Query Construction
4
+
5
+ - Use specific, targeted queries — not generic phrases
6
+ - Include the domain or technology in the query (e.g. "Node.js SQLite WAL mode performance")
7
+ - For factual lookups, add "official docs" or "site:github.com" to narrow to authoritative sources
8
+ - For current events, add the year to avoid stale results
9
+
10
+ ## Source Quality Tiers
11
+
12
+ | Tier | Examples | Trust Level |
13
+ |------|----------|-------------|
14
+ | Primary | Official docs, GitHub repos, RFCs, research papers | High |
15
+ | Secondary | Well-known tech publications (MDN, Stack Overflow, CSS-Tricks) | Medium |
16
+ | Tertiary | Blogs, Medium posts, forum answers | Low — verify independently |
17
+
18
+ ## Fetching Pages
19
+
20
+ - Prefer fetching pages from primary/secondary sources only
21
+ - If a page is behind a paywall or returns an error, note the URL as "inaccessible" and move on
22
+ - When a fetched page is very long, focus on headings and the first paragraph of each section
23
+
24
+ ## Avoiding Common Errors
25
+
26
+ - Do not treat AI-generated summaries (from search snippets) as verified facts
27
+ - Do not cite a URL you have not fetched — snippets can be misleading
28
+ - If two sources contradict each other, flag the discrepancy in your report rather than choosing one silently