Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Memento Laravel Package

scrypster/memento

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Neo4j Dependency: The package leverages Neo4j for graph-based memory storage, which is a strong fit for AI context retention but introduces external dependency complexity (database setup, licensing, and schema management). Laravel’s Eloquent ORM does not natively support Neo4j, requiring a custom integration layer (e.g., via neo4j-php-client).
  • MCP (Model Context Protocol) Integration: MCP is a proprietary protocol for AI tooling. Laravel would need to expose an API endpoint (REST/gRPC) to bridge MCP-compatible clients (e.g., IDE plugins, LLMs) with Memento’s Neo4j backend. This adds cross-language complexity (Go ↔ PHP ↔ AI tool).
  • Event-Driven Workflow: Memento’s design assumes real-time session persistence, which may conflict with Laravel’s traditional request-response cycle. A message queue (e.g., RabbitMQ, Redis Streams) could decouple AI tool interactions from Laravel’s core logic.
  • Monolithic vs. Microservices: Memento’s all-in-one approach (Neo4j + MCP + Ollama) contrasts with Laravel’s application-centric philosophy. A microservice decomposition (e.g., separate Neo4j service, MCP API gateway) may be preferable for scalability.

Integration Feasibility

  • PHP/Neo4j Compatibility: The neo4j-php-client library supports Cypher queries, but Memento’s custom graph schema (entities, relationships, context nodes) would require:
    • Schema migration scripts.
    • Laravel Service Providers to abstract Neo4j operations.
    • Model binding (e.g., MementoEntity, MementoRelationship) to map PHP objects to Neo4j nodes.
  • MCP Protocol Handling: Laravel would need to:
    • Implement an MCP-compatible HTTP/WebSocket server (or proxy requests to a Go service).
    • Parse MCP payloads (JSON/Protobuf) and translate them into Neo4j transactions.
    • Handle authentication/authorization for AI tools (e.g., JWT, API keys).
  • Ollama Integration: Memento uses Ollama for local LLM inference. Laravel could:
    • Delegate inference to Ollama via CLI calls (exec()) or a gRPC client.
    • Cache responses in Redis to reduce Ollama load.
  • Session Persistence: Memento’s "remember everything" feature implies:
    • Database triggers or Laravel events to sync AI sessions with Neo4j.
    • Conflict resolution for concurrent writes (e.g., optimistic locking).

Technical Risk

Risk Area Description Mitigation Strategy
Neo4j Schema Drift Custom graph schema may evolve independently of Laravel models, leading to inconsistencies. Use migrations and schema validation (e.g., GraphQL-like introspection).
Performance Bottlenecks Neo4j queries + Ollama inference could slow Laravel responses. Implement async processing (queues) and caching (Redis for frequent queries).
MCP Protocol Changes MCP is a moving target; breaking changes could require Laravel API updates. Abstract MCP logic behind a facade and use feature flags for backward compatibility.
State Management Laravel’s stateless nature clashes with Memento’s session-aware design. Use Redis for session state and Neo4j for persistence.
Dependency Bloat Adding Neo4j, MCP, and Ollama increases operational overhead. Containerize Memento as a separate microservice (Docker) and communicate via API.

Key Questions

  1. Is Neo4j a Hard Requirement?
    • Could an alternative (e.g., PostgreSQL with pgvector, ArangoDB) reduce complexity?
  2. How Will AI Tools Authenticate?
    • Will Laravel expose an OAuth2/MCP-specific auth layer, or delegate to Memento’s Go service?
  3. What’s the Data Retention Policy?
    • Will Laravel enforce TTL (Time-to-Live) for graph nodes, or rely on Neo4j’s built-in features?
  4. How Will Errors Be Handled?
    • Neo4j/Ollama failures should not crash Laravel. Will dead-letter queues or circuit breakers be used?
  5. Is Real-Time Sync Needed?
    • If AI tools require sub-second persistence, Laravel’s ORM may not suffice—WebSockets or Server-Sent Events (SSE) could be needed.
  6. How Will the Graph Scale?
    • Neo4j’s performance degrades with millions of nodes. Will Laravel implement sharding or graph partitioning?

Integration Approach

Stack Fit

  • Laravel Core: Best suited for:
    • API layer (REST/gRPC endpoints for MCP clients).
    • Business logic (e.g., validating AI tool requests, enforcing policies).
    • Authentication (JWT/OAuth2 for AI tool integration).
  • Neo4j: Handled via:
    • Laravel Service Container (bind neo4j-php-client).
    • Custom Eloquent-like models (e.g., MementoNode, MementoRelationship).
    • Repository pattern to abstract queries (e.g., GraphRepository).
  • Ollama: Integrated via:
    • Artisan commands for model management.
    • HTTP/gRPC client for inference (e.g., ollama-php).
  • MCP Protocol: Implemented as:
    • Laravel middleware to parse MCP payloads.
    • Event listeners to trigger Neo4j updates on AI tool interactions.

Migration Path

  1. Phase 1: Proof of Concept (PoC)
    • Set up local Neo4j instance (Docker) and neo4j-php-client.
    • Implement basic CRUD for Memento entities (e.g., UserContext, DecisionNode).
    • Test with a mock MCP client (Postman/cURL).
  2. Phase 2: API Gateway
    • Expose Laravel routes for MCP (e.g., /api/memento/context).
    • Use Laravel Sanctum/Passport for AI tool authentication.
  3. Phase 3: Ollama Integration
    • Add Ollama CLI calls for inference (e.g., Artisan::call('ollama run mistral')).
    • Cache responses in Redis to avoid repeated calls.
  4. Phase 4: Real-Time Sync
    • Implement Laravel Echo + Pusher for WebSocket-based updates.
    • Use Laravel Queues to offload Neo4j writes.
  5. Phase 5: Scaling
    • Containerize Neo4j and Ollama in Docker/Kubernetes.
    • Add horizontal scaling for Laravel API (e.g., load balancer + multiple workers).

Compatibility

Component Compatibility Notes
Laravel 10+ Fully compatible with PHP 8.1+. Use Laravel 10’s improved dependency injection for Neo4j/Ollama services.
Neo4j 5.x neo4j-php-client supports Neo4j 5.x. Schema indexing may need tuning for performance.
Ollama Requires Docker or native installation. Laravel can call Ollama via process execution or HTTP API (if Ollama exposes one).
MCP v1.2 Laravel must implement MCP’s JSON/Protobuf schema. Use OpenAPI/Swagger to document endpoints.
IDE Plugins If integrating with VS Code/IntelliJ, Laravel’s API must support WebSocket streaming for real-time context updates.

Sequencing

  1. Database First
    • Set up Neo4j and define Memento’s graph schema (nodes: User, Session, Entity; relationships: HAS_CONTEXT, MAKES_DECISION).
  2. API Layer
    • Build MCP-compatible endpoints before integrating AI tools.
  3. Ollama Last
    • Defer Ollama integration until core persistence is stable (to avoid blocking on LLM performance).
  4. Real-Time Features
    • Implement WebSockets only after REST API is validated (to reduce complexity).

Operational Impact

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums