Repository navigation
refactor(audit): extract agent adapter registry for Claude and Codex - #2
Conversation
Neal006
left a comment
There was a problem hiding this comment.
Thanks for this, Nandini. The adapter registry is a good direction, and the new refactor-pipeline bench task is solid: it fails at the start and has a clear checker. The PR can't merge in its current form, though. Here is what we need.
Please split this PR
It bundles five unrelated changes into one commit. Please open separate PRs so each one can be reviewed and reverted on its own:
- Agent adapter registry plus the Claude and Codex adapters (pure refactor, no behaviour change)
- One PR per new agent (Antigravity, Cline, Aider), each once it meets the bar below
- The
refactor-pipelinebench task (can merge almost as is) - Release automation, if still wanted (see below)
Blockers
1. Existing test fails. test/wrap.e2e.test.ts > deja audit --agent codex fails on this branch and after merging with main: the report name changed from "Codex" to "Codex CLI". Please keep name: "Codex" for output compatibility, or update the test in the same commit with a reason. Please run the full suite (npm test), not only test/agents.test.ts.
2. Merge conflict. CONTRIBUTING.md conflicts with main, so CI never ran on this PR. Please rebase on main.
3. Aider adapter parses unrelated files. With extensions: [".md"] and a default directory of process.cwd(), discovery parses every Markdown file. Running deja audit --agent aider --dir . on this repo reports 23 "Aider sessions" built from the README and docs. Discovery has to match the file name .aider.chat.history.md exactly. Please also check the turn mapping against a real history file: as far as I know, Aider writes user prompts as #### lines and its own tool messages as > quotes, which is the reverse of what the parser assumes. Because Aider records no tool calls or results, please also show what deja can actually save on a real Aider history before we add it.
4. Antigravity pairs tool output with the wrong call. Only lastToolCallId gets a result, so when one PLANNER_RESPONSE makes several tool calls, every GENERIC output is attached to the last call and the earlier calls get none. This changes which output dedup and decay act on. There is also an unused appData variable in defaultDir.
5. Cline reads every .json file in a task folder (ui_messages.json, task metadata), not only api_conversation_history.json. Please match that file name. Cline records no timestamps, so idle and cache-expiry modelling can't work; please say so in the docs.
6. Validation claims need evidence. Antigravity and Cline are marked validated: true and "Production", but the tests use synthetic fixtures only. Our own rule in your CONTRIBUTING text says to add at least one real, anonymised fixture before claiming validation. Until then, please set validated: false and mark them Beta. The "-27.6% across 16 sessions" figure also needs a reproducible source, or it should be removed.
7. Please remove the npm publishing section from CONTRIBUTING.md. Package ownership is handled by the maintainer and is never changed through a PR, so the npm owner add ... instruction must go. Its "before the first publish" steps are also out of date, because 0.1.0 is already on npm.
Smaller items
readAnyinworker.tshardcodesclaude, codex, aiderin its error message. Please usesupportedAgents().--agenthelp text lists only three of the five agents..npmignorehas no effect, becausepackage.jsonfilesalready limits the package todist,README.mdandLICENSE. Please drop it.publish.yml: we may want tag-based publishing later, but not in this PR. If you'd like to propose it, please open an issue first.docs/launch-announcements.md: launch posts don't belong in the repo. Please remove the file.- The CONTRIBUTING roadmap edit drops "Support the OpenAI Responses API in the proxy". Please keep that line.
Once the adapter-registry PR is green with no behaviour change, the per-agent PRs can follow one by one. Thanks again for the effort here; the structure is the right one.
Generated by Claude Code
cf126b6 to
f7cbb5a
Compare
Neal006
left a comment
There was a problem hiding this comment.
Thanks for reworking this, Nandini. Cutting it down to the registry refactor was the right call, and everything from the last review that still applies has been addressed: the report name is back to Codex, the branch is rebased with CI green on all 9 jobs, the npm publishing section and the extra files are gone, and the error message and help text now come from the registry.
I checked the branch locally:
- typecheck, build and the full suite pass (650/650)
deja audit --jsongives byte-identical output onmainand on this branch for the same 8 real transcripts, in normal,--tuneand--uncachedmodes, so this is a pure refactor as intended
Before merge
1. Update the PR title and description. They still describe the original PR: Antigravity, Cline, Aider, the publish workflow, .npmignore, the bench task and the "−27.6% across 16 sessions" figure. None of that is in the diff any more. main only allows squash merges, so the title can end up as the commit message. Please change the title to match the commit:
refactor(audit): extract agent adapter registry for Claude and Codex
and replace the description with a short summary of what is actually here (registry, two adapters, no behaviour change, 4 new tests).
Small fixes, in this PR or a follow-up
2. Don't fall back to the current directory. In src/cli/commands/audit.ts:
const root = flagString(args.flags, "dir") ?? adapter.defaultDir() ?? process.cwd();If a future adapter returns undefined from defaultDir(), the audit silently scans whatever folder the user is in. That is how the earlier Aider adapter ended up reporting the README and docs as sessions. Both adapters return a directory today, so nothing is broken, but please make this an error instead ("this agent has no default history location, pass --dir") before the first new agent lands.
3. Help text alignment. --agent claude|codex audit: … in src/cli/help.ts breaks the column. Something like this keeps it aligned:
--agent <name> audit: whose history to replay: claude (default) or codex
4. extensions is unused. Neither adapter sets it. It's fine to keep since the next adapters need it, but then please add a test for discoverTranscripts with a custom extensions list so the new branch is covered.
5. Note the case-insensitive lookup. --agent CODEX is now accepted. That's a harmless behaviour change, but worth one line in the description since the PR says "no behaviour change".
Once item 1 is done this is good to merge. The per-agent PRs (Cline, Aider, Antigravity) can then follow one at a time, each with a real anonymised fixture as discussed.
|
@Neal006 I have made the required changes pls check |
Neal006
left a comment
There was a problem hiding this comment.
Thanks Nandini, this is exactly the scope we wanted: a clean registry with no behaviour change, good tests, and CI green everywhere. I updated the title and description to match the final diff. Looking forward to the per-agent PRs.
Generated by Claude Code
Moves transcript discovery and parsing for each agent into a small adapter registry under
src/audit/agents/, so new agents can be added one file at a time instead of throughif (agent === "codex")branches in the audit command.What changed
AgentAdapterinterface and registry (src/audit/agents/index.ts) withgetAdapter()andsupportedAgents().deja auditresolves--agentthrough the registry; error messages and help text come from it.discoverTranscriptsaccepts an optionalextensionslist (default.jsonl, unchanged).Behaviour
No change to audit results:
deja audit --jsonoutput is byte-identical tomainon real transcripts, in normal,--tuneand--uncachedmodes. One small difference:--agentis now case-insensitive (--agent CODEXworks).Tests
New
test/agents.test.ts(registry, metadata, error paths,--dirhandling) and a custom-extensions case intest/discover.test.ts. Full suite and CI pass on all 9 jobs.Next: one PR per new agent (Cline, Aider, Antigravity), each with a real anonymised fixture.
Generated by Claude Code