SHEAF is an opinionated, single-architect workflow system for planning and executing software work with strong continuity across sessions.
The name comes from sheaf theory in mathematics: local data that glues together coherently to form a global structure. The metaphor is intentional — Sheaf takes local pieces of context (tasks, decisions, code, architecture) and articulates them into a coherent AI-assisted flow.
It is designed for day-to-day implementation work with one core principle:
- always maintain momentum with exactly one clear next action.
- QUICKSTART.md — compact daily operating guide
SHEAF is installed with a guided project installer:
npx viespejo/sheaf- Interactive (Recommended): Simply run the command above and follow the prompts.
- Flags: Use specific flags to automate the installation.
Install for CodeCompanion (Neovim):
npx viespejo/sheaf --codecompanionInstall for Claude Code:
npx viespejo/sheaf --claudeInstall for Gemini CLI:
npx viespejo/sheaf --geminiPreview without writing files:
npx viespejo/sheaf --codecompanion --dry-runCustom installation (multiple runtimes, global paths, custom directory):
npx viespejo/sheaf --codecompanion --claude --gemini --scope global --install-dir ~/.ai- Scope (
-s, --scope):local(default): References are rewritten relative to the agent's own directory (e.g.,./.codecompanion/).global: References are rewritten as absolute paths to the installation target.
- Install Directory (
-t, --install-dir): The base directory where agent folders will be created. - Runtimes: Use any combination of
--codecompanion,--claude, and--geminito select which artifacts to install.
Each selected runtime receives its own directory (.codecompanion/, .claude/, or .gemini/) containing:
-
prompts/sheaf/(CodeCompanion) orcommands/sheaf/(Claude/Gemini) -
sheaf/templates/ -
sheaf/workflows/ -
sheaf/references/ -
sheaf/skills/ -
sheaf/rules/(if present)
During install, markdown references using the {{SHEAF_RUNTIME_DIR}} placeholder are rewritten automatically based on the chosen Scope.
Runtime prompt behavior:
- CodeCompanion and Claude receive markdown prompt outputs.
- Gemini receives TOML command outputs generated from composed markdown prompts.
- Installation is copy-based; existing files at the target can be overwritten.
- If no runtime flags are provided, the installer runs in interactive mode.
If you want to avoid repetitive repository discovery (ls, find, cat) at the start of a coding session, you can generate a structured context snapshot manually before chatting with an LLM.
Reference path:
{{SHEAF_RUNTIME_DIR}}/tools/context-dump.sh
Concrete installed path:
- Shared runtime assets:
.sheaf-runtime/tools/context-dump.sh
Run the command from the project root you want to snapshot.
Ephemeral output to stdout (default):
bash .sheaf-runtime/tools/context-dump.shSave output to file (optional):
bash .sheaf-runtime/tools/context-dump.sh --out context.mdAdd ad-hoc files at runtime:
bash .sheaf-runtime/tools/context-dump.sh --include docs/decisions.md.contextdumpis optional.- When present, it is read from the project root (one relative path per line, comments allowed).
--includeappends extra files at runtime.- Entries from
.contextdumpand--includeare merged with deduplication.
Canonical usage is bash <path>, but you can run it directly if executable:
chmod +x .sheaf-runtime/tools/context-dump.sh
./.sheaf-runtime/tools/context-dump.sh- convert product/architecture intent into executable plans,
- execute plans with explicit control per task,
- reconcile results into durable summaries,
- preserve session continuity so you can resume quickly,
- avoid decision fatigue through deterministic routing.
SHEAF is intentionally not a generic framework with many setup branches. It is optimized for practical, personal software delivery.
- Initialization starts from your docs (
docs/prd.md,docs/architecture.md). - Ongoing work is guided primarily by
.sheaf/STATE.md,.sheaf/ROADMAP.md, and.sheaf/PROJECT.md. - Existing SHEAF artifacts are your operational memory.
At the end of every command/workflow, SHEAF should route to one deterministic next step.
No action menus. No “pick 1 of 4” fatigue.
Every unit of work follows the loop:
- PLAN: decide and approve work
- APPLY: execute tasks with explicit choices
- UNIFY: reconcile what actually happened
Skipping phases reduces traceability and quality.
SHEAF treats continuity as first-class:
STATE.mdfor ongoing digest,HANDOFF*.mdfor session transfer,resumeandprogresscommands for deterministic routing.
After initialization, SHEAF uses this structure:
.sheaf/
PROJECT.md
ROADMAP.md
STATE.md
sheaf.json
execution-log.json # created/updated as needed by APPLY
HANDOFF-*.md # created by handoff command
handoffs/archive/ # used by resume lifecycle
phases/
NN-phase-name/
NN-PP-PLAN.md
NN-PP-SUMMARY.md
Initialize SHEAF from docs and create core .sheaf artifacts.
- Primary use: first setup in a repository.
- Required docs:
docs/prd.md,docs/architecture.md. - Auto-includes
PLANNING.mdif present. - May run interview mode for critical ambiguity.
- Ends with one action:
/sheaf:plan.
Create or continue one implementation plan for a selected story.
- Collaborative-first: discuss in chat before writing files.
- Uses INIT artifacts as primary context.
- Writes PLAN only after explicit approval.
- Updates state/roadmap after approval.
- Ends with one action:
/sheaf:apply [plan-path].
Run a BMAD-style interactive brainstorming session with continuity.
- Detects previous brainstorming sessions and supports continue/new selection.
- Supports 4 approach modes: user-selected, AI-recommended, random, progressive flow.
- Facilitates collaborative ideation before convergence.
- Organizes ideas into themes and produces prioritized action steps.
- Persists session notes in
.sheaf/brainstorming/for later continuation. - Ends with one deterministic next action.
Execute an approved plan with per-task user control.
For each task, SHEAF shows a preview and requires a decision:
- manual apply (you edit and confirm),
- SHEAF apply (agent writes changes),
- skip (logged as deviation).
- Supports stop/pause behavior with continuity.
- Logs outcomes for reconciliation.
- Routes to
/sheaf:unify [plan-path]when execution is complete.
Reconcile planned vs actual execution and close the loop.
- Creates
SUMMARY.mdnext to PLAN. - Updates
STATE.mdloop position. - Updates
ROADMAP.mdwhere applicable. - Runs transition workflow if phase is fully unified.
- Ends with one action:
/sheaf:plan.
Restore context at the start of a new session.
- Reads
.sheaf/STATE.md. - Detects optional handoff (
.sheaf/HANDOFF*.mdor provided path). - Reconciles handoff vs state (state-first if stale/conflicting).
- Suggests exactly one next action.
- Archives consumed handoff after user proceeds.
Mid-session checkpoint with deterministic routing.
- Reads
STATE.md+ROADMAP.md. - Shows milestone/phase/loop status.
- Supports optional user context (time limit, blocker, priority).
- Suggests exactly one next action.
- Adds context advisory when deep/critical risk is detected.
Generate a comprehensive continuity document for the next session.
- Synthesizes state + session evidence + optional notes.
- Creates
.sheaf/HANDOFF-{timestamp}-{context}.md. - Includes accomplishments, decisions, gaps, open questions, references, and prioritized next actions.
- Updates
STATE.mdSession Continuity with handoff pointer.
Create or update product briefs through guided or autonomous discovery using the BMAD Product Brief skill.
- Objective: Guides you from raw ideas to polished executive summaries (1-2 pages) and optionally an LLM distillate for PRD creation.
- Modes:
- Guided (Default): Conversational discovery with soft gates.
- Yolo: Fast-track drafting followed by refinement.
- Autonomous: Headless execution for structured inputs or flags (
--autonomous).
- Features:
- Contextual Discovery: Analyzes local artifacts and performs web research via specialized subagents.
- Multi-lens Review: Uses Skeptic and Opportunity reviewers to stress-test the draft.
- Distillate Generation: Captures technical details, rejected ideas, and requirements for downstream use.
Create a new Product Requirements Document (PRD) from scratch using the BMAD Create PRD skill.
- Objective: Transform a product brief or raw requirements into a structured, comprehensive PRD.
- Process: Follows a specialized workflow to ensure all critical sections (context, goals, user stories, technical requirements, etc.) are addressed.
Edit and refine an existing PRD using the BMAD Edit PRD skill.
- Objective: Update, expand, or pivot an existing requirements document based on new feedback or changing scope.
- Process: Maintains document consistency while incorporating specific changes.
Validate a PRD against organizational or quality standards using the BMAD Validate PRD skill.
- Objective: Ensure a PRD is complete, consistent, and ready for implementation.
- Process: Analyzes the document for gaps, ambiguities, and alignment with project goals.
Standardizes relative paths in skill prompts to absolute SHEAF-style paths. Use this when developing or updating skills to ensure all internal references (prompts, agents, resources, etc.) are correctly resolved during installation.
- Usage:
node bin/fix-skill-paths.js <skill-name> - Features:
- Resolves folder references (
prompts/,agents/, etc.) relative to the current file. - Resolves direct
.mdfile references within the same directory. - Automatically handles
../and./prefixes. - Verifies file existence for local references to avoid false positives.
- Resolves folder references (
SHEAF command behavior is defined in these workflow documents:
src/workflows/init-project.mdsrc/workflows/plan-phase.mdsrc/workflows/apply-phase.mdsrc/workflows/unify-phase.mdsrc/workflows/transition-phase.mdsrc/workflows/resume-project.mdsrc/workflows/progress-project.mdsrc/workflows/handoff-project.md
Think of commands as entrypoints and workflows as operational contracts.
Shared rules and guidance:
-
src/references/loop-phases.md- loop semantics,
- phase invariants,
- transition conditions,
- anti-patterns.
-
src/references/plan-format.md- expected plan shape and conventions.
-
src/references/context-management.md- context brackets (FRESH/MODERATE/DEEP/CRITICAL),
- lean context loading,
- handoff and continuity guidance.
SHEAF uses templates for consistent artifacts:
src/templates/PROJECT.mdsrc/templates/ROADMAP.mdsrc/templates/STATE.mdsrc/templates/PLAN.mdsrc/templates/SUMMARY.md
A typical work cycle:
- Start session:
/sheaf:resume - Check orientation (optional):
/sheaf:progress - Plan next unit:
/sheaf:plan - Execute:
/sheaf:apply [plan-path] - Reconcile/close:
/sheaf:unify [plan-path] - End session safely:
/sheaf:handoff
For quick mid-session checks, use /sheaf:progress at any point.
- Use resume when starting a new session and you need context restoration.
- Use progress during an active session for a status checkpoint + next action.
- Use handoff before stopping work when continuity risk exists.
Quick rule:
- new session →
resume - same session, unsure next step →
progress - ending session / context risk →
handoff
Given loop markers in state:
- PLAN ○ →
/sheaf:plan - PLAN ✓, APPLY ○ →
/sheaf:apply [plan-path] - PLAN ✓, APPLY ✓, UNIFY ○ →
/sheaf:unify [plan-path] - PLAN ✓, APPLY ✓, UNIFY ✓ →
/sheaf:plan(next work unit) - blocked → address blocker first
Always one action.
During APPLY, each task must end in an explicit outcome:
manualagent_appliedskippedstopped
This contract is mandatory so UNIFY can reconcile accurately.
Keep .sheaf/STATE.md as a digest, not an archive.
Recommended practices:
- update after major state transitions,
- keep only active blockers/deferred issues,
- keep continuity section explicit and current,
- avoid bloating state with full historical detail,
- rely on
SUMMARY.md+ handoffs for deeper history.
SHEAF tracks context pressure with practical brackets:
- FRESH (>70%): normal pace
- MODERATE (40–70%): reinforce core context
- DEEP (20–40%): reduce reads, prepare continuity
- CRITICAL (<20%): finish safely, write handoff
At DEEP/CRITICAL, avoid starting broad new work without continuity preparation.
- one story per plan,
- clear acceptance criteria,
- explicit boundaries,
- tasks with files/action/verify/done,
- explicit approval before execution.
- preview before writes,
- explicit per-task user decision,
- boundary respect,
- deviations logged.
- SUMMARY reflects actual outcomes,
- criteria pass/fail/partial with evidence,
- deferred items explicit,
- state and roadmap synchronized.
- never execute without approved plan,
- never skip UNIFY after APPLY,
- never end workflow with ambiguous/multiple next actions,
- never invent execution results when evidence is missing.
- loading everything “just in case”,
- reflexive dependency chains in plans,
- silent scope drift beyond boundaries,
- postponing summary/state updates until “later”.
/sheaf:init
/sheaf:plan
/sheaf:apply .sheaf/phases/04-workflows-layer/04-01-PLAN.md
/sheaf:unify .sheaf/phases/04-workflows-layer/04-01-PLAN.md
/sheaf:resume
/sheaf:resume .sheaf/HANDOFF-20260329-1845-phase04-apply.md
/sheaf:progress
/sheaf:progress only 30 minutes today
/sheaf:handoff
/sheaf:handoff pending db migration decision + test gap on auth module
Start of day:
- run
/sheaf:resume, - accept or correct the suggested next action,
- if needed run
/sheaf:progressfor extra orientation.
During work:
- keep loop discipline,
- use progress for checkpoints,
- avoid starting new large scope at deep/critical context.
End of day:
- run
/sheaf:handoff, - verify top next action is explicit,
- next session begins with
/sheaf:resume.
Available prompt entrypoints under src/prompts/:
init.mdplan.mdapply.mdunify.mdresume.mdprogress.mdhandoff.mdproduct-brief.mdcreate-prd.mdedit-prd.mdvalidate-prd.mdbrainstorming.md
If your runtime requires explicit command registration outside prompt files, wire these entrypoints in your host configuration.
SHEAF is most effective when you optimize for continuity, traceability, and momentum:
- plan clearly,
- execute intentionally,
- reconcile honestly,
- preserve context before it is lost,
- keep moving with one clear next step.