AI Agent Integration
LumenFlow treats AI agents as first-class collaborators. This guide covers how to work effectively with AI assistants.
Integration Options
Section titled “Integration Options”LumenFlow provides three ways for AI agents to interact with the workflow:
| Interface | Best For | Setup |
|---|---|---|
| File-based | Any AI that can read markdown | Point AI at AGENTS.md |
| CLI | Terminal-based agents, scripts | pnpm wu:claim, etc. |
| MCP | Programmatic access via MCP protocol | Setup Guide |
The MCP server (@lumenflow/mcp) exposes workflow tools and resources over the Model Context Protocol, enabling AI assistants to interact with LumenFlow programmatically. See the MCP Reference for available tools.
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”Memory Integration
Section titled “Memory Integration”For long-running agent sessions:
Context Recovery
Section titled “Context Recovery”When an agent session ends and a new one begins:
The agent can continue where the previous session left off.
Autonomous Execution
Section titled “Autonomous Execution”For trusted agents, enable autonomous mode:
The agent can:
- Claim and complete without human approval
- Make decisions within scope
- Log decisions for audit
Safety Guardrails
Section titled “Safety Guardrails”LumenFlow provides defense-in-depth safety for AI agents through the kernel runtime, not just repository-level hooks.
Kernel-Level Enforcement
Section titled “Kernel-Level Enforcement”Every tool call passes through the kernel’s authorization gate before execution:
-
Scope intersection — The kernel computes workspace ∩ lane ∩ task ∩ tool permissions. An agent working in lane
Framework: Corecannot write toapps/even if it tries — the intersection is empty, so the call is denied. -
Policy evaluation — Pack-declared policies use a deny-wins cascade. A
denyat any layer (workspace, lane, pack, or task) is final and cannot be reversed. Gates, path restrictions, and approval requirements are all policies. -
Evidence recording — Every tool call is recorded with content-addressed inputs, scope enforcement results, and policy decisions. Even denied calls produce evidence — the audit trail has no gaps.
-
Reserved path protection — Writes to
.lumenflow/**are denied unconditionally. The kernel’s own state is tamper-proof.
Subprocess Isolation
Section titled “Subprocess Isolation”Write operations and anything requiring OS-level isolation run in sandboxed subprocesses. On Linux, the kernel uses bwrap (bubblewrap) to create lightweight sandboxes that restrict filesystem access, network access, and system calls. The subprocess can only access paths within the computed scope intersection.
Repository-Level Safety
Section titled “Repository-Level Safety”Additional protections work for all agents regardless of IDE or AI provider:
Git Safety Wrapper (scripts/safe-git):
Husky Pre-Commit Hooks:
- Secret scanning (AWS/GitHub/OpenAI keys)
- Absolute path scanning (common home-dir absolute paths; prefer
~or relative paths) - Lockfile sync validation
- Worktree discipline enforcement
Escalation
Section titled “Escalation”Agents should escalate when:
- Acceptance criteria are unclear
- Security concerns arise
- Scope seems larger than WU
Cloud Agent Branches
Section titled “Cloud Agent Branches”Cloud-hosted agents (like Prompt Studio, GitHub Actions, or custom automation) that create their own branches can bypass worktree requirements.
Configuration
Section titled “Configuration”Add patterns to your config to allow specific branch prefixes:
How It Works
Section titled “How It Works”When a branch matches an agentBranchPatterns glob:
- Worktree requirement bypassed – Agent can work in main checkout
- Git shim allows destructive commands – Agent manages its own isolation
- Write/Edit hooks allow file changes – No worktree check enforced
Headless Mode for CI/CD
Section titled “Headless Mode for CI/CD”For pipelines that don’t use branch patterns, enable guarded headless mode:
This bypasses worktree checks for automation that manages its own isolation.
Detection Priority
Section titled “Detection Priority”The system evaluates in this order (first match wins):
- Headless mode (if guarded) → bypass
- Detached HEAD → protected (fail-closed)
- Agent branch pattern match → bypass
- Protected branch → protected
- Lane branch → protected (use worktree)
- Unknown branch → protected (fail-closed)
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:
No conflicts, parallel progress.
Dependency Handling
Section titled “Dependency Handling”If WUs depend on each other:
Agent 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
Skills
Section titled “Skills”LumenFlow supports agent skills — modular knowledge bundles that provide domain expertise and validation checklists. Skills are stored in .claude/skills/ (for Claude Code) or .lumenflow/skills/ (vendor-agnostic).
Available Skills
Section titled “Available Skills”| Skill | Purpose |
|---|---|
wu-lifecycle | WU claim/block/done workflow automation |
worktree-discipline | Prevent absolute path trap in worktrees |
tdd-workflow | RED-GREEN-REFACTOR, test-driven development |
lumenflow-gates | Gate troubleshooting (format/lint/typecheck) |
library-first | Validate libraries exist before custom code |
context-management | Session checkpoints, sub-agent spawning |
bug-classification | P0-P3 triage, fix-in-place vs Bug WU |
code-quality | SOLID/DRY patterns, TypeScript standards |
multi-agent-coordination | Git branch locking for parallel WUs |
orchestration | Agent dashboard, initiative execution |
execution-memory | Session tracking, context recovery |
initiative-management | Multi-phase INIT-XXX coordination |
frontend-design | React/UI component patterns |
ops-maintenance | Maintenance tasks, metrics, validation |
Loading Skills
Section titled “Loading Skills”Skills are loaded automatically by wu:brief based on WU context, or manually:
Skill Structure
Section titled “Skill Structure”Each skill has a SKILL.md with YAML frontmatter:
Configuration
Section titled “Configuration”Skills per lane can be configured in workspace.yaml:
Agents
Section titled “Agents”Pre-configured agent definitions for Task tool orchestration live in .claude/agents/:
| Agent | Model | Purpose |
|---|---|---|
general-purpose | opus | Standard WU implementation |
lumenflow-pm | opus | WU lifecycle, backlog management |
test-engineer | opus | TDD, coverage gaps |
code-reviewer | opus | PR review, quality checks |
lumenflow-enforcer | haiku | WU validation, gates enforcement |
bug-triage | haiku | Bug classification (P0-P3) |
lumenflow-doc-sync | haiku | Documentation synchronization |
Spawning Agents
Section titled “Spawning Agents”Use wu:brief to generate Task tool invocations with proper context:
Next Steps
Section titled “Next Steps”- Kernel Runtime — How every tool call is authorized and audited
- Scope Intersection — The 4-level permission model
- Policy Engine — Deny-wins rule evaluation
- Evidence Store — Immutable audit trail
- Memory Layer — Context persistence details
- CLI Reference — Agent-relevant commands