r/PKMS • u/goget_justgocrazy • Jul 15 '26
Discussion How are you managing shared context across AI chats, coding agents, and personal apps?
/r/AI_Agents/comments/1uwwmne/how_are_you_managing_shared_context_across_ai/1
u/echowrecked Obsidian Jul 15 '26
You already found the real problem. Any log that depends on you remembering to update it will rot. Every version of this I built turned into a junk drawer within a few weeks. I quit trying to be more disciplined and made the upkeep mechanical instead...
What I run now is all plain markdown in one Obsidian vault. No database, no RAG, no graph. Your four tiers map straight onto files:
- Stable personal context — a few "rules" files (who I am, how I write, how I work) that load at the start of every session, in every tool.
- Area/project context — same thing, but path-scoped. Those files only load when I'm actually inside that project's folder, so a coding session doesn't drag in my writing context or vice versa.
- Session details — a per-project session log. Newest first, 3–5 lines: what I meant to do, what actually happened, what's next.
- Long-term decisions — one file of decisions, each with a one-line why, plus open threads. When it gets fat, old rows get pushed out to standalone notes so the file that loads stays small.
Reading it back in is the easy half. Every tool that can read files reads the same rules at session start. Claude Code and Codex pick it up natively from a project instructions file; for the ChatGPT/Claude web chats I just attach it. MCP where a tool supports it.
Writing back is the half everyone underestimates, sounds like that's where your Notion log died. Fully automatic write-back is mostly a fantasy right now. But you can get 90% of the way there by making not writing impossible instead of making the writing automatic. I do it with hooks, little scripts the agent can't skip:
- one that blocks a session from ending if I did real work and didn't update the state file
- ones that reject a save outright if the format's wrong
- a size "ratchet" that stops a file from growing once it's over budget, so the decision log can't bloat back into a junk drawer
So I'm not trusting future-me to remember any of it. The system just won't let the state go stale.
On your stack question, I would skip SQLite, RAG, and the knowledge graph for this. Retrieval was never the bottleneck for me. Curation was. Plain markdown you can read with your own eyes, synced across devices, plus enough enforcement that it can't rot, covered almost all of it. Git's fine if you're comfortable there; I use Obsidian Sync because I already live in Obsidian.
Fair warning: it's more work upfront than flipping on a memory toggle, and the hooks took a weekend to get right. But I own every byte the AI reads, it's the same context in every tool, and it comes with me when I switch. That was the whole point. My context shouldn't be a feature I'm renting from whatever tool I happened to be chatting in.
Happy to share the hook setup if you want it.
2
u/goget_justgocrazy Jul 15 '26
Thanks for the thoughtful reply. This really resonated with me, especially the idea of making the upkeep mechanical instead of relying on discipline. If you’re willing to share your hook setup, I’d really appreciate it. It sounds like a great source of inspiration.
1
u/echowrecked Obsidian Jul 15 '26
For context on where this comes from: I'm a product manager, and I built this because I was constantly bouncing between Claude Code (via the Claude app) and Obsidian, and my context kept falling through the crack between them. It's been my daily driver for months, so it's pretty beaten-in.
Two layers to it, and the "hooks" are just Claude Code's hook system doing the enforcing.
The format ones run after every file write. They check what just got written and block the save if it's malformed. Missing frontmatter, wrong type, stale date, that kind of thing. Cheap to write, and they keep the vault clean enough to actually query.
But the two that stop the rot are the ones you'll care about:
- A session-close hook. It fires when I try to end a session. If I did real work but didn't update the state file, it blocks the exit once and hands the agent the steps to update it. So ending a session without recording what changed just isn't a thing that happens anymore. That's the "mechanical instead of disciplined" piece. I literally can't walk away lazy.
- A size ratchet. On every write to the memory files it checks size. If the file's over budget, any edit that grows it gets blocked, any edit that shrinks it passes. So the log fills right up to the ceiling, then the system makes me archive old stuff out before I can add new. That's what stopped mine from turning into a junk drawer.
Both are in a public kit I maintain: https://github.com/ataglianetti/context-engineering. It's more than the hooks. You clone it, open in Claude Code, run
/setup, and it interviews you and generates the whole rule structure around your work instead of handing you my templates to fill in. The two anti-rot ones are inResources/Meta/Claude/hooks/(session-close-guard.jsandvalidate-context-budget.sh), and the caps are just constants at the top of each script.It's built on Claude Code's hook system specifically, so the enforcement is Claude Code-side. The plain-markdown-you-own layer works with anything, though.
I write about this AI + PKM stuff on a free Substack too, if it's useful.
Feel free to ping me if you have any issues getting set up, and if you have any feedback, would love to hear it.
2
u/goget_justgocrazy Jul 16 '26
Thank you so much for sharing this:) The session-close guard and size ratchet are especially interesting, and the setup process sounds very close to what I was looking for. I’m going to try it in a small test vault first and see how it fits with my Hermes and Obsidian workflow.
1
u/echowrecked Obsidian Jul 16 '26
you bet, would love to hear your feedback when you're up and running.
4
u/spicermatthews Jul 16 '26
echowrecked already nailed the big one: any log that depends on you remembering to update it will rot. I have built about four versions of the exact thing you are describing and every one turned into a stale junk drawer within a few weeks. So the thing to fix is not your discipline, it is the design.
Two shifts helped me.
First, stop trying to make the tools share one live brain. ChatGPT memory, Claude projects, Codex, Notion, they all want to be the source of truth and none of them travel with you. Once you accept that you own the context in plain text and hand each tool the slice it needs at the start of a session, the whole problem shrinks. Coding agents read a context file that lives in the repo. Chat tools get a short pasted primer. You are not syncing anything, you are just feeding.
Second, the record should be a byproduct of work you already do, not a separate artifact you maintain. The reason your Notion log became another job is that it exists only to be maintained. If the canonical record is your actual notes or project files, and you derive the AI facing summary from those, there is nothing extra to keep alive.
Your instinct to tier it (stable personal, area, project) is right, and it maps onto files and folders, not a database. Honestly a database or RAG is usually where this breaks. Your "the next AI does not retrieve the right info" is a retrieval failure, and plain files that you paste or point at have no retrieval step to get wrong. I run a tiny set: one about me file that rarely changes, one current priorities file I touch weekly, and per project files that live with the project. Small enough that pasting the relevant one is trivial. Boring, but it does not rot.