Skip to content

Start here

Start here when you need the fastest coherent mental model of copilot-cli-pkg/app.js. This chapter answers three questions before sending readers into deep source-anchored pages:

  1. What is the extracted bundle?
  2. What major runtime capabilities does it contain?
  3. Which path should I follow for a specific investigation?

app.js is a bundled and minified production artifact, so this wiki uses stable semantic aliases in prose and keeps minified names only as searchable anchors.

Source-anchor policy

This page is an orientation document, not a direct implementation trace. Concrete anchors live in the linked pages.

Semantic aliasMinified anchorScope
Start pageN/A — navigation pageEstablishes the first reading path and the wiki’s conceptual map.
Bundle identitySee what-is-app-js.mdExplains artifact boundaries, package layout, and caveats.
Runtime capability mapSee main-feature-map.mdMaps the major systems implemented by the bundle.

First reading path

StepReadWhy
1app.js overviewDefines what the artifact is and what it is not.
2Main feature mapShows how CLI modes, sessions, tools, models, agents, policy, and ops connect.
3Mode dispatch and runtime startupExplains how argv/stdin/TTY/options route into TUI, prompt, server/headless, or ACP mode.
4Conversation session end-to-endShows the durable path through replay, tools, UI projection, persistence, remote export, and shutdown.

Choose your route

QuestionGo to
How does the binary/package start and select a mode?Runtime lifecycle
What does the model see, and how is the request shaped?Context and model loop
Which tools are exposed, executed, filtered, or permissioned?Tools, integrations, and security
Where do session events, state files, indexes, and remote control live?Sessions, persistence, and remote
Which env vars and operational contracts define hosted jobs?Hosted agent ops
How are subagents, custom agents, fleet, and scheduled prompts run?Agents and automation

Internals map

flowchart TD
Start[Start here] --> Runtime[Runtime lifecycle]
Runtime --> Loop[Context and model loop]
Loop --> Tools[Tools, integrations, and security]
Runtime --> Sessions[Sessions, persistence, and remote]
Sessions --> Hosted[Hosted agent ops]
Loop --> Agents[Agents and automation]
click Start "./" "Open Start here"
click Runtime "../01-runtime-lifecycle/" "Open Runtime lifecycle"
click Loop "../02-context-model-loop/" "Open Context and model loop"
click Tools "../03-tools-integrations-security/" "Open Tools, integrations, and security"
click Sessions "../04-sessions-persistence-remote/" "Open Sessions, persistence, and remote"
click Hosted "../05-hosted-agent-ops/" "Open Hosted agent ops"
click Agents "../06-agents-automation/" "Open Agents and automation"

Reading strategy

  • Use section README pages as narrative guides.
  • Use implementation pages when you need source anchors, event names, env vars, call paths, or edge cases.
  • Use the generated atlas only as a discovery layer; every behavioral claim should point back to a focused page or source anchor.

Created and maintained by Yingting Huang.