Description
For interactive Claude Code sessions launched via codemie-claude, Claude Code (2.1.218) does not write its session transcript JSONL to ~/.claude/projects/<cwd>/<session>.jsonl — the project dir contains only a memory/ subdir. However, Claude's SessionStart/UserPromptSubmit hook payload still reports that transcript_path, and CodeMie's correlation marks it status: "matched". At Stop/SessionEnd, the metrics processor reads the absent path, reports "0 records processed", and writes no sessions/*_metrics.jsonl. Session metrics are silently lost, and correlation reports matched for a file that doesn't exist — masking the gap.
Headless --task mode persists the transcript normally, so its metrics work.
Steps to Reproduce
- Run the agent suite:
npm run test:integration:agent (or just TC-024 in tests/integration/agent-model.test.ts).
- TC-024 drives
codemie-claude interactively via node-pty, does a /model switch + a prompt, then /exit.
- Observe the session's
logs/debug-*.log: hooks fire, but both Stop and SessionEnd log Session processing complete: 0 records processed.
~/.claude/projects/<cwd-hash>/ contains only memory/ — no .jsonl.
Expected Behavior
Interactive-session metrics are recorded (a sessions/*_metrics.jsonl is written with the model used), as with --task mode.
Actual Behavior
No metrics file is produced; getLatestMetricsRecord throws No metrics files found. The transcript at the correlated path never exists on disk.
Investigation (ruled out)
Temp vs persistent cwd · workspace trust · the /model switch · provider (ai-run-sso vs anthropic-subscription) · session duration / turn count (4 turns / 75s) · flush-on-clean-exit. A "normally" launched interactive codemie-claude session (same claude --plugin-dir … invocation) does persist its transcript, so the trigger appears specific to how a programmatically-driven (node-pty) interactive session is handled by Claude Code — i.e. likely an upstream transcript-persistence behavior, not CodeMie logic.
Partial mitigation (already landed)
src/cli/commands/hook.ts now logs an explicit WARN when the reported transcript path is missing (or empty) at Stop/SessionEnd, instead of silently reporting "0 records processed", so the gap is diagnosable.
Suggested follow-ups
- Don't mark correlation
matched for a transcript path that doesn't exist on disk.
- Bisect Claude Code versions to confirm where interactive-PTY transcript persistence changed.
- Adjust TC-024 to assert against the API-sent session metric, or drive the model check via
--task.
Environment
| Field |
Value |
| OS |
Darwin 25.5.0 arm64 |
| Node.js |
v26.5.0 |
| CodeMie CLI |
0.15.0 |
| Claude Code |
2.1.218 |
| Shell / Terminal |
zsh / ghostty |
Description
For interactive Claude Code sessions launched via
codemie-claude, Claude Code (2.1.218) does not write its session transcript JSONL to~/.claude/projects/<cwd>/<session>.jsonl— the project dir contains only amemory/subdir. However, Claude's SessionStart/UserPromptSubmit hook payload still reports thattranscript_path, and CodeMie's correlation marks itstatus: "matched". AtStop/SessionEnd, the metrics processor reads the absent path, reports "0 records processed", and writes nosessions/*_metrics.jsonl. Session metrics are silently lost, and correlation reportsmatchedfor a file that doesn't exist — masking the gap.Headless
--taskmode persists the transcript normally, so its metrics work.Steps to Reproduce
npm run test:integration:agent(or just TC-024 intests/integration/agent-model.test.ts).codemie-claudeinteractively via node-pty, does a/modelswitch + a prompt, then/exit.logs/debug-*.log: hooks fire, but bothStopandSessionEndlogSession processing complete: 0 records processed.~/.claude/projects/<cwd-hash>/contains onlymemory/— no.jsonl.Expected Behavior
Interactive-session metrics are recorded (a
sessions/*_metrics.jsonlis written with the model used), as with--taskmode.Actual Behavior
No metrics file is produced;
getLatestMetricsRecordthrowsNo metrics files found. The transcript at the correlated path never exists on disk.Investigation (ruled out)
Temp vs persistent cwd · workspace trust · the
/modelswitch · provider (ai-run-ssovsanthropic-subscription) · session duration / turn count (4 turns / 75s) · flush-on-clean-exit. A "normally" launched interactivecodemie-claudesession (sameclaude --plugin-dir …invocation) does persist its transcript, so the trigger appears specific to how a programmatically-driven (node-pty) interactive session is handled by Claude Code — i.e. likely an upstream transcript-persistence behavior, not CodeMie logic.Partial mitigation (already landed)
src/cli/commands/hook.tsnow logs an explicitWARNwhen the reported transcript path is missing (or empty) atStop/SessionEnd, instead of silently reporting "0 records processed", so the gap is diagnosable.Suggested follow-ups
matchedfor a transcript path that doesn't exist on disk.--task.Environment