dmx
Reference

Directory Structure

.dmx/: the project memory bank

The .dmx/ directory is committed to your repository. It contains project configuration, the repo-wide memory bank, and one folder per ticket with its spec, plan, learning inbox, and loop state. In a monorepo it also has one folder per component.

.dmx/
├── config.md                    # Project configuration
├── projectbrief.md              # Project goals and scope
├── productContext.md            # User-facing behavior and flows
├── systemPatterns.md            # Architecture decisions, code conventions
├── techContext.md               # Tech stack, dependencies, build system
├── shared-sources.yaml          # Org-wide shared sources (optional)
├── shared-sources.lock          # Their locked commits and hashes
│
├── loops/                       # Custom loop configs (optional)
│   ├── dev.yaml                 # Overrides the bundled dev loop
│   └── docs.yaml                # Custom documentation loop
│
├── skills/                      # Custom skills (optional)
│   ├── commit.md                # Overrides the bundled commit skill in loops
│   └── security-review/         # Folder-shaped skill
│       └── SKILL.md
│
├── components/                  # Monorepos only (optional)
│   └── {id}/
│       ├── component.yaml       # Description, paths, depends_on, test, validators, ticket
│       ├── *.md                 # Memory about this component
│       ├── skills/ loops/ validators/   # Its own, named {id}/{name}
│       ├── shared-sources.yaml  # Its own shared sources (optional)
│       └── shared-sources.lock
│
├── jobs/                        # One folder per ticket
│   └── {job_id}/
│       ├── spec.md              # The ticket's spec
│       ├── tasks.md             # Its implementation plan
│       ├── activeContext.md     # Its learning inbox
│       ├── {loop_name}-{task_id}.json   # Loop runs (also the active-run signal)
│       └── validation-report.json       # Written by the validate skill
│
├── releases/                    # Drafted release notes (optional)
│   └── v0.3.0.md
│
└── .cache/                      # Shared sources fetched at their locked commits (git-ignored)
    └── {repo}@{commit}/

File descriptions

config.md

Written by /dmx/init. Contains:

  • Workflow mode: jira, github-issues, or none
  • Ticketing configuration (project key, board URL)
  • Branch naming conventions (feature prefix, bug prefix)
  • Protected branches (integration branch, production branch)
  • Auto-detected tech stack
  • The test command (test_command) and its known failures (test_known_failures), when set. See Test Commands

projectbrief.md

Project goals and scope. Written by /dmx/init from your README and project files. Durable — rarely updated after the initial setup.

productContext.md

User-facing behavior and flows: why the project exists, how it works, who uses it. Written by /dmx/init, updated by /dmx/create-pr and /dmx/update-memory when user-facing behavior changes.

systemPatterns.md

Architecture decisions and code conventions:

# System Patterns

## Repository pattern
All database access goes through repository classes in `src/repositories/`.
Service layer calls repositories, never accesses the DB directly.

## Error handling
Use custom exception classes from `src/exceptions.py`.
HTTP errors are caught in middleware and converted to standard error responses.

## Testing
Unit tests mock at the repository boundary.
Integration tests use a real test database via the `db_session` fixture.
Test files mirror the source structure under `tests/`.

techContext.md

Describes the project's tech stack. Example content:

# Tech Context

## Language and runtime
Python 3.12, managed with uv

## Key dependencies
- FastAPI 0.111: web framework
- SQLAlchemy 2.0: ORM (async)
- Pydantic v2: validation
- pytest + pytest-asyncio: testing

## Build and tooling
- uv for package management and running
- ruff for linting and formatting
- mypy for type checking (strict mode)
- GitHub Actions for CI

## Database
PostgreSQL 16 via asyncpg. Migrations with Alembic.

jobs/{job_id}/activeContext.md

The ticket's learning inbox — three sections: ## Open Learnings, ## Open Decisions, ## Session Notes. Updated by commit (light progress notes) and by the loop runtime (a one-line breadcrumb per loop run). create-pr promotes what's left in the inbox before opening the PR. update-memory reads it, promotes durable items into systemPatterns.md, techContext.md, or productContext.md, and clears what it promotes. In a monorepo, items are tagged with their owner and wait here for that owner's PR; see Monorepos.

jobs/{job_id}/spec.md

The ticket's spec. Created by create-ticket or derive-ticket. Its frontmatter names the ticket and branch (which is how dmx finds the current job), and in a monorepo its components. Read by plan to generate tasks.md. Validators get its path as loop_context.spec_path and use it in check_spec_complete and spec_adherence.

jobs/{job_id}/tasks.md

The phased implementation plan. Created by plan. Read by implement-next-phase and implement-next-task to know what to build. The repeat_until: all_phases_complete condition reads this file to check for unchecked items.

Format:

## Phase 1: Data model

- [x] Add `RateLimit` model with fields: `api_key`, `window_seconds`, `max_requests`
- [x] Write migration for the new table
- [x] Add model tests

## Phase 2: Service layer

- [ ] Implement `RateLimitService.check(api_key)` → bool
- [ ] Implement `RateLimitService.record_request(api_key)`
- [ ] Write service tests

shared-sources.yaml and shared-sources.lock

Declares the org-wide shared sources this repo pulls loops, skills, and validators from, each pinned to a tag, branch, or commit SHA. Optional — without it, dmx resolves from the repo and its bundled defaults only. The lock, written by /dmx/update-shared-sources, records each source's commit and content hash; commit both.

shared_sources:
  - name: org-wide
    source: "git::https://github.com/acme/dmx-shared.git//?ref=v1.4.0"

loops/*.yaml

Custom loop configs. Any file here overrides the shared-source or bundled loop with the same name. See Loop Configuration.

skills/

Custom skills for this repo. When a loop runs a skill, dmx checks here first, then shared sources, then the bundled skills, so a file here overrides a skill of the same name. Each skill is either a flat {name}.md file or a {name}/SKILL.md folder with optional scripts/, references/, and assets/.

components/{id}/

One service or package in a monorepo. component.yaml declares its description and the paths it owns, and optionally depends_on, a test command, extra validators, and a ticket destination. Its *.md files are its memory. It can hold its own skills/, loops/, and validators/, and its own shared sources. See Monorepos and the component.yaml reference.

.cache/{repo}@{commit}/

A shared source's tree at its locked commit, fetched on first use and checked against the lock's hash. Git-ignored: never commit it. Don't edit these files — change the source repo, or override a file in your own .dmx/loops/, .dmx/skills/, or validators/ instead. Repos still on 0.5 may have a committed .dmx/vendor/; /dmx/upgrade replaces it with the lock.

jobs/{job_id}/{loop_name}-{task_id}.json

Full state for a single loop run. The job is the folder in .dmx/jobs/ whose spec.md frontmatter branch is the current branch; its folder name is the ticket ID when there is one, else the branch name, and a detached HEAD resolves to unknown. The task ID is a UUID4 assigned when the loop starts. A component loop such as ledger/backfill is stored as ledger--backfill-{task_id}.json.

The loop runtime commits this file when a chain of loops stops (the next skill's commit picks it up between loops), together with the session-note breadcrumb it adds to the job's activeContext.md. See Jobs, Tasks & Persistent State.

{
  "loop_name": "dev",
  "job_id": "DM-123",
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "paused",
  "current_skill_index": 1,
  "skills": ["implement-next-phase", "commit"],
  "skills_completed": ["implement-next-phase"],
  "skill_outputs": {
    "implement-next-phase": "Phase 1 complete. Added RateLimit model..."
  },
  "validator_results": [],
  "outcome": null,
  "iteration_count": 0,
  "timestamp": "2026-08-21T09:14:22Z",
  "updated_at": "2026-08-21T09:20:11Z"
}

status is one of pending, running, paused, iterating, validating, complete, or failed. validating means the loop's validators are running in the background.

There's no separate pointer file for the active run. loop_advance, loop_continue, and loop_status find it by scanning a job's state files for the one with a non-terminal status — pending, running, paused, iterating, or validating. A run that failed and started a rework waits as reworking while its rework run is the active one; it records that run, and the rework run records it as rework_parent. On a feature branch, a Release Loop run that create-pr marked complete before committing, with outcome still null, also counts until /dmx/loop-continue runs its validators. Everything else under jobs/ is historical: completed or failed runs from earlier in the ticket's lifecycle. Only files with loop_name, task_id, and status fields count as task state; artifacts that skills write into the job folder, like validation-report.json, are ignored. This is also what keeps state isolated per branch — the scan is scoped to the job id derived from the current branch/ticket, so switching branches and running a loop there can't touch another branch's paused run.

The Spec Loop is a special case: it creates a brand-new ticket, so it doesn't have a real job id yet when it starts. It runs under a temporary _pending-{task_id} folder until create-ticket writes a spec.md whose branch matches the new branch, at which point the folder is renamed to the real job ID. dmx won't rename it into a job folder that already has loop runs; the error tells you to fix the spec's frontmatter or move that folder aside. If you ever see a _pending-* folder lingering, it means a Spec Loop run didn't finish — resume it with /dmx/loop-continue or delete the folder if it's a stale leftover.

releases/{version}.md

Drafted release notes created by draft-release-note, which commits and pushes the file so it's included in the release-merge PR. Read by release-merge and create-release. Stored here so the notes can be reviewed and edited before the release is published.

On this page