Documentation Framework
The canonical source for what Devflow names under .devflow/docs/. A command that writes or looks up a doc path follows it, and the one place a command differs is stated here as an exception, never left implicit.
Iron Law
ALL ARTIFACTS FOLLOW NAMING CONVENTIONS
A run directory is
YYYY-MM-DD_HHMMin local time; a second run in the same minute takes
seconds (
YYYY-MM-DD_HHMMSS). Branch slugs replace/with-. Topic slugs are lowercase
alphanumeric with single dashes, at most 50 characters. The exceptions are the ones listed
under Naming Conventions, and no others. Follow the pattern or fix the pattern for everyone.
Directory Structure
All generated documentation lives under .devflow/docs/ at the checkout's toplevel:
.devflow/docs/
├── reviews/{branch-slug}/ # /code-review, per branch
│ └── {timestamp}/ # one directory per review
│ ├── {focus}.md # Review agent report (security.md, architecture.md, ...)
│ ├── review-summary.md # Synthesize agent output
│ ├── {pr-description,prior-resolutions}.txt # /code-review: passed to agents by path
│ ├── resolution-summary.md # /resolve
│ ├── evidence.md # /resolve: appended test-plan claims
│ └── stale-plan.md # /resolve: stale test-plan lines
├── bug-analysis/{branch-slug}/ # /bug-analysis, per branch
│ └── {timestamp}/
│ ├── {focus}.md # Debug agent report
│ ├── static-findings.md # Top 50 static findings and the status of each tool
│ ├── {tool}.sarif # Scanner SARIF file (semgrep, snyk, codeql); snyk-all.json is Snyk before its scope filter, changed.z the changed names for that filter
│ ├── codeql.log # CodeQL output, kept out of the call output
│ ├── findings.tsv # Every static finding, one row each; findings-{tool}.tsv holds one tool's rows, findings-top.tsv the top 50
│ ├── bug-analysis-summary.md # Synthesize agent output
│ └── resolution-summary.md # /resolve (evidence.md and stale-plan.md as in reviews)
├── research/{topic-slug}/{timestamp}/ # /research
│ ├── {type}.md # Research agent output (codebase.md, external.md, ...)
│ └── research-summary.md # Synthesize agent output
├── plan/{timestamp}/ # /plan, from plan-files.cjs claim
├── design/
│ ├── {ISSUE_ID}-{topic-slug}.{timestamp}.md # /plan, one issue
│ ├── multi-{topic-slug}.{timestamp}.md # /plan, several issues (frontmatter issue: pending)
│ └── {topic-slug}.{timestamp}.md # /plan, no issue
├── handoff-{branch-slug}.md # Code agent phase handoff; deleted once the PR exists
└── evidence-{branch-slug}.md # /implement test plan and claims; stays after the PR
.devflow/memory/
├── WORKING-MEMORY.md # Note when working memory is on
└── backup.json # Pre-compact git state snapshot
.devflow/curation/
├── decisions.md # Architectural decisions (ADR-NNN format)
└── pitfalls.md # Known pitfalls (PF-NNN format)
{ISSUE_ID} is the filesystem-safe issue identifier the Git agent emits as - **Issue ID**: under ### Handoff Values. A multi-issue batch fetch returns none, which is why that variant is named multi-. Example: 42-jwt-auth.2026-04-07_1430.md.
The head markers for incremental runs are not part of this tree. /code-review and /bug-analysis keep each one under the git directory of the worktree, at <git dir>/devflow/reviews/{branch-slug}/.last-review-head and <git dir>/devflow/bug-analysis/{branch-slug}/.last-analysis-head. <git dir> is the path that git rev-parse --absolute-git-dir prints, so each worktree has its own markers.
Naming Conventions
Timestamps
YYYY-MM-DD_HHMM, local time (sortable, readable), computed once per run and reused for every path of that run.
- Same-minute collision.
/code-review,/bug-analysis,/researchand/plancreate their run directory withplan-files.cjs claim: when it already exists, the second run appends seconds (2025-12-26_143005). It sorts after its minute, so newest-first listings stay correct. - A design document's timestamp is the suffix before
.md, so a listing sorts by that suffix, not by the leading{ISSUE_ID}.
Branch Slugs
The branch name with every / replaced by -; case, dots and underscores are kept. A detached HEAD has no name and uses standalone.
A slug builds a path or reaches a shell only when it matches ^[A-Za-z0-9._-]{1,200}$. Every command derives {branch_slug} (the underscore spelling in handoff-* and evidence-*) this way, from the branch the work is on.
Topic Slugs
One rule for every topic {slug}: lowercase; each run of characters outside a-z0-9 becomes one -; leading and trailing - are trimmed; at most 50 characters (trim again after the cut); untitled when nothing is left. A command makes the slug in prose; no shell call takes the topic. It uses the slug only when it matches ^[a-z0-9-]{1,50}$, else untitled. /plan and /research take {topic-slug} from it.
Helper Functions
Define these inline, in the Bash call that needs them, for consistent naming. .devflow/docs/ lives at the checkout's toplevel, never under a subdirectory the session started in:
get_timestamp() { date +%Y-%m-%d_%H%M; }
get_branch_slug() { local b; b=$(git branch --show-current 2>/dev/null); echo "${b:-standalone}" | sed 's/\//-/g'; }
Make a run directory, or the design/ folder, only with node "$HOME/.devflow/scripts/plan-files.cjs" claim, never with mkdir -p: the script applies the shared folder checks.
Agent Persistence Rules
Who Writes What
- Reviews: the Review agents and the Synthesize agent (review mode) write into
reviews/{branch-slug}/{timestamp}/;/resolveaddsresolution-summary.md(Phase 5);/code-reviewoverwrites its.last-review-headmarker, under the git directory, with the HEAD SHA. - Bug analysis: the Debug agents and the Synthesize agent (bug-analysis mode) write into
bug-analysis/{branch-slug}/{timestamp}/; the scanner calls write the SARIF files, the changed-name list for the Snyk filter and the CodeQL log, and the counts step writes the findings tables, all into that run folder;/bug-analysisoverwrites its.last-analysis-headmarker, under the git directory, with the HEAD SHA only when every tool that was to run completed, or--no-staticis set. - Research: the Research agents write
{type}.md, and the Synthesize agent (research mode) writesresearch-summary.mdthroughRESEARCH_BASE_DIR, both intoresearch/{topic-slug}/{timestamp}/. - Design:
/planwrites the design document, and its Skim, Design and Synthesize agents writeplan/{timestamp}/{agent}-{k}.md. - Handoff and evidence:
/implementwritesevidence-{branch-slug}.md, which stays after the PR, and the handoff file, to which each Code agent appends one phase section and which is deleted once the PR exists. - Memory and curation: The worker updates
WORKING-MEMORY.mdwhen working memory is on (devflow memory --enable).decisions.mdandpitfalls.mdcome fromdecisions-ledger.jsonl(full active entries; Inactive table).
Agents That Don't Persist
- Git (fetch-issue: read-only, post-review-summary: consolidated review comment only)
- Code agent (commits to git; its only file is the handoff section it appends when
HANDOFF_FILEis given)
Implementation Checklist
When creating or modifying persisting agents or commands:
- [ ] Document output location in agent's final message
- [ ] Update relevant index files
Extended References
- patterns.md - Full templates, helper functions, naming examples, edge cases
- violations.md - Common violations with detection patterns and fixes