DEV Community

Cover image for I built persistent memory for AI coding tools one install, every tool, no more re-explaining context
Felipe Marzochi
Felipe Marzochi

Posted on

I built persistent memory for AI coding tools one install, every tool, no more re-explaining context

Every AI coding session starts from zero.

Close Claude Code and open it tomorrow. The AI doesn't know your project. You spend the first 10 minutes re-explaining the stack, the architectural decisions from last week, the approach that failed after three attempts.

It gets worse when you switch tools. Move from Cursor to Codex and you start over again.

I got tired of this. So I built EGC — Extended Global Context.

What EGC does

One install. Every tool. Permanent memory.

sh install.sh detects which AI tools you have (Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Windsurf, Kiro, Trae, CodeBuddy) and registers two local MCP servers in all of them. It also writes the memory protocol into each tool's global instruction file, so the AI calls get_state({}) at session start and update_state({}) at session end — automatically.

The state file lives at ~/.egc/state/ on your machine. It follows the project, not the IDE.

How it looks in practice

You open Claude Code on a project you haven't touched in two weeks. Without typing anything:

State loaded from egc-memory

Context acknowledged.

Ready to pick up:
• Fix the auth middleware regression
• Add rate limiting before deploy
• Decision: use Redis, not in-memory (discussed 2 sessions ago)

The AI already knows. You just start working.

Token savings

Rebuilding context from scratch costs ~1,500 tokens per session. EGC delivers the same in ~200 tokens.

20 sessions/month = ~$0.08 saved. The money is small. The interrupted flow is not.

Installation

Requires Node.js 20+.


bash
npm install -g @egchq/egc
egc install

That's it. Run egc doctor to verify.

The two MCP servers

egc-memory — the one you use every session
- get_state — reads project memory at session start
- update_state — saves decisions, preferences, next steps
- store_decision — persists a decision to SQLite
- query_history — returns past decisions by timestamp

egc-guardian — runs in the background
- validate_command — blocks shell injection
- validate_write — blocks writes to sensitive paths
- reduce_context — deduplicates Markdown payloads

It's open source

GitHub: https://github.com/Fmarzochi/EGC

MIT license. Built by one developer. 13 supported tools. If it saves you time, a star helps other developers find it.

---
If you've been re-explaining context every session, try it and let me know what breaks.
![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y8tf9v3gtaqdwln2wye.png)
Enter fullscreen mode Exit fullscreen mode

Top comments (5)

Collapse
 
topstar_ai profile image
Luis

This is an impressive solution for persistent AI memory across tools and sessions. I really like how EGC automatically registers MCP servers for multiple AI coding tools, stores project-level context, and drastically reduces token usage while preserving continuity across sessions. The get_state/update_state/store_decision/query_history pattern provides a robust foundation for cross-tool memory, and egc-guardian adds a much-needed layer of safety for shell and filesystem operations.
I’d love to collaborate and explore extending EGC—experimenting with multi-project memory management, shared team contexts, or agent-assisted code review workflows. It would be interesting to test how persistent context can improve AI-assisted productivity across different coding stacks.
Would you be open to discussing collaboration or co-developing extensions to improve cross-tool AI memory and verification?

Collapse
 
fmarzochi profile image
Felipe Marzochi

Thanks for the kind words and the interest in collaborating!

Multi-project memory and shared team contexts are exactly the kind of
extensions I have in mind for future versions. The architecture is designed
to support that.

If you want to explore co-development, open an issue on GitHub describing
what you want to build and we can figure out the best approach together:

github.com/Fmarzochi/EGC

Looking forward to it.

Collapse
 
vic_xie_9bed0062d5fd73d12 profile image
vic xie

Nice write-up! For devs who deal with messy copied text, TextStow might help — it's a Mac menu bar tool combining clipboard history with prompt templates and text cleanup. Free: textstow.com

Collapse
 
fmarzochi profile image
Felipe Marzochi

Thanks, Vic! I appreciate the recommendation. TextStow looks interesting. EGC is focused on persistent memory and project context for AI coding tools, so it's tackling a different part of the workflow. If you ever try EGC, I'd love to hear your thoughts!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.