rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:wct-lab/dsh-docchain
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
A DSH knowledge base and document conversion plugin bundling filename/content/metadata search, topic listing, bulk document upload, document-to-Markdown conversion, a multi-subagent deep-research workflow, and a knowledge-graph (Neo4j) layer — ontology inspection, read-only Cypher, and node/relation writes all go through the DocChain API (no Neo4j password needed): install once with plugin_manager install_bundle and it works on any machine — no manual copying into ~/.agents/skills required. Built on docchain.
Its configuration page goes beyond a single endpoint: it keeps a list of saved environments — each with its own address and its own credential — switches between them in one click, and pre-selects topics per environment, so a later request can say "search this topic" without naming an id.
Apart from deep-research-advanced (a pure instruction workflow with no script), every capability is also exposed as a native tool, executed in-process by the host instead of by shelling out to a script:
| Tool | What it does |
|---|---|
docchain_doc_search |
Locate documents by doc_id / document-name keyword, list details, optionally read content (paged, resumable) |
docchain_content_search |
Search document content by keyword; returns matching line numbers and content |
docchain_filename_search |
Find documents whose filename matches keywords, within the given topics |
docchain_topic_info |
List topics with pagination and a name-or-id keyword filter |
docchain_meta_search |
Filter documents by custom metadata fields (string/number/time, AND / OR groups) |
docchain_upload |
Upload a file, or a folder's top-level files, to a topic |
docchain_image_search |
Image-to-image search with a local picture |
docchain_image_describe |
Turn a document's images into text: describe each image and save a sidecar description markdown |
doc2markdown |
Convert docx/doc/pdf/pptx/xlsx/images and more to Markdown |
docchain_kg_schema |
Inspect a topic's ontology (entity types with attributes + relationship types), via the DocChain API |
docchain_kg_cypher |
Run a read-only Cypher query on a topic's graph, via the DocChain API |
docchain_kg_upsert_node |
Create or edit an ontology/entity node, via the DocChain API |
docchain_kg_upsert_relation |
Create an ontology or entity relationship, via the DocChain API |
docchain_kg_delete_node |
Delete a node (and its relationships), via the DocChain API |
docchain_kg_delete_relation |
Delete a relationship, via the DocChain API |
| Skill | Kind | Description |
|---|---|---|
docchain-filename-search |
SKILL.md + Node.js script | Find documents whose filename matches keywords, within the given topics (tool: docchain_filename_search) |
docchain-doc-search |
SKILL.md + Node.js script | Locate documents by doc_id or document-name keyword, show their details, and optionally read a document's content (paged, resumable; tool: docchain_doc_search) |
docchain-content-search |
SKILL.md + Node.js script | Search document content by keyword; returns line numbers and content; or/and operators (tool: docchain_content_search) |
docchain-meta-search |
SKILL.md + Node.js script | Query documents by custom metadata fields (string/number/time, exact and range; tool: docchain_meta_search) |
docchain-topic-info |
SKILL.md + Node.js script | List docchain topics with pagination and a name-or-id keyword filter (tool: docchain_topic_info) |
docchain-upload |
SKILL.md + Node.js script | Upload a local file or a whole folder to a given docchain topic in bulk (tool: docchain_upload) |
doc2markdown |
SKILL.md + Node.js script | Convert docx/doc/pdf/pptx/xlsx/images and many more formats to Markdown via the docchain parsing service (tool: doc2markdown) |
docchain-image-search |
SKILL.md + Node.js script | Find similar images by example (tool: docchain_image_search) |
docchain-image-describe |
SKILL.md + Node.js script | Turn a document's images into text: describe each image (flowcharts come out as a plantuml sketch) and save a sidecar description markdown, leaving the main md untouched (tool: docchain_image_describe) |
deep-research-advanced |
SKILL.md only | Orchestrator-style multi-subagent deep research workflow (pure instructions, no scripts, no tool) |
docchain-kg |
SKILL.md only | DocChain knowledge graph: ontology/Cypher/writes all via the DocChain API (tools: docchain_kg_*) |
The same package installs into either profile — pick the one that matches how you run DSH:
| How you run DSH | Command |
|---|---|
| Desktop app | dsh plugin --profile desktop add github:wct-lab/dsh-docchain |
dsh web |
dsh plugin --profile web add github:wct-lab/dsh-docchain |
Restart DSH afterwards so the host and client halves reload. Or, from a local checkout:
plugin_manager install_bundle target=<absolute path to this directory>
No credentials ship in this package. Every script except doc2markdown (Node.js) needs a docchain service endpoint and an API key before it can run; doc2markdown (Node.js) works with neither — it falls back to the built-in default endpoint and uploads anonymously, while the same config chain can point it at a custom endpoint/key.
| Field | Meaning | Required |
|---|---|---|
docchain_url |
docchain service address, e.g. http://<host>:7100/llmdoc |
Yes |
docchain_api_key |
API authentication key | Yes |
Four ways to provide them, in priority order (higher wins):
DOCCHAIN_URL and DOCCHAIN_API_KEY;<skill>/scripts/config.json;~/.dsh/storages/docchain-config.json (written by the plugin config — see below);skills/docchain_config.json (file-drop distribution fallback; the package ships only docchain_config.example.json as a template).Environment variables outrank everything below them, including the environment selected on the plugin's configuration page — see Switching between environments.
Config file format (all JSON-based):
{
"docchain_url": "http://<host>:7100/llmdoc",
"docchain_api_key": "your-api-key-here"
}
All scripts need only Node.js. Invoke them from the skill's base directory as node scripts/<script>.js … (see each SKILL.md for parameters).
The plugin ships a configuration page in the web client: in dsh web, open Plugins in the sidebar, find the dsh-docchain plugin, and use the configure control on its row. The page manages a list of environments; an address and a key are properties of an environment, so they are entered and edited inside its row — there are no separate top-level fields. The key itself goes to the credential store and is write-only: the page never echoes a stored value, only whether one is set.
The plugin follows the official credential pattern. Its Config schema declares:
| Field | Meaning |
|---|---|
docchain_url |
Service endpoint used when no environment is active; volatile, kept in sync with the active environment by the page |
docchain_api_key_ref |
Credential reference name for the key; default DOCCHAIN_API_KEY |
docchain_api_key |
Fallback literal key (not recommended; the store wins over it) |
docchain_environments |
Saved environments (JSON): per entry a name, URL, credential reference and its pre-selected topics; the active entry outranks docchain_url |
neo4j_uri |
Neo4j Bolt endpoint, e.g. neo4j://<host>:17687; kept for future direct graph tools (currently unused) |
neo4j_user |
Neo4j username, default neo4j |
neo4j_password |
Neo4j password; kept for future direct graph tools (all graph tools currently use the API) |
neo4j_database |
Neo4j database name, default neo4j |
The key's value lives in the credential store ~/.dsh/.credentials.yaml (refs: section, owner-only permissions) — save it through the configuration page or edit the file directly; changes hot-reload. It can also come from the launch environment under the same variable name. On activation, whenever a stored credential changes, and whenever this row's settings are saved, the resolved values are mirrored into ~/.dsh/storages/docchain-config.json (permissions 0600): the file is a pure projection of the current resolution, so a cleared config entry disappears from it; the scripts read it on every run.
Key resolution order: credential store (launch env > stored file) > docchain_api_key row literal.
The reference name is configuration: leaving docchain_api_key_ref unconfigured is a supported state, not a broken one. The page reports no key and the scripts exit with a configuration error instead of falling back to another reference — a present-but-wrong key queries the wrong account silently, which is far harder to notice than a failure.
To change values, either:
DOCCHAIN_API_KEY in the credential store — takes effect without touching this plugin, or~/.dsh/storages/docchain-config.json directly (takes effect on the next script run; the plugin rewrites it from the resolved config on activation and config changes — for durable overrides use env vars or a per-skill config.json), ordocchain_url / docchain_api_key_ref / docchain_api_key in the plugin's config row (patch config / preset override) and re-activate the plugin.The configuration page keeps a list of saved environments, so pointing the skills at another docchain service no longer means retyping a URL and a key.
docchain_url / docchain_api_key_ref values remain the fallback (editable in the profile's cordis.patch.yml).Where the data lives:
| What | Where |
|---|---|
| The environment list (name, URL, credential reference, selected topics) | config.docchain_environments in the profile's cordis.patch.yml |
| Each environment's key | refs: in ~/.dsh/.credentials.yaml, under DOCCHAIN_API_KEY__<ID> |
The values in force — URL, key, and the active environment's topics as docchain_topic_ids / docchain_topic_names |
~/.dsh/storages/docchain-config.json, rewritten on every switch |
Two limits worth knowing:
DOCCHAIN_URL / DOCCHAIN_API_KEY before the projection file, so a value exported at launch silently outranks whatever the page selects. Do not set them if you want the page to be authoritative.Each environment can also pre-select up to 10 topics, so a later request can say "search this topic" without naming an ID.
topic_id and the name.GET /plugin/dsh-docchain/topics and the host queries the service on its behalf.topics inside its entry), so switching environments switches the topic set with it.topic_ids into the agent's prompt. The agent then uses them when the user says "the current topic" or omits topic_ids; with nothing selected nothing is injected./login?redirect=… address makes the list fail. Such an environment is marked with ⚠ in the list.Two limits: a topic deleted on the server stays in the selection (it is a name snapshot, and using it later will fail), and the route is reachable by any local process that can open the port — it reads the active environment's topic names and never returns a credential.
The bundle inserts one Host plugin (dsh-docchain). At activation it registers a skill provider on ctx.skills that serves every <skills>/<name>/SKILL.md directory in this package:
name, description); bodies are re-read on every load..dsh/skills = 100, project .agents/skills = 200), runtime registrations (250) and customSkillDirs (300) keep precedence, as does ~/.dsh/skills (400); the bundle outranks ~/.agents/skills (500) and the bundled root (600). In practice: same-name copies in ~/.agents/skills are shadowed by this bundle; delete them there if you want a single source.GET /plugin/dsh-docchain/topics on the web server (the browser never holds the API key, so the host queries the active environment on its behalf), and a prompt section that describes the active environment and its selected topics. A profile without those services still gets the skill provider and the projection file.Every script-backed capability is registered as a DSH tool, so the model calls it directly and the host executes it in-process — no shell step.
| Tool | Key arguments |
|---|---|
docchain_doc_search |
doc_ids or keyword (exactly one); content: true reads content (single id only); offset / max_lines page through it |
docchain_content_search |
keywords required; at least one of doc_ids / topic_ids; operator is or or and |
docchain_filename_search |
keywords and topic_ids both required (filename search inside those topics only) |
docchain_topic_info |
page / size / keyword, all optional |
docchain_meta_search |
conditions as [{field, op, value}] (AND), or_groups (OR inside, AND across); list_fields: true lists fields |
docchain_upload |
path + topic_id required; mode is file or folder (top level only) |
docchain_image_search |
image required; omitted topic_ids falls back to the page's selected topics; all scans everything |
docchain_image_describe |
doc_ids processes directly; keyword alone returns candidates only; read returns an already-generated description md; list_models lists usable vision models; batches of >1 need confirm |
doc2markdown |
file_path required; action is convert or check; md_only exports a single md |
docchain_kg_schema |
topic_id required; ontology_type is ontology or dg_ontology |
docchain_kg_cypher |
topic_id + cypher required; read-only (MATCH/CALL/SHOW…RETURN), auto-LIMIT when absent |
docchain_kg_upsert_node |
topic_id + node_type (ontology/entity) required; ontology needs entity_name, entity needs ontology_id_list; doc_ids links documents |
docchain_kg_upsert_relation |
topic_id + relation_type + source + target required; entity relations also need ontology_id |
docchain_kg_delete_node |
topic_id + entity_id required (removes its relationships too) |
docchain_kg_delete_relation |
topic_id + relation_id required |
Tools and scripts share one implementation: the host requires the script modules and calls their exported compute functions, so a tool result cannot drift from a node scripts/... run. Registration goes through ctx.inject(["tools"]), so a host without the tool registry keeps the skills, the projection file and the configuration page — it just has no tools.
Failures return { ok: false, error, message } with the same error values as the scripts: CONFIG / NO_RESULTS / NOT_FOUND / NO_PERMISSION / SERVER_ERROR. doc2markdown adds PENDING for "still converting, call check later". Arguments are arrays or objects (doc_ids: [1, 2]), never comma-joined strings.
docchain_upload, docchain_image_describe and the convert action of doc2markdown are marked non-concurrency-safe (one writes to the knowledge base, one is a long job, the other is a long pipeline); the search tools may run in parallel.
Locate documents by filename keywords within the specified topics.
How to use it — describe the filename keywords you are looking for. You must specify the topic ID(s); this skill searches only inside those topics.
Division of labour with
docchain-doc-search: to search filenames across all topics, or to locate by doc_id or read a document's content, usedocchain-doc-search. This skill is "scoped to topics + filename only".
Examples:
Find out "which document is this" by doc_id or by a document-name keyword, and list its details (name, topic, pages, size, state). When needed, read a document's content in pages (resume with next_offset). Use it for "what document is id X", "which documents have a name containing XX", or "read me the content of a document".
How to use it — give one or more document IDs, or a document-name keyword (--keyword searches filenames across all topics); to read content, pass a single document ID with --content.
Unlike
docchain-filename-search, this searches filenames across all topics and can resolve by doc_id or read content; to look up a filename only within a specific topic, usedocchain-filename-search. Unlikedocchain-content-search, this locates the document itself by id / name rather than grepping keywords inside its content.
Examples:
Search keywords inside document content; returns the matching line numbers and content. Supports or and and operators.
How to use it — specify the search scope and keywords. You must provide at least one of doc_ids or topic_ids.
Examples:
Filter documents by custom metadata field conditions — string, number, and time types with exact and range operators.
How to use it — describe the filter conditions. You must specify topic ID(s) or document ID(s).
Examples:
Lists the topics in a docchain system with pagination, optionally filtered by a name keyword. Often a first step before other skills: get the topic IDs, then search or upload within a topic.
How to use it — just ask what topics exist; optionally give a page number, page size, or a name keyword.
Examples:
Uploads a single local file or a whole folder to a given docchain topic, one file at a time, with progress and success/failure counts. Folder scans cover top-level files only (non-recursive).
How to use it — provide the file/folder path and the target topic ID (--topic_id is required).
Examples:
Uploads a document (docx, doc, pdf, ppt, xlsx, images, epub, mobi and many more) to the docchain parsing service and downloads the converted Markdown next to the source file — either a single .md file (--md) or a package with images and tables.
How to use it — point it at a file path, e.g. "read the content of ./report.pdf" or "convert 合同.docx to Markdown".
Examples:
The service URL and API key follow the same config chain as the search scripts, but both are optional: without configuration the built-in default (https://lab.hjcloud.com/llmdoc) is used with anonymous upload.
Uploads one local image to the active environment and returns similar pictures found in the documents — the pictures themselves, plus their topic (id and name), document name and similarity score. Matched images are downloaded to a temp directory so they can be shown in the conversation.
How to use it — attach a photo or screenshot and ask. The docchain API has no global image search, so the search is scoped to topics: by default the topics selected on the configuration page, or --topic_ids for others, or --all to walk every topic.
Things worth knowing:
score is the service's visual similarity (0–1; an identical image scores 1), not the assistant's judgement. Read it as a ranking, not an absolute verdict — a low score does not by itself mean "unrelated".--all walks every topic — slow and request-heavy (thousands of queries). Prefer the selected topics when you know them.Reads the document's main markdown, hands each image to a multimodal model, inserts <!-- image-desc: … --> directly above every image, and saves the result as that document's sidecar description markdown.
Flowcharts and architecture diagrams take a different route: the model answers with a node/edge graph, and the script renders it as a plantuml sketch block placed where the description would be. The model never writes PlantUML itself — syntax is generated by the script, so the block is always valid — while photos, screenshots, line charts and tables keep the Chinese description.
The main markdown is never touched: descriptions live in a separate file, read back with GET /v1/doc/read?doc_id=<id>&read_format=image_description_md. Normal reading behaviour is therefore unchanged, and a chat agent reads the sidecar only when it needs the picture semantics.
How to use it:
keyword alone returns candidates only and processes nothing)read: true)list_models: true)Things worth knowing:
max_images is only for capping cost — it cannot tell you whether the descriptions are any good, and splitting the work in two makes the user pick a vision model twice.diagram.structured / diagram.as_prose report the two counts, diagram.suspect counts images classified as description that answered with graph data and were re-asked once, and diagram.annotation_guard counts images classified as structure whose node labels looked like layout annotations and were demoted back to a description.plantuml block, everything else becomes a Chinese description comment. Either way the original image is no longer embedded — it becomes a single [原图](url) link you can click to compare."nodes": (it clearly saw a structure) is it re-asked with the structure prompt; if that yields a graph, the image is promoted to a sketch. Deliberately not done for every image, to avoid paying an extra call each time. Measured: 0 triggers across 14 images in two documents.model and once by judge_model. The second pass does two things: (1) drop only edges whose direction is contradicted by the other read, keeping everything else; (2) compare the node sets and report how many labels the judge saw but the primary did not as diagram.missing_from_primary — a warning only, never auto-added, because the judge can hallucinate departments too and merging them would manufacture new errors. Set docchain_vision_judge_model to an empty string to disable the second pass and halve the calls.diagram.trimmed and a DIAGRAM_TRIMMED warning is added.1, 2, …) are treated as noise and dropped; to keep the trunk connected, a dropped node's predecessor is wired straight to its successor — a connection the original image does not contain. Such edges render as dotted ..>, are counted in diagram.speculated, and raise a DIAGRAM_SPECULATED warning. Only solid arrows are relationships the image actually shows.diagram.missing_from_primary counts labels the judge read but the primary missed. Anything above 0 raises a DIAGRAM_MISSING warning and means the sketch may be under-drawing — a blank is far harder to notice than an extra line.diagram.labels_truncated and a DIAGRAM_LABEL_TRUNCATED warning lists the original alongside the shortened form.boxCount before listing nodes, and it no longer caps the node count (it used to say "no more than 20", contradicting the 80-node limit in code — which made the model under-read on purpose). The fan-out limit also went from 8 to 40: an org chart is by nature one centre with twenty-odd parallel departments, and 8 threw away every edge and node past the ninth.boxCount exceeds the nodes it actually listed, it has admitted a gap, so the tool asks once more with the target count spelled out. Counts land in diagram.under_read / under_read_fixed with a DIAGRAM_UNDER_READ warning.diagram: "off" (plain descriptions).:,。;、 or a · separator), the sketch is dropped and the image falls back to a description (counted as diagram.annotation_guard). An ellipsis … is not evidence — it is merely the mark left by truncating a long name, and using it wrongly demoted a normal org chart.image-desc comments in the main md are stripped before this run's output is written, so one image never shows both an old comment and a new sketch.L×/N×/×N repeat counts are dropped, while 4096 / 224×224×3 (real layer widths and sizes) are kept; nodes with the same label and identical neighbours are merged (a same-label chain like 512→512→512 is not).diagram.prose_retry) before the image is reported as failed.docchain_vision_max_desc_chars). Overlong results are first compressed by the model (names/numbers/formulas kept, modifiers dropped); only what still overflows is cut at a sentence boundary. Three counters tell the story: compressed (went through compression), truncated (still cut), incomplete (hit max_tokens, content stops mid-sentence) — only a non-zero truncated/incomplete means information was lost.LARGE_PAYLOAD warning.Vision model configuration: the image-description model follows the model you pick in the chat, and the tool has no model argument — nothing can silently substitute one. If your chat model cannot read images, the tool pauses and asks you to pick a vision model from the gateway list; that pick applies to this call only and never changes your chat model. The fields below are the fallback used when no chat model can be resolved. Defaults to https://lab.iwhalecloud.com/gpt-proxy/v1, keyed by the IWHALE_API_KEY credential. To change endpoint or length cap, edit these fields (the configuration page does not render inputs for them):
docchain_vision_url: https://lab.iwhalecloud.com/gpt-proxy/v1
docchain_vision_model: doubao-seed-2.0-pro # fallback only: used when no chat model resolves
docchain_vision_candidates: doubao-seed-2.0-pro,g-doubao-seed-2.1-pro,qwen3-vl-plus,glm-5v-turbo,g-gpt-5.6-sol
# comma-separated, best first. Order comes from a measured
# benchmark (5 models x 6 real org charts x 2 runs each):
# both doubao models were 6/6, qwen3-vl-plus scored 0 on
# two-row peer charts, and glm-5v-turbo misclassifies
# simple fan-outs as prose. The first usable one is the
# fallback primary; the judge is the first usable one that
# differs from the primary (reading with the same model twice
# gives no second opinion). Shipped in this plugin's own
# cordis.patch.yml, so a fresh install already has it.
docchain_vision_judge_model: # leave empty to let the candidate list choose the judge.
# Set it explicitly to "" to read once (no judge).
docchain_vision_fallback_model: g-deepseek-v4-flash # used once when the primary model is unavailable
docchain_vision_key_ref: IWHALE_API_KEY # credential reference name
docchain_vision_max_desc_chars: 1200 # per-description character cap
docchain_vision_diagram: on # structure diagrams as plantuml sketches; "off" = descriptions only
The CLI uses VISION_BASE_URL / VISION_MODEL / VISION_JUDGE_MODEL / VISION_FALLBACK_MODEL / VISION_API_KEY / VISION_MAX_DESC_CHARS / VISION_DIAGRAM instead. Use list_models to see which vision models your key can actually reach.
Bring your own model service: point docchain_vision_url + docchain_vision_key_ref at your own OpenAI-compatible gateway (Volcengine Ark, Alibaba Bailian, self-hosted vLLM all work). The model list adapts to your gateway:
is_vision field, that field is authoritative./v1/models only return ids), models are recognised by name (vision, vl, gpt-4o, doubao-2.x, …).When no vision model is reachable (for example a DeepSeek account, which only has text models), the tool does not open a picker; it fails fast with:
当前没有可使用的视觉模型,请更换 API key 选择可使用的视觉模型。
That avoids making the user pick something that cannot work.
A ReAct orchestrator-style deep-research workflow (pure instructions, no scripts): the main agent probes the topic, splits independent sub-tasks and dispatches them to parallel subagents; each subagent iterates on retrieval, close reading and deduction and returns a sub-report with its reasoning chain; the main agent cross-validates, reviews and enforces at least two global loops before deciding to stop. The final report is logic-closed, traceable and low-hallucination.
When to use — complex, open-ended questions that need external evidence and logical deduction: industry analysis, market research, competitive analysis, policy interpretation, technology research, trend forecasting. Do not use it for simple Q&A or basic computation.
Removing the bundle unregisters the provider and its skills:
dsh plugin remove dsh-docchain
(or plugin_manager remove_bundle).
Uninstalling does not clean up what this plugin wrote: ~/.dsh/storages/docchain-config.json and any DOCCHAIN_API_KEY__* entries in ~/.dsh/.credentials.yaml stay behind and must be removed by hand.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。