Skip to content

Adapter Architecture

Host adapters are the integration layer between a specific coding-agent host and TokenPilot.

Current Adapters

From HOSTS.md:

HostStatusIntegration ModeInstall Surface
OpenClawproductionbundled plugin + embedded runtimepnpm component:install:tokenpilot:openclaw or npm --prefix components/tokenpilot/adapters/openclaw run install:release
Codex CLIavailablehooks + local Responses proxy + shared CLInpm --prefix components/tokenpilot/adapters/codex run build then npm --prefix components/tokenpilot/adapters/codex run install:codex
Claude Codeavailablegateway routing + observability hooks + shared CLInpm --prefix components/tokenpilot/adapters/claude-code run build then npm --prefix components/tokenpilot/adapters/claude-code run install:claude-code

Adapter Responsibilities

From adapters/README.md:

Keep these inside the adapter:

  • Host install and uninstall flow
  • Host config mutation
  • Request / response hook wiring
  • Session and transcript bridging
  • Host-specific command registration
  • Runtime bootstrap and doctor checks
  • Host-owned path resolution

Shared Packages

Host-agnostic logic lives in shared packages under components/tokenpilot/packages/:

PackageRole
packages/host-adapter/Host abstraction contracts and envelope bridge helpers
packages/kernel/Shared contracts, events, and runtime-facing types
packages/runtime-core/Host-agnostic reduction, recovery, and archive primitives
packages/layers/*Policy, history, and memory logic
packages/product-surface/Shared command semantics for the standalone CLI

Released under the MIT License.