Download the PHP package mauricioperera/php-agent-memory without Composer

On this page you can find all versions of the php package mauricioperera/php-agent-memory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-agent-memory

PHPAgentMemory

Agentic memory system for AI agents — built on php-vector-store. Zero external dependencies beyond php-vector-store itself.

Inspired by RepoMemory's philosophy: save, search, recall, and consolidate knowledge — but pragmatic PHP instead of Git-like versioning.

Why

AI agents lose context between sessions. PHPAgentMemory gives them persistent, searchable memory with:

Quick Start

As PHP Library

As HTTP API

Architecture

The Dream Cycle

The dream is a 4-phase reflective pass over the agent's memory — like how the brain consolidates memories during sleep.

Usage

What the LLM Does During the Dream

Given these 14 memories:

Result: 14 memories → 7 memories. Same knowledge, less noise.

Programmatic Access to the Report

Or Use the Low-Level Pipeline Directly

Entity Types

Memory

What happened — scoped by agentId + userId.

Field Type Description
content string The memory text
tags string[] Searchable tags (max 50, auto-lowercased)
category enum fact, decision, issue, task, correction
sourceSession ?string Optional session ID that produced this memory

Skill

How to do things — scoped by agentId only (no userId).

Field Type Description
content string The procedure/config/workflow
tags string[] Searchable tags
category enum procedure, configuration, troubleshooting, workflow
status enum active, deprecated, draft

Knowledge

Facts about the world — scoped by agentId only.

Field Type Description
content string The knowledge text
tags string[] Searchable tags
source ?string Where this knowledge came from

Scoping Model

Entities are isolated by scope using php-vector-store collections:

The special agent ID _shared enables cross-agent shared skills and knowledge. The recall engine automatically searches both the agent's own collections and _shared.

Deduplication

Every saveOrUpdate() call:

  1. Flushes pending writes
  2. Runs hybrid search for similar existing entities
  3. If score >= threshold (default 0.85): updates existing entity, merges tags
  4. Otherwise: creates new entity

This prevents memory bloat from repeated saves of similar content.

Configuration

CloudflareLlmProvider (included)

Zero-dependency LLM provider using Cloudflare Workers AI:

Any Workers AI text generation model works. Recommended:

Custom LLM Provider

Neuron AI Integration

PHPAgentMemory integrates with Neuron AI — the PHP agentic framework. Four adapters give any Neuron agent persistent memory:

Option 1: Memory Tools (agent decides when to remember)

The toolkit exposes 4 tools the LLM can call:

Option 2: VectorStore Adapter (for RAG pipelines)

Option 3: Memory Retrieval (replaces default retrieval)

Option 4: PreProcessor (automatic context injection)

Combining Everything

HTTP API Reference

Method Route Body Description
GET /health — Status check (no auth)
GET /stats — Storage statistics
POST /memory/save {agentId, userId, content, tags, category, vector} Save/dedup memory
POST /memory/search {agentId, userId, query, vector, limit?} Search memories
POST /skill/save {agentId, content, tags, category, vector} Save/dedup skill
POST /skill/search {agentId, query, vector, limit?} Search skills (+shared)
POST /knowledge/save {agentId, content, tags, source, vector} Save/dedup knowledge
POST /knowledge/search {agentId, query, vector, limit?} Search knowledge (+shared)
POST /recall {agentId, userId, query, vector, maxItems?, weights?} Multi-collection recall
POST /consolidate {agentId, userId?} AI consolidation (needs LLM)
POST /dream {agentId, userId?} Full dream cycle (needs LLM + embedFn)
GET /entity/{id} — Get any entity by ID
DELETE /entity/{id} — Soft-delete entity

Auth: Authorization: Bearer <token> (timing-safe comparison). /health is public. CORS: Configurable via --cors-origin (default *).

Benchmarks

Tested with AG News dataset and Cloudflare EmbeddingGemma-300m (768d Matryoshka, Int8 quantized).

Search Performance

Vectors Brute 768d Matryoshka 128→768 128d only Speedup Top-1 Accuracy
100 68ms 90ms 15ms 0.7x 100%
500 297ms 152ms 60ms 1.9x 100%
1,000 703ms 230ms 128ms 3.1x 100%
2,000 1,320ms 306ms 262ms 4.3x 100%
5,000 3,333ms 596ms 438ms 5.6x 100%

Dream Performance

Metric Value
Entities before dream 18 (14 memories + 4 skills)
Entities after dream 10
Duplicate clusters found 5
Merged groups 3
Entries removed 11
Duration 20s
LLM model Granite 4.0 H-Micro (Cloudflare Workers AI)

Other Metrics

Metric Value
Save latency 1.0-2.0ms/entity
Flush to disk 60-130ms
Storage per vector 776 bytes (Int8 768d)
Storage at 5K vectors 3.7 MB
Embedding (Cloudflare batch) 23ms/text
Persistence reload 7ms

Embedding Providers

PHPAgentMemory is embedding-agnostic — you pass pre-computed vectors to every save() and search() call. Use any provider:

Cloudflare Workers AI (free)

OpenAI

Ollama (local)

Storage Format

Testing

Project Structure

RepoMemory Comparison

Feature RepoMemory (TS) PHPAgentMemory
Language TypeScript PHP 8.1+
Storage Git-like (SHA-256 objects + commits) php-vector-store (binary + JSON)
Versioning Full commit history + tombstones Soft-delete via metadata
Search TF-IDF + neural embeddings BM25 + vector hybrid (RRF)
Entity types 5 (+ sessions, profiles) 3 (memories, skills, knowledge)
Dream/Consolidation AI pipeline AI pipeline (4-phase dream cycle)
Agent integration MCP server Neuron AI (4 adapters) + HTTP API
Dependencies 0 0 (beyond php-vector-store)

PHPAgentMemory trades RepoMemory's Git-like versioning for simplicity. No commit chains, no tombstones, no audit log — just vectors, metadata, and soft-deletes. The core value (save, search, recall, dream) is preserved.

License

MIT


All versions of php-agent-memory with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
mauricioperera/php-vector-store Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mauricioperera/php-agent-memory contains the following files

Loading the files please wait ...