Skip to content

Package runtime scripts in the skill and add digest caching#28

Merged
hacktivist123 merged 5 commits into
hacktivist123:mainfrom
uncoooloj:tools/package-scripts-digest-cache
Jun 19, 2026
Merged

Package runtime scripts in the skill and add digest caching#28
hacktivist123 merged 5 commits into
hacktivist123:mainfrom
uncoooloj:tools/package-scripts-digest-cache

Conversation

@uncoooloj

Copy link
Copy Markdown
Contributor

Moves the four runtime helpers (session-events.py, session-candidates.py, session-digest.py, skill-provenance.py) from repo-root scripts/ into skills/agent-session-resume/scripts/ so installed skills actually ship them — previously every resume re-derived multi-line jq pipelines by hand because the scripts were not present in ~/.claude/skills or ~/.codex/skills installs.

Also:

  • session-digest.py: persistent <transcript>.digest.json sidecar cache (size+sha256+offset keyed), incremental append-only tail processing by default, --sidecar-dir / --no-sidecar / --no-incremental flags. Cached vs fresh output verified byte-identical.
  • session-candidates.py: --since / --until (ISO or relative like 7d) and --cwd (exact or parent/child) filters, so 'my Codex threads from the past week' needs one command instead of hand-rolled date enumeration.
  • New validators: validate-session-digest.py, validate-session-candidates.py; wired into CI. Full suite green.
  • .gitignore: digest sidecars.

CI validate-*.py stay at repo root. All scripts remain python3 stdlib-only and cwd-independent.

🤖 Generated with Claude Code

uncoooloj and others added 2 commits June 10, 2026 00:47
Moves (git mv, so installed skills ship the helpers):
- scripts/session-events.py -> skills/agent-session-resume/scripts/session-events.py
- scripts/session-candidates.py -> skills/agent-session-resume/scripts/session-candidates.py
- scripts/session-digest.py -> skills/agent-session-resume/scripts/session-digest.py
- scripts/skill-provenance.py -> skills/agent-session-resume/scripts/skill-provenance.py
CI-only validate-*.py stay at repo-root scripts/.

session-digest.py:
- writes a <transcript>.digest.json cache sidecar next to the source by
  default, keyed on file size + sha256 + last processed byte offset
- unchanged files reuse the sidecar wholesale; append-only growth processes
  only the tail and merges (incremental is the default for JSONL transcripts);
  prefix changes recompute fully
- new flags: --sidecar-dir, --no-sidecar, --no-incremental; unwritable
  transcript directories skip the sidecar with a stderr notice

session-candidates.py:
- new flags: --since / --until (ISO date/datetime or relative like 7d, 12h)
  and --cwd now filters to exact or parent/child workspace matches in
  addition to ranking

Validation:
- new scripts/validate-session-digest.py covers cache-hit, append-only tail,
  prefix-change invalidation, --no-sidecar, --sidecar-dir, and read-only dirs
- new scripts/validate-session-candidates.py covers the time-window and cwd
  filters for both platforms
- validate-skill-package.py now checks the packaged scripts; validate.yml
  runs the new validators and compiles the moved scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…dexed sessions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread skills/agent-session-resume/scripts/session-digest.py Outdated
hacktivist123 and others added 2 commits June 19, 2026 19:43
…ion, drop review comment

The suggestion was committed in the wrong place (inside digest_file_cached if-block),
creating a duplicate sha256_prefix and breaking syntax. This:
- Removes the duplicate sha256_prefix
- Moves last_complete_newline_offset to after sha256_prefix
- Removes the LakunleD review comment from the function
- Updates write_cache to use last_complete_newline_offset + aligned sha256
@hacktivist123 hacktivist123 merged commit f52e198 into hacktivist123:main Jun 19, 2026
1 check passed
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.

3 participants