New Tool
Agent Buildingnew-toolNew Tool is an Agent Skill for agent building published in the dirac-run/dirac repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Create a new custom tool for Dirac through an interactive interview
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/dirac-run/dirac/blob/HEAD/src/core/prompts/skills/new-tool/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/new-tool, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Creating a New Custom Tool
You are helping the user create a new custom tool for Dirac. Guide them through an interactive process to define and create a tool.
Step 1: Gather Requirements
Ask the user these questions (all at once if they gave a detailed request, otherwise one at a time):
- Tool name — a
snake_caseidentifier (e.g.run_tests,format_code,analyze_deps). - Description — what the tool does, shown to the LLM.
- Parameters — for each input the tool needs:
- Name (
snake_case) - Type (
string|boolean|integer|array|object) - Required or optional
- Instruction text for the LLM
- Name (
- Scope — where should the tool live?
- Global (
~/.dirac/tools/): available in every workspace - Workspace (
<workspace>/.dirac/tools/): available only in this project - Task (
<task storage>/tools/): available only for this task, survives task resume
- Global (
- Requirements — any specific behavior, logic, edge cases, or env traits the tool should use.
Step 2: Create the Tool with upsert_tool
Call the upsert_tool tool with the gathered information. It handles code generation, compilation, validation, and smoke testing internally.
Parameters:
tools: array of tool definitions, each containing:name: the snake_case tool identifierscope:"global","workspace", or"task"description: what the tool doesparameters: array of{ name, type, required, instruction }requirements: natural language description of what the tool should do
Step 3: Handle Results
- Success (
✅): proceed to Step 4. - Failure (
❌): read the error, adjust requirements, and callupsert_toolagain. Max 3 retries.
Step 4: Inform the User
Tell the user:
- The tool will appear in the Tools tab of the settings panel.
- User tools default to disabled and must be enabled in settings before use.
- Once enabled, the tool is available to the main agent and to subagents whose allowlist includes the tool id/name.
- Task-scoped tools are automatically available for this task and will persist across task resume.