Skip to content

Commit 6577bf2

Browse files
authored
docs: consolidate Codex onboarding (oceanbase#1251)
1 parent e2130dc commit 6577bf2

15 files changed

Lines changed: 267 additions & 108 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,16 @@
88

99
PowerContext gives agents durable, project-scoped context. A later session can recover a decision, outcome, current state, or next step without relying on chat history. PowerContext includes a local Server, SQLite storage, an async Python client, a Core SDK, a CLI, a Codex plugin, and a DeepSeek Harness plugin.
1010

11+
## Get started
1112

12-
## Install for Codex or DeepSeek Harness
13+
Use [Install and run](docs/en/docs/how-to/install-and-run.md) for prerequisites, installation, Server startup, and
14+
verification. Then choose a host integration:
1315

14-
Prerequisites:
16+
- [Codex quickstart](docs/en/docs/tutorials/codex-quickstart.md) provides a first cross-session Memory workflow.
17+
- [Configure Codex](docs/en/docs/how-to/configure-codex.md) and
18+
[Configure DeepSeek Harness](docs/en/docs/how-to/configure-dsh.md) cover host-specific setup.
1519

16-
- macOS or Linux;
17-
- [uv](https://docs.astral.sh/uv/getting-started/installation/);
18-
- Codex CLI and/or DeepSeek Harness (`dsh`).
19-
20-
```bash
21-
uv tool install "powercontext[cli,server]==0.0.1"
22-
powercontext --version
23-
```
24-
25-
The version command should print `0.0.1`. Configure the matching host plugin from the same release tag:
26-
27-
```bash
28-
powercontext setup codex --source oceanbase/powercontext --ref v0.0.1
29-
powercontext setup dsh --source oceanbase/powercontext --ref v0.0.1
30-
```
31-
32-
Start the local service in a terminal:
33-
34-
```bash
35-
powercontext server run
36-
```
37-
38-
The Server listens on `http://127.0.0.1:8000` by default and stores its SQLite database in the platform-specific user data directory. Keep this process running while using PowerContext. In another terminal, verify the package, Server,
39-
and Codex integration:
40-
41-
```bash
42-
powercontext doctor
43-
powercontext doctor codex
44-
powercontext doctor dsh
45-
```
46-
47-
Runtime or database failures make the Server not ready. A configured inference failure is reported as degraded without removing the Server from traffic; the separate Codex and DeepSeek Harness commands do not affect Server health.
48-
49-
Start a new Codex session after setup. Open `/hooks` once and approve the PowerContext hook if Codex asks for trust.
50-
51-
See the [Codex quickstart](docs/en/docs/tutorials/codex-quickstart.md) for a first cross-session workflow.
20+
For other tasks, start from the [documentation overview](docs/en/docs/index.md).
5221

5322
## Choose an interface
5423

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Understand Memory and Handoff
3+
description: Learn the different purposes and boundaries of durable project Memory and a temporary work Handoff.
4+
---
5+
6+
# Understand Memory and Handoff
7+
8+
PowerContext provides both durable project Memory and a temporary Handoff. Both help later work continue, but they
9+
solve different problems.
10+
11+
## Memory: durable project knowledge
12+
13+
Memory stores information that later work may need and can understand independently, such as a decision, constraint,
14+
current state, or next step. It belongs to a project scope, can be searched, and can be revised or retired. Revision
15+
and retirement preserve history rather than silently overwriting an earlier record.
16+
17+
Codex should write Memory only when the user explicitly asks to save it. The prompt Hook captures prompts as Source
18+
evidence, but capture is not the same as automatically creating Memory. It should not create an extra Memory merely to
19+
duplicate the current prompt.
20+
21+
## Handoff: temporary transfer of work
22+
23+
A Handoff organizes a task's current objective, verified progress, blockers, next action, and evidence into temporary
24+
content for a receiver. It must be explicitly prepared, inspected, and finalized. The receiver gets the complete
25+
Prepared Handoff and checks it against current code and instructions.
26+
27+
Drafts and Prepared Handoffs are not durable project knowledge by default. Commit a Handoff only when the user
28+
explicitly asks to retain a milestone.
29+
30+
## Choose the right one
31+
32+
| Your need | Use |
33+
| --- | --- |
34+
| A later project task needs a decision, constraint, or next step | Memory |
35+
| Transfer the complete current task to another task, session, or model | Handoff |
36+
| Record the current user prompt as processing evidence | Let the prompt Hook capture a Source |
37+
| Retain a verified Handoff milestone for long-term reuse | Commit the Handoff on user request, or save it as Memory |
38+
39+
Never store secrets, access tokens, or other sensitive information in either. For the Handoff procedure, see
40+
[Hand off work in Codex](../how-to/handoff-with-codex.md).

‎docs/en/docs/how-to/configure-codex.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ directory. It is safe to run again. Pass the same `--ref` used to install the Po
1919
Open a new Codex session after setup. Use `/hooks` to inspect and, when prompted, trust the PowerContext
2020
`UserPromptSubmit` hook.
2121

22-
## Understand what the plugin does
22+
## Understand automatic recall, Memory, and Handoff
2323

2424
The plugin has two paths to the same Server:
2525

2626
- a prompt hook asks the Runtime to prepare one final, bounded context value, then independently captures the
2727
user's prompt as Source evidence;
28-
- MCP gives Codex explicit tools to remember, search, revise, retire, and audit Memory.
28+
- MCP gives Codex explicit tools to read and maintain Memory, plus an explicit Handoff workflow.
2929

3030
Memory scope comes from the normalized Git remote when one is available, or from the project path otherwise. A later
3131
Codex session opened in the same project resolves the same scope. Set `POWERCONTEXT_CODEX_SCOPE_ID` only when you need
@@ -34,7 +34,14 @@ an explicit scope that is independent of both.
3434
The Hook calls `POST /v1/context/prepare` once before Codex analyzes the prompt. It requests an 8000-byte total budget,
3535
strictly validates `powercontext.prepared-context.v1`, and injects the returned content unchanged. The Runtime labels
3636
Memory-derived items as untrusted history, preserves exact citations, and owns final selection and rendering. Explicit
37-
search remains available through the Client and MCP; it is not a second automatic recall step.
37+
search remains available through the Client and MCP; it is not a second automatic recall step. Automatically injected
38+
content and Handoffs are historical information. Codex must still check current code, user requests, and system
39+
instructions before acting on them.
40+
41+
Memory stores durable, reusable decisions, constraints, and state. A Handoff temporarily transfers the current task to
42+
another task, session, or model. It must be explicitly prepared, inspected, and delivered, rather than substituted with
43+
a few Memory entries. Read [Memory and Handoff](../explanation/memory-and-handoff.md) for the boundary and
44+
[Hand off work in Codex](handoff-with-codex.md) for the procedure.
3845

3946
## Control prompt capture
4047

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Hand off work in Codex
3+
description: Explicitly transfer the verifiable state of current work to another task, session, or model.
4+
---
5+
6+
# Hand off work in Codex
7+
8+
Use a Handoff to explicitly transfer current work to another Codex task, later session, or model. When you finish, the
9+
receiver gets inspected temporary content that includes the objective, verified progress, blockers, next action, and
10+
evidence.
11+
12+
## Before you start
13+
14+
Complete [Install and run](install-and-run.md), keep the Server running, and start a Codex session with the
15+
PowerContext plugin configured in the current project. Handoff content belongs to the current project scope. The
16+
receiving task should continue in that project or receive the complete Prepared Handoff.
17+
18+
## 1. State the handoff boundary
19+
20+
Tell Codex the boundary of the transfer and what the receiver needs. For example:
21+
22+
> Prepare a PowerContext Handoff for this task. Record the objective, verified progress, current blockers, and next
23+
> action; inspect every statement in the draft for evidence, then give the completed handoff to the next task.
24+
25+
Include the current task's objective, verified progress, blockers, and next action. Do not put secrets, access tokens,
26+
or other sensitive information in the handoff.
27+
28+
## 2. Inspect the handoff draft
29+
30+
Codex captures a concise current-state Source and activates the Handoff. Inspect the generated Draft and correct
31+
missing, stale, or unsupported statements. A repeated boundary can return `ignored`, which means that the Source has
32+
already been used.
33+
34+
## 3. Give it to the receiving task
35+
36+
After the inspection, Codex finalizes the Handoff. Give the resulting Prepared Handoff to the receiving task unchanged.
37+
The receiver treats it as untrusted history, checks it against the current repository, user request, and system
38+
instructions, then continues the work.
39+
40+
## 4. Make it durable only when needed
41+
42+
Handoff Drafts and Prepared Handoffs are temporary carriers and do not automatically become durable project knowledge.
43+
Ask Codex to commit a Handoff only when the user explicitly wants to preserve a milestone. Use Memory for durable,
44+
searchable decisions, constraints, state, or next steps. Read [Memory and Handoff](../explanation/memory-and-handoff.md)
45+
for the distinction.

‎docs/en/docs/how-to/install-and-run.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ powercontext setup codex --source oceanbase/powercontext --ref <ref>
2424
powercontext setup dsh --source oceanbase/powercontext --ref <ref>
2525
```
2626

27+
For host-specific options, see [Configure Codex](configure-codex.md) and
28+
[Configure DeepSeek Harness](configure-dsh.md).
29+
2730
## Run the local Server
2831

2932
```bash
@@ -52,8 +55,9 @@ powercontext capabilities
5255
`doctor` checks the installed package, Server liveness, and Server readiness without requiring an integration. Server
5356
readiness covers the database and each configured inference provider. Runtime or database failures return
5457
`not_ready`; an inference failure returns `degraded` without removing database-backed operations from traffic.
55-
`doctor codex` and `doctor dsh` separately check the optional host CLI and PowerContext plugin. The content commands exercise the
56-
public HTTP SDK path.
58+
`doctor codex` and `doctor dsh` separately check the optional host CLI and PowerContext plugin. `ready` and
59+
`capabilities` show the readiness and enabled capabilities of the running service. For complete status definitions and
60+
recovery steps, see [Troubleshoot](troubleshoot.md).
5761

5862
## Update or replace an installation
5963

‎docs/en/docs/index.md‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ description: Install PowerContext, connect Codex, and choose the right integrati
55

66
# PowerContext documentation
77

8-
PowerContext stores project-scoped context for agents. It runs as a local or remote Server and exposes the same
9-
durable Memory through Codex, Claude Code, DeepSeek Harness, Python, HTTP, and MCP.
8+
PowerContext stores project context that people and agents can use in later tasks. It runs as a local or remote Server
9+
and exposes the same persisted data through Codex, Claude Code, DeepSeek Harness, Python, HTTP, and MCP.
1010

11-
If you are installing PowerContext for yourself, start with the [Codex quickstart](tutorials/codex-quickstart.md). It
12-
takes you from a Git install to a second Codex session that can restore the first session's work.
11+
If this is your first use, start with the [Codex quickstart](tutorials/codex-quickstart.md). When you finish, you can
12+
read and maintain Memory in a later Codex session for the same project.
1313

14-
## Use PowerContext
14+
## Choose your path
1515

16-
- [Install and run](how-to/install-and-run.md): install from Git, start the Server, and update it.
17-
- [Configure Codex](how-to/configure-codex.md): install the plugin and control project scope and prompt capture.
18-
- [Configure Claude Code](how-to/configure-claude-code.md): install the plugin and share project Memory with Codex.
19-
- [Configure DeepSeek Harness](how-to/configure-dsh.md): install the DSH plugin and control project scope and prompt capture.
20-
- [Troubleshoot](how-to/troubleshoot.md): diagnose credentials, plugin, Server, database, and hook failures.
16+
- For an end-to-end first experience, read the [Codex quickstart](tutorials/codex-quickstart.md).
17+
- To install, start, update, or relocate a local service, read [Install and run](how-to/install-and-run.md).
18+
- To control project scope, prompt capture, or local authentication, read [Configure Codex](how-to/configure-codex.md).
19+
- To configure another host, read [Configure Claude Code](how-to/configure-claude-code.md) or
20+
[Configure DeepSeek Harness](how-to/configure-dsh.md).
21+
- To understand the boundary between durable Memory and a temporary Handoff, read
22+
[Memory and Handoff](explanation/memory-and-handoff.md).
23+
- To transfer current work to another task, session, or model, read [Hand off work in Codex](how-to/handoff-with-codex.md).
24+
- For installation, Server, plugin, or Hook failures, read [Troubleshoot](how-to/troubleshoot.md).
2125

2226
## Look up details
2327

‎docs/en/docs/tutorials/codex-quickstart.md‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ description: Install PowerContext and carry project context across Codex session
55

66
# Codex quickstart
77

8-
This tutorial installs PowerContext without requiring you to clone the repository, connects Codex, and proves that
9-
Memory survives across sessions.
8+
This tutorial installs PowerContext without requiring you to clone the repository. When you finish, you will read,
9+
revise, and retire Memory saved from the first Codex session in a second session for the same project.
1010

1111
## Before you start
1212

1313
You need macOS or Linux, `uv`, Codex CLI, and read access to the PowerContext Git URL. Confirm that Git can reach the
1414
repository with the credentials already configured on your machine.
1515

16-
## 1. Install and configure
16+
## 1. Install the tool and plugin
1717

1818
Run these commands from any directory:
1919

@@ -23,7 +23,7 @@ powercontext setup codex --source oceanbase/powercontext --ref master
2323
```
2424

2525
The first command installs an isolated application. The second installs the Codex plugin and prepares PowerContext's
26-
user data directory.
26+
user data directory. For installation, updates, and data locations, see [Install and run](../how-to/install-and-run.md).
2727

2828
## 2. Start the Server
2929

@@ -33,7 +33,8 @@ Keep this process running in its own terminal:
3333
powercontext server run
3434
```
3535

36-
The default service listens at `http://127.0.0.1:8000`. It creates a persistent SQLite database on first start.
36+
The default service listens at `http://127.0.0.1:8000`. It creates a persistent SQLite database on first start. Keep
37+
this terminal running.
3738

3839
Check the whole installation from another terminal:
3940

@@ -42,37 +43,41 @@ powercontext doctor
4243
powercontext doctor codex
4344
```
4445

45-
Every line from both commands should report `ok`. The first command checks the package and Server dependencies; the
46-
second checks the optional Codex integration.
46+
Every line from both commands should report `ok`. The first checks the package and Server; the second checks only the
47+
optional Codex integration. If a result is `degraded` or `failed`, read [Troubleshoot](../how-to/troubleshoot.md).
4748

48-
## 3. Save a handoff
49+
## 3. Save project Memory
4950

5051
Start a new Codex session in a project directory. If Codex asks whether to trust the PowerContext hook, open `/hooks`
5152
and approve it.
5253

5354
Ask Codex:
5455

55-
> Use PowerContext to save three separate handoff entries: the outcome is “the parser accepts TOML”; the current state
56+
> Use PowerContext to save three separate project Memory entries: the outcome is “the parser accepts TOML”; the current state
5657
> is “tests pass on Python 3.11”; the next step is “add malformed-input cases”.
5758
5859
Codex should use the project-context skill and confirm the successful Memory writes. Do not put secrets in Memory.
5960

60-
## 4. Restore and update it
61+
## 4. Read and update it in a later session
6162

6263
End that session and start another one in the same project. Ask:
6364

64-
> Restore the PowerContext handoff for this project. Then revise the next step to “document malformed-input errors”
65+
> List the active PowerContext Memory for this project. Then revise the next step to “document malformed-input errors”
6566
> and retire the old current-state entry.
6667
67-
The second session should recover the three entries before changing them. Revision and retirement preserve history;
68+
The second session should list the three active entries before changing them. Revision and retirement preserve history;
6869
they do not overwrite or delete old versions.
6970

7071
Start a third session and ask:
7172

72-
> List the active PowerContext memory for this project.
73+
> List the active PowerContext Memory for this project.
7374
7475
The revised next step should be active. The retired current state and superseded next step should not appear in the
75-
active list.
76+
active list. This shows that the project scope remains consistent across Codex sessions.
77+
78+
This tutorial verifies durable Memory. Read [Memory and Handoff](../explanation/memory-and-handoff.md) for the
79+
distinction between Memory and a temporary Handoff. To transfer a complete work package to another task, session, or
80+
model, use [Hand off work in Codex](../how-to/handoff-with-codex.md).
7681

7782
## 5. Check graceful degradation
7883

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: 理解 Memory 和 Handoff
3+
description: 了解长期项目 Memory 与临时工作 Handoff 的不同用途和边界。
4+
---
5+
6+
# 理解 Memory 和 Handoff
7+
8+
PowerContext 提供长期项目 Memory 和临时 Handoff。后续任务会用到的内容不同,因此两者的用途也不同。
9+
10+
## Memory:长期项目知识
11+
12+
Memory 保存后续任务仍可能需要的、可独立理解的信息,例如决策、约束、当前状态和下一步。它属于项目 scope,可被检索,
13+
也可以修订或停用;修订和停用保留历史,不会静默覆盖旧记录。
14+
15+
用户明确要求保存时,Codex 才应写入 Memory。Prompt Hook 会采集提示词作为 Source 证据,但采集不等同于自动创建
16+
Memory,也不应为了复制当前提示词而额外写入一条 Memory。
17+
18+
## Handoff:临时工作交接
19+
20+
Handoff 将一个任务当前的目标、已验证进度、阻塞项、下一步和证据组织为可交给接手者的临时内容。它需要显式准备、检查
21+
和完成;接手者应收到完整的 Prepared Handoff,并先核对当前代码和指令。
22+
23+
Draft 和 Prepared Handoff 默认不是长期项目知识。只有用户明确要求保留某个里程碑时,才提交 Handoff。
24+
25+
## 如何选择
26+
27+
| 你的需求 | 使用 |
28+
| --- | --- |
29+
| 后续项目工作仍需了解一项决策、约束或下一步 | Memory |
30+
| 把正在进行的任务完整交给另一个任务、会话或模型 | Handoff |
31+
| 记录用户当前提示词作为处理证据 | 让 Prompt Hook 采集 Source |
32+
| 保存已经验证、需要长期复用的交接里程碑 | 经用户要求提交 Handoff,或保存为 Memory |
33+
34+
无论使用哪一种,都不要存储密钥、访问令牌或其他敏感信息。使用 Handoff 的具体步骤见
35+
[在 Codex 中交接工作](../how-to/handoff-with-codex.md)。

0 commit comments

Comments
 (0)