Local VS Code/Copilot session recall CLI for low-token agent handoffs
Project description
code-session-recall
Minimal tool to recover past coding/AI sessions.
State of the union
code-session-recall (csr) is a small, local CLI that helps you rediscover past coding work and AI-assisted sessions. It scans your workspace and local session stores, indexes recent activity, and provides quick lookups so you can run csr before asking large-context tools to search your repo. The goal is to make context retrieval cheap, targeted, and privacy-friendly.
Inspiration: CSR is inspired by Desi Villanueva's article
"I Wasted 68 Minutes a Day Re-Explaining My Code. Then I Built auto-memory."
and the related auto-memory
project. auto-memory targets Copilot CLI's local session database. CSR applies
the same recall-first idea to VS Code/GitHub Copilot, where useful state is
spread across VS Code workspace storage, chat session JSONL files, extension
artifacts, and state databases rather than one easy-to-query CLI database.
Core capabilities
- Scan and index: crawl specified folders and extract session metadata and touched files.
- Search: full-text search across indexed sessions and extracted text artifacts.
- Show: present a single session's details (checkpoints, files, commands, snippets).
- Export: dump sessions or indexes for backup or sharing.
Intended usage
- Run
csr scanafter a focused work session (or let it be scheduled) to capture a session snapshot. - Run
csrcommands before using an expensive workspace-wide search or an LLM prompt to surface recent, relevant context. - Use
csr show <id>to rehydrate a prior session when you need the exact commands, files, or checkpoints.
Installation
Once published to PyPI:
python -m pip install code-session-recall
csr handoff
csr install-instructions
For local development or pre-release testing from a clone:
python -m pip install -e .
csr --help
csr install-instructions
The repository-local entry point remains available:
python csr.py handoff
python csr.py install-instructions
csr install-instructions prints the exact bootstrap prompt and AGENTS.md
snippet to give another coding agent so CSR becomes the first recall step in a
workspace.
Release and publishing
GitHub Actions builds and checks the package on every push to main and every
pull request. PyPI publishing is intentionally tag-driven: bump
pyproject.toml, push the commit, then push a matching tag such as v0.1.1.
See docs/RELEASE.md for the Trusted Publishing setup and release checklist.
VS Code + GitHub Copilot integration
- This tool is designed to complement the GitHub Copilot extension in Visual Studio Code. Use
csrto surface local session context before invoking Copilot so prompts sent to Copilot are focused and cheaper. - Installation pattern: place the
AGENTS-TEMPLATE.mdcontent into~/.copilot/copilot-instructions.md(or append it) to teach Copilot to runcsrfirst on each prompt. Alternately, copy the template into your workspace notes and reference it from your Copilot config. - Recommended flow: run
csr files/csr list(orcsr search) to collect context, then paste or include the relevant snippets in the Copilot prompt.
Key record types and what they provide
-
Session (primary unit)
- id: stable session identifier
- times: start / end / last-modified timestamps
- summary: short natural-language summary (if available)
- files: list of file paths touched and small excerpts
- commands: captured commands and terminal history snippets
- checkpoints: named snapshots within the session
- tags/labels: user or auto-generated tags
-
File record
- path: workspace-relative path
- last_touched: timestamp
- diffs/snippets: small context snippets or a short diff for quick review
-
Checkpoint
- checkpoint id/name
- description: short note captured at checkpoint time
- snapshot: list of important files and their short hashes
-
Health / Index metadata
- schema version: DB layout version
- index stats: counts, last-scan, errors
Usage (examples)
python csr.py scan python csr.py handoff "keyword" python csr.py handoff python csr.py ask "question" --json python csr.py handoff "keyword" --json python csr.py search "keyword" python csr.py show --json python csr.py install-instructions python csr.py export --out sessions.ndjson
Roadmap
The code and docs are mid-migration from an earlier machine/user profile. The
near-term goal is to make csr discover the active VS Code/Copilot environment
from local state instead of relying on hard-coded usernames, storage folders, or
session ids.
-
Implemented / present in this repo
scan- crawl and index workspace and session storessearch- full-text search across indexed recordslist- list recent indexed sessionsshow- display a single sessionexport- export sessions or sliceshealth- basic DB/workspaceStorage/workspace check- formatter fact extraction - Copilot chat formatting now extracts compact
files,commands,errors,nextSteps,editedFiles, andtoolEventsfacts before recent-turn previews handoff- produce compact agent-ready markdown from matched or recent sessionsask- compatibility alias forhandoffso natural agent recall commands work
-
Highest priority
- VS Code storage discovery - support Stable (
Code), Insiders (Code - Insiders), and user-supplied roots; prefer environment-derived paths such asAPPDATA,TERM_PROGRAM_VERSION,VSCODE_*, and terminal/tool metadata captured in Copilot sessions. - Session discovery - infer the active workspace/session from
chat.ChatSessionStore.index,chatSessions/*.jsonl, terminal command metadata, and conversation titles instead of hard-codedWORKSPACE_CURRENT_CHAT_SESSION_ID. - Environment-aware recall - index Copilot terminal/tool records, including command, cwd, language, exit code, command URI, and useful environment variables, so future scans can locate the right database/session without guessing.
- Improve deterministic handoff compression - continue refining
csr handoff <query>scoring, workspace affinity, and typed fact ranking; seedocs/HANDOFF_DESIGN.md. - Docs parity - keep README,
docs/TOOL_DOCUMENTATION.md,AGENTS-TEMPLATE.md, andcsr --helpaligned with actual CLI behavior.
- VS Code storage discovery - support Stable (
-
Roadmap / desirable commands and flags
files- list recently touched files with metadata (useful for quick context):csr files --json --limit 10checkpoints- list or search named checkpoints across sessions- enhanced
health- 8-dimension health check report for the local datastore, VS Code storage discovery, current workspace/session, parser coverage, and index freshness schema-check- validate DB schema and guide migrations after upgrades- finer
--days Nfiltering forlist,files,search,checkpoints(convenience flag)
Notes and conventions
- We intentionally keep sample data and temporary investigation outputs out of version control by default; see
.gitignore. - Raw discovery outputs belong in ignored
unsanitized/; only sanitized derivatives should be committed todocs/or code. - The intended downstream install pattern is a local
code-session-recall/subdirectory inside each workspace; seedocs/INSTALL.mdfor.gitignoreentries, optional wrapper commands, and mergingAGENTS-TEMPLATE.mdinto that workspace's top-level agent instructions. - Sessions are meant to be local by default; export if you need to share or archive them.
Contributing and extensions
- The
csrarchitecture is intentionally small — new extractors and exporters can be added as modules. If you want a tighter IDE integration or a remote sync feature, add it as an optional plugin.
License / attribution
- Inspired by Desi Villanueva's Auto Memory article and the
dezgit2025/auto-memoryrepository: https://devblogs.microsoft.com/all-things-azure/i-wasted-68-minutes-a-day-re-explaining-my-code-then-i-built-auto-memory/ and https://github.com/dezgit2025/auto-memory. - (add license and contributor notes here)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_session_recall-0.1.0.tar.gz.
File metadata
- Download URL: code_session_recall-0.1.0.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abed691b2e36e6696c5171fec1cd6f50887b1eeed0e5cf2c772cb2b3723c6608
|
|
| MD5 |
e4d1ea0530647d060666654ea973f683
|
|
| BLAKE2b-256 |
e06abbdf69347c09c79e5b844d07ba61f107f01c718a54373dd5b13755406c1a
|
Provenance
The following attestation bundles were made for code_session_recall-0.1.0.tar.gz:
Publisher:
publish.yml on sle118/code-session-recall
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code_session_recall-0.1.0.tar.gz -
Subject digest:
abed691b2e36e6696c5171fec1cd6f50887b1eeed0e5cf2c772cb2b3723c6608 - Sigstore transparency entry: 1390709107
- Sigstore integration time:
-
Permalink:
sle118/code-session-recall@691ab6f33d1896a6e03805fe88f1def039de1290 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sle118
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@691ab6f33d1896a6e03805fe88f1def039de1290 -
Trigger Event:
push
-
Statement type:
File details
Details for the file code_session_recall-0.1.0-py3-none-any.whl.
File metadata
- Download URL: code_session_recall-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e345d7d082e777b281eaa443ba1ccc3a8e5bae0c6b700919c8e9bfe65c597b5
|
|
| MD5 |
f126bb0b6a9139fd7898e2b028d9bf31
|
|
| BLAKE2b-256 |
abc71b1bd5e892cf6b5abbe7b0fc14344409241bd4ac396bbd27ebfb2e438e39
|
Provenance
The following attestation bundles were made for code_session_recall-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on sle118/code-session-recall
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code_session_recall-0.1.0-py3-none-any.whl -
Subject digest:
1e345d7d082e777b281eaa443ba1ccc3a8e5bae0c6b700919c8e9bfe65c597b5 - Sigstore transparency entry: 1390709126
- Sigstore integration time:
-
Permalink:
sle118/code-session-recall@691ab6f33d1896a6e03805fe88f1def039de1290 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sle118
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@691ab6f33d1896a6e03805fe88f1def039de1290 -
Trigger Event:
push
-
Statement type: