This page is a design/reference spec. Release truth lives in the runtime capability manifest and shipped product docs.
Architecture Overview
Current Implementation State
PHANTOM is currently a TypeScript monorepo with these active packages:
packages/cli: command orchestrationpackages/core: config, context, modules, swarm, PRDpackages/tui: terminal rendering and themed screenspackages/modules: baseline built-in modules packagepackages/mcp-server: MCP core server and tool contracts
Current runtime model:
- local CLI process
- local filesystem indexing for context
- local JSON configuration in
~/.phantom/config.json
Target State
Target architecture adds:
- one-line installer pipeline and release manifest
- MCP core server with adapter layer
- deterministic swarm pipeline with evidence provenance
- stronger security and audit model
Config Schema Additions (Public Interface)
Required config keys in persisted user config:
installation.channelinstallation.versionmcp.enabledmcp.server_modeintegrations[]security.audit_log_path
Current implementation state:
- configuration includes installation metadata and integrations list
- MCP and security keys are available in config model
- compatibility path accepts legacy camelCase keys while writing canonical keys
Target state:
- schema validation gate for config load/save
phantom doctorincludes config schema diagnostics- migration tooling for older config payloads
Logical Layers
Interface Layer
- CLI commands
- TUI outputs
- future website and API docs reference
CLI Contract Additions (Foundation)
Required command surface:
phantom doctorphantom integrate scanphantom integrate <target>phantom integrate doctorphantom status --json
phantom status --json contract (current):
versionfirstRunactiveProjectinstalledModulesintegrationsdataModepermissionLeveltheme
Domain Layer
- context management
- module registry and lifecycle
- agent swarm orchestration
- artifact generation (PRD and future outputs)
Integration Layer
- MCP core contracts
- adapter-specific configuration surfaces
Storage Layer
- config store
- local context index store
- future artifact store and audit log
Cross-Cutting Concerns
- permission policy
- reliability gates
- status-tagged documentation parity
Data Flow (High-Level)
- user command enters CLI
- CLI routes to core service
- core reads context/config/module state
- core produces deterministic response/artifact
- CLI/TUI renders result and writes output when applicable
Architectural Constraints
- local-first default behavior
- explicit external action paths
- deterministic behavior for all
Realfeatures - docs and implementation must remain synchronized
Acceptance Criteria
- architecture document reflects current code structure
- includes current and target states explicitly
- references installer and MCP as planned extensions