forge-delegate

v1.2.4
io.github.MuhamadBarzani/forge-delegate Checked 3 days ago Published 1 month ago

Delegate coding tasks from Claude Code, Codex or opencode to any model opencode can run.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_models

List the models available for delegation: local/keyless ones, direct-API models from opencode logins, and agentic models from the local opencode installation. Call it when the user asks what's available or wants to change the default model, not before an ordinary delegation — those use the configured default.

ask_model

Get a second opinion from a different model — on a design, an approach, or a tricky snippet — or ask one when the user requests it. Sends a one-shot prompt over a direct API call and returns the raw response. The model has no file access and cannot take actions; for anything touching files use delegate. Don't use it for syntax or API details you already know: a cheap model is usually less reliable than you on those. Omit model to use the configured default.

ParameterTypeDescription
prompt *stringThe full question. The model has seen none of this conversation, so include the code and context it needs
modelstringprovider/model or ollama:<name>, e.g. deepseek/deepseek-v4-flash, ollama:llama3. Omit to use the configured default; don't pick a premium tier
systemstringOptional system prompt, e.g. a role or an answer format

delegate

Hand a coding task to another AI model running as a full agent via local opencode: it reads the project, explores, and writes the code in its own tool loop, none of which enters your context. Use it instead of writing the code yourself for: tests for code that already exists; a mechanical refactor (rename, signature change, import rewrite, API migration); lint/type/build errors (paste the error output); boilerplate or scaffolding (CRUD endpoints, config, schemas, adapters, fixtures); a port between languages or frameworks; the same edit repeated across 3 or more files; reading a large file or…

ParameterTypeDescription
task *stringSelf-contained instructions: the goal, the file paths to read or change, constraints, and how to check the result (e.g. which tests to run). The agent has not seen this conversation
agentstringopencode agent to use (defaults to config defaultAgent)
autoApprovebooleanLet the agent edit files and run commands without asking (defaults to config autoApprove, true). When false nobody is there to approve, so actions that need approval can stall or be refused
backgroundbooleanRun detached and return a job id immediately; poll check_delegation (default false)
continue_sessionstringSession id from a previous delegation's result, to continue in that agent session
directorystringAbsolute path of the project to work in (defaults to config defaultDirectory, else the server's working directory)
filesarrayPaths to attach to the agent's prompt (inline only; ignored with background:true). Rarely needed: the agent reads paths named in task itself
modelstringprovider/model, e.g. opencode/deepseek-v4.1-flash-free. Omit to use the configured default; don't raise it to a premium tier — split the task instead
profilestringNamed preset from config profiles (see get_delegate_config) that sets model, agent, variant, directory and autoApprove together

check_delegation

Check a delegation started with background:true. Returns RUNNING, DONE or TIMED OUT, the elapsed time, the session id, and the last 8,000 characters of the agent's output. Each poll costs context, so wait between polls instead of checking in a tight loop. Call with no id to list all jobs.

ParameterTypeDescription
idstringJob id returned by delegate with background:true. Omit to list all jobs

get_delegate_config

Read the current forge-delegate configuration: defaultModel, defaultAgent, defaultVariant, autoApprove, timeoutMs, defaultDirectory, and named profiles — plus the installed version and whether it updates automatically. Call this to see what will be used when a model/directory is omitted, or when the user asks which version is running.

set_delegate_config

Change forge-delegate configuration at runtime — no reinstall. Only change settings when the user asks; never raise defaultModel to a premium tier on your own. Pass any subset of {defaultModel, defaultAgent, defaultVariant, autoApprove, timeoutMs, defaultDirectory, profiles}. Set a field to null to clear it. To edit a profile, pass the whole profiles object (e.g. profiles: {tests: {model: "..."}}); set a profile to null to delete it. Only provided keys change; others are preserved.

ParameterTypeDescription
autoApprovebooleanLet delegated agents edit files and run commands without asking
defaultAgentstring | nullopencode agent used when a call omits agent
defaultDirectorystring | nullAbsolute project path used when a call omits directory
defaultModelstring | nullprovider/model used when a call omits model
defaultVariantstring | nullReasoning-effort variant, sent to opencode as provider/model#variant
profilesobjectThe whole profiles object: { name: { model, agent, variant, autoApprove, directory } }. A profile set to null is deleted
timeoutMsnumberPer-delegation timeout in milliseconds (default 900000, 15 minutes)