bonecode 1.2.3 → 1.3.0
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.
- package/README.md +20 -0
- package/dist/src/engine/agent/prompt/compaction.txt +9 -0
- package/dist/src/engine/agent/prompt/explore.txt +18 -0
- package/dist/src/engine/agent/prompt/scout.txt +36 -0
- package/dist/src/engine/agent/prompt/summary.txt +11 -0
- package/dist/src/engine/agent/prompt/title.txt +44 -0
- package/dist/src/engine/session/prompt/anthropic.txt +105 -0
- package/dist/src/engine/session/prompt/beast.txt +147 -0
- package/dist/src/engine/session/prompt/bonescript.txt +391 -0
- package/dist/src/engine/session/prompt/build-switch.txt +5 -0
- package/dist/src/engine/session/prompt/codex.txt +79 -0
- package/dist/src/engine/session/prompt/copilot-gpt-5.txt +143 -0
- package/dist/src/engine/session/prompt/default.txt +105 -0
- package/dist/src/engine/session/prompt/gemini.txt +155 -0
- package/dist/src/engine/session/prompt/gpt.txt +107 -0
- package/dist/src/engine/session/prompt/kimi.txt +95 -0
- package/dist/src/engine/session/prompt/max-steps.txt +16 -0
- package/dist/src/engine/session/prompt/plan-reminder-anthropic.txt +67 -0
- package/dist/src/engine/session/prompt/plan.txt +26 -0
- package/dist/src/engine/session/prompt/trinity.txt +97 -0
- package/dist/src/engine/session/prompt.js +35 -2
- package/dist/src/engine/session/prompt.js.map +1 -1
- package/dist/src/engine/skill/prompt/customize-opencode.md +377 -0
- package/dist/src/engine/tool/apply_patch.txt +33 -0
- package/dist/src/engine/tool/edit.txt +10 -0
- package/dist/src/engine/tool/glob.txt +6 -0
- package/dist/src/engine/tool/grep.txt +8 -0
- package/dist/src/engine/tool/lsp.txt +24 -0
- package/dist/src/engine/tool/plan-enter.txt +14 -0
- package/dist/src/engine/tool/plan-exit.txt +13 -0
- package/dist/src/engine/tool/question.txt +10 -0
- package/dist/src/engine/tool/read.txt +14 -0
- package/dist/src/engine/tool/repo_clone.txt +5 -0
- package/dist/src/engine/tool/repo_overview.txt +4 -0
- package/dist/src/engine/tool/shell/shell.txt +77 -0
- package/dist/src/engine/tool/skill.txt +5 -0
- package/dist/src/engine/tool/task.txt +58 -0
- package/dist/src/engine/tool/task_status.txt +13 -0
- package/dist/src/engine/tool/todowrite.txt +167 -0
- package/dist/src/engine/tool/tool/apply_patch.txt +33 -0
- package/dist/src/engine/tool/tool/edit.txt +10 -0
- package/dist/src/engine/tool/tool/glob.txt +6 -0
- package/dist/src/engine/tool/tool/grep.txt +8 -0
- package/dist/src/engine/tool/tool/lsp.txt +24 -0
- package/dist/src/engine/tool/tool/plan-enter.txt +14 -0
- package/dist/src/engine/tool/tool/plan-exit.txt +13 -0
- package/dist/src/engine/tool/tool/question.txt +10 -0
- package/dist/src/engine/tool/tool/read.txt +14 -0
- package/dist/src/engine/tool/tool/repo_clone.txt +5 -0
- package/dist/src/engine/tool/tool/repo_overview.txt +4 -0
- package/dist/src/engine/tool/tool/shell/shell.txt +77 -0
- package/dist/src/engine/tool/tool/skill.txt +5 -0
- package/dist/src/engine/tool/tool/task.txt +58 -0
- package/dist/src/engine/tool/tool/task_status.txt +13 -0
- package/dist/src/engine/tool/tool/todowrite.txt +167 -0
- package/dist/src/engine/tool/tool/webfetch.txt +13 -0
- package/dist/src/engine/tool/tool/websearch.txt +14 -0
- package/dist/src/engine/tool/tool/write.txt +8 -0
- package/dist/src/engine/tool/webfetch.txt +13 -0
- package/dist/src/engine/tool/websearch.txt +14 -0
- package/dist/src/engine/tool/write.txt +8 -0
- package/package.json +2 -2
- package/scripts/copy_prompts.js +58 -0
- package/scripts/test_bonescript_primer.js +111 -0
- package/src/engine/session/prompt/bonescript.txt +391 -0
- package/src/engine/session/prompt.ts +36 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- Clone or refresh a repository into OpenCode's managed cache under the data directory
|
|
2
|
+
- Accepts git URLs, forge host/path references, or GitHub owner/repo shorthand
|
|
3
|
+
- Returns the cached absolute local path so other tools can explore the cloned source
|
|
4
|
+
- Use this before Read, Glob, or Grep when the code you need lives outside the current workspace
|
|
5
|
+
- This tool is intended for dependency and documentation research workflows, not for modifying the user's workspace
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
- Summarize the structure and likely entrypoints of a cloned repository or local directory
|
|
2
|
+
- Accepts either a cached repository reference or a directory path
|
|
3
|
+
- Reports detected ecosystems, dependency files, package manager, likely entrypoints, and a compact structure tree
|
|
4
|
+
- Use this after repo_clone to orient quickly before deeper Read, Glob, or Grep investigation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
${intro}
|
|
2
|
+
|
|
3
|
+
Be aware: OS: ${os}, Shell: ${shell}
|
|
4
|
+
|
|
5
|
+
${workdirSection}
|
|
6
|
+
|
|
7
|
+
Use `${tmp}` for temporary work outside the workspace. This directory has already been created, already exists, and is pre-approved for external directory access.
|
|
8
|
+
|
|
9
|
+
IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
|
|
10
|
+
|
|
11
|
+
${commandSection}
|
|
12
|
+
|
|
13
|
+
# Committing changes with git
|
|
14
|
+
|
|
15
|
+
Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
|
|
16
|
+
|
|
17
|
+
Git Safety Protocol:
|
|
18
|
+
- NEVER update the git config
|
|
19
|
+
- NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
|
|
20
|
+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
21
|
+
- NEVER run force push to main/master, warn the user if they request it
|
|
22
|
+
- Avoid git commit --amend. ONLY use --amend when ALL conditions are met:
|
|
23
|
+
(1) User explicitly requested amend, OR the commit succeeded and pre-commit hooks auto-modified files that need including — verify by checking `git log` that HEAD is the new commit before amending
|
|
24
|
+
(2) HEAD commit was created by you in this conversation (verify: git log -1 --format='%an %ae')
|
|
25
|
+
(3) Commit has NOT been pushed to remote (verify: git status shows "Your branch is ahead")
|
|
26
|
+
- CRITICAL: If commit FAILED or was REJECTED by hook, NEVER amend - fix the issue and create a NEW commit
|
|
27
|
+
- CRITICAL: If you already pushed to remote, NEVER amend unless user explicitly requests it (requires force push)
|
|
28
|
+
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
|
|
29
|
+
|
|
30
|
+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel, each using the ${toolName} tool:
|
|
31
|
+
- Run a git status command to see all untracked files.
|
|
32
|
+
- Run a git diff command to see both staged and unstaged changes that will be committed.
|
|
33
|
+
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
|
|
34
|
+
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
|
|
35
|
+
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
|
|
36
|
+
- Do not commit files that likely contain secrets (.env, credentials.json, etc.). Warn the user if they specifically request to commit those files
|
|
37
|
+
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
|
|
38
|
+
- Ensure it accurately reflects the changes and their purpose
|
|
39
|
+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
|
|
40
|
+
- Add relevant untracked files to the staging area.
|
|
41
|
+
- Create the commit with a message
|
|
42
|
+
- Run git status after the commit completes to verify success.
|
|
43
|
+
Note: git status depends on the commit completing, so run it sequentially after the commit.
|
|
44
|
+
4. If the commit fails due to pre-commit hook, fix the issue and create a NEW commit (see amend rules above)
|
|
45
|
+
|
|
46
|
+
Important notes:
|
|
47
|
+
- NEVER run additional commands to read or explore code, besides ${gitCommandRestriction}
|
|
48
|
+
- NEVER use the TodoWrite or Task tools
|
|
49
|
+
- DO NOT push to the remote repository unless the user explicitly asks you to do so
|
|
50
|
+
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
|
|
51
|
+
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
|
|
52
|
+
|
|
53
|
+
# Creating pull requests
|
|
54
|
+
Use the gh command via the ${toolName} tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a GitHub URL use the gh command to get the information needed.
|
|
55
|
+
|
|
56
|
+
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
|
|
57
|
+
|
|
58
|
+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following ${gitCommands} in parallel using the ${toolName} tool, in order to understand the current state of the branch since it diverged from the main branch:
|
|
59
|
+
- Run a git status command to see all untracked files
|
|
60
|
+
- Run a git diff command to see both staged and unstaged changes that will be committed
|
|
61
|
+
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
|
|
62
|
+
- Run a git log command and `git diff [base-branch]...HEAD` to understand the full commit history for the current branch (from the time it diverged from the base branch)
|
|
63
|
+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
|
|
64
|
+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
|
|
65
|
+
- Create new branch if needed
|
|
66
|
+
- Push to remote with -u flag if needed
|
|
67
|
+
- ${createPrInstruction}
|
|
68
|
+
<example>
|
|
69
|
+
${createPrExample}
|
|
70
|
+
</example>
|
|
71
|
+
|
|
72
|
+
Important:
|
|
73
|
+
- DO NOT use the TodoWrite or Task tools
|
|
74
|
+
- Return the PR URL when you're done, so the user can see it
|
|
75
|
+
|
|
76
|
+
# Other common operations
|
|
77
|
+
- View comments on a GitHub PR: gh api repos/foo/bar/pulls/123/comments
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Load a specialized skill when the task at hand matches one of the skills listed in the system prompt.
|
|
2
|
+
|
|
3
|
+
Use this tool to inject the skill's instructions and resources into current conversation. The output may contain detailed workflow guidance as well as references to scripts, files, etc in the same directory as the skill.
|
|
4
|
+
|
|
5
|
+
The skill name must match one of the skills listed in your system prompt.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Launch a new agent to handle complex, multistep tasks autonomously.
|
|
2
|
+
|
|
3
|
+
When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.
|
|
4
|
+
|
|
5
|
+
When to use the Task tool:
|
|
6
|
+
- When you are instructed to execute custom slash commands. Use the Task tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py")
|
|
7
|
+
|
|
8
|
+
When NOT to use the Task tool:
|
|
9
|
+
- If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly
|
|
10
|
+
- If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
|
|
11
|
+
- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly
|
|
12
|
+
- Other tasks that are not related to the agent descriptions above
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Usage notes:
|
|
16
|
+
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
|
|
17
|
+
2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result. The output includes a task_id you can reuse later to continue the same subagent session.
|
|
18
|
+
3. If OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS is enabled, background=true launches the subagent asynchronously. Use task_status(task_id=..., wait=false) to poll, or wait=true to block until done.
|
|
19
|
+
4. Each agent invocation starts with a fresh context unless you provide task_id to resume the same subagent session (which continues with its previous messages and tool outputs). When starting fresh, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.
|
|
20
|
+
5. The agent's outputs should generally be trusted
|
|
21
|
+
6. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
|
|
22
|
+
7. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
|
|
23
|
+
|
|
24
|
+
Example usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):
|
|
25
|
+
|
|
26
|
+
<example_agent_descriptions>
|
|
27
|
+
"code-reviewer": use this agent after you are done writing a significant piece of code
|
|
28
|
+
"greeting-responder": use this agent when to respond to user greetings with a friendly joke
|
|
29
|
+
</example_agent_description>
|
|
30
|
+
|
|
31
|
+
<example>
|
|
32
|
+
user: "Please write a function that checks if a number is prime"
|
|
33
|
+
assistant: Sure let me write a function that checks if a number is prime
|
|
34
|
+
assistant: First let me use the Write tool to write a function that checks if a number is prime
|
|
35
|
+
assistant: I'm going to use the Write tool to write the following code:
|
|
36
|
+
<code>
|
|
37
|
+
function isPrime(n) {
|
|
38
|
+
if (n <= 1) return false
|
|
39
|
+
for (let i = 2; i * i <= n; i++) {
|
|
40
|
+
if (n % i === 0) return false
|
|
41
|
+
}
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
</code>
|
|
45
|
+
<commentary>
|
|
46
|
+
Since a significant piece of code was written and the task was completed, now use the code-reviewer agent to review the code
|
|
47
|
+
</commentary>
|
|
48
|
+
assistant: Now let me use the code-reviewer agent to review the code
|
|
49
|
+
assistant: Uses the Task tool to launch the code-reviewer agent
|
|
50
|
+
</example>
|
|
51
|
+
|
|
52
|
+
<example>
|
|
53
|
+
user: "Hello"
|
|
54
|
+
<commentary>
|
|
55
|
+
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
|
|
56
|
+
</commentary>
|
|
57
|
+
assistant: "I'm going to use the Task tool to launch the with the greeting-responder agent"
|
|
58
|
+
</example>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Poll the status of a background subagent task launched with the task tool.
|
|
2
|
+
|
|
3
|
+
Use this for tasks started with `task(background=true)`.
|
|
4
|
+
|
|
5
|
+
Parameters:
|
|
6
|
+
- `task_id` (required): the task session id returned by the task tool
|
|
7
|
+
- `wait` (optional): when true, wait for completion
|
|
8
|
+
- `timeout_ms` (optional): max wait duration in milliseconds when `wait=true`
|
|
9
|
+
|
|
10
|
+
Returns compact, parseable output:
|
|
11
|
+
- `task_id`
|
|
12
|
+
- `state` (`running`, `completed`, `error`, or `cancelled`)
|
|
13
|
+
- `<task_result>...</task_result>` or `<task_error>...</task_error>` containing final output, error summary, or current progress text
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
2
|
+
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
3
|
+
|
|
4
|
+
## When to Use This Tool
|
|
5
|
+
Use this tool proactively in these scenarios:
|
|
6
|
+
|
|
7
|
+
1. Complex multistep tasks - When a task requires 3 or more distinct steps or actions
|
|
8
|
+
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
|
|
9
|
+
3. User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
10
|
+
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
11
|
+
5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.
|
|
12
|
+
6. After completing a task - Mark it complete and add any new follow-up tasks
|
|
13
|
+
7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.
|
|
14
|
+
|
|
15
|
+
## When NOT to Use This Tool
|
|
16
|
+
|
|
17
|
+
Skip using this tool when:
|
|
18
|
+
1. There is only a single, straightforward task
|
|
19
|
+
2. The task is trivial and tracking it provides no organizational benefit
|
|
20
|
+
3. The task can be completed in less than 3 trivial steps
|
|
21
|
+
4. The task is purely conversational or informational
|
|
22
|
+
|
|
23
|
+
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
24
|
+
|
|
25
|
+
## Examples of When to Use the Todo List
|
|
26
|
+
|
|
27
|
+
<example>
|
|
28
|
+
User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
|
|
29
|
+
Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
|
|
30
|
+
*Creates todo list with the following items:*
|
|
31
|
+
1. Create dark mode toggle component in Settings page
|
|
32
|
+
2. Add dark mode state management (context/store)
|
|
33
|
+
3. Implement CSS-in-JS styles for dark theme
|
|
34
|
+
4. Update existing components to support theme switching
|
|
35
|
+
5. Run tests and build process, addressing any failures or errors that occur
|
|
36
|
+
*Begins working on the first task*
|
|
37
|
+
|
|
38
|
+
<reasoning>
|
|
39
|
+
The assistant used the todo list because:
|
|
40
|
+
1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
|
|
41
|
+
2. The user explicitly requested tests and build be run afterward
|
|
42
|
+
3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
|
|
43
|
+
</reasoning>
|
|
44
|
+
</example>
|
|
45
|
+
|
|
46
|
+
<example>
|
|
47
|
+
User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
|
|
48
|
+
Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
|
|
49
|
+
*Uses grep or search tools to locate all instances of getCwd in the codebase*
|
|
50
|
+
Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
|
|
51
|
+
*Creates todo list with specific items for each file that needs updating*
|
|
52
|
+
|
|
53
|
+
<reasoning>
|
|
54
|
+
The assistant used the todo list because:
|
|
55
|
+
1. First, the assistant searched to understand the scope of the task
|
|
56
|
+
2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
|
|
57
|
+
3. The todo list helps ensure every instance is tracked and updated systematically
|
|
58
|
+
4. This approach prevents missing any occurrences and maintains code consistency
|
|
59
|
+
</reasoning>
|
|
60
|
+
</example>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<example>
|
|
64
|
+
User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
|
|
65
|
+
Assistant: I'll help implement these features. First, let's add all the features to the todo list.
|
|
66
|
+
*Creates a todo list breaking down each feature into specific tasks based on the project architecture*
|
|
67
|
+
Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
|
|
68
|
+
|
|
69
|
+
<reasoning>
|
|
70
|
+
The assistant used the todo list because:
|
|
71
|
+
1. The user provided multiple complex features to implement in a comma separated list
|
|
72
|
+
2. The todo list helps organize these large features into manageable tasks
|
|
73
|
+
3. This approach allows for tracking progress across the entire implementation
|
|
74
|
+
</reasoning>
|
|
75
|
+
</example>
|
|
76
|
+
|
|
77
|
+
<example>
|
|
78
|
+
User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
|
|
79
|
+
Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
|
|
80
|
+
*Reviews component structure, render patterns, state management, and data fetching*
|
|
81
|
+
Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
|
|
82
|
+
*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*
|
|
83
|
+
Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
|
|
84
|
+
|
|
85
|
+
<reasoning>
|
|
86
|
+
The assistant used the todo list because:
|
|
87
|
+
1. First, the assistant examined the codebase to identify specific performance issues
|
|
88
|
+
2. Based on this analysis, it identified multiple optimization opportunities
|
|
89
|
+
3. Performance optimization is a non-trivial task requiring multiple steps
|
|
90
|
+
4. The todo list helps methodically track improvements across different components
|
|
91
|
+
5. This systematic approach ensures all performance bottlenecks are addressed
|
|
92
|
+
</reasoning>
|
|
93
|
+
</example>
|
|
94
|
+
|
|
95
|
+
## Examples of When NOT to Use the Todo List
|
|
96
|
+
|
|
97
|
+
<example>
|
|
98
|
+
User: How do I print 'Hello World' in Python?
|
|
99
|
+
Assistant: In Python, you can print "Hello World" with this simple code:
|
|
100
|
+
|
|
101
|
+
python
|
|
102
|
+
print("Hello World")
|
|
103
|
+
|
|
104
|
+
This will output the text "Hello World" to the console when executed.</assistant>
|
|
105
|
+
|
|
106
|
+
<reasoning>
|
|
107
|
+
The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
|
|
108
|
+
</reasoning>
|
|
109
|
+
</example>
|
|
110
|
+
|
|
111
|
+
<example>
|
|
112
|
+
User: What does the git status command do?
|
|
113
|
+
Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
|
|
114
|
+
|
|
115
|
+
<reasoning>
|
|
116
|
+
The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
|
|
117
|
+
</reasoning>
|
|
118
|
+
</example>
|
|
119
|
+
|
|
120
|
+
<example>
|
|
121
|
+
User: Can you add a comment to the calculateTotal function to explain what it does?
|
|
122
|
+
Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
|
|
123
|
+
* Uses the Edit tool to add a comment to the calculateTotal function *
|
|
124
|
+
|
|
125
|
+
<reasoning>
|
|
126
|
+
The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
|
|
127
|
+
</reasoning>
|
|
128
|
+
</example>
|
|
129
|
+
|
|
130
|
+
<example>
|
|
131
|
+
User: Run npm install for me and tell me what happens.
|
|
132
|
+
Assistant: I'll run the npm install command for you.
|
|
133
|
+
|
|
134
|
+
*Executes: npm install*
|
|
135
|
+
|
|
136
|
+
The command completed successfully. Here's the output:
|
|
137
|
+
[Output of npm install command]
|
|
138
|
+
|
|
139
|
+
All dependencies have been installed according to your package.json file.
|
|
140
|
+
|
|
141
|
+
<reasoning>
|
|
142
|
+
The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
|
|
143
|
+
</reasoning>
|
|
144
|
+
</example>
|
|
145
|
+
|
|
146
|
+
## Task States and Management
|
|
147
|
+
|
|
148
|
+
1. **Task States**: Use these states to track progress:
|
|
149
|
+
- pending: Task not yet started
|
|
150
|
+
- in_progress: Currently working on (limit to ONE task at a time)
|
|
151
|
+
- completed: Task finished successfully
|
|
152
|
+
- cancelled: Task no longer needed
|
|
153
|
+
|
|
154
|
+
2. **Task Management**:
|
|
155
|
+
- Update task status in real-time as you work
|
|
156
|
+
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
|
|
157
|
+
- Only have ONE task in_progress at any time
|
|
158
|
+
- Complete current tasks before starting new ones
|
|
159
|
+
- Cancel tasks that become irrelevant
|
|
160
|
+
|
|
161
|
+
3. **Task Breakdown**:
|
|
162
|
+
- Create specific, actionable items
|
|
163
|
+
- Break complex tasks into smaller, manageable steps
|
|
164
|
+
- Use clear, descriptive task names
|
|
165
|
+
|
|
166
|
+
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
|
|
167
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
- Fetches content from a specified URL
|
|
2
|
+
- Takes a URL and optional format as input
|
|
3
|
+
- Fetches the URL content, converts to requested format (markdown by default)
|
|
4
|
+
- Returns the content in the specified format
|
|
5
|
+
- Use this tool when you need to retrieve and analyze web content
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.
|
|
9
|
+
- The URL must be a fully-formed valid URL
|
|
10
|
+
- HTTP URLs will be automatically upgraded to HTTPS
|
|
11
|
+
- Format options: "markdown" (default), "text", or "html"
|
|
12
|
+
- This tool is read-only and does not modify any files
|
|
13
|
+
- Results may be summarized if the content is very large
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- Search the web using the session's web search provider - performs real-time web searches and can scrape content from specific URLs
|
|
2
|
+
- Provides up-to-date information for current events and recent data
|
|
3
|
+
- Supports configurable result counts and returns the content from the most relevant websites
|
|
4
|
+
- Use this tool for accessing information beyond knowledge cutoff
|
|
5
|
+
- Searches are performed automatically within a single API call
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- Supports live crawling modes when available: 'fallback' (backup if cached unavailable) or 'preferred' (prioritize live crawling)
|
|
9
|
+
- Search types when available: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
|
|
10
|
+
- Configurable context length for optimal LLM integration
|
|
11
|
+
- Domain filtering and advanced search options available
|
|
12
|
+
|
|
13
|
+
The current year is {{year}}. You MUST use this year when searching for recent information or current events
|
|
14
|
+
- Example: If the current year is 2026 and the user asks for "latest AI news", search for "AI news 2026", NOT "AI news 2025"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Writes a file to the local filesystem.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- This tool will overwrite the existing file if there is one at the provided path.
|
|
5
|
+
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
6
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
7
|
+
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
8
|
+
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
- Fetches content from a specified URL
|
|
2
|
+
- Takes a URL and optional format as input
|
|
3
|
+
- Fetches the URL content, converts to requested format (markdown by default)
|
|
4
|
+
- Returns the content in the specified format
|
|
5
|
+
- Use this tool when you need to retrieve and analyze web content
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.
|
|
9
|
+
- The URL must be a fully-formed valid URL
|
|
10
|
+
- HTTP URLs will be automatically upgraded to HTTPS
|
|
11
|
+
- Format options: "markdown" (default), "text", or "html"
|
|
12
|
+
- This tool is read-only and does not modify any files
|
|
13
|
+
- Results may be summarized if the content is very large
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- Search the web using the session's web search provider - performs real-time web searches and can scrape content from specific URLs
|
|
2
|
+
- Provides up-to-date information for current events and recent data
|
|
3
|
+
- Supports configurable result counts and returns the content from the most relevant websites
|
|
4
|
+
- Use this tool for accessing information beyond knowledge cutoff
|
|
5
|
+
- Searches are performed automatically within a single API call
|
|
6
|
+
|
|
7
|
+
Usage notes:
|
|
8
|
+
- Supports live crawling modes when available: 'fallback' (backup if cached unavailable) or 'preferred' (prioritize live crawling)
|
|
9
|
+
- Search types when available: 'auto' (balanced), 'fast' (quick results), 'deep' (comprehensive search)
|
|
10
|
+
- Configurable context length for optimal LLM integration
|
|
11
|
+
- Domain filtering and advanced search options available
|
|
12
|
+
|
|
13
|
+
The current year is {{year}}. You MUST use this year when searching for recent information or current events
|
|
14
|
+
- Example: If the current year is 2026 and the user asks for "latest AI news", search for "AI news 2026", NOT "AI news 2025"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Writes a file to the local filesystem.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
- This tool will overwrite the existing file if there is one at the provided path.
|
|
5
|
+
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
6
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
7
|
+
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
8
|
+
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonecode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "BoneCode — a production-grade AI coding agent with BoneScript-generated backend and pgvector RAG",
|
|
6
6
|
"keywords": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"compile": "node --max-old-space-size=512 scripts/compile.js",
|
|
40
40
|
"migrate": "node --max-old-space-size=512 scripts/migrate.js",
|
|
41
41
|
"dev": "ts-node --project tsconfig.json src/server.ts",
|
|
42
|
-
"build": "tsc --project tsconfig.json",
|
|
42
|
+
"build": "tsc --project tsconfig.json && node scripts/copy_prompts.js",
|
|
43
43
|
"build:web": "cd web && npm install && npm run build",
|
|
44
44
|
"dev:web": "cd web && npm install && npm run dev",
|
|
45
45
|
"start": "node dist/src/server.js",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy non-TS assets (.txt prompt files, etc.) into dist/ after `tsc` runs.
|
|
4
|
+
* tsc only emits .js/.d.ts/.js.map — text files used at runtime via
|
|
5
|
+
* fs.readFileSync need to be copied manually.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const ROOT = path.resolve(__dirname, "..");
|
|
13
|
+
|
|
14
|
+
function copyRecursive(srcDir, dstDir, predicate = () => true) {
|
|
15
|
+
if (!fs.existsSync(srcDir)) return 0;
|
|
16
|
+
fs.mkdirSync(dstDir, { recursive: true });
|
|
17
|
+
let count = 0;
|
|
18
|
+
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
19
|
+
const src = path.join(srcDir, entry.name);
|
|
20
|
+
const dst = path.join(dstDir, entry.name);
|
|
21
|
+
if (entry.isDirectory()) {
|
|
22
|
+
count += copyRecursive(src, dst, predicate);
|
|
23
|
+
} else if (predicate(entry.name)) {
|
|
24
|
+
fs.copyFileSync(src, dst);
|
|
25
|
+
count++;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return count;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const isAsset = (name) =>
|
|
32
|
+
name.endsWith(".txt") ||
|
|
33
|
+
name.endsWith(".md") ||
|
|
34
|
+
name.endsWith(".sql");
|
|
35
|
+
|
|
36
|
+
const targets = [
|
|
37
|
+
// Session prompts (default.txt, anthropic.txt, bonescript.txt, etc.)
|
|
38
|
+
["src/engine/session/prompt", "dist/src/engine/session/prompt"],
|
|
39
|
+
// Tool description files (read.txt, write.txt, edit.txt, etc.)
|
|
40
|
+
["src/engine/tool", "dist/src/engine/tool"],
|
|
41
|
+
// Agent prompts
|
|
42
|
+
["src/engine/agent/prompt", "dist/src/engine/agent/prompt"],
|
|
43
|
+
// Skill prompts
|
|
44
|
+
["src/engine/skill/prompt", "dist/src/engine/skill/prompt"],
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
let total = 0;
|
|
48
|
+
for (const [src, dst] of targets) {
|
|
49
|
+
const srcAbs = path.join(ROOT, src);
|
|
50
|
+
const dstAbs = path.join(ROOT, dst);
|
|
51
|
+
const count = copyRecursive(srcAbs, dstAbs, isAsset);
|
|
52
|
+
if (count > 0) {
|
|
53
|
+
console.log(` ${src} → ${dst} (${count} files)`);
|
|
54
|
+
total += count;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(`Copied ${total} asset files to dist/`);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Verifies that the BoneScript primer is bundled and loadable.
|
|
4
|
+
*
|
|
5
|
+
* The primer must be:
|
|
6
|
+
* 1. Present in dist/src/engine/session/prompt/bonescript.txt after build
|
|
7
|
+
* 2. Non-empty
|
|
8
|
+
* 3. Contain the workflow keywords (Define, Compile, Extend, Check)
|
|
9
|
+
* 4. Mention bonec/.bone explicitly
|
|
10
|
+
* 5. Loadable via the same path resolution the prompt builder uses
|
|
11
|
+
* 6. Reachable from the source tree fallback
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";
|
|
15
|
+
const fs = require("fs");
|
|
16
|
+
const path = require("path");
|
|
17
|
+
|
|
18
|
+
const G = "\x1b[32m"; const R = "\x1b[31m"; const C = "\x1b[36m";
|
|
19
|
+
const B = "\x1b[1m"; const D = "\x1b[2m"; const N = "\x1b[0m";
|
|
20
|
+
|
|
21
|
+
let passed = 0;
|
|
22
|
+
let failed = 0;
|
|
23
|
+
const failures = [];
|
|
24
|
+
|
|
25
|
+
function ok(name, info = "") {
|
|
26
|
+
passed++;
|
|
27
|
+
console.log(` ${G}✓${N} ${name}${info ? ` ${D}${info}${N}` : ""}`);
|
|
28
|
+
}
|
|
29
|
+
function fail(name, msg) {
|
|
30
|
+
failed++;
|
|
31
|
+
failures.push(`${name}: ${msg}`);
|
|
32
|
+
console.log(` ${R}✗${N} ${name} ${R}${msg}${N}`);
|
|
33
|
+
}
|
|
34
|
+
function header(s) { console.log(`\n${C}${B}${s}${N}`); }
|
|
35
|
+
|
|
36
|
+
const ROOT = path.resolve(__dirname, "..");
|
|
37
|
+
|
|
38
|
+
header("[1] Primer file presence");
|
|
39
|
+
|
|
40
|
+
const srcPath = path.join(ROOT, "src", "engine", "session", "prompt", "bonescript.txt");
|
|
41
|
+
const distPath = path.join(ROOT, "dist", "src", "engine", "session", "prompt", "bonescript.txt");
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(srcPath)) ok("src/...bonescript.txt exists", `${fs.statSync(srcPath).size} bytes`);
|
|
44
|
+
else fail("src primer", "missing");
|
|
45
|
+
|
|
46
|
+
if (fs.existsSync(distPath)) ok("dist/...bonescript.txt exists", `${fs.statSync(distPath).size} bytes`);
|
|
47
|
+
else fail("dist primer", "missing — run `npm run build`");
|
|
48
|
+
|
|
49
|
+
header("[2] Primer content");
|
|
50
|
+
|
|
51
|
+
const primer = fs.readFileSync(srcPath, "utf-8");
|
|
52
|
+
|
|
53
|
+
const checks = [
|
|
54
|
+
{ needle: "BoneScript", desc: "mentions BoneScript" },
|
|
55
|
+
{ needle: "bonec", desc: "mentions the bonec CLI" },
|
|
56
|
+
{ needle: ".bone", desc: "mentions .bone files" },
|
|
57
|
+
{ needle: "Define", desc: "documents the workflow (Define)" },
|
|
58
|
+
{ needle: "Compile", desc: "documents the workflow (Compile)" },
|
|
59
|
+
{ needle: "Extend", desc: "documents the workflow (Extend)" },
|
|
60
|
+
{ needle: "extension_point", desc: "documents extension_point" },
|
|
61
|
+
{ needle: "capability", desc: "documents capability syntax" },
|
|
62
|
+
{ needle: "entity", desc: "documents entity syntax" },
|
|
63
|
+
{ needle: "system Marketplace", desc: "shows system block example" },
|
|
64
|
+
{ needle: "delivery: at_least_once", desc: "shows event delivery semantics" },
|
|
65
|
+
{ needle: "compensate:", desc: "documents saga compensation" },
|
|
66
|
+
{ needle: "shortest_path", desc: "documents algorithm catalog" },
|
|
67
|
+
{ needle: "shop.bone", desc: "shows worked example filename" },
|
|
68
|
+
{ needle: "https://github.com/Doorman11991/BoneScript", desc: "links to the BoneScript repo" },
|
|
69
|
+
{ needle: "bonescript-compiler", desc: "names the npm package" },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
for (const c of checks) {
|
|
73
|
+
if (primer.includes(c.needle)) ok(c.desc);
|
|
74
|
+
else fail(c.desc, `primer does not contain "${c.needle}"`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
header("[3] Path resolution from compiled module location");
|
|
78
|
+
|
|
79
|
+
// Simulate the loadBonescriptPrimer logic — the compiled prompt.js lives at
|
|
80
|
+
// dist/src/engine/session/prompt.js, so __dirname resolves to that directory.
|
|
81
|
+
const fakeCompiledDir = path.join(ROOT, "dist", "src", "engine", "session");
|
|
82
|
+
const candidate1 = path.join(fakeCompiledDir, "prompt", "bonescript.txt");
|
|
83
|
+
const candidate2 = path.join(fakeCompiledDir, "..", "..", "..", "src", "engine", "session", "prompt", "bonescript.txt");
|
|
84
|
+
|
|
85
|
+
if (fs.existsSync(candidate1)) ok("primary path (dist) resolves");
|
|
86
|
+
else fail("primary path", `not found at ${candidate1}`);
|
|
87
|
+
|
|
88
|
+
if (fs.existsSync(candidate2)) ok("fallback path (src) resolves");
|
|
89
|
+
else fail("fallback path", `not found at ${candidate2}`);
|
|
90
|
+
|
|
91
|
+
header("[4] Primer is included in published package");
|
|
92
|
+
|
|
93
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, "package.json"), "utf-8"));
|
|
94
|
+
const includesSrc = pkg.files && pkg.files.some((f) => f === "src/" || f === "src");
|
|
95
|
+
const includesDist = pkg.files && pkg.files.some((f) => f === "dist/" || f === "dist");
|
|
96
|
+
|
|
97
|
+
if (includesSrc) ok("package.json files[] includes src/");
|
|
98
|
+
else fail("package files", "src/ is not in published files list");
|
|
99
|
+
|
|
100
|
+
if (includesDist) ok("package.json files[] includes dist/");
|
|
101
|
+
else fail("package files", "dist/ is not in published files list");
|
|
102
|
+
|
|
103
|
+
console.log();
|
|
104
|
+
if (failed === 0) {
|
|
105
|
+
console.log(`${G}${B}✓ All ${passed} tests passed${N}`);
|
|
106
|
+
process.exit(0);
|
|
107
|
+
} else {
|
|
108
|
+
console.log(`${R}${B}✗ ${failed} failed, ${passed} passed${N}`);
|
|
109
|
+
for (const f of failures) console.log(` ${R}- ${f}${N}`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|