# DeepSeek Harness

Connect the DeepSeek Harness (dsh) CLI agent execution loop to XMemo using the native dsh-xmemo npm package.

- Canonical: https://docs.xmemo.dev/docs/connect/deepseek-harness
- Locale: en-US
- Content-Locale: en-US
- Canonical-Content-Digest: b3fb06a84ac45b05b3c8bff9c408d6b126a04ed971a8df04641c0b579a4c19de
- Edition-Digest: fb363a62620915fe5b286f1c8d8812789e4d2c2f31ee962017b523921c3eea04
- Source-Revision: sha256:dec9ab1fbe4dd6a2bdb916f3b710fbe7727d084a06a4c81753e6790881a0afee

## Who this is for and boundary

This guide connects the DeepSeek Harness (dsh) CLI agent execution loop to XMemo persistent memory. Integration operates through the native dsh-xmemo plugin package (version 0.1.0) on npm, anchored to repository yonro/xmemo-deepseek-plugin @ e7101afb0a (https://github.com/yonro/xmemo-deepseek-plugin/blob/e7101afb0a/README.md). Important boundary: This integration is specifically for the dsh agent harness CLI tool; it is NOT an integration into DeepSeek consumer web chat (chat.deepseek.com), which does not support custom plugins or MCP extensions.

## Prerequisites

Ensure the following runtime dependencies and tools are present before connecting:

- DeepSeek Harness (dsh) CLI installed and operational.
- Node.js runtime version 18.0.0 or higher.
- Valid XMemo account at https://xmemo.dev.
- Network access to https://xmemo.dev/mcp over HTTPS.

## Installation

Add the native dsh-xmemo plugin to your DeepSeek Harness profile using the documented command from README lines 90-94:

```bash
dsh plugin --profile <name> add dsh-xmemo
```

## Authorization and credential configuration

Configure credentials using environment variables or harness profile configuration. Do not place plain API keys in public project repositories:

- Environment variable (recommended): Set XMEMO_KEY in the environment before launching dsh (export XMEMO_KEY='<your-xmemo-token>').
- Profile configuration: Specify authentication credentials in the target profile configuration file (~/.dsh/config.json).

## Load and restart behavior

Daemon restart or execution loop reload procedures are not explicitly documented in the dsh-xmemo plugin README (https://github.com/yonro/xmemo-deepseek-plugin/blob/e7101afb0a/README.md); refer to the DeepSeek Harness CLI documentation or launch tasks using your configured profile.

## Connection check (read-only)

Verify connectivity with a read-only recall request before starting agent execution loops:

- Check: Execute a read-only evaluation query through dsh without modifying memory state.
- Success signal: dsh returns structured memory results with valid Reference and Location fields from the authorized workspace.

## First useful task: Synthetic memory lifecycle

Verify memory persistence, stateless session transition, source-attributed recall, and correction:

- 1. Save synthetic fact: Store a harness task convention ("Harness demo build target: ESM with strict typing.") to "projects/demo-dsh/conventions".
- 2. Stateless transition: Terminate the current dsh task and start a fresh execution run using the configured profile.
- 3. Recall with source attribution: Query "harness build target convention". Confirm returned Reference and Location.
- 4. Correct memory: Update the remembered convention using update_memory with updated build targets.
- 5. Optional cleanup: Soft-delete (forget) the demo convention when onboarding verification completes.

## Scope of automatic capture and duplicate prevention

DeepSeek Harness execution loop memory management:

- Loop checkpointing: dsh-xmemo automatically captures task outcomes, architectural decisions, and error resolutions at task completion boundaries.
- Duplicate prevention: Deduplication hashing prevents re-capturing identical execution context across repeated loop iterations.
- Scope isolation: Captured context is strictly bounded to the authenticated workspace and active repository scope.

## Conflicts with existing providers and storage ownership

Runtime boundaries and storage ownership:

- Provider conflicts: Disable default ephemeral local memory in dsh.config.json when using dsh-xmemo to avoid redundant or conflicting context injection.
- Storage ownership: Durable memories are stored in the user-owned XMemo cloud backend; dsh stores only ephemeral execution transcripts and local run logs.
- Offline and replay limits: Transient connectivity losses are buffered locally; extended offline periods fail write operations once the buffer is exhausted, and offline context is not shared across agents until network reconnection.

## Recovery, update, and removal

Troubleshooting, update, and removal procedures for DeepSeek Harness:

- Recovery (401 invalid_token): Verify XMEMO_KEY is exported in the shell environment running dsh.
- Update and removal: Update and plugin removal procedures are not documented in the dsh-xmemo plugin README (https://github.com/yonro/xmemo-deepseek-plugin/blob/e7101afb0a/README.md); refer to DeepSeek Harness CLI documentation for profile management, or revoke credentials and purge stored memories at https://xmemo.dev/me.
- Remote deletion: To purge stored memories or revoke access tokens, manage your workspace at https://xmemo.dev/me.

