powercontext README

项目的 README,来自 github.com/oceanbase/powercontext。合并为一个 markdown 文件: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.1 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.1"
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.1
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)

正在搜索数据库…

这是做什么用的?PowerContext 是 OceanBase 团队推出的一个可自行部署的上下文服务。它把决策、依据和任务状态与项目保存在一起,这样你或另一个智能体在以后的会话中就能接着继续之前的工作。
那它是需要导入代码里的库,还是我自己运行的服务?它是一个需要你自己运行的 Server,外加客户端集成:应用可以通过异步 Python 客户端、HTTP API、MCP 或进程内的 Core SDK 连接。
怎么安装配置?使用 Git 和 uv 安装 1.1.0 版本(uv 会自动准备 Python 3.11+),在一个专用目录中打开交互式配置向导,然后在自己的终端里启动 Server 并保持运行。
我需要自己准备模型的 API 密钥吗?只有 Full memory 功能需要:自动 Memory 和 Topic Memory 需要单独的 Generation 和 Embedding API 凭据,智能体订阅不包含这些。基础 memory 无需任何额外的模型 API。
现在能在 Windows 上用吗?支持 macOS 和 Linux;Windows 支持尚处于实验阶段。如果 Python 依赖下载缓慢或失败,README 中提供了镜像重试的说明。
Server 能跑在和我的智能体不同的机器上吗?可以。Server 部署在其他机器上时请使用 HTTPS 或远程连接指南;远程明文 HTTP 地址需要明确同意,自动化安装可以通过 --allow-insecure-http 来放行。
上下文数据存在哪里?存在你自己运行的 Server 里:向导会询问存储和访问是本地还是远程,远程连接通过 HTTPS 进行并需要明确同意。
Memory 和 Handoff 有什么区别?Memory 保存持久的信息,比如已确认的决策和依据,可复用的做法还可以保存为 Experience 或 Skill。Handoff 则把当前目标和状态打包在一起,让下一个人或智能体无需重读全部历史就能继续工作。每条内容都限定在其对应的工作范围内,并保留其来源和早期版本。
有没有教程可以学习这套工作流程?有 —— 22 个 Jupyter 教程(中文),外加一套完整的团队工作流程,逐步演示 Memory、上下文准备、Handoff、Experience、Skill 以及真实的智能体操作。前七个教程不需要模型或 API 密钥。
它和 PowerMem 是什么关系?PowerContext 是 PowerMem 的后继版本,新部署应该从这里开始。1.1.0 版本包含引导式的安装配置向导。
安装时安装的 seekdb 依赖是什么?它是 PowerContext 的一个依赖:如果缺少它,安装向导会询问一次,然后在后台自动为你安装。
有哪些类似的项目?EverOS, deer-flow, mem0, OpenViking, Memori, Raven, MemOS, hindsight
作者
oceanbase
大小
188.1 MB
星标
1.7K
时长
1年
提交 · 90 天