Skip to main content

Git-native append-only memory store for agents.

Project description

git-as-memory

git-as-memory is a small TypeScript proof of concept for storing agent memory directly in a Git object database.

It follows the same core idea as checkpoint systems that write agent state into Git refs:

  • no branch checkout
  • no working tree changes
  • no mutation of the repository's normal index
  • append-only history through commits
  • versioned storage namespace under a dedicated ref

Default storage ref:

refs/git-as-memory/memory/v1

Default tree layout:

.git-as-memory/schema.json
memories/<type>/<id>/memory.json
memories/<type>/<id>/source.md
memories/<type>/<id>/events.jsonl

Why TypeScript

TypeScript is the best default for this project because it fits the Minion Mind/Electron/Node ecosystem and can be used as both a CLI and an embeddable SDK. The current backend calls canonical git plumbing commands for correctness and speed of iteration. A later backend can use isomorphic-git when browser support or a no-native-git runtime matters.

isomorphic-git is useful reference material for Git internals: object storage, refs, index handling, packfiles, and API layering. For this PoC, the system Git binary keeps the implementation small while preserving real Git semantics.

Install

npm install
npm run build

Local CLI:

node dist/cli.js --help

Or through package bins after linking/installing:

gam --help
git-as-memory --help

Quick Start

Inside any Git repo:

gam init
gam write "User prefers concise technical answers." \
  --type entity \
  --id user-preference-concise \
  --tag preference \
  --source "Learned from a conversation where the user corrected over-explanation."

gam list
gam glob "entity/*"
gam read entity/user-preference-concise
gam show user-preference-concise
gam search concise
gam history user-preference-concise

Equivalent without linking:

node /path/to/git-as-memory/dist/cli.js write "A memory" --repo /path/to/repo

Commands

gam init [--repo .] [--ref refs/git-as-memory/memory/v1]
gam write <content> [--repo .] [--type semantic] [--id id] [--tag tag] [--source text]
gam write --stdin [--source-file context.md] [--events-file events.jsonl]
gam list [--repo .] [--all] [--json]
gam glob [pattern] [--repo .] [--files] [--json]
gam read <id|type/id> [--repo .] [--json]
gam show <id> [--repo .] [--type semantic] [--json]
gam search <query> [--repo .] [--json]
gam history <id> [--repo .] [--type semantic] [--json]
gam delete <id> [--repo .] [--type semantic]
gam purge <id> [--repo .] [--type semantic]

delete writes a tombstone into memory.json so history and provenance remain available. purge removes the current files from the memory ref while Git history still retains old commits.

glob is memory-native. It matches memory keys in the form <type>/<id>, and also matches bare ids:

gam glob "entity/*"
gam glob "user-*"
gam glob "*preference*"

Use --files only when you want the underlying Git tree paths:

gam glob "entity/*" --files

Record Shape

memory.json:

{
  "schema_version": 1,
  "id": "user-preference-concise",
  "type": "entity",
  "content": "User prefers concise technical answers.",
  "tags": ["preference"],
  "metadata": {},
  "created_at": "2026-05-18T13:40:00.000Z",
  "updated_at": "2026-05-18T13:40:00.000Z"
}

source.md is for human/model readable provenance. events.jsonl is for a complete event stream when an agent runtime wants replay or audit support.

Inspect With Git

The memory store is ordinary Git data:

git log --oneline refs/git-as-memory/memory/v1
git ls-tree -r --name-only refs/git-as-memory/memory/v1
git show refs/git-as-memory/memory/v1:memories/entity/user-preference-concise/memory.json

The current working branch and files are not touched.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_as_memory-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_as_memory-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file git_as_memory-0.1.1.tar.gz.

File metadata

  • Download URL: git_as_memory-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for git_as_memory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 71e702ed7ea6f25ac82439c005c3212a92824b717faf923c978b3384aa7ef3c9
MD5 795217c04a44583b8b5b52110dd11049
BLAKE2b-256 a729ddceb32842a8b0e66fe3fca3d2fc3aa2024a6efeb6818a43ec980c1662a8

See more details on using hashes here.

File details

Details for the file git_as_memory-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: git_as_memory-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for git_as_memory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5868ac04e09e5e02856ae8be18ce09d6a6f16dd18b3208fd85145a1ba96e07b6
MD5 79d06f47abf84b92c30f53ba2ed0df45
BLAKE2b-256 4571f30cd4c4530b160b81dcd741ea67ad1df79eafa0dc5d5e5b49846263f29f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page