Skip to content

systems

Dylan McCavitt edited this page Jul 4, 2026 · 1 revision

Systems

Garnish is a single TypeScript package whose deployable artifacts (a garnish CLI and a Pi extension) compose the same core modules. This section documents the internal building blocks under src/, each as its own page with the module's purpose, layout, abstractions, control flow, and modification entry points.

Core domain schemas (pack, quest, level, checks, IDs, progression events) are foundational types shared across every system. They are documented under primitives rather than here, since a change to a primitive ripples through every consumer. Cross-cutting capabilities that span systems, such as capability gating and the curriculum, are documented under features.

  • Pi adapter: the only module that knows Pi specifics. Certified runtime install and version handshake (src/adapter/runtime.ts), gate config rendering (src/adapter/gates.ts), and the adapter contract assertions (src/adapter/contract.ts).
  • Pack loader: discovers packs, parses markdown frontmatter, validates against Zod schemas, and builds the quest graph with cycle detection (src/loader/index.ts).
  • Verification engine: evaluates the check DSL against live events and on-demand probes, with a debounced scheduler (src/verifier/index.ts).
  • Progression engine: folds the append-only event log into state and derives unlocks, XP, and badges (src/progression/index.ts).
  • CLI: the garnish CLI, onboarding wizard, status, unlock escape hatch, and doctor (src/cli/).
  • Extension: the Pi extension, event wiring, HUD, live unlocks, and tutor bridge (src/extension/).

For the architecture that connects these systems and the data flows between them, see architecture.

Clone this wiki locally