Skip to main content

Class MemMachineProject

The MemMachineProject class provides methods to manage and interact with specific projects in MemMachine. It acts as the bridge between your high-level client and the specific memory engine for a project. While you can instantiate this class directly, the recommended way is to use the client.project() method.
const project = client.project({ org_id: 'your_org', project_id: 'your_project' });
Parameters
NameTypeDescription
projectContextProjectContextThe organization and project identifiers.

Methods

create()

Creates a new project on the MemMachine server if it does not already exist.
await project.create(options?: CreateProjectOptions)
Parameters
NameTypeDescription
optionsCreateProjectOptionsOptional settings such as a project description.
Returns
  • Promise<Project> — The newly created Project entity.

memory()

Creates a MemMachineMemory instance for managing and searching memories within this specific project.
project.memory(memoryContext?: MemoryContext)
Parameters
NameTypeDescription
memoryContextMemoryContextOptional context to narrow the memory scope.
Returns

get()

Fetches the current project details from the MemMachine server.
await project.get()
Returns
  • Promise<Project> — The Project entity containing metadata and configuration.

getEpisodicCount()

Retrieves the total count of episodic memories currently stored within this project.
await project.getEpisodicCount()
Returns
  • Promise<number> — The total count of memories.

delete()

Permanently removes the project and all of its associated episodic and semantic memories from the server.
await project.delete()
Throws

Usage Example

import { MemMachineClient } from '@memmachine/client';

const client = new MemMachineClient({ base_url: 'your-base-url' });
const project = client.project({ org_id: 'acme_corp', project_id: 'internal_ai' });

// 1. Initialize the project on the server
await project.create({ description: 'AI assistant memory storage' });

// 2. Check how much memory we have stored
const count = await project.getEpisodicCount();
console.log(`Current memory count: ${count}`);

// 3. Access the memory engine
const memory = project.memory();