Lean Agentic Coding Workflow
A working synthesis of the workflow that emerged from ingesting and critiquing the agent engineering landscape. Not a framework — a set of composable, independently adoptable pieces. The AGENTS.md template encodes this workflow; this page explains why each piece exists.The Full Stack
Why Each Piece
grill-me-first
The most common failure mode in AI coding is starting implementation on misaligned requirements. Grill-me forces alignment before token spend. The session summary lives in PRD, not in the conversation. See: Agent Skills (grill/prd/issues), Dangeresque (AFK loop)Vertical slices (tracer bullets)
PRD → kanban DAG with HITL/AFK flags per task. Each task is a thin vertical slice through the full stack (UI → API → DB). Not horizontal layers (all frontend, then all backend). This means every slice is independently shippable and verifiable. Fails when: slices are too large to complete in a single AFK session, or the codebase has no clean vertical boundaries. See: Spec-Driven Frameworks vs Native Claude Code — vertical slices context; “for whom / fails when” analysisDangeresque (AFK loop)
Host-native (ToS-compliant), not containerized. Each task runs in a worktree (filesystem isolation); adversarial reviewer checks the result; human must merge. The reviewer is a different model or provider — single-model review catches nothing new. See: Dangeresque, Worktree Isolation, Multi-Vendor Adversarial ReviewCouncil (not adversarial review)
Council is for design decisions, not code review. When two valid approaches exist, when security design is in scope, or when a major component is being designed — call council before implementing, not after..agents/decisions.md. That file persists across sessions.
See: Council Pattern, Karpathy LLM Council
lean-session plugin
Fires onsession.idle and session.compacting. On idle: writes a structured checkpoint (git state, task list, changed files, loop iteration) to .agents/checkpoint.md. On compacting: injects .agents/ state into the LLM continuation summary so the active task survives context compression.
This is what makes clear-over-compact safe for interactive sessions. Without it, compaction loses .agents/ state.
See: lean-session plugin, OpenCode, Context Compression Strategies
Self-correction
When the agent deviates from workflow (implements without grill, skips verify, etc.), it should query the wiki oracle before proceeding:wiki/concepts/agent-self-correction.md. This is a pull-based correction mechanism — no harness enforcement, but zero startup overhead.
See: Agent Self-Correction, Rules vs. Hooks
Model Routing
All model routing via env vars — never hardcode:
Council must be cross-vendor from the implementation model — same-vendor council finds the same blind spots.
See: Multi-Vendor Adversarial Review, AgentOps (boshu2)
Session State
.agents/ directory convention originates with AgentOps (boshu2). lean-session reads and writes it on every compaction and idle event.
Read .agents/ at session start. Update throughout. Write checkpoint before stopping. decisions.md is the long-term architectural memory — never truncate it.
What This Replaces
Spec-driven frameworks (BMAD, AgentOS, SpecKit): These add ceremony and structure but the actual execution still falls apart without quality gates. The lean workflow skips the ceremony and adds gates instead. Single-model review: Self-review catches nothing new. The adversarial reviewer + council are the quality mechanisms, not re-prompting the same model. Memory bank / spec-driven memory (SPARC, Memory Bank pattern): Valuable for multi-session projects where session reset is the primary threat. For most projects,.agents/ + worktree isolation + clear-over-compact is sufficient. Add _memory/ only when .agents/ stops being enough.
See: Spec-Driven Frameworks vs Native Claude Code, Memory Bank Pattern
When the Workflow Fails
Related Pages
- Dangeresque — AFK loop implementation
- OpenCode — primary harness; plugin event surface
- Council Pattern — 3-stage deliberation
- Worktree Isolation — filesystem isolation for parallel AFK tasks
- Context Compression Strategies — clear-over-compact; why lean-session matters
- Agent Self-Correction — deviation detection and wiki oracle
- Agent Primitive Selection — decision tree for skill vs subagent vs team
- Control Plane Expansion Plan — Gap Analysis and Phase 0.5 Roadmap — scaling this workflow into an Agentic Engineering Control Plane