Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
integrations/dsh/plugins/powercontext/src/operations.generated.ts text eol=lf
integrations/dsh/plugins/powercontext/lib/*.js text eol=lf
integrations/dsh/plugins/powercontext/lib/*.d.ts text eol=lf
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,10 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

# PowerContext DeepSeek Harness plugin (Node)
integrations/dsh/node_modules/
integrations/dsh/coverage/
integrations/dsh/*.tgz
!integrations/dsh/plugins/powercontext/lib/
!integrations/dsh/plugins/powercontext/lib/**
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ harness-compose-down: ## Stop the selected isolated harness environment and remo
@e2e/bub/run.sh down

.PHONY: contract-test
contract-test: api-generate-check ## Verify generated API code and contract bindings.
@uv run python -m pytest tests/test_api_contract.py
contract-test: api-generate-check js-api-generate-check ## Verify generated API code and contract bindings.
@uv run python -m pytest tests/test_api_contract.py tests/test_js_operations.py

.PHONY: api-generate
api-generate: ## Generate API models and operations from OpenAPI.
Expand All @@ -87,6 +87,18 @@ api-generate: ## Generate API models and operations from OpenAPI.
api-generate-check: ## Verify generated API code is current.
@uv run python scripts/generate_api.py --check

.PHONY: js-api-generate
js-api-generate: ## Generate the DeepSeek Harness operations table from OpenAPI.
@uv run python scripts/generate_js_operations.py

.PHONY: js-api-generate-check
js-api-generate-check: ## Verify generated JS operations are current.
@uv run python scripts/generate_js_operations.py --check

.PHONY: js-test
js-test: ## Run DeepSeek Harness plugin unit tests.
@pnpm --dir integrations/dsh/plugins/powercontext test

.PHONY: build
build: clean-build ## Build wheel file
@echo "🚀 Creating wheel file"
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@
[![License Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![Discord](https://img.shields.io/badge/Discord-community-5865F2?logo=discord&logoColor=white)](https://discord.com/invite/74cF8vbNEs)

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, and a Codex plugin.
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.


## Install for Codex
## Install for Codex or DeepSeek Harness

Prerequisites:

- macOS or Linux;
- [uv](https://docs.astral.sh/uv/getting-started/installation/);
- Codex CLI.
- Codex CLI and/or DeepSeek Harness (`dsh`).

```bash
uv tool install "powercontext[cli,server]==0.0.1"
powercontext --version
```

The version command should print `0.0.1`. Configure the Codex plugin from the matching release tag:
The version command should print `0.0.1`. Configure the matching host plugin from the same release tag:

```bash
powercontext setup codex --source oceanbase/powercontext --ref v0.0.1
powercontext setup dsh --source oceanbase/powercontext --ref v0.0.1
```

Start the local service in a terminal:
Expand All @@ -40,9 +41,10 @@ and Codex integration:
```bash
powercontext doctor
powercontext doctor codex
powercontext doctor dsh
```

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 command does not affect Server health.
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.

Start a new Codex session after setup. Open `/hooks` once and approve the PowerContext hook if Codex asks for trust.

Expand All @@ -53,6 +55,7 @@ See the [Codex quickstart](docs/en/docs/tutorials/codex-quickstart.md) for a fir
| Interface | Use it for |
| --- | --- |
| Codex plugin | Restore relevant project memory and explicitly remember, revise, or retire entries while coding |
| DeepSeek Harness plugin | Restore relevant project memory and explicitly remember, revise, or retire entries in DeepSeek Harness |
| CLI | Install the plugin, run or connect to the Server, inspect content, and diagnose an installation |
| Python client | Call the Server's Source and Memory API from an application |
| Core SDK | Embed PowerContext contracts or supply custom adapters in a Python system |
Expand Down
78 changes: 78 additions & 0 deletions docs/en/docs/how-to/configure-dsh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: Configure DeepSeek Harness
description: Install the PowerContext DeepSeek Harness plugin and control its local behavior.
---

# Configure DeepSeek Harness

## Install or refresh the plugin

Install DeepSeek Harness first and make sure the web profile exists. Then run:

```bash
powercontext setup dsh --source oceanbase/powercontext --ref master
```

The command installs the plugin from `integrations/dsh/plugins/powercontext` and creates the user data directory. The directory must contain a built `lib/index.js`. It is safe to run again: a valid checkout is reused, and a broken checkout for the same ref is replaced. Pass the same `--ref` used to install the PowerContext tool. `--source` accepts a GitHub slug or a `https://github.com/...` URL.

A local checkout works the same way:

```bash
powercontext setup dsh --source .
```

`setup dsh` calls `dsh plugin --profile web add`. Open a new `dsh web` session after setup.

## Understand what the plugin does

The plugin has two paths to the same Server:

- before each model step it asks the Runtime to prepare one final, bounded context value, then independently captures the user's prompt as Source evidence;
- named `pc_*` tools call the public HTTP API to remember, search, revise, retire, and audit Memory.

Memory scope comes from the normalized Git remote when one is available, or from the project path otherwise. Set `POWERCONTEXT_DSH_SCOPE_ID` only when you need an explicit scope that is independent of both.

The plugin calls `POST /v1/context/prepare` once before the model analyzes the prompt. Explicit `remember_memory` calls do not require a model.

## Control prompt capture

Prompt capture is enabled by default. Disable it before starting DeepSeek Harness when the current work must not be recorded:

```bash
export POWERCONTEXT_DSH_CAPTURE_PROMPTS=false
dsh web
```

For testing only, make the plugin wait for captured Source processing:

```bash
export POWERCONTEXT_DSH_FLUSH_ON_CAPTURE=true
```

This adds inference latency to each prompt and is not the normal interactive setting. `timeoutMs`, `requestTimeoutMs`, `maxBytes`, and `flushMaxCalls` are plugin patch settings, not environment variables.

## Connect to an authenticated local Server

```bash
export POWERCONTEXT_SERVER_AUTH_ENABLED=true
export POWERCONTEXT_SERVER_AUTH_TOKEN="$POWERCONTEXT_LOCAL_TOKEN"
powercontext server run
```

Start DeepSeek Harness from an environment that contains the matching complete Authorization header:

```bash
export POWERCONTEXT_DSH_AUTHORIZATION="Bearer $POWERCONTEXT_LOCAL_TOKEN"
dsh web
```

Do not put the token in the patch file or the Server URL. If the Server is unavailable, recall and capture fail open. Plugin load still requires the DeepSeek Harness peer modules.

## Verify the installation

```bash
powercontext doctor
powercontext doctor dsh
```

`doctor` checks the package and Server. `doctor dsh` checks the DeepSeek Harness CLI and that dump-config contains the plugin id `powercontext-dsh`.
9 changes: 6 additions & 3 deletions docs/en/docs/how-to/install-and-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ To install a tested branch or tag, replace `master` after the final `@`. Use the

```bash
powercontext setup codex --source oceanbase/powercontext --ref <ref>
powercontext setup dsh --source oceanbase/powercontext --ref <ref>
```

## Run the local Server
Expand All @@ -43,14 +44,15 @@ With no environment variables, the Server:
```bash
powercontext doctor
powercontext doctor codex
powercontext doctor dsh
powercontext ready
powercontext capabilities
```

`doctor` checks the installed package, Server liveness, and Server readiness without requiring Codex. Server
`doctor` checks the installed package, Server liveness, and Server readiness without requiring an integration. Server
readiness covers the database and each configured inference provider. Runtime or database failures return
`not_ready`; an inference failure returns `degraded` without removing database-backed operations from traffic.
`doctor codex` separately checks the optional Codex CLI and PowerContext plugin. The content commands exercise the
`doctor codex` and `doctor dsh` separately check the optional host CLI and PowerContext plugin. The content commands exercise the
public HTTP SDK path.

## Update or replace an installation
Expand All @@ -60,9 +62,10 @@ To replace the installed tool with a chosen ref:
```bash
uv tool install --force "powercontext[cli,server] @ git+https://github.com/oceanbase/powercontext.git@<ref>"
powercontext setup codex --source oceanbase/powercontext --ref <ref>
powercontext setup dsh --source oceanbase/powercontext --ref <ref>
```

Restart the Server and open a new Codex session after updating. Existing SQLite data remains in the user data
Restart the Server and open a new host session after updating. Existing SQLite data remains in the user data
directory unless `POWERCONTEXT_HOME` or the database URL changes.

## Install a Python role
Expand Down
15 changes: 10 additions & 5 deletions docs/en/docs/how-to/troubleshoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ powercontext doctor

The command checks the package, Server liveness, and Server readiness. It exits with status 1 unless every check is
`ok`; a `degraded` readiness result is usable but is not a complete diagnostic success. Add `--json` for automation;
the top-level result and every check include `ok` and `status`. Check the optional Codex integration separately:
the top-level result and every check include `ok` and `status`. Check optional host integrations separately:

```bash
powercontext doctor codex
powercontext doctor dsh
```

## Installation cannot read the Git URL
Expand All @@ -30,18 +31,19 @@ git ls-remote https://github.com/oceanbase/powercontext.git HEAD
If this fails, configure the credential helper or SSH key used by Git, then rerun `uv tool install`. `uv` uses Git's
credential configuration; PowerContext does not accept or store repository credentials.

## `powercontext` or `codex` is not found
## `powercontext`, `codex`, or `dsh` is not found

Run:

```bash
uv tool dir --bin
command -v powercontext
command -v codex
command -v dsh
```

Add the uv tool bin directory to `PATH` if needed. `powercontext setup codex` reports an error rather than installing a
plugin when Codex CLI is unavailable.
Add the uv tool bin directory to `PATH` if needed. `powercontext setup codex` and `powercontext setup dsh` report an
error rather than installing a plugin when the host CLI is unavailable.

## The plugin is missing or stale

Expand All @@ -56,9 +58,12 @@ Reinstall it from the same ref as the tool:
```bash
powercontext setup codex --source oceanbase/powercontext --ref <ref>
codex plugin list --json
powercontext setup dsh --source oceanbase/powercontext --ref <ref>
dsh --profile web --dump-config
```

Then start a new Codex session. Check `/hooks` if prompt recall and capture do not run.
Then start a new host session. Check `/hooks` in Codex, or confirm dump-config lists `id: powercontext-dsh` for DeepSeek
Harness. The DSH plugin directory must contain `lib/index.js`.

## The Server check fails

Expand Down
5 changes: 3 additions & 2 deletions docs/en/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Install PowerContext, connect Codex, and choose the right integrati
# PowerContext documentation

PowerContext stores project-scoped context for agents. It runs as a local or remote Server and exposes the same
durable Memory through Codex, Python, HTTP, and MCP.
durable Memory through Codex, DeepSeek Harness, Python, HTTP, and MCP.

If you are installing PowerContext for yourself, start with the [Codex quickstart](tutorials/codex-quickstart.md). It
takes you from a Git install to a second Codex session that can restore the first session's work.
Expand All @@ -15,9 +15,10 @@ takes you from a Git install to a second Codex session that can restore the firs

- [Install and run](how-to/install-and-run.md): install from Git, start the Server, and update it.
- [Configure Codex](how-to/configure-codex.md): install the plugin and control project scope and prompt capture.
- [Configure DeepSeek Harness](how-to/configure-dsh.md): install the DSH plugin and control project scope and prompt capture.
- [Troubleshoot](how-to/troubleshoot.md): diagnose credentials, plugin, Server, database, and hook failures.

## Look up details

- [Interfaces](reference/interfaces.md): Codex, CLI, Client SDK, Core SDK, HTTP, and MCP.
- [Interfaces](reference/interfaces.md): Codex, DeepSeek Harness, CLI, Client SDK, Core SDK, HTTP, and MCP.
- [Configuration](reference/configuration.md): defaults and environment variables.
12 changes: 12 additions & 0 deletions docs/en/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,15 @@ only through the environment so it does not appear in command-line arguments.
The outer Codex hook timeout is ten seconds. Recall, capture, and flush fail independently and never block Codex when
the Server is unavailable or rejects authentication. The variable must be present in the environment that starts
Codex; restart Codex after changing it.

## DeepSeek Harness plugin

| Variable | Default | Meaning |
| --- | --- | --- |
| `POWERCONTEXT_DSH_BASE_URL` | `http://127.0.0.1:8000` | Server base URL used by the plugin |
| `POWERCONTEXT_DSH_SCOPE_ID` | derived from Git remote or project path | Override project scope |
| `POWERCONTEXT_DSH_AUTHORIZATION` | unset | Complete `Bearer <token>` header for plugin HTTP requests |
| `POWERCONTEXT_DSH_CAPTURE_PROMPTS` | `true` | Capture user prompts as Source evidence |
| `POWERCONTEXT_DSH_FLUSH_ON_CAPTURE` | `false` | Wait for Source processing after capture |

`timeoutMs`, `requestTimeoutMs`, `maxBytes`, and `flushMaxCalls` are plugin patch settings. Server unavailability fails open for recall and capture; restart `dsh web` after changing these variables.
14 changes: 12 additions & 2 deletions docs/en/docs/reference/interfaces.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Interfaces
description: Choose between the Codex plugin, CLI, Python SDKs, HTTP, and MCP.
description: Choose between the Codex plugin, DeepSeek Harness plugin, CLI, Python SDKs, HTTP, and MCP.
---

# Interfaces
Expand All @@ -10,6 +10,7 @@ All remote interfaces operate on the same Server and persistent Artifact storage
| Interface | Intended use | Install |
| --- | --- | --- |
| Codex plugin | Cross-session recall and explicit Memory maintenance in Codex | `powercontext setup codex` |
| DeepSeek Harness plugin | Cross-session recall and explicit Memory maintenance in DeepSeek Harness | `powercontext setup dsh` |
| CLI | Setup, diagnostics, Server control, capability checks, and human Candidate review | `powercontext[cli,server]` |
| Python Client SDK | Typed async calls to a running Server | `powercontext[client]` |
| Core SDK | In-process Source, Artifact, Trigger, and composition contracts | base package |
Expand All @@ -22,12 +23,20 @@ The project-context skill tells Codex when to search, remember, revise, or retir
relevant entries and captures user input as Source evidence. MCP tools perform explicit operations. The plugin never
starts or embeds the Server.

## DeepSeek Harness plugin

The project-context skill tells DeepSeek Harness when to search, remember, revise, or retire Memory. Before each model
step the plugin recalls relevant entries and captures user input as Source evidence. Named `pc_*` tools perform explicit
HTTP operations. The plugin never starts or embeds the Server.

## CLI

```text
powercontext setup codex
powercontext setup dsh
powercontext doctor
powercontext doctor codex
powercontext doctor dsh
powercontext server run
powercontext ready
powercontext capabilities
Expand Down Expand Up @@ -57,7 +66,8 @@ All content commands call the configured Server. The optional `server` role adds
not create a second content profile inside the CLI.

`powercontext doctor` checks the package and Server without requiring an integration. `powercontext doctor codex`
checks the Codex CLI and PowerContext plugin explicitly.
checks the Codex CLI and PowerContext plugin explicitly. `powercontext doctor dsh` checks the DeepSeek Harness CLI
and that dump-config lists the plugin id `powercontext-dsh`.

Generation and revision commands accept repeatable `--source-ref TYPE/ID` and
`--artifact-ref FAMILY/ID@REVISION` options instead of serialized request files. `--target FAMILY/ID@REVISION`
Expand Down
Loading