# Dependency Graph

The Rust workspace is acyclic. An arrow in the diagram means "depends on";
arrows point from a consumer to the lower-level crate or layer it consumes.

```mermaid
flowchart TB
    core["aip-core"]
    schema["aip-schema"]
    crypto["aip-crypto"]
    auth["aip-auth"]
    discovery["aip-discovery"]
    runtime["aip-runtime"]
    storage["aip-storage-postgres"]
    connector_sdk["aip-connector"]
    connectors["aip-connector-* implementations"]
    transports["aip-transport and aip-transport-*"]
    profiles["aip-profile-*"]
    gateway["aip-gateway"]
    mcp_server["aip-mcp-server"]
    mcp_client["aip-mcp-client"]
    daemon["aipd"]
    cli["aipctl"]
    facade["aip facade"]

    schema --> core
    crypto --> core
    auth --> core
    discovery --> schema
    discovery --> core
    runtime --> auth
    runtime --> crypto
    runtime --> discovery
    runtime --> schema
    storage --> runtime
    connector_sdk --> core
    connectors --> connector_sdk
    transports --> core
    profiles --> core
    gateway --> runtime
    gateway --> connector_sdk
    gateway --> profiles
    gateway --> transports
    mcp_server --> gateway
    mcp_server --> profiles
    mcp_client --> profiles
    mcp_client --> transports
    daemon --> gateway
    daemon --> storage
    daemon --> connectors
    daemon --> mcp_server
    cli --> profiles
    cli --> transports
    facade --> core
    facade --> gateway
    facade --> profiles
    facade --> transports
    facade --> connector_sdk
```

## Boundary Rules

- `aip-core` has no runtime, network, profile, connector, or mandatory schema
  tooling dependency. Its optional `schema` feature enables `schemars` derives
  for `aip-schema` without changing runtime behavior.
- `aip-runtime` owns native lifecycle semantics. It does not depend on product
  connectors or compatibility profiles.
- `aip-gateway` composes native runtime, connectors, profiles, and transports.
  It is embedded by `aipd`, tests, and application hosts.
- `aipctl` is a transport client and conformance operator. It does not embed the
  gateway or become part of server execution.
- `aip` is a feature-gated public facade. Depending on it with a feature makes
  the corresponding lower-level crate part of the consumer's build; it does
  not create a reverse dependency from those crates to the facade.

Cargo metadata is the source of truth for exact crate edges. This diagram
documents architectural ownership, not every third-party dependency.
