Skip to content

tracekit audit: read Codex session rollouts #669

Closed

Description

@LoopGlitch26

tracekit audit (#490, #491) replays the tool calls in Claude Code transcripts through the policy engine. Codex users can't use it yet: Codex writes its sessions as rollout files, ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl, in a different shape.

What's needed

tracekit audit should read Codex rollouts too, deciding each call the way Tracekit's Codex hook would have decided it live.

Where it goes

  • The mapping already exists. tracekit/integrations/harness_hooks.py _use(item) takes the payload of a {"type": "response_item", "payload": {...}} line (_responses() unwraps it) and returns the call's name and arguments as the Codex PreToolUse payload has them, passed through agent_hooks.tool("codex", ...). It returns None for a call that fires no hook. It covers exec_command (as Bash), apply_patch and MCP calls. It returns a dict for the model record (id, name, digest), not the arguments.
  • Split the mapping out. Move the part that builds (hook, ti) from a call item and calls agent_hooks.tool("codex", hook, ti) into a small function that takes the payload item and returns (tool, args), or None for a call that fires no hook or has no call_id (as _use does today). _use() and tracekit/audit.py both call it, so there is one mapping, not two.
  • Detect the format per line in audit() (tracekit/audit.py, the loop over transcript_entries, which today skips any entry whose type isn't "assistant"). A "response_item" line is Codex; an "assistant" line is Claude Code. A file then needs no flag.
  • Root. default_root() stays the Claude Code folder. A user passes ~/.codex/sessions as ROOT. Optionally add a --codex shortcut for that folder.
  • Session. A rollout file is one session; _session_from_path already names a session from the file.
  • Time. Use the line's timestamp (_entry_time reads an entry's time today).

Acceptance

  • Tests in tests/test_audit.py, with a small rollout fixture written in the test as _call does for Claude Code lines:
    • exec_command decided as Bash;
    • an apply_patch;
    • an MCP call;
    • a call that fires no hook, which isn't counted;
    • a malformed line, which is counted.
  • One test checks a rollout call and the same call through agent_hooks.tool get the same decision.
  • tests/test_harness_hooks_v2.py passes unchanged.
  • docs/audit.md says where Codex keeps its sessions and shows the command. docs/limits.md (Audit section) has a row that says audit reads only Claude Code's transcripts and nothing from Codex or Gemini CLI: rewrite it for Codex, and note that a rollout's arguments are Codex's rewrite of what the model sent, as harness_hooks notes.
  • Run tracekit audit ~/.codex/sessions --since 7d on a real Codex install and paste the summary line (not the calls) in the PR.

Read-only like the rest of tracekit audit: no signer, no writes, no network. Comment here to claim it. Commits need a DCO sign-off (git commit -s).

Activity

  1. kausthubhk commented on Nov 9, 2026

    @kausthubhk
    Contributor

    @LoopGlitch26 can i pick this?

  2. LoopGlitch26 commented on Nov 9, 2026

    @LoopGlitch26
    MemberAuthor

    Yes, it's yours, @kausthubhk. Codex writes its rollouts as JSONL under ~/.codex/sessions; please follow how audit reads Claude Code sessions, and include a test built from a real rollout's record shapes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions