Skip to content

Existing Projects

Adding LumenFlow to an existing project takes about 15 minutes. This guide walks through the process without disrupting your current workflow.

Before starting:

  • Git repository (any platform)
  • Node.js 22+ (for CLI)
  • Understanding of Work Units and Gates

LumenFlow adds:

  • workspace.yaml - Configuration file
  • LUMENFLOW.md - Workflow entry point
  • .lumenflow/ - State and constraints
  • docs/tasks/ - WU specs and backlog (optional)
  • Git hooks for enforcement (optional)

It does not require:

  • Changing your existing code structure
  • Migrating existing tickets immediately
  • Modifying CI/CD pipelines (optional enhancement)
  • Team-wide adoption at once

The CLI provides the fastest path to adoption.

  1. Install the CLI

    bash pnpm add -D @lumenflow/cli
  2. Initialize LumenFlow

    pnpm lumenflow

    Answer the prompts or use flags for non-interactive setup:

    pnpm lumenflow \
      --framework nextjs \
      --main-branch main \
      --docs-structure simple

    Agent onboarding docs are included by default. Use --minimal to skip them.

    Adding to existing config files? Use --merge mode to safely insert LumenFlow configuration into your existing AGENTS.md or other files without overwriting your content:

    pnpm lumenflow --merge

    The merge mode uses bounded markers (<!-- LUMENFLOW:START --> and <!-- LUMENFLOW:END -->) to safely insert and update the LumenFlow block. Running --merge twice produces no changes on the second run (idempotent).

    Using a specific AI coding tool? There is no --client/--vendor flag any more — pnpm lumenflow always scaffolds the same universal surfaces (AGENTS.md, LUMENFLOW.md, .lumenflow/skills/, workspace.yaml) for every project, regardless of which AI tool you use. Point your tool at those files directly, or adapt them into your tool’s own config/rules/ instruction mechanism yourself — see AI Coding Assistant Integrations for how.

  3. Review generated files

    The init command creates (agent onboarding docs are now included by default):

    • workspace.yaml (your configuration) - LUMENFLOW.md (workflow entry point) - AGENTS.md (universal AI agent entry point) - .lumenflow/ - constraints.md (non-negotiable rules) - agents/ (AI agent guidance) - docs/tasks/ - backlog.md - status.md - wu/ (WU spec directory) - _frameworks/lumenflow/agent/onboarding/ - quick-ref-commands.md (CLI command reference) - first-wu-mistakes.md (common pitfalls) - troubleshooting-wu-done.md (wu:done issues) - agent-safety-card.md (safety reference)

    Use --minimal to skip agent onboarding docs if you want a lighter setup.

    lumenflow init no longer creates any vendor-specific overlay files (no CLAUDE.md, .cursor/, .windsurf/, etc.) — the universal surfaces above are all that get scaffolded. Adapt them into your own AI tool’s native format yourself; see AI Coding Assistant Integrations.

  4. Add scripts to package.json

    {
      "scripts": {
        "wu:create": "wu-create",
        "wu:claim": "wu-claim",
        "wu:prep": "wu-prep",
        "wu:done": "wu-done",
        "gates": "gates"
      }
    }
  5. Git hooks (auto-scaffolded)

    lumenflow init automatically creates .husky/pre-commit (blocks main commits) and scripts/safe-git (blocks dangerous git operations). To also run gates on commit:

    # Optional: Add gates to pre-commit
    echo 'npx gates --quick' >> .husky/pre-commit

Most projects already have the tools LumenFlow gates run. Map them:

| Gate | Your Existing Command | LumenFlow Config | | --------- | --------------------- | --------------------------- | | Format | npm run prettier | gates.execution.format | | Lint | npm run eslint | gates.execution.lint | | Typecheck | npm run tsc | gates.execution.typecheck | | Test | npm test | gates.execution.test |

Example mapping:

gates:
  execution:
    format: 'npm run prettier -- --check'
    lint: 'npm run eslint'
    typecheck: 'npm run tsc --noEmit'
    test: 'npm test'

If you have team branches or areas:

| Current Branches | LumenFlow Lanes | | ------------------------- | ---------------------------- | | feature/*, frontend-* | Experience: UI | | api/*, backend-* | Framework: Core | | infra/*, devops-* | Operations: Infrastructure | | docs/* | Content: Documentation |

Each pull request or ticket becomes a Work Unit:

| PR/Ticket Field | WU Field | | --------------- | -------------- | | Title | title | | Description | description | | Labels | lane, type | | Acceptance | acceptance | | Assignee | assigned_to |

You don’t need to migrate everything at once.

Run LumenFlow alongside existing workflow:

  1. Install and configure
  2. Create WUs for new work only
  3. Keep using existing tickets for in-progress work
  4. Run gates manually to test
  1. New work starts as WUs
  2. Existing PRs complete normally
  3. When a PR completes, optionally create a retroactive WU for history
  4. Team familiarizes with commands
  1. All new work uses WUs
  2. Close out ticket system (or keep for roadmap/epics)
  3. Enable git hooks (auto-scaffolded by lumenflow init)

LumenFlow handles execution. Keep your roadmap tool:

Product Roadmap (Linear/Notion/Jira)
    ↓ Quarterly planning
Initiatives (INIT-001, INIT-002)
    ↓ Broken into
Work Units (WU-001, WU-002, ...)
    ↓ Executed via
LumenFlow

Link them:

# WU-042.yaml
id: WU-042
title: Add search autocomplete
initiative: INIT-008
external_refs:
  - 'LINEAR-1234'
  - 'JIRA-ABC-567'

Not everyone needs to adopt simultaneously:

| Role | Adoption Level | | --------------- | ---------------------------- | | AI Agents | Full LumenFlow (required) | | Backend Team | Full LumenFlow (recommended) | | Frontend Team | Gradual adoption | | Product Manager | Continues using roadmap tool |

LumenFlow gates can run in CI without replacing your existing pipeline:

# .github/workflows/gates.yml
name: LumenFlow Gates
on: [pull_request]

jobs:
  gates:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: hellmai/lumenflow/actions/lumenflow-gates@v4
        with:
          skip-on-no-wu: true # Only run if WU exists

Re-running init to backfill missing entries

Section titled “Re-running init to backfill missing entries”

Running lumenflow init on a repo that already has LumenFlow files is safe. For the .gitignore specifically, init checks each entry in REQUIRED_GITIGNORE_EXCLUSIONS against the existing file and appends only the missing ones under a # LumenFlow (auto-added) header. No existing entries are modified or duplicated.

This is useful after upgrading @lumenflow/cli when new ephemeral paths have been added to the exclusion list. For example, if your .gitignore is missing entries for .lumenflow/checkpoints/ or .lumenflow/locks/, re-running init will add them:

pnpm lumenflow

Ignore rules do not untrack files that are already in the index. Audit the local kernel tree first, then remove only the runtime paths you deliberately selected from the index. --cached preserves the local files:

# Include both root and nested workspace paths in this Git repository:
git ls-files -- '.lumenflow/kernel/**' ':(glob)**/.lumenflow/kernel/**'
# Review the output, then pass only those exact tracked files to:
git rm --cached -- <reviewed-file> [<reviewed-file>...]
git add .gitignore
git commit -m "fix: keep kernel runtime state local"

Repeat init or upgrade and this audit inside every independent nested Git repository; a parent repository’s ignore rules never apply across that boundary.

Treat .lumenflow/kernel/ as sensitive operational state. For a complete recoverable backup, stop and drain every runtime using the workspace, then capture the whole tree coherently. Never copy the active SQLite database alone: its WAL may contain committed pages and the surrounding task specs, migration state, and evidence are part of the recovery point. The -shm sidecar is transient and stale lock files are not restore payloads. SQLite’s Online Backup API or VACUUM INTO is suitable only for an explicitly database-only copy; it does not freeze the rest of the runtime tree.

You don’t need to migrate them. Options:

  1. Ignore old tickets - Start fresh with WUs for new work
  2. Migrate incrementally - Convert tickets as you work on them
  3. Bulk migrate - Script conversion of existing tickets to WU YAML

”Our team isn’t ready for trunk-based development”

Section titled “”Our team isn’t ready for trunk-based development””

LumenFlow supports gradual transition:

  1. Start with worktrees (isolated, like feature branches)
  2. Gates run in worktrees, merge when passing
  3. This feels like PRs but with automated quality

LumenFlow doesn’t eliminate review, it changes when:

  • Gates replace mechanical review (format, lint, types, tests)
  • Human review for security, architecture, judgment calls
# WU spec
requires_review: true
reviewers:
  - security@company.com

Use gate presets with test splitting:

gates:
  execution:
    test: 'npm test -- --shard=1/3' # Parallel shards
    test_timeout: 300000 # 5 minute timeout

Or run fast tests in gates, slow tests in CI.

After setup, verify everything works:

# 1. Create a test WU
pnpm wu:create \
  --title "Test LumenFlow setup" \
  --lane "Operations: Infrastructure" \
  --type documentation \
  --exposure documentation \
  --description "Verify LumenFlow CLI works in this repo" \
  --acceptance "WU can be claimed, prepped, and completed"

# 2. Claim it
# Use the generated ID from the output (example: WU-123)
pnpm wu:claim --id WU-123 --lane "Operations: Infrastructure"
pnpm wu:brief --id WU-123 --client <client>

# 3. Make a trivial change in worktree
cd worktrees/operations-infrastructure-wu-123
echo "# LumenFlow works" >> README.md

# 4. Run gates in worktree
pnpm wu:prep --id WU-123

# 5. Complete (from main checkout)
cd /path/to/main
pnpm wu:done --id WU-123

# 6. Check results
ls .lumenflow/state/packs/software-delivery/stamps/WU-123.done  # Should exist