Skip to main content

Overview

The MemMachineProject class provides methods to manage and interact with projects within the MemMachine ecosystem[cite: 1]. It serves as a middle-tier controller, allowing you to create projects, check memory usage, and spawn dedicated memory management instances.

Key Features

  • Project Lifecycle: Create, retrieve, and delete project entities on the server.
  • Memory Factory: Initialize MemMachineMemory instances scoped to this project.
  • Usage Metrics: Retrieve the total count of episodic memories stored within the project.

Constructor

new MemMachineProject()

Initializes a project instance. This is typically accessed via client.project().
new MemMachineProject(client: AxiosInstance, projectContext: ProjectContext)
ParameterTypeDescription
clientAxiosInstanceInternal Axios instance for API communication.
projectContextProjectContextScoping identifiers like org_id and project_id.

Properties

PropertyTypeDescription
clientAxiosInstanceThe underlying HTTP client.
projectContextProjectContextThe active organizational and project scope.

Methods

create()

Initializes the project on the MemMachine server.
create(options?: CreateProjectOptions): Promise<Project>

get()

Retrieves the current metadata and state of the project from the server.
get(): Promise<Project>
  • Returns: Promise<Project> — The current project data model.

getEpisodicCount()

Retrieves the total number of episodic memories associated with this project.
getEpisodicCount(): Promise<number>

memory()

Creates a MemMachineMemory instance scoped to this project.
memory(memoryContext?: MemoryContext): MemMachineMemory

delete()

Permanently removes the project and all associated memories from the server.
delete(): Promise<null>

Usage Example

const project = client.project({ org_id: 'org_123', project_id: 'proj_456' });

// 1. Create the project if it doesn't exist
await project.create({ description: 'AI Assistant Context' });

// 2. Check the memory footprint
const count = await project.getEpisodicCount();
console.log(`Current memory count: ${count}`);

// 3. Access memory operations
const memory = project.memory();
This class is the recommended gateway for memory management. Always use project.memory() to ensure your operations are correctly scoped to your organization and project ID.