Physical intelligence vision and architecture audit
Status: proposed evolution; documentation only. Audited on 2026-11-26 against
95fe1c9 (robot.__version__ = 1.9.0). No runtime capability, integration,
permission, or release commitment is introduced by this design.
Give your agent physical context and a way to communicate beyond chat. PHOS connects supported sensors to AI agents and turns authorized requests into expressive eyes, speech, and visual signals.
PHOS should evolve into a local-first physical intelligence and expressive interaction platform. Its product is useful, qualified physical evidence and authorized communication. Device administration supports that purpose; a general automation engine, device-control catalog, or IoT dashboard does not.
Reading map and ownership
This audit owns the current assessment, design choices, risks, and implementation sequence. Detailed proposed contracts have one owner each:
| Concern | Design reference |
|---|---|
| Connectivity and protocol limits | Universal connectivity |
| Provider ownership and recovery | Physical provider interface |
| Facts, provenance, clocks, quality | Physical observation model |
| Spatial context, evidence, fusion | Physical world model |
| Agent contracts and permissions | MCP semantic contract |
| Product differentiation | MCP differentiation |
Architecture and accepted ADRs remain
authoritative for implemented boundaries. This proposal extends ADR-002/003,
008, 012, 015, 017/018, 025, and 026; implementation requires a separately
approved vertical milestone. Python namespace robot remains unchanged.
Implementation status update (2026-12-03): this audit is a historical snapshot, not the current runtime inventory. Since its 2026-11-26 audit, encrypted ESPHome Native API onboarding, numeric/binary entity mapping, authorization and current authorized MCP physical-context projection have been implemented. Optional
aioesphomeapiandzeroconfdependencies and secret-store support are present. See the current ESPHome guide and implementation handoff. The broader PI design, source fusion, spatial model and further acceptance gates remain proposals.
Audit scope and evidence limits
The audit covered the tracked repository inventory, public documentation, composition and service boundaries, providers, protocols, interaction paths, Web/MCP adapters, configuration/security, representative tests, dependency declarations, deployment scripts, and CI workflows. Generated assets and bundled Swagger code were inventoried rather than treated as PHOS architecture.
ESP32 firmware is not present in this checkout: there are no tracked firmware
sources or firmware submodule. Controller documentation
assigns it to phosairobot/phos-esp32. Its remote source could not be retrieved
during this audit. Consequently only the Pi-side contract and fake-controller
tests were inspected; firmware scheduling, memory, parser safety, reconnect
behavior, and electrical behavior remain unverified. The separately owned
phos-mcp-bridge also has no implementation here; bridge descriptions are
documented compatibility expectations, not a new external interoperability test.
No Raspberry Pi, serial hardware, microphone, camera, or live broker was tested.
Current architecture assessment
Paths below refer to the audited source, not proposed modules.
| Area | Existing implementation and reuse | Gap or qualification |
|---|---|---|
| Composition/lifecycle | src/robot/main.py::build_application, runtime.py::build_runtime, PhosRuntime.start/stop; core/runtime.py::RobotCore, behavior and task ownership |
Extend this graph; no second runtime or provider process by default. Optional network-provider failure policy needs definition. |
| Configuration | src/robot/config.py::RuntimeConfig, ConfigRepository; config/phos.yaml; web/configuration.py, web/domains.py |
YAML-only, strict validation and atomic persistence exist. New optional integration/source/space settings and explicit migrations are absent. |
| Secrets | src/robot/secrets.py::SecretsService, web/secrets.py, agent credential services |
At this audit snapshot, MQTT/ESPHome secret slots were not yet implemented; current ESPHome uses the existing encrypted secret store and write-only administration. |
| Local sensors | src/robot/sensors.py provider protocols, EnvironmentalSensorService, AirQualitySensorService, IMUSensorService; hardware/environmental.py, bme280.py, bmp280.py, mpu6050.py |
Family-specific snapshots and worker ownership exist. No general multi-source registry. ENS160 is controller-backed in current composition. |
| Native connectivity | hardware/controller_protocol.py::ControllerMessage, JsonLinesDecoder; hardware/serial_controller.py::ControllerService, SerialControllerTransport |
Bounded 8192-byte JSONL, capabilities, heartbeat, reconnect, generations, pushed measurements and resolved LED commands exist. It is not a generic MQTT/ESPHome provider. |
| ESP32 boundary | docs/hardware-controller.md, tests/test_controller_protocol.py |
Documented companion ENS160/AHT21 and WS2812B support; firmware internals outside audit scope. Reserved protocol command names do not imply exposed controls. |
| Environmental semantics | core/environmental.py::EnvironmentalInterpreter, sensor snapshots |
Existing threshold/hysteresis semantics can be reused. No arbitrary-source or room-level interpretation. eCO2 is an estimate, not a CO2 reference measurement. |
| Motion/orientation | src/robot/motion.py, sensors.py::IMUSensorService; generation-gated controller orientation/motion |
Motion intensity is not velocity; acceleration/gyro data do not establish robot position or room coordinates. |
| Vision/presence/attention | vision/pipeline.py::VisionPipeline, core/presence.py::PresenceInterpreter, core/attention.py::AttentionManager, expression providers/smoother |
Stable face-based observations and target continuity exist. Local target IDs are not identity. Attention coordinates are not metric world coordinates. |
| Object awareness | vision/object_awareness.py::ObjectAwarenessCoordinator, vision/nanodet.py, composition in runtime.py, application visible_objects |
On-demand bounded object inference exists; no persistent spatial object map. The coordinator's module docstring saying it is not runtime-composed is stale. |
| Physical context | services/physical_context.py::SemanticPhysicalContextService.build |
Read-only build-on-read aggregation exists. It selects named family snapshots and is not a world model or general fusion engine. |
| History | services/temporal_history.py::TemporalHistoryService; accepted reading sinks in runtime.py::build_runtime, transitions in services/application.py::_semantic_transition |
Bounded RAM history exists. Keying/sampling by metric alone cannot isolate two independent sources of the same metric. |
| Evidence assessment | services/physical_assessment.py::PhysicalContextAssessmentService |
pci-01a checks availability, coverage, gaps, and recovery segments. valid means evidence ready, not trend, accuracy, comfort, or safety. Metric/family mapping is fixed. |
| Events | core/events.py::EventBus, services/semantic_events.py::SemanticEventPublisher |
Two intentional layers already exist. Core dispatch is ordered/awaited; semantic callbacks are synchronous with exception isolation. Neither is a durable event log or a bounded network ingestion queue. |
| Expression and behavior | core/behavior_engine.py::BehaviorEngine, ui/state.py::FaceState, ui/eyes.py::EyeRenderer; semantic LED, overlay and visual lease services |
Reuse arbitration and protected admin overlay ordering. Evidence must not call renderers or controllers directly. |
| Speech/interaction | voice/provider.py, voice/tts.py, voice/session.py, interaction/coordinator.py, executor.py, speech.py |
STT/TTS provider boundaries and separate playback exist. Physical evidence needs neither STT nor LLM/TTS availability. Cloud voice/expression options remain optional existing capabilities. |
| LLM | ai/provider.py::LLMProvider, provider adapters and ai/agent.py |
Keep external agent reasoning distinct from deterministic physical evidence. No LLM added to the context engine. |
| Application/API | services/application.py::PhosApplicationService; web/api.py, web/openapi.py, docs/api/openapi.yaml |
Shared reads/commands exist. /api/v1/events is bounded SSE; no implemented WebSocket server was found. Future transports must reuse the service. |
| MCP | mcp/server.py adapter, tools/resources, McpServerManager, semantic resource bridge |
Embedded Streamable HTTP, read tools, evidence/history, object and JPEG reads, semantic actions and subscription cues exist. No new tools required to start connectivity work. |
| Authentication/authorization | services/agent_identity.py, agent_permissions.py, agent_credentials.py; web/auth.py, admin_access.py |
Identity, operation permission and capability are separate. No per-space/source read policy; current trusted-local compatibility can be uncredentialed. |
| Web administration | web/app.py, templates/static assets, lifecycle IPC in lifecycle_channel.py |
Configuration, credentials, controller diagnostics and subsystem views exist. Extend these boundaries only when a milestone needs operator controls. |
| Packaging/deployment | pyproject.toml, requirement files, deploy/phos.service, scripts/install-phos.sh, run_pi.sh |
At this audit snapshot there were no MQTT/ESPHome extras; current packaging declares both as optional extras. Preserve optional imports and Pi 3 budget. |
| Verification/release | tests/, .github/workflows/ci.yml, scripts/ci_validate.sh, ci_report.py, tests/test_release.py; deploy-pages.yml |
Software tests, compilation, strict MkDocs and post-publication release provenance checks exist. Hardware, firmware and separate bridge validation are not provided by this CI. |
Documentation inconsistencies to preserve as findings
- Older passages of
docs/development.mdanddocs/current-state.mddescribe JSON/legacy overrides.ConfigRepositoryand ADR-026 reject JSON and own one active YAML file. These older passages must not guide new schema work. - At the time of this audit, an early physical-context subsection of
docs/architecture.mdsaid there was no MCP adapter;mcp/server.pyalready exposed context and assessment tools/resources. The architecture overview has since been corrected. Read the source and current MCP contract together when assessing historical audit notes. - CCS811 and early version milestones remain in historical roadmap/development
passages; current
build_runtimerequires controller-backed ENS160 for enabled air quality. Do not reintroduce a Pi CCS811 dependency from historical text. - The object-awareness module header conflicts with its current runtime composition. This audit records the inconsistency without changing runtime.
Proposed target and observation flow
Solid nodes show responsibilities, not new deployment processes. Provider and world-model extensions below are proposed; existing services remain their owners.
flowchart TD
native[Existing local sensors and phos-hw serial] --> ingress[Validated observation ingress]
mqtt[Optional MQTT provider] --> ingress
esp[Optional ESPHome Native API provider] --> ingress
vision[Existing Vision observations] --> ingress
config[Canonical configuration and source metadata] --> ingress
ingress --> domains[Existing canonical domain services extended by source]
domains --> history[Existing bounded temporal history extended by source]
domains --> world[Build-on-read physical world projection]
history --> assessment[Existing evidence assessment extended]
assessment --> world
world --> app[PhosApplicationService]
domains --> events[Existing Core and semantic event boundaries]
events --> app
app --> permissions[AgentApplicationService and request identity]
permissions --> mcp[MCP reads and change cues]
agent[External AI agent] -.->|Authorized semantic action request| permissions
permissions --> app
app --> behavior[Behavior and expressive arbitration]
behavior --> eyes[Eyes and visual signals]
behavior --> speech[TTS provider and separate playback]
classDef phos fill:#0F4C5C,stroke:#49E7FF,color:#fff
classDef aiAgent fill:#5B21B6,stroke:#C4B5FD,color:#fff
classDef hardware fill:#334155,stroke:#94A3B8,color:#fff
class native hardware
class mqtt,esp,vision,config,ingress,domains,history,world,assessment,app,events,permissions,mcp,behavior,eyes,speech phos
class agent aiAgent
style mqtt stroke-dasharray: 5 4
style esp stroke-dasharray: 5 4
Ingress is a validation/dispatch boundary, not a parallel sensor manager or
authoritative state store. Provider session metadata belongs to runtime-owned
providers; physical source descriptors belong to canonical configuration;
accepted current values belong to the existing domain services; historical
values belong to TemporalHistoryService. The world projection derives its
answers from those owners. A bounded ingress queue is transient work only.
Design decisions and rejected alternatives
These are proposed design choices, not additions to the accepted ADR ledger.
| Choice | Rationale | Rejected alternative |
|---|---|---|
| Native serial, MQTT, ESPHome Native API only | Bound scope and prove semantics before expanding connectivity | Implementing other transports, discovery ecosystems, or a universal IoT hub |
| Extend existing state/history/services | Preserve one answer for existing callers | Parallel sensor manager, third event bus, duplicate world-state database |
| Observation-only network integrations initially | Contain authority and support useful evidence first | MQTT command topics, generic ESPHome action forwarding, device actuation tools |
| Deterministic evidence and explicit unknowns | Auditable on Pi 3 without cloud or LLM | LLM-generated sensor facts, inferred causal explanations, hidden imputation |
| Configured space/source bindings first | Avoid unsupported localization and trust claims | Inferring rooms, device identity, occupancy truth, or coordinate transforms from names |
| Optional integration lifecycle | Preserve expressive native runtime during outages | Required broker, Home Assistant, global reconnect/restart, mandatory integration SDKs |
| Retain current MCP projections | Protect clients and permissions | Replacing existing payloads with a new observation envelope or raw entity catalog |
| Keep bounded RAM retention initially | Preserve privacy and embedded storage limits | New database, event sourcing, media/transcript archive |
Incremental implementation sequence and acceptance gates
Each row is a separately scoped runnable milestone. No next row starts automatically. Proposed ordering does not change the existing release roadmap.
| Step | Deliverable | Acceptance gate |
|---|---|---|
| PI-1 | Internal observation/provenance contract and native compatibility mapping for one environmental metric | Fake local/controller inputs produce unchanged current context/history/MCP values; source IDs and receipt-time meaning are explicit; invalid values rejected; no integration dependency/config churn. |
| PI-2 | Source-aware domain/history keys and configured source/space descriptors; compatibility selector | Two temperature sources remain independent through sampling, gaps, reconnect and queries; old metric-only calls resolve the configured legacy source deterministically; global RAM limits proven. |
| PI-3 | Minimal lifecycle seam and optional MQTT numeric observation provider for one explicit topic mapping | Missing extra, broker outage, duplicates, retained data, floods, invalid payloads and reconnect cannot stall native eyes/speech; no write/command path. |
| PI-4 | Optional ESPHome Native API provider for explicitly mapped sensor entities | Direct device connection without Home Assistant; encryption and missing-secret failures isolated; reconnect/entity key changes tested; no action forwarding. |
| PI-5 | Read-only spatial world projection and narrowly scoped deterministic multi-source assessment | Every answer identifies space, evidence age/quality, rule and conflicts; correlated aliases do not count as independent corroboration; no inferred room or person identity. |
| PI-6 | Versioned opt-in semantic MCP exposure if existing projections prove insufficient | Existing schemas, URIs, permission profiles and actions pass contract regressions; new source/space privacy policy approved; unsupported subscription clients still read on demand. |
| PI-7 | Pi 3 soak and fault-injection verification for the enabled slice | Record CPU/RSS, event-loop/render responsiveness, queue high-water marks, reconnect behavior and bounded shutdown on real 800x600 hardware. Publish measured results and firmware/bridge revisions used. |
Recommended next implementation task: PI-1, restricted to one native temperature path and internal provenance tests. Do not add MQTT/ESPHome, a world store, new agent tools, or public payload changes as part of that task.
Testing and runnable review
For this documentation change, build with .venv/bin/python -m mkdocs build
--strict; review the seven pages through the Developer & Architecture navigation.
Run .venv/bin/python -m pytest -q when the environment supports the suite.
Results and environmental skips are reported with the change, not assumed here.
Audit verification on this checkout: strict MkDocs build and local-link,
whitespace and code-fence checks passed. The five focused context, temporal
history, assessment, semantic-event and agent-permission test modules passed
all 43 tests. Two full-suite attempts each reached 463 passes and then stalled
in tests/test_controller_protocol.py::test_controller_run_retires_failed_session_before_reconnect;
they were interrupted. A focused run reproduced that wait, with the diagnostic
stack in its asyncio.run call at line 1121. The neighboring heartbeat-reconnect
test passed in isolation. Full-suite verification is therefore incomplete;
the cause of the existing reconnect-test wait remains unresolved. This audit
does not change runtime code or claim a fully passing baseline.
Subsequent implementation note: the
native provider foundation
addresses that ENS160 reconnect freshness-boundary defect. The results above
remain the historical audit record for 95fe1c9, not its current validation status.
Existing regression anchors include tests/test_controller_protocol.py,
test_imu.py, core/test_environmental.py, test_physical_context.py,
test_temporal_history.py, test_physical_assessment.py, test_semantic_events.py,
test_application_service.py, test_agent_permissions.py, test_mcp_server.py,
test_mcp_authentication_modes.py, test_api.py, test_web.py, and Vision/UI/voice
tests. Provider acceptance details belong in the linked design documents.
Future hardware verification: start the existing runtime with its active YAML; verify fresh native telemetry, eyes, permitted speech and semantic LED signals; disconnect each optional peer separately; verify native continuity and truthful stale/unavailable reads; reconnect and reject old-generation callbacks; stop PHOS and verify tasks/connections/subscriptions terminate. No deployment or physical execution is authorized by this documentation task.
Risks and unresolved decisions
| Risk/question | Required resolution before implementation expands |
|---|---|
| Pi 3 fan-out and source count | Choose global/per-provider queue and source limits, CPU/RSS/latency budgets from baseline measurement; never multiply the existing history allowance without a global cap. |
| Source identity across protocols | Choose stable configured IDs and explicit alias bindings; endpoint names and topic strings cannot establish physical identity. |
| Legacy source selection | Approve deterministic configured selection and migration when multiple sources exist; no silent newest-source switch. |
| Clocks and retention | Keep receipt monotonic TTLs; approve device-time trust/skew policy and history key evolution before using upstream timestamps. |
| Privacy granularity | Existing permissions are operation-level. Decide source/space filtering before exposing distributed occupancy or location. |
| Integration SDK support | Select/pin compatible optional libraries only after Python 3.11/Pi 3 installation and cancellation tests; no dependency chosen by this audit. |
| Firmware and bridge versions | Inspect pinned companion sources and run integration checks before claiming end-to-end compatibility. |
| Fusion semantics | Approve the first explicit rule and evidence requirements; no generic confidence scoring or safety/medical conclusions. |
| Documentation drift | Reconcile historical configuration/MCP/module wording in a separate bounded cleanup; preserve release records. |
Security, privacy, failure isolation, and compatibility requirements in the linked documents are acceptance constraints, not claims of completed hardening.