Cross-app personal memory for AI tools. Your Claude, GPT, and custom agents share one memory layer.
Project description
contextos
Your AI tools have different brains. ContextOS gives them one.
Claude remembers Claude. ChatGPT remembers ChatGPT. Your custom agent remembers nothing. ContextOS is the shared memory layer that runs on your machine — any LLM reads from it, any LLM writes to it.
Install
pip install "contextos[cli]"
One-time setup
contextos init
This starts the server, creates an API key, and saves config to ~/.contextos/config.json. Takes 30 seconds.
Add 2 lines to your existing app
import contextos
import anthropic
contextos.init() # reads config saved by `contextos init`
contextos.set_user("alice") # set before each LLM call
# Your existing code — UNCHANGED
response = anthropic.Anthropic().messages.create(
model="claude-opus-4-6",
system="You are helpful.",
messages=[{"role": "user", "content": message}]
)
# ContextOS automatically:
# → injects Alice's memory into the system prompt
# → captures the conversation in the background
Works with OpenAI too — zero changes to your openai.OpenAI().chat.completions.create(...) calls.
Manual API (full control)
# In your Claude app
claude_client = ContextOS(api_key="sk-...")
claude_client.write(user_id="alice", conversation="...", source_client="claude-app")
# In your GPT app — reads memory written by the Claude app
gpt_client = ContextOS(api_key="sk-...")
memory = gpt_client.query(user_id="alice", q="what does alice prefer?")
# → Alice never re-introduced herself. Your GPT app already knows her.
Same user_id. Same server. One brain.
Create an API key
contextos keys create --app-name myapp \
--database-url postgresql://contextos:contextos@localhost:5433/contextos
API
client.write(user_id, conversation, source_client=None) # → session_id
client.query(user_id, q, top_k=10, scope="global") # → MemoryResponse
client.delete(fragment_id)
# Async versions
await client.awrite(...)
await client.aquery(...)
await client.adelete(...)
MemoryResponse.prompt_block is a pre-formatted string you paste directly into your system prompt. No processing needed.
CLI
contextos start # start server
contextos stop # stop server
contextos logs -f # follow logs
contextos health # check status
contextos keys create # create API key
contextos keys list # list apps
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextos_mem-0.1.0.tar.gz.
File metadata
- Download URL: contextos_mem-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94a374fac657c99298a57adb9b42ba79b38f6e09c576bc0c35f1c0b666c52044
|
|
| MD5 |
84e6e85d3d6327df3abb09e244ed01c9
|
|
| BLAKE2b-256 |
2a4163c4da73d9eedfa3d29422ea3fa10f630021d21a7f771966aeb3a9f96c17
|
Provenance
The following attestation bundles were made for contextos_mem-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on bythebug/context-os
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextos_mem-0.1.0.tar.gz -
Subject digest:
94a374fac657c99298a57adb9b42ba79b38f6e09c576bc0c35f1c0b666c52044 - Sigstore transparency entry: 1393875583
- Sigstore integration time:
-
Permalink:
bythebug/context-os@e9f39244ed4ff2a865a5db10a704761d4c394f94 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bythebug
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e9f39244ed4ff2a865a5db10a704761d4c394f94 -
Trigger Event:
push
-
Statement type:
File details
Details for the file contextos_mem-0.1.0-py3-none-any.whl.
File metadata
- Download URL: contextos_mem-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80581fbb1a1252e73bd74435b0e4a97fb9c9341bb391bdd36ab87f44839adba9
|
|
| MD5 |
f40d000146265397adefd5819530feb9
|
|
| BLAKE2b-256 |
a0b9a40c1bad6e13c95e007b1a796648272947df0d0dc6275c22b7ae53dba133
|
Provenance
The following attestation bundles were made for contextos_mem-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on bythebug/context-os
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextos_mem-0.1.0-py3-none-any.whl -
Subject digest:
80581fbb1a1252e73bd74435b0e4a97fb9c9341bb391bdd36ab87f44839adba9 - Sigstore transparency entry: 1393875697
- Sigstore integration time:
-
Permalink:
bythebug/context-os@e9f39244ed4ff2a865a5db10a704761d4c394f94 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bythebug
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e9f39244ed4ff2a865a5db10a704761d4c394f94 -
Trigger Event:
push
-
Statement type: