Skip to content

Commit 4191641

Browse files
Pandaclaude
andcommitted
feat: initial release of aimemo v0.1.0
Zero-dependency MCP memory server for AI agents. SQLite+FTS5 storage, JSON-RPC 2.0 MCP stdio server, Cobra CLI with 18 commands, append-only journal. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
0 parents  commit 4191641

47 files changed

Lines changed: 4406 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
22+
- uses: goreleaser/goreleaser-action@v6
23+
with:
24+
version: latest
25+
args: release --clean
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
GITHUB_OWNER: MyAgentHubs

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Build output
2+
/aimemo
3+
dist/
4+
5+
# Local test db
6+
.aimemo/
7+
8+
# macOS
9+
.DS_Store
10+
11+
# Go
12+
*.test
13+
*.out

.goreleaser.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: 2
2+
3+
builds:
4+
- id: aimemo
5+
main: ./cmd/aimemo
6+
binary: aimemo
7+
env:
8+
- CGO_ENABLED=0
9+
goos: [linux, darwin, windows]
10+
goarch: [amd64, arm64]
11+
ignore:
12+
- goos: windows
13+
goarch: arm64
14+
ldflags:
15+
- -s -w
16+
- -X main.version={{.Version}}
17+
18+
archives:
19+
- format: tar.gz
20+
format_overrides:
21+
- goos: windows
22+
format: zip
23+
name_template: "aimemo_{{.Version}}_{{.Os}}_{{.Arch}}"
24+
25+
brews:
26+
- name: aimemo
27+
repository:
28+
owner: "{{ .Env.GITHUB_OWNER }}"
29+
name: homebrew-tap
30+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
31+
homepage: "https://github.com/{{ .Env.GITHUB_OWNER }}/aimemo"
32+
description: "Zero-dependency MCP memory server for AI agents"
33+
license: MIT
34+
test: |
35+
system "#{bin}/aimemo --version"
36+
install: |
37+
bin.install "aimemo"
38+
generate_completions_from_executable(bin/"aimemo", "completion")
39+
40+
checksum:
41+
name_template: "checksums.txt"
42+
43+
changelog:
44+
sort: asc
45+
filters:
46+
exclude: ["^docs:", "^test:", "Merge pull request"]

.mcp.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"mcpServers": {
3+
"aimemo-memory": {
4+
"command": "aimemo",
5+
"args": [
6+
"serve"
7+
]
8+
}
9+
}
10+
}

CLAUDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# aimemo Memory Instructions
2+
3+
## Session Start
4+
At the beginning of every session, call `memory_context` to load project context before doing any work.
5+
6+
## During the Session
7+
Call `memory_store` (entities mode) when you:
8+
- Learn something new about the codebase architecture or design decisions
9+
- Fix a bug or identify a root cause
10+
- Make a significant implementation choice
11+
12+
Call `memory_store` (journal mode) when you:
13+
- Complete a meaningful unit of work
14+
- Encounter and resolve a non-obvious problem
15+
16+
## Session End
17+
Before the session ends, write a journal entry summarizing what was done:
18+
```
19+
memory_store({ journal: "..." })
20+
```
21+
22+
## Search Before Asking
23+
Before asking the user to re-explain something, call `memory_search` first.

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributing to aimemo
2+
3+
## Prerequisites
4+
5+
- Go 1.21+
6+
- No CGO required (`modernc.org/sqlite` is pure Go)
7+
8+
## Running Tests
9+
10+
```bash
11+
go test ./...
12+
```
13+
14+
## Building
15+
16+
```bash
17+
go build -o aimemo ./cmd/aimemo
18+
```
19+
20+
## Project Structure
21+
22+
```
23+
cmd/aimemo/ # Binary entry point
24+
internal/
25+
cli/ # Cobra commands
26+
config/ # TOML config loader
27+
db/ # SQLite layer (entities, observations, relations, journal, search)
28+
locate/ # .aimemo directory discovery
29+
mcp/ # MCP stdio server (JSON-RPC 2.0)
30+
examples/ # CLAUDE.md templates for users
31+
```
32+
33+
## Making Changes
34+
35+
1. Fork the repo and create a branch from `main`
36+
2. Make your changes with tests where applicable
37+
3. Run `go test ./...` — all tests must pass
38+
4. Submit a pull request with a clear description of the change
39+
40+
## Reporting Issues
41+
42+
Open a GitHub Issue. For security vulnerabilities, please email the maintainers
43+
directly rather than opening a public issue.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 MyAgentHubs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# aimemo
2+
3+
[![Go 1.22+](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat&logo=go)](https://golang.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat)](LICENSE) [![Release](https://img.shields.io/github/v/release/MyAgentHubs/aimemo?style=flat)](https://github.com/MyAgentHubs/aimemo/releases)
4+
5+
Zero-dependency MCP memory server for AI agents — persistent, searchable, local-first, single binary.
6+
7+
```
8+
$ claude "let's keep working on the payment service"
9+
10+
╭─ memory_context ──────────────────────────────────────────────────╮
11+
│ [project: payment-service] │
12+
│ │
13+
│ Last session (3 days ago): │
14+
│ • Stripe webhook signature verification — DONE │
15+
│ • Idempotency key refactor — IN PROGRESS │
16+
│ • Blocked: race condition in concurrent refund handler │
17+
│ │
18+
│ Related: Redis connection pool, pkg/payments/refund.go │
19+
╰───────────────────────────────────────────────────────────────────╯
20+
21+
Picking up where we left off. The race condition in the refund
22+
handler looks like a missing mutex around the in-flight map.
23+
Let me check pkg/payments/refund.go ...
24+
25+
[... Claude works through the fix ...]
26+
27+
╭─ memory_store (journal) ──────────────────────────────────────────╮
28+
│ Resolved refund race — added sync.Mutex around inFlightRefunds. │
29+
│ Tests passing. Next: load test with k6 at 500 rps. │
30+
╰───────────────────────────────────────────────────────────────────╯
31+
```
32+
33+
## 🧠 Why aimemo
34+
35+
- **No infra to babysit.** Single Go binary. No Docker, no Node.js runtime, no cloud account, no API keys. `brew install` in 30 seconds.
36+
- **Memory stays with the project.** Stored in `.aimemo/` next to your code — commit it to git or add it to `.gitignore`. Switch branches; memory follows the directory.
37+
- **Claude picks up exactly where it left off.** `memory_context` fires automatically on every session start. Claude sees what it was doing, what was blocked, what decisions were made. You stop repeating yourself.
38+
- **Full-text search that ranks correctly.** FTS5 + BM25 scoring weighted by recency and access frequency. Relevant memories surface first; old noise fades naturally.
39+
- **Concurrent sessions, no corruption.** SQLite WAL mode lets multiple Claude windows write simultaneously without locking each other out.
40+
- **You stay in control.** Every tool Claude has, you have from the terminal. Inspect, edit, retract, export. Your memory is readable Markdown or JSON — never locked in a proprietary format.
41+
42+
## ⚡ Quick Start
43+
44+
```bash
45+
# 1. Install
46+
brew install MyAgentHubs/tap/aimemo
47+
48+
# 2. Initialize memory for your project (run from project root)
49+
aimemo init
50+
51+
# 3. Register with Claude Code
52+
claude mcp add-json aimemo '{"type":"stdio","command":"aimemo","args":["serve"]}'
53+
```
54+
55+
Restart Claude Code. On the next session, Claude will automatically load project context.
56+
57+
## 🔧 How It Works
58+
59+
`aimemo serve` runs as a stdio MCP server; Claude Code manages the process lifecycle, so there is nothing to keep alive yourself. When Claude starts a session it calls `memory_context` to load relevant prior context; as it works it calls `memory_store` and `memory_link` to record decisions and relationships. You can call `aimemo search`, `aimemo list`, or `aimemo get` at any time to read or edit the same data from your terminal. Everything lives in a SQLite database inside `.aimemo/`, discovered by walking up from the current directory — the same way Git finds `.git/`.
60+
61+
## 🛠 MCP Tools
62+
63+
| Tool | Description | When Claude calls it |
64+
|------|-------------|----------------------|
65+
| `memory_context` | Returns ranked, recent observations for the current project | Session start — automatic |
66+
| `memory_store` | Saves an observation (fact, decision, journal entry, TODO) | After completing a task or making a decision |
67+
| `memory_search` | Full-text search across all observations, BM25-ranked | When it needs to recall something specific |
68+
| `memory_forget` | Soft-deletes an observation by ID | When instructed to discard something |
69+
| `memory_link` | Creates a named relationship between two observations | When it identifies a dependency or connection |
70+
71+
All tool schemas total under 2,000 tokens. Each call has a hard 5-second timeout — the server never stalls your session. Empty-state queries return in under 5 ms.
72+
73+
## 📋 CLI Reference
74+
75+
### Setup
76+
77+
| Command | Description |
78+
|---------|-------------|
79+
| `aimemo init` | Create `.aimemo/` in the current directory |
80+
| `aimemo serve` | Start the MCP stdio server (called by Claude Code automatically) |
81+
| `aimemo doctor` | Verify DB health, FTS5 support, WAL mode, and MCP registration |
82+
83+
### Memory
84+
85+
| Command | Description |
86+
|---------|-------------|
87+
| `aimemo add <text>` | Store an observation from the terminal |
88+
| `aimemo observe <text>` | Alias for `add` |
89+
| `aimemo retract <id>` | Surgically remove a single observation |
90+
| `aimemo forget <pattern>` | Soft-delete all observations matching a pattern |
91+
| `aimemo search <query>` | Full-text search with ranked results |
92+
| `aimemo get <id>` | Show a single observation by ID |
93+
| `aimemo link <id1> <id2> <label>` | Create a named link between two observations |
94+
| `aimemo append <id> <text>` | Append text to an existing observation |
95+
96+
### Journal
97+
98+
| Command | Description |
99+
|---------|-------------|
100+
| `aimemo journal` | Open an interactive journal entry (respects `$EDITOR`) |
101+
| `aimemo journal <text>` | Record a quick inline journal entry |
102+
103+
### Inspect & Export
104+
105+
| Command | Description |
106+
|---------|-------------|
107+
| `aimemo list` | List recent observations |
108+
| `aimemo tags` | List all tags in use |
109+
| `aimemo stats` | Show DB size, observation count, last-write time |
110+
| `aimemo export --format md` | Export all memory to Markdown |
111+
| `aimemo export --format json` | Export all memory to JSON |
112+
| `aimemo import <file>` | Import from mcp-knowledge-graph JSONL or aimemo JSON |
113+
114+
All commands accept `--context <name>` to target a named context (a separate `.db` file inside `.aimemo/`).
115+
116+
## ⚙️ Configuration
117+
118+
`~/.aimemo/config.toml` — global defaults, all optional:
119+
120+
```toml
121+
[defaults]
122+
context = "main" # default context name
123+
max_results = 20 # observations returned by memory_context
124+
125+
[scoring]
126+
recency_weight = 0.7 # 0–1, weight of recency vs. access frequency
127+
128+
[server]
129+
timeout_ms = 5000 # hard timeout on every MCP call
130+
log_level = "warn" # "debug" | "info" | "warn" | "error"
131+
```
132+
133+
Per-project overrides live in `.aimemo/config.toml` in the project root — same keys, project values win over global values.
134+
135+
## 🔀 Migration from mcp-knowledge-graph
136+
137+
```bash
138+
# Export your existing graph
139+
npx @modelcontextprotocol/inspector export > knowledge-graph.jsonl
140+
141+
# Import into aimemo
142+
aimemo import knowledge-graph.jsonl
143+
```
144+
145+
Entities become observations; relations become links; tags are preserved. Run `aimemo stats` to confirm the import count.
146+
147+
## 🤖 Claude Code Integration
148+
149+
Register the server once per machine:
150+
151+
```bash
152+
claude mcp add-json aimemo '{"type":"stdio","command":"aimemo","args":["serve"]}'
153+
```
154+
155+
Add the following to your project's `CLAUDE.md` so Claude knows memory is available and how to use it:
156+
157+
```markdown
158+
## Memory
159+
160+
This project uses aimemo for persistent memory across sessions.
161+
162+
- Call `memory_context` at the start of every session to load prior context.
163+
- Call `memory_store` with `type: journal` before ending a session to record
164+
what was completed, what is still in progress, and any blockers.
165+
- Use `memory_link` to connect related observations (e.g. a bug to its fix,
166+
a decision to its rationale).
167+
- Do not store secrets, credentials, or PII.
168+
```
169+
170+
## 🤝 Contributing
171+
172+
Bug reports and feature requests go in [GitHub Issues](https://github.com/MyAgentHubs/aimemo/issues). Pull requests are welcome — please open an issue first for anything non-trivial so we can align on direction before you invest time writing code.

0 commit comments

Comments
 (0)