Skip to content

Cross-Session Memory

By default, AI coding agents start every session cold. They re-read files, re-trace routes, re-learn your architecture. Ganglia’s memory layer fixes that.

Survives everything. Stored in a per-project Knowledge Base in MemOS (cloud or self-hosted). Semantic search — not keyword grep.

Use for: preferences, decisions, gotchas, fix patterns, left-off notes.

code_memory(action="save", text="JWT tokens expire after 15 minutes. Refresh token is httpOnly cookie. Never store access token in localStorage.")
code_memory(action="recall", text="auth token storage")
→ JWT tokens expire after 15 minutes. Refresh token is httpOnly cookie...

Stored as nodes in the project graph, linked to code nodes via edges. Auto-surfaces when you query related symbols.

Use for: architectural notes about specific functions, patterns, relationships between components.

code_knowledge(action="save",
subject="auth flow",
note="JWT from /auth/login → localStorage → Authorization header → AuthGuard validates",
links=["AuthController", "AuthService", "AuthGuard"],
tags=["architecture"])

When you later call code_related("AuthService"), this knowledge appears automatically.

Each project gets its own Knowledge Base named gl-<project-dir>. The ID is cached in .gl/kb_id. Memories from one project never bleed into another.

End of session:

code_memory(action="save", text="TODO: finish token refresh logic in auth middleware — left off at line 142")

Start of next session:

code_memory(action="recall", text="what was I working on?")
→ TODO: finish token refresh logic in auth middleware — left off at line 142

The agent picks up exactly where it left off.