I was chatting with friends about context compaction and how hard it can be to carry forward important context from past LLM sessions without wasting tokens or repeating yourself.

We kept coming back to the same pain point: you finish a productive session, but when you start a new one, you have no clean way to bring that history along. Claude Code already keeps a full record of every session on your local machine. So why not make that data more accessible and usable?

That idea turned into cc-sessions-cli, a lightweight command-line tool that helps you explore, analyze, and reuse your Claude Code session logs to make each session smarter than the last.

cc-sessions-cli.png

Why This Matters

Claude Code automatically saves every session under ~/.claude/projects. Each project has its own directory with complete JSONL logs of your prompts, completions, and decisions.

These logs are incredibly valuable, but they are stored in a raw JSON format that is awkward to read and inefficient for LLMs to process. Most of the time, those logs just sit there unused even though they could help you debug, learn, or continue a conversation exactly where you left off.

cc-sessions-cli changes that by:

  • Turning session logs into compact, model-friendly formats that are easier for Claude to work with
  • Keeping everything local and private so no sensitive data leaves your machine
  • Making it simple to build new workflows for session-to-session continuity and analysis

Smarter Session to Session Continuity

Imagine you spent hours debugging a tricky issue with Claude Code last week. Now you open a new session and need to pick up where you left off. Normally, you would either try to remember everything or manually paste fragments from old conversations.

With cc-sessions-cli, you can simply ask Claude:

“Summarize my last two sessions, focusing on the bug fixes we worked on.”

The tool gives Claude a clean, structured view of your past work so you can continue seamlessly without wasting tokens on messy JSON or sending private data to an external service. It is like giving Claude a form of long-term memory that is completely under your control.

Built-in Sub-Agents for Even More Power

cc-sessions-cli comes with two Claude Code sub-agents that make your session logs even more powerful.

1. prompt-coach

Helps you analyze your past sessions and improve your prompting techniques.
It reviews how you have been interacting with Claude and gives you actionable feedback to make future sessions more efficient and effective.

2. session-query

Lets you converse directly about your past sessions.
For example, you can ask:

“Summarize our conversations around authentication from last week.”
“Show me everything we discussed about improving the onboarding flow.”

session-query searches your logs and surfaces exactly the information you need, turning historical conversations into a living resource you can query anytime.

No Extra Installation Steps

The best part is that you do not need to install anything manually.

cc-sessions-cli runs automatically using npx, so all you need to do is place the sub-agent definitions (session-analyzer and session-query) in your project.

This setup tells Claude how to call the tool whenever it is needed. If you are working in a TypeScript or JavaScript project, you can optionally install it as a local dependency, but that is completely optional.

This keeps your workflow lightweight and ensures Claude can always access and query past sessions for that project without extra setup.

Local, Private, and Flexible

Because everything happens locally:

  • Your logs never leave your machine, keeping sensitive data safe
  • It scales easily, even with very large logs, since you can filter them with tools like grep or head before giving context to Claude
  • It works naturally with other CLI tools and Claude’s own orchestration, creating endless possibilities for custom workflows

The sub-agents are designed to be privacy-friendly, giving you powerful analysis and querying capabilities without relying on external services.

Early Days, Big Potential

This is an early project built to solve a real problem. It is simple now, but there is huge potential for it to grow into a central piece of how you manage and reuse context with Claude Code.

You can try it right away by adding the sub-agents to your project. Claude will automatically run the tool via npx whenever you ask it to analyze or query your past sessions.

Check out the project here: https://github.com/erans/cc-sessions-cli

Final Thoughts

Your Claude Code session logs are more than just an archive. They are a record of your thinking, problem solving, and decisions over time.

With cc-sessions-cli, you can finally unlock that history.

  • Use session-analyzer to gain insights into how you work and improve your prompting
  • Use session-query to ask direct questions about past sessions and bring their context into today’s work
  • Do it all without worrying about privacy since everything runs locally through npx

Give it a try and see how much smarter and more connected your Claude Code sessions can become when your past work becomes part of the conversation.

Oh, and you know why its a CLI? Because its powerful :)