convez.ai
MCP ServerIntegração & APIsIntermediário
srobinson

Context Matters

srobinson/context-matters

Memória persistente scopada para agentes IA com busca e versionamento

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP que fornece memória persistente estruturada para agentes de IA, armazenando decisões, padrões e lições aprendidas em sessões diferentes. Usa SQLite como backend com suporte a escopos, busca e recuperação de contexto prioritário.

Instalação

$npx convez-ai srobinson/context-matters

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 2 semanas
Versão
v0.2.27
Issues abertas
1
Contribuidores
2

Casos de uso

  • Agentes que precisam lembrar decisões e padrões entre sessões
  • Manutenção de contexto estruturado por projeto ou repositório
  • Busca e recuperação de lições aprendidas e feedback histórico
  • Backup e auditoria de conhecimento acumulado por agentes

Veredito

Ferramenta sólida para estateful agents, bem-estruturada com dez operações claras via MCP. Ideal para cenários onde agentes precisam crescer em conhecimento, mas requer integração explícita e gestão de escopos.

README

A tradução para o português deste README ainda está na fila.

context-matters

Structured context store for AI agents. SQLite-backed, scoped, searchable.

Agents accumulate knowledge during sessions: decisions made, feedback received, patterns discovered, lessons learned. Without persistence, every session starts from zero. context-matters gives agents a place to store and retrieve that knowledge across sessions, projects, and scopes.

Install

npx context-matters serve    # MCP server on stdio

Or build from source:

cargo install --path crates/cm-cli

MCP server

Runs as a Model Context Protocol server. Ten tools, all prefixed cx_*.

cm serve

This CLI mirrors the MCP tool surface. From a shell, use cm <command>. From an MCP client, the same operations are exposed as cx_<command>. Run cm serve to start the MCP server on stdio.

MCP Tools

ToolPurpose
cx_recallPriority context for one known scope
cx_searchContent search across wide or unknown scopes
cx_storePersist a fact, decision, preference, or lesson
cx_depositBatch-store conversation exchanges
cx_browseList entries with filters and pagination
cx_getFetch full content for specific entry IDs
cx_updatePartially update an existing entry
cx_forgetMark entries forgotten so active reads skip them
cx_statsView store statistics and scope breakdown
cx_exportExport entries as JSON for backup

MCP Examples

cx_recall(query: "auth decisions", scope: {"kind":"path","path":"global/project:helioy"})
cx_recall(scope: {"kind":"cwd_inferred"})
cx_search(query: "auth decisions", scope: {"kind":"all"})
cx_search(query: "scope path", scope: {"kind":"descendants","path":"global/project:helioy"})
cx_search(query: "retry policy", scope: {"kind":"set","paths":["global", "global/project:helioy"]})
cx_store(title: "Use UUIDv7", body: "...", kind: "decision")
cx_store(title: "Repo-scoped lesson", body: "...", kind: "lesson", scope: "global/project:helioy/repo:context-matters")
cx_deposit(exchanges: [{"user":"...","assistant":"..."}])
cx_deposit(exchanges: [{"user":"...","assistant":"..."}], summary: "Conversation about scope routing.", scope: {"kind":"cwd_inferred"})
cx_browse(kind: "decision", scope: {"kind":"path","path":"global/project:helioy"})
cx_browse(scope: {"kind":"cwd_inferred"}, cursor: "opaque-cursor-from-previous-response")
cx_get(ids: ["uuid1", "uuid2"])
cx_update(id: "uuid", title: "Updated title")
cx_update(id: "uuid", body: "Revised body content.", kind: "decision")
cx_forget(ids: ["uuid"])
cx_forget(ids: ["uuid1", "uuid2", "uuid3"])
cx_stats()
cx_export(scope: "global/project:helioy")
cx_export(scope: {"kind":"descendants","path":"global/project:helioy"})

CLI Commands

The CLI reads from the same store as the cx_* MCP tools.

CommandPurposeScope input
cm recallPriority context for one known scopeOptional singular scope selector
cm searchContent search across wide or unknown scopesRequired singular or broad scope selector
cm storePersist a fact, decision, preference, or lessonOptional singular scope selector
cm depositBatch-store conversation exchangesOptional singular scope selector
cm browseList entries with filters and paginationOptional singular or broad scope selector
cm getFetch full content for specific entry IDsNo scope request parameter
cm updatePartially update an existing entryNo scope request parameter
cm forgetMark entries forgotten so active reads skip themNo scope request parameter
cm statsView store statistics and scope breakdownNo scope request parameter
cm exportExport entries as JSON for backupOptional singular or broad scope selector

CLI Examples

cm serve
cm init
cm init --global
cm web --open
cm forget 019d09ed-7a4f-7693
cm recall "auth migration"
cm search "auth migration" --scope '{"kind":"all"}'
cm browse --kind decision -j
cm get 019d09ed-7a4f-7693
cm stats
cm export --scope '{"kind":"descendants","path":"global/project:helioy"}'

Scope Model

Scopes form a hierarchy. Context at broader scopes is visible at narrower scopes.

global                                           cross-project knowledge
global/project:helioy                           project-level decisions
global/project:helioy/repo:context-matters      codebase-specific facts
global/project:helioy/repo:context-matters/session:abc   task context

Public requests select scope through the scope field. The canonical scope path string returned by read tools can be passed directly to write tools.

Singular Selectors

SelectorRequest example
canonical path string{ "scope": "global/project:helioy/repo:context-matters" }
path{ "scope": { "kind": "path", "path": "global/project:helioy/repo:context-matters" } }
cwd_inferred{ "scope": { "kind": "cwd_inferred", "cwd": "/path/to/repo" } }
project{ "scope": { "kind": "project", "project": "helioy" } }
repo{ "scope": { "kind": "repo", "project": "helioy", "repo": "context-matters" } }
session{ "scope": { "kind": "session", "project": "helioy", "repo": "context-matters", "session": "abc" } }

Broad Selectors

SelectorRequest example
descendants, subtree alias accepted{ "scope": { "kind": "descendants", "path": "global/project:helioy" } }
set{ "scope": { "kind": "set", "paths": ["global", "global/project:helioy"] } }
all{ "scope": { "kind": "all" } }

Tool Scope Boundaries

ToolScope request
cx_recallOptional singular scope selector
cx_searchRequired singular or broad scope selector
cx_storeOptional singular scope selector
cx_depositOptional singular scope selector
cx_browseOptional singular or broad scope selector
cx_exportOptional singular or broad scope selector

For cwd based browse resolution, call cx_browse(scope: {"kind":"cwd_inferred","cwd":"/path/to/repo"}). cwd_inferred resolves linked git worktrees to the source repository identity. Persisted entries and export rows include scope_path. Read projections use scope for compact row output.

Two-Phase Retrieval

cx_recall, cx_search, cx_browse return metadata plus snippets. Use cx_get with returned IDs to fetch full body content. This keeps initial responses compact while allowing selective deep reads.

Web UI

Run cm web --open for browser entry management and monitoring. It serves http://localhost:3141/ by default.

Architecture

Five crates, clean separation:

CrateWhat it does
cm-coreDomain types, ContextStore trait, query construction. Zero I/O.
cm-storeSQLite adapter via sqlx. WAL mode, FTS5 search, BLAKE3 dedup.
cm-capabilitiesShared request/response types, validation, scope resolution, projections.
cm-cliCLI binary + MCP server. Tool docs generated from tools.toml.
cm-webWeb monitoring dashboard with Axum and React/Vite. Run cm web --open; default URL: http://localhost:3141/.

Development

Rust 2024 edition. just as task runner.

just check    # fmt + clippy (warnings = errors)
just build    # cargo build --workspace
just test     # cargo test --workspace
just fmt      # rustfmt

License

MIT

Ver o original no GitHub

Bom para

Relacionados