feat: structured tool call metadata and worktree project normalization - #18
Merged
Conversation
… type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…to tool_calls Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ToolResult type and ToolResults field to db.Message (transient) - Update convertToolCalls to copy ToolUseID, InputJSON, SkillName - Add convertToolResults to map ParsedToolResult to db.ToolResult - Add pairToolResults to match result content lengths to tool calls by tool_use_id across message boundaries - Call pairToolResults in writeBatch before ReplaceSessionMessages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ToolCall interface and tool_calls field to Message type - Add "Skill" to TOOL_NAMES so Skill tool calls render as tool blocks - Add enrichSegments() to attach structured tool_calls to parsed segments - For Bash: replace truncated multi-line commands with full command from input_json, absorbing orphaned text fragments caused by regex \n\n boundary - For Task: show prompt content and metadata (subagent_type, description) when the tool block is expanded - Pass toolCall prop through ToolBlock, MessageContent, ToolCallGroup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prose text in assistant messages can contain [ToolName: args] patterns that TOOL_RE would falsely parse as tool blocks. Pass has_tool_use to parseContent and skip the TOOL_RE loop when the flag is false. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…endMessage Go backend: specific formatters in formatToolUse for task management and messaging tools, replacing generic [Tool: name] output. Frontend: add new tool names to TOOL_NAMES regex, add metadata display for TaskCreate (subject/description) and TaskUpdate (taskId/status) in ToolBlock. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
User messages whose content is only tool_result blocks were being skipped because ExtractTextContent produces no text for them, causing the sync engine's pairToolResults to never see the result content lengths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
User messages containing only tool_result blocks have empty Content. These were preserved so pairToolResults() could match them to tool_calls, but they should not appear in the UI. The new pairAndFilter() function pairs results first, then removes messages with no displayable content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- canonicalize project names using cwd + git branch hints so archived worktree sessions group with the main repo even when worktree paths are gone\n- keep filesystem-based git root resolution when available and add parser/sync coverage for both online/offline worktree cases\n- batch tool_call hydration queries to avoid large IN-clause limits and add a regression test across batch boundaries
- pairAndFilter now only removes user messages that have ToolResults and empty content, preserving assistant messages and user messages without tool results - use disjoint cache key prefixes in parseContent to prevent theoretical collision between tools/notools modes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
Author
|
cc @clkao — this superseds your PR since I rebased and pushed some other stuff |
roborev: Combined Review (
|
Member
Author
|
These findings are false positives, merging! |
5 tasks
cursor Bot
referenced
this pull request
in diazMelgarejo/periscope
Jun 1, 2026
#18) ## Summary - Extract and persist structured tool call metadata (`tool_use_id`, `input_json`, `skill_name`, `result_content_length`) from session files into the `tool_calls` table - Pair `tool_result` content lengths back to their originating `tool_call` via `tool_use_id` in the sync engine, then filter empty user carrier messages - Expose structured `tool_calls` in the message API response and enrich frontend tool block rendering with parsed arguments (Bash commands, Task prompts, TaskCreate/Update metadata, Skill names, etc.) - Canonicalize worktree project names during import so archived worktree sessions group with the main repository even when worktree paths no longer exist on disk - Batch tool-call hydration queries to avoid SQLite bind-variable limits on large sessions ## Test plan - [x] All Go tests pass (`CGO_ENABLED=1 go test -tags fts5 ./...`) - [x] All frontend tests pass (380 tests) - [x] Worktree project normalization: online worktree, offline worktree with branch hint, offline worktree without branch - [x] Tool-call batch hydration across batch boundaries (500+25 messages) - [ ] Manual: open a session with tool calls, confirm tool blocks show arguments and no empty user messages appear 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: CL Kao <clkao@datarecce.io> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool_use_id,input_json,skill_name,result_content_length) from session files into thetool_callstabletool_resultcontent lengths back to their originatingtool_callviatool_use_idin the sync engine, then filter empty user carrier messagestool_callsin the message API response and enrich frontend tool block rendering with parsed arguments (Bash commands, Task prompts, TaskCreate/Update metadata, Skill names, etc.)Test plan
CGO_ENABLED=1 go test -tags fts5 ./...)🤖 Generated with Claude Code