今日已更新 53 条资讯 | 累计 39582 条内容
关于我们

Before Your Coding Agent Edits a File, Let It Ask Why

Xia Chen 2026年09月04日 23:50 0 次阅读 来源:Dev.to

AI coding agents can modify an unfamiliar file in seconds. The slower question is often more important: Why does this code look this way? The answer may be scattered across old local sessions: one turn investigated the bug, another rejected an approach, and a later turn made the edit. Git preserves the code change, but not necessarily the surrounding agent conversation. I added a local query layer to ThoughtDAG so a developer—or a coding agent—can deliberately retrieve that history before editing: npx thoughtdag why src/lib/api.ts It searches supported local agent transcripts for turns that changed, read, or discussed the file and returns links to the matching source turns. Observation is not explanation The difficult part was not text search. It was avoiding a false claim of causality. If a session record shows a file edit, ThoughtDAG can report that as an observed change: Δ storedProviders → storedProviders, storedVision… If the agent later says why it made the change, that is useful—but it is still the agent's account, not a verified causal fact. ThoughtDAG marks that separately: ≈ candidate explanation from the agent response This distinction matters when old session history becomes input to another agent. A fluent explanation should not silently harden into ground truth just because it was retrieved. Retrieval stays deliberate For regular use, the same index can be exposed through read-only MCP tools: npm install -g thoughtdag thoughtdag setup mcp The agent can then call why_check , why_file , find , and recall_turn before changing code. Retrieval is explicit; matching history is not automatically injected into every prompt. The index stays on the local machine, and source session files are never modified. The current CLI covers local Claude Code, Codex, and ThoughtDAG canvas conversations. What this does not prove This is a developer preview, not a complete audit trail. An observed edit proves that the recorded session changed a file, not that every reason for

本文内容来源于互联网,版权归原作者所有
查看原文