dshbase

Plugin directory / Developer / dsh-context-economy

dsh-context-economy

Verified · install-tested on dsh huangjua

✓ Actively maintained Builds on 4 official DSH packages

View on GitHub ↗ ← Back to plugin directory

0Stars
0Forks
0Open issues
—Language
2026-08-16Last push
Cross-platformPlatform

What it does

Token-efficient project reading plugin for DSH: symbol/import index + mtime self-heal + byte-slice reader + cost probe

✅
Our take
Works — verified, early-stage project

Token-efficient project reading plugin for DSH: symbol/import index + mtime self-heal + byte-slice reader + cost probe It installs cleanly and boots without issues in our testing. It's early-stage but functional.

“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.

README

⚡ dsh-context-economy

Slash token costs for agent code reading via pointer & topology indexing
Pointer-Based Lazy Reading • PageRank File Topology • Byte-Level Slices • 80–93% Token Savings

DSH Suite
Token Savings
License

Features • Quick Start • DSH Power Suite • Tools • 简体中文


💡 Why dsh-context-economy?

LLM context windows are finite and expensive. Dumping entire 2,000-line source files into prompts exhausts token budgets and severely degrades the model's reasoning capabilities.

dsh-context-economy provides an ultra-compact code reading layer:

  • 💰 80–93% Output Token Reduction: Queries return minimal path:line pointers with brief context; oversized matches spill cleanly to disk.
  • 🌐 PageRank Dependency Topology: Analyzes project imports (adapted from Aider's repomap algorithm) to prioritize central, high-frequency hub files (hotspots).
  • 🔬 Byte-Level Window Slicing (project_slice_read): Reads specific byte windows with regex find and tail tracking — built for huge single-line JS bundles and deep JSON.
  • 📊 Persistent Savings Accounting (project_savings): Automatically tracks token savings per turn against naive full-read baselines.

🚀 Quick Start

Installation

# In your DSH plugin environment
dev_inject_plugin @dsh-external/dsh-context-economy

Typical Usage Flow

  1. Find symbols with PageRank: project_symbols_find query="AuthHandler" ranking=true
  2. Inspect dependency hotspots: project_imports direction="hotspots"
  3. Query accumulated token savings: project_savings

🧩 DSH Power Suite

This plugin is part of the DSH Agent Power Suite — 4 modular, zero-hard-dependency plugins forming a complete closed-loop developer workflow:

flowchart LR
    M["🧠 dsh-local-memory<br>(1. Remember rules & prefs)"] --> E["⚡ dsh-context-economy<br>(2. Save 80%+ tokens reading code)"]
    E --> A["🛡️ dsh-evidence<br>(3. Tamper-proof audit receipts)"]
    A --> S["🔍 dsh-session-index<br>(4. CJK search & bookmarks)"]
    S --> M

    style M fill:#e8f4fd,stroke:#2b7de9,stroke-width:2px
    style E fill:#eef9f2,stroke:#1e8e3e,stroke-width:2px
    style A fill:#fef7e0,stroke:#f29900,stroke-width:2px
    style S fill:#f3e8fd,stroke:#8430ce,stroke-width:2px
Plugin Role in Suite Synergy with Context Economy
⚡ dsh-context-economy Context Economy (Current) Provides index-backed pointer reading and topology to slash token expenditure.
🧠 dsh-local-memory Memory Layer Frees up prompt tokens, leaving abundant budget for persistent memory snapshots.
🛡️ dsh-evidence Audit & Receipts Benchmark runs (savings-bench) generate verifiable evidence bundles registered into Evidence.
🔍 dsh-session-index Session Search Compact pointer output generates 80%+ smaller session logs, reducing search index load.

📖 Deep Dive & Reference

🛠️ Available Tools (8 Tools)
Tool Description
project_index_status View index stats, heal history, and manually refresh working-tree reconciliation.
project_symbols_find Locate symbols by name/substring with optional PageRank ordering.
project_imports Inspect in/out import edges, top-k hotspots, and orphans.
project_files Cached fast glob listing relative project paths.
project_slice_read Precision byte slicing with window / tail modes and ReDoS-protected regex find.
project_json_read Bounded streaming scan of top-level JSON keys without full JSON.parse memory spikes.
project_cost_probe Single-shot comparison probe between tool output and naive full-file reading.
project_savings Query accumulated token savings ledger (grouped by tool/root with trend analysis).
🏗️ Architecture & Self-Healing
  • Incremental Self-Healing Index: Tracks mtime + size to re-scan only modified files on demand without persistent daemon threads.
  • Top-Level JSON Scanner: 64KB chunk-based depth scanner preventing OOM on massive configuration files.
  • PageRank Algorithm: Power-iteration algorithm with $\alpha=0.85$ and strict convergence tolerances.
🧪 Building & Testing
npm run typecheck
npm run check:dsh-contract
npm test
npm run pack:check

Part of the DSH Agent Power Suite. Licensed under BSD-3-Clause.

Install

🧩 Let your agent install it (recommended)

Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:

dsh plugin add dshbase-catalog

Then say "install dsh-context-economy for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.

This plugin is GitHub source (not published to npm) — install it straight from the repo:

Web profile:

dsh plugin --profile web add github:huangjua/dsh-context-economy

Headless (CLI) profile:

dsh plugin --profile headless add github:huangjua/dsh-context-economy

Test report

Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.

Security: not yet scanned — our daily static scan will cover it shortly.

Share this badge

More in Developer

Browse all 7819 plugins →