The AI thinks, the gate decides — how I made LLM code edits deterministic (and cut token usage 42×)
Описание и применение
D‑Engine снижает токенов на 44× и предотвращает некорректные коммиты, разделяя «мышление» LLM и «действие» локального гейта.
Задача
AI coding agents consume excessive tokens and risk breaking code due to lack of memory, state drift, and atomic writes.
Результат
D‑Engine achieved token usage 44× lower than dsh, comparable quality (48/50 points), and prevented unsafe commits, demonstrating that a stricter gate outperforms smarter agents.
Рабочий процесс
- 1. Selector step: LLM picks minimal relevant files (≈300 tokens).
- 2. Proposal step: LLM generates SEARCH/REPLACE patches (≈2,000 tokens).
- 3. LocalEditor applies patches via 4‑strategy cascade.
- 4. Compiler validates patched copy.
- 5. commitAndMerge stages only touched files if gate green.
- 6. (Optional) Verify mode: send modified snippet for semantic audit (330–984 tokens).
Доказательства
D-Engine (my harness) 2,552 tokens, ~4 s vs dsh 107,000 tokens, 28 s
The model receives only those files and generates the SEARCH/REPLACE blocks.
D-Engine Fast ~2,100 tokens per task, dsh ~93,000 tokens for same set.
- Дата записи: 2026-09-15T20:30:47.385Z