@j-o-r/hello-dave 0.1.1 → 0.1.4

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 (173) hide show
  1. package/CHANGELOG.md +42 -25
  2. package/README.md +81 -221
  3. package/TODO.md +173 -35
  4. package/agents/agent_creator.js +105 -0
  5. package/agents/agent_creator.prompt.md +371 -0
  6. package/agents/ask_agent.js +64 -127
  7. package/agents/claude_agent.js +68 -0
  8. package/agents/code_agent.js +55 -135
  9. package/agents/code_agent.prompt.md +50 -0
  10. package/agents/echo_agent.js +76 -0
  11. package/agents/financial_expert.js +75 -0
  12. package/agents/gpt_agent.js +52 -103
  13. package/agents/gpt_code.js +81 -0
  14. package/agents/grok_agent.js +58 -114
  15. package/agents/minimax_agent.js +92 -0
  16. package/agents/mureka_agent.js +77 -0
  17. package/agents/planner_agent.js +172 -0
  18. package/agents/stability_agent.js +87 -0
  19. package/agents/test_agent.js +75 -157
  20. package/agents/weather_agent.js +73 -0
  21. package/agents/workflow_agent.js +189 -0
  22. package/bin/dave.js +436 -184
  23. package/docs/bin-dave.md +85 -35
  24. package/docs/cdn-ssh.md +100 -0
  25. package/docs/creating-agents.md +301 -0
  26. package/docs/creating-toolsets.md +336 -0
  27. package/docs/docs-organization.md +48 -0
  28. package/docs/project-overview.md +86 -51
  29. package/lib/API/elevenlabs.io/music.compose.md +441 -0
  30. package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
  31. package/lib/API/elevenlabs.io/music.stream.md +425 -0
  32. package/lib/API/lalal.ai/lalal.js +445 -0
  33. package/lib/API/lalal.ai/openapi.json +2614 -0
  34. package/lib/API/minimax/ImageToolset.js +82 -37
  35. package/lib/API/minimax/MusicToolset.js +125 -79
  36. package/lib/API/minimax/VideoToolset.js +170 -167
  37. package/lib/API/minimax/image.js +5 -1
  38. package/lib/API/minimax/music.js +210 -23
  39. package/lib/API/minimax/video.js +242 -53
  40. package/lib/API/mureka/MusicToolset.js +646 -0
  41. package/lib/API/mureka/README.md +41 -0
  42. package/lib/API/mureka/index.js +7 -0
  43. package/lib/API/mureka/music.js +658 -0
  44. package/lib/API/openai.com/index.js +7 -0
  45. package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
  46. package/lib/API/openai.com/video.create.character.md +40 -0
  47. package/lib/API/openai.com/video.create.md +219 -0
  48. package/lib/API/openai.com/video.delete.md +44 -0
  49. package/lib/API/openai.com/video.download.md +31 -0
  50. package/lib/API/openai.com/video.edit.md +155 -0
  51. package/lib/API/openai.com/video.extend.md +166 -0
  52. package/lib/API/openai.com/video.fetch.character.md +43 -0
  53. package/lib/API/openai.com/video.js +784 -0
  54. package/lib/API/openai.com/video.list.md +201 -0
  55. package/lib/API/openai.com/video.remix.md +175 -0
  56. package/lib/API/openai.com/video.retrieve.md +139 -0
  57. package/lib/API/openai.com/videoToolset.js +616 -0
  58. package/lib/API/stability.ai/ImageToolset.js +131 -40
  59. package/lib/API/stability.ai/MusicToolset.js +79 -47
  60. package/lib/API/stability.ai/audio.js +63 -131
  61. package/lib/API/x.ai/chat.responses.md +1040 -0
  62. package/lib/API/x.ai/image.js +229 -59
  63. package/lib/API/x.ai/imageToolset.js +376 -0
  64. package/lib/API/x.ai/index.js +1 -1
  65. package/lib/API/x.ai/responses.js +9 -18
  66. package/lib/Agent.js +271 -0
  67. package/lib/Agent.js.old +284 -0
  68. package/lib/AgentLauncher.js +562 -0
  69. package/lib/Cli.js +87 -13
  70. package/lib/Prompt.js +23 -1
  71. package/lib/Session.js +5 -4
  72. package/lib/ToolSet.js +102 -6
  73. package/lib/agentLoader.js +369 -0
  74. package/lib/cdn.js +67 -231
  75. package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
  76. package/lib/defaultToolsets.js +43 -0
  77. package/lib/fafs.js +1 -1
  78. package/lib/genericToolset.js +442 -119
  79. package/lib/handOffToolset.js +179 -0
  80. package/lib/index.js +34 -27
  81. package/lib/toolsetLoader.js +248 -0
  82. package/package.json +11 -5
  83. package/types/API/lalal.ai/lalal.d.ts +116 -0
  84. package/types/API/minimax/image.d.ts +2 -1
  85. package/types/API/minimax/music.d.ts +189 -26
  86. package/types/API/minimax/video.d.ts +100 -31
  87. package/types/API/mureka/index.d.ts +7 -0
  88. package/types/API/mureka/music.d.ts +472 -0
  89. package/types/API/openai.com/index.d.ts +7 -0
  90. package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
  91. package/types/API/openai.com/video.d.ts +409 -0
  92. package/types/API/openai.com/videoToolset.d.ts +24 -0
  93. package/types/API/stability.ai/audio.d.ts +14 -103
  94. package/types/API/stability.ai/image.d.ts +2 -2
  95. package/types/API/x.ai/image.d.ts +138 -26
  96. package/types/API/x.ai/imageToolset.d.ts +3 -0
  97. package/types/API/x.ai/index.d.ts +1 -1
  98. package/types/API/x.ai/responses.d.ts +4 -4
  99. package/types/Agent.d.ts +123 -0
  100. package/types/AgentLauncher.d.ts +222 -0
  101. package/types/Cli.d.ts +28 -8
  102. package/types/Prompt.d.ts +23 -5
  103. package/types/Session.d.ts +1 -1
  104. package/types/ToolSet.d.ts +10 -0
  105. package/types/agentLoader.d.ts +78 -0
  106. package/types/cdn.d.ts +15 -90
  107. package/types/defaultToolsets.d.ts +9 -0
  108. package/types/fafs.d.ts +1 -1
  109. package/types/genericToolset.d.ts +1 -1
  110. package/types/handOffToolset.d.ts +28 -0
  111. package/types/index.d.ts +19 -17
  112. package/types/toolsetLoader.d.ts +114 -0
  113. package/utils/format_log.js +101 -23
  114. package/utils/launch_agent.js +18 -0
  115. package/utils/list_sessions.sh +13 -5
  116. package/utils/search_sessions.sh +65 -29
  117. package/utils/toolsets.js +33 -0
  118. package/README.md.bak.1779452127 +0 -240
  119. package/agents/codeserver.sh +0 -47
  120. package/agents/daisy_agent.js +0 -173
  121. package/agents/docs_agent.js +0 -148
  122. package/agents/memory_agent.js +0 -263
  123. package/agents/minimax.js +0 -173
  124. package/agents/npm_agent.js +0 -202
  125. package/agents/prompt_agent.js +0 -133
  126. package/agents/readme_agent.js +0 -148
  127. package/agents/spawn_agent.js +0 -160
  128. package/agents/stability.js +0 -173
  129. package/agents/todo_agent.js +0 -175
  130. package/bin/codeDave +0 -58
  131. package/docs/agent-dave-websocket-protocol.md +0 -180
  132. package/docs/agent-manager.md +0 -244
  133. package/docs/codeserver-pattern.md +0 -191
  134. package/docs/generic-toolset.md +0 -326
  135. package/docs/howtos/agent-networking.md +0 -253
  136. package/docs/howtos/spawn-agents.md.bak +0 -200
  137. package/docs/howtos/spawn-agents.md.bak_new +0 -200
  138. package/docs/multi-agent-clusters.md +0 -265
  139. package/docs/music-toolsets.md +0 -137
  140. package/docs/path-resolution-best-practices.md +0 -104
  141. package/docs/plans/minimax-music-generation.md +0 -80
  142. package/docs/plans/unified-agent-architecture.md +0 -146
  143. package/docs/plans/websocket-streaming-plan.md.bak +0 -317
  144. package/docs/prompt/spawn_agent.md +0 -175
  145. package/docs/prompt/spawn_agent.md.bak +0 -201
  146. package/docs/prompt/task_clarification_and_documentation.md +0 -35
  147. package/docs/prompt-class.md +0 -141
  148. package/docs/todo-archive-infra-2026-04-21.md +0 -15
  149. package/docs/todo-archive-v0.0.8.md +0 -1
  150. package/docs/todo-archive-v0.1.0.md +0 -32
  151. package/docs/todo-archive.md +0 -44
  152. package/docs/tools-syntax-validation.md +0 -121
  153. package/docs/toolset.md +0 -164
  154. package/docs/xai-responses.md +0 -111
  155. package/docs/xai_collections.md +0 -106
  156. package/lib/API/x.ai/ImageToolset.js +0 -165
  157. package/lib/API/x.ai/text.js +0 -415
  158. package/lib/AgentClient.js +0 -248
  159. package/lib/AgentManager.js +0 -245
  160. package/lib/AgentServer.js +0 -404
  161. package/lib/wsCli.js +0 -287
  162. package/lib/wsIO.js +0 -90
  163. package/types/API/x.ai/text.d.ts +0 -286
  164. package/types/AgentClient.d.ts +0 -109
  165. package/types/AgentManager.d.ts +0 -100
  166. package/types/AgentServer.d.ts +0 -89
  167. package/types/wsCli.d.ts +0 -17
  168. package/types/wsIO.d.ts +0 -30
  169. package/utils/test.sh +0 -46
  170. /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
  171. /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
  172. /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
  173. /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
package/docs/bin-dave.md CHANGED
@@ -2,61 +2,111 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- The Dave CLI tool is the entry point for interacting with the Hello Dave project. It is located at `bin/dave.js` and can be run globally or via npx.
5
+ The `dave` CLI (`bin/dave.js`) is the main entry point.
6
6
 
7
- ## Installation
7
+ **Current model**: Bare (non-flag) first argument is treated as an agent name and delegated to `AgentLauncher`. All further arguments are forwarded.
8
8
 
9
- ### Global Installation
9
+ The old swarm / CodeServer / `--serve` / `--connect` / hybrid model has been abandoned.
10
10
 
11
- To install globally and use the `dave` command:
11
+ ## Running Agents
12
+
13
+ In the direct `hello-dave` project folder, agents are available with the `dave` command from `bin/dave.js`:
12
14
 
13
15
  ```bash
14
- npm install -g @j-o-r/hello-dave
16
+ dave <agent_name> # interactive CLI
17
+ dave <agent_name> "one-shot message"
18
+ echo "piped input" | dave <agent_name>
19
+ dave <agent_name> --info
20
+ dave <agent_name> --help
21
+
22
+ # Example
23
+ dave agent_creator --info
15
24
  ```
16
25
 
17
- ### Local Usage with npx
26
+ Only `*_agent.js` files are discovered.
27
+
28
+ For other projects, check `package.json` for a `bin` command and prefer that project-local launcher. If no suitable bin command exists, create a temporary ESM script that imports `AgentLauncher` from `@j-o-r/hello-dave`, loads the agent, and forwards arguments.
29
+
30
+ ## Built-in Commands
31
+
32
+ - `--help`
33
+ - `--list-agents`
34
+ - `--clear`
35
+ - `--search "query"`
36
+ - `--list`
37
+ - `--inspect "log.ndjson"`
38
+ - `--toolsets [filter...] [--json]`
39
+ - List toolsets exposed via `API.toolset`.
40
+ - Filters match provider (e.g. `minimax`), type (e.g. `image`, `music`), or full path (`minimax/music`).
41
+ - `--toolsets --help` shows detailed help for the toolsets command.
42
+ - Examples:
43
+ - `dave --toolsets`
44
+ - `dave --toolsets image`
45
+ - `dave --toolsets minimax music`
46
+ - `dave --toolsets --json`
47
+
48
+ These do not launch an agent.
49
+
50
+ ## Session Management for One-Shot Calls (No Background Services)
51
+
52
+ **Core principle**: Every `dave <agent> ...` invocation is an independent, short-lived process. There are **no background daemons, listeners, or persistent services**.
18
53
 
19
- Run without installation:
54
+ The interactive CLI (when you just run `dave <agent>` with no message) gives you rich in-memory session continuation with keyboard shortcuts (Alt+r reset, Alt+s load session, Alt+i info, etc.).
55
+
56
+ For one-shot and scripting use, the same session power is exposed via explicit flags. These operate on the existing per-agent NDJSON session storage under `.cache/@j-o-r/hello-dave/<agent>/sessions/`.
57
+
58
+ ### Session Flags (one-shot / scripting)
20
59
 
21
60
  ```bash
22
- npx @j-o-r/hello-dave [flags]
23
- ```
61
+ # Start a new conversation or continue the "current" session
62
+ # (the one from the most recent successful message call for this agent)
63
+ dave ask_agent "What's the weather in Paris?"
64
+
65
+ # List all previously saved sessions for this agent
66
+ dave ask_agent --list-sessions
24
67
 
25
- ## Available Flags
68
+ # Select a previous session. The *next* plain message call will continue from it.
69
+ dave ask_agent --load-session "what_s_the_weather_in_paris_0"
70
+ # or by recent index (most recent first)
71
+ dave ask_agent --load-session 2
26
72
 
27
- The CLI supports various flags for configuration and launching services. Common flags include:
73
+ # Force the next plain message call to start a completely fresh session
74
+ dave ask_agent --reset-session
75
+
76
+ # Show info about the currently selected / last active session
77
+ dave ask_agent --session-info
78
+
79
+ # Dedicated help for the session flags
80
+ dave ask_agent --session-help
81
+ ```
28
82
 
29
- - `--help`: Display help information.
30
- - `--version`: Show the current version of the Dave CLI.
31
- - `--code [port] [--secret secret]`: Launch a portable CodeServer instance. Optionally specify a port (defaults to 8080 if omitted). Use `--secret` to set an access password for the server.
83
+ **How it works (high level)**:
84
+ - A tiny per-agent "current session pointer" file tracks which session the next plain call should continue.
85
+ - `--load-session` updates the pointer.
86
+ - `--reset-session` clears/marks the pointer so the next call starts fresh.
87
+ - A plain message call pre-loads the pointed-to session (if any) into the Prompt before processing the new input, then updates the pointer afterward.
88
+ - All real history lives in the same NDJSON files used by the interactive CLI.
32
89
 
33
- For detailed information on the CodeServer pattern and integration, refer to [codeserver-pattern.md](codeserver-pattern.md).
90
+ This design gives you scriptable, "call from anywhere" session continuation with zero operational overhead.
34
91
 
35
- Other flags may be available depending on the version; run `dave --help` for the full list.
92
+ See the full plan and honest assessment: `docs/plans/no-service-session-continuation.md`.
36
93
 
37
- ## Examples
94
+ ## Handoffs
38
95
 
39
- ### Basic Usage
96
+ Handled inside agents via the `hand_over` / `load_agent` tools (registered from `API.toolset.generic.handoff`).
40
97
 
41
- - Show help (global):
42
- ```bash
43
- dave --help
44
- ```
98
+ See `docs/creating-agents.md` and `lib/handOffToolset.js`.
45
99
 
46
- - Show version (npx):
47
- ```bash
48
- npx @j-o-r/hello-dave --version
49
- ```
100
+ ## Legacy Networking
50
101
 
51
- ### Launching CodeServer
102
+ Old flags and patterns (`--connect`, `--serve`, `dave code_swarm`, etc.) are no longer supported in the CLI.
52
103
 
53
- - Launch on default port (global):
54
- ```bash
55
- dave --code
56
- ```
104
+ Historical documentation is in `docs/_legacy/`.
57
105
 
58
- - Launch on custom port with secret (npx):
59
- ```bash
60
- npx @j-o-r/hello-dave --code 3000 --secret mysecretpassword
61
- ```
106
+ ## References
62
107
 
108
+ - [docs/creating-agents.md](creating-agents.md) (current standard)
109
+ - [README.md](../README.md)
110
+ - `lib/AgentLauncher.js`
111
+ - `docs/plans/no-service-session-continuation.md` (primary session strategy)
112
+ - `docs/plans/agent-file-socket-communication.md` (earlier exploration — superseded for the no-service requirement)
@@ -0,0 +1,100 @@
1
+ # CDN & SSH Publishing (SSH_EP)
2
+
3
+ ## Overview
4
+
5
+ @j-o-r/hello-dave includes reusable modules for publishing local files (e.g., generated audio, images, documents) to a public HTTPS CDN via SSH/SCP.
6
+
7
+ This is useful for music/image/video agents (Minimax, Stability, Mureka, xAI image tools) so that remote LLMs or users can access generated artifacts via direct URLs.
8
+
9
+ ## Requirements
10
+
11
+ - Set the `SSH_EP` environment variable in the format:
12
+ ```
13
+ export SSH_EP='ssh://user@your-cdn-host.example.com:4301'
14
+ ```
15
+ or the shorter form:
16
+ ```
17
+ export SSH_EP='user@your-cdn-host.example.com:4301'
18
+ ```
19
+
20
+ - The remote host must:
21
+ - Accept SSH connections on the specified port.
22
+ - Have a web server serving the `htdocs` directory publicly over HTTPS (the module uploads to `htdocs/aaztmp/...` by default for temp/public files).
23
+
24
+ ## Core Module: lib/cdn.js
25
+
26
+ - `getSshConfig()`: Parses and validates `SSH_EP`.
27
+ - `publishFile(localPath, remoteRelativePath)`: Uploads a single file and returns `{ public_url, remote_path }`.
28
+ - Automatically creates parent directories under `htdocs/aaztmp/`.
29
+ - Public URL example: `https://your-cdn-host.example.com/aaztmp/tmp/myfile.mp3`
30
+
31
+ Full JSDoc and examples are in the source file.
32
+
33
+ ## Dedicated Toolset: lib/CdnToolset.js
34
+
35
+ Exposes the `publish_file` tool for agents:
36
+
37
+ ```js
38
+ import cdnTools from './CdnToolset.js';
39
+ // or via API
40
+ toolset.borrow(API.toolset.generic.cdn);
41
+ ```
42
+
43
+ Usage in an agent (after `const toolset = agent.getToolset()`):
44
+ ```js
45
+ await toolset.call('publish_file', {
46
+ localPath: '/tmp/generated.mp3',
47
+ remoteRelativePath: 'tmp/my-audio-123.mp3'
48
+ });
49
+ // Returns: { public_url: 'https://...', remote_path: '...' }
50
+ ```
51
+
52
+ ## Generic Tool Integration
53
+
54
+ `lib/genericToolset.js` includes `execute_remote_script` which also respects `SSH_EP` as a default for remote bash execution.
55
+
56
+ ## Helper Scripts & Scenarios
57
+
58
+ - `scenarios/_cdn-host.js`: Shared helper to derive CDN host from `SSH_EP` or `CDN_HOST` (priority: CDN_HOST > SSH_EP > fallback).
59
+ - `scenarios/demo-publish-cdn.js`: Full demo of publishing (single + multi-file). Requires `SSH_EP`.
60
+
61
+ Run the demo:
62
+ ```bash
63
+ export SSH_EP='ssh://user@host:port'
64
+ node scenarios/demo-publish-cdn.js
65
+ ```
66
+
67
+ ## Usage in Agents
68
+
69
+ Creative agents (e.g., `minimax_agent.js`, `stability_agent.js`) typically borrow the CDN toolset alongside their domain toolsets:
70
+
71
+ ```js
72
+ const toolset = agent.getToolset();
73
+ if (toolset) {
74
+ toolset.borrow(API.toolset.generic.cdn);
75
+ // plus music/image/video toolsets
76
+ }
77
+ ```
78
+
79
+ After generation, call `publish_file` (or the underlying `cdn.publishFile`) to expose results publicly.
80
+
81
+ ## Security & Best Practices
82
+
83
+ - Only relative paths under the configured remote root.
84
+ - Temp folders (`aaztmp`) are regularly cleared on the host.
85
+ - Use for non-sensitive, generated artifacts only.
86
+ - Validate `SSH_EP` before operations (the module throws clear errors if missing/invalid).
87
+
88
+ ## TypeScript Support
89
+
90
+ See `types/cdn.d.ts` for declarations of `getSshConfig` and `publishFile`.
91
+
92
+ ## Related Documentation
93
+
94
+ - `lib/cdn.js` (source + JSDoc)
95
+ - `lib/CdnToolset.js`
96
+ - `lib/genericToolset.js` (remote script tool)
97
+ - `docs/creating-agents.md` (how to borrow toolsets in new agents)
98
+ - `docs/generic-toolset.md` (overview of generic tools)
99
+
100
+ **Last updated**: June 2026 (documentation task completion for SSH_EP / CDN usage).
@@ -0,0 +1,301 @@
1
+ # Creating Agents
2
+
3
+ **Current canonical pattern (June 2026)**: Use the unified `Agent` class + `AgentLauncher`.
4
+
5
+ This document is the authoritative `@j-o-r/hello-dave` framework guide for creating and improving agent definitions.
6
+
7
+ ## Documentation Source Rules
8
+
9
+ All `hello-dave` agent documentation exists in the `@j-o-r/hello-dave` docs folder.
10
+
11
+ Use this document from one of these valid locations only:
12
+
13
+ 1. **Direct `@j-o-r/hello-dave` checkout**
14
+ - When the current working directory is the checked-out `@j-o-r/hello-dave` project itself, paths are relative to CWD.
15
+ - Example: `docs/creating-agents.md`
16
+
17
+ 2. **Installed package usage**
18
+ - In all other projects, read this document from the installed package.
19
+ - Prefer local install first, then global install.
20
+ - Example locations:
21
+ - `node_modules/@j-o-r/hello-dave/docs/creating-agents.md`
22
+ - `$(npm root -g)/@j-o-r/hello-dave/docs/creating-agents.md`
23
+
24
+ Do **not** rely on arbitrary project-local `docs/creating-agents.md` files for `hello-dave` framework guidance. Do **not** create or bootstrap this file into other projects as a framework-doc fallback.
25
+
26
+ ## Agent Creator Scope
27
+
28
+ `agent_creator` is a helper agent dedicated to the `@j-o-r/hello-dave` module.
29
+
30
+ It creates and improves `hello-dave` agent definitions while following this framework documentation. It may create or modify agent files in a user's project, but framework guidance must come from the `@j-o-r/hello-dave` docs folder only.
31
+
32
+ ## Quick Start — Minimal Agent
33
+
34
+ ```js
35
+ import { API, Agent } from '@j-o-r/hello-dave';
36
+
37
+ // call_name is derived from the filename and is the single source of truth.
38
+ const call_name = Agent.deriveCallName(import.meta.url);
39
+
40
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
41
+ const options = {
42
+ model: 'grok-4'
43
+ };
44
+
45
+ const call_description = `
46
+ Short description of what this agent does.
47
+ `.trim();
48
+
49
+ const agent = new Agent({
50
+ prompt: `You are a focused helper agent.`,
51
+ api: API.chat.grok,
52
+ options,
53
+ toolsetMode: 'auto',
54
+ contextWindow: 300000,
55
+ call_name,
56
+ call_description
57
+ });
58
+
59
+ const toolset = agent.getToolset();
60
+ if (toolset) {
61
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
62
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
63
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
64
+ toolset.borrow(API.toolset.generic.handoff);
65
+ }
66
+
67
+ export default agent;
68
+ ```
69
+
70
+ ## Extended Agents
71
+
72
+ Use an extended agent when the system prompt is long or should be maintained separately. `Agent.loadPrompt(import.meta.url)` loads an external sibling pure Markdown prompt file named `<agent_name>.prompt.md` as UTF-8 text.
73
+
74
+ ```js
75
+ import { API, Agent } from '@j-o-r/hello-dave';
76
+
77
+ const call_name = Agent.deriveCallName(import.meta.url);
78
+ const prompt = await Agent.loadPrompt(import.meta.url);
79
+
80
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
81
+ const options = {
82
+ model: 'grok-4'
83
+ };
84
+
85
+ const agent = new Agent({
86
+ prompt,
87
+ api: API.chat.grok,
88
+ options,
89
+ toolsetMode: 'auto',
90
+ contextWindow: 300000,
91
+ call_name,
92
+ call_description: 'Creates or improves focused agent definitions.'
93
+ });
94
+
95
+ export default agent;
96
+ ```
97
+
98
+ For an agent at:
99
+
100
+ ```text
101
+ agents/example_agent.js
102
+ ```
103
+
104
+ The sibling prompt file must be pure Markdown:
105
+
106
+ ```text
107
+ agents/example_agent.prompt.md
108
+ ```
109
+
110
+ ## API-specific Options
111
+
112
+ Agent `options` must match the selected `api`. Do not copy options between providers unless the provider type supports them.
113
+
114
+ ### GPT / OpenAI responses API
115
+
116
+ ```js
117
+ import { API } from '@j-o-r/hello-dave';
118
+
119
+ /** @type {import('@j-o-r/hello-dave/types/API/openai.com/responses').OAOptions} */
120
+ const options = {
121
+ model: 'gpt-5.5',
122
+ reasoning: { effort: 'high', summary: 'auto' }
123
+ };
124
+
125
+ const api = API.chat.gpt;
126
+ ```
127
+
128
+ ### Grok / xAI responses API
129
+
130
+ ```js
131
+ import { API } from '@j-o-r/hello-dave';
132
+
133
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
134
+ const options = {
135
+ model: 'grok-4'
136
+ };
137
+
138
+ const api = API.chat.grok;
139
+ ```
140
+
141
+ ### Claude / Anthropic text API
142
+
143
+ ```js
144
+ import { API } from '@j-o-r/hello-dave';
145
+
146
+ /** @type {import('@j-o-r/hello-dave/types/API/anthropic.com/text').ANTHOptions} */
147
+ const options = {
148
+ model: 'claude-sonnet-4-20250514'
149
+ };
150
+
151
+ const api = API.chat.claude;
152
+ ```
153
+
154
+ ## Accessing Agents
155
+
156
+ In the direct `hello-dave` project folder, agents are accessible through the `dave` command from `bin/dave.js`:
157
+
158
+ ```bash
159
+ dave agent_creator --info
160
+ ```
161
+
162
+ In other projects, check that project's `package.json` for a `bin` command and use that project-local command when available. If no suitable bin command exists, create a temporary ESM launcher script that uses `lib/AgentLauncher.js` through the package export:
163
+
164
+ ```js
165
+ import { AgentLauncher } from '@j-o-r/hello-dave';
166
+
167
+ const launcher = new AgentLauncher({ from: import.meta.url });
168
+ await launcher.load(process.argv[2]);
169
+ await launcher.run(process.argv.slice(3));
170
+ ```
171
+
172
+ Then run, for example:
173
+
174
+ ```bash
175
+ node ./tmp/launch-agent.mjs <name> --info
176
+ ```
177
+
178
+ ## Toolset Discovery
179
+
180
+ When creating or improving an agent that needs tools, inspect the available toolsets first using the appropriate launch command for the current project. In the direct `hello-dave` checkout this is:
181
+
182
+ ```bash
183
+ dave --toolsets
184
+ ```
185
+
186
+ This command lists the toolsets and tools available in the current `@j-o-r/hello-dave` installation or checkout. Use it before inventing or changing tool registrations.
187
+
188
+ Recommended approach:
189
+
190
+ 1. Run the detected launch command with `--toolsets` (for example, `dave --toolsets` in the direct checkout).
191
+ 2. Choose only the tools the agent needs.
192
+ 3. Register tools using the current `API.toolset...` references.
193
+ 4. Keep access minimal and task-focused.
194
+ 5. If the command is not available, fall back to this framework guide and current in-repository examples.
195
+
196
+ Example pattern:
197
+
198
+ ```js
199
+ const toolset = agent.getToolset();
200
+ if (toolset) {
201
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
202
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
203
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
204
+ toolset.borrow(API.toolset.generic.handoff);
205
+ }
206
+ ```
207
+
208
+ ## Key Requirements
209
+
210
+ - Use ESM syntax.
211
+ - Import framework symbols with:
212
+ ```js
213
+ import { API, Agent } from '@j-o-r/hello-dave';
214
+ ```
215
+ - Derive the agent name from the filename:
216
+ ```js
217
+ const call_name = Agent.deriveCallName(import.meta.url);
218
+ ```
219
+ - Include `call_name` and `call_description` in the `Agent` constructor.
220
+ - Include useful `cliIntro` for CLI-facing agents when appropriate.
221
+ - Include JSDoc comments for important code and exported behavior.
222
+ - Run the detected launch command with `--toolsets` before constructing or changing toolsets.
223
+ - Register only the tools the agent needs.
224
+ - Prefer `toolset.borrow(API.toolset.generic.handoff);` for collaboration.
225
+ - End with:
226
+ ```js
227
+ export default agent;
228
+ ```
229
+
230
+ ## Do Not
231
+
232
+ - Do not hardcode `call_name`.
233
+ - Do not add top-level `run()` calls.
234
+ - Do not use external npm packages for agent definitions.
235
+ - Do not use `API.chat.xai`; use `API.chat.grok`.
236
+ - Do not mix provider-specific option types or option shapes.
237
+ - Do not treat another project's `docs/creating-agents.md` as framework documentation.
238
+
239
+ ## Validation
240
+
241
+ Before running or recommending a changed JavaScript agent file, validate syntax:
242
+
243
+ ```bash
244
+ node --check agents/<name>.js
245
+ ```
246
+
247
+ Then test discovery/help with the detected launch command:
248
+
249
+ ```bash
250
+ <detected-launch-command> <name> --help
251
+ ```
252
+
253
+ ## Running
254
+
255
+ In the direct `hello-dave` checkout:
256
+
257
+ ```bash
258
+ dave <name>
259
+ dave <name> "message"
260
+ echo "..." | dave <name>
261
+ dave <name> --info
262
+ dave <name> --help
263
+ ```
264
+
265
+ For other projects, prefer the project's `package.json` `bin` command when present, or use a temporary `AgentLauncher` script as shown above. Package-based use can also be invoked with:
266
+
267
+ ```bash
268
+ npx @j-o-r/hello-dave <name> "message"
269
+ ```
270
+
271
+ ## Handoff
272
+
273
+ Use `hand_over` / `load_agent` only for clear domain shifts or deliberate fresh starts.
274
+
275
+ Handoff context must be short, task-focused, and self-contained. Do not use handoff for meta questions, generic restarts, or capability questions.
276
+
277
+ See `lib/handOffToolset.js` for framework implementation details.
278
+
279
+ ## Recommended Agent Creator Workflow
280
+
281
+ 1. Inspect the environment.
282
+ 2. Detect whether CWD is the direct `@j-o-r/hello-dave` checkout.
283
+ 3. Select the correct docs source:
284
+ - direct checkout: `docs/creating-agents.md`
285
+ - all other cases: `node_modules/@j-o-r/hello-dave/docs/creating-agents.md`
286
+ 4. Read the selected docs source.
287
+ 5. Run the detected launcher command with `--toolsets` before constructing or changing toolsets.
288
+ 6. Create or improve the requested agent definition.
289
+ 7. Backup before overwriting existing files.
290
+ 8. Run `node --check` on changed `.js` files.
291
+ 9. Recommend the detected launch command, such as `dave <name> --help`, as the final test.
292
+
293
+ ## Documentation Responsibility
294
+
295
+ Maintain this file as the framework-level source of truth for `@j-o-r/hello-dave` agent creation patterns.
296
+
297
+ Project-specific documentation may describe a separate project's own conventions, but it must not replace this framework guide as the source for `hello-dave` agent API behavior.
298
+
299
+ ---
300
+
301
+ *Last updated: June 2026 (single framework-doc source model clarified)*