Skip to main content

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

Metadata

Release files for contextos-mem 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contextos-mem 0.1.0
File Size Uploaded Provenance Actions
contextos_mem-0.1.0.tar.gz 9.6 kB With provenance Details for contextos_mem-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for contextos-mem 0.1.0
File Interpreter ABI Platform Actions
contextos_mem-0.1.0-py3-none-any.whl Python 3 none any Details for contextos_mem-0.1.0-py3-none-any.whl

Total release size: 21.0 kB

Release files / contextos_mem-0.1.0.tar.gz

Download URL contextos_mem-0.1.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
94a374fac657c99298a57adb9b42ba79b38f6e09c576bc0c35f1c0b666c52044
BLAKE2b-256 checksum
How to use checksums
2a4163c4da73d9eedfa3d29422ea3fa10f630021d21a7f771966aeb3a9f96c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Release files / contextos_mem-0.1.0-py3-none-any.whl

Download URL contextos_mem-0.1.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80581fbb1a1252e73bd74435b0e4a97fb9c9341bb391bdd36ab87f44839adba9
BLAKE2b-256 checksum
How to use checksums
a0b9a40c1bad6e13c95e007b1a796648272947df0d0dc6275c22b7ae53dba133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

Security for contextos-mem 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for contextos_mem-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page