Outbound ports
Outbound ports (core/ports/outbound/*.ts) define the contracts that adapters implement: file I/O, HTTP, database, secrets, events, chat runtime, etc. This is the “driven” surface of the hexagonal core.
Source of truth: core/ports/outbound/.
Pattern
Section titled “Pattern”Each port is a pure TypeScript interface. The core never knows the concrete implementation — it always receives an instance that satisfies the interface, provided by composition.
export interface Filesystem { read(path: string): Promise<string>; readJson<T = unknown>(path: string): Promise<T>; writeJson(path: string, value: unknown): Promise<void>; exists(path: string): Promise<boolean>; rm(path: string, options?: { recursive?: boolean }): Promise<void>; // ...}The concrete adapter (adapters/outbound/filesystem/fs-filesystem.ts) implements the interface. For tests, an InMemoryFilesystem or a fake also satisfies the contract.
Inventory by category
Section titled “Inventory by category”The main outbound ports shipped, grouped by responsibility.
General infrastructure
Section titled “General infrastructure”clock.ts— clock (now())id-generator.ts— stable ID generationfilesystem.ts— local file read/write (with allowlist)arka-home.ts— resolution of the~/.arka-deck/folderevent-bus.ts— typed in-process event buschecksum-computer.ts— checksum computation (files, artifacts)
Business storage
Section titled “Business storage”chat-session-store.ts— chat sessions (SQLite)chat-attachment-store.ts— session attachmentsagent-action-card-store.ts— agent action cardsarkadoc-store.ts,arkadoc-manifest-store.ts,arkadoc-file-activity-store.ts— project documentscatalogue-cache.ts— Cortex catalogue cacheconnector-execution-store.ts,connector-installation-store.ts,connector-action-grant-store.ts— external connectors
Cortex HTTP clients
Section titled “Cortex HTTP clients”catalogue-client.ts— HYOS profiles from the public Cortexcatalogue-blocs-client.ts— blocs from Cortexarkadoc-cortex-client.ts— ArkaDoc sync with Cortexatoms-client.ts— Cortex atomscortex-lite-materialization-source.ts— project materialization source
Chat and providers
Section titled “Chat and providers”chat-runtime.ts— LLM turn execution (streaming)before-turn-augmenter.ts— context injection before a turnagent-identity-context-client.ts— agent identity context
Materializers
Section titled “Materializers”agent-workspace-materializer.ts— agents materialized as local files
Connectors
Section titled “Connectors”connector-registry.ts— external connectors registry
Secrets
Section titled “Secrets”secret-cipher.ts— encryption/decryption (AES-256-GCM default)
Three implementation families
Section titled “Three implementation families”| Prefix | Family | Usage |
|---|---|---|
Fs* | Filesystem | Local file read/write |
Sqlite* | SQLite | Relational local storage |
Http* | HTTP | Public Cortex or Cortex Lite clients |
InMemory* | In-memory | Tests, fakes |
Each port has at least one production implementation and a testable fake.
When to create a new outbound port
Section titled “When to create a new outbound port”- You need a new external dependency (new service, new data source).
- Several implementations may exist (e.g.
Fs*+Http*). - The interface must be mockable for tests.
Avoid creating ports for pure utilities (computation, formatting) — keep them in core/_shared/ or in the domain.
See also
Section titled “See also”- Overview: ./overview
- Inbound ports: ./ports-inbound
- Composition root: ./composition-root
- Storage: ./stockage