Tags: Mapleeeeeeeeeee/cc-session-reader
Tags
docs: make README English-first with badges, add zh-TW translation (#8) Rewrite README.md in English as the primary language and move the existing Traditional Chinese content to README.zh-TW.md, with a language switcher at the top of both files. Add CI, release, pkg.go.dev, Go Report Card, Go version, license, and platform badges, plus a License section.
feat: trustworthy tool summaries, semantic audit, and repetition coll… …apsing (#7) * fix: determine tool result status via ladder instead of defaulting to ok Bash/Read results carry no toolUseResult.success field, so every failed command was rendered as "-> ok: Exit code 1" — misleading LLMs consuming injected context. Status now follows ADR-003's ladder: explicit success field, then is_error:true on the tool_result block (previously unparsed), then a conservative sniff list (non-zero "Exit code N", hook error), else ok. Failure excerpts skip noise lines (line-number prefixes, bare exit code lines, hook boilerplate) and widen to 200 runes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * feat: diff summaries for Edit/Write and graceful unknown-tool fallback Successful Edit results now render "-> ok (+A, -D @ L<n>)" computed from toolUseResult.structuredPatch hunks; Write renders "-> ok (new file, N lines)"; missing patch data falls back to the bare status (ADR-003 decisions 3-4). Unknown tools show their first input key/values instead of a bare tag, so new Claude Code tools degrade gracefully. Also fixes the pre-existing root cause that defeated ADR-002's per-tool suppression on real transcripts: tool names live on the assistant tool_use block, not on toolUseResult (commandName/agentType are absent for Bash/Read/Write/Edit), so RawName was always empty. ReadFile now correlates tool_use id -> name and resolves result names through it, covered by pipeline-level regression tests that parse realistic two-entry fixtures instead of hand-filled RawName values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * fix: emit minimal context header when session metadata is missing writeContextHeader silently skipped the header whenever the session-meta JSON was absent — and upstream stopped producing those files, so every recent session's context output started mid-dialogue with no hint of which project or conversation it was. The fallback header now derives session id, project (from event cwd, else transcript directory), and date (first non-empty event timestamp) from the transcript itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * fix: compute list duration and preview without session metadata Session-meta JSON files stopped being produced upstream, so every recent session fell back to the header scan, which showed 0m durations and blank previews for inherit-style sessions. Duration now derives from the transcript's first/last timestamps (last one found via a bounded 16KB tail read, never a whole-file load). The preview scan no longer lets noise lines (command tags, skill injections, tool results, interrupt sentinels) consume the candidate budget, and falls back to a [/command args] preview when no genuine prompt exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * feat: record command outcomes in usage log and normalize inject alias Usage entries now carry result (ok/error) and a one-line error message, written after the command finishes via a begin/finalize split around the existing exitOnError choke point — failures before target resolution are captured too. Legacy entries without the field read back as unknown, never as errors. The usage query normalizes the pre-rename "inject" command to "inherit" in both filter and display, and local builds resolve their version from runtime/debug.ReadBuildInfo instead of "dev". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * fix: measure stats from the real render pipeline so breakdown reconciles ComputeStats kept its own copy of the compaction logic, so the KEPT category sum drifted from the Filtered total (some categories counted pre-compression text, join newlines went unaccounted, and formatter-side cc-session collapsing was invisible). Filtered is now measured from the actual read-render output via a content sink threaded through the formatter, categories derive from that same pass, and the residual template bytes (timestamps, role labels, indentation) surface as an explicit "render overhead" row — the breakdown now reconciles to the character. System-reminder/context-usage blocks that the renderer drops are no longer miscounted as kept user text. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * refactor: address review findings from /review and /test-review - analyzer references formatter.Category* constants instead of re-typed string literals, so the category-name invariant is compiler-enforced - render pipeline params (agentIDs/opts/out/sink) bundled into a renderContext struct; output verified byte-identical before/after - mutation-guard tests: countContentLines' documented no-trailing-newline and empty-content contract, and the (?m)^Exit code N$ anchor that keeps mid-sentence mentions from sniffing as FAILED - stats test expectation hardcodes "??-?? ??:??" instead of borrowing parser.FormatTimestamp into the expected value Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UQYeDtvg1CQYvirZ4jWC5 * feat: audit semantic histogram and failure-length distribution Bucket CUT content by semantic risk (failure_output first, harness_noise last), report failed-result length stats (count/median/p90/max) to inform the upcoming head+tail error retention threshold, and annotate audit samples with their bucket. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * docs: ADR-004 failure retention strategy — investigated, deferred Records the fleet length distribution (379 sessions), the adversarially reviewed two-tier design (threshold ~1,500, global-ranking head+tail+signal truncation, self-describing omission markers, re-derivability budgets), and the measured rejection of project-path rescue (<1% net coverage, half noise). Implementation deferred until the expand-telemetry feedback loop exists; revisit triggers listed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * test: pin JSONL malformed-input and UTF-8 truncation boundary contracts Truncated/garbage/null-byte lines error explicitly without panic or silent loss; a 1MB single line guards against a future bufio.Scanner 64KB-token regression; Truncate stays valid UTF-8 at emoji-ZWJ and combining-char boundaries (grapheme-cluster integrity documented as a known limitation). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * feat: record requested tool ids in expand usage telemetry Prerequisite for ADR-004's feedback loop: expand entries now carry tool_ids (all requested short IDs, including unresolved ones — the goal is what the caller wanted to inspect). Legacy entries without the field read back empty; display appends tools: only for expand rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * feat: collapse retry loops and consecutive same-file reads Consecutive failed calls of the same tool whose command shares a prefix collapse to one line with a xN count and the last error (last tool id kept so expand reaches the final state); consecutive successful Reads of the same file collapse to a single xN line. Collapsing never crosses an interleaved event, never hides a distinct failure, and -verbose-bash exempts retry collapsing per the ADR-001 precedent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * docs: ADR-005 collapse rules for retry loops and same-file reads Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * fix: collapse only identical errors and require token-boundary multi-token prefix Adversarial verification (Codex) found two violations of ADR-005's invariants: distinct errors under a prefix-matched command merged into one line hiding the earlier error, and bare HasPrefix let 'git add' absorb 'git add-on-something' (and a bare 'git' absorb everything). Collapsing now additionally requires identical failure excerpts, and a prefix match needs a whitespace token boundary plus a multi-token shorter command. ADR-005 revised to match, including the rendered-event boundary semantics and expanded negative knowledge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * fix: windows-safe project dir names and CRLF-tolerant SKILL.md parsing in tests ProjectDirName (single source of truth, was duplicated across production caller detection and two test helpers) now also normalizes backslashes and drive colons — a no-op on unix paths; the SKILL.md frontmatter test helper trims CR before quote stripping. Both regressions are pinned by OS-independent tests that inject windows-style inputs directly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe * chore: gitignore local .claude directory Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SaBPDHw1cZDxhehYrqFgGe --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
feat: derive CLI commands and skill hint from a single registry (#6) * feat: derive CLI commands and skill hint from a single registry The set of cc-session subcommands was hand-copied across three places (main.go doc comment, the dispatch switch, and printUsage), plus the SKILL.md cheat-sheet — so a rename like inject→inherit had to be mirrored by hand and silently rotted when missed. Introduce a command registry in cmd/cc-session/commands.go as the single source of truth. Dispatch and printUsage now derive from it, and a new `cc-session help` renders the intent→command cheat sheet while `cc-session help --argument-hint` emits the one-line hint string. SKILL.md adopts the /wt shape: an `argument-hint` frontmatter (so the input box shows the subcommands), a `## 路由` section that dispatches on $ARGUMENTS, and the static cheat-sheet table replaced by a live !`cc-session help` injection that always matches the installed binary. install.sh / install.ps1 stamp the argument-hint line from `cc-session help --argument-hint` at install time (awk temp-file + mv for BSD/GNU portability), falling back to the committed line when the binary is absent or the output is malformed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JwariBme7AbQxDciEKSPXt * refactor: address review findings — make help derive from the registry The cheat sheet rendered by `cc-session help` was a fourth hand-copied command list living alongside the registry, and the struct doc comment claimed the registry was its single source of truth when it was not — reintroducing the exact drift this refactor set out to remove. - cheatSheetRow now references a registry command by name; the command string (`cc-session <name> <argHint>`) is derived via findCommand, and commandText() panics if the row points at a missing or hidden command, turning the `hidden` doc comment into an enforced invariant. - New TestCheatSheet_… asserts the cheat sheet covers exactly the non-hidden, hinted registry commands, so a new subcommand can't be added without a matching cheat-sheet row. - New TestSkillMD_… asserts SKILL.md's argument-hint frontmatter equals buildArgumentHint(), so registry changes that aren't mirrored into the committed SKILL.md fail the build instead of drifting silently. - printUsage computes column width from the longest command name so `benchmark` (9 chars) no longer breaks alignment. - Rename bool flag var argumentHint -> isArgumentHint per package convention. - Doc comments in commands.go rewritten to describe only what is true. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JwariBme7AbQxDciEKSPXt --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
refactor: rename cc-session inject subcommand to inherit (#5) Keep `inject` working as a deprecated alias (prints a stderr notice) so existing scripts/transcripts keep working during the transition. Also teach the formatter's cc-session call collapsing to recognize `inherit` while still collapsing legacy `inject` transcripts. Claude-Session: https://claude.ai/code/session_01GypgpBVuZDFuxAWoqVxxeL Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
fix: resolve path format on Windows and evaluate symlinks in DetectCa… …llerSession on macOS (#4) * fix: resolve path format on Windows and evaluate symlinks in DetectCallerSession on macOS * fix(ci): bump Go to 1.23 to fix macOS 15 dyld LC_UUID abort trap Go 1.22's external linker produces binaries missing LC_UUID on the macos-latest runner (now macOS 15 / Xcode 16), causing dyld to abort the test binaries with a signal: abort trap. Bumping to 1.23 resolves it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015AjK9TU7cRMbLTJGGJgpkB --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PreviousNext