Skip to content
egc-memory

MCP Servers

egc-memory

Persistent cross-session memory for AI coding tools. The one you'll use every session.

Overview

egc-memory is a local MCP server that stores project state in a SQLite database at ~/.egc/state/. The AI reads it at the start of each session and writes to it at the end.

State is stored per-project as plain Markdown files. Human-readable, version-control friendly, never leaves your machine.

Tools

get_state
get_state({ project_path?: string })

Reads the state file for the current project. Call this at the start of every session to restore context. If project_path is omitted, uses the current working directory.

Returns: Markdown string with project context, active decisions, preferences, and next steps.

update_state
update_state({ project_path?: string, context?: string, decisions?: Decision[], avoid?: Avoid[], preferences?: string[], next?: string[] })

Saves this session's decisions and preferences. Merges with existing state — does not erase previous memory. Only include fields that changed this session.

Returns: Confirmation string with the updated state file path.

store_decision
store_decision({ project_path?: string, what: string, why: string, tags?: string[] })

Persists a single decision to SQLite with a timestamp. Useful for decisions you want to query by date or tag later.

Returns: Confirmation with the stored decision ID.

query_history
query_history({ project_path?: string, limit?: number, since?: string, tag?: string })

Returns past decisions filtered by timestamp and/or tag. Useful for auditing architectural decisions over time.

Returns: Array of decision records with timestamps and tags.

State file format

State files live at ~/.egc/state/<project-slug>.md. The slug is derived from the absolute path of the project directory.

~/.egc/state/Projetos--my-app.md
# Project State
project: /home/user/Projetos/my-app
updated: 2026-06-05T01:00:00.000Z

## Context
Next.js 15 app with PostgreSQL and row-level security.
Auth uses sessions via iron-session, not JWT.

## Active Decisions
- Drizzle ORM over Prisma: better TypeScript inference, lighter
- No client components unless strictly needed

## Avoid
- Prisma: tried it, generated types were too verbose
- JWT: dropped after audit flagged refresh token storage

## Preferences
- Terse responses, no summaries
- Functional components only

## Next
- Add RLS policies to the projects table
- Wire up the invite flow

Session protocol

The cognitive bootstrap injected by the installer writes this protocol into every tool's global instruction file. The AI is instructed to run it automatically.

Session start
get_state({})

AI reads project state and picks up where the last session ended.

Session end
update_state({
  context: "...",
  decisions: [...],
  next: [...]
})

AI saves decisions, what to avoid, preferences, and next steps.