Skip to content

AI Agent Integration

LumenFlow treats AI agents as first-class collaborators. This guide covers how to work effectively with AI assistants.

LumenFlow is designed for AI agents to:

  • Understand work context (WU specs)
  • Execute autonomously (clear acceptance)
  • Prove completion (gates + stamps)
  • Recover context (memory layer)

Provide agents with:

  1. WU Spec – The work to be done
  2. Acceptance Criteria – Definition of done
  3. Code Paths – Where to work
  4. Memory Context – What happened before
## Context
You are working on WU-042 in the LumenFlow workflow.
## Work Unit
- ID: WU-042
- Title: Add email validation to login form
- Lane: UI
- Status: in_progress
## Acceptance Criteria
1. Email field validates on blur
2. Invalid emails show "Please enter a valid email"
3. Valid emails allow form submission
4. Unit test covers validation logic
## Code Paths
- src/components/LoginForm.tsx
- src/utils/validation.ts
## Instructions
1. Work in worktree: worktrees/ui-wu-042
2. Implement changes per acceptance
3. Run: pnpm gates
4. When done: pnpm wu:done --id WU-042

For long-running agent sessions:

Terminal window
# Agent starts session
pnpm mem:start --wu WU-042
# Agent signals progress
pnpm mem:signal "Validation logic complete"
# Agent creates checkpoint (before pause/context limit)
pnpm mem:checkpoint
# Agent resumes later
pnpm mem:ready
# → Shows previous progress

When an agent session ends and a new one begins:

Terminal window
# New agent runs
pnpm mem:ready
# Output:
# WU-042 in progress
# Last signal: "Validation logic complete"
# Files touched: src/utils/validation.ts
# Next: Add unit tests

The agent can continue where the previous session left off.

For trusted agents, enable autonomous mode:

# WU spec
autonomous: true
approval_required: false

The agent can:

  • Claim and complete without human approval
  • Make decisions within scope
  • Log decisions for audit

Define what agents can and cannot do:

.lumenflow.config.yaml
agent:
allowed_paths:
- src/**
- tests/**
forbidden_paths:
- .env*
- secrets/**
max_file_changes: 10

Require human approval for certain actions:

agent:
require_approval_for:
- delete_files
- modify_config
- external_api_calls

Agents should escalate when:

  • Acceptance criteria are unclear
  • Security concerns arise
  • Scope seems larger than WU
Terminal window
pnpm wu:escalate --id WU-042 --reason "Unclear: should validation be server-side too?"

When multiple agents work in parallel:

Each agent works in a separate lane:

Agent A → Lane: UI → WU-100
Agent B → Lane: Core → WU-101
Agent C → Lane: Infra → WU-102

No conflicts, parallel progress.

If WUs depend on each other:

# WU-101
dependencies:
- WU-100 # Agent B waits for Agent A

Agent B blocks until WU-100 is done.

Implements code per WU spec:

  • Writes code
  • Writes tests
  • Runs gates
  • Completes WU

Reviews completed WUs:

  • Checks code quality
  • Validates against acceptance
  • Suggests improvements

Explores and documents:

  • Research spikes
  • Architecture decisions
  • Documentation updates
  1. Clear WU specs – Agents need explicit acceptance
  2. Small WUs – Easier for agents to complete
  3. Frequent checkpoints – Recover from context limits
  4. Review agent work – Trust but verify
  1. Strict scope limits – Prevent runaway changes
  2. Gate enforcement – Quality checks are non-negotiable
  3. Audit trails – Log all decisions and actions
  4. Kill switch – Ability to pause/stop agent work