@wular/coder 0.1.19 → 0.1.21

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.
@@ -7,7 +7,7 @@
7
7
  {
8
8
  "name": "coder",
9
9
  "source": "./plugins/claude",
10
- "description": "Delegate coding tasks to a Coder subagent. Codex first, Claude fallback; your main context stays clean."
10
+ "description": "Delegate coding tasks to a Coder subagent. Your main context stays clean."
11
11
  }
12
12
  ]
13
13
  }
package/README.md CHANGED
@@ -23,6 +23,15 @@ Plugs into Claude Code or Codex to enable the harness with Coder instances.
23
23
 
24
24
  Coder runs your tasks on an **engine CLI** - it needs at least one of the [codex CLI](https://github.com/openai/codex) (`npm install -g @openai/codex`, then `codex login`) or the [Claude Code CLI](https://github.com/anthropics/claude-code) (`npm install -g @anthropic-ai/claude-code`, then `claude auth login`) installed and logged in. `coder host-setup` reports which are ready; if none is, install one of them to run tasks.
25
25
 
26
+ Follow the install host specific guides below, then you can ask like:
27
+
28
+ > Use Coder to explain the directory structure of the workspace.
29
+
30
+ You can also add this to CLAUDE.md.
31
+
32
+ > Always use Coder for all implementation and system exploring tasks.
33
+
34
+ The work happens in the engine, and your session gets the result. Codex is the primary engine when available, with a Claude subagent as fallback.
26
35
 
27
36
  ### Claude Code
28
37
 
@@ -43,16 +52,6 @@ npm install -g @wular/coder
43
52
  coder host-setup --claude
44
53
  ```
45
54
 
46
- Then you can ask like:
47
-
48
- > Use Coder to explain the directory structure of the workspace.
49
-
50
- You can also add this to CLAUDE.md.
51
-
52
- > Always use Coder for all implementation and system exploring tasks.
53
-
54
- The work happens in the engine, and your session gets the result. Codex is the primary engine when available, with a Claude subagent as fallback.
55
-
56
55
  ### Codex
57
56
 
58
57
  ```
@@ -67,11 +66,7 @@ npm install -g @wular/coder
67
66
  coder host-setup --codex
68
67
  ```
69
68
 
70
- Then ask like:
71
-
72
- > Use $coder:handle to explain the directory structure of the workspace.
73
-
74
- Restart Codex and it dispatches coding tasks through the same runtime, with Claude run directly by Coder when it is the selected or fallback engine.
69
+ Note: Codex 'Approve for me' just disables invoking CLI agents, so just use 'Ask for approval'/'Full Access' when using Codex/ChatGPT app as host.
75
70
 
76
71
  ## Staying up to date
77
72
 
package/dist/cli.js CHANGED
@@ -105,7 +105,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
105
105
  `)}}function S1(r,i,$,u=null){let n=r.agents.claude??{};return{agent:"claude",action:"spawn-claude-subagent",reason:$,model:n.model??"opus",permissions:u??n.permissions??"auto",note:"Spawn a general-purpose subagent with this model and forward the task verbatim.",task:i}}async function pO(r,i,{echo:$}){let u=dr(r),n=m(r,i.id),v=or(r),g=L1(r,i.id,{echo:$}),I=mi[i.permissions??"auto"]??mi.auto,_=I.approvalPolicy==="never"?void 0:h_({workspaceRoot:u,jobDir:n,mode:I.approvalMode,escalationTimeoutMs:v.approvals.escalationTimeoutMs,allowedNetworkHosts:v.approvals.allowedNetworkHosts,onEvent:(z)=>{if(Dn(r,i.id,z),$&&z.message)j.stderr.write(`[coder] ${z.message}
106
106
  `)}}),U=await zk(r,{prompt:i.prompt??"",model:G1(i.model),effort:i.effort,sandbox:I.sandbox,approvalPolicy:I.approvalPolicy,onApprovalRequest:_,resumeThreadId:i.resumeThreadId??null,onProgress:(z)=>{g(z);let t=typeof z==="object"?z.threadId:null,O=typeof z==="object"?z.turnId:null;if(t||O)p(r,i.id,{status:"running",...t?{threadId:t}:{},...O?{turnId:O}:{}})}}),k=U.status===0?"completed":"failed";return p(r,i.id,{status:k,threadId:U.threadId,turnId:U.turnId,completedAt:new Date().toISOString()}),yr.writeFileSync(fi.join(n,"result.json"),`${JSON.stringify(U,null,2)}
107
107
  `,"utf8"),U}async function aO(r,i,{echo:$}){let u=m(r,i.id),n=L1(r,i.id,{echo:$}),v=await Y1(r,{prompt:i.prompt??"",model:i.model,effort:i.effort,permissions:i.permissions,resumeSessionId:i.resumeThreadId??null,onProgress:(g)=>{if(n(g),g.threadId)p(r,i.id,{status:"running",threadId:g.threadId})}});return p(r,i.id,{status:v.status===0?"completed":"failed",threadId:v.threadId,completedAt:new Date().toISOString()}),yr.writeFileSync(fi.join(u,"result.json"),`${JSON.stringify(v,null,2)}
108
- `,"utf8"),v}function sO(r){return r.agent==="claude"?aO:pO}async function an(r){let{options:i,positionals:$}=Z(r,{valueOptions:["agent","model","effort","permissions","resume","cwd","host","name"],booleanOptions:["background","wait","json","simulate-approval"]}),u=R(i),n=$.join(" ").trim();if(!n)H("Missing task text.",{hint:['Usage: coder run "<task text>"',"Help: coder task run --help"]});let v=or(u),g=eO(i,v),I=i.host??(j.env.CLAUDECODE?"claude":"codex");if(I!=="claude"&&I!=="codex")H(`Invalid --host "${I}". Use claude or codex.`);if(g.agent==="claude"&&I==="claude")o(S1(v,n,"configured",g.permissions)),j.exit(0);let _=async(c,y)=>{let M=v.chain[v.chain.indexOf(c)+1];if(!M)H(`${c} failed to start: ${y}`);if(M==="claude"&&I==="claude")o({error:`${c} failed to start: ${y}`,fallback:S1(v,n,"codex-failed",g.permissions)}),j.exit(3);j.stderr.write(`[coder] ${c} failed to start (${y}); falling back to ${M}.
108
+ `,"utf8"),v}function sO(r){return r.agent==="claude"?aO:pO}async function an(r){let{options:i,positionals:$}=Z(r,{valueOptions:["agent","model","effort","permissions","resume","cwd","host","name"],booleanOptions:["background","wait","json","simulate-approval"]}),u=R(i),n=$.join(" ").trim();if(!n)H("Missing task text.",{hint:['Usage: coder run "<task text>"',"Help: coder task run --help"]});let v=or(u),g=eO(i,v),I=i.host??(j.env.CLAUDECODE?"claude":"codex");if(I!=="claude"&&I!=="codex"&&I!=="cursor")H(`Invalid --host "${I}". Use claude, codex, or cursor.`);if(g.agent==="claude"&&I==="claude")o(S1(v,n,"configured",g.permissions)),j.exit(0);let _=async(c,y)=>{let M=v.chain[v.chain.indexOf(c)+1];if(!M)H(`${c} failed to start: ${y}`);if(M==="claude"&&I==="claude")o({error:`${c} failed to start: ${y}`,fallback:S1(v,n,"codex-failed",g.permissions)}),j.exit(3);j.stderr.write(`[coder] ${c} failed to start (${y}); falling back to ${M}.
109
109
  `),await an([n,"--agent",M,"--host",I,"--cwd",u,...i.wait?["--wait"]:[],...i.json?["--json"]:[],...i.permissions?["--permissions",i.permissions]:[]]),j.exit(0)},U=(c)=>{let y="read-only unavailable on this host: the OS sandbox failed to start (Linux/WSL2 needs bubblewrap + socat). Re-dispatch with --permissions auto (or workspace-write) if writes are acceptable, or install the sandbox deps.";if(i.json)o({error:y,code:"read-only-unavailable",detail:c});else j.stderr.write(`[coder] ${y}
110
110
  `);j.exit(1)},k=(c)=>g.permissions==="read-only"&&b1.test(c??"");{let c=g.agent==="codex"?Lr(u):pn();if(!c.available)await _(g.agent,c.detail)}let z=null;if(i.resume)z=di(u,i.resume)?.threadId??i.resume;let t=T_(),O=p(u,t,{status:"queued",kind:"task",name:i.name??null,agent:g.agent,host:I,prompt:n,model:g.model,effort:g.effort,permissions:g.permissions,resumeThreadId:z,cwd:u,background:!i.wait,...i["simulate-approval"]?{simulateApproval:!0}:{}}),W=m(u,t),X=yr.openSync(fi.join(W,"worker.log"),"a"),G=dO(j.execPath,[Nn,"_worker",t,"--cwd",u],{cwd:u,detached:!0,stdio:["ignore",X,X]});G.unref(),yr.closeSync(X),p(u,t,{pid:G.pid??null});let B=Number.MAX_SAFE_INTEGER,f=Date.now()+15000,q=O,V=null,l=null;while(Date.now()<(l??f)){if(q=Jr(u,t)??q,q.status==="failed"||q.status==="completed")break;if(q.threadId&&V===null)V=Sr(u,t,B).length,l=Date.now()+2000;if(V!==null&&Sr(u,t,B).length>V){q=Jr(u,t)??q;break}await new Promise((c)=>setTimeout(c,150))}if(q.status==="failed"){let c=fi.join(W,"result.json"),y=yr.existsSync(c)?JSON.parse(yr.readFileSync(c,"utf8")).error?.message??"":"",M=Sr(u,t,5).map((ri)=>ri.message??"").join(`
111
111
  `),x=y||M;if(k(x))U(x);if(Q1.test(x))await _(g.agent,x);if(i.json)o({taskId:t,status:"failed",detail:x}),j.exit(1);H(`Task ${t} failed to start.${x?`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wular/coder",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Delegating coding-agent runtime",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "build": "bun build src/cli.ts src/lib/broker.ts --outdir dist --root src --target node --format esm --minify",
11
11
  "dev": "bun run build --watch",
12
12
  "typecheck": "tsc -p tsconfig.json --noEmit",
13
+ "validate-plugin:cursor": "node scripts/validate-template.mjs",
13
14
  "version-bump:patch": "node scripts/bump.mjs patch",
14
15
  "version-bump:minor": "node scripts/bump.mjs minor",
15
16
  "version-bump:major": "node scripts/bump.mjs major",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "coder",
3
- "version": "0.1.19",
4
- "description": "Delegate coding tasks to a Coder subagent. Codex first, Claude fallback; your main context stays clean.",
3
+ "version": "0.1.21",
4
+ "description": "Delegate coding tasks to a Coder subagent. Your main context stays clean.",
5
5
  "author": {
6
6
  "name": "muzam1l"
7
7
  }
@@ -16,7 +16,7 @@ If `coder` is not on PATH, install it yourself without asking (`npm install -g @
16
16
  - Compose one self-contained task text (goal, relevant paths, constraints) and dispatch it. It backgrounds by default: the runtime does a startup check and prints a task id (or errors / hands off, see exit codes):
17
17
 
18
18
  ```bash
19
- coder task run "<task text>"
19
+ coder task run --host claude "<task text>"
20
20
  ```
21
21
 
22
22
  Fetch the answer with `coder task result <task-id> --wait` - it blocks until the task finishes, then prints only the final answer (keeps your context clean). Run it as a **background Bash call** so it does not block you and you are re-invoked on completion:
@@ -26,8 +26,10 @@ If `coder` is not on PATH, install it yourself without asking (`npm install -g @
26
26
  ```
27
27
 
28
28
  Only use `--wait` when you can run it in a background shell like that; without one, poll `coder task result <task-id>` (no `--wait`) until it is done. Or skip the two steps and block on the run itself with `--wait` on `coder task run`.
29
+
29
30
  - A `--wait` (on `run` or `result`) exits **4** when the task is waiting on a permission approval: relay the approval to the user, apply their decision with `coder approve <task-id> <approval-id> [--deny]`, then re-fetch with `coder task result <task-id> --wait`. (Unanswered approvals auto-deny after 120s and the task moves on.)
30
31
 
32
+ - Always pass `--host claude` to identify yourself.
31
33
  - `coder task run` exits after its startup check. Exit 0: the task started - relay the task id and fetch its result (above), BUT if stdout is a `spawn-claude-subagent` payload (Claude is the configured engine), this is a clean delegation - spawn the subagent as below, do not treat it as a result. Exit 1: it failed to start - report it, do not retry or fall back yourself. Exit 3: Codex failed to start and handed off to Claude (see below).
32
34
  - Engine, model, and effort come from config; add `--agent` / `--model` / `--effort` when the user asks or it is unambiguous from context (agents: `codex`, `claude`; codex models: `spark`, `luna`, `terra`, `sol`; claude models: `opus`, `sonnet`, `fable`; efforts: `low|medium|high`).
33
35
  - `spark` is only for the very lightest tasks (formatting, renames, quick lookups) - very fast and very cheap. It runs on a separate quota, so reach for it when the others hit a usage limit; it may still run once they are exhausted.
@@ -55,5 +57,5 @@ Relay its output when it completes.
55
57
  ## Hard rules
56
58
 
57
59
  - Forward task text verbatim in `steer` and fallback prompts - never rewrite or summarize what the user asked for.
58
- - NEVER run git write operations yourself (commit, checkout, stash, reset, rebase, merge, push, etc.); the runtime's approval policy enforces this for Codex.
59
- - Honor any constraints in the user's request (read-only, scoped paths) over your own preferences.
60
+ - Tell every coder to never run git write operations (commit, checkout, stash, reset, rebase, merge, push, etc.) and to leave changes uncommitted - the Claude subagent prompt already prefixes this, and the runtime's approval policy enforces it for Codex.
61
+ - Pass the user's constraints (read-only, scoped paths) into each coder's task text, and honor them over your own preferences.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "interface": {
5
5
  "displayName": "Coder (plugin)"
6
6
  },
@@ -7,7 +7,7 @@ description: Use Coder for any coding, implementation, or investigation task - f
7
7
 
8
8
  You dispatch coding tasks through the `coder` runtime instead of implementing them yourself. By default the runtime picks the engine from its configured chain; `--agent`/`--model`/`--effort` override it. You never spawn agents yourself in this host.
9
9
 
10
- If `coder` is not on PATH, install it yourself without asking: `npm install -g @wular/coder`, then `coder host-setup --codex`. Only if that fails, show the user the error and those two commands. On first setup, mention the chain is Codex-first with Claude on fallback. The Claude fallback engine needs the claude CLI; if it is not installed, ask the user before installing it (on yes: `npm install -g @anthropic-ai/claude-code`, then have them run `claude` once to log in). If the user prefers Claude engines first, run `coder config set chain claude,codex`.
10
+ If `coder` is not on PATH, install it yourself without asking: `npm install -g @wular/coder`, then `coder host-setup --codex`. Only if that fails, show the user the error and those two commands. The configured chain (`coder config`) decides which engine runs first and which is the fallback; set it with `coder config set chain <first>,<second>`. Each engine needs its own CLI; the claude engine needs the claude CLI installed - if it is not, ask the user before installing it (on yes: `npm install -g @anthropic-ai/claude-code`, then have them run `claude` once to log in).
11
11
 
12
12
  When you run setup, also check codex is new enough for the default GPT-5.6 model, which needs codex `>= 0.144` (`codex --version`). If it is older, update it automatically without asking with `codex update` (codex's own updater; fall back to `npm install -g @openai/codex@latest` if it fails), then tell the user to restart their codex session so the update takes effect.
13
13
 
@@ -26,11 +26,7 @@ When you run setup, also check codex is new enough for the default GPT-5.6 model
26
26
 
27
27
  - Always pass `--host codex` to identify yourself.
28
28
  - `coder task run` exits after its startup check. Exit 0: the task started - fetch its result (above). Exit 1: it failed to start / the turn failed - report it, do not retry.
29
- - Exit 3: Codex could not start (auth, quota, rate limit - mention this to the user, including any limit-reset time). Rerun once with the Claude engine and fetch its result:
30
-
31
- ```bash
32
- coder task run --host codex --agent claude "<same task text, verbatim>"
33
- ```
29
+ - When the first engine can't start (auth, quota, rate limit), the runtime automatically falls back to the next engine in the chain, runs the same task on it via CLI, and still exits 0 - so just fetch the result. If the failure mentions a usage-limit reset time, relay that to the user.
34
30
 
35
31
  - Engine, model, and effort come from config; add `--agent` / `--model` / `--effort` when the user asks or it is unambiguous from context (agents: `codex`, `claude`; codex models: `spark`, `luna`, `terra`, `sol`; claude models: `opus`, `sonnet`, `fable`; efforts: `low|medium|high`).
36
32
  - `spark` is only for the very lightest tasks (formatting, renames, quick lookups) - very fast and very cheap. It runs on a separate quota, so reach for it when the others hit a usage limit; it may still run once they are exhausted.
@@ -47,5 +43,5 @@ When you run setup, also check codex is new enough for the default GPT-5.6 model
47
43
  ## Hard rules
48
44
 
49
45
  - Forward task text verbatim in `steer` and retries - never rewrite or summarize what the user asked for.
50
- - NEVER run git write operations yourself (commit, checkout, stash, reset, rebase, merge, push, etc.); the runtime's permission model constrains the engines.
51
- - Honor any constraints in the user's request (read-only, scoped paths) over your own preferences.
46
+ - Tell every coder, in its task text, to never run git write operations (commit, checkout, stash, reset, rebase, merge, push, etc.) and to leave changes uncommitted. The runtime's permission model also enforces this on the engines.
47
+ - Pass the user's constraints (read-only, scoped paths) into each coder's task text, and honor them over your own preferences.
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "coder",
3
+ "displayName": "Coder",
4
+ "version": "0.1.21",
5
+ "description": "Delegate coding tasks to a Coder subagent. Your main context stays clean.",
6
+ "author": {
7
+ "name": "muzam1l"
8
+ },
9
+ "license": "MIT",
10
+ "homepage": "https://github.com/muzam1l/coder",
11
+ "repository": "https://github.com/muzam1l/coder",
12
+ "keywords": [
13
+ "cursor",
14
+ "coder",
15
+ "codex",
16
+ "claude",
17
+ "agent",
18
+ "subagent",
19
+ "delegation",
20
+ "orchestration"
21
+ ],
22
+ "logo": "assets/logo.png"
23
+ }
@@ -0,0 +1,119 @@
1
+ <div align="center">
2
+
3
+ # Coder
4
+
5
+ ### Delegate the coding. Keep your context.
6
+
7
+ </div>
8
+
9
+ One runtime that hands your coding tasks to the best engine available and lets you steer, inspect, or stop any task while it works.
10
+
11
+ Plugs into Claude Code or Codex to enable the harness with Coder instances.
12
+
13
+ ## Why Coder
14
+
15
+ - **A clean main thread.** Installed in Claude Code or Codex, dispatch is a single command from your session; the actual coding runs in a Coder subagent. File dumps, test output, and retries stay there; only the outcome returns to your conversation.
16
+ - **Fast dispatch.** Coder keeps a single Codex engine warm in the background and hands tasks to it directly, instead of booting the CLI for every request. A handoff starts in seconds.
17
+ - **Unified permissions.** One permission model across agents, with three modes: **Read-only**, **Workspace-write**, and **Auto**. Auto is the default: safe commands run, dangerous ones are blocked, and anything in between is brought to you for a yes/no.
18
+ - **Tasks you can steer.** Every dispatch is a task. Check on it, read its result, give it follow-up instructions, or stop it, all by id, while it keeps working in the background.
19
+ - **Graceful fallback.** If Codex can't start (auth, usage limits, not installed), the task flows to a Claude subagent with the same instructions. You configure the chain and the default model and effort for each agent.
20
+ - **Any model, anywhere.** Codex can point at local models (Ollama, LM Studio, and other OpenAI-compatible endpoints) and third-party providers, so Coder can run your tasks on those too - not just the hosted defaults. That opens up the whole scope of engines you can delegate to.
21
+
22
+ ## Get started
23
+
24
+ Coder runs your tasks on an **engine CLI** - it needs at least one of the [codex CLI](https://github.com/openai/codex) (`npm install -g @openai/codex`, then `codex login`) or the [Claude Code CLI](https://github.com/anthropics/claude-code) (`npm install -g @anthropic-ai/claude-code`, then `claude auth login`) installed and logged in. `coder host-setup` reports which are ready; if none is, install one of them to run tasks.
25
+
26
+ Follow the install host specific guides below, then you can ask like:
27
+
28
+ > Use Coder to explain the directory structure of the workspace.
29
+
30
+ You can also add this to CLAUDE.md.
31
+
32
+ > Always use Coder for all implementation and system exploring tasks.
33
+
34
+ The work happens in the engine, and your session gets the result. Codex is the primary engine when available, with a Claude subagent as fallback.
35
+
36
+ ### Cursor
37
+
38
+ ```
39
+ /add-plugin Coder
40
+ ```
41
+
42
+ ### Claude Code
43
+
44
+ ```
45
+ /plugin marketplace add muzam1l/coder
46
+
47
+ /plugin install coder@coder-plugins
48
+
49
+ /reload-plugins
50
+
51
+ /coder:setup
52
+ ```
53
+
54
+ Or from the shell:
55
+
56
+ ```
57
+ npm install -g @wular/coder
58
+ coder host-setup --claude
59
+ ```
60
+
61
+ ### Codex
62
+
63
+ ```
64
+ codex plugin marketplace add muzam1l/coder
65
+ codex plugin add coder@coder-plugins
66
+ ```
67
+
68
+ Or from the npm directly:
69
+
70
+ ```
71
+ npm install -g @wular/coder
72
+ coder host-setup --codex
73
+ ```
74
+
75
+ Note: Codex 'Approve for me' just disables invoking CLI agents, so just use 'Ask for approval'/'Full Access' when using Codex/ChatGPT app as host.
76
+
77
+ ## Staying up to date
78
+
79
+ ```bash
80
+ coder upgrade
81
+ ```
82
+
83
+ It updates the CLI through whichever package manager installed it (npm, pnpm, yarn, or bun, auto-detected) and refreshes the host plugins to match. Narrow it with `--cli-only`, `--plugins-only`, `--codex`, `--claude`, or force a manager with `--pm <npm|pnpm|yarn|bun>`.
84
+
85
+ Set `CODER_NO_UPDATE_CHECK=1` to silence the update notice.
86
+
87
+ ## Configuration
88
+
89
+ Machine defaults live in `~/.coder/config.json`; drop a `coder.config.json` in a repo to override per project.
90
+
91
+ ```json
92
+ {
93
+ "chain": ["codex", "claude"],
94
+ "agents": {
95
+ "codex": { "model": "terra", "effort": "high", "permissions": "auto" },
96
+ "claude": { "model": "opus", "effort": "medium", "permissions": "auto" }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## Advanced usage
102
+
103
+ You rarely need these - the agent drives tasks itself - but you can run them. Task commands live under `coder task <sub>`; the common ones have a top-level shortcut. Full docs: `coder --help`, `coder task <sub> --help`.
104
+
105
+ ```bash
106
+ coder run "<text>" # dispatch a task (--wait to block for the answer)
107
+ coder result [task-id] # status + final answer (--wait blocks until done)
108
+ coder list [--all|--stopped] # list tasks (running by default)
109
+ coder task steer <id> "<text>" # continue a task with new instructions
110
+ coder task stop <id> # interrupt it
111
+ coder task stream [id] # watch the live progress log (you/debugging)
112
+ coder task archive <id> # archive a session (--all-stopped for all finished)
113
+ coder task delete <id> # delete a session (--all-archived for all archived)
114
+ coder task approve <id> <appr> # answer an escalated permission (--deny)
115
+ ```
116
+
117
+ `run`/`list`/`result`/`stream` are shortcuts for the `task` subcommand. Any `[task-id]` defaults to the most recent task and accepts a unique prefix.
118
+
119
+ Run flags (`run`/`steer`): `--wait` (foreground), `--agent codex|claude`, `--model spark|luna|terra|sol|opus|sonnet|fable`, `--effort low|medium|high`, `--permissions read-only|workspace-write|auto`, `--resume <task-id>`, `--json`.
Binary file
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: handle
3
+ description: Use Coder for any coding, implementation, or investigation task - features, fixes, refactors, debugging, tests, code questions. You orchestrate, never implement yourself; dispatch through the `coder` CLI, one coder per focused goal, fanning out many coders in parallel as the work needs.
4
+ ---
5
+
6
+ # Coder dispatch (Cursor host)
7
+
8
+ You dispatch coding tasks through the `coder` runtime instead of implementing them yourself. By default the runtime picks the engine from its configured chain; `--agent`/`--model`/`--effort` override it. You never spawn agents yourself; the runtime spawns and supervises them.
9
+
10
+ If `coder` is not on PATH, install it yourself without asking: `npm install -g @wular/coder`, then run `coder host-setup` to seed the config and check engine readiness (no host plugin is installed - Cursor gets this skill from the marketplace). Only if that fails, show the user the error and those commands. Coder needs at least one engine CLI installed and logged in: codex (`npm install -g @openai/codex`, then `codex login`) and/or claude (`npm install -g @anthropic-ai/claude-code`, then run `claude` once to log in) - ask the user before installing an engine CLI. The configured chain (`coder config`) decides which engine runs first and which is the fallback; set it with `coder config set chain <first>,<second>`.
11
+
12
+ When you run setup, also check codex is new enough for the default GPT-5.6 model, which needs codex `>= 0.144` (`codex --version`). If it is older, update it automatically without asking with `codex update` (codex's own updater; fall back to `npm install -g @openai/codex@latest` if it fails), then tell the user to restart their codex session so the update takes effect.
13
+
14
+ ## Dispatching a task
15
+
16
+ - `coder` commands are safe to run in the terminal - the runtime is a supervisor: it spawns engines, keeps state in `~/.coder`, and enforces its own OS sandbox and approval policy on the task. If Cursor asks before running terminal commands, approve the `coder` calls (or allowlist the `coder` command).
17
+ - One coder per focused goal. When the work splits into independent parts, decompose it and dispatch each part as its own `coder task run` call - fan out a wide web of coders, not one giant dispatch. Give each coder a self-contained goal with all context - overview, file paths, constraints (read-only, git rules); use `steer` to continue a single coder's thread.
18
+ - Delegation is a hard gate for anything the engine can do itself: do not read source files, investigate, or write code first - no matter how simple the task. Fold into the task text whatever only you have - conversation context, results from tools the engine lacks. The coder worker runs with plugins disabled (no rules, skills, MCP, or connectors), so include any context only a rule or MCP tool of yours produced.
19
+ - Compose one self-contained task text (goal, relevant paths, constraints) and dispatch it. It backgrounds by default: the runtime does a startup check and prints a task id (or errors, see exit codes):
20
+
21
+ ```bash
22
+ coder task run --host cursor "<task text>"
23
+ ```
24
+
25
+ Fetch the answer with `coder task result <task-id> --wait` - it blocks until the task finishes, then prints only the final result (keeps your context clean). Run it in a **background terminal** so it does not block you; if you can't, poll `coder task result <task-id>` (no `--wait`) until it is done. Or skip the two steps and block on the run itself with `--wait` on `coder task run`. A `--wait` exits **4** when the task is waiting on a permission approval: relay it to the user, apply their decision with `coder task approve <task-id> <approval-id> [--deny]`, then re-fetch with `coder task result <task-id> --wait` (unanswered approvals auto-deny after 120s and the task moves on).
26
+
27
+ - Always pass `--host cursor` to identify yourself.
28
+ - `coder task run` exits after its startup check. Exit 0: the task started - fetch its result (above). Exit 1: it failed to start / the turn failed - report it, do not retry.
29
+ - Codex startup failures (auth, quota, rate limit) fall back to the next engine in the chain automatically - the runtime reruns the same task on the claude engine via its CLI and still exits 0, so just fetch the result. If it mentions a usage-limit reset time, relay that to the user.
30
+ - Engine, model, and effort come from config; add `--agent` / `--model` / `--effort` when the user asks or it is unambiguous from context (agents: `codex`, `claude`; codex models: `spark`, `luna`, `terra`, `sol`; claude models: `opus`, `sonnet`, `fable`; efforts: `low|medium|high`).
31
+ - `spark` is only for the very lightest tasks (formatting, renames, quick lookups) - very fast and very cheap. It runs on a separate quota, so reach for it when the others hit a usage limit; it may still run once they are exhausted.
32
+ - Permissions default to auto mode. Pass `--permissions read-only` when the task is read-only; `--permissions workspace-write` to forbid any escalation beyond the project.
33
+ - A background dispatch prints a task id plus its result/steer/stop commands. Relay them and fetch the result (above) rather than polling.
34
+
35
+ ## Controlling tasks
36
+
37
+ - Continue prior work ("keep going", "apply the top fix"): `coder task steer <task-id> "<follow-up>"`.
38
+ - Inspect: `coder task result <task-id>` (status + answer; add `--wait` to block until done) and `coder task list`. (`coder task stream <task-id>` streams the live progress log - to watch/debug in special cases, generally not for you to consume.)
39
+ - Interrupt: `coder task stop <task-id>`.
40
+ - If status shows `pendingApprovals`, surface them to the user; apply their decision with `coder task approve <task-id> <approval-id> [--deny]`.
41
+
42
+ ## Hard rules
43
+
44
+ - Forward task text verbatim in `steer` and retries - never rewrite or summarize what the user asked for.
45
+ - Tell every coder, in its task text, to never run git write operations (commit, checkout, stash, reset, rebase, merge, push, etc.) and to leave changes uncommitted. The runtime's permission model also enforces this on the engines.
46
+ - Pass the user's constraints (read-only, scoped paths) into each coder's task text, and honor them over your own preferences.