daaain / daaain/claude-code-log

CB's ideas scratchpad

Open
#73 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scary
Dominant language
Python
Stars
1.2k
Forks
98
Avg merge
3d 2h
Merged PRs (30d)
13

Description

This "issue" is used for sharing my backlog of ideas for future claude-code-log features.
A bit like @daaain's TODO list in the README.md (there is some synergy!).
It's more of a scratchpad, really. Feel free to comment. If something needs more discussion, I can open a dedicated issue.

Filtering

Older proposal:

  • --depth option, symbolic: #287
    • "session": only the session summaries (should work on a folder; may also work on a single .jsonl if we also try to get the summary from the other sessions, as the summary message is not in the session .jsonl itself); PR287 only --depth session
    • "user": stop at the user prompts; → #26 --detail user PR287 --depth user
    • "assistant": stop at the assistant answers; "assistant+": also include "thinking" → #96 --detail minimal (no thinking) PR287 --depth assistant
    • "subassistant": stop at the subassistant answers in the sidechains; → --detail low PR287 --depth agent
    • "tools": stop at the tools level (no sidechains); "tools-"/"shallow": only the information gathering ones (Task, WebSearch); → --detail low PR287 --depth tool (default)
    • 5 / "full": all the way, i.e., as we have now → --detail full PR287 --depth hook

Older proposal:

  • (?) --filter-out, --filter-in with fine-grained control (e.g., --filter-out thinking, --filter-out tools + --filter-in edit)
    • the --depth option above would translate to filters:
      • --depth session = --filter-out user,command,assistant,thinking,system,tools,sub-assistant,sub-thinking,sub-tools
      • --depth user = --filter-out assistant,thinking,system,tools,sub-assistant,sub-thinking,sub-tools
      • --depth assistant = --filter-out thinking,system,tools,sub-assistant,sub-thinking,sub-tools
      • --depth assistant+ = --filter-out system,tools,sub-assistant,sub-thinking,sub-tools
      • --depth tools = --filter-out sub-assistant,sub-thinking,sub-tools
      • --depth shallow = --filter-out thinking,sub-assistant,sub-thinking,sub-tools + --filter-in task,websearch
      • --depth subassistant = --filter-out sub-thinking,sub-tools
      • --depth subassistant+ = --filter-out sub-tools

In light of #96, I wonder if we shouldn't simply have these two options to modulate what's hard-coded by default in the "low" detail mode...

The two most useful modes:

  • "full" (what we have now) to fully understand what was going on by seeing everything that happened → --detail full

  • "shallow" to have an overview of what happened at the information processing/gathering level, without the redundancy between thinking and assistant, and the details of what the tools did → --detail low

  • (?) --skip to start rendering at a given offset in the .jsonl, useful for deltas (generated output filename would contain the range: '...-start-end.fmt'); --skip could even take the previously generated file as input;

Rendering

HTML and Markdown
Structure
  • pagination support: break a session in chunks delimited by n User messages

    • we can use that mode in Markdown previews in the TUI, so that it remains usable for long sessions
      • partially there, but problematic (see #84)
  • -o should be respected when processing the projects directory as well; it's not a good idea to create our logs below ~/.claude itself! Rather use $XDG_DOCUMENTS_DIR or ~/Documents, + /claude-code-log; if only for Bug #1972762 “Firefox and Chromium snaps preventing apps and dev...” : Bugs : snapd... (see #151)

  • -o is currently only halfway respected when processing one project directory:

    • only the combined transcript will take the specified name (fails when -o directory is given)
    • the individual sessions are still created below ~/.claude/projects/<projectdir>; instead, they should be placed below the targeted directory (or siblings to -o file) (see #151)
  • combined transcript mode can be... too much (my current one for claude-code-log is now 146MB...); we already have --no-individual-sessions, so we should also have --no-combined-transcript (mutually exclusive; unless we want to use that combination for only doing a cache sync) => combined transcript is paginated now, so this is less urgent (well, with #59), but it would be nice to have only individual sessions (and those could be paginated as well, see above)

    • we could also have the "positive" ones, mutually exclusive: --individual-sessions, --combined-transcript
Content
  • In the session summary, a session entry should include the start and end dates of the messages it contains, "(from - to)" suffix

    • but see #85 for the bigger picture
  • --user=plain|markdown|md - how to interpret user input: possible values:

    • "plain": i.e., what we have now and the safe default;
    • "md" or "markdown": render as Markdown, a.k.a., "Trust me, I know what I'm doing" mode; -u as shortcut for --user=markdown;
    • "auto": auto-detect if it's a nicely formatted Markdown text or a copy/pasted error stack... delux version would auto-wrap such things in a raw code block (future) → #119 ("auto" behavior is the default, always on)

Impl note: ideas for the "auto" mode welcome!

  • Specialized rendering for WebSearch tool; #83 / #87

  • Differentiate a "Reject" error from a real error - there's some user prompt there that should "stand out": Image

  • Better support for hooks: Image
    Even without the alignment glitch => #89, we can do better: pair them by uuid/parentUuid, and a dedicated renderer.

    Excerpt from the corresponding input .jsonl
    {
      "type": "user",
      "message": {
        "role": "user",
        "content": "Stop hook feedback:\nYou've got mail! Use /clmail:read 10 to read message #10 and proceed (reply if requested)."
      },
      "isMeta": true,
      "uuid": "e9edc0d4-81b9-4d5f-9ad5-be56e588479e", // same
    },
    {
      "parentUuid": "e9edc0d4-81b9-4d5f-9ad5-be56e588479e", // same
      "type": "system",
      "subtype": "stop_hook_summary",
      "hookCount": 1,
      "hookInfos": [
        {
          "command": "callback"
        }
      ],
      "hookErrors": [
        "You've got mail! Use /clmail:read 10 to read message #10 and proceed (reply if requested)."
      ],
      "preventedContinuation": false,
      "stopReason": "",
      "hasOutput": true,
      "level": "suggestion",
    }
    

→ #149

  • Show transitions for cwd (now in ... directory) and gitBranch (now on ... branch) → #94
HTML only
  • Pygmentize old/new before diff? Easy for the red/green background, but what about intra-line highlights?
Markdown only
  • User command, System info, Bash output in Markdown: support ANSI to Markdown (on the model of ANSI to HTML, only simpler, just bold and italics)

  • EnterPlanMode: render as Markdown instead of code block ... or skip altogether

Others
  • --format json - nothing like the "original" .jsonl, but a serialization of the high-level TemplateMessage objects → #36

Styling

  • Fix glitches as they're discovered (still quite a few)

    • Inverted colors for bottom bar: → #89
    • see #153
  • --compact option, for compact style:

    • for HTML:
      • For tools, something similar to Image
      • Less lines visible in <details><summary> (or none?);
      • Avoid the dates? (only as tooltips?)
      • Expand/collapse on the side? (my original idea, but never implemented)
    • for Markdown:
      • For tools, something similar to #44's "chat" mode (no headers) → #114
      • Every tool Read/Edit/Write/Bash output in <details>
        • --no-details to suppress those
  • too large spacing between "▼▼" in Chrome: fix with letter-spacing, though not too much as then this would break FF → #153

Image

The TUI

claude-code-log --tui

Project list
  • The projects are listed in some order... not sure I can figure out what order it is without looking at the code...; would be great if we had "last mod" and "created" date columns, and that we could sort according to name, or these dates
  • (?) Selecting a project with 's' - makes sense, but I keep hitting "[Enter]" ;-) Would be nice to have that as an alias!
  • [ESC] alias to 'q'
Project view / Session list
  • Better navigation: 'q' / '[ESC]' should go to project selection if we're coming from project selection, not quit immediately ('Q' could do that, but that saves one repeated keystroke...) → '[ESC]' alias to 'p', goes back to project list, 'q' still exits immediately, that's OK...
Markdown preview
  • 't' doesn't do anything (supposed to toggle the outline view) → fixed
  • '[Enter]' alias to 'v' (configurable?)

File system

  • The FS caches were located in ~/.claude/projects/*/cache, and the new cache is located in ~/.claude/projects/*/cache'.db is currently in ~/.claude/projects/`.
  • If we keep that location, we should at least name it ~/.claude/projects/claude-code-log-cache.db~ → now ~/.claude/projects/claude-code-log-cache.db which is OK.

We should have our own location. I'm no fan of ~/.claude-code-log, but as I wrote about, we should really put our generated output (.md and .html) in ~/Documents/ClaudeCodeLog (or ~/Documents/ClaudeCodeLog), we could also put the cache.db there.

Known issues

  • ⛔ Pre-process "thinking" Markdown, typically missing required new lines, like in this example:
    ...but this is hopeless, the newlines are missing from the input: Image
    {"type":"thinking","thinking":"The user is right - the worker approach is over-engineering. The TUI is still blocking during generation anyway, and they don't want users to do other things during generation. A simpler approach is just to show a notification before starting the generation and then show the result when done.Let me revert to a simpler approach:\n1. Show \"Rendering Markdown...\" notification\n2. Do the synchronous generation3. Show success/error notification when doneThis is simpler and matches what the user wants.", ...
    
    2. Do the synchronous generation3. Show success/error (no space between "generation" and "3." in the input, therefore, not much we could do about it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This issue is a scratchpad containing many unrelated proposals, with no single file, test, or entry point identified. Choose one unchecked idea and move it into a dedicated issue with a defined scope, implementation location, and completion criteria before starting work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.