Skip to content

feat(v1.0.0): fork-on-delete + heatmap + true token counts#4

Merged
dudegladiator merged 1 commit into
mainfrom
feat/v1-fork-and-heatmap
Jun 12, 2026
Merged

feat(v1.0.0): fork-on-delete + heatmap + true token counts#4
dudegladiator merged 1 commit into
mainfrom
feat/v1-fork-and-heatmap

Conversation

@dudegladiator

Copy link
Copy Markdown
Owner

Major rewrite. Every delete now writes a NEW session file with a fresh UUID and prints a claude --resume <new-id> command. Source file is never touched. New session id forces a fresh prefix-cache slot in Claude Code, so /context immediately reflects the smaller size — no stale cache.

What changed

  • fork-on-deletedelete produces new_session_id, new_path, resume_command. No more in-place mutation.
  • heatmap subcommandcc-session heatmap <id> ranks conversational turns by true token count (tiktoken on whole JSONL line: text + tool args + tool stdout + metadata).
  • true token countsinfo / show token numbers now reflect wire size (typically 2-3x the old text-only estimate).
  • fork badge — list / search show is_fork=true with an [edited] title prefix.
  • AGENTS.md — agent guide moved out of source into a real markdown file at the repo root, included via include_str!. GitHub renders natively; binary stays self-contained.

Removed

  • --force flag, lsof concurrent-open detection, .bak backup, restore subcommand. None are needed when the source is never mutated.

Verified

  • 62/62 unit tests pass (4 new for parentUuid relink, 2 new for fork sentinel, plus token-count tests for tool I/O)
  • Smoke test on real session: 91e440c0 (639 msgs, 662k tokens) → fork 1d9a021d (319 msgs, 276k tokens). Resumed in Claude Code, /context dropped from 433k → 230k (47%)
  • Sentinel line accepted by Claude Code's renderer (verified via fresh resume)

Major rewrite. Every `delete` now produces a NEW session file with a
fresh UUID instead of mutating the source. Output prints a
`claude --resume <new-id>` command. The new id forces a fresh prefix-
cache slot in Claude Code, so /context immediately reflects the
smaller size — no stale cache.

- delete: forks instead of mutating; output adds new_session_id,
  new_path, resume_command. Source file is never touched.
- heatmap: new subcommand. Ranks conversational turns by true token
  count (tiktoken on whole JSONL line — text + tool args + tool
  stdout + metadata). Drop the heaviest first.
- info / show: token counts now reflect wire size (typically 2-3x
  the old text-only estimate).
- list / search: forked files are tagged with a cc-session-fork
  sentinel line and surface as is_fork=true with an [edited] title
  prefix.
- Removed: --force flag, lsof concurrent-open detection, .bak
  backup, restore subcommand. None are needed when the source is
  never mutated.
- AGENTS.md: agent guide moved out of source into a real markdown
  file at the repo root. `cc-session agent-guide` reads it via
  include_str! so GitHub renders it natively and the binary stays
  self-contained.
- v1.0.0 bump.
@dudegladiator dudegladiator merged commit 947df98 into main Jun 12, 2026
5 checks passed
@dudegladiator dudegladiator deleted the feat/v1-fork-and-heatmap branch June 12, 2026 06:46
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