symcc

Research: a small Copilot CLI extension for the 4 open host questions #

Task T-955 (a spike: a short hands-on test). Tested with GitHub Copilot CLI 1.0.114 and a small throwaway extension. It follows the Copilot host plan from T-953.

The question #

Can a Copilot CLI extension do the four things a symcc host needs?

  1. Add tools and slash commands.
  2. Guard tool calls (block edits and shell commands that a task may not do).
  3. Wake an idle lead with a message.
  4. Start worker sessions in a git worktree, each with its own guard, and know when they finish.

Short answer #

Yes, all four work in Copilot CLI 1.0.114. Tools and slash commands work, the deny guard blocks edits and shell calls, a timer message wakes an idle lead, and a child session can run in a git worktree with its own guard and report when it is done.

One catch: the default new CopilotClient() crashes inside an extension. It only works when you tell it to start a separate copilot process (RuntimeConnection.forSpawnedStdio({ path: process.execPath })).

The T-953 plan still holds.

How it was found #

The spike took two tries. The first try installed everything and read the SDK, but could not run anything until the owner logged in to Copilot. The second try ran all four tests.

Setup #

1. Tools and commands: yes #

2. Guard: yes #

3. Waking the lead: yes, both modes #

4. Worker sessions: yes, with one catch #

Extras #

The extension code #

The full file was /tmp/t955/plugin/extensions/symspike/extension.mjs (about 70 lines). The parts that matter:

import { joinSession } from "@microsoft/copilot-sdk/extension";
import { CopilotClient, RuntimeConnection, approveAll } from "@microsoft/copilot-sdk";
const guard = (who) => async (input) => { const a = JSON.stringify(input.toolArgs ?? {});
  if (/blocked|BLOCKME/.test(a)) return { permissionDecision: "deny", permissionDecisionReason: `symcc guard (${who}): …` }; };
session = await joinSession({ tools: { definitions: [{ name: "spike_ping", parameters: {...}, skipPermission: true, handler }] },
  commands: [{ name: "spike", description: "…", handler: async (ctx) => session.log(`… ${ctx.args}`) }],
  hooks: { handlers: { onPreToolUse: guard("lead") } } });
setTimeout(() => session.send({ prompt: "…AWAKE.", mode: "enqueue", source: "automation-symspike" }), 20000);
// worker:
const client = new CopilotClient({ mode: "coding-agent", runtime: RuntimeConnection.forSpawnedStdio({ path: process.execPath }) });
const child = await client.createSession({ workingDirectory: dir, systemMessage: {mode:"append",content:"…"}, permissions: { onRequest: approveAll }, hooks: { handlers: { onPreToolUse: guard("worker") } } });
child.on((e) => { if (e.type === "session.idle") session.log("worker finished"); });
await child.send({ prompt: "…" });

Not checked #

Does the T-953 plan hold? #

Yes. The main plan works: a hooks/copilot/ adapter as an extension, the lead woken with session.send, and workers as SDK child sessions with their own guard. The copilot -p runner is still a good fallback: the extension and its guard also load in -p mode, and --output-format json gives a clean event stream. Its limit is that slash commands don't work there.

Two changes to the plan: extensions need the experimental setting (--experimental or /settings experimental on), and symcc should ship a marketplace file, since direct plugin installs are deprecated.

Suggested first build tasks #

  1. Copilot host core: hooks/copilot/host.ts, tools.ts and lead.ts. Register symcc's tools and the /symcc commands through joinSession, show board text with session.log, and wake the lead with session.send (enqueue normally, immediate for urgent notes). Lead state lives on disk because /clear restarts the extension.
  2. Copilot guard: hooks/copilot/guard.ts. Map onPreToolUse to symcc's file and shell rules, including reading the file paths out of apply_patch patch text. Test it on the fake host.
  3. Copilot agents: workers, checkers and scouts as child sessions through RuntimeConnection.forSpawnedStdio({ path: process.execPath }), each in its own worktree with its own guard. Watch session.idle and session.error to know when an agent ends, and stop the client after.
  4. Bundle and install: a script that builds a single extension.mjs plus the plugin manifest (and a marketplace file), so the plugin installs with copilot plugin install owner/repo:path or from a marketplace.
  5. Fallback runner and band: a copilot -p … --output-format json runner in hooks/process/, and a statusLine script for the band.

Before task 3, check choosing a model for each worker on a paid Copilot plan.