aboutsummaryrefslogtreecommitdiffstats
path: root/claude_logbook/terminal.py
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2026-10-03 19:47:45 -0300
committerElvis Claros Castro <elvis@claros.ar>2026-10-03 19:47:45 -0300
commita5896fe2e28eb1e9ff9affe5d47ccd443bee5fc2 (patch)
treed76155b2c6aed9b905fe1b04094b879420964177 /claude_logbook/terminal.py
parent60c586001cf4d21ef1351be8c8ad7a269a6f005a (diff)
downloadclaude-logbook-a5896fe2e28eb1e9ff9affe5d47ccd443bee5fc2.tar.gz
claude-logbook-a5896fe2e28eb1e9ff9affe5d47ccd443bee5fc2.zip
Use the /rename title, mark compactions, count active time
A title set with /rename (custom-title) now wins over Claude's. The summary Claude Code leaves when the context is compacted is a block of its own ("c"), shown as a "context compacted here" mark instead of a message of yours, and not counted. Duration is active time: pauses over 30 minutes between messages are left out.
Diffstat (limited to 'claude_logbook/terminal.py')
-rw-r--r--claude_logbook/terminal.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/claude_logbook/terminal.py b/claude_logbook/terminal.py
index 65af046..61d05d8 100644
--- a/claude_logbook/terminal.py
+++ b/claude_logbook/terminal.py
@@ -214,6 +214,16 @@ def print_chat(s, st, out, show_tools=True, width=None):
first = True
for m in s["c"]:
+ if m["r"] == "c":
+ # The summary is long and Claude's, not part of the dialogue:
+ # only the mark of where the earlier context was folded.
+ if not first:
+ print(file=out)
+ first = False
+ label = " context compacted here "
+ side = max(3, (min(width, 80) - len(label)) // 2)
+ print(f"{st.faint}{'โ”€' * side}{label}{'โ”€' * side}{st.reset}", file=out)
+ continue
if m["r"] == "t":
if show_tools:
print(f" {st.faint}โš’ {clip(m['x'], body - 4)}{st.reset}", file=out)