Skip to content

feat(runtime): combine global profile with workspace memory - #103

Merged
Grivn merged 1 commit into
mainfrom
codex/issue-77-composite-storage-scope
Aug 27, 2026
Merged

feat(runtime): combine global profile with workspace memory#103
Grivn merged 1 commit into
mainfrom
codex/issue-77-composite-storage-scope

Conversation

@Grivn

@Grivn Grivn commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

摘要 / Summary

新增独立的 runtimeUserScope,允许全局 USER.md 用户档案与工作区/自定义根中的 MEMORY.md 项目记忆同时投影和维护。默认仍让 USER.md 跟随 storageScope;设置页新增明确的双选项,并同步更新双语文档与设置截图。

Adds an independent runtimeUserScope so a global USER.md profile can be projected and maintained together with project MEMORY.md from a workspace or custom root. The default still follows storageScope; the Web settings surface, bilingual documentation, and settings screenshot now expose the opt-in split scope.

关联 Issue 或背景 / Related Issue or Context

Closes #77

涉及区域 / Affected Areas

  • Host 激活、Headless 或 bundle / Host activation, Headless, or bundle
  • 运行时记忆 / Runtime Memory
  • 项目档案 / Project Documents
  • 记忆体或 Provider / Memory Spaces or Providers
  • 子 Agent 或 Agent 工作流 / Subagent or Agent workflow
  • Web UI 或对话交互 / Web UI or conversation interaction
  • 设置、存储或安全 / Settings, storage, or security
  • CLI、RPC、命令或工具 / CLI, RPC, commands, or tools
  • 安装、更新或发布 / Installation, update, or release
  • 测试、构建或文档 / Tests, build, or documentation
  • 其他(请说明)/ Other (explain below)

PR 类型 / PR Type

  • 面向用户的功能或行为变更 / User-facing feature or behavior change
  • Bug 修复 / Bug fix
  • 增强或优化 / Enhancement or optimization
  • 兼容性适配 / Compatibility change
  • 维护或重构 / Maintenance or refactor
  • 测试或构建 / Tests or build

最新代码确认 / Latest Codebase Confirmation

  • 我已基于最新 main 分支开发,或在提交前已 rebase 或合并最新 main。 / I developed from the latest main, or rebased or merged the latest main before submitting.

同步命令 / Sync command:

git fetch origin --prune && git rebase origin/main

AI 编码披露 / AI Coding Disclosure

  • 完全 AI 编码:全部编程改动由 AI 产出,并由贡献者接受和审查。 / Fully AI-coded: AI produced all programming changes, which the contributor accepted and reviewed.
  • 部分 AI 辅助:AI 帮助编写或修改了部分内容。 / Partially AI-assisted: AI helped write or modify part of the change.
  • 未使用 AI 编码辅助。 / No AI coding assistance was used.

使用的 AI 模型 / AI model used: OpenAI GPT-5 Codex

使用的编码 Agent 工具 / Coding Agent tool used: Codex

仓库规范检查 / Repository Rules

  • 未修改 DSH 官方源码,未让 tsconfig 指向 DSH 源码 checkout,仅使用正式的 @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.
  • Client 与 Host 边界仍以 src/shared/contracts.ts 为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses src/shared/contracts.ts as the single source for wire DTOs.
  • 持久化格式、RPC 权限、路径或凭据处理的变更包含兼容或拒绝路径、安全分析和相应测试。 / Changes to persistence formats, RPC authority, paths, or credentials include compatibility or rejection paths, security analysis, and tests.
  • 没有提交 token、密钥、私有记忆、未脱敏日志或生成的 lib/ 文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generated lib/ files.
  • 用户可见文案和长期文档已同步维护中文与英文版本,命令、配置键和路径保持一致。 / User-facing copy and long-lived documentation are synchronized in Chinese and English, with matching commands, configuration keys, and paths.
  • 新增和修改的代码、注释、文档、提交信息不含 emoji。 / New and modified code, comments, documentation, and commits contain no emoji.

兼容性与数据安全 / Compatibility and Data Safety

runtimeUserScope 默认为 storage,因此现有安装、全局模式与旧配置保持原行为。选择 global 时,有效 Runtime 仅组合全局事实源的 target=user 与所选项目事实源的 target=memory;用户写入及 USER 压缩只写全局根,项目写入及 MEMORY 压缩只写项目根。两个 memories.json 及其 Markdown 投影均保持原格式,不复制、不合并、不删除;切回默认模式即可重新看到所选根原有的 USER 条目。工作区 Mnemon Pack 不会带入独立的全局 USER,避免跨项目备份泄漏;全局档案需要单独备份。回滚到旧版本时,新键被忽略,磁盘数据仍完整可读。

runtimeUserScope defaults to storage, preserving every existing installation, global mode, and legacy configuration. In global mode, the effective Runtime combines only target=user from the global source with target=memory from the selected project source. User writes and USER compaction route only to the global root; project writes and MEMORY compaction route only to the project root. Both memories.json files and Markdown projections retain their existing format, with no copy, merge, or deletion; switching back reveals the selected root's original USER entries. A workspace Mnemon Pack excludes the separate global USER to avoid cross-project backup leakage, so the global profile must be backed up separately. Older versions ignore the new key and all on-disk data remains readable.

本地验证 / Local Validation

执行的命令 / Commands run:

pnpm run verify

结果摘要 / Result summary:

  • 522 tests passed; the Windows-only smoke test was skipped on macOS.
  • TypeScript typecheck passed.
  • Deterministic build verified 106 files.
  • Isolated Headless profile activated with 35 tools, including 5 representative Mnemon tools.
  • Package contents (113 files; 1713490 unpacked bytes under the explicit 1720000-byte guard), 10 public Node entries, publint --strict, and AreTheTypesWrong passed.
  • Regression coverage verifies split-root projection, shared configured capacity limits across both authority roots, branch-scoped project filtering with an always-visible global profile, user/project write routing, maintenance planning, USER/MEMORY compaction, hidden-entry preservation, live Runtime wiring, settings mutation, and global USER exclusion from workspace Packs.

用户可见变更证据 / Local Feature Evidence

证据 / Evidence:

在隔离的 DSH Web profile、临时 DSH_HOME、临时 MNEMON_DATA_DIR 和临时工作区中运行本分支。左图是 v0.3.3 main 只有单一“记忆范围”的设置页;右图是本 PR 已保存并实时生效的“工作区 + 全局用户档案”,新增的独立范围清晰可见。保存后 Host 同时将 Mnemon Native 标记为工作区范围,设置状态显示“已保存并实时生效”。页面控制台无 warning/error;截图不含凭据、私有记忆或敏感路径。

The branch ran in an isolated DSH Web profile with temporary DSH_HOME, MNEMON_DATA_DIR, and workspace. The left image is v0.3.3 main, where settings expose only one Memory scope. The right image is this PR with the saved, live Workspace + Global user profile selection and its new independent scope. After Save, the Host also reported Mnemon Native as workspace-scoped and the settings status confirmed the live update. The browser console had no warnings/errors; screenshots contain no credentials, private memory, or sensitive paths.

v0.3.3 main: 单一范围 / one scope 本 PR:项目记忆 + 全局档案 / project memory + global profile
v0.3.3 settings before split profile scope saved workspace memory and global user profile settings

@Grivn
Grivn force-pushed the codex/issue-77-composite-storage-scope branch 2 times, most recently from a673669 to b5ea8ac Compare August 27, 2026 14:02
@Grivn
Grivn force-pushed the codex/issue-77-composite-storage-scope branch from b5ea8ac to 2f666f3 Compare August 27, 2026 15:09
@Grivn
Grivn merged commit cbfdd3d into main Aug 27, 2026
6 checks passed
@Grivn Grivn mentioned this pull request Aug 27, 2026
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: 如何同时管理全局记忆和项目记忆

1 participant