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.
-
library_record
Records objects. The system has a change-detection mechanism and uses theverify/confirmroute to decide whether to update. For immutable-class changes, the system rejects the change and waits for user confirmation, then records thereasonand marks it asrecord-confirm. -
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).
-
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. -
library_detect
Scans and registers local tools and environments. Built-in seeds resolve command names fromPATHand record tool locations (such as%ProgramFiles%,%GOROOT%, etc.). Supportsadd(add to the candidate package) andpropose(suggest entries from a directory). -
library_sniff
Identifies file types by header bytes (supports 108 signatures), independently of file extensions. -
library_format
Extends the local format library and supports operations such aslist,scan,learn,add,remove,deps,draft,report,deliver, andunseal. -
library_decrypt
Reads isolated sensitive objects on request. -
library_export
Exports data as JSON or NDJSON. -
library_encoding
Reports the host encoding and how to switch to UTF-8. -
library_adb
Performs Android device operations via ADB. -
library_sessions
Reads DSH sessions and their exported history ZIP files. Supportsop=list,op=read,op=tail,op=search,op=record,op=bootstrap, andop=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¶
- Query the index
library_query term by term ranking
- 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
- 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
- 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.