---
title: "Deploy Hermes Agent Memory"
description: "Agent-curated memory and session search on a volume"
category: "AI/ML"
url: https://railway.com/deploy/deploy-hermes-agent-long-term-memory
---

# Deploy Hermes Agent Memory

Agent-curated memory and session search on a volume

**[Deploy Hermes Agent Memory on Railway](https://railway.com/template/deploy-hermes-agent-long-term-memory)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-hermes-agent-long-term-memory/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### hermes-agent

- **Image:** nousresearch/hermes-agent:v0.22.0@sha256:c69536a39e885b8943329bda68cdf44492458b96aa74a212239bde9d2aeb406a
- **Start command:** `sh -c "mkdir -p /opt/data && chown -R 10000:10000 /opt/data && exec /opt/hermes/docker/entrypoint-dispatch.sh hermes gateway run"`
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted Hermes Agent Memory (Open-Source AI Agent with Long-Term Memory) on Railway

This template runs Hermes Agent on Railway with its memory files on a persistent volume. Two small curated files instead of a vector database. Here is how MEMORY.md and USER.md actually behave across sessions.

## About Hosting Hermes Agent Memory open-source software on Railway (self hosted Hermes Agent memory template)

Your memory lives in plain files you can open, grep and back up: memories/MEMORY.md (agent notes, 2,200 characters) and memories/USER.md (your profile, 1,375 characters), plus state.db holding past sessions.

## Why Deploy Hermes Agent Memory, the ChatGPT Memory alternative on Railway (Railway Free Trial)

ChatGPT Memory is convenient, but it's rented: you can't open the file, cap its size, or carry it to another model. Here you own two plain text files on a volume, and the $5 Railway trial is enough to see whether it sticks.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Hermes Agent Memory on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for Hermes Agent Memory self hosting

The real difference is who owns the /opt/data volume where MEMORY.md lives.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Volume, health check and domain wired up; port 8642 needs no firewall rule. | Droplet plus block storage you mount and proxy yourself. |
| AWS | Minute billing, volume and env vars pre-set. | ECS plus EBS, security group and IAM before MEMORY.md. |
| Hetzner | Memory survives redeploys with no snapshot step. | Cheapest compute, but a rebuild without the volume wipes it. |

## Common Use Cases for hosted Hermes Agent Memory

- **Remembering your stack:** tell Hermes once that you run Postgres with Drizzle and prefer pnpm, and later MEMORY.md entries carry it forward. No re-asking which test runner you use.
- **Recalling last week's conversation:** memory is small, so long threads go to session_search, which queries the SQLite FTS5 index in /opt/data/state.db and summarizes what it finds.
- **A shared team assistant:** USER.md holds the profile side, name, role, timezone, communication style, pet peeves, so each person's preferences stay straight without bloating the prompt.
- **Keeping memory lean:** the 2,200 character limit on MEMORY.md arrives fast. When an add fails, ask the agent to consolidate or prune stale entries by hand.
- **Moving memory between instances:** snapshot the /opt/data volume and restore it on a new service. MEMORY.md, USER.md and state.db come along, history intact.

## Dependencies for Hermes Agent Memory Docker hosted on Railway

Memory only survives if the volume does. Detach that volume and every learned preference and past session goes with it.

### Deployment Dependencies for Managed Hermes Agent Memory Service (AI Agent Memory)

You need one model provider key, either OPENROUTER_API_KEY, ANTHROPIC_API_KEY or OPENAI_API_KEY, or a Nous Portal account. API_SERVER_KEY is generated. Keep the volume at /opt/data, and back it up by snapshotting it.

### Implementation Details for Hermes Agent Memory (Using Hermes Agent official docker image)

The service runs nousresearch/hermes-agent:v0.22.0, pinned by sha256, on port 8642 with health at /health. The start command creates /opt/data, gives it to uid 10000, then runs hermes gateway run. Memory limits stay at 2,200 and 1,375 characters by default.

## How does Hermes Agent Memory compare against other ways to give an AI agent long-term memory

Hermes keeps memory in two editable files plus session search. Each alternative below does one half better.

### Hermes Agent vs ChatGPT Memory (ChatGPT Alternative)

- **Where Hermes wins:** memory is plain markdown on your volume, so you can read, diff and back it up.
- **Where Hermes wins:** session_search covers every past chat via SQLite FTS5, past the 2,200 cap.
- **Where ChatGPT wins:** zero setup, no volume or key, and it works in the phone app.
- **Gotcha:** Hermes freezes the snapshot, so a save only lands next session.

### Hermes Agent vs Mem0 (Mem0 Alternative)

- **Where Hermes wins:** no extra service or SDK. Mem0 is a memory API you wire into your own app.
- **Where Hermes wins:** the agent curates itself; "remember I use pnpm" edits MEMORY.md via add.
- **Where Mem0 wins:** scale. It mines facts across millions of users; two bounded files do not.

### Hermes Agent vs Letta (Letta Alternative)

- **Where Hermes wins:** it is already an assistant. Letta is a framework, so you build the agent first.
- **Where Hermes wins:** memory is inspectable at /opt/data/memories/ with no framework layer.
- **Where Letta wins:** memory blocks are first class, with server-side editing and sharing.

### Hermes Agent vs OpenClaw (OpenClaw Alternative)

- **Where Hermes wins:** FTS5 search over every past session is built in.
- **Where Hermes wins:** entries are scanned for injection and exfiltration before they are accepted.
- **Where OpenClaw wins:** its memory is plain markdown in the workspace too, with a broader set of chat channels.

## How to use Hermes Agent Memory (the OSS AI agent)?

1. Start a chat through the OpenAI-compatible API at https://your-domain/v1 with API_SERVER_KEY as the bearer key (any chat client that takes a base URL), or through Telegram if you set TELEGRAM_BOT_TOKEN.
2. Tell it a durable fact: "I run Postgres 16, deploys are Fridays. Remember that." It calls memory add.
3. From a Railway shell, read /opt/data/memories/MEMORY.md.
4. Start a new session; the fact is now in the system prompt. Writes land there next session only.
5. Ask it to search past chats: "Use session_search to find my notes on backups."
6. Near the limit, say "consolidate MEMORY.md, drop stale entries." A full file makes add fail until you prune.

```markdown
# Memory (67% - 1,474/2,200 chars)
- Railway volume /opt/data, Postgres 16
- Fridays: deploys only, no prod after 16:00
```

USER.md holds the profile: name, role, timezone.

## How to self host Hermes Agent Memory on other VPS Services (Hermes Agent self hosting guide)

Same agent, same two memory files, on a box you patch yourself.

### Clone the Repository

The repo holds the docs and the install script; you don't build from it by hand.

```
git clone https://github.com/NousResearch/hermes-agent.git
```

### Install Dependencies

Install git and curl, then run the official install script from the README (curl piped to bash), which sets up the hermes command. Or run the nousresearch/hermes-agent:v0.22.0 image with Docker and a volume.

### Configure Environment Variables

Run `hermes setup` to write ~/.hermes/config.yaml, set one provider key, and keep HERMES_HOME on a persistent path so memories/MEMORY.md, memories/USER.md and state.db outlive the code tree.

```
export HERMES_HOME=/var/lib/hermes
export OPENROUTER_API_KEY=your-key
```

### Start the Hermes Agent Memory Application

Run `hermes gateway` once in the foreground to confirm port 8642 answers, then `hermes gateway start` to install the service.

On Railway the /opt/data volume, pinned image, API key and health check are already wired, so you skip this.

## Official Pricing of Hermes Agent Memory (Hermes Agent pricing)

Hermes Agent itself is MIT licensed and free to self host: there is no license fee, no per-seat charge and no paid tier for the memory files. Your bill is infrastructure plus inference. Memory reads and session search on the volume cost nothing extra.

## Hermes Agent Memory cloud vs self hosted comparison (Pricing, features, costs, and more)

Self hosting keeps the memory files yours. Hosted memory holds your notes in someone else's account; here they sit on a volume you can copy.

### Monthly cost of self hosting Hermes Agent Memory on Railway

Railway runs about $5-10/mo at 512 MB to 1 GB plus whatever you pay your model provider. The $5 trial covers the first stretch. There is no per-memory or per-seat charge, so a long MEMORY.md costs nothing extra.

### System Requirements for Hosting Hermes Agent Memory on a VPS

A VPS with 1 GB RAM and a few GB of disk is enough; the image is the official v0.22.0 build on port 8642 with a health check at /health. You need Docker and a writable /opt/data volume, since memories/ and state.db live there. Back it up by snapshotting the volume.

## Frequently Asked Questions (FAQs)

### How much can Hermes Agent actually remember?

MEMORY.md holds about 2,200 characters of agent notes, USER.md about 1,375 of user profile. That is small, so the agent curates hard and pushes the rest to session search.

### Why does a new memory not show up until the next session?

Both files load as a frozen snapshot at session start. Writes hit disk immediately, but the prompt refreshes next session to keep the prefix cache stable.

### Where is memory stored on this Railway template?

HERMES_HOME is /opt/data on the volume, so the files are /opt/data/memories/MEMORY.md and /opt/data/memories/USER.md. Past sessions live in /opt/data/state.db, SQLite with FTS5.

### How is session_search different from memory?

Memory is small, curated, and always in context. Session search is unlimited but on demand: it queries SQLite and summarizes past conversations when asked.

### Can I edit the memory files by hand?

Yes. Open a Railway shell, edit either file, and the change lands next session like any other write. Keep entries short and factual.

### What happens to memory if I redeploy?

Nothing, as long as the volume stays attached. Both files and state.db survive redeploys, and a volume snapshot moves that memory elsewhere.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/deploy-hermes-agent-long-term-memory
