DeepSeek Harness plugin

GraphFlow

Local-first code knowledge graph for coding agents: 10 MCP tools for layered context compression, DAG planning, incremental AST indexing, a cross-session skill flywheel, diagnostics, and graph artifact import/export.

Jump to install

Source facts

Repository
Roarpeng/GraphFlow
Latest update
Aug 19, 2026
Category
Tools & Capabilities
GitHub stars
0

Install

Start with a prompt that asks an agent to read the source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to read the page and repository first.

Do not install anything yet. Read this DeepSeek Harness plugin and explain what it does, which files, networks, or credentials it can access, and how to install and remove it.

Plugin page: https://deepseekplugins.org/plugins/Roarpeng/GraphFlow
GitHub: https://github.com/Roarpeng/GraphFlow
Plugin: GraphFlow
Author: Roarpeng
Install command: dsh plugin --profile web add github:Roarpeng/GraphFlow

Do not run the install command until I confirm.

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer4 files
README.mdSource · read only

GraphFlow

English | [中文](README.zh.md)

![npm version](https://www.npmjs.com/package/@roarpeng/graphflow)

> The memory & context harness for coding agents. Local-first code knowledge graph · bounded context compression (~98% token savings) · cross-session learning flywheel.

The community is converging on an "agent harness" vocabulary: memory + hooks + skills are the harness primitives that turn a stateless model into a reliable long-running agent. GraphFlow implements all three for coding agents and ships them through a portable MCP surface (Cursor, Claude Code, 15+ agents):

Harness primitiveGraphFlow implementation
Memory12-language AST code graph + Episodic / Skill / Decision nodes — project knowledge and project experience persist across sessions
HooksOutcome auto-capture (on by default) + Claude Code SessionEnd / Stop hooks close the learning loop automatically — no manual outcome reporting required
SkillsA four-class flywheel (proven / correctable / anti-pattern / noise) with canary validation — skills are promoted by evidence, not by assertion

Pure TypeScript/Node. CLI + MCP + VS Code extension. Fully offline, no API key required.

Why a harness, not another RAG

Most "memory" products are either static injection (load CLAUDE.md / rules files in full on every session) or plain RAG (retrieve chunks, no learning). Both fail in long-lived projects:

  • Static injection pays the same token cost every session regardless of the task, and grows until it is truncated or ignored.
  • Plain RAG retrieves text but never accumulates experience — the thousandth task pays the same cost as the first.

GraphFlow is a harness: memory is dynamic and typed. Each request retrieves only what the current decision needs — graph anchors, compressed summaries, similar past episodes, applicable skills — under an explicit token budget (L0–L3 layered compression, ~98% savings measured). What the agent learns (outcomes, lessons, skills) is written back through hooks, so the harness gets better with use.

It is also local-first and portable: everything runs offline with no API key, and the whole surface is exposed over MCP, so the same memory travels across agents instead of being locked into one vendor's format.

Proof, not promises

All headline numbers come from a public, reproducible benchmark suite ([benchmarks/README.md](benchmarks/README.md)) with published methodology ([docs/benchmark-standards.md](docs/benchmark-standards.md)) and machine-readable JSON dumps pinned to commits:

  • ~98% token savings (8-query suite, 262,926 → 2,843 tokens; independently re-counted with gpt-tokenizer)
  • 132-query golden retrieval set in CI (Hit@5 = 100%, MRR = 0.836, NDCG@5 = 0.601); downloadable open dataset: [benchmarks/datasets/retrieval-golden-v1.json](benchmarks/datasets/retrieval-golden-v1.json) — run npm run bench:retrieval
  • Skill A/B: 100% vs 61.5% task success with the flywheel on vs off (26 tasks)
  • Memory ROI: 100% vs 56.5% with episodic memory on vs off (62 tasks, with attribution chains)

Results are commit-anchored so any number above can be checked out and re-run. Third-party reproduction is actively welcomed — see [ROADMAP.md](ROADMAP.md) for the open invitation.

Memory poisoning protection

Shared and synced memory is only useful if it cannot be silently corrupted. Skills merged from external sources (e.g. skill sync imports) are treated as unproven until validated locally: imported skills carry provenance markers, never enter the proven class directly, must pass canary validation on real tasks before promotion, and anti-pattern skills are isolated rather than deleted so they can be audited. Promotion is gated by the four-class lifecycle, not by trust in the source. See [docs/team-memory-security.md](docs/team-memory-security.md).

Quick start

No API key needed (offline AST indexing + graph compression):

# 1. Build the graph offline (AST indexing, no LLM)
npx @roarpeng/graphflow graph index .

# 2. Preview compressed context (anchors + summaries, 90%+ token savings)
npx @roarpeng/graphflow context preview "orchestrator" --json

Connect via MCP (Cursor / Claude Code / …):

{
  "mcpServers": {
    "graphflow": {
      "command": "npx",
      "args": ["-y", "--package=@roarpeng/graphflow", "graphflow-mcp"]
    }
  }
}

The agent calls graphflow_context for compressed context, then graphflow_plan to plan; without a provider API key GraphFlow automatically bridges the ATP thinking protocol to the host agent (agent-delegated mode).

Why GraphFlow

Single-purpose tools each do one thing well; GraphFlow combines graph + compression + planning protocol + learning memory in one place:

CapabilityGraphFlowCodeGraphSerenaRepomix
Code graph12-language AST indexmore matureLSP symbols
Context compressionlayered + graph compression + vector recallpartialpartialwhole-repo dump
Planning protocolATP IR + DAG + agent bridge
Learning memoryEpisodic / Skill / Decision flywheel
Local-first
Open protocol[ATP/IR public spec](docs/atp-ir-spec-v1.md)

> The differentiator is the learning flywheel: graph indexing and token compression are replicable; project-private experience (skills, lessons, decisions) accumulated across sessions is not — it compounds with use. Serena is a complement, not a competitor — see [GraphFlow + Serena: better together](docs/comparison.md#graphflow--serena-better-together联合方案).

Core capabilities (v1.7.15+)

ModuleCapability
Planning protocolATP v1.1 (Intent / Requirement / Six Hats / 5-Why / First Principles / Decision Matrix / Planning / Reflection); simple / complex / insight modes; agent-delegated bridge without an LLM; skill-conditioned DAG (skillRefs / avoidPatterns on plan nodes); [ATP/IR public spec v1.1](docs/atp-ir-spec-v1.md)
Goal alignmentGoal anchor nodes (intent five-tuple as first-class citizen, original requirement auto-injected); low-confidence clarification gate (no plan below 0.6); runtime alignment-check; deviation classification (misread-requirement / scope-creep / tech-drift); goal version chain + diffs
Knowledge graph12-language AST indexing; File / Module / Symbol + Concept / Requirement; cross-layer edges documents / implements / derived_from; Office/PDF → Markdown via optional @firecrawl/anydoc (MIT). CLI/npm: optionalDependency. VSIX: not bundled; on activate the extension auto-downloads the current-OS binary into ~/.graphflow/optional-deps when graphflow.downloadAnydoc is true (default). Disable the setting to skip network; source indexing still works.
Context compressionL1/L2/L3 layered anchors; graph compression (edge weights + PageRank, LRU cache); stem-matching recall (orchestrate ↔ orchestration); vector recall + RRF; RepoMap overview; adaptive budget
Retrieval qualityGolden-set regression gate (132 queries, Hit@5=100%, MRR=0.836, NDCG@5=0.601)
Vector indexIn-process memoization + disk persistence (fingerprint-checked, seconds to restore after MCP restart)
Storage backendsfile / memory / sqlite (FTS5, tokenizer-enhanced searchtext, camelCase searchable) / auto (sqlite-first with fallback) / mcp-http
Learning flywheelEpisodic memory, reflection, skill nodes (score ±1, bounded [-20,20]), nightly training, skill decay/pruning, auto-capture + Claude Code hooks (on by default), SkillOpt-lite bounded guidance edits, four-class lifecycle + canary gate for synced skills, npm run backfill:episodes, contribution reports (skill report / graphflow_diagnose / route diagnose)
Team sharingskill sync: export/import skill packs to a committable .graphflow/skills/team-skills.json; imports are a bidirectional MERGE (per-skill-id union, newer updatedAt wins, ties keep local, local-only skills preserved; --force to overwrite); golden retrieval queries round-trip via .graphflow/team-golden.json; [security model](docs/team-memory-security.md)
Benchmarks[Comprehensive 92.9%](benchmarks/COMPREHENSIVE-RESULTS.md) · [Independent-style 96.2%](benchmarks/INDEPENDENT-RESULTS.md) · [context-readiness eval](benchmarks/SWE-BENCH-RESULTS.md) · [98.2% token savings](benchmarks/RESULTS.md)
Model routingSmart / Economy tiers; multi-provider health probes and fallback (DeepSeek, OpenAI, Anthropic, Bailian, Doubao)
WorkbenchPlan DAG seeds function-topic containers; collapsed outline; click topicId to resume; drift forks a side branch; original Q/A stored via assistantReply
Observabilitygraphflow_diagnose / route diagnose: provider health + graph stats + token savings + flywheel health (auto-capture, episodes, skills by class, session journal) + workbench outline
Agent surfacesCLI --json; MCP stdio (10 tools); auto-install into 15+ agents (incl. Codex Windows NODE/NPX_CLI short-path MCP)
Engineering qualityTypeScript strict; vitest suite; npm run ci includes extension packaging and smoke tests

Positioning

> GraphFlow is not an orchestrating executor — it is the memory & context harness for coding agents. Task execution is delegated to the host coding agent via bridge mode (honest semantics, no faked COMPLETED); GraphFlow's job is to make the agent see clearly and remember.

MCP tools (10)

ToolFunction
graphflow_contextCompressed context package (query → anchors + summaries; topicId / assistantReply to resume a workbench node or fill the pending answer; anchorId → expand)
graphflow_planTask planning (mode='simple' or 'insight'; seeds workbench.topics + workbench.outline; agent-delegated without an LLM)
graphflow_runOrchestration + bridge execution descriptor
graphflow_report_outcomeOutcome backfill (incl. deviation classification), closes the learning flywheel
graphflow_insightATP insight submit / merge (agent bridge protocol)
graphflow_indexIncremental / full indexing
graphflow_skill_insightsSkill insights
graphflow_diagnoseDiagnostics (provider + graph + token savings + flywheel + graph.workbenchOutline)
graphflow_artifactGraph artifact import / export
graphflow_skill_guideGraphFlow skill usage guide

MCP workspace resolution: the workspace is discovered automatically from the MCP client cwd; override with GRAPHFLOW_WORKSPACE_ROOT.

Workbench navigation (v1.9.14)

Everyday chat stays a single thread. Complex work seeds a workbench of function-topic containers from graphflow_plan — one canvas node per plan step, not one node per turn. Click a node and pass topicId to graphflow_context to refine that function or return to the mainline. Drift auto-forks an isolated side branch (co_occurs); the trunk is not overwritten. After answering, call graphflow_context({ assistantReply }) so the original reply is stored. Outline titles are display labels only; next-turn context is Goal + ancestor titles + the node's original Q/A.

Wake the collapsed outline when you need it (still 10 MCP tools):

graphflow workbench tree --json            # CLI
# VS Code / Cursor: GraphFlow: Workbench Tree (Activity Bar, default collapsed) or chat /tree
# MCP: graphflow_diagnose → graph.workbenchOutline
graphflow context preview --topic-id "<topic:...>" "continue from this node"
graphflow context preview --reply "original assistant answer"

CLI quick reference

graphflow graph index .                    # build the graph
graphflow context preview "orchestrator"   # preview compressed context
graphflow plan "refactor planner" --json   # plan (also seeds workbench topics)
graphflow workbench tree --json            # on-demand function DAG + side branches
graphflow run "update readme"              # orchestrate (bridge)
graphflow skill insights                   # skill insights
graphflow skill report                     # flywheel contribution report
graphflow skill sync export                # export team skill pack + golden queries (share via git)
graphflow skill sync import                # import team skill pack (MERGE; --force to overwrite) + golden merge into .graphflow/team-golden.json
graphflow route diagnose                   # routing diagnostics
graphflow learn nightly                    # nightly learning
graphflow doctor                           # install self-check

Configuration

Three-layer merge: global ~/.graphflow.config.json → project graphflow.config.json → project .graphflow/config.json. Copy [graphflow.config.example.json](graphflow.config.example.json) to get started.

Key options:

OptionDescription
graphPolicy.transportfile / memory / sqlite / auto (recommended: sqlite-first, falls back to file) / mcp-http
graphPolicy.maxContextTokensContext budget (default 1500)
graphPolicy.autoIndexOnSaveAuto incremental index on save (default true)
embeddingPolicy.providertransformers (local default) / openai / hash
embeddingPolicy.vectorStorePathVector index persistence path (.hnsw derived automatically)
skillPolicy.enableSkillFlywheelLearning flywheel switch

Team backend pilot

Set graphPolicy.transport to mcp-http to host the graph on a remote Graphify service (shared by the team); requires graphPolicy.mcpEndpoint (http(s) URL, optional mcpApiKey bearer token):

{ "graphPolicy": { "transport": "mcp-http", "mcpEndpoint": "http://graphify.team.internal:8080" } }

A missing/malformed endpoint fails at config validation; connection or runtime request failures degrade transparently to local JSON storage (graphPolicy.graphStorePath, default graphflow-out/graphflow-graph.json) with a logger.warn, consistent with the sqlite→file fallback, never interrupting the agent. The pilot protocol does not yet support full snapshots: readSnapshot returns the local mirror file (possibly stale). For the team-sharing security model, see [docs/team-memory-security.md](docs/team-memory-security.md).

Benchmarks

  • Comprehensive: [COMPREHENSIVE-RESULTS.md](benchmarks/COMPREHENSIVE-RESULTS.md) — P1–P6 six-dimension evaluation, overall 92.9% (indexing 100% / compression 64.9% / planning 100% / learning 100% / bridge 100% / performance 99.7%)
  • Independent-style: [INDEPENDENT-RESULTS.md](benchmarks/INDEPENDENT-RESULTS.md) — CodeGraph-style 5-domain evaluation, Hit@5 96%, token savings 96.6%, overall 96.2%
  • SWE-bench-style: [SWE-BENCH-RESULTS.md](benchmarks/SWE-BENCH-RESULTS.md) — self-built 12-instance context-readiness eval; [SWE-BENCH-REAL-RESULTS.md](benchmarks/SWE-BENCH-REAL-RESULTS.md) — Flask real-project 10-instance file-recall eval (48.3%)
  • Token savings: [RESULTS.md](benchmarks/RESULTS.md) — 8 representative queries, 98.2% savings, re-counted with independent gpt-tokenizer
  • Retrieval quality: [RETRIEVAL-EVAL-RESULTS.md](benchmarks/RETRIEVAL-EVAL-RESULTS.md) — 132 queries, Hit@5=100%, MRR=0.836, NDCG@5=0.601
  • Skill flywheel A/B: [SKILL-AB-RESULTS.md](benchmarks/SKILL-AB-RESULTS.md) — injection rate 100%, recall 100%, overhead 25.6 tok/task

VS Code / Cursor extension

Download graphflow-<version>.vsix from GitHub Releases (or Open VSX: roarpeng.graphflow).

Commands: Settings / Show Graph (graph visualization) / Preview Context / Plan & Brainstorm / Run Task / Skill Insights / Install MCP; chat agent @graphflow (/run /plan /graph /skills /diagnose /learn /history).

Agent Plugins 1.0

Primary install path for hosts that support Agent Plugins. GraphFlow ships as a portable package at the repository root:

plugin.json              # Agent Plugins 1.0 manifest
mcp.json                 # stdio MCP (type required by the spec)
skills/graphflow/SKILL.md

Install in Cursor (local):

mkdir -p ~/.cursor/plugins/local
ln -s /absolute/path/to/GraphFlow ~/.cursor/plugins/local/graphflow
# then Restart Cursor / Developer: Reload Window

Install via Team Marketplace / Git: import this repository; clients discover plugin.json, then load skills/ and mcp.json.

Docs: [Context Engineering contract](docs/context-contract.md) · [Experience memory](docs/experience-memory.md)

Uninstall: Removing the Agent Plugin in Cursor only drops the plugin package. Skills/Rules/MCP written by graphflow install remain and will keep steering the agent — run:

npx @roarpeng/graphflow uninstall

That removes user + workspace MCP entries, skills/graphflow folders, GraphFlow rules/instruction blocks, Claude Code hooks, and the DeepSeek Harness cordis.patch.yml overlay. Also delete any local symlink under ~/.cursor/plugins/local/graphflow if you used one.

DeepSeek Harness 插件(用法与能力)

GraphFlow 是 DeepSeek Harnessdsh-plugin。包内 dsh.bundle + cordis.patch.yml 会把 GraphFlow MCP 挂到内置 @deepseek-ai/dsh-mcp-client。模型看到的工具名是 mcp__graphflow__graphflow_*。中文说明见 [README.zh.md](README.zh.md)。

能力(10 个工具): 压缩上下文、任务规划 DAG、桥接执行描述、结果回填飞轮、ATP insight、增量/全量建图、技能洞察、诊断、图谱产物、技能指南。

装进某个 profile:

dsh plugin --profile web add @roarpeng/graphflow

或在已有 ~/.dsh 时写 home 级 overlay(对所有 profile 生效):

npx @roarpeng/graphflow install

会写入 $DSH_HOME/cordis.patch.yml$DSH_HOME/skills/graphflow/SKILL.md。卸载:npx @roarpeng/graphflow uninstall,或 dsh plugin --profile web remove @roarpeng/graphflow

用法:mcp__graphflow__graphflow_context(传入 rootDir),复杂任务再 graphflow_plan;改完代码后 graphflow_index;若走了 graphflow_run,结束后必须 graphflow_report_outcome。不要在 patch 里写死 GRAPHFLOW_WORKSPACE_ROOT

Agent integrations

Use npx @roarpeng/graphflow install as the fallback when you need Rules, multi-agent wiring, or a host that does not load Agent Plugins:

npx @roarpeng/graphflow doctor     # detect installed agents
npx @roarpeng/graphflow install    # auto-install MCP + Skill + Rules
npx @roarpeng/graphflow uninstall  # remove MCP + Skill + Rules + hooks
npx @roarpeng/graphflow init       # write a minimal project config

Supported: Cursor, VS Code, Trae (incl. CN), Claude Code, Windsurf, Cline, Roo Code, Kilo Code, Gemini CLI, Codex, Antigravity, Opencode, Qoder, Amazon Q, Zed, Continue, DeepSeek Harness (dsh), and more (15+).

PathWhen to use
Agent PluginsPreferred single-host Skill + MCP discovery
graphflow installRules / multi-agent / non-plugin hosts
graphflow uninstallAfter removing a plugin (or anytime) — clears leftover Skill/MCP/Rules

Protocol

[ATP/IR — Agent Thinking Protocol public specification v1.0](docs/atp-ir-spec-v1.md): work-item registry, submit/merge contract, compatibility rules. Third-party tools can implement compatible producers / consumers. Minimal Producer example: [examples/atp-minimal-producer/](examples/atp-minimal-producer/).

Community

GraphFlow is a single-maintainer project (bus factor = 1); community collaboration is the key to reducing single-point risk. Contributions welcome:

  • [Contributing guide](CONTRIBUTING.md): dev environment, code style, test requirements and PR checklist
  • [Roadmap](ROADMAP.md): completed milestones and next steps (P0–P2)
  • Issues: bug reports and feature requests (please use the built-