Driftlock is the implementation of a new type of tooling: an AI Orchestrator designed to fight entropy in your codebase, implemented as a standalone tool following the POC and research described in this article published in Q4 2025: Software and Thermodynamics: A Change of Paradigm in the Era of AI.
As of today, you need to have both the git CLI and the codex CLI installed on your machine to be able to run this software. Later, I will add more frictionless and diverse ways to authenticate with these two dependencies as needed. If you need that, feel free to contribute.
Start by creating a driftlock.config.json at the root of your project. It allows you to modify the default configuration, for example:
To generate a full config template, run:
driftlock init
{
"auditors": {
"consistency": {
"enabled": false
},
"security": {
"path": "./.ai/auditors/security.md"
}
}
}
Auditors are the core logic of Driftlock. Each auditor defines domain-specific rules that guide the AI in analyzing your codebase. They are sophisticated prompts used for discovery. When using an auditor, the orchestrator is essentially given a set of instructions allowing the AI to scan the project for issues related to one of the nine pillars described below.
The default auditors live under assets/auditors/ and can be overridden in your project by adding a driftlock.config.json file to the root of your project.
It is recommended that you override the auditors with your own so that they are taylored to your project for an optimal result, but it is optional an the current auditors will perform well as they are designed to be stack agnostic.
When overriding auditors, we recommend to pick a location in your codebase to host your prompts collections, related to this project or not, such as .ai. Ideally, you would create .ai/auditors to write your own set of auditors.
You are also able to create any type of auditor you may imagine beyond the nine pillars described below that are provided by default.
Below are the nine default auditors included with the orchestrator:
-
Complexity — Focuses on reducing accidental complexity, cognitive load, duplication, and tangled logic. Aims to make the system expressive, elegant, and easy to reason about.
File:assets/auditors/complexity.md -
Consistency — Ensures global alignment across naming, structures, patterns, contracts, and conventions. Enforces a coherent, uniform style throughout the system.
File:assets/auditors/consistency.md -
Dependency — Audits dependency manifests and usage across the codebase. Ensures dependencies are minimal, consistent, safe, and free of drift.
File:assets/auditors/dependency.md -
Documentation — Reviews documentation for accuracy, completeness, and alignment with the codebase. Ensures READMEs, ADRs, and architecture docs reflect reality without drift.
File:assets/auditors/documentation.md -
Modularity — Evaluates module boundaries, dependency flow, and layering. Ensures the system remains well-structured, encapsulated, and maintainable.
File:assets/auditors/modularity.md -
Performance — Identifies structural performance risks such as N+1 queries, heavy hot paths, inefficient flows, and missing signals. Focuses on backend and service-level performance characteristics.
File:assets/auditors/performance.md -
Quality — Audits the test suite for correctness, determinism, completeness, and architectural alignment. Ensures high-risk scenarios are covered and regressions are detectable.
File:assets/auditors/quality.md -
Reliability — Evaluates system resilience, observability, failure detection, and recoverability. Covers readiness/liveness probes, timeouts, metrics, dashboards, and alerting.
File:assets/auditors/reliability.md -
Security — Focuses on tenant isolation, RBAC integrity, token and session handling, input validation, and secure transport. Prioritizes correctness of core security invariants.
File:assets/auditors/security.md
Validators are prompts that evaluate plans produced by auditors before any changes are executed.
They ensure that a plan is:
- structurally valid
- safe in scope and risk
- clear, concrete, and realistically executable
Validators do not change code themselves; they approve or reject plans.
One validator is provided by default under assets/validators/:
- Plan
- File:
assets/validators/plan.md - Responsibility: validate that a plan is structurally valid and appropriate, feasible, and safe per the canonical schema defined in
assets/formatters/plan.mdandassets/schemas/plan.schema.json. - Rejects plans that are not valid JSON, violate the schema shape, are overly broad or architectural rewrites, are vague/non-actionable, cross too many domains, or carry disproportionate risk.
- File:
The default config.default.json wires every auditor to both validators:
- First
structure, thengeneral.
The typical flow for a single auditor run is:
- Auditor generates a plan.
- Structure validator checks JSON validity and schema conformance.
- General validator checks scope, clarity, and risk (only if structure passed).
- If both validators approve, the orchestrator may proceed to apply or execute the plan.
This separation keeps syntax/shape concerns and semantic/risk concerns cleanly isolated.
The assets/formatters directory contains human-readable guidance for producing plan outputs. The authoritative shape is defined by the JSON schema in assets/schemas/plan.schema.json; the formatter doc is a companion guide to help LLMs emit compliant plans.
Key points:
- Plans must follow
assets/schemas/plan.schema.json(requiredsteps, max 3 items, no extra keys). - The guidance in
assets/formatters/plan.mdis descriptive, but schema/validators enforce the shape.
assets/schemas/plan.schema.json provides a machine-readable JSON Schema (2020-12) equivalent of the rules in assets/formatters/plan.md.
assets/schemas/config.schema.json defines the expected structure of the orchestrator configuration (e.g., config.default.json and driftlock.config.json).
It enables:
- automated validation in CI/CLI tools
- editor integrations and plugins
- future orchestrator or agent tooling to validate plans independently of LLMs
When in doubt, the human-readable rules in plan.md are authoritative; plan.schema.json should stay in sync with it.
-
assets/validators/structure.md- Validates that a plan’s JSON structure matches
assets/formatters/plan.md/assets/schemas/plan.schema.json. - Rejects any plan that is not valid JSON or violates structural rules.
- Validates that a plan’s JSON structure matches
-
assets/validators/plan.md- Performs both structural and general validation (schema conformance, feasibility, risk, scope, appropriateness).
To evolve the plan format:
- Propose changes in
assets/formatters/plan.md(new fields, enums, or constraints). - Update
assets/schemas/plan.schema.jsonto match. - Update validators (
assets/validators/plan.md) to recognize the new rules.
Changes should be additive and backwards-compatible when possible to avoid breaking existing tooling.
The assets/schemas directory contains JSON Schemas used for machine validation of configuration and plan data.
These schemas complement the human-readable Markdown formatters by providing strong typing and tooling-friendly contracts.
- File:
assets/schemas/plan.schema.json - Purpose: enforce the canonical plan structure:
- top-level
{ "plan": [...] }object - required fields (
action,why,filesInvolved,category,steps) riskenum and optional fields as defined in the schema- maximum of 3 plan items and no extra keys
- top-level
- Used by:
assets/validators/plan.md- any CI/CLI/editor tooling that wants to validate plan JSON emitted by auditors
- File:
assets/schemas/config.schema.json - Purpose: define the expected structure of orchestrator configuration files such as
config.default.jsonanddriftlock.config.json. - Validates:
auditorsmap and each auditor’senabled,path,validators, optionalmodelvalidatorsmap (name → object withpathand optionalmodel)formattersentries (plan,executeStep) withpath,schema, optionalmodel- top-level
excludearray and top-level defaultmodel
- Editors and tooling can use this schema (via the
$schemafield inconfig.default.jsonor your owndriftlock.config.json) to provide validation and autocomplete for configuration changes.
The top-level qualityGate config defines the fail-fast stage commands:
qualityGate.build—{ enabled, run }build/typecheck stage.qualityGate.lint—{ enabled, run }lint stage.qualityGate.test—{ enabled, run }test stage.
Stages run in order: build → lint → test, and Driftlock stops at the first failure.
The top-level config also includes runBaselineQualityGate (default: true):
- When
true, Driftlock runs a fullbuild→lint→testcycle once before any auditor executes, to establish baseline health. - When
false, the orchestrator skips this baseline check and proceeds directly to auditor plans.
When Driftlock is running on a driftlock/* branch and has committed changes, it can open a GitHub PR when the run ends.
pullRequest.enabled— enable/disable automatic PR creation.pullRequest.formatter—{ path, schema, model }used to generate a PR title/body summary of all committed plans (falls back togh pr create --fillif summarization fails).
Retry-related caps can also be tuned:
maxRegressionAttempts— maximum number of regression-fix attempts per step (0 means unbounded).maxThreadLifetimeAttempts— maximum number of Codex executor calls (apply + fix_regression) per step (0 means unbounded).
Defaults are conservative (maxRegressionAttempts: 5, maxThreadLifetimeAttempts: 10). For most projects you should keep caps enabled; setting them to 0 removes the guardrail and may cause long-running loops when underlying suites are persistently red.
Developed with ❤️ by @glemiere.