Skip to content

Copilot CLI app.js reverse-engineering wiki

Copilot CLI app.js reverse-engineering wiki

This wiki organizes the implementation notes for the extracted @github/copilot CLI bundle around reader journeys instead of a flat list of files. The analyzed artifact is:

copilot-cli-pkg/app.js

The docs are based on static inspection of the extracted package, command/help output, string/anchor extraction, and script-assisted scans. Because app.js is bundled/minified, symbol names are unstable; source anchors are intended for searching the analyzed bundle, not as public API names.

Wiki map

flowchart TD
Home[Wiki home] --> O[00 Overview]
Home --> R[01 Runtime and UI]
Home --> C[02 Context and input]
Home --> S[03 Sessions and remote]
Home --> T[04 Tools and integrations]
Home --> P[05 Security and policy]
Home --> M[06 Models and reliability]
Home --> A[07 Agents and automation]
Home --> Ops[08 Operations and research]
O --> R
R --> C
C --> S
S --> T
T --> P
P --> M
M --> A
A --> Ops

Volumes

VolumePurposePages
OverviewStart here: what the extracted bundle is, how to read the docs, and the high-level feature map.2
Runtime and UIBootstrap, root command routing, interactive TUI, terminal ergonomics, voice mode, protocol server modes, and rendering support.7
Context and inputEverything that becomes model-visible context: prompts, custom instructions, attachments, memory, compaction, and rewind boundaries.6
Sessions and remoteLocal event-sourced sessions, cloud/remote control, SQLite indexing, UI projection, repository metadata, and Mission Control steering.6
Tools and integrationsBuilt-in tools, MCP, plugins, IDE/LSP/editor bridges, web access, and integration overview surfaces.6
Security and policyPermissions, content exclusion, hooks, sandboxing, and persistent policy/configuration state.5
Models and reliabilityAuthentication, provider selection, wire APIs, resilience, rate limits, usage metrics, quota, and billing.4
Agents and automationTask orchestration, subagents, autopilot, fleet mode, and scheduled prompt/command automation.4
Operations and researchFeature gates, diagnostics, debug bundles, observability/update/shutdown, and the original documentation backlog.4

Naming and maintenance conventions

AreaConvention
Volume directoriesNumbered prefixes preserve a stable reading order while keeping related pages together.
Topic filenamesUse short lower-kebab-case wiki slugs. Rename only when a page’s scope changes, not just because a title is reworded.
Topic titlesPrefer reader-facing titles over historical source filenames. Keep app.js in the title only when the page is specifically about bundle-level behavior.
Merging pagesMerge only when two pages describe the same lifecycle or runtime boundary. Otherwise keep focused implementation pages and connect them through volume indexes.
Adding pagesAdd the page under the closest volume, then update that volume README.md, the root page index, and SUMMARY.md.
Link textUse human-readable page titles in prose; reserve raw filenames for tables or maintenance notes.
GoalRead this path
Get oriented quicklyOverviewRuntime and UIContext and input
Understand local/remote session behaviorSessions and remoteOperations and research
Trace a model request end to endContext and inputTools and integrationsModels and reliability
Review safety and trust boundariesSecurity and policyTools and integrationsOperations and research
Study automation and subagentsContext and inputAgents and automationSessions and remote

Cross-cutting implementation matrix

ConcernPrimary volumeKey supporting volumes
Prompt/context assemblyContext and inputTools and integrations, Models and reliability
Session/event lifecycleSessions and remoteRuntime and UI, Operations and research
Tool executionTools and integrationsSecurity and policy, Agents and automation
Permissions and redactionSecurity and policyContext and input, Tools and integrations
Model routing and quotaModels and reliabilityOperations and research
Remote/cloud operationSessions and remoteRuntime and UI, Security and policy

Complete page index

VolumePageCovers
Overviewapp.js overviewBundle identity, responsibilities, and caveats.
OverviewMain feature map for Copilot CLIHigh-level map of feature areas and runtime ownership.
Runtime and UILoader and bootstrap workflowsSEA/npm loader chain, restart wrapper, secure module loading, and bootstrap safeguards.
Runtime and UICLI runtime workflowsRoot CLI routing, pre-action setup, prompt/headless/server dispatch, and session resolution.
Runtime and UIInteractive TUI and slash-command workflowsInteractive TUI event loop, dialogs, slash command macros, and permission surfaces.
Runtime and UITerminal setup and shell environmentTerminal detection, Shift+Enter setup, shell context, and command-history state.
Runtime and UIVoice mode and Foundry LocalFoundry Local dictation runtime, voice settings, native audio modules, and model cache checks.
Runtime and UIEmbedded server, ACP, and JSON-RPC protocolJSON-RPC/ACP server modes, external tool calls, elicitation, sampling, and commands.
Runtime and UITree-sitter WASM usage in the Copilot CLIPackaged Tree-sitter grammars, highlight queries, rich diff rendering, and fallback behavior.
Context and inputPrompt sources in Copilot CLIStatic/runtime prompt sources, YAML package prompts, instructions, MCP prompts, hooks, and provider mapping.
Context and inputCustom agents and skills packagingAGENTS.md, SKILL.md, plugin/remote/provided agents, skill directories, and enable/disable events.
Context and inputAttachment and file-ingestion pipelineNative image/document attachments, tagged-file fallback, MIME detection, payload mapping, and limits.
Context and inputMemory and dynamic context board in Copilot CLIAgentic memory API, local memory, dynamic context board, rem-agent, sidekicks, and shutdown consolidation.
Context and inputConversation compaction and memory compression in Copilot CLI/compact, automatic compaction, summary replacement, checkpoints, hooks, telemetry, and UI status.
Context and inputCheckpoints, undo, rewind, and fork/undo, /rewind, /fork, event-log truncation/replay, snapshot_rewind, and workspace events.
Sessions and remoteSession support implementation in the Copilot CLIEvent-sourced local persistence, workspace artifacts, startup resolution, APIs, and handoff behavior.
Sessions and remoteSession, remote, cloud, and history workflowsResume/continue/name handling, background sessions, cloud sessions, remote steering, and history.
Sessions and remoteSession-store SQLite indexingsession-store.db schema, FTS/search, /reindex, Chronicle, refs, cloud sync, and backfill.
Sessions and remoteSystem events and UI projectionSystem messages, notifications, info/warning/error events, timeline entries, and ephemeral UI projection.
Sessions and remoteGit, repository, PR, and ref contextGit root/branch/head/base detection, session refs, PR context, and GitHub MCP overlap.
Sessions and remoteRemote control implementation in Copilot CLIMission Control exporter, command polling, /remote, permission bridging, and remote task attach.
Tools and integrationsBuilt-in tool execution pipelineTool registration, model-visible schemas, permission/hook flow, execution events, streaming, and telemetry.
Tools and integrationsMCP support implementation in the Copilot CLIMCP config discovery, transports, host lifecycle, tool exposure, OAuth, permissions, and tasks.
Tools and integrationsPlugin and extension architecturePlugin install/cache/config lifecycle, marketplaces, local plugin dirs, contributions, and SDK loading.
Tools and integrationsIDE, LSP, and editor integrationIDE tools, selections, diagnostics, diffs, session title sync, LSP config, and extension state.
Tools and integrationsWeb search, URL fetching, and URL permissionsBuilt-in web_fetch, GitHub MCP web_search, URL allow/deny persistence, and web-tool gates.
Tools and integrationsIntegrations, permissions, auth, and config workflowsCross-cutting overview of MCP, plugins, permissions, auth/provider selection, login, and updates.
Security and policyPermission system design in Copilot CLICentral PermissionService pipeline, rule precedence, path/URL managers, prompts, scopes, and allow-all behavior.
Security and policyContent exclusion and redactionContent-exclusion service, policy fetch/merge, filtered outputs, bypass limits, secret env vars, and redaction.
Security and policyHooks and lifecycle automationHook schema, command/HTTP hooks, VS Code aliases, security restrictions, events, and lifecycle automation.
Security and policySandbox ImplementationLocal command sandboxing, /sandbox, SANDBOX gate, shell wiring, MXC policy, and platform caveats.
Security and policySettings and configuration persistenceConfig roots, typed stores, writeKey/load paths, settings overlays, URL/MCP/plugin/sandbox state, and migration.
Models and reliabilityModels, providers, and authentication workflowsAuth manager, login, GitHub tokens, BYOK/custom providers, offline mode, model selection, and effort.
Models and reliabilityModel API routing and provider wire formatsRouting to Chat Completions, Responses, WebSocket Responses, and Anthropic Messages APIs.
Models and reliabilityRate limits, concurrency, retries, and error recoveryRetry policy, rate-limit recovery, auto-mode switching, queue pauses, concurrency limits, fallback, and cancellation.
Models and reliabilityUsage, quota, and billing metrics/usage, assistant.usage, session.usage_info, premium/AI-unit metrics, token details, and billing/quota errors.
Agents and automationAgent and task orchestration in Copilot CLITask tool dispatch, TaskRegistry, main/subagent/custom-agent collaboration, hooks, MCP tasks, research, and fleet.
Agents and automationAutopilot and no-ask-user flagsImplementation comparison of —autopilot, —no-ask-user, continuation, task_complete, ask_user, and permission boundaries.
Agents and automationFleet mode implementation in Copilot CLI/fleet, session.fleet.start, autopilot_fleet, SQL todo coordination, dependencies, and parallel subagents.
Agents and automationScheduled prompts and command queue/every and /after parsing, ScheduleRegistry replay, queue integration, and ephemeral command dispatch.
Operations and researchFeature gates and rollout logic in Copilot CLIGate tiers, rollout inputs, env/settings overrides, remote experiments, repo/team allowlists, and MCP permission gates.
Operations and researchDiagnostics, feedback, and debug bundles/diagnose, /feedback, /bug, /collect-debug-logs, .tgz bundles, secret gist uploads, and debug-log paths.
Operations and researchObservability, update, and shutdown workflowsLogging, telemetry, OpenTelemetry, debug artifacts, update/version paths, and graceful shutdown.
Operations and researchFurther documentation opportunities for Copilot CLIHistorical scan report, implemented backlog, command surfaces, and future niche follow-ups.

Full table of contents

For a compact sidebar-style table of contents, see SUMMARY.md.

Important caveat

These pages document a bundled/minified production artifact, not clean source. Semantic names in prose and diagrams are explanatory aliases. Generated/minified symbols are retained only when useful as search anchors for the analyzed bundle.