dex

Dex is a workflow automation framework for Claude Code. Give it a ticket number or task description and it creates an isolated worktree, plans the work, implements it, reviews it, verifies it, opens a PR, watches CI and review feedback, then cleans up when the PR is ready.

dx 342

One command. Worktree created, ticket context loaded, autonomous lifecycle started.

The loop

The core idea is simple: Claude Code has a Stop hook. Every time the agent tries to finish, Dex intercepts it and injects a phase-specific audit prompt. The agent cannot exit the current phase until the audit criteria are satisfied.

This is what makes it autonomous rather than just a prompt library. Without the loop, Claude can plan something, implement half of it, and tell you it is done. With the loop, it plans, waits for approval, implements, self-reviews, fixes its own findings, runs quality gates, retries on failure, commits, opens the PR, monitors CI, addresses review comments, and closes the ticket. At every step, the Stop hook asks whether the current phase is actually complete. If the answer is no, the agent keeps going.

Each phase has its own audit criteria:

  1. Plan — did the user approve an approach? Are tasks written?
  2. Implement — did every task pass self-review with zero findings? Did quality gates pass?
  3. Review — did fresh review waves run until the clean-pass gate succeeded?
  4. Verify and commit — did format, lint, typecheck, and tests all pass? Are commits pushed?
  5. PR — is the PR created and tracker updated?
  6. Complete — did CI pass? Are review comments addressed? Is the ticket closed?

Stall detection prevents infinite loops. If the agent makes no progress for five minutes across three consecutive iterations, Dex escalates rather than burning tokens.

Worktree isolation

Every ticket gets its own git worktree in .dex/worktrees/. Work on multiple tickets in parallel without branch switching or stash juggling. dxls lists active worktrees, dxrm removes them, and dxclean prunes stale ones.

Guard system

A set of markdown-defined guards run before every Bash, Edit, and Write tool call. Built-in guards block destructive commands, sensitive file modifications, and hardcoded secrets. Project-specific guards are generated during dx init based on your codebase. Guards use Python regex with a two-second timeout per pattern to prevent ReDoS.

Self-review

Implementation includes a two-perspective review loop. First, the implementing agent walks all changed files, checking correctness, design, and consistency. Then an independent self-reviewer agent, read-only and running on a separate model, performs a 10-pass semantic review covering correctness, security, performance, testing, and more. Findings are confidence-scored 0-100; only those above 50 surface. The loop continues until there are zero findings.

Codebase-agnostic

Install once globally, use on any project. dx init analyses your codebase with Claude Code and generates quality gate configs, coding convention rules, and project-specific guards. It discovers your format, lint, typecheck, and test commands rather than prescribing specific tools. Shell scripts and Python stdlib only, with no runtime dependencies.

Skills

Core slash commands are standalone skills that also work independently outside the full lifecycle:

SkillPurpose
/dexFull lifecycle orchestrator
/dxplanMulti-approach planning from ticket context
/dximplementTDD implementation with self-review
/dxreviewloopRepeated review waves until the change is clean
/dxverifyDiscover and run quality gates
/dxcommitAtomic conventional commits
/dxprPR creation with tracker updates
/dxcompleteFinal verification and ticket closure
/dxloopPrompt loop for ad-hoc tasks
/dxsyncRefresh project rules and durable memory

Stack

Zsh for the CLI, Bash for hooks and shared libraries, Python 3 stdlib for guard evaluation. No npm packages, no pip dependencies. Integrates with Linear and GitHub Issues for ticket tracking.


Stay up to date

Get notified when I publish something new, and unsubscribe at any time.