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:

  • .lumenflow.config.yaml - Configuration file
  • LUMENFLOW.md - Workflow entry point
  • .lumenflow/ - State and constraints
  • docs/04-operations/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 exec lumenflow

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

    pnpm exec lumenflow \
      --framework nextjs \
      --main-branch main

    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 exec 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? Use the --client flag to generate client-specific overlay files:

    # Claude Code / Claude in IDE
    pnpm exec lumenflow --client claude
    
    # Cursor IDE
    pnpm exec lumenflow --client cursor
    
    # Windsurf IDE
    pnpm exec lumenflow --client windsurf
    
    # All clients
    pnpm exec lumenflow --client all
  3. Review generated files

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

    • .lumenflow.config.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/04-operations/ - 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.

    With --client flags, additional overlay files are created:

    Client FlagFiles Created
    --client claudeCLAUDE.md
    --client cursor.cursor/rules/lumenflow.md
    --client windsurf.windsurf/rules/lumenflow.md
    --client allAll of the above
  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:

GateYour Existing CommandLumenFlow Config
Formatnpm run prettiergates.execution.format
Lintnpm run eslintgates.execution.lint
Typechecknpm run tscgates.execution.typecheck
Testnpm testgates.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 BranchesLumenFlow 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 FieldWU Field
Titletitle
Descriptiondescription
Labelslane, type
Acceptanceacceptance
Assigneeassigned_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:

RoleAdoption Level
AI AgentsFull LumenFlow (required)
Backend TeamFull LumenFlow (recommended)
Frontend TeamGradual adoption
Product ManagerContinues 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-gates@v1
        with:
          skip-on-no-wu: true # Only run if WU exists

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 (see Migration Guide)

“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 exec 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 exec wu-claim --id WU-123 --lane "Operations: Infrastructure"

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

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

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

# 6. Check results
ls .lumenflow/stamps/WU-123.done  # Should exist