Skip to content

Package Architecture

LumenFlow is a TypeScript monorepo with clear dependency boundaries between packages. This page explains the package graph, what each package contains, and how packs are built and distributed.

Diagram

The CLI package sits at the top of the dependency graph. Leaf packages (core, memory, agent, metrics, initiatives) are independently buildable. The kernel is standalone with minimal external dependencies. The pack has a unique dual relationship: it imports kernel types at compile time, but loads CLI modules at runtime via the runtime CLI adapter.

PackagePathRoleKey Dependencies
@lumenflow/clipackages/@lumenflow/cli110+ CLI commands, each exporting main()core, memory, agent, metrics, initiatives, kernel
@lumenflow/corepackages/@lumenflow/coreWU types, YAML parsing, validation, configurationzod, yaml, fast-glob
@lumenflow/kernelpackages/@lumenflow/kernelKernelRuntime, ToolHost, scope intersection, policy engine, evidence store, sandbox dispatchzod, yaml, micromatch
@lumenflow/memorypackages/@lumenflow/memorySession tracking, checkpoints, signals, context recovery(minimal)
@lumenflow/agentpackages/@lumenflow/agentAgent coordination, delegation, spawn management(minimal)
@lumenflow/metricspackages/@lumenflow/metricsFlow metrics collection and reporting(minimal)
@lumenflow/initiativespackages/@lumenflow/initiativesMulti-WU initiative tracking and wave orchestration(minimal)
@lumenflow/runtimepackages/@lumenflow/runtimeRuntime surface for programmatic API usagekernel
@lumenflow/mcppackages/@lumenflow/mcpMCP (Model Context Protocol) server for AI agent integrationkernel
@lumenflow/shimspackages/@lumenflow/shimsGit safety shims (pre-commit, pre-push hooks)(none)
software-deliverypackages/@lumenflow/packs/software-delivery90+ tool implementations for software development workflowskernel (types only)

The pnpm bootstrap command builds the CLI and all its workspace dependencies in the correct order:

turbo build --filter=@lumenflow/cli

Turbo’s ^build dependency means “build all workspace dependencies first.” This produces a build order like:

Diagram

Phase 1 packages have no workspace dependencies, so they build in parallel. The CLI builds last because it depends on all of them.

The Software Delivery Pack is bundled into the CLI package for npm distribution. A sync-bundled-packs.mjs script handles this:

Diagram

The CLI’s package.json files array includes "packs", ensuring the bundled pack ships with the npm package. The prepack hook runs sync automatically before npm publish.

When the kernel starts, it resolves pack locations using resolvePacksRoot() with this priority:

  1. Workspace packs directory{workspaceRoot}/packs/ (for projects with local packs)
  2. Monorepo development path{workspaceRoot}/packages/@lumenflow/packs/ (for LumenFlow development)
  3. CLI-relative fallback{cliPackageRoot}/packs/ (for end-user npm installs)
Diagram