Repository navigation
refactor: split the Host's subagent and tool modules along their seams - #428
Merged
Merged
Conversation
Before the Host's subagent and tool modules are split, pin the text they give the model and the people using it, so the move can be checked against the same values: - every kind of delegated child, the eight write operations, the answer, placement, metadata, the four idle reviews, both MEMORY.md routing batches, the USER.md compaction and the document archive, reads the same persona, completion protocol (its result schema) and task, pinned as SHA-256 hashes with the run's requestId left out; - every memory tool shows the same call and result cards, in registration order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive workflows src/host/subagent.ts held the delegated children's personas, their result schemas and the text of their tasks, the DSH output-schema check, receipt recovery, and the runtime-capacity and Document archive workflows beside the coordinator. Each now has a module of its own: - subagent-prompts.ts: every persona, result schema and task-text helper; - subagent-output-schema.ts: the DSH output-schema subset and its check; - subagent-receipts.ts: reading a child's result, tool receipts and failure detail back; - archive-destinations.ts: which Memory Spaces can take an archive, and the lineage a Provider's receipt proves, which both workflows share; - runtime-capacity.ts: runtimeLocked, compactUserAndCommit, archiveRuntimeEntry, archiveRuntimeLocally, runtimeArchiveSource and the routing batches; - document-archive.ts: the Document capacity and archive workflow. The code moved verbatim. The class methods that left became functions taking what they used of the coordinator: the counters, the runtime source, or for the Document workflow a small host object the coordinator builds with its own lookups and delegate. subagent.ts stays the facade and exports the same names. The pinned persona, schema and task hashes of every delegated child are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
registerTools in src/host/tools.ts was one 439-line function that built the helpers every tool shares and registered all sixteen tools. The helpers now come from toolHelpers, and each tool family registers in a function of its own: the View tools, Memory Spaces' reads, the Documents tools, the runtime memory tool and Memory Spaces' writes, called in that order, which is the order the model has always been given the tools. Every registration block moved unchanged, the helpers are built once as before, and the captured config is read at registration as before. The model-tools fixture, the tool table and the pinned tool cards pass unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record lists what moved where with line counts before and after, how the code moved, and three equivalence checks: the pinned text every delegated child reads and the tool cards, the code lines before and after with the split scripts that reproduce both moves from the baseline, and the built Host bundle, whose statements match main's but for the coordinator class, its former methods and the tool registration functions, which are made of the old code. A changeset records the patch for dsh-mnemon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pins of what delegated children read covered eight of the nine delegated operations: reconciliation, which runs through the maintenance task runner, now has its child pinned too, over evidence with another installation's entry, branches, documents, the sync branch's side and a reviewer's opinion. Every list in the pinned tasks had one element and no request field was an object, so the separators that join them were never pinned. The remember request now has two tags and an object field, the routed entry two branches and the archived document two source paths. The updated pins pass on the code before the move (a8c4026) as after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The record now counts 20 pinned children, the reconciliation child among them, 14 personas, 8 completion protocols and 18 tasks, says that the task separators are pinned, and that the extended pins pass on the code before the move as after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lits # Conflicts: # docs/pr-assets/README.md
11 of 28 tasks
LoveDoLove
pushed a commit
to LoveDoLove-Forked-Projects/dsh-mnemon
that referenced
this pull request
Oct 18, 2026
Brings in omdsh-dev#428. The records index conflicted on its top row: both rows are kept, this branch's gallery record first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要 / Summary
把 Host 的两个过大模块按已有的接缝拆开,只搬移代码:
subagent.ts(2,378 行)拆出提示词与人设、DSH 输出 schema 校验、回执恢复、归档目标、运行时容量工作流与项目档案归档工作流 6 个模块,仍作为对外的门面导出原有名称;tools.ts中 439 行的registerTools按工具族拆成 5 个注册函数,注册顺序不变。搬移前先用测试固定了每种委托子 Agent 的人设、完成协议与任务文本以及全部工具卡片的哈希;用户和模型看到的内容不变。Two oversized Host modules split along their seams by moving code verbatim:
subagent.ts(2,378 lines) gives its prompts and personas, the DSH output-schema check, receipt recovery, the archive destinations, the runtime-capacity workflow and the Document archive workflow six modules of their own and stays the facade with the same exports;tools.ts's 439-lineregisterToolsbecomes five family functions registering in the same order. Before anything moved, tests pinned the hash of every delegated child's persona, completion protocol and task and of every tool card. Nothing users or the model see changes.关联 Issue 或背景 / Related Issue or Context
Item H2 of the technical-debt review after v0.5.31 (#413).
涉及区域 / Affected Areas
PR 类型 / PR Type
变更内容 / Changes
0236a9e0, extended inea19a2ec):tests/subagent.spec.tsdrives all 9 delegated operations (20 children) through the coordinator and pins SHA-256 hashes of each persona (14), completion protocol (8) and task (18); a second test pins all 16 tool cards. The pins pass on the pre-move code and after every move.src/host/subagent.ts(2,378 -> 1,068 lines; the coordinator 1,467 -> 836 lines, 60 -> 48 members): newsubagent-prompts.ts,subagent-output-schema.ts,subagent-receipts.ts,archive-destinations.ts,runtime-capacity.ts,document-archive.ts. 13 private methods became functions taking what they used ofthis(the livecountersandruntimeSource, or aDocumentWorkflowHostthe coordinator builds with its methods bound). The facade exports the same 17 names.src/host/tools.ts:registerTools(439 -> 8 lines) callstoolHelpers(the original closures, built once) and five family functions; the 16 registration blocks are byte-identical and in the same order.docs/pr-assets/host-module-splitswith harness scripts that reproduce all eight files from the base by line slices and listed substitutions, and a bundle comparison. Changeset:dsh-mnemonpatch.最新代码确认 / Latest Codebase Confirmation
main分支开发,或在提交前已 rebase 或合并最新main。 / I developed from the latestmain, or rebased or merged the latestmainbefore submitting.同步命令 / Sync command:
Branched from
a8c40265(the head of #426);mainbd70979f(#426) merged inbad852aa.AI 编码披露 / AI Coding Disclosure
使用的 AI 模型 / AI model used: Claude Opus 5.5 (
claude-opus-5-5)使用的编码 Agent 工具 / Coding Agent tool used: Claude Code
仓库规范检查 / Repository Rules
@deepseek-ai/*NPM 契约。 / I did not modify DSH source or point tsconfig at a DSH source checkout, and used only published@deepseek-ai/*NPM contracts.src/host/protocol.ts为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safesrc/host/protocol.tsas the source for wire DTOs.lib/文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generatedlib/files.兼容性与数据安全 / Compatibility and Data Safety
tests/fixtures/model-tools.jsonunchanged) and the same persona, protocol and task text for every child (the pins). Persisted formats (archive index text, cold paths, lineage), RPC behavior and error messages are unchanged.lib/index.jschanges only at module boundaries: the same 29 external imports in the same order, every module region in order, the 13 moved bodies identical after normalizingthis; of the statements that run at load, only three pure constant constructions change relative order. Every other build output,lib/typesincluded, is identical. No package entry, declaration or plugin changes, so no peer floor moves.本地验证 / Local Validation
执行的命令 / Commands run:
结果摘要 / Result summary:
verifypassed (root tests 2,111 passed, 7 skipped in 152 files; plugins 593 passed, 3 skipped; package);verify:pluginspassed; installed DSH 0.2.0-rc.2: 2,108 passed, 10 skipped; installed 0.2.1-rc.2: 2,111 passed, 7 skipped; Git sync 64/64;release:intentcoversdsh-mnemon. After the pin extension: the subagent, tool-card and memory-tools specs (157), typecheck, the root tests (2,111 passed) andverify:docspass.thisbinding, live state, await and error boundaries, confirmed no test spies on or replaces coordinator methods, rebuilt both sides (only module boundaries and three pure constants differ), checked the facade's 17 exports, and found that 40 of 42 one-character prompt mutations failed the pins. It found no must- or should-fix; its two nits (the reconcile child and two list separators were not pinned) are fixed inea19a2ec, and the extended pins pass on the pre-move code.用户可见变更证据 / Local Feature Evidence
证据 / Evidence: N/A, nothing users or the model see changes; the record has the harness, the pins and the bundle comparison.
🤖 Generated with Claude Code