Architecture
Monorepo structure, key packages, data flow, and build system overview for pair contributors.
An overview of how the pair codebase is organized, how the packages relate to each other, and how data flows from the Knowledge Base to your AI assistant.
Monorepo layout
pair is a pnpm workspace monorepo using Turborepo for task orchestration and build caching.
Key packages
| Package | Scope | Description |
|---|---|---|
@pair/pair-cli | apps/pair-cli | CLI tool for KB installation, update, packaging, and validation. Entry point for developers using pair. |
@pair/website | apps/website | Documentation site built with Fumadocs (Next.js 15) + Orama search. Hosted on Vercel. |
@pair/knowledge-hub | packages/knowledge-hub | The Knowledge Base dataset — guidelines, how-tos, templates, and skills. Distributed as a GitHub release artifact. |
@pair/content-ops | packages/content-ops | File operations and markdown link processing library. Used by the CLI for KB manipulation. |
@pair/brand | packages/brand | Brand identity — design tokens, React components, and Tailwind preset. |
Shared tooling
The tools/ directory contains workspace-internal configuration packages:
- eslint-config — Shared ESLint rules for all packages.
- prettier-config — Shared Prettier formatting.
- markdownlint-config — Shared markdown linting for KB content.
- ts-config — Shared TypeScript presets (base, library, app).
Data flow
- Contributors add or update KB content in
packages/knowledge-hub/dataset/. - CI packages the KB into a versioned ZIP and publishes it as a GitHub Release artifact.
- Developers run
pair install— the CLI downloads the KB and creates the.pair/directory. - AI agents read
.pair/for guidelines, adoption files, and how-tos. Skills are distributed to.claude/skills/(and other tool directories).
The .pair/ directory
The .pair/ directory is the interface between pair and AI assistants. It contains two top-level areas:
adoption/— Project-specific decisions (architecture, tech stack, way of working). These are generated through the pair workflow and reflect your team's choices.knowledge/— Universal content (guidelines, how-tos, templates, skills guide). This comes from the Knowledge Base and is shared across all projects.
For the full .pair/ structure and file descriptions, see the KB Structure Reference.
Build system
Turborepo manages the build pipeline:
- Tasks are defined in
turbo.jsonwith dependency relationships. - Build results are cached — unchanged packages skip rebuilding.
pnpm quality-gateruns the full validation pipeline (type check → test → lint → format → markdown lint).
Key Turbo tasks: build, test, lint, ts:check, dev.
For build commands and development workflow, see the Development Setup guide.