Archon Directories
This document explains the Archon directory structure and configuration system for developers contributing to or extending Archon.
Overview
Section titled “Overview”Archon provides a unified directory and configuration system with:
- Consistent paths across all platforms (Mac, Linux, Windows, Docker)
- Configuration precedence chain (env > global > repo > defaults)
- Workflow engine integration with YAML definitions in
.archon/workflows/
Directory Structure
Section titled “Directory Structure”User-Level: ~/.archon/
Section titled “User-Level: ~/.archon/”~/.archon/ # ARCHON_HOME├── workspaces/ # Cloned repositories (project-centric layout)│ └── owner/│ └── repo/│ ├── source/ # Clone or symlink -> local path│ └── worktrees/ # Git worktrees for this project├── worktrees/ # Legacy global worktrees (for repos not in workspaces/)└── config.yaml # Global user configurationPurpose:
workspaces/- Repositories cloned via/clonecommand or GitHub adapterworkspaces/owner/repo/worktrees/- Git worktrees for this project (new registrations)worktrees/- Legacy fallback for repos not registered underworkspaces/config.yaml- Non-secret user preferences
Repo-Level: .archon/
Section titled “Repo-Level: .archon/”any-repo/.archon/├── commands/ # Custom commands│ ├── plan.md│ └── execute.md├── workflows/ # Workflow definitions (YAML files)│ └── pr-review.yaml└── config.yaml # Repo-specific configurationPurpose:
commands/- Slash commands (auto-loaded on clone)workflows/- YAML workflow definitions, discovered recursively at runtimeconfig.yaml- Project-specific settings
Docker: /.archon/
Section titled “Docker: /.archon/”In Docker containers, the Archon home is fixed at /.archon/ (root level). This is:
- Mounted as a named volume for persistence
- Not overridable by end users (simplifies container setup)
Path Resolution
Section titled “Path Resolution”All path resolution is centralized in packages/paths/src/archon-paths.ts (@archon/paths).
Core Functions
Section titled “Core Functions”// Get the Archon home directorygetArchonHome(): string// Returns: ~/.archon (local) or /.archon (Docker)
// Get workspaces directorygetArchonWorkspacesPath(): string// Returns: ${ARCHON_HOME}/workspaces
// Get global worktrees directory (legacy fallback)getArchonWorktreesPath(): string// Returns: ${ARCHON_HOME}/worktrees
// Get global config pathgetArchonConfigPath(): string// Returns: ${ARCHON_HOME}/config.yaml
// Get command folder search paths (priority order)getCommandFolderSearchPaths(configuredFolder?: string): string[]// Returns: ['.archon/commands'] + configuredFolder if specifiedDocker Detection
Section titled “Docker Detection”function isDocker(): boolean { return ( process.env.WORKSPACE_PATH === '/workspace' || (process.env.HOME === '/root' && Boolean(process.env.WORKSPACE_PATH)) || process.env.ARCHON_DOCKER === 'true' );}Platform-Specific Paths
Section titled “Platform-Specific Paths”| Platform | getArchonHome() |
|---|---|
| macOS | /Users/<username>/.archon |
| Linux | /home/<username>/.archon |
| Windows | C:\Users\<username>\.archon |
| Docker | /.archon |
Configuration System
Section titled “Configuration System”Precedence Chain
Section titled “Precedence Chain”Configuration is resolved in this order (highest to lowest priority):
- Environment Variables - Secrets, deployment-specific
- Global Config (
~/.archon/config.yaml) - User preferences - Repo Config (
.archon/config.yaml) - Project-specific - Built-in Defaults - Hardcoded in
packages/core/src/config/config-types.ts
Config Loading
Section titled “Config Loading”// Load merged config for a repoconst config = await loadConfig(repoPath);
// Load just global configconst globalConfig = await loadGlobalConfig();
// Load just repo configconst repoConfig = await loadRepoConfig(repoPath);Configuration Options
Section titled “Configuration Options”Key configuration options:
| Option | Env Override | Default |
|---|---|---|
ARCHON_HOME | ARCHON_HOME | ~/.archon |
| Default AI Assistant | DEFAULT_AI_ASSISTANT | claude |
| Telegram Streaming | TELEGRAM_STREAMING_MODE | stream |
| Discord Streaming | DISCORD_STREAMING_MODE | batch |
| Slack Streaming | SLACK_STREAMING_MODE | batch |
Command Folders
Section titled “Command Folders”Command detection searches in priority order:
.archon/commands/- Always searched first- Configured folder from
commands.folderin.archon/config.yaml(if specified)
Example configuration:
commands: folder: .claude/commands/archon # Additional folder to searchExtension Points
Section titled “Extension Points”Adding New Paths
Section titled “Adding New Paths”To add a new managed directory:
- Add function to
packages/paths/src/archon-paths.ts:
export function getArchonNewPath(): string { return join(getArchonHome(), 'new-directory');}- Update Docker setup in
Dockerfile - Update volume mounts in
docker-compose.yml - Add tests in
packages/paths/src/archon-paths.test.ts
Adding Config Options
Section titled “Adding Config Options”To add new configuration options:
- Add type to
packages/core/src/config/config-types.ts:
export interface GlobalConfig { // ...existing newFeature?: { enabled?: boolean; setting?: string; };}- Add default in
getDefaults()function - Use via
loadConfig()in your code
Design Decisions
Section titled “Design Decisions”Why ~/.archon/ instead of ~/.config/archon/?
Section titled “Why ~/.archon/ instead of ~/.config/archon/?”- Simpler path (fewer nested directories)
- Follows Claude Code pattern (
~/.claude/) - Cross-platform without XDG complexity
- Easy to find and manage manually
Why YAML for config?
Section titled “Why YAML for config?”- Bun has native support (via
yamlpackage) - Supports comments (unlike JSON)
- Workflow definitions use YAML
- Human-readable and editable
Why fixed Docker paths?
Section titled “Why fixed Docker paths?”- Simplifies container setup
- Predictable volume mounts
- No user confusion about env vars in containers
- Matches convention (apps use fixed paths in containers)
Why config precedence chain?
Section titled “Why config precedence chain?”- Mirrors git config pattern (familiar to developers)
- Secrets stay in env vars (security)
- User preferences in global config (portable)
- Project settings in repo config (version-controlled)
UI Integration
Section titled “UI Integration”The config type system is designed for:
- Web UI configuration
- API-driven config updates
- Real-time config validation