powercontext README

The project's README from github.com/oceanbase/powercontext. As one markdown file: README.md.

PowerContext on 24 shared SWE-bench Pro tasks: both arms solved the same 16 tasks. Tokens fell from 26.41M to 17.81M (32.57% fewer), counting 15.77M for solving and 2.04M for memory generation. Solving only: 40.30% fewer tokens. Estimated model cost: 15.42% lower with memory generation. Best task: 63.49% fewer tokens.

The open-source context service for AI agents

Fewer detours. Fewer tokens.
Handoffs · shared memory across agents · company knowledge bases · per-user profiles · Dream · Scope isolation · memory rules per Scope · your existing subscription, all in one service.

What  ·  Why  ·  Use cases  ·  Architecture  ·  Quick start  ·  Ecosystem  ·  News  ·  Docs  ·  Feishu  ·  Discord

English · 中文 · 日本語   /   Python package · Apache 2.0

What is PowerContext

PowerContext helps agents and harnesses manage context. It turns conversations, documents, and work records into knowledge that can be searched, updated, and traced to its sources, and brings it to the agent when needed:

Run it as a service through HTTP, MCP, Python, or Agent integrations, or embed Core in your own application.

Why PowerContext

Fewer tokens

Every model call in an agent loop re-sends the accumulated context. So PowerContext optimizes the round trips and total cost of finishing the whole task: helping the agent find the right code, read the right lines, batch independent work, and run focused tests, with less repeated exploration and fewer unproductive attempts.

This benchmark runs in gateway mode, with code retrieval, working guidance, and project memory enabled together:

CodeGraph: relevant code with freshness checks. Steering: targeted reads, batched work and focused tests. Memory: saved decisions and bounded recall for later sessions.

24-task benchmark: results and methodology → · Main-model request counts → · Memory-extraction cost and quality →

Memory rules for every Scope

In one PowerContext Server, a legal team, a personal sales Scope, and an R&D project customize the extraction, profile, and reconciliation prompts, each with its own revisions; output schema, permissions, evidence boundaries, and sensitive-data safeguards stay fixed by the server

Many memory services configure extraction rules for a whole service or project. PowerContext keeps the prompts for memory extraction, reconciliation, profile generation, and Topic Memory as Scope-level artifacts, so every team, project, or even individual user can have its own memory rules. Every change is kept as a revision you can restore, and Dream can propose revisions from past evidence for your review.

Rules decide only what to keep and how to organize it. The output schema, tools and permissions, evidence boundaries, and sensitive-data safeguards stay fixed by the server, so changing a rule cannot break the system. With access control enabled, changes need Scope admin rights. The Dashboard has no editor yet; applications can expose this to their own users through the API. Manage prompts →

Traceable and governed

Review candidates → · Scopes and access →

Use cases

PowerContext works with coding agents, personal assistants, and office agents, and embeds into applications built by teams and companies.

Coding agents

Pick up where you left off: session 1 leaves verified progress and a next step, and session 2 continues from it One memory for every agent: Codex, Claude Code, and OpenCode share decisions, constraints, and progress in one Scope

Personal assistants and office agents

An assistant that remembers: OpenClaw saves key points into memory before a long conversation is compacted, so a new chat the next day still knows them Office work, learned once: a monthly-report process that worked becomes a skill and is reused next month after review

Team and business applications

Company docs your agent can search: Markdown and images become a knowledge base, and results point to the exact section Your app remembers every user: profiles build up per business user ID and are recalled in LangChain or LangGraph

Domain agents learn from every case: a diagnosis agent reuses experience from similar faults and resumes interrupted tasks Tickets become searchable knowledge: a plugin captures tickets as Sources and generates ticket summaries in a custom format

Handoffs · Scopes and sharing · OpenClaw · Hermes · Experience and skills · Knowledge-base plugin · Profiles · Power-system diagnosis case · Source and Artifact plugins

Architecture

PowerContext architecture: agents and apps connect to PowerContext Server through hooks, MCP, SDKs, or an optional gateway. Within each Scope, the Server processes Sources into Artifacts such as memories, topics, profiles, experiences, skills, and handoffs, then recalls them into context for the next turn. Source and Artifact plugins extend the data sources and artifact types. Processing calls generation and embedding models, and data is stored in SQLite, OceanBase, or seekDB.

Agents connect to the Server through hooks, MCP, or SDKs, or send model requests through the gateway, which injects context and provides working guidance. The Server keeps source evidence (Sources) per Scope, processes it in the background into Artifacts such as memories, Topic Memory, profiles, experiences, and skills, and recalls them into context for the next turn. Source and Artifact plugins add new data sources and artifact types. Architecture and responsibilities →

Quick start

Let your agent install it

Send this to your coding agent, such as Codex, OpenCode or Claude Code. It detects your environment, asks a few questions, then installs PowerContext and checks that memory works. For personal use, Codex and OpenCode connect through the gateway by default; team administrators can use it to deploy as well.

Install PowerContext on this machine by following https://powercontext.oceanbase.io/en/llms.mdx/docs/get-started/agent-install/content.md. Ask me before deciding anything on my behalf, don't guess, and never read or show any of my keys.
Install it yourself

You need Python 3.11+, Git, and uv, plus the CLI of any Agent you want to connect. This setup pins PowerContext 1.6.0 for macOS and Linux; Windows support is experimental. The installation script can also provision Python and uv.

Choose Basic memory in the wizard to try explicit saves and recall without a separate Server model API. Automatic extraction requires Full memory with Generation and Embedding credentials. SQLite is a simple first storage choice.

uv tool install --force "powercontext[cli,server]==1.6.0"
mkdir -p powercontext-config && cd powercontext-config
powercontext config init --language en --output .env
powercontext config validate --env-file .env
powercontext service install --env-file .env
powercontext service status

The service keeps running after you close the terminal. Linux requires an available systemd --user manager. The generated .env and .env.next-steps.md may contain credentials; keep them out of Git.

Load the generated configuration and check the service:

set -a
. ./.env
set +a
powercontext ready
powercontext capabilities

Follow .env.next-steps.md to create and bind your Scope, using the real scope_id returned by the creation request. Use the same Server and Scope in your Agent and Dashboard; changing directories does not create project isolation. After editing .env, reload it and rerun powercontext service install --env-file .env to apply the changes.

For Codex, install the matching integration:

powercontext setup codex --env-file .env --ref powercontext-v1.6.0
powercontext doctor codex

Before sending the first message in a new Codex session, open /hooks and trust the PowerContext hooks when prompted. The UserPromptSubmit hook must be enabled for automatic prompt capture and recall, even when MCP connects. First-session checks and recovery →

Verify the workflow you enabled:

  • Basic memory: explicitly ask the Agent to save a project decision, then start a new session in the same Scope and recall it with a source reference.
  • Full memory: confirm that an input appears as a Source, wait for configured processing to produce Topic Memory, then check that a related update is reflected and can be recalled in a new session.

doctor codex checks installation and connectivity only. Source capture alone does not create memory; automatic processing also depends on configured schedules and model work. The Agent still uses its own model in Basic memory mode. Full setup guide →

This starts the context service. It does not automatically reproduce the benchmark's Gateway, CodeGraph, or Steering configuration; see the evidence report.

Use your existing subscription

Already subscribed to Codex, Claude Code, GitHub Copilot, Grok, Gemini, Qwen Code, or Kimi Code? Use it to generate memories, experiences, and profiles, without a separate generation model API:

Configure background generation with a subscription → · Gateway OAuth subscriptions →

Ecosystem

Codex
Codex
Claude Code
Claude Code
MiniMax Code
MiniMax Code
DeepSeek Harness
DeepSeek Harness
ZCode
ZCode
Kimi Code
Kimi Code
Hermes Agent
Hermes Agent
Pi Coding Agent
Pi Coding Agent
OpenClaw
OpenClaw
OpenCode
OpenCode
WorkBuddy
WorkBuddy
Bub
Bub
Pydantic AI
Pydantic AI
LangChain
LangChain
LangGraph
LangGraph

Codex is officially maintained; other Agent and Python framework integrations are community-maintained. Bub is for evaluation only. See the capability matrix for supported features.

More integrations and capability comparison →

Apps & teams — Python / HTTP / MCP · Memory & Handoff · Deployment & access

News

All releases →

Learn more

Community

Join the PowerContext community on Feishu to share tips, ask questions, and explore context management for AI agents. Scan the QR code below with Feishu to join the group.

QR code to join the PowerContext Feishu community

Discord · Issues · Contributing

PowerContext is the successor to PowerMem. Released under Apache 2.0.

powercontext (oceanbase/powercontext)

Searching Database…

What is this?PowerContext is a self-hosted context service from the OceanBase team. It keeps decisions, evidence, and task state together with the project, so you or another agent can pick the work up in a later session.
So is it a library I import into my code, or a service I run?It's a Server you run plus client integrations: applications connect through an async Python client, HTTP API, MCP, or the in-process Core SDK.
How do I set it up?Install the 1.1.0 release with Git and uv (uv provisions Python 3.11+), open the interactive configuration wizard in a dedicated directory, then start the Server in its own terminal and keep it running.
Do I need my own model API keys?Only Full memory capabilities needs them: automatic Memory and Topic Memory require separate Generation and Embedding API credentials, which an agent subscription does not cover. Basic memory works with no extra model APIs.
Does it work on Windows yet?macOS and Linux are supported; Windows support is experimental. If Python dependency downloads are slow or fail, the README has mirror retry instructions.
Can the Server run on a different machine from my agent?Yes. For a Server on another machine use HTTPS or the remote connection guide; remote plain-HTTP URLs require explicit consent, and automated setup can pass --allow-insecure-http.
Where does the context data live?In the Server you run yourself: the wizard asks whether storage and access are local or remote, and remote connections go over HTTPS with explicit consent.
What is the difference between Memory and Handoff?Memory holds durable information such as confirmed decisions and evidence, and reusable approaches can be saved as Experience or Skill. A Handoff packages the current objective and state so the next person or agent can continue without rereading the full history. Every item stays scoped to its work and keeps its sources and earlier revisions.
Is there a walkthrough for learning the workflow?Yes — 22 Jupyter tutorials (in Chinese) plus a complete team workflow that runs Memory, context preparation, Handoff, Experience, Skill, and a real agent step by step. The first seven tutorials need no model or API key.
How does it relate to PowerMem?PowerContext is the successor to PowerMem, so new setups should start here. The 1.1.0 release includes the guided setup wizard.
What is the seekdb dependency installed during setup?It's a dependency of PowerContext: if it's missing, the setup wizard asks once and installs it in the background for you.
What are similar projects?EverOS, deer-flow, mem0, OpenViking, Memori, Raven, MemOS, hindsight
Creator
oceanbase
Size
188.1 MB
Stars
1.7K
Age
1y
Commits · 90 Days