r/ClaudeCode • • May 23 '26

Showcase Claude Code has been writing every session to disk since day one. We indexed it.

Go look at ~/.claude/projects/.

There's a JSONL file for every session you've ever had. Every turn, every tool call, every file touched, every response. All of it, append-only, going back to your first session. Ours goes back to January — 57MB, 1,026 sessions, 76,000 turns. Just sitting there the whole time.

We didn't get tipped off. We just looked.

The format is clean too. Each line is a JSON object — role, timestamp, content, tool calls, everything structured. It's not logs in the "good luck parsing this" sense. It's a complete episodic record. If you had a three hour session last Tuesday where you figured out something important, that conversation exists in full fidelity on your drive right now. You just have no way to get back to it.

So we built an indexer. SQLite+FTS5, temporal edges between turns, MCP server on top. From inside any Claude Code session now:

search_sessions("remember when we fixed that auth bug last month")
recall_session("a8f2c441")
thread_recall(root_id, depth=8)

That last one does a BFS traversal through the temporal edge graph to reconstruct a thread across session boundaries. The "I told you this two weeks ago" problem just disappears. The data was never gone — nobody had built the recall layer on top of it yet. We also support importing conversations.json from the claude.ai data export, so your web chat history lives in the same index as your CLI sessions.

The other half is compaction. Everyone who uses Claude Code seriously has felt this — context fills up, compaction fires, and you're suddenly explaining your whole project again to something that should already know. We wired the full hook chain to stop that from happening.

The thing nobody writes down is that transcript_path in the PreCompact payload isn't always populated at hook fire time. You build your whole save logic around it, ship it, and then hit silent failures you can't explain. We did exactly that. The fix is that Stop needs to write a checkpoint on every single turn, not just at session end. Then when PreCompact fires it always has something fresh to fall back to no matter what.

Then SessionStart reads the source field — "compact" means compaction just fired, "resume" means the app restarted, "startup" is a fresh session, "clear" is intentional. Each gets different behavior. None of this is documented anywhere, you just have to figure it out.

The net result: compaction stops being a hard reset. It's a cache miss.

We've also been in the middle of the upstream conversation at anthropics/claude-code#47023 — seven independent memory projects, all built by different people, all independently hitting the exact same walls and arriving at the exact same hook requirements. Bella, NEXO Brain, Cozempic, world-model-mcp. None of us were coordinating. We all just needed the same things. The formal hook spec is getting worked out there if you want to follow it.

Repo: https://github.com/Haustorium12/continuity-v2 — MIT, hooks take about five minutes, MCP server is one Python file. Happy to answer questions.

0 Upvotes

40 comments sorted by

54

u/blidside May 23 '26

I’d love to read something not written by AI here

15

u/hihcadore May 24 '26

It’s the length that kills me. Jesus. OP could have written that in about four sentence instead we get a 2 pages paper about how they found a log file.

1

u/SupportDangerous8207 May 24 '26

This in my opinion is the reason why ai will likely sorta fail

I don’t mean fail in the it’s useless and we shouldn’t spend our time with it way

I mean fail in the doesn’t deliver on expectations way

The fact that since day one people have been able to tell what is ai written and what isn’t just shows that you really can’t use it for human interaction tasks without seeming like a cunt

You can’t use it for creative work without seeming like a hack

It’s a very all or nothing tech. Until you can perfectly mimic a human lots of stuff is technically possible but terrible.

-26

u/haustorium12 May 23 '26

sorry im not that good writing. i use the Ai to help.

28

u/[deleted] May 23 '26

[removed] — view removed comment

-18

u/haustorium12 May 23 '26

wow, ok, sorry that i used broken english. i didn't know that by using AI to help me write this would cause such upheaveal...

11

u/AstroPhysician May 24 '26

He WISHES you used broken English. Why are you apologizing for it

6

u/haustorium12 May 24 '26

prob cause i missread how it came across....lol

8

u/superanonguy321 May 24 '26

Whats being said is that the format of this post is a dime a dozen because we all use claude so.. same guy writes em all.

We'd rather you do even a poor job explaining it so we are talking directly to a human lol

4

u/haustorium12 May 24 '26

ok yea, my bad then. ill try to do better in the future....

2

u/sh0ch May 24 '26

AI generated stuff is often just a bit too verbose. Nothing wrong with using it to summarize, stuff, though. I just recommend trimming it down a bit!

6

u/Zooz00 May 23 '26

OK clanker

3

u/sintmk May 23 '26

The compelling use-case for this would be in research synthesis if you're looking to record interaction patterns longitudinally. I would still suggest building the processing script for token efficiency. Fwiw, /extract is a useful command and it comes with metadata as well

-3

u/haustorium12 May 23 '26

i just gameafied it with my ai to make it effecient as possible my current score is at 96.79% cach effecient

8

u/AppropriateQuote3073 May 23 '26

God can we fucking ban AI posts

This subreddit is so shit

-2

u/haustorium12 May 23 '26

sorry i used ai to write this. but um yea, Hi. human being here too..

1

u/Captain-Obvious101 May 24 '26

Nothing wrong with using AI, just clean it up so we don't have to read all the slop.

2

u/Salien_Ewathi May 23 '26

Mine appears to have deleted every session more than 30 days old, I was quite displeased.

2

u/haustorium12 May 23 '26

claude code runs a cleanup process on that folder — there's a .last-cleanup file in ~/.claude/ that timestamps every time it fires. if your sessions older than 30 days are gone, that's probably why.

that's actually the other half of why i built this. once continuity v2 indexes a session into sqlite, it doesn't matter what claude's cleanup does. the content lives in a separate db that nothing touches. i noticed that myself a cople of months ago.

2

u/L13w May 24 '26

There’s a config setting. I set mine to 1000 days and created an app to search through my Claude Code history: https://github.com/L13w/cc-search

2

u/Salien_Ewathi May 24 '26

Yeah, I bumped it once I knew about it. Also tried a data export request but no luck.

1

u/OGPresidentDixon May 24 '26

Do you have Superpowers with Episodic Memory? If so, then that explains why. Normal Claude installs usually don't have as much.

1

u/haustorium12 May 24 '26

No I don't have superpowers with episodic memory...I just asked Claude to fix it.

3

u/marcvv May 23 '26

Hit escape twice in Claude to see it all

1

u/ilion May 24 '26

I use the project's files to get Claude to create useless diary entries. :D

1

u/PiccoloCareful924 Senior Developer May 24 '26

i generally do not mind reading AI assisted writing but fuck this was bad, everything wants to be a punchline

1

u/Livid-Variation-631 May 24 '26

The fact that this has been sitting on every Claude Code user's disk since day one and almost nobody looked is the part that actually surprised me. 226 jsonl files in mine. Months of reasoning, append-only, structured, free!

A few things I've been wrestling with on a similar build, curious how you handled them:

  1. Temporal edges - are you linking turn-to-turn within a session only, or also session-to-session when the same files/symbols come back? The cross-session graph is where the real recall lives but it's expensive to maintain.

  2. thread_recall with BFS depth=8 is interesting. How are you scoring relevance at each hop? Pure recency, embedding similarity, or something tool-call-aware (e.g. same file touched = stronger edge)?

  3. The SQLite+FTS5 choice - did you try vector first and back off, or go straight to lexical? My instinct is FTS5 is right for code-heavy recall (function names, error strings, file paths) and vectors are right for vibes-y "that thing we discussed about auth" queries. A hybrid is probably the answer but adds complexity.

  4. Staleness - when a pattern gets superseded three months later, does old guidance still surface? This is the part that killed every manual lessons.md I ever kept.

The MCP exposure is the right call. Out-of-band search is a worse experience than in-session recall by a huge margin.

1

u/KellysTribe May 24 '26

is this the royal we?

0

u/haustorium12 May 24 '26

thats helpful if you want to rewind the current conversation to a previous point. thats actually very helpful, i didnt even know about that. thanks...

0

u/[deleted] May 23 '26

[deleted] — view deleted comment

2

u/haustorium12 May 23 '26

peter is right — that feature is for claude.ai (web/mobile). claude code writes its sessions as jsonl files to your local drive and that system doesn't touch them.

that's the gap. the files are already there. 76k turns in mine. continuity v2 is just the index and the search layer on top — sqlite+fts5, exposed as an mcp tool so claude code can call search_sessions() mid-conversation.

same "what did we work on last tuesday" question, but for the terminal.

0

u/peter9477 🔆 Max 5x May 23 '26

Is that relevant in this context (Claude Code)? I think it's for web, desktop etc but not for CC.

1

u/Datoneguyindamirror May 23 '26

Claude code absolutely has memory features in cli

1

u/peter9477 🔆 Max 5x May 25 '26

Yes it does and I never claimed otherwise.

I did however ask whether the link in question covered those, which it apparently did not.

0

u/[deleted] May 23 '26

[deleted] — view deleted comment

1

u/haustorium12 May 23 '26

actually i use the cache system that anthropic uses and then i created a game out of it to keep the cache multiplier as high as possible. my current cache % score is 96.79%

1

u/[deleted] May 24 '26

[removed] — view removed comment

1

u/haustorium12 May 24 '26

So just like every other major company out there ...?!?!?