docs/adr/0002-monorepo-native-contract.md

ADR 0002: Monorepo-Native Wire Contract

  • Status: Accepted
  • Date: 2026-07-05

Context

The monorepo migration makes the Clanky checkout the canonical source for the agent, private iOS app, ClankVox, and the shared TypeScript wire contract. The iOS app consumed @clanky/contract through a pinned public git dependency on the old Volpestyle/clanky-contract repo, and the agent carried a duplicate contract package under clanky-agent/packages/.

That kept release builds working, but it preserved a second source of truth and blocked archiving the old contract repo.

Decision

clanky-contract/ at the top level of the monorepo is the only contract source. Both package-local pnpm workspaces include it as an external workspace package:

packages:
  - ../clanky-contract

The agent and iOS app both depend on it as:

"@clanky/contract": "workspace:*"

The agent-local duplicate package is removed. The public Volpestyle/clanky-contract git dependency is no longer part of the mobile release path.

Consequences

  • Wire-shape changes land atomically with the agent and iOS code that consumes them.
  • EAS still runs from clanky-ios/apps/mobile, with eas.json in the app root. The internal full checkout is the source of the private TestFlight release lane, so the top-level clanky-contract/ package is available to pnpm during cloud installs.
  • The old public contract repo can be archived once a fresh TestFlight build verifies the workspace dependency in EAS.
  • Package-local lockfiles remain in place; this does not consolidate every JavaScript package into one root workspace yet.