@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,21 @@
1
+ You are Analyst, a thorough file and project analysis agent.
2
+
3
+ Your mission: explore project directories, read files, and produce structured analysis reports.
4
+
5
+ Capabilities:
6
+ - list_dir: explore directory structures
7
+ - read_file: read any file content
8
+ - glob: find files by pattern
9
+ - grep: search file contents
10
+ - memory_write: save important findings for later
11
+ - todo_write/todo_read: manage analysis checklist
12
+
13
+ Approach every analysis task systematically:
14
+ 1. Use todo_write to create an analysis checklist
15
+ 2. Explore the directory structure with list_dir
16
+ 3. Read key files (README, config, entry points)
17
+ 4. Use grep to find patterns across the codebase
18
+ 5. Write findings to memory as you go
19
+ 6. Produce a final structured report
20
+
21
+ Be thorough. Cover: project purpose, structure, technologies, key components, and observations.
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "analyst",
3
+ "description": "File and directory analysis agent. Explores project structures, reads files, summarizes codebases.",
4
+ "model": "moonshotai/kimi-k2.5",
5
+ "temperature": 0.7,
6
+ "reasoning": "medium",
7
+ "memory": { "enabled": false },
8
+ "skillDiscovery": false,
9
+ "modes": {
10
+ "chat": {
11
+ "enabled": true,
12
+ "tools": ["read_file", "list_dir", "glob", "grep", "memory_write", "memory_read", "todo_write", "todo_read"],
13
+ "disallowedTools": ["bash", "write_file", "edit_file"]
14
+ },
15
+ "task": {
16
+ "enabled": true,
17
+ "maxIterations": 30,
18
+ "maxDurationSeconds": 180,
19
+ "tools": ["read_file", "list_dir", "glob", "grep", "memory_write", "memory_read", "todo_write", "todo_read"],
20
+ "disallowedTools": ["bash", "write_file", "edit_file"]
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,15 @@
1
+ You are Assistant, a capable general-purpose AI agent.
2
+
3
+ You can help with a wide range of tasks including:
4
+ - Answering questions and explaining concepts
5
+ - Reading and writing files
6
+ - Analyzing codebases
7
+ - Running shell commands (when safe and necessary)
8
+ - Summarizing documents
9
+
10
+ When given a task:
11
+ 1. Think through what you need to do
12
+ 2. Use the appropriate tools (read_file, write_file, bash, etc.)
13
+ 3. Report your findings or completion clearly
14
+
15
+ Be concise in your responses. Prefer action over lengthy explanation.
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "assistant",
3
+ "description": "General-purpose assistant with file and shell access. Handles both chat and tasks.",
4
+ "model": "moonshotai/kimi-k2.5",
5
+ "temperature": 0.7,
6
+ "reasoning": "medium",
7
+ "memory": { "enabled": false },
8
+ "skillDiscovery": false,
9
+ "modes": {
10
+ "chat": { "enabled": true },
11
+ "task": {
12
+ "enabled": true,
13
+ "maxIterations": 20,
14
+ "maxDurationSeconds": 120,
15
+ "tools": ["bash", "read_file", "write_file", "edit_file", "list_dir", "glob", "grep"],
16
+ "disallowedTools": []
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,18 @@
1
+ You are Coder, an expert code analysis agent.
2
+
3
+ Your specialties:
4
+ - Reading and understanding codebases
5
+ - Explaining what code does and why
6
+ - Identifying bugs, anti-patterns, and security issues
7
+ - Suggesting improvements with clear rationale
8
+ - Documenting functions and modules
9
+
10
+ You have READ-ONLY access (no writes, no bash). Use read_file, list_dir, glob, and grep to explore codebases.
11
+
12
+ When analyzing code:
13
+ 1. Start by listing the directory structure
14
+ 2. Read key files (entry points, config, core modules)
15
+ 3. Identify patterns and architecture
16
+ 4. Provide clear, structured analysis
17
+
18
+ Be precise and technical. Reference specific line numbers and file paths.
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "coder",
3
+ "description": "Code analysis and explanation agent. Reads codebases, explains code, finds bugs, suggests improvements.",
4
+ "model": "moonshotai/kimi-k2.5",
5
+ "temperature": 0.7,
6
+ "reasoning": "medium",
7
+ "memory": { "enabled": false },
8
+ "skillDiscovery": false,
9
+ "modes": {
10
+ "chat": { "enabled": true },
11
+ "task": {
12
+ "enabled": true,
13
+ "maxIterations": 25,
14
+ "maxDurationSeconds": 180,
15
+ "tools": ["read_file", "list_dir", "glob", "grep"],
16
+ "disallowedTools": ["bash", "write_file", "edit_file"]
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ You are Hello, a friendly conversational agent.
2
+
3
+ Keep responses concise and warm. You can discuss any topic, answer questions, and engage in casual conversation. You have no access to tools — just respond from your knowledge.
4
+
5
+ When greeted, greet back warmly. When asked a question, answer directly and helpfully.
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "hello",
3
+ "description": "Simple conversational agent. No tools. Answers questions, chats, and greets.",
4
+ "model": "moonshotai/kimi-k2.5",
5
+ "temperature": 0.7,
6
+ "reasoning": "medium",
7
+ "memory": { "enabled": false },
8
+ "skillDiscovery": false,
9
+ "modes": {
10
+ "chat": { "enabled": true },
11
+ "task": { "enabled": true, "maxIterations": 5, "maxDurationSeconds": 60 }
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ You are Writer, a creative writing and content generation agent.
2
+
3
+ You excel at:
4
+ - Writing engaging stories, articles, and blog posts
5
+ - Summarizing and rewriting content
6
+ - Creating structured documents (reports, READMEs, specs)
7
+ - Adapting tone and style to the audience
8
+ - Generating creative content on any topic
9
+
10
+ You work purely from knowledge — no file access needed. Just produce high-quality written content.
11
+
12
+ Always deliver complete, polished output. Don't just outline — write the full content requested.
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "writer",
3
+ "description": "Creative writing agent. Generates stories, articles, summaries, and structured documents. No tools needed.",
4
+ "model": "moonshotai/kimi-k2.5",
5
+ "temperature": 0.9,
6
+ "reasoning": "medium",
7
+ "memory": { "enabled": false },
8
+ "skillDiscovery": false,
9
+ "modes": {
10
+ "chat": { "enabled": true },
11
+ "task": {
12
+ "enabled": true,
13
+ "maxIterations": 8,
14
+ "maxDurationSeconds": 90
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,343 @@
1
+
2
+
3
+ <!-- 2026-03-02 -->
4
+ # Project Analysis: VeilCli
5
+
6
+ ## Basic Information
7
+ - **Name**: veilcli
8
+ - **Version**: 0.1.0
9
+ - **Description**: Enterprise autonomous agent runtime — local, API-first, multi-model
10
+ - **License**: MIT
11
+ - **Node.js Requirements**: >=18.3.0
12
+
13
+ ## Entry Points
14
+ - **CLI Binary**: `./cli/index.js` (accessible via `veil` command)
15
+ - **Start Command**: `node cli/index.js start`
16
+ - **Test Command**: `node test/smoke.js`
17
+
18
+ ## Key Dependencies
19
+ - **ajv** (8.17.1): JSON schema validation
20
+ - **ajv-formats** (3.0.1): Additional format validators for AJV
21
+ - **better-sqlite3** (11.10.0): SQLite database (synchronous, high-performance)
22
+ - **cors** (2.8.5): Cross-Origin Resource Sharing middleware
23
+ - **express** (4.21.2): Web framework for API
24
+ - **node-cron** (3.0.3): Cron job scheduling
25
+
26
+ ## Architecture Insights
27
+ - API-first design with Express.js
28
+ - Local SQLite database for persistence
29
+ - Supports scheduled tasks via node-cron
30
+ - JSON schema validation for structured data
31
+ - Multi-model agent runtime capability
32
+
33
+ ## Notes
34
+ - No README.md file exists in the project root
35
+ - No devDependencies defined
36
+ - Project appears to be in early development (v0.1.0)
37
+
38
+ <!-- 2026-03-02 -->
39
+ <!-- 2026-03-02 -->
40
+ ## Complete Project Analysis: VeilCLI
41
+
42
+ ### Project Overview
43
+ **VeilCLI** is an enterprise-grade autonomous agent runtime built in Node.js. It provides a local-first, API-driven platform for running AI agents with multi-model support.
44
+
45
+ ### JavaScript File Count
46
+ Approximately **68 JavaScript files** in the main codebase (excluding node_modules and .OLD directory):
47
+ - tools/: 25 files
48
+ - TEST-APP/: 15 files
49
+ - core/: 8 files
50
+ - api/: 8 files
51
+ - cli/: 3 files
52
+ - utils/: 4 files
53
+ - infrastructure/: 2 files
54
+ - llm/: 1 file
55
+ - settings/: 1 file
56
+ - test/: 1 file
57
+
58
+ ### Core Architecture Components
59
+
60
+ #### 1. Agent System (core/agent.js)
61
+ - JSON-schema validated agent definitions
62
+ - Hierarchical agent loading (project-level → global)
63
+ - Multi-mode support: chat, task, daemon, subagent
64
+ - Agent configuration via agent.json + AGENT.md + SOUL.md
65
+
66
+ #### 2. Execution Loop (core/loop.js)
67
+ - Async generator-based agentic loop
68
+ - Tool permission system (allow/ask/deny)
69
+ - Anti-drift reminders every 10 iterations
70
+ - Stall detection and recovery
71
+ - Token tracking and limit enforcement
72
+
73
+ #### 3. Tool Registry (core/registry.js)
74
+ - 25 built-in tools organized by category:
75
+ - Agent communication (agent_message, agent_send, agent_spawn)
76
+ - File operations (read_file, write_file, edit_file, glob, list_dir)
77
+ - Code search (grep)
78
+ - System (bash, sleep)
79
+ - Task management (5 tools)
80
+ - Memory (3 tools)
81
+ - Planning (todo_read, todo_write)
82
+ - Web (web_search, web_fetch)
83
+ - Utilities (tool_search, log_write)
84
+ - Custom tool support via tool.json + index.js
85
+ - Input validation via AJV
86
+
87
+ #### 4. Database Layer (infrastructure/database.js)
88
+ - SQLite with better-sqlite3
89
+ - WAL mode enabled
90
+ - Migration system
91
+ - Stores: sessions, tasks, messages, todos, agent-messages
92
+
93
+ #### 5. LLM Client (llm/client.js)
94
+ - Native fetch-based (no SDK dependency)
95
+ - OpenAI-compatible API support
96
+ - Token usage tracking
97
+
98
+ #### 6. API Server (api/server.js)
99
+ - Express.js with CORS
100
+ - Route structure: /agents, /sessions, /tasks, /daemons, /system
101
+ - Auth middleware
102
+
103
+ #### 7. CLI Interface (cli/index.js)
104
+ - Commands: start, stop, run, status, agents, login
105
+ - Auto-daemon startup
106
+ - Task execution mode
107
+
108
+ ### Key Dependencies
109
+ - **express** (4.21.2): Web framework
110
+ - **better-sqlite3** (11.10.0): High-performance SQLite
111
+ - **ajv** (8.17.1): JSON schema validation
112
+ - **node-cron** (3.0.3): Cron scheduling
113
+ - **cors** (2.8.5): Cross-origin middleware
114
+
115
+ ### Notable Patterns
116
+
117
+ 1. **Mode-Based Execution**: Agents run in chat, task, daemon, or subagent modes with different behaviors
118
+ 2. **Permission Hierarchy**: Tool permissions checked at agent-level, then settings-level (deny → ask → allow)
119
+ 3. **Safety-First**: Auth file access is hardcoded as forbidden; permission system prevents unauthorized operations
120
+ 4. **Hot Reload**: Custom tools support cache-busting for development
121
+ 5. **Graceful Degradation**: LLM errors are retried up to 3 times with backoff
122
+ 6. **Context Compaction**: Anti-drift reminders and context management to keep agents focused
123
+ 7. **Multi-Level Configuration**: Project-level settings override global settings
124
+ 8. **Async Generators**: Core loop yields progress events for real-time monitoring
125
+
126
+ ### Directory Structure
127
+ ```
128
+ VeilCLI/
129
+ ├── api/ # Express routes and middleware
130
+ ├── cli/ # Command-line interface
131
+ ├── core/ # Agent runtime, loop, registry, router
132
+ ├── infrastructure/# Database and scheduler
133
+ ├── llm/ # LLM client abstraction
134
+ ├── settings/ # Configuration field definitions
135
+ ├── tools/ # Built-in tool implementations
136
+ ├── utils/ # Path resolution, context, settings loader
137
+ ├── schemas/ # JSON schemas for validation
138
+ ├── migrations/ # Database migrations
139
+ ├── system-prompts/# Layered prompt system
140
+ ├── examples/ # Example agent configurations
141
+ └── test/ # Smoke tests
142
+ ```
143
+
144
+ ### Configuration Locations
145
+ - **Project-level**: `.veil/` folder in project root
146
+ - **Global**: `~/.veil/` in user's home directory
147
+ - **Priority**: Project settings override global settings
148
+
149
+ ### Security Features
150
+ - Auth file reading is explicitly blocked
151
+ - Permission patterns support wildcards
152
+ - Tool input validation via JSON schema
153
+ - PreToolUse and PostToolUse hooks
154
+ - Permission levels: deny, ask, allow
155
+
156
+ <!-- 2026-03-02 -->
157
+ <!-- 2026-03-02 -->
158
+ ## Project Metadata: VeilCLI
159
+
160
+ ### Basic Information
161
+ - **Name**: veilcli
162
+ - **Version**: 0.1.0
163
+ - **Description**: Enterprise autonomous agent runtime — local, API-first, multi-model
164
+ - **License**: MIT
165
+ - **Node.js Requirements**: >=18.3.0
166
+
167
+ ### Entry Points
168
+ - **CLI Binary**: `./cli/index.js` (accessible via `veil` command)
169
+ - **Start Command**: `node cli/index.js start`
170
+ - **Test Command**: `node test/smoke.js`
171
+
172
+ ### Key Dependencies
173
+ - **ajv** (8.17.1): JSON schema validation
174
+ - **ajv-formats** (3.0.1): Additional format validators for AJV
175
+ - **better-sqlite3** (11.10.0): SQLite database (synchronous, high-performance)
176
+ - **cors** (2.8.5): Cross-Origin Resource Sharing middleware
177
+ - **express** (4.21.2): Web framework for API
178
+ - **node-cron** (3.0.3): Cron job scheduling
179
+
180
+ ### Architecture Insights
181
+ - API-first design with Express.js
182
+ - Local SQLite database for persistence
183
+ - Supports scheduled tasks via node-cron
184
+ - JSON schema validation for structured data
185
+ - Multi-model agent runtime capability
186
+
187
+ ### Notes
188
+ - No README.md file exists in the project root
189
+ - No devDependencies defined
190
+ - Project appears to be in early development (v0.1.0)
191
+
192
+ <!-- 2026-03-02 -->
193
+ ## Project Metadata: VeilCLI
194
+
195
+ ### Basic Information
196
+ - **Name**: veilcli
197
+ - **Version**: 0.1.0
198
+ - **Description**: Enterprise autonomous agent runtime — local, API-first, multi-model
199
+ - **License**: MIT
200
+ - **Node.js Requirements**: >=18.3.0
201
+
202
+ ### Entry Points
203
+ - **CLI Binary**: `./cli/index.js` (accessible via `veil` command)
204
+ - **Start Command**: `node cli/index.js start`
205
+ - **Test Command**: `node test/smoke.js`
206
+
207
+ ### Key Dependencies
208
+ - **ajv** (8.17.1): JSON schema validation
209
+ - **ajv-formats** (3.0.1): Additional format validators for AJV
210
+ - **better-sqlite3** (11.10.0): SQLite database (synchronous, high-performance)
211
+ - **cors** (2.8.5): Cross-Origin Resource Sharing middleware
212
+ - **express** (4.21.2): Web framework for API
213
+ - **node-cron** (3.0.3): Cron job scheduling
214
+
215
+ ### Architecture Insights
216
+ - API-first design with Express.js
217
+ - Local SQLite database for persistence
218
+ - Supports scheduled tasks via node-cron
219
+ - JSON schema validation for structured data
220
+ - Multi-model agent runtime capability
221
+
222
+ ### Notes
223
+ - No README.md file exists in the project root
224
+ - No devDependencies defined
225
+ - Project appears to be in early development (v0.1.0)
226
+
227
+ <!-- 2026-03-02 -->
228
+ <!-- 2026-03-02 -->
229
+ ## Complete Project Analysis: VeilCLI
230
+
231
+ ### Project Overview
232
+ **VeilCLI** is an enterprise-grade autonomous agent runtime built in Node.js. It provides a local-first, API-driven platform for running AI agents with multi-model support.
233
+
234
+ ### JavaScript File Count
235
+ **78 JavaScript files** in the main codebase (excluding node_modules and .OLD directory):
236
+ - tools/: 25 files
237
+ - TEST-APP/: 16 files
238
+ - core/: 8 files
239
+ - api/: 7 files
240
+ - cli/: 3 files
241
+ - utils/: 4 files
242
+ - infrastructure/: 2 files
243
+ - llm/: 1 file
244
+ - settings/: 1 file
245
+ - test/: 1 file
246
+
247
+ ### Core Architecture Components
248
+
249
+ #### 1. Agent System (core/agent.js)
250
+ - JSON-schema validated agent definitions
251
+ - Hierarchical agent loading (project-level → global)
252
+ - Multi-mode support: chat, task, daemon, subagent
253
+ - Agent configuration via agent.json + AGENT.md + SOUL.md
254
+
255
+ #### 2. Execution Loop (core/loop.js)
256
+ - Async generator-based agentic loop
257
+ - Tool permission system (allow/ask/deny)
258
+ - Anti-drift reminders every 10 iterations
259
+ - Stall detection and recovery
260
+ - Token tracking and limit enforcement
261
+
262
+ #### 3. Tool Registry (core/registry.js)
263
+ - 25 built-in tools organized by category:
264
+ - Agent communication (agent_message, agent_send, agent_spawn)
265
+ - File operations (read_file, write_file, edit_file, glob, list_dir)
266
+ - Code search (grep)
267
+ - System (bash, sleep)
268
+ - Task management (5 tools)
269
+ - Memory (3 tools)
270
+ - Planning (todo_read, todo_write)
271
+ - Web (web_search, web_fetch)
272
+ - Utilities (tool_search, log_write)
273
+ - Custom tool support via tool.json + index.js
274
+ - Input validation via AJV
275
+
276
+ #### 4. Database Layer (infrastructure/database.js)
277
+ - SQLite with better-sqlite3
278
+ - WAL mode enabled
279
+ - Migration system
280
+ - Stores: sessions, tasks, messages, todos, agent-messages
281
+
282
+ #### 5. LLM Client (llm/client.js)
283
+ - Native fetch-based (no SDK dependency)
284
+ - OpenAI-compatible API support
285
+ - Token usage tracking
286
+
287
+ #### 6. API Server (api/server.js)
288
+ - Express.js with CORS
289
+ - Route structure: /agents, /sessions, /tasks, /daemons, /system
290
+ - Auth middleware
291
+
292
+ #### 7. CLI Interface (cli/index.js)
293
+ - Commands: start, stop, run, status, agents, login
294
+ - Auto-daemon startup
295
+ - Task execution mode
296
+
297
+ ### Key Dependencies
298
+ - **express** (4.21.2): Web framework
299
+ - **better-sqlite3** (11.10.0): High-performance SQLite
300
+ - **ajv** (8.17.1): JSON schema validation
301
+ - **node-cron** (3.0.3): Cron scheduling
302
+ - **cors** (2.8.5): Cross-origin middleware
303
+
304
+ ### Notable Patterns
305
+
306
+ 1. **Mode-Based Execution**: Agents run in chat, task, daemon, or subagent modes with different behaviors
307
+ 2. **Permission Hierarchy**: Tool permissions checked at agent-level, then settings-level (deny → ask → allow)
308
+ 3. **Safety-First**: Auth file access is hardcoded as forbidden; permission system prevents unauthorized operations
309
+ 4. **Hot Reload**: Custom tools support cache-busting for development
310
+ 5. **Graceful Degradation**: LLM errors are retried up to 3 times with backoff
311
+ 6. **Context Compaction**: Anti-drift reminders and context management to keep agents focused
312
+ 7. **Multi-Level Configuration**: Project-level settings override global settings
313
+ 8. **Async Generators**: Core loop yields progress events for real-time monitoring
314
+
315
+ ### Directory Structure
316
+ ```
317
+ VeilCLI/
318
+ ├── api/ # Express routes and middleware
319
+ ├── cli/ # Command-line interface
320
+ ├── core/ # Agent runtime, loop, registry, router
321
+ ├── infrastructure/# Database and scheduler
322
+ ├── llm/ # LLM client abstraction
323
+ ├── settings/ # Configuration field definitions
324
+ ├── tools/ # Built-in tool implementations
325
+ ├── utils/ # Path resolution, context, settings loader
326
+ ├── schemas/ # JSON schemas for validation
327
+ ├── migrations/ # Database migrations
328
+ ├── system-prompts/# Layered prompt system
329
+ ├── examples/ # Example agent configurations
330
+ └── test/ # Smoke tests
331
+ ```
332
+
333
+ ### Configuration Locations
334
+ - **Project-level**: `.veil/` folder in project root
335
+ - **Global**: `~/.veil/` in user's home directory
336
+ - **Priority**: Project settings override global settings
337
+
338
+ ### Security Features
339
+ - Auth file reading is explicitly blocked
340
+ - Permission patterns support wildcards
341
+ - Tool input validation via JSON schema
342
+ - PreToolUse and PostToolUse hooks
343
+ - Permission levels: deny, ask, allow
@@ -0,0 +1,55 @@
1
+
2
+
3
+ <!-- 2026-03-02 -->
4
+ ## Tools Directory Analysis
5
+
6
+ The `/home/ixi/khacloud/drive/Plugins/VeilCli/tools` directory contains **25 tool files** that provide the core functionality for VeilCLI agents.
7
+
8
+ ### Tool Categories:
9
+
10
+ **Agent Communication (3 tools):**
11
+ - `agent_message.js` - Synchronous message to another agent with response waiting
12
+ - `agent_send.js` - Asynchronous fire-and-forget message to another agent
13
+ - `agent_spawn.js` - Spawn sub-agents with sync/async modes and return modes
14
+
15
+ **File Operations (5 tools):**
16
+ - `read_file.js` - Read file contents with offset/limit support
17
+ - `write_file.js` - Write/overwrite entire files
18
+ - `edit_file.js` - Search-and-replace file editing
19
+ - `glob.js` - Find files matching glob patterns
20
+ - `list_dir.js` - List directory contents with sizes
21
+
22
+ **Code Search (1 tool):**
23
+ - `grep.js` - Search file contents with regex support
24
+
25
+ **System Operations (2 tools):**
26
+ - `bash.js` - Execute shell commands with timeout support
27
+ - `sleep.js` - Wait for specified duration
28
+
29
+ **Task Management (5 tools):**
30
+ - `task_create.js` - Create new async tasks
31
+ - `task_status.js` - Check task status and output
32
+ - `task_respond.js` - Respond to waiting tasks
33
+ - `task_subscribe.js` - Subscribe to task completion
34
+
35
+ **Memory Management (3 tools):**
36
+ - `memory_read.js` - Read agent/project memory files
37
+ - `memory_write.js` - Write to persistent memory
38
+ - `memory_search.js` - Search across memory files
39
+
40
+ **Planning (2 tools):**
41
+ - `todo_read.js` - Read session TODO list
42
+ - `todo_write.js` - Create/update structured TODOs
43
+
44
+ **Web Operations (2 tools):**
45
+ - `web_search.js` - Web search via DuckDuckGo
46
+ - `web_fetch.js` - Fetch URL content (text/JSON/base64)
47
+
48
+ **Utilities (1 tool):**
49
+ - `tool_search.js` - Search available tools by name/description
50
+ - `log_write.js` - Write progress entries to task log
51
+
52
+ ### Key Dependencies:
53
+ - Most tools use `../infrastructure/database` for persistence
54
+ - File tools use Node.js `fs` and `path` modules
55
+ - Memory tools use `../utils/paths` for directory resolution
@@ -0,0 +1,12 @@
1
+
2
+
3
+ <!-- 2026-03-02 -->
4
+ User's name is TestUser42.
5
+
6
+ <!-- 2026-03-02 -->
7
+ <!-- 2026-03-02 -->
8
+ User's name is TestUser42.
9
+
10
+ <!-- 2026-03-02 -->
11
+ <!-- 2026-03-02 -->
12
+ User's test codeword: **ZEBRA_KITE_77**
@@ -0,0 +1 @@
1
+ 3672838
@@ -0,0 +1,10 @@
1
+ {
2
+ "port": 5050,
3
+ "maxIterations": 30,
4
+ "maxDurationSeconds": 120,
5
+ "permissions": {
6
+ "allow": ["*"],
7
+ "deny": [],
8
+ "ask": []
9
+ }
10
+ }
Binary file
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ # 01 — Vision & Identity
2
+
3
+ ## What VeilCLI Is
4
+
5
+ VeilCLI is an **enterprise autonomous agent runtime**. It runs locally on any machine, manages autonomous AI agents, and exposes a clean REST API for any consumer (web app, mobile app, CLI, another service) to interact with.
6
+
7
+ Think: **rebuilt OpenClaw with Claude Code-level engineering quality** — but for autonomous enterprise agents, not a coding copilot.
8
+
9
+ ## What VeilCLI Is NOT
10
+
11
+ - **Not a coding copilot** or IDE extension
12
+ - **Not a cloud service** — runs locally, optional remote access via Ably
13
+ - **Not a UI application** — REST API only, UIs built separately
14
+ - **Not a personal/hobby tool** — enterprise-grade: permissions, hooks, audit logs, retention
15
+ - **Not an LLM wrapper** — it's a full agent runtime with tool execution, context management, multi-agent orchestration
16
+
17
+ ## Core Philosophy
18
+
19
+ - **Local-first, offline-capable** — no internet required for core operation
20
+ - **API-first, UI-agnostic** — REST API is the sole interface; documentation is primary
21
+ - **File-system for definitions** — agents, skills, config are files (versionable, portable)
22
+ - **SQLite for runtime data** — sessions, messages, tasks (queryable, atomic, single-file)
23
+ - **Claude Code ecosystem importable** — `veil import` converts CLAUDE.md, .claude/ settings, and skills to VeilCLI format
24
+ - **Any LLM provider** — single `base_url` + `api_key` interface (OpenRouter, Anthropic, Ollama, etc.)
25
+ - **Minimum custom work** — reuse existing libraries and standards, don't reinvent
26
+ - **Forkable** — all branding/naming in `config.json`, can be forked and rebranded