Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(cli): add GitHub Copilot CLI as the 14th engine

0xken159207be705610
diff --git a/.github/assets/engines/README.md b/.github/assets/engines/README.md
index 805917a0a..fc749eadd 100644
--- a/.github/assets/engines/README.md
+++ b/.github/assets/engines/README.md
@@ -30,10 +30,16 @@ a retina display.
| `amp.png` | Amp's official app icon — the `apple-touch-icon` the site itself declares, <https://ampcode.com/app-icon.png?v=3>, fetched 2026-08-07 | 512 | `e5fc0d1178674b80c0dcbbf9811787b44df91f865fac9cd3ef44bb13ef728018` |
| `kilo.png` | Kilo's official mark SVG, <https://kilo.ai/favicon/favicon.svg?v=2>, rendered to a 512px PNG — see the note below | 512 | `03a348a04c622938a278d803cbb6333819de855d2b3127de8e412fd261db3701` |
| `grok.png` | SpaceXAI symbol, the WHITE transparent variant, <https://media.x.ai/v1/website/spacexai-symbol-white-transparent-0c31957f.png>, fetched 2026-08-19 — composited on a black tile, see the note below | 600 | `56357e60b43284734c58e06596be038c58d7fd1a9bea7325d21a107a44ea4b47` |
+| `copilot.png` | GitHub's official Copilot octicon, <https://raw.githubusercontent.com/primer/octicons/main/icons/copilot-48.svg>, fetched 2026-08-19 — rendered white, see the note below | 48 (SVG) | `d94b7a94a4c23816b02285f53eca6386429b67522271483fa0f18ab3596617dc` |
| `agy.png` | Antigravity's official gradient "A" mark — the logo the site itself declares, <https://antigravity.google/assets/image/antigravity-logo.png>, fetched 2026-08-18 | 200 | `8f0b95d2d21dbf930b4d100e2fdc4505673e900a731aa56ea633a4b59c312799` |
Open items, recorded rather than left implicit:
+- **`copilot.png` is a monochrome icon, not a logo.** GitHub publishes the Copilot mark as an
+ octicon whose paths inherit `currentColor`, so it ships with no colour at all and cannot be
+ vendored as-is. It is rendered at `fill="#ffffff"` — a choice of ink for a shape that has none,
+ the same call Kilo's `oklch()` rewrite documents, not a recolour of a coloured mark. Being an SVG
+ it rasterises at any size, so this one has no resolution caveat.
- **`agy.png` is a 200px source.** Antigravity publishes the bare mark only at 200×184; the 512px
`icon.icns` inside the macOS app is an app TILE (a white rounded square with a small glyph),
not the same class of asset as the marks here. The site logo was taken and recorded rather
diff --git a/.github/assets/engines/copilot.png b/.github/assets/engines/copilot.png
new file mode 100644
index 000000000..36b6ade7b
Binary files /dev/null and b/.github/assets/engines/copilot.png differ
diff --git a/README.md b/README.md
index 2b5adee4c..4d875be60 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,8 @@ It drives the agents you already use:
<img src=".github/assets/engines/grok.png" height="72" alt="Grok" title="Grok">
&nbsp;&nbsp;
<img src=".github/assets/engines/agy.png" height="72" alt="Antigravity" title="Antigravity">
+ &nbsp;&nbsp;
+ <img src=".github/assets/engines/copilot.png" height="72" alt="GitHub Copilot" title="GitHub Copilot">
</p>
## Add your agent to Harness
@@ -91,7 +93,7 @@ Your agents stay your processes, on your hardware, with your credentials.
│ │ │
claude · codex hermes · muse agents running on
cursor · amp · … opencode · kilo · your own servers
- grok · agy
+ grok · agy · copilot
└───────── CLI ─────────┘ └─────── API ───────┘
```
diff --git a/cli/hook/notify.mjs b/cli/hook/notify.mjs
index 74dbb4d46..01d37e96b 100644
--- a/cli/hook/notify.mjs
+++ b/cli/hook/notify.mjs
@@ -83,7 +83,14 @@ function argValue(name, fallback) {
function argEngine() {
const i = process.argv.indexOf('--engine')
const value = i !== -1 ? process.argv[i + 1] : ''
- return value === 'codex' || value === 'cursor' || value === 'hermes' || value === 'commandcode' || value === 'devin' || value === 'muse' || value === 'grok' || value === 'agy' ? value : 'claude'
+ return value === 'codex' || value === 'cursor' || value === 'hermes' || value === 'commandcode' || value === 'devin' || value === 'muse' || value === 'grok' || value === 'agy' || value === 'copilot' ? value : 'claude'
+}
+
+/** Copilot names its hook event only on the command line, like agy. */
+function argCopilotEvent() {
+ const i = process.argv.indexOf('--copilot-event')
+ const value = i !== -1 ? process.argv[i + 1] : ''
+ return ['sessionStart', 'userPromptSubmitted', 'agentStop', 'sessionEnd'].includes(value) ? value : ''
}
/**
@@ -108,6 +115,7 @@ function paths() {
const hermesHome = argValue('--hermes-home', process.env.HERMES_HOME || join(homedir(), '.hermes'))
const commandcodeHome = argValue('--commandcode-home', process.env.COMMANDCODE_HOME || join(homedir(), '.commandcode'))
const devinHome = argValue('--devin-home', process.env.DEVIN_HOME || join(homedir(), '.local', 'share', 'devin', 'cli'))
+ const copilotHome = argValue('--copilot-home', process.env.COPILOT_HOME || join(homedir(), '.copilot'))
const agyHome = argValue('--agy-home', process.env.AGY_HOME || join(homedir(), '.gemini', 'antigravity-cli'))
return {
dataDir,
@@ -125,9 +133,17 @@ function paths() {
agyHome,
agyBrainDir: join(agyHome, 'brain'),
agyPresenceDir: join(agyHome, 'presence'),
+ copilotHome,
+ copilotSessionsDir: join(copilotHome, 'session-state'),
}
}
+/** Copilot's deterministic transcript layout, duplicated here because the hook cannot import src/. */
+function copilotTranscriptPath(p, sessionId) {
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId || '')) return undefined
+ return join(p.copilotSessionsDir, sessionId, 'events.jsonl')
+}
+
/**
* Is this agy conversation the PANE's, or a sub-agent's?
*
@@ -396,12 +412,12 @@ function processEntrypoint(args) {
const ENGINE_COMMANDS = {
claude: 'claude', codex: 'codex', cursor: 'agent', hermes: 'hermes', commandcode: 'cmd',
- devin: 'devin', muse: 'muse', grok: 'grok', agy: 'agy',
+ devin: 'devin', muse: 'muse', grok: 'grok', agy: 'agy', copilot: 'copilot',
}
const ENGINE_PATH_ENV = {
claude: 'CLAUDE_PATH', codex: 'CODEX_PATH', cursor: 'CURSOR_PATH', hermes: 'HERMES_PATH',
commandcode: 'COMMANDCODE_PATH', devin: 'DEVIN_PATH', muse: 'MUSE_PATH', grok: 'GROK_PATH',
- agy: 'AGY_PATH',
+ agy: 'AGY_PATH', copilot: 'COPILOT_PATH',
}
function executableIdentity(path) {
@@ -799,6 +815,7 @@ function validTranscriptPath(engine, filePath, p) {
engine === 'codex' ? p.codexSessionsDir
: engine === 'grok' ? p.grokSessionsDir
: engine === 'agy' ? p.agyBrainDir
+ : engine === 'copilot' ? p.copilotSessionsDir
: engine === 'cursor' ? p.cursorProjectsDir
: engine === 'commandcode' ? p.commandcodeProjectsDir
: p.claudeProjectsDir,
@@ -1054,7 +1071,7 @@ function mergeRuntimes(current, observed) {
const REGISTRY_ENGINES = new Set([
'claude', 'codex', 'cursor', 'opencode', 'pi', 'hermes', 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok',
- 'agy',
+ 'agy', 'copilot',
])
function validRegistryString(value, max = 4096) {
@@ -1150,7 +1167,7 @@ async function fallbackRegister(input, engine, tmuxPane) {
? rawSessionId
: (transcriptPath ? basename(transcriptPath).replace(/\.jsonl$/, '') : '')
if (!sessionId) return
- const transcriptOptional = ['cursor', 'opencode', 'kilo', 'pi', 'hermes', 'commandcode', 'devin', 'grok', 'agy'].includes(engine)
+ const transcriptOptional = ['cursor', 'opencode', 'kilo', 'pi', 'hermes', 'commandcode', 'devin', 'grok', 'agy', 'copilot'].includes(engine)
if (!transcriptOptional && !transcriptPath) return
if (transcriptPath && !validTranscriptPath(engine, transcriptPath, p)) return
const observations = []
@@ -1264,6 +1281,47 @@ async function main() {
// the final assistant chunk, so treating Stop as authoritative would close the turn too early. The
// transcript's `turn_completed` record closes normal turns; only StopFailure is needed as an error
// fallback here.
+ // Copilot: every event carries `sessionId` and `cwd`, and `agentStop` additionally names the
+ // transcript. `sessionStart` fires AFTER the first prompt (measured: userPromptSubmitted at
+ // …796411, sessionStart at …798963), so registration is driven by whichever arrives first —
+ // both are idempotent.
+ if (engine === 'copilot') {
+ const copilotEvent = argCopilotEvent()
+ if (!copilotEvent) return
+ const sessionId = input.sessionId
+ const p = paths()
+ const transcriptPath = existsPath(input.transcriptPath) ? input.transcriptPath : copilotTranscriptPath(p, sessionId)
+ const cwd = input.cwd
+ if (copilotEvent === 'sessionEnd') {
+ const ok = await post(port, '/api/hook/session-end', { sessionId, reason: input.reason, ...mutationFields })
+ if (!ok) await fallbackSessionEnd(sessionId, input.reason, engine, tmuxPane)
+ return
+ }
+ if (copilotEvent === 'agentStop') {
+ // `stopReason` is `end_turn` on a clean finish; anything else ended the loop early.
+ const failed = typeof input.stopReason === 'string' && input.stopReason !== '' && input.stopReason !== 'end_turn'
+ await post(port, '/api/hook/turn-stop', {
+ sessionId, transcriptPath, status: failed ? 'error' : undefined, ...mutationFields,
+ })
+ return
+ }
+ const body = {
+ engine,
+ hookEvent: 'SessionStart',
+ sessionId,
+ transcriptPath,
+ cwd,
+ ...terminalHookFields(tmuxPane),
+ }
+ const registered = await post(port, '/api/hook/session-start', body)
+ if (!registered) {
+ await fallbackRegister({
+ ...input, hook_event_name: 'SessionStart', session_id: sessionId, transcript_path: transcriptPath, cwd,
+ }, engine, tmuxPane)
+ }
+ return
+ }
+
// agy: the hook is the whole binding. Its `PreInvocation` fires before every model round-trip, so the
// FIRST one of a turn is the session announce; `Stop` fires exactly once when the execution loop ends
// and is the authoritative turn boundary (the transcript records no closing marker of its own, and a
@@ -1497,6 +1555,7 @@ main()
// only `{"decision":"continue"}` would block the stop. It is also why PreToolUse is never installed
// — there `decision` is required, and `{}` reads as a denial (measured: every tool call of the turn
// came back "Tool call denied by pre-tool hook").
- if (e === 'cursor' || e === 'hermes' || e === 'agy') process.stdout.write('{}\n', () => process.exit(0))
+ // Copilot parses stdout as JSON too; `{}` is the documented no-op for every event installed here.
+ if (e === 'cursor' || e === 'hermes' || e === 'agy' || e === 'copilot') process.stdout.write('{}\n', () => process.exit(0))
else process.exit(0)
})
diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.ts
index 6240dc00d..9181a75f5 100644
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@ -33,6 +33,7 @@ import { museMessagesToEvents } from './engines/muse/normalizer.js'
import { ampMessagesToEvents } from './engines/amp/normalizer.js'
import { grokMessagesToEvents } from './engines/grok/normalizer.js'
import { agyMessagesToEvents } from './engines/agy/normalizer.js'
+import { copilotMessagesToEvents } from './engines/copilot/normalizer.js'
import { ampThreadToEvents, readAmpThread } from './engines/amp/threadExport.js'
import { piMessagesToEvents, windowPiLines } from './engines/pi/normalizer.js'
import { commandcodeMessagesToEvents, windowCommandCodeLines } from './engines/commandcode/normalizer.js'
@@ -141,13 +142,20 @@ export function agyHistoryPage(lines: string[], paginated: boolean):
return paginated ? { events, hasMore: false, oldestCursor: null } : { events }
}
+/** Copilot has no transcript windower either; same both-shapes replay as grok and agy. */
+export function copilotHistoryPage(lines: string[], paginated: boolean):
+ { events: SessionEvent[]; hasMore?: false; oldestCursor?: null } {
+ const events = copilotMessagesToEvents(lines)
+ return paginated ? { events, hasMore: false, oldestCursor: null } : { events }
+}
+
export function deviceAgentListItem(
raw: unknown,
-): { id: unknown; name?: string; engine?: 'claude' | 'codex' | 'cursor' | 'opencode' | 'pi' | 'hermes' | 'commandcode' | 'devin' | 'muse' | 'amp' | 'kilo' | 'grok' | 'agy'; selectedModel?: string | null } {
+): { id: unknown; name?: string; engine?: 'claude' | 'codex' | 'cursor' | 'opencode' | 'pi' | 'hermes' | 'commandcode' | 'devin' | 'muse' | 'amp' | 'kilo' | 'grok' | 'agy' | 'copilot'; selectedModel?: string | null } {
const o = (raw ?? {}) as Record<string, unknown>
- const item: { id: unknown; name?: string; engine?: 'claude' | 'codex' | 'cursor' | 'opencode' | 'pi' | 'hermes' | 'commandcode' | 'devin' | 'muse' | 'amp' | 'kilo' | 'grok' | 'agy'; selectedModel?: string | null } = { id: o.id }
+ const item: { id: unknown; name?: string; engine?: 'claude' | 'codex' | 'cursor' | 'opencode' | 'pi' | 'hermes' | 'commandcode' | 'devin' | 'muse' | 'amp' | 'kilo' | 'grok' | 'agy' | 'copilot'; selectedModel?: string | null } = { id: o.id }
if (typeof o.name === 'string') item.name = clipDeviceAgentName(o.name)
- if (o.engine === 'claude' || o.engine === 'codex' || o.engine === 'cursor' || o.engine === 'opencode' || o.engine === 'pi' || o.engine === 'hermes' || o.engine === 'commandcode' || o.engine === 'devin' || o.engine === 'muse' || o.engine === 'amp' || o.engine === 'kilo' || o.engine === 'grok' || o.engine === 'agy') item.engine = o.engine
+ if (o.engine === 'claude' || o.engine === 'codex' || o.engine === 'cursor' || o.engine === 'opencode' || o.engine === 'pi' || o.engine === 'hermes' || o.engine === 'commandcode' || o.engine === 'devin' || o.engine === 'muse' || o.engine === 'amp' || o.engine === 'kilo' || o.engine === 'grok' || o.engine === 'agy' || o.engine === 'copilot') item.engine = o.engine
// Runtime model/effort profile (opaque runtime-v1:...) — lets the device render + change model/effort.
if (typeof o.selectedModel === 'string' || o.selectedModel === null) item.selectedModel = o.selectedModel
return item
@@ -835,12 +843,14 @@ export class BackendSocket {
? grokHistoryPage(lines, false).events
: s.engine === 'agy'
? agyHistoryPage(lines, false).events
+ : s.engine === 'copilot'
+ ? copilotHistoryPage(lines, false).events
: s.engine === 'pi'
? piMessagesToEvents(lines)
: s.engine === 'commandcode'
? commandcodeMessagesToEvents(lines)
: messagesToEvents(lines)
- if (s.engine !== 'cursor' && s.engine !== 'pi' && s.engine !== 'commandcode' && s.engine !== 'muse' && s.engine !== 'amp' && s.engine !== 'grok' && s.engine !== 'agy') await enrichSubagentStats(fullEvents, s.transcriptPath)
+ if (s.engine !== 'cursor' && s.engine !== 'pi' && s.engine !== 'commandcode' && s.engine !== 'muse' && s.engine !== 'amp' && s.engine !== 'grok' && s.engine !== 'agy' && s.engine !== 'copilot') await enrichSubagentStats(fullEvents, s.transcriptPath)
reply(type, requestId, {
id: sessionId,
title: projectDisplayName(s),
@@ -858,12 +868,14 @@ export class BackendSocket {
// small: a real one measured 271 lines).
// Amp is in the same position as muse and for the same reason: no windower, so falling
// through would pair claude's line-uuid cursor with claude's normalizer and return nothing.
- if (s.engine === 'muse' || s.engine === 'amp' || s.engine === 'grok' || s.engine === 'agy') {
+ if (s.engine === 'muse' || s.engine === 'amp' || s.engine === 'grok' || s.engine === 'agy' || s.engine === 'copilot') {
const wholePage = s.engine === 'grok'
? grokHistoryPage(lines, true)
: s.engine === 'agy'
? agyHistoryPage(lines, true)
- : null
+ : s.engine === 'copilot'
+ ? copilotHistoryPage(lines, true)
+ : null
reply(type, requestId, {
id: sessionId,
title: projectDisplayName(s),
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index b138e01f7..4dfa8652d 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -24,7 +24,7 @@ import { homedir } from 'os'
import { env } from './config/env.js'
import { VERSION } from './version.js'
import { registry, projectDisplayName, type RegisteredSession } from './lib/registry.js'
-import { installAmpPlugin, installCodexHooks, installCommandCodeHooks, installCursorHooks, installDevinHooks, installGrokHooks, installAgyHooks, installHermesHooks, installKiloPlugin, installOpencodePlugin, installPiExtension, installSessionHooks } from './lib/hooks.js'
+import { installAmpPlugin, installCodexHooks, installCommandCodeHooks, installCursorHooks, installDevinHooks, installGrokHooks, installAgyHooks, installCopilotHooks, installHermesHooks, installKiloPlugin, installOpencodePlugin, installPiExtension, installSessionHooks } from './lib/hooks.js'
import { PID_FILE, TOKEN_FILE, daemonPort, isAlive, readPid } from './lib/daemonState.js'
import { flashCommand } from './lib/flash.js'
import { ENGINE_CLI_COMMANDS, ENGINES } from './lib/engineBin.js'
@@ -87,6 +87,8 @@ import { findGrokTranscript } from './engines/grok/session.js'
import { AgyNormalizer, lastAgyTurnText } from './engines/agy/normalizer.js'
import { findAgyTranscript } from './engines/agy/session.js'
import { agyPaneIdle } from './engines/agy/runtimeProfile.js'
+import { CopilotNormalizer, lastCopilotTurnText } from './engines/copilot/normalizer.js'
+import { findCopilotTranscript } from './engines/copilot/session.js'
import { PiNormalizer, lastPiTurnText } from './engines/pi/normalizer.js'
import { HermesReader, readHermesMessages } from './engines/hermes/reader.js'
import { DevinReader, readDevinMessages } from './engines/devin/reader.js'
@@ -798,6 +800,7 @@ async function runForeground(token: string): Promise<void> {
const ampNormalizers = new Map<string, AmpNormalizer>()
const grokNormalizers = new Map<string, GrokNormalizer>()
const agyNormalizers = new Map<string, AgyNormalizer>()
+ const copilotNormalizers = new Map<string, CopilotNormalizer>()
const hermesReaders = new Map<string, HermesReader>()
const devinReaders = new Map<string, DevinReader>()
const commandcodeNormalizers = new Map<string, CommandCodeNormalizer>()
@@ -905,6 +908,7 @@ async function runForeground(token: string): Promise<void> {
|| ampNormalizers.has(session.sessionId)
|| grokNormalizers.has(session.sessionId)
|| agyNormalizers.has(session.sessionId)
+ || copilotNormalizers.has(session.sessionId)
|| hermesReaders.has(session.sessionId)
|| devinReaders.has(session.sessionId)
|| commandcodeNormalizers.has(session.sessionId)
@@ -1014,6 +1018,11 @@ async function runForeground(token: string): Promise<void> {
normalizer.closeTurn()
historyTurnOpen = false
}
+ } else if (session.engine === 'copilot') {
+ // A JSONL tail like claude/agy. Its turn lifecycle comes from the agentStop hook, not the file.
+ const normalizer = new CopilotNormalizer()
+ historyTurnOpen = fold((line) => normalizer.ingest(line), () => normalizer.turnOpen)
+ copilotNormalizers.set(session.sessionId, normalizer)
} else if (session.engine === 'pi') {
const normalizer = new PiNormalizer('live')
// Hydrate state silently; never replay history live — except a turn left open, below.
@@ -1260,6 +1269,7 @@ async function runForeground(token: string): Promise<void> {
if (s.engine === 'amp') return lastAmpTurnText(lines)
if (s.engine === 'grok') return lastGrokTurnText(lines)
if (s.engine === 'agy') return lastAgyTurnText(lines)
+ if (s.engine === 'copilot') return lastCopilotTurnText(lines)
if (s.engine === 'pi') return lastPiTurnText(lines)
if (s.engine === 'commandcode') return lastCommandCodeTurnText(lines)
return lastTurnTextFromRawLines(lines)
@@ -1333,6 +1343,7 @@ async function runForeground(token: string): Promise<void> {
?? ampNormalizers.get(sessionId)?.turnOpen
?? grokNormalizers.get(sessionId)?.turnOpen
?? agyNormalizers.get(sessionId)?.turnOpen
+ ?? copilotNormalizers.get(sessionId)?.turnOpen
?? hermesReaders.get(sessionId)?.turnOpen
?? devinReaders.get(sessionId)?.turnOpen
?? commandcodeNormalizers.get(sessionId)?.turnOpen
@@ -1439,6 +1450,7 @@ async function runForeground(token: string): Promise<void> {
ampNormalizers.delete(sessionId)
grokNormalizers.delete(sessionId)
agyNormalizers.delete(sessionId)
+ copilotNormalizers.delete(sessionId)
clearAgyIdleWatch(sessionId)
hermesReaders.get(sessionId)?.stop()
hermesReaders.delete(sessionId)
@@ -1481,8 +1493,13 @@ async function runForeground(token: string): Promise<void> {
// re-emitted `turn_started` for a turn already open (measured: two turn_started, one turn_ended).
// Its first bind is covered by `meta.isNew`, and registry derives the transcript path from the
// conversation id, so nothing here depends on a later announcement carrying it.
+ // Copilot joins cursor and agy for a third reason: it announces the SAME turn twice. Its
+ // `userPromptSubmitted` and `sessionStart` hooks both register (measured 2.5s apart, and in that
+ // order — sessionStart fires AFTER the first prompt), so treating the second as a reset re-folded
+ // the transcript and emitted a second `turn_started` for one exchange.
const reset = meta.isNew
- || (entry.engine !== 'cursor' && entry.engine !== 'agy' && meta.hookEvent === 'SessionStart')
+ || (entry.engine !== 'cursor' && entry.engine !== 'agy' && entry.engine !== 'copilot'
+ && meta.hookEvent === 'SessionStart')
// Deliberately NOT gated on `meta.isNew`. `isNew` is false in exactly the case this is meant to catch:
// a session announced once BEFORE its transcript exists and registered again when the file appears —
// the second announcement is the only one that can carry the path, and it reports `isNew=false`
@@ -1547,7 +1564,9 @@ async function runForeground(token: string): Promise<void> {
? await findGrokTranscript(env.GROK_HOME, observed.cwd, sessionId) ?? undefined
: observed.engine === 'agy'
? await findAgyTranscript(env.AGY_HOME, sessionId) ?? undefined
- : undefined
+ : observed.engine === 'copilot'
+ ? await findCopilotTranscript(env.COPILOT_HOME, sessionId) ?? undefined
+ : undefined
if ((observed.engine === 'cursor' || observed.engine === 'grok') && !transcriptPath) return
} else {
const attempts = repairAttempts.get(agent.agentId) ?? 0
@@ -1824,6 +1843,28 @@ async function runForeground(token: string): Promise<void> {
})
return
}
+ // Copilot's agentStop hook is the turn boundary: its own `assistant.turn_end` records mark model
+ // round-trips, several per exchange. Drain first so the closing text is on the wire, then close.
+ if (session.engine === 'copilot') {
+ void (async () => {
+ await watcher.pollSession(sessionId)
+ const normalizer = copilotNormalizers.get(sessionId)
+ if (!normalizer?.turnOpen) return
+ await new Promise((r) => setTimeout(r, STOP_HOOK_GRACE_MS))
+ await watcher.pollSession(sessionId)
+ if (!normalizer.turnOpen) return
+ if (status === 'error') {
+ announceTurnAborted(sessionId, 'copilot', 'Copilot ended the turn early')
+ emitSessionEvents(sessionId, normalizer.abortTurn())
+ return
+ }
+ console.log(`[turn] ${sid(sessionId)} closed by copilot agentStop hook (after grace)`)
+ emitSessionEvents(sessionId, normalizer.closeTurn())
+ })().catch((err) => {
+ console.error('[hooks] copilot stop hook failed:', err instanceof Error ? err.message : err)
+ })
+ return
+ }
// agy's Stop hook is the ONLY turn boundary it has. Nothing in the transcript says a turn ended:
// a backgrounded step is written `status: RUNNING` and, the file being append-only, stays that way
// forever. Drain first so the closing prose is on the wire before turn_ended, then force-close.
@@ -1979,6 +2020,7 @@ async function runForeground(token: string): Promise<void> {
installCommandCodeHooks(hookPort)
installGrokHooks(hookPort)
installAgyHooks(hookPort)
+ installCopilotHooks(hookPort)
}
backend.setDashboardPort(hookPort) // surfaced to the web (e2e_status) so it can link here to approve
console.log(`[cli] local dashboard → http://127.0.0.1:${hookPort}`)
@@ -2026,6 +2068,10 @@ async function runForeground(token: string): Promise<void> {
let normalizer = agyNormalizers.get(evt.sessionId)
if (!normalizer) { normalizer = new AgyNormalizer(); agyNormalizers.set(evt.sessionId, normalizer) }
events = normalizer.ingest(evt.text)
+ } else if (session.engine === 'copilot') {
+ let normalizer = copilotNormalizers.get(evt.sessionId)
+ if (!normalizer) { normalizer = new CopilotNormalizer(); copilotNormalizers.set(evt.sessionId, normalizer) }
+ events = normalizer.ingest(evt.text)
} else if (session.engine === 'pi') {
let normalizer = piNormalizers.get(evt.sessionId)
if (!normalizer) { normalizer = new PiNormalizer('live'); piNormalizers.set(evt.sessionId, normalizer) }
@@ -2071,6 +2117,7 @@ async function runForeground(token: string): Promise<void> {
?? ampNormalizers.get(session.sessionId)?.turnOpen
?? grokNormalizers.get(session.sessionId)?.turnOpen
?? agyNormalizers.get(session.sessionId)?.turnOpen
+ ?? copilotNormalizers.get(session.sessionId)?.turnOpen
?? hermesReaders.get(session.sessionId)?.turnOpen
?? devinReaders.get(session.sessionId)?.turnOpen
?? commandcodeNormalizers.get(session.sessionId)?.turnOpen
@@ -2185,6 +2232,7 @@ async function runForeground(token: string): Promise<void> {
ampNormalizers.get(sessionId)?.closeTurn()
grokNormalizers.get(sessionId)?.closeTurn()
agyNormalizers.get(sessionId)?.closeTurn()
+ copilotNormalizers.get(sessionId)?.closeTurn()
hermesReaders.get(sessionId)?.closeTurn()
devinReaders.get(sessionId)?.closeTurn()
commandcodeNormalizers.get(sessionId)?.closeTurn()
diff --git a/cli/src/config/env.ts b/cli/src/config/env.ts
index 62cfdee4b..c8098a0e2 100644
--- a/cli/src/config/env.ts
+++ b/cli/src/config/env.ts
@@ -111,6 +111,10 @@ const envSchema = z.object({
AGY_HOME: z.string().default(join(homedir(), '.gemini', 'antigravity-cli')),
// Where the Antigravity CLI reads its shared customization root (hooks.json lives here).
AGY_CONFIG_DIR: z.string().default(join(homedir(), '.gemini', 'config')),
+ // GitHub Copilot CLI state root. Its per-session event stream lives at
+ // <COPILOT_HOME>/session-state/<sessionId>/events.jsonl, and hooks are read from
+ // <COPILOT_HOME>/hooks/*.json — a directory, so Harness drops in its own file.
+ COPILOT_HOME: z.string().default(join(homedir(), '.copilot')),
// Cursor state root. Interactive transcripts live below <CURSOR_HOME>/projects and local
// subagent linkage metadata lives below <CURSOR_HOME>/chats.
CURSOR_HOME: z.string().default(join(homedir(), '.cursor')),
@@ -236,6 +240,9 @@ const envSchema = z.object({
KILO_PATH: z.string().optional(),
// Path to the xAI Grok CLI for interactive sessions and recap one-shots.
GROK_PATH: z.string().optional(),
+ // Path to the GitHub Copilot CLI. Two builds answer to `copilot` on a typical machine — a compiled
+ // binary and the npm loader script — so an override is worth having.
+ COPILOT_PATH: z.string().optional(),
// Path to the Antigravity CLI. Two binaries answer to `agy` on a typical PATH — the CLI itself and
// the Antigravity IDE launcher — so an override is worth having.
AGY_PATH: z.string().optional(),
@@ -251,6 +258,8 @@ const envSchema = z.object({
KILO_SUMMARY_MODEL: z.string().default(''),
// Grok recap model. Empty → use the user's Grok CLI default model.
GROK_SUMMARY_MODEL: z.string().default(''),
+ // Copilot recap model. Empty -> `auto`, which lets Copilot pick and keeps the user's credit policy.
+ COPILOT_SUMMARY_MODEL: z.string().default(''),
// Antigravity recap model (a slug from `agy models`). Flash at low effort: a recap is a short
// summarisation of text already in hand, so the cheapest tier in the catalog is the right one.
AGY_SUMMARY_MODEL: z.string().default('gemini-3.7-flash-low'),
diff --git a/cli/src/engines/README.md b/cli/src/engines/README.md
index a1c1d3c12..f34419181 100644
--- a/cli/src/engines/README.md
+++ b/cli/src/engines/README.md
@@ -300,6 +300,18 @@ conversation reports the last turn as still open and nothing is ever coming to c
`turn_heartbeat` every second, indefinitely). Its pane knows — `? for shortcuts` when idle,
`esc to cancel` while busy — so attach reads the pane once and closes the folded turn.
+**Two announce events for one turn is a thing that happens.** Copilot fires `userPromptSubmitted` and
+then `sessionStart` (measured 2.5s apart, in that order — its sessionStart comes AFTER the first
+prompt). Both register, registration is idempotent, and that is fine — but `handleRegistered` treats a
+`SessionStart` hook as a reason to re-fold the transcript, so the second one re-emitted `turn_started`
+for a turn already open. Copilot is excluded from that reset in `cli.ts`, next to cursor and agy.
+
+**Read the hook's exit-code contract before installing an event, not just its payload.** Copilot's
+docs are explicit that every hook fails OPEN except `preToolUse`, which fails CLOSED: a non-zero exit
+denies the tool. A crashing hook would stop the user's agent from running anything. It is not
+installed — the same rows are in the transcript anyway. (agy's version of this trap is worse: there
+`{}` itself is a denial.)
+
## Stage D — drive the agent
Only needed for the capabilities your agent actually has. Skip what does not apply.
diff --git a/cli/src/engines/copilot/normalizer.spec.ts b/cli/src/engines/copilot/normalizer.spec.ts
new file mode 100644
index 000000000..c6b613dd5
--- /dev/null
+++ b/cli/src/engines/copilot/normalizer.spec.ts
@@ -0,0 +1,110 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import {
+ CopilotNormalizer,
+ copilotEvent,
+ copilotMessagesToEvents,
+ copilotSessionModel,
+ copilotToolName,
+ lastCopilotTurnText,
+} from './normalizer.js'
+import type { LiveEvent } from '../../lib/normalize.js'
+
+const FIXTURE = fileURLToPath(new URL('../../lib/__fixtures__/copilot-session.jsonl', import.meta.url))
+const LINES = readFileSync(FIXTURE, 'utf8').split('\n').filter(Boolean)
+
+function live(): LiveEvent[] {
+ const normalizer = new CopilotNormalizer()
+ const events: LiveEvent[] = []
+ for (const line of LINES) events.push(...normalizer.ingest(line))
+ events.push(...normalizer.closeTurn())
+ return events
+}
+
+describe('copilot normalizer, over real recorded sessions', () => {
+ it('opens a turn per user message and closes the last one on the agentStop hook', () => {
+ const events = live()
+ expect(events.filter((e) => e.type === 'turn_started')).toHaveLength(2)
+ expect(events.filter((e) => e.type === 'turn_ended')).toHaveLength(2)
+ expect(events[events.length - 1].type).toBe('turn_ended')
+ })
+
+ it('does NOT read the lifecycle off assistant.turn_start/end', () => {
+ // Those mark model round-trips: the fixture holds four of each across two user exchanges. Reading
+ // them as turns would report four turns and close the first while tools were still running.
+ const turnMarkers = LINES.filter((l) => /"assistant\.turn_(start|end)"/.test(l))
+ expect(turnMarkers.length).toBeGreaterThan(4)
+ expect(live().filter((e) => e.type === 'turn_started')).toHaveLength(2)
+ })
+
+ it('pairs tools by their real toolCallId, leaving no row open', () => {
+ const events = live()
+ const starts = events.filter((e) => e.type === 'tool_start') as Array<Extract<LiveEvent, { type: 'tool_start' }>>
+ const ends = events.filter((e) => e.type === 'tool_end') as Array<Extract<LiveEvent, { type: 'tool_end' }>>
+ expect(starts.length).toBeGreaterThan(1)
+ expect(ends.map((e) => e.payload.id).sort()).toEqual(starts.map((e) => e.payload.id).sort())
+ // Two tools were launched in one message and completed out of band — position would not pair them.
+ expect(starts.map((e) => e.payload.id)).toEqual(expect.arrayContaining([starts[0].payload.id]))
+ })
+
+ it('maps the measured tool names onto the shared vocabulary', () => {
+ const events = live()
+ const tools = new Set(events.filter((e) => e.type === 'tool_start').map((e) => (e as Extract<LiveEvent, { type: 'tool_start' }>).payload.tool))
+ expect(tools.has('Bash')).toBe(true)
+ expect(tools.has('Write')).toBe(true)
+ })
+
+ it('shows the prompt the user typed, not the transformed one', () => {
+ const events = live()
+ const first = events.find((e) => e.type === 'user_message') as Extract<LiveEvent, { type: 'user_message' }>
+ expect(first.payload.content).not.toContain('<current_datetime>')
+ expect(first.payload.content).not.toContain('system_reminder')
+ })
+
+ it('renders no card for Copilot bookkeeping or for our own hooks', () => {
+ const events = live()
+ const text = JSON.stringify(events)
+ expect(text).not.toContain('usage_checkpoint')
+ expect(text).not.toContain('auto_mode_resolved')
+ expect(text).not.toContain('hook.start')
+ })
+
+ it('replay emits no lifecycle frames and terminates with done', () => {
+ const events: LiveEvent[] = copilotMessagesToEvents(LINES)
+ expect(events.some((e) => e.type === 'turn_started')).toBe(false)
+ expect(events.some((e) => e.type === 'turn_ended')).toBe(false)
+ expect(events[0].type).toBe('user_message')
+ expect(events[events.length - 1]).toEqual({ type: 'done', payload: { result: 'success' } })
+ })
+
+ it('lastCopilotTurnText returns the final exchange as the recap source', () => {
+ const last = lastCopilotTurnText(LINES)
+ expect(last).not.toBeNull()
+ expect(last!.assistantText.length).toBeGreaterThan(0)
+ })
+
+ it('reads the resolved model, not the "auto" placeholder', () => {
+ // `session.model_change` says `auto`; each assistant message names what auto actually chose.
+ expect(copilotSessionModel(LINES)).not.toBe('auto')
+ expect(copilotSessionModel(LINES)).toBeTruthy()
+ })
+
+ it('is inert on malformed input', () => {
+ const normalizer = new CopilotNormalizer()
+ expect(normalizer.ingest('not json')).toEqual([])
+ expect(normalizer.ingest('{}')).toEqual([])
+ expect(copilotEvent('{"data":{}}')).toBeNull()
+ })
+})
+
+describe('copilot tool names', () => {
+ it('maps what was measured and title-cases the rest', () => {
+ expect(copilotToolName('bash')).toBe('Bash')
+ expect(copilotToolName('create')).toBe('Write')
+ expect(copilotToolName('view')).toBe('Read')
+ // `sql` is Copilot's todo mechanism AND its general query tool; it must not become TodoWrite.
+ expect(copilotToolName('sql')).toBe('Sql')
+ expect(copilotToolName('some_future_tool')).toBe('Some Future Tool')
+ })
+})
diff --git a/cli/src/engines/copilot/normalizer.ts b/cli/src/engines/copilot/normalizer.ts
new file mode 100644
index 000000000..af871a012
--- /dev/null
+++ b/cli/src/engines/copilot/normalizer.ts
@@ -0,0 +1,255 @@
+/**
+ * GitHub Copilot CLI `events.jsonl` -> Harness's shared event vocabulary.
+ *
+ * Measured on Copilot CLI 1.0.80. Each session writes an append-only event stream to
+ * `<COPILOT_HOME>/session-state/<sessionId>/events.jsonl`. Every record is
+ * `{type, data, id, timestamp, parentId}`, and the vocabulary is the most explicit of any engine here:
+ * tool calls carry a real `toolCallId` on both halves, so nothing is paired by position or by guessing.
+ *
+ * The one thing that is NOT what it looks like:
+ *
+ * `assistant.turn_start` / `assistant.turn_end` are per MODEL ROUND-TRIP, not per user exchange.
+ * One measured prompt produced turnId 0 (text + two tools) and turnId 1 (the closing sentence) —
+ * two starts and two ends for one turn. Reading the lifecycle off them splits a single exchange
+ * into several and closes the turn while the agent is still working.
+ *
+ * The real boundary is the `agentStop` hook (`stopReason: "end_turn"`, and it names this very file in
+ * `transcriptPath`), handled in `cli.ts`. A turn opens here on `user.message`.
+ */
+
+import type { EngineNormalizer } from '../types.js'
+import type { LastTurnText, LiveEvent, SessionEvent } from '../../lib/normalize.js'
+
+type JsonObject = Record<string, unknown>
+
+const MAX_OUTPUT = 2_000
+
+/**
+ * Only names observed in real Copilot sessions belong here; unknown tools stay visibly generic.
+ *
+ * Measured firing: `bash`, `create`, `view`, `sql`. Everything else falls through to Title Case rather
+ * than being invented — an earlier draft mapped `todo`/`todos` from words in the system prompt and was
+ * wrong: those are SQL identifiers, not tools (see below).
+ *
+ * **There is no TodoWrite here, and that is a measurement, not an omission.** Asked on a real session
+ * to "make a todo list using your todo tool", Copilot called `sql` with
+ * `INSERT INTO todos (id, title, description, status) VALUES …`. Its plan lives in an in-session SQL
+ * table, not in a tool payload shaped `{todos:[{content,status}]}`, so the device checklist for this
+ * engine stays empty. `sql` is a general query tool and must not be relabelled TodoWrite: the same tool
+ * runs every other query too.
+ */
+const TOOL_NAMES: Record<string, string> = {
+ bash: 'Bash',
+ create: 'Write',
+ view: 'Read',
+}
+
+export function copilotToolName(name: string): string {
+ if (TOOL_NAMES[name]) return TOOL_NAMES[name]
+ const words = name.split(/[_\s-]+/).filter(Boolean)
+ return words.length ? words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ') : 'Tool'
+}
+
+function obj(value: unknown): JsonObject | null {
+ return value && typeof value === 'object' && !Array.isArray(value) ? value as JsonObject : null
+}
+
+function str(value: unknown): string {
+ return typeof value === 'string' ? value : ''
+}
+
+function clip(value: string, max: number): string {
+ return value.length <= max ? value : `${value.slice(0, max)}\n...[truncated]`
+}
+
+export interface CopilotEvent {
+ type: string
+ data: JsonObject
+ id: string
+ parentId: string
+}
+
+export function copilotEvent(line: string): CopilotEvent | null {
+ let raw: JsonObject | null
+ try { raw = obj(JSON.parse(line)) } catch { return null }
+ const type = str(raw?.type)
+ if (!raw || !type) return null
+ return { type, data: obj(raw.data) ?? {}, id: str(raw.id), parentId: str(raw.parentId) }
+}
+
+/**
+ * The prompt as the user typed it.
+ *
+ * `content` is that; `transformedContent` is the same text wrapped in `<current_datetime>` and
+ * `<system_reminder>` blocks for the model. Showing the transformed one would put Copilot's own
+ * scaffolding in the user's bubble.
+ */
+export function copilotUserText(data: JsonObject): string {
+ return str(data.content).trim()
+}
+
+/** Tool results are `{result: {content, detailedContent}}`; `content` is the human-sized one. */
+export function copilotToolOutput(data: JsonObject): string {
+ const result = obj(data.result)
+ const text = str(result?.content) || str(result?.detailedContent)
+ return clip(text.trim(), MAX_OUTPUT)
+}
+
+interface CopilotTurnState {
+ open: boolean
+ /** toolCallId -> shared tool name, so `tool.execution_complete` can close the row it opened. */
+ openRows: Map<string, string>
+}
+
+export function newCopilotTurnState(): CopilotTurnState {
+ return { open: false, openRows: new Map() }
+}
+
+function closeRows(state: CopilotTurnState, events: LiveEvent[], status: string): void {
+ for (const [id, tool] of state.openRows) {
+ events.push({ type: 'tool_end', payload: { id, tool, output: `Tool ${status}`, isError: status === 'failed', summary: '' } })
+ }
+ state.openRows.clear()
+}
+
+/** Records that exist for Copilot's own bookkeeping and carry nothing a person reads. */
+const IGNORED = new Set([
+ 'session.start',
+ 'session.shutdown',
+ 'session.usage_checkpoint',
+ 'session.auto_mode_resolved',
+ 'session.model_change',
+ 'session.info',
+ // Our own hooks, logged back into the stream. Rendering them would mirror Harness at the user.
+ 'hook.start',
+ 'hook.end',
+ // The system prompt. Never the user's.
+ 'system.message',
+])
+
+export function copilotEventToEvents(event: CopilotEvent, state: CopilotTurnState, mode: 'live' | 'replay'): LiveEvent[] {
+ const events: LiveEvent[] = []
+ const { type, data } = event
+
+ if (IGNORED.has(type)) return events
+
+ if (type === 'user.message') {
+ const userMessage = copilotUserText(data)
+ if (mode === 'live') {
+ if (state.open) {
+ closeRows(state, events, 'interrupted')
+ events.push({ type: 'turn_ended', payload: {} })
+ }
+ state.open = true
+ events.push({ type: 'turn_started', payload: { userMessage } })
+ }
+ events.push({ type: 'user_message', payload: { content: userMessage } })
+ return events
+ }
+
+ if (type === 'assistant.message') {
+ // `toolRequests` announces the calls, but `tool.execution_start` carries the same ids a moment
+ // later — opening rows from both would double every card.
+ const text = str(data.content).trim()
+ if (text) events.push({ type: 'text_delta', payload: { content: text } })
+ return events
+ }
+
+ if (type === 'tool.execution_start') {
+ const id = str(data.toolCallId)
+ if (!id) return events
+ const tool = copilotToolName(str(data.toolName))
+ state.openRows.set(id, tool)
+ events.push({ type: 'tool_start', payload: { id, tool, input: obj(data.arguments) ?? {} } })
+ return events
+ }
+
+ if (type === 'tool.execution_complete') {
+ const id = str(data.toolCallId)
+ const tool = state.openRows.get(id)
+ if (!id || !tool) return events
+ state.openRows.delete(id)
+ events.push({
+ type: 'tool_end',
+ payload: { id, tool, output: copilotToolOutput(data), isError: data.success === false, summary: '' },
+ })
+ return events
+ }
+
+ // assistant.turn_start / assistant.turn_end deliberately fall through: see the header. They mark
+ // model round-trips, and one user exchange contains several.
+ return events
+}
+
+export class CopilotNormalizer implements EngineNormalizer {
+ private state = newCopilotTurnState()
+
+ get turnOpen(): boolean { return this.state.open }
+
+ /** The `agentStop` hook fired: close every row this turn opened, then the turn. */
+ closeTurn(): LiveEvent[] {
+ if (!this.state.open) return []
+ const events: LiveEvent[] = []
+ closeRows(this.state, events, 'completed')
+ this.state.open = false
+ events.push({ type: 'turn_ended', payload: {} })
+ return events
+ }
+
+ abortTurn(): LiveEvent[] {
+ if (!this.state.open) return []
+ const events: LiveEvent[] = []
+ closeRows(this.state, events, 'failed')
+ this.state.open = false
+ events.push({ type: 'turn_ended', payload: { aborted: true } })
+ return events
+ }
+
+ ingest(line: string): LiveEvent[] {
+ const event = copilotEvent(line)
+ return event ? copilotEventToEvents(event, this.state, 'live') : []
+ }
+
+ finishReplay(): LiveEvent[] { return [] }
+}
+
+export function copilotMessagesToEvents(lines: string[]): SessionEvent[] {
+ const state = newCopilotTurnState()
+ const events: SessionEvent[] = []
+ for (const line of lines) {
+ const event = copilotEvent(line)
+ if (event) events.push(...copilotEventToEvents(event, state, 'replay') as SessionEvent[])
+ }
+ events.push({ type: 'done', payload: { result: 'success' } })
+ return events
+}
+
+export function lastCopilotTurnText(lines: string[]): LastTurnText | null {
+ let userMessage = ''
+ let assistantText = ''
+ for (const line of lines) {
+ const event = copilotEvent(line)
+ if (!event) continue
+ if (event.type === 'user.message') {
+ userMessage = copilotUserText(event.data)
+ assistantText = ''
+ } else if (event.type === 'assistant.message') {
+ const text = str(event.data.content).trim()
+ if (text) assistantText += `${assistantText ? '\n\n' : ''}${text}`
+ }
+ }
+ return assistantText ? { userMessage, assistantText } : null
+}
+
+/** The model Copilot resolved for this session — `session.model_change`, then each assistant message. */
+export function copilotSessionModel(lines: string[]): string | null {
+ let model = ''
+ for (const line of lines) {
+ const event = copilotEvent(line)
+ if (!event) continue
+ if (event.type === 'session.model_change') model = str(event.data.newModel) || model
+ // `auto` resolves to a concrete model per message; the concrete one is what the user is billed for.
+ if (event.type === 'assistant.message' && str(event.data.model)) model = str(event.data.model)
+ }
+ return model || null
+}
diff --git a/cli/src/engines/copilot/session.ts b/cli/src/engines/copilot/session.ts
new file mode 100644
index 000000000..bde875310
--- /dev/null
+++ b/cli/src/engines/copilot/session.ts
@@ -0,0 +1,69 @@
+import { readdir, stat } from 'fs/promises'
+import { join } from 'path'
+
+const SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
+
+/**
+ * `<COPILOT_HOME>/session-state/<sessionId>/events.jsonl`.
+ *
+ * Deterministic from the session id alone, and confirmed by Copilot itself: the `agentStop` hook
+ * reports this exact path in `transcriptPath`.
+ */
+export function copilotTranscriptPath(copilotHome: string, sessionId: string): string | null {
+ if (!SESSION_ID.test(sessionId)) return null
+ return join(copilotHome, 'session-state', sessionId, 'events.jsonl')
+}
+
+async function isFile(path: string): Promise<boolean> {
+ try { return (await stat(path)).isFile() } catch { return false }
+}
+
+export async function findCopilotTranscript(copilotHome: string, sessionId: string): Promise<string | null> {
+ const path = copilotTranscriptPath(copilotHome, sessionId)
+ return path && await isFile(path) ? path : null
+}
+
+export interface CopilotSessionFile {
+ sessionId: string
+ transcriptPath: string
+ mtimeMs: number
+ birthMs: number
+}
+
+/** Every session with an event stream on disk, newest write first. */
+export async function listCopilotSessions(copilotHome: string): Promise<CopilotSessionFile[]> {
+ const root = join(copilotHome, 'session-state')
+ const entries = await readdir(root, { withFileTypes: true }).catch(() => [])
+ const found: CopilotSessionFile[] = []
+ for (const entry of entries) {
+ if (!entry.isDirectory() || !SESSION_ID.test(entry.name)) continue
+ const transcriptPath = join(root, entry.name, 'events.jsonl')
+ const info = await stat(transcriptPath).catch(() => null)
+ if (!info?.isFile()) continue
+ found.push({
+ sessionId: entry.name,
+ transcriptPath,
+ mtimeMs: info.mtimeMs,
+ birthMs: info.birthtimeMs || info.ctimeMs,
+ })
+ }
+ return found.sort((a, b) => b.mtimeMs - a.mtimeMs)
+}
+
+/**
+ * The cwd a Copilot session was started in, read from its first record.
+ *
+ * `session.start` carries `data.context.cwd`. Sessions are named by uuid, not by directory, so this is
+ * the only link between a session file and the pane that owns it.
+ */
+export function copilotSessionCwd(firstLines: string[]): string | null {
+ for (const line of firstLines) {
+ try {
+ const record = JSON.parse(line) as { type?: unknown; data?: { context?: { cwd?: unknown } } }
+ if (record?.type !== 'session.start') continue
+ const cwd = record.data?.context?.cwd
+ return typeof cwd === 'string' && cwd ? cwd : null
+ } catch { /* a partial write mid-flush; the next poll sees the whole line */ }
+ }
+ return null
+}
diff --git a/cli/src/engines/types.ts b/cli/src/engines/types.ts
index 77ba079ba..6986b2baa 100644
--- a/cli/src/engines/types.ts
+++ b/cli/src/engines/types.ts
@@ -10,7 +10,7 @@ import type { RegisteredSession } from '../lib/registry.js'
*/
export const ENGINES = [
'claude', 'codex', 'cursor', 'opencode', 'pi', 'hermes',
- 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok', 'agy',
+ 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok', 'agy', 'copilot',
] as const
export type AgentEngine = (typeof ENGINES)[number]
diff --git a/cli/src/lib/__fixtures__/copilot-session.jsonl b/cli/src/lib/__fixtures__/copilot-session.jsonl
new file mode 100644
index 000000000..120524f6b
--- /dev/null
+++ b/cli/src/lib/__fixtures__/copilot-session.jsonl
@@ -0,0 +1,32 @@
+{"type": "session.start", "data": {"sessionId": "9cd340e2-8095-40f5-8d00-7ac1ab12b1ca", "version": 1, "producer": "copilot-agent", "copilotVersion": "1.0.80", "startTime": "2026-08-19T06:46:01.197Z", "contextTier": null, "context": {"cwd": "/private/tmp/copilot-e2e"}, "alreadyInUse": false, "remoteSteerable": false}, "id": "43f6ed74-faed-481c-a0a6-e6e559c47488", "timestamp": "2026-08-19T06:46:01.207Z", "parentId": null}
+{"type": "session.model_change", "data": {"contextTier": null, "newModel": "auto", "reasoningEffort": null}, "id": "ccc5990f-b29f-4051-8aa2-633cdf6b6a04", "timestamp": "2026-08-19T06:46:03.983Z", "parentId": "43f6ed74-faed-481c-a0a6-e6e559c47488"}
+{"type": "session.auto_mode_resolved", "data": {"chosenModel": "claude-haiku-4.5", "reasoningBucket": "low", "categoryScores": {"debugging": 0.0015, "tool_use": 0.0547, "code_gen": 0.0367, "reasoning": 0.0559}, "predictedLabel": "no_reasoning", "confidence": 0.94, "candidateModels": ["claude-haiku-4.5", "gpt-5-mini"], "routingMethod": "hydra", "availableModels": ["claude-haiku-4.5", "gpt-5-mini"], "fallback": false, "stickyOverride": false, "routerLatencyMs": 108, "endToEndLatencyMs": 580, "chosenShortfall": 0, "hasImage": false}, "id": "cbbb3c51-58c5-4436-bc20-6e117a00c4f1", "timestamp": "2026-08-19T06:46:04.998Z", "parentId": "6cd8ebdc-1e21-4106-820b-c0ad0fe1db4b"}
+{"type": "user.message", "data": {"content": "Run the shell command 'echo hello-copilot', then write a file named note.txt containing the word DONE, then say in one sentence what you did.", "transformedContent": "<current_datetime>2026-08-19T13:46:05.022+07:00</current_datetime>\n\nRun the shell command 'echo hello-copilot', then write a file named note.txt containing the word DONE, then say in one sentence what you did.\n\n<system_reminder>\n<sql_tables>Available tables: todos, todo_deps</sql_tables>\n</system_reminder>", "attachments": [], "supportedNativeDocumentMimeTypes": [], "delivery": "idle", "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c", "parentAgentTaskId": "eef7b950-82f5-4f1e-9841-b3551f7cb9d0"}, "id": "13d8db0a-97d1-4222-b414-019f02d45ab7", "timestamp": "2026-08-19T06:46:05.023Z", "parentId": "0da5f03f-4635-414a-9f5d-1a24508c42b5"}
+{"type": "assistant.turn_start", "data": {"turnId": "0", "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c"}, "id": "a99e4d7b-3115-4456-9811-84c05a5798af", "timestamp": "2026-08-19T06:46:05.086Z", "parentId": "e0742c80-fc87-4dee-bc2d-d6c3937d7789"}
+{"type": "assistant.message", "data": {"messageId": "34a6458a-d1f6-4c13-b406-f06b9a33b15f", "model": "claude-haiku-4.5", "content": "", "toolRequests": [{"toolCallId": "toolu_01UYQsbXdJpLD5oFpxw7B63r", "name": "bash", "arguments": {"command": "echo hello-copilot", "description": "Run echo hello-copilot command"}, "type": "function", "intentionSummary": "Run echo hello-copilot command"}, {"toolCallId": "toolu_01AGfJE7EYWqLPqrajXoMw82", "name": "create", "arguments": {"path": "/private/tmp/copilot-e2e/note.txt", "file_text": "DONE"}, "type": "function", "intentionSummary": "create a new file at /private/tmp/copilot-e2e/note.txt."}], "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c", "turnId": "0", "reasoningOpaque": "Ev8ECqgBCBAYAipAn+dVABCv7enCBICLgNzEae1VOSrhYguHJaKJptabBBzASb8a12i/EhHYADsY33F86GCCkrUD6BdxPzmSh0mDjTIZY2xhdWRlLWhhaWt1LTQtNS0yMDI1MTAwMTgAQgh0aGlua2luZ1okY2VkMWY5OGUtMGI1MS00NjEwLTgyODItNGU1ZDg4Mzg0NTc0chBD5rTzw1/mLzfqSETJcGLeiAEBEgzoNsXoDZ2CNy7ZWsoaDP1d7W5k/E/WkTZl3yIw7Vofnt56CHmJ6ckiPQYQo1CvW3O3EPsOqcTTXWjk2JmVejDQLGoR2KjjYIQjPVzwKoMDFEXzBo57jZBMpPi6WThKnM2rMk+k9nMPGe0wTimkkwdCrWUKAH/u6kJsyNqi7zRzz54NHyM0Owohsp5bG4u8AOZmMdhsnBxZJwhTm8ZJLZrBi2Znvd3vHu23wduQkiNI1SdzEaTljcWoYcwXehCWu83Dd0bJWGXjOZvFcDhhzNazHWWugGGLJ1KF4r8jD6+k7AYZs0gJxVzskkp3iJopULJXosqEani4yoNxNFjGp+nXN6XpGjPCsW36gNWfhxqmNhpPZZMKNe65mdGTvRIQFCRwsZhjsUzJG0DYiDghI8yvwuUKlbAOOTrvrnvbDxtm6aqJgPXoEC+NJP7dXb53GwAemy4k1GhxQk0dlwfCybbBTKj99RKXuRujdv9/cFL0iP4bBLNnFlp4RAuUY8/FVtHvky7RGDCLfjtGWmRwuD3FSdx9Y1u5iX7QFKpSKedu0/GVHzjYD074LPAK6hPsagZGukUHMAWAGM1ri9evbADxeqzRAXZd2Gc7clIH+F+naHicGAE=", "reasoningText": "The user wants me to:\n1. Run the shell command 'echo hello-copilot'\n2. Write a file named note.txt containing the word DONE\n3. Say in one sentence what I did\n\nI'll need to:\n1. Use bash tool to run the echo command\n2. Use create tool to write note.txt with \"DONE\"\n3. Provide a one-sentence summary\n\nLet me make these calls in parallel since they're independent operations.", "outputTokens": 261, "requestId": "F994:2F6F69:F32727:131E0ED:6A85512C", "clientRequestId": "00000-26ca0d5d-6929-4b45-b484-76e8fa62c4dc", "serviceRequestId": "f6e60c8f-8b0f-442e-ad28-32fcd20f5fb9", "rte": true, "apiCallId": "msg_011CeBf4szYKbxwdNYPVLRyT"}, "id": "c68e54c7-eadd-4c1d-80e6-35a0503886b7", "timestamp": "2026-08-19T06:46:08.957Z", "parentId": "a99e4d7b-3115-4456-9811-84c05a5798af"}
+{"type": "tool.execution_start", "data": {"toolCallId": "toolu_01UYQsbXdJpLD5oFpxw7B63r", "toolName": "bash", "arguments": {"command": "echo hello-copilot", "description": "Run echo hello-copilot command"}, "turnId": "0", "model": "claude-haiku-4.5", "rte": true, "shellToolInfo": {"possiblePaths": [], "hasWriteFileRedirection": false}}, "id": "ca42b141-5a45-4c94-a0c2-2c9afa604189", "timestamp": "2026-08-19T06:46:08.960Z", "parentId": "c68e54c7-eadd-4c1d-80e6-35a0503886b7"}
+{"type": "tool.execution_start", "data": {"toolCallId": "toolu_01AGfJE7EYWqLPqrajXoMw82", "toolName": "create", "arguments": {"path": "/private/tmp/copilot-e2e/note.txt", "file_text": "DONE"}, "turnId": "0", "model": "claude-haiku-4.5", "rte": true}, "id": "f1758600-75ae-45b3-b8f8-7102b4af5050", "timestamp": "2026-08-19T06:46:08.960Z", "parentId": "ca42b141-5a45-4c94-a0c2-2c9afa604189"}
+{"type": "tool.execution_complete", "data": {"toolCallId": "toolu_01AGfJE7EYWqLPqrajXoMw82", "model": "claude-haiku-4.5", "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c", "turnId": "0", "rte": true, "success": true, "result": {"content": "Created file /private/tmp/copilot-e2e/note.txt with 4 characters", "detailedContent": "\ndiff --git a/private/tmp/copilot-e2e/note.txt b/private/tmp/copilot-e2e/note.txt\ncreate file mode 100644\nindex 0000000..0000000\n--- a/dev/null\n+++ b/private/tmp/copilot-e2e/note.txt\n@@ -1,0 +1,1 @@\n+DONE\n"}, "toolTelemetry": {"properties": {"command": "create", "options": "{\"truncateBasedOn\":\"tokenCount\",\"truncateStyle\":\"middle\"}", "inputs": "[\"path\",\"file_text\",\"command\"]", "resolvedPathAgainstCwd": "false", "fileExtension": "[\".txt\"]", "codeBlocks": "[{\"fileExt\":\".txt\",\"languageId\":\"text\",\"linesAdded\":1,\"linesRemoved\":0}]", "languageId": "[\"text\"]"}, "metrics": {"resultLength": 64, "resultForLlmLength": 64, "responseTokenLimit": 32000, "linesAdded": 1, "linesRemoved": 0}, "restrictedProperties": {"filePaths": "[\"/private/tmp/copilot-e2e/note.txt\"]"}}}, "id": "db251571-4585-483d-99ad-e311e7528f24", "timestamp": "2026-08-19T06:46:09.037Z", "parentId": "bc9ad454-81e9-4752-8854-ed72de7fb4e4"}
+{"type": "tool.execution_complete", "data": {"toolCallId": "toolu_01UYQsbXdJpLD5oFpxw7B63r", "model": "claude-haiku-4.5", "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c", "turnId": "0", "rte": true, "success": true, "result": {"content": "hello-copilot\n<shellId: 0 completed with exit code 0>", "detailedContent": "hello-copilot\n<shellId: 0 completed with exit code 0>"}, "toolTelemetry": {"properties": {"customTimeout": "false", "executionMode": "sync", "detached": "false", "sandboxApplied": "false", "sandboxOptOutRequested": "false", "asyncOnlyShell": "false"}, "metrics": {"commandTimeout": 30000}}}, "id": "80bcb7d7-9a24-4056-86f1-6f9b7b5f6399", "timestamp": "2026-08-19T06:46:09.071Z", "parentId": "b6389343-9495-4eb4-9fe2-efcf72e2b90d"}
+{"type": "assistant.turn_end", "data": {"turnId": "0"}, "id": "93fc993e-8bae-4cd6-9fa6-9f1c04bd028f", "timestamp": "2026-08-19T06:46:09.092Z", "parentId": "80bcb7d7-9a24-4056-86f1-6f9b7b5f6399"}
+{"type": "assistant.turn_start", "data": {"turnId": "1", "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c"}, "id": "9ec038d9-dc04-47ad-a7c7-4639d8d6cde7", "timestamp": "2026-08-19T06:46:09.093Z", "parentId": "93fc993e-8bae-4cd6-9fa6-9f1c04bd028f"}
+{"type": "assistant.message", "data": {"messageId": "6493e3e1-fd77-401b-afe9-3616028d88f0", "model": "claude-haiku-4.5", "content": "I ran the echo command that output \"hello-copilot\" and created a note.txt file containing \"DONE\" in the current directory.", "toolRequests": [], "interactionId": "af221c61-dd04-4722-a66e-a0fb6986f74c", "turnId": "1", "reasoningOpaque": "Ev8ECqgBCBAYAipAn+dVABCv7enCBICLgNzEae1VOSrhYguHJaKJptabBBzASb8a12i/EhHYADsY33F86GCCkrUD6BdxPzmSh0mDjTIZY2xhdWRlLWhhaWt1LTQtNS0yMDI1MTAwMTgAQgh0aGlua2luZ1okY2VkMWY5OGUtMGI1MS00NjEwLTgyODItNGU1ZDg4Mzg0NTc0chBD5rTzw1/mLzfqSETJcGLeiAEBEgzoNsXoDZ2CNy7ZWsoaDP1d7W5k/E/WkTZl3yIw7Vofnt56CHmJ6ckiPQYQo1CvW3O3EPsOqcTTXWjk2JmVejDQLGoR2KjjYIQjPVzwKoMDFEXzBo57jZBMpPi6WThKnM2rMk+k9nMPGe0wTimkkwdCrWUKAH/u6kJsyNqi7zRzz54NHyM0Owohsp5bG4u8AOZmMdhsnBxZJwhTm8ZJLZrBi2Znvd3vHu23wduQkiNI1SdzEaTljcWoYcwXehCWu83Dd0bJWGXjOZvFcDhhzNazHWWugGGLJ1KF4r8jD6+k7AYZs0gJxVzskkp3iJopULJXosqEani4yoNxNFjGp+nXN6XpGjPCsW36gNWfhxqmNhpPZZMKNe65mdGTvRIQFCRwsZhjsUzJG0DYiDghI8yvwuUKlbAOOTrvrnvbDxtm6aqJgPXoEC+NJP7dXb53GwAemy4k1GhxQk0dlwfCybbBTKj99RKXuRujdv9/cFL0iP4bBLNnFlp4RAuUY8/FVtHvky7RGDCLfjtGWmRwuD3FSdx9Y1u5iX7QFKpSKedu0/GVHzjYD074LPAK6hPsagZGukUHMAWAGM1ri9evbADxeqzRAXZd2Gc7clIH+F+naHicGAE=", "reasoningText": "The user wants me to:\n1. Run the shell command 'echo hello-copilot'\n2. Write a file named note.txt containing the word DONE\n3. Say in one sentence what I did\n\nI'll need to:\n1. Use bash tool to run the echo command\n2. Use create tool to write note.txt with \"DONE\"\n3. Provide a one-sentence summary\n\nLet me make these calls in parallel since they're independent operations.", "outputTokens": 34, "requestId": "F994:2F6F69:F33242:131EE5D:6A855130", "clientRequestId": "00000-aeb8c3e2-f279-4680-a0b2-7d2786a800ed", "serviceRequestId": "441c1b4b-d4b4-48fc-9b40-32404107ba41", "rte": true, "apiCallId": "msg_011CeBf5Au36CTKRU9eSSJum"}, "id": "759aa7fa-0700-4484-b8ac-95f5fd4ec72d", "timestamp": "2026-08-19T06:46:11.009Z", "parentId": "9ec038d9-dc04-47ad-a7c7-4639d8d6cde7"}
+{"type": "assistant.turn_end", "data": {"turnId": "1"}, "id": "22d538cd-7b41-47dc-bfdf-de9131e5c22f", "timestamp": "2026-08-19T06:46:11.012Z", "parentId": "759aa7fa-0700-4484-b8ac-95f5fd4ec72d"}
+{"type": "session.usage_checkpoint", "data": {"totalNanoAiu": 2491645000, "totalPremiumRequests": 0.33, "modelCacheState": [{"modelId": "claude-haiku-4.5", "cacheExpiresAt": "2026-08-19T06:51:09.104Z", "cacheTtlSeconds": 300}]}, "id": "74775bf0-63d9-4c57-8dd1-3fd51b78a135", "timestamp": "2026-08-19T06:46:11.102Z", "parentId": "edc2c699-43b0-49de-86d8-99b86524a75b"}
+{"type": "session.shutdown", "data": {"shutdownType": "routine", "totalPremiumRequests": 0.33, "totalNanoAiu": 2491645000, "tokenDetails": {"input": {"tokenCount": 63}, "cache_read": {"tokenCount": 17022}, "cache_write": {"tokenCount": 17341}, "output": {"tokenCount": 295}}, "totalApiDurationMs": 5756, "sessionStartTime": 1787121961197, "eventsFileSizeBytes": 43996, "codeChanges": {"linesAdded": 1, "linesRemoved": 0, "filesModified": ["/private/tmp/copilot-e2e/note.txt"]}, "modelMetrics": {"claude-haiku-4.5": {"requests": {"count": 2, "cost": 0.33}, "usage": {"inputTokens": 34426, "outputTokens": 295, "cacheReadTokens": 17022, "cacheWriteTokens": 17341, "reasoningTokens": 109}, "totalNanoAiu": 2491645000, "tokenDetails": {"input": {"tokenCount": 63}, "cache_read": {"tokenCount": 17022}, "cache_write": {"tokenCount": 17341}, "output": {"tokenCount": 295}}}}, "currentModel": "claude-haiku-4.5", "currentTokens": 14873, "systemTokens": 5852, "conversationTokens": 678, "toolDefinitionsTokens": 8340}, "id": "91622ab9-dcc7-4c40-83d4-a80548e6ead1", "timestamp": "2026-08-19T06:46:11.125Z", "parentId": "74775bf0-63d9-4c57-8dd1-3fd51b78a135"}
+{"type": "session.start", "data": {"sessionId": "a3f16b25-147c-4605-be42-4b5ac2a48d36", "version": 1, "producer": "copilot-agent", "copilotVersion": "1.0.80", "startTime": "2026-08-19T06:47:05.482Z", "contextTier": null, "context": {"cwd": "/private/tmp/copilot-e2e"}, "alreadyInUse": false, "remoteSteerable": false}, "id": "fd1d0433-4069-4350-b13f-35a277150bcb", "timestamp": "2026-08-19T06:47:05.501Z", "parentId": null}
+{"type": "session.model_change", "data": {"contextTier": null, "newModel": "auto", "reasoningEffort": null}, "id": "61653be2-d6f1-44f6-8a79-91bd4458f83d", "timestamp": "2026-08-19T06:47:08.798Z", "parentId": "fd1d0433-4069-4350-b13f-35a277150bcb"}
+{"type": "session.auto_mode_resolved", "data": {"chosenModel": "gpt-5-mini", "reasoningBucket": "low", "categoryScores": {"code_gen": 0.0234, "debugging": 0.0013, "reasoning": 0.1131, "tool_use": 0.1027}, "predictedLabel": "no_reasoning", "confidence": 0.89, "candidateModels": ["gpt-5-mini", "claude-haiku-4.5"], "routingMethod": "hydra", "availableModels": ["claude-haiku-4.5", "gpt-5-mini"], "fallback": false, "stickyOverride": false, "routerLatencyMs": 65, "endToEndLatencyMs": 392, "chosenShortfall": 0.0891, "hasImage": false}, "id": "7532b9a9-d389-44bc-b7a2-8aaed2a312b3", "timestamp": "2026-08-19T06:47:09.640Z", "parentId": "c1a588db-3b65-49de-a0b3-d5fd4c3aa477"}
+{"type": "user.message", "data": {"content": "Make a todo list with 3 items for tidying this folder using your todo tool, then read note.txt and tell me what it says.", "transformedContent": "<current_datetime>2026-08-19T13:47:09.671+07:00</current_datetime>\n\nMake a todo list with 3 items for tidying this folder using your todo tool, then read note.txt and tell me what it says.\n\n<system_reminder>\n<sql_tables>Available tables: todos, todo_deps</sql_tables>\n</system_reminder>", "attachments": [], "supportedNativeDocumentMimeTypes": [], "delivery": "idle", "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2", "parentAgentTaskId": "414c623c-7bef-48e6-9d43-8a849f8e47b8"}, "id": "f97898dc-a08e-4da7-9907-82af32260f6f", "timestamp": "2026-08-19T06:47:09.672Z", "parentId": "4caa9ae4-48f5-4701-aafe-02527a049d13"}
+{"type": "assistant.turn_start", "data": {"turnId": "0", "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2"}, "id": "33ae838c-2c09-40ce-b023-67b5575cbcc5", "timestamp": "2026-08-19T06:47:09.735Z", "parentId": "92813f67-dc76-4ff5-b723-109e6765aad8"}
+{"type": "assistant.message", "data": {"messageId": "ac87e686-f0fa-4b32-87a8-44e864408eb5", "model": "gpt-5-mini", "content": "Inserting three tidy todos into the session todo DB and reading /private/tmp/copilot-e2e/note.txt to report its contents. Running both operations in parallel.", "toolRequests": [{"toolCallId": "call_Z5hNVVIyBp2SXAwsjQOCFD3w", "name": "sql", "arguments": {"description": "Add three tidy todos", "query": "INSERT INTO todos (id, title, description, status) VALUES\n('tidy-1', 'Sort files', 'Move files into src/, docs/, and assets/ as appropriate; remove temporary and duplicate files.', 'pending'),\n('tidy-2', 'Clean tmp files', 'Find and delete *.tmp, .DS_Store, and build artefacts not under version control.', 'pending'),\n('tidy-3', 'Organize notes', 'Consolidate loose notes into notes/ directory and archive obsolete notes.', 'pending');"}, "type": "function", "intentionSummary": "Add three tidy todos"}, {"toolCallId": "call_2Q0rgOTyxV185YBdksodgdPg", "name": "view", "arguments": {"path": "/private/tmp/copilot-e2e/note.txt"}, "type": "function", "intentionSummary": "view the file at /private/tmp/copilot-e2e/note.txt."}], "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2", "turnId": "0", "reasoningOpaque": "VZh7t0hcYJMQG38L7pysxCMXVZ4ojUAKgNcNiVrYnzmL5dlUGyPKLxyos4xc205dcUj7ZCNAPIpmerKtXyVmxhN6qw6A6kUDwWdGCijuko1bhajfKyzho1pLr9Mo5OHrX0yRFypofTWLSDuOhV1G8xWUFCkvWeTYoQkgGoS/5LwfcL1anG7LtI1Q8EV+Xzgr4Q+tRuujN1tywRoL554/j/w1y+f7Fb5chU0UVLtsqZhri+Y2znyshApDbob4J3atW7gXSXY7h54CgXL0oc8z1R2tAHe1oiuYaYopyhhkmVlqyFbQek5CHdMvXqpKSOA77BKOVOPWj0z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f3v8jrSzZIP9yKmRoqj9RtPNXm8Vyr7c6xZHtPZVDKQjwNK8FWt9Li9HcGRA8pUerjrSgUnXxS1ri2fDC0uCNxsRW3AN8R4CMIng5pfPP3IB8GLdRBrnlAWCpW7FB/HeBbCf+ksEkopRVFYMPz8Xk95f5MuwHlGjyeF+r1Sus5DHiu/5SUpUScX5FwWjY7mufTYy9pT6mf2XiELuCqjrBOb2gIAdz/7vtZgdJEAa6mjE9aIjdhtTsHrIeH7hhMkETmj8Vvj2I1yKdpc2IpUXSprdYuK4k3kxm9nrnGap6VzJo2HoIaN3RZmaCiMnvOws/jLsA7lOHQoXqH/DBA+mJOWk2Wy0DZUJMOVH+1blz3j7f0nLAgXfipwMqxBxtj1U1YdB29VUDRzxcJkjJ6YBkWs1940U+iBIxBqgPy/Ewr+NBUyykSboJuvOkI/0qVxoM3w==", "chunkIndex": 0, "chunkCount": 1, "outputTokens": 1069, "requestId": "F9A3:217A26:1793468:1B3FA31:6A85516D", "clientRequestId": "00000-3ef70799-43b0-4fc2-831e-f68ab616d210", "serviceRequestId": "49095596-3b8d-47b9-bf1e-98b912110752", "rte": true, "apiCallId": "2J3YUCH8akXTYTZSmbSckaYgvMSLvbsjD5usp5juvTLEMXF6YOKJ1SwU+7/1mFKgBOck0EQQhvhuoLi8m5w+9pGzXYT3jsWKp2a8laqq4KmRwOolYUraucwoXX8HceqxltMOjvXVIqdeobBfAMy6x05tt8fKfTB4LaO8xnx4/L3bomZoGI4Pe7TaoN8m6XhdRkNUt9lSxKcdS/AzGmKh1lcp/by+ugUt1r1szCrL7+vXwc2eIQKUIkKF4l95ubcnoo0+p+QTVBgXt6QXfoqS8PKGxctpY2nXPHYcrPFlzbpZ0X3WckuJaxu4mpSK24xOZtQZLZGpSpFrO6fzowgpdG4sQYAU72zLDz/VpHNh5HGH6nsRbttqCNcMhql3tU4j1psIH/5FKUjvJzFRm3DupiJfPgpPUICrSVtI60Yx56LODPd5KA=="}, "id": "2e3059c4-0e4a-41ea-9262-edda62de2a70", "timestamp": "2026-08-19T06:47:22.767Z", "parentId": "33ae838c-2c09-40ce-b023-67b5575cbcc5"}
+{"type": "tool.execution_start", "data": {"toolCallId": "call_Z5hNVVIyBp2SXAwsjQOCFD3w", "toolName": "sql", "arguments": {"description": "Add three tidy todos", "query": "INSERT INTO todos (id, title, description, status) VALUES\n('tidy-1', 'Sort files', 'Move files into src/, docs/, and assets/ as appropriate; remove temporary and duplicate files.', 'pending'),\n('tidy-2', 'Clean tmp files', 'Find and delete *.tmp, .DS_Store, and build artefacts not under version control.', 'pending'),\n('tidy-3', 'Organize notes', 'Consolidate loose notes into notes/ directory and archive obsolete notes.', 'pending');"}, "turnId": "0", "model": "gpt-5-mini", "rte": true}, "id": "2f0888db-7114-421e-bcea-638dcc22b0a1", "timestamp": "2026-08-19T06:47:22.770Z", "parentId": "2e3059c4-0e4a-41ea-9262-edda62de2a70"}
+{"type": "tool.execution_start", "data": {"toolCallId": "call_2Q0rgOTyxV185YBdksodgdPg", "toolName": "view", "arguments": {"path": "/private/tmp/copilot-e2e/note.txt"}, "turnId": "0", "model": "gpt-5-mini", "rte": true}, "id": "915639c8-7fc7-4559-8ac9-9a12e87a0295", "timestamp": "2026-08-19T06:47:22.771Z", "parentId": "2f0888db-7114-421e-bcea-638dcc22b0a1"}
+{"type": "tool.execution_complete", "data": {"toolCallId": "call_2Q0rgOTyxV185YBdksodgdPg", "model": "gpt-5-mini", "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2", "turnId": "0", "rte": true, "success": true, "result": {"content": "1. DONE", "detailedContent": "\ndiff --git a/private/tmp/copilot-e2e/note.txt b/private/tmp/copilot-e2e/note.txt\nindex 0000000..0000000 100644\n--- a/private/tmp/copilot-e2e/note.txt\n+++ b/private/tmp/copilot-e2e/note.txt\n@@ -1,1 +1,1 @@\n DONE\n"}, "toolTelemetry": {"properties": {"command": "view", "options": "{\"truncateBasedOn\":\"tokenCount\",\"truncateStyle\":\"middle\"}", "inputs": "[\"path\",\"command\"]", "resolvedPathAgainstCwd": "false", "fileExtension": "[\".txt\"]", "viewType": "file"}, "metrics": {"resultLength": 7, "resultForLlmLength": 7, "responseTokenLimit": 32000}, "restrictedProperties": {}}}, "id": "635d5bbe-d6c5-460c-ba10-2754f264d9fa", "timestamp": "2026-08-19T06:47:22.844Z", "parentId": "4f99862b-2da4-4ffa-86fb-fe1785a44eb8"}
+{"type": "tool.execution_complete", "data": {"toolCallId": "call_Z5hNVVIyBp2SXAwsjQOCFD3w", "model": "gpt-5-mini", "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2", "turnId": "0", "rte": true, "success": true, "result": {"content": "3 row(s) inserted. Last inserted row ID: 3.", "detailedContent": "SQL: INSERT INTO todos (id, title, description, status) VALUES\n('tidy-1', 'Sort files', 'Move files into src/, docs/, and assets/ as appropriate; remove temporary and duplicate files.', 'pending'),\n('tidy-2', 'Clean tmp files', 'Find and delete *.tmp, .DS_Store, and build artefacts not under version control.', 'pending'),\n('tidy-3', 'Organize notes', 'Consolidate loose notes into notes/ directory and archive obsolete notes.', 'pending');\n\n3 row(s) inserted. Last inserted row ID: 3."}, "toolTelemetry": {"properties": {"queryType": "INSERT"}, "restrictedProperties": {"query": "INSERT INTO todos (id, title, description, status) VALUES\n('tidy-1', 'Sort files', 'Move files into src/, docs/, and assets/ as appropriate; remove temporary and duplicate files.', 'pending'),\n('tidy-2', 'Clean tmp files', 'Find and delete *.tmp, .DS_Store, and build artefacts not under version control.', 'pending'),\n('tidy-3', 'Organize notes', 'Consolidate loose notes into notes/ directory and archive obsolete notes.', 'pending');"}, "metrics": {"rowsAffected": 3, "rowsReturned": 0}}}, "id": "c4cca441-81a4-4b72-847d-0eb2317a5215", "timestamp": "2026-08-19T06:47:22.881Z", "parentId": "73b278f3-641b-45a6-84c9-3c2af96cb93e"}
+{"type": "assistant.turn_end", "data": {"turnId": "0"}, "id": "2bfe8de7-94af-46d7-b1f3-c871370f4378", "timestamp": "2026-08-19T06:47:22.896Z", "parentId": "c4cca441-81a4-4b72-847d-0eb2317a5215"}
+{"type": "assistant.turn_start", "data": {"turnId": "1", "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2"}, "id": "8aefee33-4255-4196-957c-be3fadf343e8", "timestamp": "2026-08-19T06:47:22.897Z", "parentId": "2bfe8de7-94af-46d7-b1f3-c871370f4378"}
+{"type": "assistant.message", "data": {"messageId": "108edab8-8a15-4bf2-97ec-b6bf4204853d", "model": "gpt-5-mini", "content": "Todos added:\n- tidy-1: Sort files (pending)\n- tidy-2: Clean tmp files (pending)\n- tidy-3: Organize notes (pending)\n\nContents of note.txt:\n\"1. DONE\"", "toolRequests": [], "interactionId": "c80b89c5-b120-4f2f-8234-f9b1db177be2", "turnId": "1", "outputTokens": 49, "requestId": "F9A3:217A26:1797289:1B43F78:6A85517A", "clientRequestId": "00000-5426d6bb-de0e-40c3-8ffc-dfd56c96f00b", "serviceRequestId": "ed631652-642c-443a-9061-6312e8741443", "rte": true, "apiCallId": "OLFA12RxlQA/bYmeAAjbAeEo47gu5Xw0Y6+083k0pZU8x33Nr/+wcXLYT1xfWklPvqHqMLMlQzLkjgsl5uRmEED5IJ3btLO7WGJaf2gJ8jb57Pjk1Bt1Z82y7vo5kcmAkngejeTO1yzyGALvq4bgEfs6xKuxk26f5r6modKaJ3T0jPnWABmh5VssrUPD30oCCeRQ0elyXfpZQkNCjg9nJERan5KYRkHhr1VG/Fj6C9hifI8q/Y2dXeNYlW3N2QWZFctjGbnq8ITRxpSL/Cq4zeEvPVnILbk3udRaRoy3nLJtDaM+A3pwF0pu7lDdjz0EUGDvMiLa672nBLLNsCV+RI+cE8iXPUQlHzfw3Cykd6B5XOLwVgrqRcazZdGQ2x0w9KA+gZDNOWy2fkpipHbRIiH2QtubYj3j9xaElXgV+XVg4GUOUg=="}, "id": "a05d77ed-c289-40c9-8217-fdd16b2e36c3", "timestamp": "2026-08-19T06:47:25.404Z", "parentId": "8aefee33-4255-4196-957c-be3fadf343e8"}
+{"type": "assistant.turn_end", "data": {"turnId": "1"}, "id": "9c475e85-bbda-4f26-80c1-9e5c99c71de3", "timestamp": "2026-08-19T06:47:25.406Z", "parentId": "a05d77ed-c289-40c9-8217-fdd16b2e36c3"}
+{"type": "session.usage_checkpoint", "data": {"totalNanoAiu": 310385000, "totalPremiumRequests": 0, "modelCacheState": [{"modelId": "gpt-5-mini", "cacheExpiresAt": "2026-08-19T07:17:22.906Z", "cacheTtlSeconds": 1800}]}, "id": "5ba78fe0-dd8b-466c-9070-8c355e0b8683", "timestamp": "2026-08-19T06:47:25.504Z", "parentId": "3b97cebd-160f-4535-bbaa-0499209f97a5"}
+{"type": "session.shutdown", "data": {"shutdownType": "routine", "totalPremiumRequests": 0, "totalNanoAiu": 310385000, "tokenDetails": {"input": {"tokenCount": 809}, "cache_read": {"tokenCount": 26624}, "cache_write": {"tokenCount": 0}, "output": {"tokenCount": 1118}}, "totalApiDurationMs": 15505, "sessionStartTime": 1787122025482, "eventsFileSizeBytes": 58895, "codeChanges": {"linesAdded": 0, "linesRemoved": 0, "filesModified": []}, "modelMetrics": {"gpt-5-mini": {"requests": {"count": 2, "cost": 0}, "usage": {"inputTokens": 27433, "outputTokens": 1118, "cacheReadTokens": 26624, "cacheWriteTokens": 0, "reasoningTokens": 832}, "totalNanoAiu": 310385000, "tokenDetails": {"input": {"tokenCount": 809}, "cache_read": {"tokenCount": 26624}, "cache_write": {"tokenCount": 0}, "output": {"tokenCount": 1118}}}}, "currentModel": "gpt-5-mini", "currentTokens": 14585, "systemTokens": 5806, "conversationTokens": 436, "toolDefinitionsTokens": 8340}, "id": "9517fef2-05ab-4b1b-ae98-11a911bb685c", "timestamp": "2026-08-19T06:47:25.529Z", "parentId": "5ba78fe0-dd8b-466c-9070-8c355e0b8683"}
diff --git a/cli/src/lib/analytics/contract.ts b/cli/src/lib/analytics/contract.ts
index 1d6521622..4a7b8866f 100644
--- a/cli/src/lib/analytics/contract.ts
+++ b/cli/src/lib/analytics/contract.ts
@@ -18,7 +18,7 @@ export const ANALYTICS_SCHEMA_VERSION = 1
export const ENGINES = [
'claude', 'codex', 'cursor', 'opencode', 'pi', 'hermes',
- 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok', 'agy',
+ 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok', 'agy', 'copilot',
] as const
export type Engine = (typeof ENGINES)[number]
diff --git a/cli/src/lib/askQuestion.ts b/cli/src/lib/askQuestion.ts
index 27aed5115..4c3542548 100644
--- a/cli/src/lib/askQuestion.ts
+++ b/cli/src/lib/askQuestion.ts
@@ -719,7 +719,7 @@ const POLL_MS = 1500
// cancel` footer, which is the shared parser's anchor exactly (`__fixtures__/permission-codex.txt`), and
// the question it lands on is the command itself. Membership in this set is what starts the poll, so an
// engine belongs here only once something can actually read its pane.
-const QUESTION_ENGINES = new Set<AgentEngine>(['claude', 'commandcode', 'codex', 'cursor', 'devin', 'hermes', 'opencode', 'muse', 'amp', 'kilo', 'grok', 'agy'])
+const QUESTION_ENGINES = new Set<AgentEngine>(['claude', 'commandcode', 'codex', 'cursor', 'devin', 'hermes', 'opencode', 'muse', 'amp', 'kilo', 'grok', 'agy', 'copilot'])
/** Does this engine ever paint a question dialog? Callers use it to decide whether to watch its pane. */
export function pollsQuestions(engine: AgentEngine): boolean {
diff --git a/cli/src/lib/engineBin.spec.ts b/cli/src/lib/engineBin.spec.ts
index 89faceb87..9576e9ef8 100644
--- a/cli/src/lib/engineBin.spec.ts
+++ b/cli/src/lib/engineBin.spec.ts
@@ -20,7 +20,7 @@ afterEach(() => {
})
describe('canonical engine CLI commands', () => {
- it('keeps the user-facing 13-engine command contract exact and ordered', () => {
+ it('keeps the user-facing 14-engine command contract exact and ordered', () => {
expect(ENGINES.map((engine) => [engine, ENGINE_CLI_COMMANDS[engine]])).toEqual([
['claude', 'claude'],
['codex', 'codex'],
@@ -35,6 +35,7 @@ describe('canonical engine CLI commands', () => {
['kilo', 'kilo'],
['grok', 'grok'],
['agy', 'agy'],
+ ['copilot', 'copilot'],
])
})
diff --git a/cli/src/lib/engineBin.ts b/cli/src/lib/engineBin.ts
index 1030aab56..43d79bb68 100644
--- a/cli/src/lib/engineBin.ts
+++ b/cli/src/lib/engineBin.ts
@@ -13,7 +13,7 @@ import type { AgentEngine } from '../engines/types.js'
/** Every engine the adapter can discover and drive. */
export const ENGINES: readonly AgentEngine[] = [
'claude', 'codex', 'cursor', 'opencode', 'pi', 'hermes', 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok',
- 'agy',
+ 'agy', 'copilot',
] as const
/** Public vendor command shown to users and matched by the real-binary smoke matrix. */
@@ -31,6 +31,7 @@ export const ENGINE_CLI_COMMANDS: Readonly<Record<AgentEngine, string>> = {
kilo: 'kilo',
grok: 'grok',
agy: 'agy',
+ copilot: 'copilot',
}
export interface ExecutableFileIdentity {
@@ -215,6 +216,7 @@ export function enginePathOverride(engine: AgentEngine): string | undefined {
case 'kilo': return env.KILO_PATH
case 'grok': return env.GROK_PATH
case 'agy': return env.AGY_PATH
+ case 'copilot': return env.COPILOT_PATH
}
}
@@ -235,5 +237,6 @@ export function engineBin(engine: AgentEngine): string {
case 'kilo': return env.KILO_PATH || ENGINE_CLI_COMMANDS.kilo
case 'grok': return env.GROK_PATH || ENGINE_CLI_COMMANDS.grok
case 'agy': return env.AGY_PATH || ENGINE_CLI_COMMANDS.agy
+ case 'copilot': return env.COPILOT_PATH || ENGINE_CLI_COMMANDS.copilot
}
}
diff --git a/cli/src/lib/hooks.ts b/cli/src/lib/hooks.ts
index eae84a72e..625fbb5c6 100644
--- a/cli/src/lib/hooks.ts
+++ b/cli/src/lib/hooks.ts
@@ -20,6 +20,9 @@ const CURSOR_HOOKS_PATH = join(process.env.CURSOR_HOME || join(homedir(), '.curs
// the CLI's changelog records the move, "ensuring hooks remain synchronized between the TUI and the
// backend". Verified live: a hooks.json placed there fires for `agy` in a pane.
const AGY_HOOKS_PATH = join(env.AGY_CONFIG_DIR, 'hooks.json')
+// Copilot reads every *.json in this directory, so Harness gets its own file and never edits the
+// user's. Measured: a file dropped here fires without any further opt-in.
+const COPILOT_HOOKS_PATH = join(env.COPILOT_HOME, 'hooks', 'harness.json')
// notify.mjs location depends on the layout (import.meta.url is the REAL executing file at runtime):
// - packaged/bundled: cli.js at ~/.harness/cli/cli.js → notify.mjs is a SIBLING (dist/ bundle too).
@@ -53,7 +56,7 @@ function shellQuote(value: string): string {
return `'${value.replace(/'/g, `'\\''`)}'`
}
-function command(port: number, engine: 'claude' | 'codex' | 'cursor' | 'hermes' | 'commandcode' | 'devin' | 'grok' | 'agy'): string {
+function command(port: number, engine: 'claude' | 'codex' | 'cursor' | 'hermes' | 'commandcode' | 'devin' | 'grok' | 'agy' | 'copilot'): string {
return [
'node',
shellQuote(HOOK_SCRIPT),
@@ -67,6 +70,7 @@ function command(port: number, engine: 'claude' | 'codex' | 'cursor' | 'hermes'
'--commandcode-home', shellQuote(env.COMMANDCODE_HOME),
'--devin-home', shellQuote(env.DEVIN_HOME),
'--agy-home', shellQuote(env.AGY_HOME),
+ '--copilot-home', shellQuote(env.COPILOT_HOME),
...(engine !== 'claude' ? ['--engine', engine] : []),
].join(' ')
}
@@ -275,6 +279,53 @@ export function installAgyHooks(port: number): void {
}
}
+/**
+ * Copilot's user-level hooks: a directory of JSON files, each `{version, hooks: {<event>: [handler]}}`.
+ *
+ * Four events, and the omissions are deliberate:
+ *
+ * - `preToolUse` is NOT installed. Its exit-code contract is fail-CLOSED — the docs are explicit that
+ * a non-zero exit denies the tool, while every other event fails open. A crashing hook would stop
+ * the user's agent from running anything. Tool cards come off the transcript instead, which costs
+ * nothing.
+ * - `postToolUse` is not installed either: the same rows are already in `events.jsonl`, so posting
+ * them would only duplicate work on every tool call.
+ *
+ * `agentStop` is the turn boundary and the one event that names the transcript
+ * (`transcriptPath: <COPILOT_HOME>/session-state/<id>/events.jsonl`).
+ */
+type CopilotHookFile = { version: number; hooks: Record<string, Array<{ type: string; command: string }>> }
+
+export function installCopilotHooks(port: number): void {
+ const cmd = command(port, 'copilot')
+ const handler = (event: string): { type: string; command: string } => ({ type: 'command', command: `${cmd} --copilot-event ${event}` })
+ const file: CopilotHookFile = {
+ version: 1,
+ hooks: {
+ sessionStart: [handler('sessionStart')],
+ userPromptSubmitted: [handler('userPromptSubmitted')],
+ agentStop: [handler('agentStop')],
+ sessionEnd: [handler('sessionEnd')],
+ },
+ }
+
+ let existing: unknown = null
+ if (existsSync(COPILOT_HOOKS_PATH)) {
+ try { existing = JSON.parse(readFileSync(COPILOT_HOOKS_PATH, 'utf-8')) } catch { existing = null }
+ }
+ if (JSON.stringify(existing) === JSON.stringify(file)) {
+ console.log('[hooks] Copilot lifecycle hooks already installed')
+ return
+ }
+ try {
+ writeJsonAtomic(COPILOT_HOOKS_PATH, file)
+ console.log(`[hooks] installed Copilot lifecycle hooks → ${COPILOT_HOOKS_PATH}`)
+ console.log('[hooks] (takes effect on the next copilot session start)')
+ } catch (err) {
+ console.error('[hooks] failed to write Copilot hook file:', err)
+ }
+}
+
interface CursorHook {
command: string
failClosed?: boolean
diff --git a/cli/src/lib/oneshot.ts b/cli/src/lib/oneshot.ts
index e65bafb15..885cea625 100644
--- a/cli/src/lib/oneshot.ts
+++ b/cli/src/lib/oneshot.ts
@@ -1201,6 +1201,97 @@ export async function runAgyOneShot(opts: OneShotOptions): Promise<OneShotResult
}
}
+/**
+ * The measured Copilot CLI 1.0.80 headless invocation.
+ *
+ * Three things settled by running it:
+ *
+ * - **`--no-color` makes stdout the answer and nothing else.** The "Changes / AI Credits / Tokens /
+ * Resume" block goes to stderr, so the recap needs no parsing at all — 12 bytes of stdout for a
+ * 12-byte reply.
+ * - **`--available-tools` with no values leaves the model no tools.** `-p` demands
+ * `--allow-all-tools`, which on its own would let a recap run shell commands; pairing the two gives
+ * a run that can answer but cannot touch anything.
+ * - **`--session-id` accepts a UUID we choose for a NEW session**, so the state this leaves behind is
+ * known before it exists and can be removed by name rather than by scraping stderr.
+ */
+export function copilotOneShotSpawn(
+ opts: Pick<OneShotOptions, 'prompt' | 'model'>,
+ sessionId: string,
+ parentEnv: NodeJS.ProcessEnv = process.env,
+): { args: string[]; env: NodeJS.ProcessEnv } {
+ const args = [
+ '-p', opts.prompt,
+ '--allow-all-tools',
+ '--available-tools',
+ '--no-color',
+ '--session-id', sessionId,
+ ...(opts.model ? ['--model', opts.model] : []),
+ ]
+ const childEnv = scrubTerminalContext({ ...parentEnv })
+ delete childEnv.MACHINE_ID
+ return { args, env: childEnv }
+}
+
+/**
+ * Remove the session a recap created.
+ *
+ * The event stream lives in a directory named by the id, so it goes cleanly. The row Copilot also
+ * writes into `session-store.db` is deliberately left alone: that database belongs to the user's
+ * running CLI, and deleting from it to tidy a recap is not worth writing into a live vendor store.
+ * The cost is an unnamed entry in `copilot --resume`.
+ */
+async function removeCopilotSession(sessionId: string): Promise<void> {
+ if (!/^[0-9a-f-]{16,}$/i.test(sessionId)) return
+ await rm(join(env.COPILOT_HOME, 'session-state', sessionId), { recursive: true, force: true }).catch(() => {})
+}
+
+export async function runCopilotOneShot(opts: OneShotOptions): Promise<OneShotResult> {
+ if (opts.signal?.aborted) throw Object.assign(new Error('copilot one-shot aborted'), { name: 'AbortError' })
+ const sessionId = randomUUID()
+ const { args, env: processEnv } = copilotOneShotSpawn(opts, sessionId)
+ const timeoutMs = opts.timeoutMs ?? 60_000
+ try {
+ return await new Promise<OneShotResult>((resolve, reject) => {
+ const child = spawn(env.COPILOT_PATH || 'copilot', args, {
+ cwd: opts.cwd, env: processEnv, detached: true, stdio: ['ignore', 'pipe', 'pipe'],
+ })
+ let stdout = ''
+ let stderr = ''
+ let settled = false
+ const finish = (fn: () => void): void => {
+ if (settled) return
+ settled = true
+ clearTimeout(timer)
+ opts.signal?.removeEventListener('abort', onAbort)
+ fn()
+ }
+ const kill = (): void => killGroup(child)
+ const onAbort = (): void => {
+ finish(() => reject(Object.assign(new Error('copilot one-shot aborted'), { name: 'AbortError' })))
+ kill()
+ }
+ const timer = setTimeout(() => {
+ finish(() => reject(new Error(`copilot one-shot timed out after ${timeoutMs}ms`)))
+ kill()
+ }, timeoutMs)
+ opts.signal?.addEventListener('abort', onAbort)
+ child.stdout?.on('data', (chunk: Buffer) => { stdout += chunk.toString() })
+ child.stderr?.on('data', (chunk: Buffer) => { stderr += chunk.toString() })
+ child.on('error', (err) => finish(() => reject(err)))
+ child.on('close', (code) => {
+ const text = stdout.trim()
+ finish(() => {
+ if (!text) reject(new Error(`copilot one-shot exited ${code}: ${stderr.slice(0, 500)}`))
+ else resolve({ text, sessionId: null })
+ })
+ })
+ })
+ } finally {
+ await removeCopilotSession(sessionId)
+ }
+}
+
function hermesBin(): string {
return env.HERMES_PATH || 'hermes'
}
diff --git a/cli/src/lib/registry.ts b/cli/src/lib/registry.ts
index 410b4d210..d0203d3b1 100644
--- a/cli/src/lib/registry.ts
+++ b/cli/src/lib/registry.ts
@@ -38,6 +38,7 @@ import { readCodexRolloutMeta, resolveCodexRollout } from '../engines/codex/roll
import type { AgentEngine } from '../engines/types.js'
import { commandcodeTranscriptPath } from '../engines/commandcode/transcript.js'
import { agyTranscriptPath } from '../engines/agy/session.js'
+import { copilotTranscriptPath } from '../engines/copilot/session.js'
import { hardenPrivateStateFileIfPresent, readPrivateStateFile, secureStateDirectory } from './secureState.js'
import { mergeTerminalRuntimes, processIdentityKey, terminalPlacementKey, terminalRouteKey } from './terminalRuntime.js'
import type { HookTerminalHint, ProcessIdentity, TerminalRuntimeRef } from './terminalTypes.js'
@@ -145,7 +146,7 @@ const PANE_RE = /^%\d+$/
const GROK_SESSION_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
const AGENT_ENGINES = new Set<AgentEngine>([
'claude', 'codex', 'cursor', 'opencode', 'pi', 'hermes', 'commandcode', 'devin', 'muse', 'amp', 'kilo', 'grok',
- 'agy',
+ 'agy', 'copilot',
])
const LOCK_WAIT_MS = 20
const LOCK_ATTEMPTS = 100
@@ -459,6 +460,8 @@ export function validTranscriptPath(engine: AgentEngine, filePath: string): bool
? join(env.GROK_HOME, 'sessions')
: engine === 'agy'
? join(env.AGY_HOME, 'brain')
+ : engine === 'copilot'
+ ? join(env.COPILOT_HOME, 'session-state')
: engine === 'cursor'
? join(env.CURSOR_HOME, 'projects')
: engine === 'pi'
@@ -629,7 +632,7 @@ class Registry {
}
let changed = false
for (const raw of Array.isArray(arr) ? arr : []) {
- const engine: AgentEngine = raw?.engine === 'codex' || raw?.engine === 'cursor' || raw?.engine === 'opencode' || raw?.engine === 'pi' || raw?.engine === 'hermes' || raw?.engine === 'commandcode' || raw?.engine === 'devin' || raw?.engine === 'muse' || raw?.engine === 'amp' || raw?.engine === 'kilo' || raw?.engine === 'grok' || raw?.engine === 'agy' ? raw.engine : 'claude'
+ const engine: AgentEngine = raw?.engine === 'codex' || raw?.engine === 'cursor' || raw?.engine === 'opencode' || raw?.engine === 'pi' || raw?.engine === 'hermes' || raw?.engine === 'commandcode' || raw?.engine === 'devin' || raw?.engine === 'muse' || raw?.engine === 'amp' || raw?.engine === 'kilo' || raw?.engine === 'grok' || raw?.engine === 'agy' || raw?.engine === 'copilot' ? raw.engine : 'claude'
const runtimes = normalizedRuntimes(raw?.runtimes, raw?.tmuxPane)
const pane = tmuxProjection(runtimes)
let transcriptPath =
@@ -865,7 +868,7 @@ class Registry {
const sessionId =
input.sessionId || (transcriptPath ? basename(transcriptPath).replace(/\.jsonl$/, '') : '')
const engine: AgentEngine =
- input.engine === 'codex' || input.engine === 'cursor' || input.engine === 'opencode' || input.engine === 'pi' || input.engine === 'hermes' || input.engine === 'commandcode' || input.engine === 'devin' || input.engine === 'muse' || input.engine === 'amp' || input.engine === 'kilo' || input.engine === 'grok' || input.engine === 'agy' ? input.engine : 'claude'
+ input.engine === 'codex' || input.engine === 'cursor' || input.engine === 'opencode' || input.engine === 'pi' || input.engine === 'hermes' || input.engine === 'commandcode' || input.engine === 'devin' || input.engine === 'muse' || input.engine === 'amp' || input.engine === 'kilo' || input.engine === 'grok' || input.engine === 'agy' || input.engine === 'copilot' ? input.engine : 'claude'
const pane = input.tmuxPane
// Hooks carry process metadata, not ownership. The already-discovered pane+engine process chooses the
// agent; an optional legacy launcherId is intentionally ignored.
@@ -882,7 +885,9 @@ class Registry {
|| (engine === 'grok' && !GROK_SESSION_RE.test(sessionId))
// agy's session id IS its conversation id, and it names the directory the transcript lives in.
|| (engine === 'agy' && !GROK_SESSION_RE.test(sessionId))
- || (engine !== 'cursor' && engine !== 'opencode' && engine !== 'kilo' && engine !== 'pi' && engine !== 'hermes' && engine !== 'commandcode' && engine !== 'devin' && engine !== 'grok' && engine !== 'agy' && !transcriptPath)
+ // Copilot's session id is a uuid and names the directory its event stream lives in.
+ || (engine === 'copilot' && !GROK_SESSION_RE.test(sessionId))
+ || (engine !== 'cursor' && engine !== 'opencode' && engine !== 'kilo' && engine !== 'pi' && engine !== 'hermes' && engine !== 'commandcode' && engine !== 'devin' && engine !== 'grok' && engine !== 'agy' && engine !== 'copilot' && !transcriptPath)
|| (transcriptPath && !validTranscriptPath(engine, transcriptPath))
) return null
if (engine === 'codex' && transcriptPath && readCodexRolloutMeta(transcriptPath)?.isSubagent) return null
@@ -919,7 +924,11 @@ class Registry {
// land before the first line is flushed — derive rather than wait a turn for the path.
: !transcriptPath && engine === 'agy'
? agyTranscriptPath(env.AGY_HOME, sessionId)
- : null
+ // Copilot announces its session before the first event is flushed; its layout is
+ // deterministic, so derive rather than wait a turn for the path.
+ : !transcriptPath && engine === 'copilot'
+ ? copilotTranscriptPath(env.COPILOT_HOME, sessionId)
+ : null
const effectiveTranscriptPath = transcriptPath ?? existing?.transcriptPath ?? derived ?? null
const entry: RegisteredSession = {
schemaVersion: 2,
@@ -929,7 +938,7 @@ class Registry {
boundAt: isNew ? now : existing?.boundAt ?? now,
engine,
transcriptPath: effectiveTranscriptPath,
- projectDir: engine === 'grok' || engine === 'agy'
+ projectDir: engine === 'grok' || engine === 'agy' || engine === 'copilot'
? basename(input.cwd ?? existing?.cwd ?? '') || sessionId
: effectiveTranscriptPath
? basename(dirname(effectiveTranscriptPath))
diff --git a/cli/src/lib/runtimeProfile.ts b/cli/src/lib/runtimeProfile.ts
index 9b736f211..682f360c4 100644
--- a/cli/src/lib/runtimeProfile.ts
+++ b/cli/src/lib/runtimeProfile.ts
@@ -109,7 +109,7 @@ interface CodexCache {
models?: CodexCacheModel[]
}
-const PROFILE_RE = /^runtime-v1:([^:]+):(claude|codex|cursor|commandcode|pi|devin|opencode|hermes|muse|amp|kilo|grok|agy):([^@]+)@([a-z0-9_-]+)$/i
+const PROFILE_RE = /^runtime-v1:([^:]+):(claude|codex|cursor|commandcode|pi|devin|opencode|hermes|muse|amp|kilo|grok|agy|copilot):([^@]+)@([a-z0-9_-]+)$/i
const CODEX_EFFORTS = new Set(['auto', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra'])
const CLAUDE_EFFORTS = new Set(['auto', 'low', 'medium', 'high', 'xhigh', 'max', 'ultracode'])
const CURSOR_EFFORTS = new Set(['auto', 'none', 'low', 'medium', 'high', 'xhigh', 'max'])
diff --git a/cli/src/lib/sessionInput.ts b/cli/src/lib/sessionInput.ts
index ddb16a83f..95ef6534b 100644
--- a/cli/src/lib/sessionInput.ts
+++ b/cli/src/lib/sessionInput.ts
@@ -45,6 +45,9 @@ const GROK_SUBMIT_VERIFY_MS = 6_000
// starts. Measured 3-5s from Enter to the first hook on a warm session; 8s leaves headroom without
// making a genuinely dropped message wait too long for its error.
const AGY_SUBMIT_VERIFY_MS = 8_000
+// Copilot's first hook of a turn is `userPromptSubmitted`, which fires as soon as Enter is accepted —
+// faster than agy's, which waits for the model call. 6s is the same headroom grok gets.
+const COPILOT_SUBMIT_VERIFY_MS = 6_000
const CURSOR_TURN_SETTLE_MS = 750
const SUBMIT_MAX_RETRIES = 2
// Non-cursor engines re-observe the pane (instead of erroring) while an accepted-but-not-yet-started
@@ -332,6 +335,8 @@ export class SessionInputController {
? GROK_SUBMIT_VERIFY_MS
: session.engine === 'agy'
? AGY_SUBMIT_VERIFY_MS
+ : session.engine === 'copilot'
+ ? COPILOT_SUBMIT_VERIFY_MS
: SUBMIT_VERIFY_MS)
}
@@ -358,7 +363,7 @@ export class SessionInputController {
return
}
} else if (session.engine === 'opencode' || session.engine === 'kilo' || session.engine === 'pi' || session.engine === 'hermes' || session.engine === 'muse'
- || session.engine === 'amp' || session.engine === 'grok' || session.engine === 'agy') {
+ || session.engine === 'amp' || session.engine === 'grok' || session.engine === 'agy' || session.engine === 'copilot') {
// OpenCode has no composer glyph, and the submitted text stays visible in the message area, so a
// pane scrape can't tell "still in the composer" from "already sent". Rely purely on the reader-
// derived turn_started (a new user row in opencode.db) to clear awaitingFingerprint; if it hasn't
diff --git a/cli/src/lib/sessionRepair.ts b/cli/src/lib/sessionRepair.ts
index 448012d42..46d44d47b 100644
--- a/cli/src/lib/sessionRepair.ts
+++ b/cli/src/lib/sessionRepair.ts
@@ -23,6 +23,7 @@ import { museEvent, museWorkspaceRoot } from '../engines/muse/normalizer.js'
import type { AgentEngine } from '../engines/types.js'
import { readCodexRolloutMeta } from '../engines/codex/rollout.js'
import { agyConversationForPid, findAgyTranscript } from '../engines/agy/session.js'
+import { copilotSessionCwd } from '../engines/copilot/session.js'
const execFileAsync = promisify(execFile)
@@ -305,6 +306,16 @@ export async function findLiveSession(
+ ` AND (created_at >= ${Math.trunc(sinceMs / 1000)} OR last_activity_at >= ${Math.trunc(sinceMs / 1000)})`
+ ` ORDER BY last_activity_at DESC LIMIT 2;`,
)
+ case 'copilot':
+ // Copilot names its session directory by uuid, so the cwd lives inside the file — on the first
+ // record, `session.start.data.context.cwd`. readTranscriptMeta scans the first lines for a
+ // `cwd`, but Copilot nests it, so this reads it out itself.
+ return fileEngineSession(join(env.COPILOT_HOME, 'session-state'), cwd, startedAtMs, async (path) => {
+ if (basename(path) !== 'events.jsonl') return null
+ const head = (await readFile(path, 'utf8').catch(() => '')).split('\n', 5)
+ const root = copilotSessionCwd(head)
+ return root ? { cwd: root, sessionId: basename(dirname(path)) } : null
+ }, opts)
case 'agy':
// The one engine here that cannot be found by directory. agy's transcript records no cwd, its
// brain directory is named by the conversation id, and `conversation_summaries.db` — which looks
diff --git a/cli/src/lib/summarize.ts b/cli/src/lib/summarize.ts
index 1bf467eed..633840c78 100644
--- a/cli/src/lib/summarize.ts
+++ b/cli/src/lib/summarize.ts
@@ -30,6 +30,7 @@ import {
runAmpOneShot,
runGrokOneShot,
runAgyOneShot,
+ runCopilotOneShot,
setOneShotPoolActiveCounts,
setOneShotPoolDeviceConnected,
shutdownOneShotPool,
@@ -64,7 +65,7 @@ export function syncSummaryPoolSessions(sessions: Array<{ engine: AgentEngine }>
// Hermes, Devin, Muse and Amp take their recap prompt as argv (`muse exec <prompt>`, `amp -x <prompt>`),
// so they cannot be pre-warmed the way a stdin-fed CLI can — no pooled worker for them.
if (session.engine === 'hermes' || session.engine === 'devin' || session.engine === 'muse'
- || session.engine === 'amp' || session.engine === 'grok' || session.engine === 'agy') continue
+ || session.engine === 'amp' || session.engine === 'grok' || session.engine === 'agy' || session.engine === 'copilot') continue
counts[session.engine]++
}
setOneShotPoolActiveCounts(counts)
@@ -327,6 +328,8 @@ export async function summarizeTurnText(
? env.GROK_SUMMARY_MODEL
: engine === 'agy'
? env.AGY_SUMMARY_MODEL
+ : engine === 'copilot'
+ ? env.COPILOT_SUMMARY_MODEL
: env.OPENCODE_SUMMARY_MODEL
const effort = engine === 'cursor' ? 'model-defined' : env.SUMMARY_EFFORT
console.log(
@@ -358,6 +361,8 @@ export async function summarizeTurnText(
? runGrokOneShot
: engine === 'agy'
? runAgyOneShot
+ : engine === 'copilot'
+ ? runCopilotOneShot
: runOpencodeOneShot
// One shape for both paths so the language-drift retry and the two-part capping below stay single-source.
const run: (options: OneShotOptions) => Promise<{ text: string; sessionId: string | null }> = gatewayKey
diff --git a/cli/src/lib/tmux.ts b/cli/src/lib/tmux.ts
index fdca707f5..c6940b1a4 100644
--- a/cli/src/lib/tmux.ts
+++ b/cli/src/lib/tmux.ts
@@ -325,6 +325,13 @@ export function engineProcessMatchScore(
if (executable === 'agy' || entrybase === 'agy') return 3
return /[\/\\]\.local[\/\\]bin[\/\\]agy$/.test(entrypoint) ? 2 : 0
}
+ if (engine === 'copilot') {
+ // Two builds answer to `copilot` on a typical machine: a compiled binary (~160MB, measured) and
+ // the npm loader script that execs it. Both keep the bare `copilot` argv, so the basename is the
+ // signal and the install paths only cover a wrapped launch.
+ if (executable === 'copilot' || entrybase === 'copilot') return 3
+ return /@github[\/\\]copilot[\/\\](?:npm-loader\.js|.*copilot)$/.test(entrypoint) ? 2 : 0
+ }
if (executable === 'claude' || entrybase === 'claude') return 3
return /@anthropic-ai[\/\\]claude-code[\/\\]cli\.js$/.test(entrypoint) ? 2 : 0
}
@@ -406,6 +413,9 @@ const RESUME_ARGS: Partial<Record<RegisteredSession['engine'], { flags: string[]
// `agy --conversation <uuid>` resumes by conversation id; `-c`/`--continue` names nothing and falls
// through to the presence-lock lookup in sessionRepair.
agy: { flags: ['--conversation'], id: /^[0-9a-f-]{16,}$/i },
+ // `copilot --resume=<id>` and `--session-id <id>`; bare `--resume`/`--continue` name nothing and
+ // fall through to the directory scan in sessionRepair.
+ copilot: { flags: ['--resume', '--session-id'], id: /^[0-9a-f-]{16,}$/i },
}
/** The session id an engine was told to resume, or null when argv does not name one. */