dsh_WebFocus: Use focus keywords for focused reading of web pages and control the volume of injections in web scraping

Introduction

When building web-connected agents in DeepSeek Harness (DSH), the built-in web_fetch injects page Markdown into the context in its entirety, up to the host’s limit. Long documents and Wikipedia-style pages can easily consume the entire token budget, when what’s actually needed is often just a few facts relevant to the current question.

The community plugin dsh-plugin-web-focus (repository shutongcao1-design/dsh_WebFocus) registers a standalone tool web_focus: it first fetches the same URL via the host’s ctx.web.fetch(), then performs sentence-level relevance filtering based on the focus keywords you provide, compresses links, strips navigation noise, and reports the omission ratio in the results; the uncompressed original is written to disk and can be retrieved later, and page-level results are also cached. Since 0.2.0, the plugin no longer intercepts the fetch path—disabling the bundle will not affect the built-in web_fetch.

What This Is

  • Positioning: A “focused reading” web tool for DSH (community catalog classification: web tool).
  • Maintainer: shutongcao1-design; current package version 0.2.2 (MIT).
  • Relationship with web_fetch: web_fetch behavior remains default; when you need to trim body text by focus, switch to web_focus.

Core Features

The following capabilities can be verified in the README and source code.

Standalone Tool web_focus

Required parameters are url (absolute http/https) and focus (a one-sentence keyword query, not a “please summarize” type instruction). The tool scores sentences by in-page IDF × token overlap with focus, and performs post-processing such as rare-word coverage and role/date line completion; output is primarily notice + content, with fields like kept, total, truncated, rawPath attached for troubleshooting.

Optional parameters include:

  • full=true: Skip relevance filtering and inject the full page (still subject to the maxTextLength hard cap); focus remains required.
  • refresh=true: Bypass page cache and failure cache, refetch.
  • offset / limit: Enter the segmented window path.
  • max_age: Maximum seconds allowed for cache; refetch if expired.

Body Processing and Cache

Processing pipeline (README summary): strip invisible characters → compress links / drop navigation → sentence segmentation → force-keep first/last sentences and headings containing focus words (up to 8) → score and fill within a ~4k–12k character budget based on focus size → protect high-relevance answer sentences → coverage and intra-block cohesion → budget reconcile → output coverage header and sparse-match hints.

  • Original retention: By default, writes uncompressed body to data/raw under the plugin directory (path can be changed via rawDir); default cleanup of files older than ~30 days at startup (rawCleanupDays).
  • Page cache: Default TTL 1800 seconds; same URL with different focus will re-filter, not replay old summaries.
  • Failure cache: Default 240 seconds; when hit, web_focus throws an error instead of retrying immediately; can clear with refresh: true.

Changes in 0.2.x Compared to Early Prototypes

The README’s comparison baseline shows: on test pages of 10k–200k characters, 0.2.x maintains key sentence coverage while injecting significantly less volume than the 0.1.0 strategy of “fall back to full-page compressed text if retention is low”. Real-page inspection examples during development (focus: population mayor mission founding date): en.wikipedia.org/wiki/San_Francisco ~459,687 chars original → ~3,765 chars body fragment; zh.wikipedia.org/wiki/Xiamen ~335,038 → ~3,946 chars.

Known Limitations

Selection based on lexical overlap cannot cover expressions that share no common words with focus (paraphrase baseline cases in the README). Mitigation: include words likely to appear on the page in focus, use full=true for pages with many synonym paraphrases, or read the retained raw full text.

Environment and Dependencies

  1. DSH built-in web service enabled (@deepseek-ai/dsh-web-app).
  2. Node.js ≥ 18.
  3. @deepseek-ai/schemastery (peer; provided by DSH).

Long-page note: The host HTTP fetch truncates at 100,000 decoded body characters by default. The plugin warns when truncated: true; if truncation occurs before the infobox, focused selection cannot see the unreachable body. The README suggests increasing maxBodyChars for web-fetch-http in the host config (test config example: 2000000); restart the host after modification.

- id: web-fetch-http
  config:
    maxBodyChars: 2000000

Installation and Activation

The package is not published to npm. Per the README, first obtain the source from the repository, then use plugin_manager to install the bundle (cordis.patch.yml only inserts a web-focus plugin line, does not modify the web line).

git clone https://github.com/shutongcao1-design/dsh_WebFocus.git

In DSH, execute on plugin_manager (replace the path with the absolute path of your local clone):

plugin_manager  action: install_bundle   target: <absolute path to the checkout>

If you previously installed an older version with fetchProvider, you need to remove the old bundle first and check whether the profile still references the old provider id.

Before installing, it’s recommended to read the repository source code and LICENSE, SECURITY.md. The plugin runs under the current DSH process permissions; fetching and disk-writing behavior is consistent with the host web policy, but the raw directory may contain personal data from pages.

Typical Usage

Call the tool web_focus from the agent side (name is subject to registration result). The idea: URL points to the target page, focus contains the words you expect to appear in the answer, not natural language task descriptions.

Focus examples used in the README’s development-time real-page inspection:

population mayor mission founding date

When targeting the English Wikipedia San Francisco article, facts like population, mayor name, and founding date still appear in a ~thousand-character summary, rather than the full-page Markdown.

When you need to read the entire page or focus word coverage is insufficient:

  • Set full=true to get capped full-text injection;
  • Or read the uncompressed original on disk via the returned rawPath (note the default directory is inside the package; reinstalling the bundle may lose it; configure rawDir for persistence).

For fetch failures or URLs that just failed: use refresh=true to avoid failure cache within a short time window.

Main Configuration Options

Adjustable in the plugin web-focus’s config (default values see the README config table):

Config Option Default Summary
rawDir data/raw under plugin Directory for uncompressed original
rawMaxChars 4194304 Per-file cap
rawCleanupDays 30 Clean up raw files older than this at startup (0 disables)
pageCacheTtlSeconds 1800 Page cache TTL
negativeCacheTtlSeconds 240 Failure cache TTL
maxTextLength 80000 Hard cap for context injection
sourcesMax 30 Max number of source footnotes
enableFocusTool true Whether to register web_focus
exposeInternals false Whether to expose internal objects via ctx.__webFocus

Use Cases and Notes

Suitable for: DSH agents that need to extract sentences by multiple fact points from fixed URLs (documents, Wikipedia, announcements) and are willing to express focus via keywords; coexists with web_fetch, choose tool by task.

Notes:

  • focus is a keyword query; no matter how complete the question, if the words don’t appear on the page, relevant sentences won’t be selected.
  • Non-2xx responses are returned as results and enter failure cache, not thrown as host-level network errors.
  • Fetching goes through ctx.web.fetch; SSRF, redirects, and size limits are still handled by the host; the plugin doesn’t disguise security interception as success.
  • The README states it’s an independent community plugin, not affiliated with or endorsed by DeepSeek; the community catalog SkillHub is also an independent site, not an official app store.

Conclusion

dsh_WebFocus breaks “full-page injection” into “focused reading by focus + retrievable original + cache reuse”, and in 0.2.x replaces full-page fallback with sparse summaries, making it more suitable for token-sensitive Harness workflows. See entries and source code:

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye