# Conventions — File Formats, Paths & Rules Read this before doing any file operations across all phases. --- ## Directory Structure ``` .claude/ ├── prds/ │ └── .md # Product requirement documents ├── epics/ │ ├── / │ │ ├── epic.md # Technical epic │ │ ├── .md # Task files (named by GitHub issue number after sync) │ │ ├── -analysis.md # Parallel work stream analysis │ │ ├── github-mapping.md # Issue number → URL mapping │ │ ├── execution-status.md # Active agents tracker │ │ └── updates/ │ │ └── / │ │ ├── stream-A.md # Per-agent progress │ │ ├── progress.md # Overall issue progress │ │ └── execution.md # Execution state │ └── archived/ │ └── / # Completed epics └── context/ # Project context docs (separate system) ``` --- ## Frontmatter Schemas ### PRD (.claude/prds/.md) ```yaml --- name: # kebab-case, matches filename description: # used in lists and summaries status: backlog | active | completed created: # date -u +"%Y-%m-%dT%H:%M:%SZ" --- ``` ### Epic (.claude/epics//epic.md) ```yaml --- name: status: backlog | in-progress | completed created: updated: progress: 0% # recalculated when tasks close prd: .claude/prds/.md github: https://github.com///issues/ # set on sync --- ``` ### Task (.claude/epics//.md) ```yaml --- name: status: open | in-progress | closed created: updated: github: https://github.com///issues/ # set on sync depends_on: [] # issue numbers this must wait for parallel: true # can run concurrently with non-conflicting tasks conflicts_with: [] # issue numbers that touch the same files --- ``` ### Progress (.claude/epics//updates//progress.md) ```yaml --- issue: started: last_sync: completion: 0% --- ``` --- ## Datetime Rule Always get real current datetime from the system — never use placeholder text: ```bash date -u +"%Y-%m-%dT%H:%M:%SZ" ``` --- ## Frontmatter Update Pattern When updating a single frontmatter field in an existing file: ```bash sed -i.bak "/^:/c\\: " rm .bak ``` When stripping frontmatter to get body content for GitHub: ```bash sed '1,/^---$/d; 1,/^---$/d' > /tmp/body.md ``` --- ## GitHub Operations ### Repository Safety Check (run before any write operation) ```bash remote_url=$(git remote get-url origin 2>/dev/null || echo "") if [[ "$remote_url" == *"automazeio/ccpm"* ]]; then echo "❌ Cannot write to the CCPM template repository." echo "Update remote: git remote set-url origin https://github.com/YOUR/REPO.git" exit 1 fi REPO=$(echo "$remote_url" | sed 's|.*github.com[:/]||' | sed 's|\.git$||') ``` ### Authentication Don't pre-check authentication. Run the `gh` command and handle failure: ```bash gh || echo "❌ GitHub CLI failed. Run: gh auth login" ``` ### Getting Issue Numbers ```bash # From a task file's github field: grep 'github:' | grep -oE '[0-9]+$' ``` --- ## Git / Worktree Conventions - One branch per epic: `epic/` - Worktrees live at `../epic-/` (sibling to project root) - Always start branches from an up-to-date main: ```bash git checkout main && git pull origin main git worktree add ../epic- -b epic/ ``` - Commit format inside epics: `Issue #: ` - Never use `--force` in any git operation --- ## Naming Conventions - Feature names: kebab-case, lowercase, letters/numbers/hyphens, starts with a letter - Task files before sync: `001.md`, `002.md`, ... (sequential) - Task files after sync: renamed to GitHub issue number (e.g., `1234.md`) - Labels applied on sync: `epic`, `epic:`, `feature` (for epics); `task`, `epic:` (for tasks) --- ## Epic Progress Calculation ```bash total=$(ls .claude/epics//[0-9]*.md 2>/dev/null | wc -l) closed=$(grep -l '^status: closed' .claude/epics//[0-9]*.md 2>/dev/null | wc -l) progress=$((closed * 100 / total)) ``` Update epic frontmatter when any task closes.