Skip to content

p export claude --project implies --cwd <canonical project dir> #239

Description

@ecalifornica

p export claude --project <dir> writes the session to ~/.claude/projects/<slug of dir>/<session ID>.jsonl. It does not rewrite cwd. Every entry keeps the session's recorded cwd.

Claude Code expects every entry's cwd to equal the directory the file is filed under (docs/agents/formats/claude-code/writing-compatible-jsonl.md, rule 3). A document recorded at /a, exported with --project /b, yields a file whose location says /b and whose entries say /a. /path:resume runs p export claude --project <absolute cwd>, so every shared session from a different checkout path lands this way.

Proposal:

  • --project implies --cwd <dir>, with <dir> canonicalized the same way write_into_claude_project canonicalizes it.
  • --cwd no longer conflicts with --project. When both are given and differ after canonicalization, the export errors.
  • --project and --cwd help text state the rule.

Scope: run_claude in crates/path-cli/src/cmd_export.rs, ~20 lines. One test: a document recorded at /old, exported with --project <tmp dir>, has every cwd equal to the canonical tmp dir. plugins/claude-code/commands/resume.md needs no change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions