gistfs
Use GitHub Gists as a persistent key-value filesystem — ideal for AI agent memory.
Install
pip install gistfs
With optional integrations:
pip install gistfs[llamaindex] # LlamaIndex KVStore
pip install gistfs[langgraph] # LangGraph BaseStore
pip install gistfs[all] # everything
Quick start
Creating a new gist
No need to create a gist manually — bootstrap one from code:
from gistfs import GistFS
gfs = GistFS.create(description="my agent memory")
print(gfs.gist_id) # save this for later
# Or with GistMemory:
from gistfs import GistMemory
mem = GistMemory.create(description="my agent memory")
As a filesystem (context manager)
from gistfs import GistFS
with GistFS(gist_id="your_gist_id") as gfs:
gfs.write("config.json", {"model": "gpt-4", "temperature": 0.7})
config = gfs.read("config.json")
print(gfs.list_files())
gfs.delete("config.json")
File-like interface
with GistFS(gist_id="your_gist_id") as gfs:
with gfs.open("notes.txt", "w") as f:
f.write("hello world")
with gfs.open("notes.txt", "r") as f:
content = f.read()
with gfs.open("notes.txt", "a") as f:
f.write("\nappended line")
As AI agent memory
from gistfs import GistMemory
with GistMemory(gist_id="your_gist_id") as mem:
mem.put("conversation_1", {"messages": [{"role": "user", "content": "hi"}]})
history = mem.get("conversation_1")
all_data = mem.get_all()
mem.delete("conversation_1")
LlamaIndex integration
from gistfs.integrations.llamaindex import GistKVStore
store = GistKVStore(gist_id="your_gist_id")
store.put("doc1", {"text": "hello world"}, collection="docstore")
doc = store.get("doc1", collection="docstore")
LangGraph integration
from gistfs.integrations.langgraph import GistStore
store = GistStore(gist_id="your_gist_id")
store.put(("user", "prefs"), "theme", {"value": "dark"})
item = store.get(("user", "prefs"), "theme")
Encryption
Install with encryption support:
pip install gistfs[encryption]
File content is encrypted (Fernet) and base64-encoded before being sent to GitHub, and decrypted transparently on read. Pass an encryption_key to any class:
from gistfs import GistFS, derive_key
from gistfs.integrations.langgraph import GistStore
# Derive a key from a password (store the salt for later reuse)
key, salt = derive_key("mypassword", salt=b"gistfs-demo-salt")
# GistFS — files are encrypted at rest in the gist
with GistFS(gist_id="your_gist_id", encryption_key=key) as gfs:
gfs.write("secrets.json", {"api_key": "sk-123"})
assert gfs.read("secrets.json") == {"api_key": "sk-123"}
# LangGraph store — same key, same transparent encryption
store = GistStore(gist_id="your_gist_id", encryption_key=key)
store.put(("user", "prefs"), "theme", {"value": "dark"})
Authentication
Set the GITHUB_TOKEN environment variable with a GitHub personal access token that has gist scope. Read-only operations on public gists work without a token.
export GITHUB_TOKEN=ghp_your_token_here
Or pass it directly:
gfs = GistFS(gist_id="abc123", token="ghp_...")
Metadata
Release files for gistfs 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gistfs-0.4.0.tar.gz | 979.7 kB | Without provenance | Details for gistfs-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gistfs-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for gistfs-0.4.0-py3-none-any.whl |
Total release size: 993.3 kB
Release files / gistfs-0.4.0.tar.gz
| Download URL | gistfs-0.4.0.tar.gz |
|---|---|
| Size | 979.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c0788eea62e560529460f196491d57af162396604859600809d750dd870bce5
|
|
BLAKE2b-256 checksum How to use checksums |
9fd580c1ef7a3be5f7190c65341cdb1b8f1415fdc2959db0b42d4674c2f00d81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gistfs-0.4.0-py3-none-any.whl
| Download URL | gistfs-0.4.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01d466cb7c4ad28d580832b7f3e85efd1ee4c5290a2617649ec51388f75b0ef5
|
|
BLAKE2b-256 checksum How to use checksums |
d654703b937588cbf87841554bf83f6cf2876b4fae8d5450f7b74818f61bda77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gistfs 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.