agentleFS
matrixoriginmatrixorigin/Memoria/skills/deployment/SKILL.md

deployment

Skill624 starsChanged 6 months agoApache-2.0View on GitHub

Deploy Memoria with Docker Compose or Kubernetes. Environment variables, multi-instance setup, security. Use when deploying or configuring Memoria.

  • Reads credentials

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-management, database and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dkprogSkill

    dependency-management

    Apply when wiring dependencies, integrating external services, or designing interfaces between modules. Ensures loose coupling through dependency injection, interface segregation, and proper abstraction boundaries.

    Also in 3 projects that use this

  • mijunriSkill

    database

    数据库脚本与操作规范。脚本放在 db_scripts 目录,遵循查询优化、事务、安全等实践。

    Also in 3 projects that use this

  • BlockSkill

    debugging

    Debugging guidelines and best practices

    Also in 6 projects that use this

  • AnthropicSkill

    documentation

    Write and maintain technical documentation. Trigger with "write docs for", "document this", "create a README", "write a runbook", "onboarding guide", or when the user needs help with any form of technical writing — API docs, architecture docs, or operational runbooks.

    Also in 5 projects that use this

  • pproencaSkill

    refactoring

    Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles. This skill should be used when refactoring existing code, improving code structure, reducing complexity, eliminating code smells, or reviewing code for maintainability. Triggers on tasks involving extract method, rename, decompose conditional, reduce coupling, or improve readability.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use an existing MatrixOne instead of the bundled one:

    line 77
  2. Distinctive:

    All coordination uses the shared MatrixOne database — zero external dependencies.

    line 87
  3. Distinctive:

    All replicas share one MatrixOne

    line 176
  4. Very specific:

    All queries scoped to authenticated user_id

    line 188
  5. Distinctive:

    Run behind reverse proxy with TLS in production

    line 191

“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Docker Compose (Single Instance)

cd Memoria
cp .env.example .env   # Set MEMORIA_MASTER_KEY, MEMORIA_EMBEDDING_API_KEY
docker compose up -d

Services: API on :8100, MatrixOne on :6001. Verify: curl http://localhost:8100/health

Environment Variables

Required

VariableDescription
MEMORIA_MASTER_KEYAdmin API key (min 16 chars)

Database

VariableDefaultDescription
MEMORIA_DB_HOSTmatrixoneMatrixOne host
MEMORIA_DB_PORT6001MatrixOne port
MEMORIA_DB_USERrootDatabase user
MEMORIA_DB_PASSWORD111Database password
MEMORIA_DB_NAMEmemoriaDatabase name

Embedding

VariableDefaultDescription
MEMORIA_EMBEDDING_PROVIDERlocallocal or openai
MEMORIA_EMBEDDING_MODELall-MiniLM-L6-v2Model name
MEMORIA_EMBEDDING_API_KEY—Required if provider is openai (single-backend)
MEMORIA_EMBEDDING_BASE_URL—Custom endpoint, OpenAI-compatible (single-backend)
MEMORIA_EMBEDDING_ENDPOINTS—JSON array for multi-backend round-robin. When set, supersedes BASE_URL/API_KEY. Format: [{"url":"https://api1.example.com/v1","api_key":"sk-1"},{"url":"https://api2.example.com/v1","api_key":"sk-2"}]. All endpoints must serve the same model. Requests rotate round-robin; failed/rate-limited endpoints are skipped automatically.
MEMORIA_EMBEDDING_DIM0 (auto)Embedding dimension

Distributed

VariableDefaultDescription
MEMORIA_INSTANCE_IDRandom UUIDUnique instance ID. Set to Pod name in K8s
MEMORIA_LOCK_TTL_SECS120Distributed lock TTL. Heartbeat renews every TTL/3

Governance

VariableDefaultDescription
MEMORIA_GOVERNANCE_ENABLEDfalseEnable background governance scheduler
MEMORIA_GOVERNANCE_PLUGIN_BINDINGdefaultRepository binding name
MEMORIA_GOVERNANCE_PLUGIN_SUBJECTsystemSubject key for binding resolution
MEMORIA_GOVERNANCE_PLUGIN_DIR—Local plugin dir (dev mode, skips signature)

Security

VariableDefaultDescription
MEMORIA_API_KEY_SECRET—HMAC secret for key hashing. Set independently of MASTER_KEY

LLM (for reflect/extract-entities/episodic)

VariableDescription
LLM_API_KEYOpenAI-compatible API key
LLM_BASE_URLAPI base URL
LLM_MODELModel name

External MatrixOne

Use an existing MatrixOne instead of the bundled one:

MEMORIA_DB_HOST=your-host MEMORIA_DB_PORT=6001 docker compose up -d api

Tables are auto-created on first startup.

Multi-Instance (K8s)

All coordination uses the shared MatrixOne database — zero external dependencies.

How it works:

  • Governance scheduler: Each instance acquires a DB lock before each task. Only one wins; others skip. Heartbeat renews every TTL/3.
  • Async tasks: Stored in mem_async_tasks table, visible cross-instance.
  • Lock expiry: Crashed instance's locks expire after TTL, another takes over.
  • Single-instance: NoopDistributedLock — zero overhead, identical behavior.

K8s Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: memoria-api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: memoria-api
  template:
    metadata:
      labels:
        app: memoria-api
    spec:
      containers:
        - name: memoria
          image: matrixorigin/memoria:latest
          ports:
            - containerPort: 8100
          env:
            - name: MEMORIA_INSTANCE_ID
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MEMORIA_MASTER_KEY
              valueFrom:
                secretKeyRef:
                  name: memoria-secrets
                  key: master-key
            - name: MEMORIA_DB_HOST
              value: "matrixone.default.svc.cluster.local"
            - name: MEMORIA_DB_PORT
              value: "6001"
            - name: MEMORIA_EMBEDDING_PROVIDER
              value: "openai"
            - name: MEMORIA_EMBEDDING_API_KEY
              valueFrom:
                secretKeyRef:
                  name: memoria-secrets
                  key: embedding-api-key
            # Optional: multi-backend round-robin (supersedes API_KEY + MODEL single-backend)
            # - name: MEMORIA_EMBEDDING_ENDPOINTS
            #   value: '[{"url":"https://api1.example.com/v1","api_key":"sk-1"},{"url":"https://api2.example.com/v1","api_key":"sk-2"}]'
            - name: MEMORIA_EMBEDDING_MODEL
              value: "BAAI/bge-m3"
            - name: MEMORIA_EMBEDDING_DIM
              value: "1024"
            - name: MEMORIA_GOVERNANCE_ENABLED
              value: "true"
            - name: MEMORIA_LOCK_TTL_SECS
              value: "120"
          livenessProbe:
            httpGet:
              path: /health
              port: 8100
            initialDelaySeconds: 5
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /health/instance
              port: 8100
            initialDelaySeconds: 5
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: memoria-api
spec:
  selector:
    app: memoria-api
  ports:
    - port: 8100
      targetPort: 8100

Key points:

  • MEMORIA_INSTANCE_ID → fieldRef: metadata.name (Pod name)
  • All replicas share one MatrixOne
  • Leader election is automatic
  • Liveness: /health, Readiness: /health/instance

Data Persistence

MatrixOne data bind-mounted to ./data/matrixone. Survives restarts. Change: MATRIXONE_DATA_DIR=/your/path

Security Notes

  • API keys are HMAC-SHA256 hashed at rest
  • Set MEMORIA_API_KEY_SECRET independently of MASTER_KEY for key rotation
  • All queries scoped to authenticated user_id
  • Snapshot names are regex-validated before SQL
  • Rate limiting per API key (in-memory sliding window)
  • Run behind reverse proxy with TLS in production

Rate Limits

Configurable via env: MEMORIA_RATE_LIMIT_AUTH_KEYS=1000,60 (format: max_requests,window_seconds)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.