Introduction

In the DSH (DeepSeek Harness) ecosystem, invoking cloud-based models to process large files or logs incurs significant token costs. This plugin delegates read-only collection tasks (such as log scanning, field extraction, counting, and de-duplication) to local Ollama models. This approach consumes no cloud tokens, requires no API key, and keeps the original content out of the main conversation context; only conclusions are returned.

Plugin Positioning

  • Name: DSH-LocalModels-TokenSavior
  • Category: Model Inference
  • Maintainer: Movingelated
  • Core Value: Offloads read-only tasks to local Ollama for zero cloud-cost data collection and preprocessing.

Installation and Activation

This plugin is a DSH bundle and must be installed with plugin_manager.

  1. Installation Command:
    Run the following in DSH:
    plugin_manager → action: install_bundle → target: "github:Movingelated/DSH-LocalModels-TokenSavior"
Alternatively, clone it with git and install it by pointing to the path:
    git clone https://github.com/Movingelated/DSH-LocalModels-TokenSavior.git
    # 然后使用 install_bundle 指向该路径
  1. Activation Requirement:
    After installation, restart DSH. The host plugin consists of module code; DSH does not perform hot replacement.

Prerequisites

Before enabling the plugin, the following conditions must be met; otherwise delegation will fail:

  1. Ollama Accessible: Local Ollama must be accessible. The default address is http://127.0.0.1:11434.
  2. Provider Routing: A provider route named ollama-local must exist in llm-pi-ai.
  3. Model Declaration: The model ID being delegated must be included in the route’s models: list.

Configuration

The plugin provides a dedicated “Local Models” panel, located in Settings.

  • Toggle and Selection: You can enable or disable the plugin, or switch the default model, directly in the panel.
  • Immediate Effect: enabled, model, and baseURL are volatile fields. Changes are saved when the field loses focus, without a restart.
  • Code Configuration (when no UI is available): Modify the local-ollama-models configuration section in the profile, set enabled: true, and specify model.

Core Tools

The plugin provides two main tool functions:

  1. ollama_local_models()

    • Purpose: Perform a read-only environment status query.
    • Returns: Ollama endpoint connectivity, version, and available models list (including size, quantization, context, and persona warnings).
  2. subagent_local({ task?, kind?, prompt?, mode?, model?, label?, collect? })

    • Purpose: Dispatches read-only collection tasks to a local model for execution.
    • Behavior: Original content is not included in context; only conclusions are returned.
    • Parameters:
      • task: Recommended; describe the task directly (object + fields/criteria).
      • kind: Task type (e.g., classify, qa, extract).
      • prompt: Full prompt (optional, takes precedence over the template).
      • mode: Execution mode (e.g., fast, balanced).
      • collect: Advanced usage; the host fetches source material and automatically chunks it, avoiding large files from occupying context.

Usage Examples

  1. Environment Check:
    First call the tool to confirm local Ollama status:
    ollama_local_models()
  1. Execute Read-Only Tasks:
    Use subagent_local for data extraction or log analysis:
    subagent_local({
      task: "统计 error 级别日志数量",
      kind: "count",
      model: "qwen2.5-coder:32b" // 指定模型
    })
  1. Large Corpus Processing:
    When source materials are large, use the collect parameter for automatic chunking:
    subagent_local({
      task: "归类日志",
      collect: {
        path: "/var/log/app",
        pattern: "ERROR|WARN",
        chunkLines: 1000 // 每片不超过 1000 行
      }
    })

Notes

  • Counts Require Manual Review: Classifications and locations returned by the plugin are reliable, but count results should be mechanically verified by you (for example, using grep).
  • Chunk Large Corpora First: The default route context is limited, so large corpora must be processed with collect chunking.
  • Model Limitations: It is suitable only for read-only tasks (reading logs, extracting fields, and viewing images), not for code delivery or rewriting.
  • Plugin Directory: https://www.skillhub.cn/plugins/Movingelated/DSH-LocalModels-TokenSavior
  • Source Repository: https://github.com/Movingelated/DSH-LocalModels-TokenSavior