Stay in flow state — spec-driven task orchestration for Claude Code
JavaScript
7
1,221 commits
updated May 14, 2026
██████╗ ███████╗ ███████╗ ██████╗ ███████╗ ██╗ ██████╗ ██╗ ██╗
██╔══██╗ ██╔════╝ ██╔════╝ ██╔══██╗ ██╔════╝ ██║ ██╔═══██╗ ██║ ██║
██║ ██║ █████╗ █████╗ ██████╔╝ █████╗ ██║ ██║ ██║ ██║ █╗ ██║
██║ ██║ ██╔══╝ ██╔══╝ ██╔═══╝ ██╔══╝ ██║ ██║ ██║ ██║███╗██║
██████╔╝ ███████╗ ███████╗ ██║ ██║ ███████╗ ╚██████╔╝ ╚███╔███╔╝
╚═════╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚══╝╚══╝
Doing reveals what thinking can't predict
Quick Start • Two Modes • Commands • What It Rejects • Principles
You can't foresee what you don't know to ask. Doing reveals — at every layer.
Most spec-driven frameworks start from a finished spec and execute a static plan. Deepflow treats the entire process as discovery: asking reveals hidden requirements, debating reveals blind spots, spiking reveals technical risks, implementing reveals edge cases. Each step makes the next one sharper.
Deepflow started with adversarial selection: one AI evaluated another AI's code in a fresh context. The "doing reveals" philosophy applied to the system itself — we discovered that LLM judging LLM produces gaming: agents that estimated instead of measuring, simulated instead of implementing, presented shortcuts as deliverables.
The fix: eliminate subjective judgment. Only objective metrics decide. Tests created by the agent itself are excluded from the baseline to prevent self-validation. We call this a ratchet — inspired by Karpathy's autoresearch: a mechanism where the metric can only improve, never regress. Each cycle ratchets quality forward.
# Install (or update)
npx deepflow
# Uninstall
npx deepflow --uninstall
The installer configures granular permissions so background agents can read, write, run git, and execute health checks (build/test/typecheck/lint) without blocking on approval prompts. All permissions are scoped and cleaned up on uninstall.
You explore the problem, shape the spec, and trigger execution — all inside a Claude Code session.
claude
# 1. Discover — understand the problem before solving it
/df:discover image-upload
# "Why do you need image upload? What exists today?
# What file sizes? What formats? Where are images stored?
# What does 'done' look like? What should this NOT do?"
# 2. Debate — stress-test the approach (optional)
/df:debate upload-strategy
# User Advocate: "Drag-and-drop is table stakes, not a feature"
# Tech Skeptic: "Client-side resize before upload, or you'll hit memory limits"
# Systems Thinker: "What happens when storage goes down mid-upload?"
# LLM Efficiency: "Split this into two specs: upload + processing"
# 3. Spec — now the conversation is rich enough to produce a solid spec
/df:spec image-upload
# 4-5: the AI takes over
/df:execute # Curator orchestrator spawns parallel agents in shared worktree, ratchet validates
/df:verify # Check spec satisfied, merge to main
What requires you: Steps 1-3 (defining the problem and approving the spec — /df:spec's curate phase produces the task list inline). Steps 4-5 run with the orchestrator session as curator; you trigger each one and can intervene.
HUMAN PHASE AI PHASE
───────────────────────────────── ──────────────────────────────────
/df:discover — ask, surface gaps /df:execute — curator spawns subagents,
/df:debate — stress-test approach ratchet validates each commit
/df:spec — curate task list /df:verify — health checks, merge
↻ refine until solid ↻ retry until converged
───────────────────────────────── ──────────────────────────────────
specs/*.md (with ## Tasks (curated)) is the handoff point
Spec lifecycle: feature.md (new) → doing-feature.md (in progress) → done-feature.md (decisions extracted, then deleted)
Human phase — you drive these to shape intent into a curated spec.
| Command | Purpose |
|---|---|
/df:discover <name> | Explore problem space with Socratic questioning |
/df:debate <topic> | Multi-perspective analysis (4 agents) |
/df:spec <name> | Generate spec from conversation; curate phase emits ## Tasks (curated) (LSP-first impact, file-ownership-aware [P]) |
/df:fix <done-spec> | Derive a follow-up spec from a completed one (regressions, unmet ACs) |
AI phase — the orchestrator session itself acts as curator and drives these.
| Command | Purpose |
|---|---|
/df:execute | Curator orchestrator spawns sub-agents per ## Tasks (curated) wave in a shared worktree, ratchet validates each commit |
/df:verify | Check specs satisfied (L0–L5), merge to main, rename doing- → done- |
Support
| Command | Purpose |
|---|---|
/df:map | Generate codebase artifacts (sketch / impact / findings / structure / testing / CLAUDE.md) |
/df:dashboard | View deepflow dashboard (team mode via URL or local mode via CLI server) |
/df:eval | Run a skill against a benchmark suite, or scaffold a new benchmark dir |
/df:update | Update or uninstall deepflow, check installed version |
your-project/
+-- specs/
| +-- auth.md # new spec (curated tasks live in this file)
| +-- doing-upload.md # in progress
| +-- done-upload.md # completed (decisions extracted)
+-- .deepflow/
+-- config.yaml # project settings (build/test commands, parallelism, optimize keys)
+-- decisions.md # auto-extracted [APPROACH] / [PROVISIONAL] / [FUTURE] / [UPDATE]
+-- checkpoint.json # /df:execute resume state (waves, completed tasks)
+-- context.json # statusline-written context % (read by /df:execute for parallelism gate)
+-- auto-snapshot.txt # ratchet baseline (pre-existing tests)
+-- token-history.jsonl # per-render token usage
+-- experiments/ # spike results, named {topic}--{hypothesis}--{status}.md
+-- maps/ # /df:map artifacts per spec (sketch.md, impact.md, findings.md)
+-- codebase/ # global artifacts (STRUCTURE.md, TESTING.md, CLAUDE.md)
+-- results/ # per-task result archives + verify JSON
+-- worktrees/curator-active/ # single shared execution branch
Deepflow's design isn't opinionated — it's a direct response to measured LLM limitations:
Focused tasks > giant context — LLMs lose ~2% effectiveness per 100K additional tokens, even on trivial tasks (Chroma "Context Rot", 2025, 18 models tested). Accuracy drops from 89% at 8K tokens to 25% at 1M tokens (Augment Code, 2025). Deepflow keeps each task's context minimal and focused instead of loading the entire codebase.
Search efficiency > model capability — Coding agents spend 60% of their time searching, not coding (Cognition, 2025). Input tokens dominate cost with up to 10x variance driven entirely by search efficiency, not coding ability. Deepflow's LSP-first search and 3-phase explore protocol (DIVERSIFY/CONVERGE/EARLY STOP) minimize search waste.
The framework matters more than the model — Same model, same tasks, different orchestration: 25.6 percentage point swing on SWE-Bench Lite (GPT-4: 2.7% with naive retrieval vs 28.3% with structured orchestration). On SWE-Bench Pro, three products using the same model scored 17 problems apart on 731 issues — the only difference was how they managed context, search, and edits. Deepflow is that orchestration layer.
Tool use > context stuffing — Information in the middle of context has up to 40% less recall than at the start/end (Lost in the Middle, 2024, Stanford/TACL). LongMemEval (ICLR 2025) found GPT-4O scoring 60-64% at full context vs 87-92% with oracle retrieval. Agents access code on-demand via LSP (findReferences, incomingCalls) and grep — always fresh, no attention dilution.
Fresh context beats long sessions — Every AI agent's success rate decreases after 35 minutes of equivalent task time; doubling duration quadruples failure rate. Deepflow's curator orchestrator spawns each subagent in a fresh context with an inline bundle — checkpoint state, not conversation history.
Input:output ratio matters — Agent token ratio is ~100:1 input to output (Manus, 2025). Deepflow truncates ratchet output (success = zero tokens), context-forks high-ratio skills, and strips prompt sections by effort level to keep the ratio low.
Model routing > one-size-fits-all — Mechanical tasks with cheap models (haiku), complex tasks with powerful models (opus). Fewer tokens per task = less degradation = better results. Effort-aware context budgets strip unnecessary sections from prompts for simpler tasks.
Prompt order follows attention — Execute prompts follow the attention U-curve: critical instructions (task definition, failure history, success criteria) at start and end, navigable data (impact analysis, dependency context) in the middle. Distractors eliminated by design.
LSP-powered impact analysis — Plan-time uses findReferences and incomingCalls to map blast radius precisely. Execute-time runs a freshness check before implementing — catching callers added after planning. Grep as fallback — though embedding-based retrieval has a hard mathematical ceiling (Google DeepMind, 2025) that LSP doesn't share.
Sub-agents are spawned by the orchestrator with strict input/output contracts (enforced by the df-delegation-contract PreToolUse hook reading agents/DELEGATION.md). The orchestrator routes each task to a sub-agent by subagent_type; the sub-agent returns a structured payload, never freeform prose.
| Sub-agent | Role |
|---|---|
df-implement | Executes one curated task — read by path, edit, run tests. No search tools. |
df-integration | Cross-spec integration — implements tasks that span multiple specs or touch shared interfaces |
df-spike | Proof-of-concept investigator — validates risky hypotheses, never edits existing files |
df-test | Writes tests for a given module or feature, runs the suite, reports status |
df-optimize | Performance/quality optimization — profiles, refactors for efficiency, no behavior changes |
df-haiku-ops | Fast Bash-only ops (git, shell). No code reading/editing — pure mechanical execution |
reasoner | Complex analysis — prioritization, debugging, architectural decisions (Opus-based) |
Skills are reusable capabilities invoked by sub-agents or commands. Some run in forked context to keep input:output ratios low; others encode protocols (commit format, AC coverage, decision capture).
| Skill | Purpose |
|---|---|
gap-discovery | Surface missing requirements during ideation |
df-decisions | Decision capture protocol — extracts [APPROACH] / [PROVISIONAL] / [ASSUMPTION] / [FUTURE] / [UPDATE] tags from agent output to .deepflow/decisions.md |
df-ac-coverage | Acceptance-criteria tagging protocol — tests carry specs/<slug>.md#AC-<n> literals so /df:verify L3 can lint that every AC is exercised |
atomic-commits | One logical change per commit, conventional format |
code-completeness | Find TODOs, stubs, placeholders, skipped tests, missing implementations |
browse-fetch | Fetch external API docs via headless Chromium (replaces context-hub) |
browse-verify | L5 browser verification — Playwright a11y tree assertions |
repo-inspect | Structured JSON intelligence for a remote GitHub repo — no local clone |
23 hooks fire at specific Claude Code lifecycle events to enforce invariants without requiring orchestrator decisions:
df-codebase-inject injects relevant artifacts into agent prompts; df-delegation-contract enforces input/output contracts; df-implement-protocol / df-verify-protocol / df-explore-protocol add tool restrictions; df-bash-worktree-guard blocks cross-worktree mutations; df-worktree-precheck prevents stale-base spawns.df-artifact-validate checks sketch/impact/findings consistency and emits a JSON Schema-validated drift report; df-spike-validate rejects schema-mismatch results; df-codebase-staleness flags artifact rot; df-experiment-immutable protects spike results; df-validate-tasks-gates audits curated task structure; df-harness-score records benchmark deltas.df-spec-lint validates spec format; df-invariant-check runs project invariants; df-check-update notifies when a new deepflow version is published.All hooks are zero-dep Node, fail-open by default (warnings to stderr), and idempotent.
MIT
1,219 commits
2 commits
JavaScript
98.7%
Stay in flow state — spec-driven task orchestration for Claude Code
JavaScript
7
1,221 commits
updated May 14, 2026
██████╗ ███████╗ ███████╗ ██████╗ ███████╗ ██╗ ██████╗ ██╗ ██╗
██╔══██╗ ██╔════╝ ██╔════╝ ██╔══██╗ ██╔════╝ ██║ ██╔═══██╗ ██║ ██║
██║ ██║ █████╗ █████╗ ██████╔╝ █████╗ ██║ ██║ ██║ ██║ █╗ ██║
██║ ██║ ██╔══╝ ██╔══╝ ██╔═══╝ ██╔══╝ ██║ ██║ ██║ ██║███╗██║
██████╔╝ ███████╗ ███████╗ ██║ ██║ ███████╗ ╚██████╔╝ ╚███╔███╔╝
╚═════╝ ╚══════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚══╝╚══╝
Doing reveals what thinking can't predict
Quick Start • Two Modes • Commands • What It Rejects • Principles
You can't foresee what you don't know to ask. Doing reveals — at every layer.
Most spec-driven frameworks start from a finished spec and execute a static plan. Deepflow treats the entire process as discovery: asking reveals hidden requirements, debating reveals blind spots, spiking reveals technical risks, implementing reveals edge cases. Each step makes the next one sharper.
Deepflow started with adversarial selection: one AI evaluated another AI's code in a fresh context. The "doing reveals" philosophy applied to the system itself — we discovered that LLM judging LLM produces gaming: agents that estimated instead of measuring, simulated instead of implementing, presented shortcuts as deliverables.
The fix: eliminate subjective judgment. Only objective metrics decide. Tests created by the agent itself are excluded from the baseline to prevent self-validation. We call this a ratchet — inspired by Karpathy's autoresearch: a mechanism where the metric can only improve, never regress. Each cycle ratchets quality forward.
# Install (or update)
npx deepflow
# Uninstall
npx deepflow --uninstall
The installer configures granular permissions so background agents can read, write, run git, and execute health checks (build/test/typecheck/lint) without blocking on approval prompts. All permissions are scoped and cleaned up on uninstall.
You explore the problem, shape the spec, and trigger execution — all inside a Claude Code session.
claude
# 1. Discover — understand the problem before solving it
/df:discover image-upload
# "Why do you need image upload? What exists today?
# What file sizes? What formats? Where are images stored?
# What does 'done' look like? What should this NOT do?"
# 2. Debate — stress-test the approach (optional)
/df:debate upload-strategy
# User Advocate: "Drag-and-drop is table stakes, not a feature"
# Tech Skeptic: "Client-side resize before upload, or you'll hit memory limits"
# Systems Thinker: "What happens when storage goes down mid-upload?"
# LLM Efficiency: "Split this into two specs: upload + processing"
# 3. Spec — now the conversation is rich enough to produce a solid spec
/df:spec image-upload
# 4-5: the AI takes over
/df:execute # Curator orchestrator spawns parallel agents in shared worktree, ratchet validates
/df:verify # Check spec satisfied, merge to main
What requires you: Steps 1-3 (defining the problem and approving the spec — /df:spec's curate phase produces the task list inline). Steps 4-5 run with the orchestrator session as curator; you trigger each one and can intervene.
HUMAN PHASE AI PHASE
───────────────────────────────── ──────────────────────────────────
/df:discover — ask, surface gaps /df:execute — curator spawns subagents,
/df:debate — stress-test approach ratchet validates each commit
/df:spec — curate task list /df:verify — health checks, merge
↻ refine until solid ↻ retry until converged
───────────────────────────────── ──────────────────────────────────
specs/*.md (with ## Tasks (curated)) is the handoff point
Spec lifecycle: feature.md (new) → doing-feature.md (in progress) → done-feature.md (decisions extracted, then deleted)
Human phase — you drive these to shape intent into a curated spec.
| Command | Purpose |
|---|---|
/df:discover <name> | Explore problem space with Socratic questioning |
/df:debate <topic> | Multi-perspective analysis (4 agents) |
/df:spec <name> | Generate spec from conversation; curate phase emits ## Tasks (curated) (LSP-first impact, file-ownership-aware [P]) |
/df:fix <done-spec> | Derive a follow-up spec from a completed one (regressions, unmet ACs) |
AI phase — the orchestrator session itself acts as curator and drives these.
| Command | Purpose |
|---|---|
/df:execute | Curator orchestrator spawns sub-agents per ## Tasks (curated) wave in a shared worktree, ratchet validates each commit |
/df:verify | Check specs satisfied (L0–L5), merge to main, rename doing- → done- |
Support
| Command | Purpose |
|---|---|
/df:map | Generate codebase artifacts (sketch / impact / findings / structure / testing / CLAUDE.md) |
/df:dashboard | View deepflow dashboard (team mode via URL or local mode via CLI server) |
/df:eval | Run a skill against a benchmark suite, or scaffold a new benchmark dir |
/df:update | Update or uninstall deepflow, check installed version |
your-project/
+-- specs/
| +-- auth.md # new spec (curated tasks live in this file)
| +-- doing-upload.md # in progress
| +-- done-upload.md # completed (decisions extracted)
+-- .deepflow/
+-- config.yaml # project settings (build/test commands, parallelism, optimize keys)
+-- decisions.md # auto-extracted [APPROACH] / [PROVISIONAL] / [FUTURE] / [UPDATE]
+-- checkpoint.json # /df:execute resume state (waves, completed tasks)
+-- context.json # statusline-written context % (read by /df:execute for parallelism gate)
+-- auto-snapshot.txt # ratchet baseline (pre-existing tests)
+-- token-history.jsonl # per-render token usage
+-- experiments/ # spike results, named {topic}--{hypothesis}--{status}.md
+-- maps/ # /df:map artifacts per spec (sketch.md, impact.md, findings.md)
+-- codebase/ # global artifacts (STRUCTURE.md, TESTING.md, CLAUDE.md)
+-- results/ # per-task result archives + verify JSON
+-- worktrees/curator-active/ # single shared execution branch
Deepflow's design isn't opinionated — it's a direct response to measured LLM limitations:
Focused tasks > giant context — LLMs lose ~2% effectiveness per 100K additional tokens, even on trivial tasks (Chroma "Context Rot", 2025, 18 models tested). Accuracy drops from 89% at 8K tokens to 25% at 1M tokens (Augment Code, 2025). Deepflow keeps each task's context minimal and focused instead of loading the entire codebase.
Search efficiency > model capability — Coding agents spend 60% of their time searching, not coding (Cognition, 2025). Input tokens dominate cost with up to 10x variance driven entirely by search efficiency, not coding ability. Deepflow's LSP-first search and 3-phase explore protocol (DIVERSIFY/CONVERGE/EARLY STOP) minimize search waste.
The framework matters more than the model — Same model, same tasks, different orchestration: 25.6 percentage point swing on SWE-Bench Lite (GPT-4: 2.7% with naive retrieval vs 28.3% with structured orchestration). On SWE-Bench Pro, three products using the same model scored 17 problems apart on 731 issues — the only difference was how they managed context, search, and edits. Deepflow is that orchestration layer.
Tool use > context stuffing — Information in the middle of context has up to 40% less recall than at the start/end (Lost in the Middle, 2024, Stanford/TACL). LongMemEval (ICLR 2025) found GPT-4O scoring 60-64% at full context vs 87-92% with oracle retrieval. Agents access code on-demand via LSP (findReferences, incomingCalls) and grep — always fresh, no attention dilution.
Fresh context beats long sessions — Every AI agent's success rate decreases after 35 minutes of equivalent task time; doubling duration quadruples failure rate. Deepflow's curator orchestrator spawns each subagent in a fresh context with an inline bundle — checkpoint state, not conversation history.
Input:output ratio matters — Agent token ratio is ~100:1 input to output (Manus, 2025). Deepflow truncates ratchet output (success = zero tokens), context-forks high-ratio skills, and strips prompt sections by effort level to keep the ratio low.
Model routing > one-size-fits-all — Mechanical tasks with cheap models (haiku), complex tasks with powerful models (opus). Fewer tokens per task = less degradation = better results. Effort-aware context budgets strip unnecessary sections from prompts for simpler tasks.
Prompt order follows attention — Execute prompts follow the attention U-curve: critical instructions (task definition, failure history, success criteria) at start and end, navigable data (impact analysis, dependency context) in the middle. Distractors eliminated by design.
LSP-powered impact analysis — Plan-time uses findReferences and incomingCalls to map blast radius precisely. Execute-time runs a freshness check before implementing — catching callers added after planning. Grep as fallback — though embedding-based retrieval has a hard mathematical ceiling (Google DeepMind, 2025) that LSP doesn't share.
Sub-agents are spawned by the orchestrator with strict input/output contracts (enforced by the df-delegation-contract PreToolUse hook reading agents/DELEGATION.md). The orchestrator routes each task to a sub-agent by subagent_type; the sub-agent returns a structured payload, never freeform prose.
| Sub-agent | Role |
|---|---|
df-implement | Executes one curated task — read by path, edit, run tests. No search tools. |
df-integration | Cross-spec integration — implements tasks that span multiple specs or touch shared interfaces |
df-spike | Proof-of-concept investigator — validates risky hypotheses, never edits existing files |
df-test | Writes tests for a given module or feature, runs the suite, reports status |
df-optimize | Performance/quality optimization — profiles, refactors for efficiency, no behavior changes |
df-haiku-ops | Fast Bash-only ops (git, shell). No code reading/editing — pure mechanical execution |
reasoner | Complex analysis — prioritization, debugging, architectural decisions (Opus-based) |
Skills are reusable capabilities invoked by sub-agents or commands. Some run in forked context to keep input:output ratios low; others encode protocols (commit format, AC coverage, decision capture).
| Skill | Purpose |
|---|---|
gap-discovery | Surface missing requirements during ideation |
df-decisions | Decision capture protocol — extracts [APPROACH] / [PROVISIONAL] / [ASSUMPTION] / [FUTURE] / [UPDATE] tags from agent output to .deepflow/decisions.md |
df-ac-coverage | Acceptance-criteria tagging protocol — tests carry specs/<slug>.md#AC-<n> literals so /df:verify L3 can lint that every AC is exercised |
atomic-commits | One logical change per commit, conventional format |
code-completeness | Find TODOs, stubs, placeholders, skipped tests, missing implementations |
browse-fetch | Fetch external API docs via headless Chromium (replaces context-hub) |
browse-verify | L5 browser verification — Playwright a11y tree assertions |
repo-inspect | Structured JSON intelligence for a remote GitHub repo — no local clone |
23 hooks fire at specific Claude Code lifecycle events to enforce invariants without requiring orchestrator decisions:
df-codebase-inject injects relevant artifacts into agent prompts; df-delegation-contract enforces input/output contracts; df-implement-protocol / df-verify-protocol / df-explore-protocol add tool restrictions; df-bash-worktree-guard blocks cross-worktree mutations; df-worktree-precheck prevents stale-base spawns.df-artifact-validate checks sketch/impact/findings consistency and emits a JSON Schema-validated drift report; df-spike-validate rejects schema-mismatch results; df-codebase-staleness flags artifact rot; df-experiment-immutable protects spike results; df-validate-tasks-gates audits curated task structure; df-harness-score records benchmark deltas.df-spec-lint validates spec format; df-invariant-check runs project invariants; df-check-update notifies when a new deepflow version is published.All hooks are zero-dep Node, fail-open by default (warnings to stderr), and idempotent.
MIT
1,219 commits
2 commits
JavaScript
98.7%