Skip to content

Codex CLI session transcripts for reproducibility #2765

@alianwaar73

Description

@alianwaar73

What feature would you like to see?

Summary

  • Purpose: Persist a privacy-safe transcript of Codex CLI sessions to aid future reference, onboarding, and reproducibility.
  • Modes: Autogenerated during sessions and on-demand via /transcribe or /summarize.
  • Scope: Session summaries and verbatim logs (with redaction), stored in-repo and kept current as the project evolves.
  • Parity: Lives alongside AGENTS.md as a canonical, evolving artifact relevant to the repo/project.
  • Inspiration: Inspired by Codex v0.25.0’s transcript highlight shortcut (Ctrl+T), extending it into persistent, commit-friendly artifacts.

Motivation

  • Reproducibility: Capture decisions, commands, and reasoning to rerun or audit work.
  • Onboarding: Provide new contributors a concise evolution of agent interactions and key changes.
  • Traceability: Link tool calls and patches to resulting files/commits for clearer provenance.
  • Knowledge retention: Preserve ephemeral chat context and CLI actions beyond scrollback.
  • Reduce drift: Keep a living record, similar in importance to AGENTS.md, that evolves with user interactions and the project itself.

Goals

  • Configurable transcripts: Per-session summary and optional verbatim logs with redaction.
  • Git-friendly storage: Text-first artifacts safe to commit; deterministic filenames.
  • Minimal friction: “Always-on” auto mode and explicit slash commands.
  • Privacy by default: Built-in secret redaction and opt-outs for sensitive content.

Non-Goals

  • Full deterministic replay of entire sessions beyond what’s logged.
  • Storing raw sensitive data or non-consented PII.
  • Replacing AGENTS.md; instead, complement or cross-link it.

User Stories

  • Contributor: “As a user, I want a session summary I can commit so teammates can understand what changed and why.”
  • Maintainer: “As a maintainer, I want a redact-safe transcript to audit agent actions without leaking secrets.”
  • New teammate: “As a newcomer, I want a chronological record to see how the project evolved via Codex.”
  • Security lead: “As a security reviewer, I need configurable redaction and opt-out options per module.”

Proposed Design

  • Transcript store: Create codex/transcripts/ at repo root (or .codex/transcripts/ if hidden preferred).
  • Session files:
    • Summary: YYYY-MM-DD_session-N_summary.md (high-level, commit-friendly).
    • Verbatim: YYYY-MM-DD_session-N_log.md (detailed, redacted).
  • Index: Maintain codex/TRANSCRIPTS.md with a chronological index and links, plus cross-link from AGENTS.md.
  • Redaction: Apply default secret scrubbing + user-defined patterns before writing to disk.
  • Hooks: Emit transcript entries on tool calls, patches, plan updates, and important assistant messages.

UX Flows

  • Auto mode: Enable in config; Codex streams content to transcript files as the session progresses.
  • Slash commands:
    • /.transcribe start|stop: Toggle logging within a session.
    • /.summarize [level]: Generate a summary now (concise|detailed).
    • /.transcribe redact add "<regex>": Add runtime redaction rules.
  • Session end: Auto-append final summary and “next steps” to the summary file and update the index.

Data & Storage

  • Paths:
    • codex/transcripts/ for per-session files.
    • codex/TRANSCRIPTS.md top-level index.
  • File hygiene: Keep each session self-contained; limit single-file growth; prefer multiple small files.
  • Determinism: Name sessions by date and increment; include optional repo SHA short-hash in filename.

Privacy & Redaction

  • Defaults: Redact common secrets by pattern (API keys, tokens, .env values, private keys).
  • Context-aware scrubbing: Mask outputs from known sensitive files (.env, id_rsa, OS keychains).
  • Custom rules: Allow config-level and command-level regex/additive rules; preview redaction before write on demand.
  • Opt-outs: Respect per-project settings to disable verbatim logs or specific data classes.
  • Manual confirmation: Prompt before logging large binary outputs or suspected secrets.

Configuration

  • File: codex/config.json (or leverage existing Codex config if present).
  • Keys:
    • transcripts.enabled (bool), transcripts.mode (auto|manual), transcripts.level (summary|verbatim|both).
    • transcripts.path (string), transcripts.filenameTemplate (string).
    • transcripts.redaction.enabled (bool), transcripts.redaction.patterns (array of regex), transcripts.maxOutputBytes (int).
    • transcripts.gitIntegration.commitMessageTemplate (string).
  • Overrides: Per-submodule overrides when running from nested directories.

Git Integration

  • Friendly commits: Optionally suggest or stage transcript files with a templated message.
  • Linking: Include commit SHAs and file paths in transcripts; embed links to diffs when available.
  • CI safety: Ensure transcripts contain no secrets; provide a pre-commit redaction check.

File Format

  • Markdown: Human-readable, reviewable in PRs, easily diffed.
  • Sections (summary): Context, high-level plan, key commands run, files modified, rationale, next steps.
  • Sections (verbatim): Timestamps, user prompts, assistant responses (truncated if needed), tool calls, command outputs (redacted).
  • Metadata header: Session ID, repo status (branch/SHA), Codex version, config snapshot hash.

API / Extensibility

  • Events: Expose transcript lifecycle events (onStart, onEntry, onError, onEnd) for plugins.
  • Export: Provide codex export --session <id> --format <md|json> for downstream tooling.
  • Query: codex transcripts list|show <id> to browse and inspect past sessions.

Acceptance Criteria

  • Creates and updates codex/transcripts/*.md and codex/TRANSCRIPTS.md in a sample repo.
  • Captures tool calls, patches, and plan updates with timestamps.
  • Redacts secrets by default; supports user-defined patterns.
  • /.transcribe start|stop and /.summarize work during a session.
  • Produces clean, commit-safe Markdown that passes a pre-commit redaction check.
  • Scales across multi-module repos without leaking unrelated secrets.

Open Questions

  • Should default location be hidden (.codex/transcripts/) to reduce noise?
  • Do we include partial command outputs by default (first/last N lines) to balance size vs. context?
  • Should there be a “private transcript” mode written outside the repo for sensitive sessions?
  • How to handle extremely long sessions—rollover policy by size/time?

Risks

  • Accidental sensitive data capture if redaction misses a pattern.
  • Repository noise if transcripts are too verbose or misconfigured.
  • User confusion between AGENTS.md and transcripts without clear cross-linking.

Mitigations

  • Conservative defaults, pre-commit redaction checks, and prominent warnings.
  • Concise summaries by default; verbatim requires explicit enable or size caps.
  • Clear cross-links and a short “How to use transcripts” block in AGENTS.md.

Future Work

  • Replay assist: Generate a minimal “reproduce session” script for core steps.
  • Semantic search: Index transcripts for query across sessions.
  • Inline PR annotations: Auto-comment key session excerpts relevant to a PR.
  • Multi-user sessions: Merge transcripts from multiple teammates with authorship tags.

Are you interested in implementing this feature?

No response

Additional information

Codex-cli should be the main product offered with the plus subscription. Way easier to use than the web-based product.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions