Introduction

The core version of DeepSeek Harness (DSH) (>= 0.1.5) natively manages context budgets and token counts, and is responsible for pruning tool results and overflow strategies. The dsh-context-lens plugin focuses on semantic compression and solves the problem of “what content to send to the model.” It transforms verbose source code files into structured AST skeletons and compresses large test or build logs into key errors and summaries, reducing token consumption while preserving semantic integrity.

Plugin Positioning

  • Name: goodandready/dsh-context-lens
  • Description: Semantic AST Code Skeletonizer & Test Log Condenser for DeepSeek Harness
  • Maintainer: GooDAnDReaDY
  • License: MIT

Core Features

1. Multilingual AST Structure Skeleton Generator

This feature supports TypeScript, JavaScript, Python, Go, C/C++, Rust, Java, and SQL DDL. It is implemented using pure regular expressions and does not rely on heavyweight parsers.

The processing logic is as follows:
- Retained content: import statements, class/struct/interface definitions, exported types, function signatures, and documentation comments.
- Removed content: function or method implementation bodies.

This allows AI to understand code structure, type definitions, and dependencies without reading specific implementation details.

2. Smart Test and Build Log Compression

For output from tools such as Jest, Vitest, Pytest, Go test, Cargo, Webpack, Vite, TSC, Maven, and Gradle, the plugin provides three compression modes:

  • raw: Removes noise lines while preserving execution order.
  • balanced: Retains failed sections and their surrounding context windows (default mode).
  • aggressive: Extracts only error lines and stack frames.

Regardless of log size, the plugin automatically extracts failure information, assertion differences (Expected ... Received ...), and test summaries, while ignoring successful run records.

3. Path Focus Management

When performing code editing tasks, you can specify the currently active target file or folder.

  • Focused file: Returns the full implementation code.
  • Non-focused files: Apply AST skeletonization.

The focus state is strictly scoped to the current session (sessionId) and is used to keep the context focused on the file currently being modified when working with large projects.

Agent Tool Usage

The plugin provides two tools that strictly follow the DSH tool specification and return structured output.

1. context_lens_code

Action Description
skeleton (default) Generates an AST skeleton. You can specify code, language, maxDepth, and filePath.
focus Sets the focus path for the current session.
get_focus Gets the focus path for the current session.
clear_focus Clears the focus path for the current session.

2. context_lens_log

Used to compress test or build logs. You can specify text (or log), mode (raw/balanced/aggressive), maxLines, auto, and command.

  • In auto: true mode, only text identified as test/build output is processed.

Configuration

Configuration is managed through the DSH settings page (plugins.row.config / plugins.item):

Property Type Default Value Description
compressionMode string 'balanced' Aggressiveness of log compression.
astSkeletonMaxDepth number 3 Maximum depth for AST skeleton generation.
autoCompressThreshold number 4000 Character threshold that triggers automatic log compression (0 disables it).

Notes

  • Core version dependency: Context budgets and token counts are managed by the DSH core (>= 0.1.5); this plugin is only responsible for semantic compression.
  • Implementation approach: Based on pure regular expressions, with no native dependencies.
  • Session isolation: The path focus state is session-isolated.

Ecosystem Information