Skip to content

Phase Directory Layout

Status: Canonical — Phase-4 D-24 / D-25

This is the authoritative spec for what a .planning/phases/<NN>-<slug>/ (project-state: .nubos-pilot/phases/<NN>-<slug>/) directory may contain, which files are parser-mandatory, which are produced by which workflow, and which are consumed by which agent.

Mandatory files

These are the only files that lib/phase.cjs / lib/plan.cjs / lib/tasks.cjs read by contract. A phase directory is well-formed when each of its plans has a PLAN.md and (optionally) a tasks/ subdirectory with one .md file per task.

FileProducer workflowParserMinimal required sections
<NN>-<MM>-PLAN.mdnp:plan-phaselib/plan.cjsFrontmatter: phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves; body: <objective>, <tasks> (may be empty if plan is single-task), <success_criteria>
tasks/<task-id>.mdnp:plan-phaselib/tasks.cjsFrontmatter: full 12-field set per D-01 (id, phase, plan, type, status, tier, owner, wave, depends_on, files_modified, autonomous, must_haves); body: freeform task prose

Notes:

  • tasks/ is optional at the plan level: a plan promotes to tasks/*.md only when parallelism, mixed tiers, or non-linear dependencies demand it. A single-task plan may keep its tasks inline inside PLAN.md.
  • Every other file in the phase directory is workflow-produced / workflow-consumed only. Parsers never read them.

Optional files (workflow artifacts)

The parser contract does not read these. Each is produced by a specific workflow and consumed by a specific downstream agent or workflow step. Missing files are never an error — they simply indicate that the corresponding workflow step did not run (or has not run yet).

FileProducer workflowConsumer agent(s) / workflowMinimal required sections
<NN>-CONTEXT.mdnp:discuss-phaseplanner, researcher, plan-checker<domain>, <decisions>, <constraints>, <dependencies>, <success_criteria>
<NN>-RESEARCH.mdnp:research-phaseplanner, plan-checker<sources> (≥1 link with HIGH/MEDIUM/LOW credibility), <findings>, <open_questions>, <flags>
<NN>-PATTERNS.mdnp:plan-phase (pre-plan)planner, executorFile Classification table, per-file Analog block, Shared Patterns (S-1..S-N)
<NN>-VALIDATION.mdnp:plan-phase (pre-plan)planner, executor, verifierValidation Strategy, Must-Have Truths, Artifact Checks, Traceability Matrix
<NN>-<MM>-SUMMARY.mdnp:execute-planverifier, np:progress, np:nextFrontmatter: phase, plan, subsystem, key-files, decisions, metrics; body: Objective, What Was Built, Key Decisions, Deviations, Self-Check
<NN>-VERIFICATION.mdnp:verify-worknp:next (rule 4 gate), human reviewerScope, Evidence, Result (pass/fail), Follow-ups. Presence flips np:next from rule-4 to rule-5 for the phase.
<NN>-DISCUSSION-LOG.mdnp:discuss-phaseplanner (carry-over), human reviewerFreeform Q&A transcript — no parser contract
<NN>-UI-SPEC.mdnp:ui-phaseUI executor, reviewerScreens, Components, Interactions, Accessibility, Design-system references
<NN>-AI-SPEC.mdnp:ai-integration-phaseAI executor, eval-reviewerFramework selector, Model profile, Prompt contracts, Eval strategy, Metrics
<NN>-REVIEW.md / REVIEW-FIX.mdnp:review / np:code-reviewexecutor (follow-up), verifierFindings table, Severity, Remediation plan
<NN>-verify.shnp:plan-phase (optional)executor, verifier, CIPOSIX-sh script; exit 0 = pass, non-zero = fail. Each assertion uses [ -f ... ] / grep -q ... / node --test ... style

Parser contract

lib/phase.cjs (findPhaseDir, paddedPhase, slug) navigates the directory tree by filename convention only. lib/plan.cjs (parsePlan, listPlans) reads PLAN.md files. lib/tasks.cjs (loadTaskGraph, validateTaskFrontmatter) reads tasks/*.md if the subdirectory exists.

None of these parsers read any of the optional files listed above. Workflows that consume optional files do so by explicit path (e.g. fs.readFileSync(path.join(phaseDir, '04-CONTEXT.md'), 'utf-8')) with ENOENT-tolerance — a missing file is a non-error state meaning "that step has not been run".

Producer-workflow vs. consumer-agent separation

Workflow commands (np:*) produce files; subagents (planner, researcher, executor, verifier, plan-checker) consume them. A well-formed phase directory reflects exactly which workflow steps have been completed, which is what np:next uses to compute the next actionable step (Phase-4 D-12..D-15 gate rules).

Relation to D-24 / D-25

  • D-24: Only PLAN.md and tasks/ are parser-mandatory. Every other file is workflow-produced and may be absent.
  • D-25: This file is the authoritative spec for the optional-file list. When a new workflow is added (e.g. Phase 5's np:research-phase), it must either produce one of the files listed above or extend this table.

References

  • Phase-4 04-CONTEXT.md §decisions D-24, D-25
  • Phase-3 03-CONTEXT.md §D-12..D-17 (task-frontmatter baseline)
  • lib/plan.cjs, lib/tasks.cjs, lib/phase.cjs — the only parsers that read this tree