[PR #553] Extract plan messages from Claude Code transcripts #560

Closed
opened 2026-03-02 04:13:58 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/553

State: closed
Merged: No


Summary

  • Detect Write/Edit tool calls targeting plan files in Claude Code JSONL transcripts and convert them to Message::Plan instead of Message::ToolUse
  • Add is_plan_file_path() and extract_plan_from_tool_use() helpers for plan file detection
  • Apply the same plan extraction to the Droid JSONL parser (same format)
  • Add 12 comprehensive tests covering unit, integration, edge cases, and serialization

Context

Closes #370

Claude Code writes plans to files outside the repo (e.g., ~/.claude/projects/). These plan writes appear in the JSONL transcript as Write/Edit tool calls but were previously stored as generic Message::ToolUse entries. This change detects plan file edits by checking if the target filename contains "plan" (case-insensitive) and ends with .md, then captures the plan content as a structured Message::Plan.

For Write calls, the full plan content is captured. For Edit calls, both old and new state are preserved in a diff format.

Test plan

  • Unit tests for is_plan_file_path (positive/negative path patterns)
  • Unit tests for extract_plan_from_tool_use (Write, Edit, non-plan, empty content)
  • Integration test with fixture containing mixed plan and code edits
  • Inline JSONL tests for Write→Plan and Edit→Plan conversion
  • Non-plan edits remain as ToolUse
  • Plan message serde roundtrip
  • Mixed plan + code edits in a single assistant message
  • All 19 claude_code tests pass
  • All 13 droid tests pass

🤖 Generated with Claude Code


Open with Devin
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/553 **State:** closed **Merged:** No --- ## Summary - Detect Write/Edit tool calls targeting plan files in Claude Code JSONL transcripts and convert them to `Message::Plan` instead of `Message::ToolUse` - Add `is_plan_file_path()` and `extract_plan_from_tool_use()` helpers for plan file detection - Apply the same plan extraction to the Droid JSONL parser (same format) - Add 12 comprehensive tests covering unit, integration, edge cases, and serialization ## Context Closes #370 Claude Code writes plans to files outside the repo (e.g., `~/.claude/projects/`). These plan writes appear in the JSONL transcript as Write/Edit tool calls but were previously stored as generic `Message::ToolUse` entries. This change detects plan file edits by checking if the target filename contains "plan" (case-insensitive) and ends with `.md`, then captures the plan content as a structured `Message::Plan`. For Write calls, the full plan content is captured. For Edit calls, both old and new state are preserved in a diff format. ## Test plan - [x] Unit tests for `is_plan_file_path` (positive/negative path patterns) - [x] Unit tests for `extract_plan_from_tool_use` (Write, Edit, non-plan, empty content) - [x] Integration test with fixture containing mixed plan and code edits - [x] Inline JSONL tests for Write→Plan and Edit→Plan conversion - [x] Non-plan edits remain as ToolUse - [x] Plan message serde roundtrip - [x] Mixed plan + code edits in a single assistant message - [x] All 19 claude_code tests pass - [x] All 13 droid tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/git-ai-project/git-ai/pull/553" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
kerem 2026-03-02 04:13:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#560
No description provided.