forge-delegate 1.0.2 → 1.0.3
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 +3 -3
- package/docs/DELEGATION.md +2 -2
- package/package.json +1 -1
- package/server.mjs +10 -10
package/README.md
CHANGED
|
@@ -91,14 +91,14 @@ rate-limited; switch anytime with `forge-delegate config set --model <m>`.
|
|
|
91
91
|
| Tool | What it does | Context cost |
|
|
92
92
|
|---|---|---|
|
|
93
93
|
| `ask_model` | One-shot question to any model (direct API, no file access) | Small |
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
94
|
+
| `delegate` | Model works **autonomously** in the **background** (recommended) — returns a job id instantly; poll `check_delegation` | Tiny |
|
|
95
|
+
| `delegate_sync` | Send a task + optional files to a model agent running via opencode; returns the result inline in your context | Medium |
|
|
96
96
|
| `check_delegation` | Poll a background job (or list all with no id) | Tiny |
|
|
97
97
|
| `list_models` | List local/keyless, direct-API, and agentic models | Small |
|
|
98
98
|
| `get_delegate_config` | Read current configuration (default model, directory, autoApprove, profiles) | Tiny |
|
|
99
99
|
| `set_delegate_config` | Change configuration at runtime — no reinstall | Tiny |
|
|
100
100
|
|
|
101
|
-
`
|
|
101
|
+
`delegate` is the token-saver: the external model gets its own tool loop executed by
|
|
102
102
|
opencode locally. File contents never touch your main agent's context. The delegation runs as a
|
|
103
103
|
detached background process, so the MCP call returns instantly.
|
|
104
104
|
|
package/docs/DELEGATION.md
CHANGED
|
@@ -30,8 +30,8 @@ Unsure → keep it.
|
|
|
30
30
|
| Need | Tool |
|
|
31
31
|
|---|---|
|
|
32
32
|
| Quick one-shot question, no file access needed | `ask_model` |
|
|
33
|
-
| A self-contained task with concrete code output | `
|
|
34
|
-
| Autonomous multi-file work, don't want to block | `
|
|
33
|
+
| A self-contained task with concrete code output, inline | `delegate_sync` |
|
|
34
|
+
| Autonomous multi-file work, don't want to block (recommended) | `delegate` + `check_delegation` |
|
|
35
35
|
| See what's available | `list_models` |
|
|
36
36
|
|
|
37
37
|
## Cost policy (non-negotiable)
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -28,12 +28,12 @@ const RUNS_DIR = join(homedir(), ".forge-delegate", "runs");
|
|
|
28
28
|
const INSTRUCTIONS = `forge-delegate gives you a crew of external AI models to delegate coding work to. Hand off the high-volume, low-risk work (boilerplate, tests, lint/type fixes, mechanical edits) to a cheap or free model and keep the expensive agent focused on architecture and judgment calls.
|
|
29
29
|
|
|
30
30
|
COST POLICY — MANDATORY, NON-NEGOTIABLE:
|
|
31
|
-
The user pays per delegated call on a budget plan. You MUST pick only cheap or free models for EVERY delegation (ask_model,
|
|
31
|
+
The user pays per delegated call on a budget plan. You MUST pick only cheap or free models for EVERY delegation (ask_model, delegate_sync, delegate). NEVER pick top-tier, premium, flagship, or frontier models — not even "just this once" or for hard tasks. If a task seems too hard for a cheap model, split it into smaller delegated steps instead of upgrading. Run list_models and prefer free/cheap models (deepseek flash tiers, free opencode models, local ollama).
|
|
32
32
|
|
|
33
33
|
Routing:
|
|
34
34
|
- Quick one-shot questions → ask_model (direct API, no file access).
|
|
35
|
-
- Multi-file edits/refactors/tests →
|
|
36
|
-
-
|
|
35
|
+
- Multi-file edits/refactors/tests → delegate (background, recommended) or delegate_sync (inline).
|
|
36
|
+
- delegate returns a job id instantly; poll check_delegation for the result.
|
|
37
37
|
- Follow-ups on a delegated area: pass the returned session id as continue_session.
|
|
38
38
|
- Omit model/directory to use the configured defaults (get_delegate_config); change them anytime with set_delegate_config — never reinstall.
|
|
39
39
|
- Never paste large files into your own context for delegation — delegate and let the agent read files itself.
|
|
@@ -120,7 +120,7 @@ server.tool(
|
|
|
120
120
|
|
|
121
121
|
server.tool(
|
|
122
122
|
"ask_model",
|
|
123
|
-
"Send a one-shot prompt to an external AI model and get its raw response. Fast direct API call; the model has NO file access and CANNOT take actions. For work requiring tools/files use
|
|
123
|
+
"Send a one-shot prompt to an external AI model and get its raw response. Fast direct API call; the model has NO file access and CANNOT take actions. For work requiring tools/files use delegate (background) or delegate_sync (inline) instead. model defaults to the configured defaultModel.",
|
|
124
124
|
{
|
|
125
125
|
model: z.string().optional().describe("provider/model, e.g. deepseek/deepseek-v4-flash, ollama:llama3 (defaults to config defaultModel)"),
|
|
126
126
|
prompt: z.string(),
|
|
@@ -136,8 +136,8 @@ server.tool(
|
|
|
136
136
|
);
|
|
137
137
|
|
|
138
138
|
server.tool(
|
|
139
|
-
"
|
|
140
|
-
"Delegate a coding task to another AI model running as a full agent (via local opencode): it can read your project and answer with concrete code. Optionally attach specific files. model/directory/agent/autoApprove default from config.",
|
|
139
|
+
"delegate_sync",
|
|
140
|
+
"Delegate a coding task to another AI model running as a full agent (via local opencode): it can read your project and answer with concrete code. Runs INLINE (foreground) — the result is returned in your context when done. Prefer `delegate` (background) to keep your context small. Optionally attach specific files. model/directory/agent/autoApprove default from config.",
|
|
141
141
|
{
|
|
142
142
|
model: z.string().optional().describe("provider/model format, e.g. opencode/mimo-v2.5-free (defaults to config defaultModel)"),
|
|
143
143
|
task: z.string(),
|
|
@@ -150,7 +150,7 @@ server.tool(
|
|
|
150
150
|
async ({ model, task, files, directory, agent, autoApprove, profile }) => {
|
|
151
151
|
const r = resolveConfig({ model, directory, agent, autoApprove, profile });
|
|
152
152
|
if (!r.model) return { content: [{ type: "text", text: "ERROR: no model specified and no defaultModel configured. Call set_delegate_config or pass model." }], isError: true };
|
|
153
|
-
return withUsage("
|
|
153
|
+
return withUsage("delegate_sync", r.model, async () => {
|
|
154
154
|
const res = await opencodeRun(r.model, task, {
|
|
155
155
|
files,
|
|
156
156
|
directory: r.directory,
|
|
@@ -164,8 +164,8 @@ server.tool(
|
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
server.tool(
|
|
167
|
-
"
|
|
168
|
-
"Fully delegate a coding task to another AI model working autonomously on this project (via local opencode): it explores, reads, edits and creates files in its own loop — invisible to the caller's context. Runs in the BACKGROUND: returns a job id instantly, poll
|
|
167
|
+
"delegate",
|
|
168
|
+
"Fully delegate a coding task to another AI model working autonomously on this project (via local opencode): it explores, reads, edits and creates files in its own loop — invisible to the caller's context. Runs in the BACKGROUND (recommended): returns a job id instantly, poll check_delegation for the result. Pass continue_session (returned by a previous delegation) to keep the same agent session instead of re-exploring. Use this over delegate_sync to keep the caller's context small. model/directory/agent/autoApprove default from config.",
|
|
169
169
|
{
|
|
170
170
|
model: z.string().optional().describe("provider/model format, e.g. opencode/mimo-v2.5-free (defaults to config defaultModel)"),
|
|
171
171
|
task: z.string(),
|
|
@@ -178,7 +178,7 @@ server.tool(
|
|
|
178
178
|
async ({ model, task, continue_session, directory, agent, autoApprove, profile }) => {
|
|
179
179
|
const r = resolveConfig({ model, directory, agent, autoApprove, profile });
|
|
180
180
|
if (!r.model) return { content: [{ type: "text", text: "ERROR: no model specified and no defaultModel configured. Call set_delegate_config or pass model." }], isError: true };
|
|
181
|
-
return withUsage("
|
|
181
|
+
return withUsage("delegate", r.model, async () => {
|
|
182
182
|
const id = await startBackgroundJob(r.model, task, {
|
|
183
183
|
sessionId: continue_session,
|
|
184
184
|
directory: r.directory,
|