Introduction

When using DSH (DeepSeek Harness) for coding agents, there is a common pain point: whether the generated code has type errors or violates lint rules after each write / edit / bash operation, you have to run the toolchain yourself to know. Problems discovered late result in high repair costs.

In the Pi host, pi-lens has solved this: the engine runs LSP, linter, formatter, type checking, and structural analysis while the agent writes code. dsh-lens does exactly this: it connects the same engine to dsh. Below is an introduction to its positioning, capabilities, installation, and configuration.

What is it

dsh-lens is a native adapter for the dsh host of pi-lens, maintained by NexusAgentX under the MIT license. The analysis engine remains in pi-lens; this plugin is only responsible for adaptation: it intercepts dsh’s file write events, runs the same pipeline, and feeds the results back to the model.

It solves the problem of enabling the agent to see the errors it just introduced in the next round of requests, rather than waiting for someone else to discover them.

What runs after each change

Whenever a write / edit / bash change occurs, the plugin runs the same pipeline as pi-lens:

  1. format queue / safe auto-fix;
  2. LSP file sync and diagnostics;
  3. ast-grep, tree-sitter, fact rules, and language scanners;
  4. cascading diagnostics for suspected adjacent files;
  5. summarizing blockers and suggestions at the end of the turn and injecting them into the next model request.

This means that before the model writes the next action, it already knows what problems were left behind in the previous round.

Registered Tools

Persistent tools include:

  • lens_diagnostics: cache / project-level diagnostic state, supports delta / all / full views;
  • lsp_diagnostics: get LSP diagnostics by file or directory;
  • symbol_search: sorted identifier search;
  • module_report / project_report: module and project reports;
  • read_symbol / read_enclosing: read code by symbol.

A batch of other tools are also registered as visible (the reason is that dsh lacks a dynamic tool API): ast_grep_search / ast_grep_replace / ast_grep_outline / ast_grep_dump, lsp_navigation, lens_diagnostic_mark, and pi_lens_activate_tools—which is a no-op on dsh because all tools are already active.

Among these, lens_diagnostics, ast_grep_search, and symbol_search are presented as search cards and support file following.

The official lsp tool has not been modified: simple go-to continues to use the official lsp, while lsp_navigation is used when a full IDE experience is needed.

/lens-* Commands

Command Effect
/lens-toggle Toggle the entire pipeline for the current session
/lens-context-toggle Keep tools / LSP / format, but stop injecting into the next round
/lens-widget-toggle Show or hide the WebUI chips and dock
/lens-health Session health, LSP list, cascading, event loop, noisy rules
/lens-perf Process and machine-level p50/p99 percentile rankings
/lens-tools Installer status grouped by source
/lens-tdi Technical Debt Index
/lens-map Output HTML dependency graph, chips get Open map action
/lens-allow-edit <path> One-time read-protection exemption

WebUI

On the official dsh web profile, the plugin comes with a browser-side implementation (dsh.client):

  • The lens chip next to the session title, mount point is conversation.session.header.actions;
  • The dock above the input box, mount point is conversation.input.dock;
  • Uses official Menu / Tooltip / StateDot primitives, chevron, and CSS modules, provides zh/en locale.

From an implementation standpoint, it is worth noting that the chip reads the lens session projection, derived from tool/result, turn/end, and the widget-state collapse from /lens-widget-toggle. It does not append custom session events, so persistence will not reject logs.

Skills

When ctx.skills exists, the plugin registers four upstream pi-lens skills:

  • pi-lens-ast-grep
  • pi-lens-lsp-navigation
  • pi-lens-write-ast-grep-rule
  • pi-lens-write-tree-sitter-rule

Installation and Enabling

Official installation command:

dsh plugin --profile web add dsh-lens

Can also be installed from git:

dsh plugin --profile web add github:NexusAgentX/dsh-lens

Requires Node.js >= 20. After installation, do not mount pi-lens-mcp or the official MCP wrapper of pi-lens on the same workspace, as this would spawn duplicate language servers.

Configuration

Configuration files follow pi-lens’s two locations:

  • Project-level: .pi-lens.json;
  • Global: ~/.pi-lens/config.json.

You can also write switches directly in the Cordis entry; omitted keys fall back to .pi-lens.json or environment variables:

- id: dsh-lens
  name: dsh-lens
  config:
    cwd: /path/to/workspace
    enabled: true
    lsp: true
    format: true
    autofix: true
    guard: false
    readGuard: true

These boolean keys map to the corresponding flags in pi-lens, such as --no-lsp, --lens-guard, --immediate-format.

Standalone CLI

Can be used without entering a session. Two commands:

npx dsh-lens build-graph --cwd .
npx dsh-lens status

build-graph produces the same review graph as pi-lens build-graph; status checks the current state.

Use Cases and Notes

Suitable scenarios: teams and individuals running coding agents on dsh who want errors fixed by the model in the next round and want structural analysis like ast-grep rules and dependency graphs.

There are a few points to be clear about before using:

  1. The plugin runs with the permissions of the current dsh process; you should check the source code and license (MIT) yourself before installing;
  2. dsh freezes tool parameters before distribution; Pi’s in-flight edit autopatch cannot rewrite old_string; dsh itself already has a read-before-write (read-before-edit) observation strategy;
  3. Some Pi host interfaces are not cloned: TUI footer, interactive LSP install prompts, session fork / cross-process nudge, official Settings card, and the upstream /lens-booboo which is still pending;
  4. Version number discrepancies exist in the docs (README states dsh-lens@0.2.0, package.json says 0.2.5); refer to the actual release in the repository.

Conclusion

The value of dsh-lens lies in turning “check after writing” into “check while writing”: the pipeline runs after every change, blockers are injected into the next round request, and the feedback received by the model is immediate. Configuration and engine are aligned with pi-lens, making the cost of migrating from Pi to dsh very low.

Directory page: https://www.skillhub.cn/plugins/NexusAgentX/dsh-lens
GitHub: https://github.com/NexusAgentX/dsh-lens

The directory is an independent community site, not officially affiliated with DeepSeek / Fantom; for issues during installation and use, please refer to the repository issues.