yksanjo/gmem

yksanjo/gmem

Crypto-aware project memory for AI coding agents. Typed entities for Solana Programs/PDAs and EVM Contracts across Base, Optimism, Polygon, Arbitrum, Ethereum — plus chain-agnostic Decisions, Findings, and Integrations. Anchor + Hardhat auto-ingest, SQLite + FTS5 BM25 ranking, append-only versioning, git-aware diffs.

Category
访问服务器

README

gmem

Persistent project memory for Solana AI agents.

A Model Context Protocol (MCP) server that gives AI coding agents — Claude Code, Cursor, or anything that speaks MCP — durable, Solana-aware memory of a project across sessions: program IDs, IDLs, PDA seeds, deployment state, architectural decisions, audit findings. So agents stop forgetting what they built yesterday.

Status: v1.1 — stable, with EVM support. Seven MCP tools, real implementations (no stubs), backward-compatible wire format:

  • Storage: SQLite via better-sqlite3, one db file per project (auto-resolved from Anchor.toml / workspace Cargo.toml, override with GMEM_DB)

  • Ranking: SQLite FTS5 BM25 with a recency boost

  • Versioning: append-only — every write inserts a new (kind, natural_id, version) row; reads return the latest; full history available via the in-process Store API

  • Anchor ingest: gmem.ingest_anchor parses Anchor.toml, captures IDL sha256s, records git HEAD as sourceCommit per Program

  • Solana CLI context: gmem.solana_context reads ~/.config/solana/cli/config.yml, classifies the cluster, derives the active keypair's pubkey (secret never leaks). gmem.write on a Decision auto-attributes author + authorCluster

  • Git-aware diff: gmem.diff accepts both ISO timestamps and git refs (HEAD, HEAD~3, branch names, full and short SHAs)

  • EVM support (v1.1): gmem.ingest_hardhat parses Hardhat / hardhat-deploy workspaces, classifies networks into canonical chain ids (base-mainnet 8453, optimism-mainnet 10, polygon-mainnet 137, arbitrum-one 42161, ethereum-mainnet 1, plus testnets), captures a reorder-invariant ABI SHA-256. New Contract entity kind for EVM smart contracts.

  • License: MIT

  • Spec: see SPEC.md

  • Entity schemas: see schema/

Why

Solana has moved decisively toward an agent-first developer experience. The Foundation's awesome-solana-ai repo indexes a strong layer of stateless reference skills — solana-dev-skill, magicblock-dev-skill, metaplex-skill, helius-phantom-skill, solana-game-skill, and more — that teach agents how to do things. The Solana Developer MCP exposes documentation. What's missing is the layer above: persistent project memory.

Today every Claude Code session on a Solana project starts cold. The agent doesn't remember the program ID it deployed yesterday, the PDA seeds it chose two weeks ago, the audit finding from last sprint, or why a specific Jupiter integration was rejected. The developer compensates by pasting context, hand-maintaining NOTES files, or re-explaining the project every session. That is a tax on every agent-assisted Solana developer.

gmem fixes this by being opinionated about Solana primitives — programs, accounts, instructions, PDAs, IDLs, cluster state, Anchor configs — rather than being a generic key-value store. It complements every existing skill in awesome-solana-ai rather than competing with any of them.

Install

npm install -g @yksanjo/gmem

Or, to run it without a global install:

npx @yksanjo/gmem

The installed binary is still called gmem.

Or, to hack on the source:

git clone https://github.com/yksanjo/gmem.git ~/gmem
cd ~/gmem && npm install && npm run build

Then point your MCP client at it. For Claude Code:

// ~/.claude/mcp_servers.json
{
  "mcpServers": {
    "gmem": {
      "command": "node",
      "args": ["/absolute/path/to/gmem/dist/index.js"],
      "env": { "GMEM_DB": "~/.gmem/memory.db" }
    }
  }
}

Tools exposed (v0.1)

Tool Purpose
gmem.recall(query) Retrieve memory entries relevant to a natural-language query, ranked by BM25 + recency
gmem.write(entity) Persist a typed memory entry (Program / Account / Instruction / Decision / Finding / Integration); append-only
gmem.diff(from, to) Show how memory state changed between two points in time — accepts ISO timestamps OR git commit refs (HEAD, HEAD~3, branch names, full or short SHAs)
gmem.list_decisions() List all Decision entries for the active project, newest first
gmem.ingest_anchor() Auto-ingest an Anchor workspace: parse Anchor.toml, capture IDL sha256s from target/idl/, record the current git HEAD as source commit, write one Program per (program, cluster) pair
gmem.solana_context() Read the active Solana CLI config (~/.config/solana/cli/config.yml), return the configured cluster + RPC URL + active-keypair pubkey. Used by gmem.write to auto-attribute Decision entries to the developer wallet. Never returns the secret key.
gmem.ingest_hardhat() v1.1 — Auto-ingest a Hardhat / EVM workspace: parses hardhat.config.{ts,js,cjs,mjs}, reads every deployment artifact under deployments/<network>/<Contract>.json (the hardhat-deploy convention), classifies the network into a canonical chain (base-mainnet, optimism-mainnet, etc.), records a reorder-invariant ABI SHA-256 and git HEAD as sourceCommit. Writes one Contract entity per (chain, address) pair.

Full input/output JSON schemas are in SPEC.md.

Out of scope for v1.0

To keep the v1 scope honest, gmem v1.0 does NOT include: hosted multi-user sync, cross-project search, agent reputation, on-chain memory anchoring. These are tracked in ROADMAP.md for v1.x / v2.

Roadmap

  • [x] v0.1 — Open spec + JSON schemas + MCP server stub
  • [x] v0.2 — SQLite backend, BM25 ranking, append-only versioning
  • [x] v0.3 — Anchor workspace auto-ingest
  • [x] v0.4 — Solana CLI context capture + Decision auto-attribution
  • [x] v0.5 — git ref resolution in gmem.diff
  • [x] v1.0 — Stable release with three worked examples (DeFi vault, cNFT mint, AI agent) — see also PR #168 in solana-foundation/awesome-solana-ai
  • [x] v1.1 — EVM / Hardhat support (Base, Optimism, Polygon, Arbitrum, Ethereum, plus testnets), new Contract entity, gmem.ingest_hardhat tool, worked example 04-evm-vault

Contributing

This is an early-stage spec. The most useful thing right now is feedback on SPEC.md — does the entity model cover the Solana primitives that matter to your project? Open an issue or PR.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选