Skip to content

Comments

Fix Markdown/JSON rendering issues in tool calls#11

Closed
ShlomoStept wants to merge 3 commits intomainfrom
fix/markdown-rendering-issues
Closed

Fix Markdown/JSON rendering issues in tool calls#11
ShlomoStept wants to merge 3 commits intomainfrom
fix/markdown-rendering-issues

Conversation

@ShlomoStept
Copy link
Owner

Summary

  • Addresses remaining markdown and JSON rendering issues in assistant cells with tool calls
  • Fixes subagent content display issues
  • Previous work from Phase 3 implementation already included

Known Issues Being Addressed

  1. Subagent content not fully provided - Subagent output may be truncated
  2. Markdown/JSON rendering issues in tool calls:
    • Markdown content duplicated above JSON in tool call area
    • Long markdown content hidden/not scrollable
    • JSON not wrapped in code block in Markdown mode
    • Tool result shows JSON in code block in Markdown mode but no difference in JSON mode
    • Subcells (tool call/reply) not collapsible

Test plan

  • Verify markdown rendering doesn't duplicate content
  • Verify JSON is properly wrapped in code blocks
  • Verify long content is scrollable
  • Verify tool call/reply sections are collapsible
  • Run tests: uv run pytest

🤖 Generated with Claude Code

ShlomoStept and others added 3 commits January 6, 2026 02:53
Add visual indicators and metadata extraction for Task and Agent tool calls
that spawn subagent processes. This enhancement helps users understand when
and why Claude Code spawns subagents during session processing.

Features:
- Detect Task and Agent tool calls as subagent spawning operations
- Extract subagent_type (Explore, Plan, code-reviewer, etc.)
- Show visual badge with subagent type in purple gradient
- Display truncated prompt preview for context
- Indicate resume operations when resuming existing agents
- Find related agent session files in the same directory
- Extract agent IDs from tool results

Visual improvements:
- Purple left border for subagent tools (distinct from other tools)
- Gradient badge with lightning bolt icon
- Prompt preview with styled container
- Resume indicator for continued sessions

Tests:
- 16 new tests covering all subagent detection functionality
- Tests for is_subagent_tool, extract_subagent_info
- Tests for extract_agent_id_from_result with strict patterns
- Tests for find_related_agent_sessions
- Tests for render_subagent_tool rendering
- CSS presence verification tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document proposed enhancements to improve usability, maintainability, and
scalability of claude-code-transcripts:

1. Session Timeline View (Priority P1, Medium effort)
   - Interactive timeline visualization at top of session pages
   - Color-coded segments for different activity types
   - Click-to-navigate functionality
   - Temporal flow understanding for long sessions

2. Diff View for Edit Operations (Priority P1, Medium effort)
   - Unified diff display for old_string/new_string comparisons
   - Side-by-side and unified view modes
   - Syntax highlighting preserved
   - Uses standard library difflib

3. Keyboard Navigation (Priority P2, Low-Medium effort)
   - Comprehensive shortcuts for session navigation
   - Cell expansion/collapse with single keys
   - View mode switching (Markdown/JSON)
   - Accessibility improvements (WCAG 2.1)

Each proposal includes:
- Problem statement
- Proposed solution with implementation details
- Files to modify and key code changes
- Estimated effort
- User impact analysis
- Technical considerations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update PLAN.md with comprehensive Phase 3 grading report:

- Overall score: 85.01 (up from 83.24, +1.77)
- Templates (macros.html): 86.20 (+1.0)
- Core (__init__.py): 82.45 (+1.95)
- Tests: 89.45 (+2.3)

Key improvements:
- C.1 Subagent Detection fully implemented
- 16 new tests (157 total), all passing
- FEATURE_PROPOSALS.md with 3 detailed proposals
- New functions follow established patterns

Cumulative improvement from Phase 2 initial: +3.73 points

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 6, 2026 10:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements comprehensive subagent detection and visualization features for Task and Agent tool calls, addressing markdown/JSON rendering issues in assistant cells with tool calls.

Key changes:

  • Added subagent detection system with visual badges and metadata display
  • Implemented 16 new comprehensive tests for subagent functionality
  • Enhanced HTML generation with specialized rendering for Task/Agent tools

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_generate_html.py Added 16 new tests covering subagent detection, extraction, and rendering functionality
tests/__snapshots__/*.html Updated snapshot files to include new subagent CSS styles (purple gradients, badges, prompt previews)
src/claude_code_transcripts/templates/macros.html Added new subagent_tool macro for rendering Task/Agent tools with specialized badge and prompt preview display
src/claude_code_transcripts/__init__.py Implemented subagent detection functions (is_subagent_tool, extract_subagent_info, extract_agent_id_from_result, find_related_agent_sessions, render_subagent_tool) and added corresponding CSS styles
PLAN.md Documented Phase 3 completion with subagent detection implementation, grading report showing improvement from 83.24 to 85.01
FEATURE_PROPOSALS.md Added new file with three detailed feature proposals: Session Timeline View (P1), Diff View for Edits (P1), and Keyboard Navigation (P2)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ShlomoStept
Copy link
Owner Author

Closing - changes consolidated for upstream PR submission

@ShlomoStept ShlomoStept closed this Jan 9, 2026
ShlomoStept pushed a commit that referenced this pull request Jan 9, 2026
* Add batch command for converting all sessions to HTML archive

Adds a new `batch` command that converts all local Claude Code sessions
into a browsable HTML archive with:

- Master index listing all projects with session counts
- Per-project pages listing sessions by date
- Individual session transcripts (using existing generate_html)

New features:
- `find_all_sessions()` - discovers sessions grouped by project
- `get_project_display_name()` - extracts readable names from encoded paths
- `--dry-run` flag to preview what would be converted
- `--include-agents` flag to include agent-* session files
- Progress indicator during conversion

Usage: claude-code-transcripts batch -o ./my-archive

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor batch command for better code reuse and error handling

- Move datetime import to module level for consistency
- Add progress_callback parameter to generate_batch_html() for progress reporting
- Add try/except around individual session conversion with failed_sessions tracking
- Refactor batch_cmd() to use generate_batch_html() instead of duplicating the loop
- Add --quiet/-q flag to suppress non-error output for scripting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix --quiet flag not respected in dry-run mode

- Wrap dry-run output in `if not quiet` check
- Add test for --quiet with --dry-run combination
- Add .playwright-mcp/ to .gitignore
- Rename html variable to html_content to avoid shadowing html module
- Remove unused imports from test file

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add batch command documentation to README

Document the new batch command that converts all local Claude Code
sessions to a browsable HTML archive with master and project indexes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Rename batch command to all

https://gistpreview.github.io/?be627e42c25a1ffdf39cfb2f9a79f1ff/index.html

Refs simonw#11 (comment)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Simon Willison <swillison@gmail.com>
ShlomoStept pushed a commit that referenced this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant