AI Agent Integration
LumenFlow treats AI agents as first-class collaborators. This guide covers how to work effectively with AI assistants.
AI as Teammate
Section titled “AI as Teammate”LumenFlow is designed for AI agents to:
- Understand work context (WU specs)
- Execute autonomously (clear acceptance)
- Prove completion (gates + stamps)
- Recover context (memory layer)
Agent Onboarding
Section titled “Agent Onboarding”Provide agents with:
- WU Spec – The work to be done
- Acceptance Criteria – Definition of done
- Code Paths – Where to work
- Memory Context – What happened before
Prompt Template
Section titled “Prompt Template”## 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 blur2. Invalid emails show "Please enter a valid email"3. Valid emails allow form submission4. Unit test covers validation logic
## Code Paths
- src/components/LoginForm.tsx- src/utils/validation.ts
## Instructions
1. Work in worktree: worktrees/ui-wu-0422. Implement changes per acceptance3. Run: pnpm gates4. When done: pnpm wu:done --id WU-042Memory Integration
Section titled “Memory Integration”For long-running agent sessions:
# Agent starts sessionpnpm mem:start --wu WU-042
# Agent signals progresspnpm mem:signal "Validation logic complete"
# Agent creates checkpoint (before pause/context limit)pnpm mem:checkpoint
# Agent resumes laterpnpm mem:ready# → Shows previous progressContext Recovery
Section titled “Context Recovery”When an agent session ends and a new one begins:
# New agent runspnpm mem:ready
# Output:# WU-042 in progress# Last signal: "Validation logic complete"# Files touched: src/utils/validation.ts# Next: Add unit testsThe agent can continue where the previous session left off.
Autonomous Execution
Section titled “Autonomous Execution”For trusted agents, enable autonomous mode:
# WU specautonomous: trueapproval_required: falseThe agent can:
- Claim and complete without human approval
- Make decisions within scope
- Log decisions for audit
Safety Guardrails
Section titled “Safety Guardrails”Scope Limits
Section titled “Scope Limits”Define what agents can and cannot do:
agent: allowed_paths: - src/** - tests/** forbidden_paths: - .env* - secrets/** max_file_changes: 10Approval Gates
Section titled “Approval Gates”Require human approval for certain actions:
agent: require_approval_for: - delete_files - modify_config - external_api_callsEscalation
Section titled “Escalation”Agents should escalate when:
- Acceptance criteria are unclear
- Security concerns arise
- Scope seems larger than WU
pnpm wu:escalate --id WU-042 --reason "Unclear: should validation be server-side too?"Multi-Agent Coordination
Section titled “Multi-Agent Coordination”When multiple agents work in parallel:
Lane Isolation
Section titled “Lane Isolation”Each agent works in a separate lane:
Agent A → Lane: UI → WU-100Agent B → Lane: Core → WU-101Agent C → Lane: Infra → WU-102No conflicts, parallel progress.
Dependency Handling
Section titled “Dependency Handling”If WUs depend on each other:
# WU-101dependencies: - WU-100 # Agent B waits for Agent AAgent B blocks until WU-100 is done.
Agent Types
Section titled “Agent Types”Coding Agent
Section titled “Coding Agent”Implements code per WU spec:
- Writes code
- Writes tests
- Runs gates
- Completes WU
Review Agent
Section titled “Review Agent”Reviews completed WUs:
- Checks code quality
- Validates against acceptance
- Suggests improvements
Discovery Agent
Section titled “Discovery Agent”Explores and documents:
- Research spikes
- Architecture decisions
- Documentation updates
Best Practices
Section titled “Best Practices”For Human-Agent Collaboration
Section titled “For Human-Agent Collaboration”- Clear WU specs – Agents need explicit acceptance
- Small WUs – Easier for agents to complete
- Frequent checkpoints – Recover from context limits
- Review agent work – Trust but verify
For Fully Autonomous Agents
Section titled “For Fully Autonomous Agents”- Strict scope limits – Prevent runaway changes
- Gate enforcement – Quality checks are non-negotiable
- Audit trails – Log all decisions and actions
- Kill switch – Ability to pause/stop agent work
Next Steps
Section titled “Next Steps”- Memory Layer – Context persistence details
- CLI Reference – Agent-relevant commands