Introduction

Agents in DeepSeek Harness (DSH) often face context loss between sessions, especially when workflows involve large numbers of files, tool configurations, or history. Repeatedly retrieving local resources is inefficient. As a cross-workspace library, mega-index-map is designed to solve this problem. It allows agents to uniformly record and locally index encountered files, tools, environment configurations, knowledge-base entries, and work records, enabling quick reuse of this information in any conversation.

Plugin Positioning

mega-index-map is a cross-workspace interoperability library maintained by Nesarf. Its core value lies in providing a local, self-expanding file-format library for recording, indexing, and searching cross-workspace data. All data is stored under $DSH_HOME/library. The plugin performs no network I/O at runtime and uploads no data, ensuring security and isolation.

Core Features

The plugin provides a set of tool commands prefixed with library_, covering the full workflow from recording data to retrieving it.

  1. library_record
    Records objects. The system has a change-detection mechanism and uses the verify/confirm route to decide whether to update. For immutable-class changes, the system rejects the change and waits for user confirmation, then records the reason and marks it as record-confirm.

  2. library_index
    Performs rebuild, audit, index, and prune operations on the index:

    • op=rebuild (default): deduplicates, sorts, and reports conflicts.
    • op=audit dir=<path>: performs read-only reconciliation between the directory and the index, handling entries that exist on disk but are not recorded, and records whose paths no longer exist in the index.
    • op=index dir=<path> confirm=true: registers missing entries, subject to depth and entry-count limits, while applying sensitive-content rules.
    • op=prune confirm=true: removes derived rows that no longer meet the criteria (for example, insufficient format-signature occurrence count).
  3. library_query
    Searches by keyword, type, or tag, and supports cursor pagination. Multi-word queries match each word and rank by coverage; a single word is searched as a substring.

  4. library_detect
    Scans and registers local tools and environments. Built-in seeds resolve command names from PATH and record tool locations (such as %ProgramFiles%, %GOROOT%, etc.). Supports add (add to the candidate package) and propose (suggest entries from a directory).

  5. library_sniff
    Identifies file types by header bytes (supports 108 signatures), independently of file extensions.

  6. library_format
    Extends the local format library and supports operations such as list, scan, learn, add, remove, deps, draft, report, deliver, and unseal.

  7. library_decrypt
    Reads isolated sensitive objects on request.

  8. library_export
    Exports data as JSON or NDJSON.

  9. library_encoding
    Reports the host encoding and how to switch to UTF-8.

  10. library_adb
    Performs Android device operations via ADB.

  11. library_sessions
    Reads DSH sessions and their exported history ZIP files. Supports op=list, op=read, op=tail, op=search, op=record, op=bootstrap, and op=status. Data is stored as zstd frames and supports read-only access as well as handling of damaged tails.

Installation and Enablement

Installing the plugin requires the official package-management commands.

# 安装插件
dsh plugin --profile web add github:Nesarf/mega-index-map

# 升级已安装的版本
dsh plugin --profile web update mega-index-map

On first start, the plugin automatically runs the bootstrap process, reads session history, and extracts indexable facts.

Typical Usage

  1. Query the index
    library_query term by term ranking
  1. Index operations
    # 重建索引
    library_index op=rebuild

    # 审核目录
    library_index op=audit dir=/path/to/dir

    # 索引目录并强制确认
    library_index op=index dir=/path/to/dir confirm=true

    # 修剪索引
    library_index op=prune confirm=true
  1. Session management
    # 列出会话
    library_sessions op=list

    # 读取会话摘要
    library_sessions op=read

    # 搜索会话历史中的短语
    library_sessions op=search phrase

    # 引导配置
    # blocking: 默认,完成后注册工具
    # gate: 后台运行,通过 status 查看状态
    # off: 仅显式调用 bootstrap
    # bootstrapBudgetMs: 默认 300000ms,控制最大运行时间
    library_sessions op=bootstrap blocking bootstrapBudgetMs=300000
  1. Tool detection
    # 添加候选工具
    library_detect add tool_name

    # 从目录建议条目
    library_detect propose /path/to/dir

Use Cases and Notes

This plugin is suitable for scenarios that require maintaining state across multi-turn conversations or retrieving local tool configurations or file information.

  • Performance data: At the current scale (about 11,649 objects and a 6.0 MB index), queries take about 51 ms, recording takes about 156 ms, and rebuilding takes about 124 ms.
  • Concurrency and isolation: Write operations are serialized through lock files. The plugin is read-only across Harness instances and writes only to $DSH_HOME, temporary directories, or caller paths.
  • Invariants: Output is forced to be ASCII to ensure cross-platform portability and correct handling of UTF-8 text.
  • Security note: The plugin runs with the permissions of the current DSH process. Check the source code and license before installing.

Summary

mega-index-map provides DSH with a localized knowledge-management and retrieval layer. By recording files, tools, and environments into the index, agents can reuse context more efficiently and reduce reliance on direct disk retrieval. It is a practical tool for projects that require long-term maintenance of working context. For more details, see the plugin directory or the GitHub repository.