:PROPERTIES:
:ID:       d6061a01-7699-45a6-bc1b-1c328f2eab16
:CREATED:  [2026-03-30 Mon 21:16]
:EDITED:   [2026-04-07 Tue 13:42]
:END:
#+TITLE: Modular Emacs Configuration
#+DATE: 2026-03-30
#+FILETAGS: :emacs:architecture:dotemacs:org-mode:
#+STARTUP: content

* Overview
The Emacs configuration has been migrated from a monolithic `emacs.org` file to a modular, directory-based architecture. This system is designed for high maintainability, literate programming, and seamless integration with the [[file:personal-software-foundry.org][Personal Software Foundry (PSF)]].

* Architecture

** 1. Initialization Loop (~/.emacs)
The entry point (`~/.emacs`) bootstraps `straight.el` and then uses `org-babel-load-file` to trigger the modular configuration chain starting from `~/memex/system/dotemacs.org`.

** 2. The Orchestrator (dotemacs.org)
Located at `~/memex/system/dotemacs.org`, this file serves as the "Orchestrator." It uses `load-file` to sequentially execute the tangled `.el` versions of each module in the system directory.

** 3. Functional Modules (emacs-*.org)
The configuration is split into domain-specific Org-mode files within `~/memex/system/`:
- `emacs-core.org`: Package management (straight.el), performance, and global variables.
- `emacs-org.org`: Core Org-mode settings, capture templates, and file paths.
- `emacs-gtd.org`: [[file:org-gtd-v4-migration.org][org-gtd v4.0]] and task management.
- `emacs-roam.org`: Zettelkasten and daily notes setup.
- `emacs-ai.org`: Integration with LLMs and agents.
- (Other modules: `media`, `writing`, `shell`, `misc`, `early-init`).

* Path Normalization
A critical part of the migration was standardizing all internal paths to the `memex` structure:
- `org-directory`: `~/memex/`
- `org-roam-directory`: `~/memex/notes/`
- `org-roam-dailies-directory`: `~/memex/daily/`
- `inbox.org` and `gtd.org` are now in the root of `~/memex/`.

* Operational Mandates
- *Literate Programming:* All configuration MUST be written in `.org` files.
- *Kebab-Case:* All file naming follows the kebab-case (hyphens) standard.
- *Tangle Local:* Every module tangles to its own `.el` file in the same directory (`:tangle yes`) to ensure loading efficiency.

* See Also
- [[file:org-gtd-v4-migration.org][org-gtd v4.0 Migration]]
- [[file:personal-software-foundry.org][Personal Software Foundry (PSF)]]
- [[file:institutional-memory.org][Institutional Memory (SOUL)]]
