Project structure
Understand where MemoGrafter behavior belongs and keep provider, persistence, CLI, and Studio concerns isolated.
Repository map
src/
adapters/ Provider SDK integrations
agents/ Session and fleet-facing agents
core/ Runtime orchestration and shared types
ingestion/ Segmentation, extraction, and queue-backed ingest
maintenance/ Conflict, versioning, and decay passes
prompts/ Provider-neutral prompt construction
retrieval/ Recall, grafting, and graph expansion
schema/ MemoGrafter-owned schema metadata
store/ GraphStore boundary and PostgreSQL implementation
studio/ Provider-independent Studio preview services
utils/ Focused reusable domain utilities
cli/
commands/ init, migrate, doctor, and studio commands
doctor/ Structured Doctor results and rendering
studio/ Local server, API, repository, and bundled frontend
utils/ Project, configuration, and database helpers
tests/
unit/ Isolated automated tests
package/ Published-entrypoint and CLI smoke tests
core/ Database-backed core scenarios
fleet/ Database-backed multi-agent scenarios
manual/ Provider and realistic workflow smoke tests
examples/ Runnable package-user workflows
migrations/ Historical SQL migration referencesCore agents and orchestration
src/agents/ exposes session-oriented and fleet-oriented workflows. src/core/ coordinates adapters, storage, ingestion, retrieval, queues, and caching without owning provider SDK details.
Pipelines and prompts
src/ingestion/ builds graph memory, while src/retrieval/ searches and assembles it for recall or grafting. src/maintenance/ manages lifecycle annotations, and src/prompts/ keeps prompt formatting separate from orchestration.
Storage and schema
src/store/GraphStore.ts is the persistence boundary. src/store/postgres-pgvector/ implements it with PostgreSQL and pgvector. src/schema/ is the source of truth for MemoGrafter-owned extensions, tables, indexes, and migration metadata.
Provider adapters
src/adapters/ contains OpenAI, Anthropic, Gemini, and adapter contracts. Provider SDK imports belong in their adapter modules so package users pay only for the providers they choose.
CLI boundary
cli/commands/ implements project initialization, migration, Doctor, and Studio startup. cli/utils/ owns project discovery, configuration resolution, and shared database diagnostics.
memo-grafter/schema entry point.memo-grafter/store.Studio boundary
src/studio/ contains provider-independent preview services exported through memo-grafter/studio. cli/studio/ contains the local HTTP host, API, database repository, and bundled frontend.
Tests and examples
tests/unit/ is the default fast suite. Package tests protect exports and CLI workflows; core and fleet suites require PostgreSQL; manual tests cover provider calls and realistic workflows.
examples/ demonstrates package-user workflows and should use public APIs rather than internal implementation shortcuts.