feat(cli): path p cache sync — incremental session ingestion#128
Closed
benbaarber wants to merge 2 commits into
Closed
feat(cli): path p cache sync — incremental session ingestion#128benbaarber wants to merge 2 commits into
path p cache sync — incremental session ingestion#128benbaarber wants to merge 2 commits into
Conversation
`path p cache sync [types…]` enumerates sessions across the installed
agent harnesses (claude/gemini/codex/opencode/cursor/pi, or just the
named ones) and derives into the cache only what is new or changed.
The manifest at ~/.toolpath/sync.json maps artifact type → session id →
{project?, cache_id, last_activity?, message_count, synced_at}; a
session re-derives only when its fingerprint (last_activity +
message_count) differs. Manifest writes are atomic (temp + rename,
0600) and checkpointed per type; sync overwrites what it re-derives
(refresh semantics) and never deletes — the cache is an archive, not a
mirror.
Enumeration reuses cmd_share::gather_sessions; per-session derivation
goes through new *_with variants of the cmd_import session helpers so
listing and derivation share provider managers (and tests can inject
fixture resolvers). Real-data numbers: 34 sessions / 129 MB of Claude
JSONL → 5.7 s cold, 0.9 s incremental no-op.
path-cli 0.15.0 → 0.16.0 (+ toolpath-cli shim bump).
|
🔍 Preview deployed: https://cff3a4c4.toolpath.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
path p cache sync [types…]— the first step toward a cache that fills itself. It enumerates sessions across the installed agent harnesses and derives into the cache only what is new or changed since the last sync, so users no longer have top importeach session by hand. Groundwork forpath queryrunning sync implicitly.How
cmd_share::gather_sessions(thepath shareaggregation), filtered per requested harness. No args = all six;path p cache sync claude codexnarrows.last_activityormessage_countdiffers from the sync manifest at~/.toolpath/sync.json({artifact type → session id → {project?, cache_id, last_activity?, message_count, synced_at}}). Written atomically (temp + rename, 0600), checkpointed after each type so an interrupted first run keeps finished types.derive_*_session_withvariants of thecmd_importhelpers that take the provider manager, so listing and derivation agree on provider roots and tests inject fixture resolvers.--forcedance; manualp importkeeps error-on-hit). Never deletes: sessions removed upstream keep their cache docs and manifest records (archive, not mirror). Derivation failures warn + tally asfailedwithout aborting.claude 3 new, 1 updated, 240 unchanged); harnesses with no sessions stay silent on default runs.Numbers (real data, this machine)
34 Claude sessions / 129 MB of JSONL: 5.7 s cold, 0.9 s incremental no-op — and the incremental run correctly caught the one live session that had changed. The 0.9 s floor is the providers' metadata pass (full parse per JSONL file); a stat-level fast path is the planned next optimization before
path queryruns sync implicitly.Versioning
path-cli0.15.0 → 0.16.0 (new subcommand) +toolpath-clishim bump; workspace deps,site/_data/crates.json, CHANGELOG, CLAUDE.md, README updated per the release checklist. Site builds (11 pages); shimcargo checks.Tests
sync.rs: manifest roundtrip + 0600 + corrupt-file hint, first-sync/second-sync/changed-session lifecycle over resolver-injected Claude fixtures, type filtering, refresh-overwrite of unremembered cache entries, failure tallying, provider-missing errors, summary rendering.cargo test --workspace,cargo clippy --workspace -- -D warnings,cargo fmtall clean (includes a drive-by fix for a pre-existingredundant_closureincmd_export.rs).Next
Wire
path queryto run sync before querying (with--no-syncopt-out), then the stat-level enumeration fast path.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.