Skip to content

07 reference file structure

Doug Beard edited this page Aug 20, 2025 · 2 revisions

Coherence APM Framework v4.2.0 - File Structure Reference

Complete directory and file organization reference for the Coherence - Agentic Persona Mapping (APM) framework.

πŸ“‹ Table of Contents

  1. Overview
  2. Root Directory Structure
  3. APM Directory (.apm)
  4. Claude Code Integration (.claude)
  5. Installation Structure
  6. File Naming Conventions
  7. Permission Requirements

πŸ—οΈ Overview

Coherence APM v4.2.0 follows a unified directory structure optimized for:

  • Native Sub-Agent Integration with Claude Code's slash command system
  • Coherence Orchestration with centralized intelligence coordination
  • Enhanced TTS Audio Experience with unified voice notification system
  • Modular Architecture with clear separation between .apm/ and .claude/ concerns

Key Principles

  • Coherence Framework: Centralized orchestration with intelligent agent coordination
  • Unified Context Engineering: Enhanced information flow between specialized personas
  • 67 Slash Commands: Complete command interface for all development workflows
  • Cross-Platform TTS: Unified voice notification system across all platforms

πŸ“ Root Directory Structure

{{PROJECT_ROOT}}/
β”œβ”€β”€ .apm/                           # Coherence APM Framework Installation
β”œβ”€β”€ .claude/                        # Claude Code Integration & Commands
β”œβ”€β”€ project_docs/                   # Project Documentation & Reports
β”œβ”€β”€ payload/                        # Installation Templates & Resources
β”œβ”€β”€ dist/                          # Distribution Builds
β”œβ”€β”€ scripts/                       # Utility Scripts
β”œβ”€β”€ CLAUDE.md                      # Claude Code Instructions
β”œβ”€β”€ README.md                      # Project Overview
β”œβ”€β”€ VERSION                        # Current Version (v4.2.0)
└── build-distribution.sh          # Distribution Builder

Core Files

File Description Version Purpose
CLAUDE.md Coherence framework activation instructions v4.2.0 Framework integration
README.md Project overview and capabilities v4.2.0 User documentation
VERSION Current framework version 4.2.0 Version tracking
build-distribution.sh Distribution packaging script v4.2.0 Release management

Directory Purpose:

  • .apm/ - Core framework with agents, voice scripts, and orchestration
  • .claude/ - Commands, hooks, and Claude Code integration
  • project_docs/ - Documentation, reports, and planning artifacts

🎯 APM Directory (.apm)

The .apm directory contains the complete Coherence APM framework installation:

{{APM_ROOT}}/
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ personas/                   # Individual Persona Directories
β”‚   β”‚   β”œβ”€β”€ analyst/                # Business Analyst persona
β”‚   β”‚   β”œβ”€β”€ architect/              # System Architect persona
β”‚   β”‚   β”œβ”€β”€ dev/                    # Developer persona
β”‚   β”‚   β”œβ”€β”€ pm/                     # Project Manager persona
β”‚   β”‚   β”œβ”€β”€ po/                     # Product Owner persona
β”‚   β”‚   β”œβ”€β”€ qa/                     # QA Engineer persona
β”‚   β”‚   └── sm/                     # Scrum Master persona
β”‚   β”œβ”€β”€ voice/                      # Voice Notification Scripts
β”‚   β”‚   β”œβ”€β”€ speakOrchestrator.sh
β”‚   β”‚   β”œβ”€β”€ speakAnalyst.sh
β”‚   β”‚   β”œβ”€β”€ speakArchitect.sh
β”‚   β”‚   β”œβ”€β”€ speakDeveloper.sh
β”‚   β”‚   β”œβ”€β”€ speakPm.sh
β”‚   β”‚   β”œβ”€β”€ speakPo.sh
β”‚   β”‚   β”œβ”€β”€ speakQa.sh
β”‚   β”‚   β”œβ”€β”€ speakSm.sh
β”‚   β”‚   β”œβ”€β”€ speakDesignArchitect.sh
β”‚   β”‚   └── speakBase.sh
β”‚   β”œβ”€β”€ checklists/                 # Quality & Process Checklists
β”‚   β”œβ”€β”€ orchestrator/               # Coherence Orchestration Logic
β”‚   β”œβ”€β”€ monitoring/                 # System Monitoring & Metrics
β”‚   └── data/                       # Agent Knowledge Base
β”œβ”€β”€ scripts/                        # APM Utility Scripts
β”‚   β”œβ”€β”€ ap-manager.sh
β”‚   β”œβ”€β”€ tts-manager.sh
β”‚   β”œβ”€β”€ notification-manager.sh
β”‚   └── configure-tts.sh
β”œβ”€β”€ .installer/                     # Installation Framework
└── .payload/                       # Template Payload System

APM Subdirectories

/agents/personas/

Contains persona definition files generated from master JSON definitions.

File Persona Generated From
analyst.persona.md Business Analyst installer/personas/_master/analyst.persona.json
architect.persona.md System Architect installer/personas/_master/architect.persona.json
developer.persona.md Developer installer/personas/_master/developer.persona.json
pm.persona.md Project Manager installer/personas/_master/pm.persona.json
po.persona.md Product Owner installer/personas/_master/po.persona.json
qa.persona.md QA Engineer installer/personas/_master/qa.persona.json
sm.persona.md Scrum Master installer/personas/_master/sm.persona.json
design-architect.persona.md Design Architect installer/personas/_master/design-architect.persona.json

/agents/voice/

Voice notification scripts for audio feedback.

Script Persona Platform
speakOrchestrator.sh Coherence Orchestrator Linux/macOS/WSL
speakAnalyst.sh Business Analyst Linux/macOS/WSL
speakArchitect.sh System Architect Linux/macOS/WSL
speakDeveloper.sh Developer Linux/macOS/WSL
speakPm.sh Project Manager Linux/macOS/WSL
speakPo.sh Product Owner Linux/macOS/WSL
speakQa.sh QA Engineer Linux/macOS/WSL
speakSm.sh Scrum Master Linux/macOS/WSL
speakDesignArchitect.sh Design Architect Linux/macOS/WSL

/session_notes/

Session management with automatic archiving.

session_notes/
β”œβ”€β”€ archive/
β”‚   β”œβ”€β”€ 2025-01-10-completed-sessions/
β”‚   └── 2025-01-14-archived-sessions/
β”œβ”€β”€ 2025-01-15-14-30-00-Orchestrator-Setup.md      # Active session
β”œβ”€β”€ 2025-01-15-15-45-12-Development-Sprint.md       # Active session
└── 2025-01-15-16-20-33-QA-Framework-Testing.md     # Active session

Session Note Naming Convention: YYYY-MM-DD-HH-mm-ss-{Description}.md

/rules/

Behavioral and operational rules for APM agents.

File Purpose Scope
orchestrator-rules.md Coherence Orchestrator behavior Coordination, delegation
session-management-rules.md Session handling Note-taking, transitions
backlog-management-rules.md Backlog updates Story tracking, acceptance criteria
parallel-execution-rules.md Parallel processing Sub-agent coordination
qa-framework-rules.md QA operations Testing, quality metrics

/config/

Configuration files and schemas.

File Content Format
apm-config.json APM system configuration JSON
persona-config.json Persona-specific settings JSON
hooks-config.json Hook system configuration JSON
voice-config.json Voice notification settings JSON

πŸ“š Project Documentation

The project_docs directory contains comprehensive project documentation:

{{PROJECT_DOCS_PATH}}/
β”œβ”€β”€ README.md                       # Project Documentation Overview
β”œβ”€β”€ backlog.md                      # Product Backlog (CRITICAL)
β”œβ”€β”€ architecture.md                 # System Architecture
β”œβ”€β”€ api-documentation.md            # API Reference
β”œβ”€β”€ deployment-guide.md             # Deployment Instructions
β”œβ”€β”€ troubleshooting.md              # Common Issues & Solutions
β”œβ”€β”€ reports/                        # Generated Reports
β”‚   β”œβ”€β”€ persona-usage-report.md
β”‚   β”œβ”€β”€ qa-metrics-report.md
β”‚   └── sprint-velocity-report.md
└── archive/                        # Historical Documentation
    β”œβ”€β”€ v3.5.0-documentation/
    └── legacy-architecture/

Critical Files

backlog.md - Product Backlog

🚨 CRITICAL: The most important file in the project. All personas must update this file.

# Product Backlog

## Current Sprint (Sprint 5)

### In Progress
- **[Story-001]** User Authentication System [8 points] - Developer: John
  - [x] Login form implementation
  - [x] Password validation
  - [ ] Session management
  - [ ] Password reset functionality
  
### Ready for Sprint
- **[Story-002]** Product Catalog [13 points]
- **[Story-003]** Shopping Cart [5 points]

## Epics

### Epic 1: User Management (60% Complete)
- Authentication System (In Progress)
- User Profile Management (Ready)
- Access Control (Backlog)

πŸ”§ Claude Code Integration (.claude)

The .claude directory integrates Coherence APM with Claude Code's slash command system:

{{CLAUDE_ROOT}}/
β”œβ”€β”€ commands/                       # 67 Slash Commands
β”‚   β”œβ”€β”€ coherence.md               # Coherence Orchestrator (primary)
β”‚   β”œβ”€β”€ ap.md                      # Coherence Orchestrator (legacy alias)
β”‚   β”œβ”€β”€ analyst.md                 # Business Analyst
β”‚   β”œβ”€β”€ architect.md               # System Architect
β”‚   β”œβ”€β”€ developer.md               # Developer
β”‚   β”œβ”€β”€ pm.md                      # Project Manager
β”‚   β”œβ”€β”€ po.md                      # Product Owner
β”‚   β”œβ”€β”€ qa.md                      # QA Engineer
β”‚   β”œβ”€β”€ sm.md                      # Scrum Master
β”‚   β”œβ”€β”€ design-architect.md        # Design Architect
β”‚   β”œβ”€β”€ planning-*.md              # Planning workflow commands
β”‚   β”œβ”€β”€ qa-*.md                    # QA framework commands
β”‚   β”œβ”€β”€ parallel-*.md              # Parallel execution commands
β”‚   β”œβ”€β”€ implementation-*.md        # Implementation commands
β”‚   β”œβ”€β”€ documentation-*.md         # Documentation commands
β”‚   └── [... 50+ additional commands]
β”œβ”€β”€ hooks/                          # Claude Code Integration Hooks
β”‚   β”œβ”€β”€ pre_tool_use.py            # Pre-execution processing
β”‚   β”œβ”€β”€ post_tool_use.py           # Post-execution processing
β”‚   β”œβ”€β”€ user_prompt_submit.py      # Prompt enhancement
β”‚   β”œβ”€β”€ notification.py            # Voice notification system
β”‚   β”œβ”€β”€ pre_compact.py             # Session compaction
β”‚   └── hook_utils.py              # Utility functions
β”œβ”€β”€ output-styles/                  # Custom Output Formatting
β”‚   β”œβ”€β”€ apm-orchestrator.md        # Orchestrator output style
β”‚   └── README.md                  # Output style documentation
└── agents/                         # Claude Agent Configuration
    β”œβ”€β”€ personas/                   # Persona-specific configs
    β”œβ”€β”€ coordination/               # Multi-agent coordination
    └── qa-framework/               # QA framework integration

Claude Commands Structure

All Claude commands follow this structure:

# Command Title

Brief description of the command.

## Prerequisites
- Required conditions
- Dependencies

## Process Flow
1. Step 1: Description
2. Step 2: Description
3. Step 3: Description

## Success Criteria
- Expected outcomes
- Validation steps

πŸ› οΈ Installer Structure

The installer system manages APM deployment and updates:

installer/
β”œβ”€β”€ personas/
β”‚   └── _master/                    # Master Persona Definitions
β”‚       β”œβ”€β”€ analyst.persona.json
β”‚       β”œβ”€β”€ analyst.persona.yaml
β”‚       β”œβ”€β”€ architect.persona.json
β”‚       β”œβ”€β”€ developer.persona.json
β”‚       β”œβ”€β”€ pm.persona.json
β”‚       β”œβ”€β”€ po.persona.json
β”‚       β”œβ”€β”€ qa.persona.json
β”‚       β”œβ”€β”€ sm.persona.json
β”‚       └── design-architect.persona.json
β”œβ”€β”€ templates/                      # Template System
β”‚   β”œβ”€β”€ APM-README.md.template
β”‚   β”œβ”€β”€ claude/
β”‚   β”‚   └── commands/               # Claude Command Templates
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ personas/               # Persona Templates
β”‚   β”‚   └── voice/                  # Voice Script Templates
β”‚   β”œβ”€β”€ hooks/                      # Hook Templates
β”‚   β”œβ”€β”€ documentation/              # Documentation Templates
β”‚   β”‚   β”œβ”€β”€ 01-getting-started/
β”‚   β”‚   β”œβ”€β”€ 02-personas/
β”‚   β”‚   β”œβ”€β”€ 03-workflows/
β”‚   β”‚   β”œβ”€β”€ 04-commands/
β”‚   β”‚   β”œβ”€β”€ 05-configuration/
β”‚   β”‚   β”œβ”€β”€ 06-troubleshooting/
β”‚   β”‚   β”œβ”€β”€ 07-advanced/
β”‚   β”‚   └── 08-reference/
β”‚   └── rules/                      # Rule Templates
β”œβ”€β”€ scripts/                        # Installation Scripts
β”‚   β”œβ”€β”€ install.sh
β”‚   β”œβ”€β”€ generate-personas.sh
β”‚   β”œβ”€β”€ build-distribution.sh
β”‚   └── update-documentation.sh
β”œβ”€β”€ VERSION                         # Installer Version
└── README.md                       # Installer Guide

Master Persona System

APM v4.0.0 introduces the unified persona system with single source of truth:

JSON Master Definitions

{
  "name": "developer",
  "display_name": "Developer Agent",
  "description": "Full-stack development specialist",
  "voice_script": "speakDeveloper.sh",
  "capabilities": [
    "code_implementation",
    "unit_testing",
    "code_review",
    "technical_documentation"
  ],
  "commands": [
    {
      "name": "implement",
      "description": "Implement feature or fix",
      "parameters": {"story_id": "string", "acceptance_criteria": "array"}
    }
  ]
}

Template Generation Flow

  1. Master Definition: /installer/personas/_master/developer.persona.json
  2. APM Template: Generated to /installer/templates/agents/personas/developer.persona.md.template
  3. Claude Template: Generated to /installer/templates/claude/commands/developer.md.template
  4. Installation: Deployed to {{APM_ROOT}}/agents/personas/developer.persona.md

πŸ“ File Naming Conventions

Session Notes

  • Format: YYYY-MM-DD-HH-mm-ss-{Description}.md
  • Examples:
    • 2025-01-15-14-30-00-Orchestrator-Setup.md
    • 2025-01-15-16-45-22-Sprint-Planning-Session.md

Persona Files

  • Format: {persona-name}.persona.{extension}
  • Examples:
    • developer.persona.json (Master definition)
    • developer.persona.md (Generated persona file)

Voice Scripts

  • Format: speak{PersonaName}.sh
  • Examples:
    • speakDeveloper.sh
    • speakOrchestrator.sh
    • speakDesignArchitect.sh

Command Files

  • Format: {command-name}.md
  • Examples:
    • ap.md (Coherence Orchestrator)
    • parallel-sprint.md (Parallel development)
    • qa-framework.md (QA Framework)

Template Files

  • Format: {base-name}.{extension}.template
  • Examples:
    • README.md.template
    • developer.persona.md.template
    • apm-config.json.template

Rule Files

  • Format: {rule-category}-rules.md
  • Examples:
    • orchestrator-rules.md
    • session-management-rules.md
    • backlog-management-rules.md

πŸ” Permission Requirements

File System Permissions

APM Directory

{{APM_ROOT}}/                       # 755 (rwxr-xr-x)
β”œβ”€β”€ agents/                         # 755 (rwxr-xr-x)
β”‚   β”œβ”€β”€ personas/                   # 755 (rwxr-xr-x)
β”‚   β”‚   └── *.persona.md            # 644 (rw-r--r--)
β”‚   └── voice/                      # 755 (rwxr-xr-x)
β”‚       └── *.sh                    # 755 (rwxr-xr-x)
β”œβ”€β”€ session_notes/                  # 755 (rwxr-xr-x)
β”‚   └── *.md                        # 644 (rw-r--r--)
β”œβ”€β”€ rules/                          # 755 (rwxr-xr-x)
β”‚   └── *.md                        # 644 (rw-r--r--)
└── config/                         # 755 (rwxr-xr-x)
    └── *.json                      # 644 (rw-r--r--)

Voice Scripts

All voice scripts require execution permissions:

chmod +x {{APM_ROOT}}/agents/voice/*.sh

Session Notes Directory

Must be writable for session management:

chmod 755 {{APM_ROOT}}/session_notes/
chmod 755 {{APM_ROOT}}/session_notes/archive/

Security Considerations

File Access

  • Read Access: All users need read access to persona and rule files
  • Write Access: Only APM system needs write access to session notes
  • Execute Access: Voice scripts need execute permissions

Directory Traversal

  • Use absolute paths with template variables
  • Validate all file paths before access
  • Sanitize user-provided file names

πŸ”„ File Lifecycle Management

Template Processing

  1. Build Time: Templates processed during build-distribution.sh
  2. Install Time: Templates deployed to target locations
  3. Runtime: Template variables resolved dynamically

Session Note Archiving

  1. Active Session: Created in {{APM_ROOT}}/session_notes/
  2. Session End: Moved to {{APM_ROOT}}/session_notes/archive/YYYY-MM-DD/
  3. Cleanup: Old archives removed after 90 days (configurable)

Configuration Updates

  1. Version Check: Compare current vs. installed versions
  2. Backup: Create backup of existing configuration
  3. Merge: Merge new configuration with user customizations
  4. Validate: Verify configuration integrity

πŸ“Š File System Metrics

APM v4.0.0 Statistics

Category Count Size (approx)
Core Files 12 2.1 MB
Persona Definitions 9 180 KB
Voice Scripts 9 45 KB
Rule Files 8 120 KB
Template Files 95+ 3.8 MB
Documentation 60+ 1.2 MB
Total Installation ~200 files ~7.5 MB

Cleanup Impact (v4.0.0)

  • Files Removed: 141 deprecated files
  • Lines Removed: 25,599 lines of code
  • Size Reduction: 40% smaller installation
  • Template Consolidation: 3x duplication eliminated

File Structure Version: {{PROJECT_VERSION}}
Last Updated: {{CURRENT_DATE}}
Total Files Documented: 200+ files and directories

Clone this wiki locally