@namewta/skills-hub 0.1.28 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +23 -4
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/cli.mjs +5 -1
  4. package/install.mjs +172 -39
  5. package/licenses/nanobot-MIT.txt +21 -0
  6. package/package.json +2 -1
  7. package/scripts/init-persistence.mjs +26 -6
  8. package/scripts/persistence/home.md +11 -0
  9. package/skills/dev/dev-architecture/references/alternative-designs.md +1 -1
  10. package/skills/dev/dev-architecture/references/architecture-method.md +1 -1
  11. package/skills/dev/dev-archive/SKILL.md +1 -1
  12. package/skills/dev/dev-archive/references/parallel-retrospective.md +1 -1
  13. package/skills/dev/dev-benchmark/SKILL.md +1 -1
  14. package/skills/dev/dev-build/SKILL.md +1 -1
  15. package/skills/dev/dev-build/references/delegation.md +2 -2
  16. package/skills/dev/dev-build/references/implement-task-graph.md +4 -4
  17. package/skills/dev/dev-deploy/SKILL.md +2 -2
  18. package/skills/dev/dev-formal-verify/SKILL.md +1 -1
  19. package/skills/dev/dev-grill/references/decision-interview.md +1 -1
  20. package/skills/dev/dev-handoff/SKILL.md +1 -1
  21. package/skills/dev/dev-handoff/assets/handoff.md +2 -2
  22. package/skills/dev/dev-handoff/references/handoff-method.md +1 -1
  23. package/skills/dev/dev-handoff/references/safe-pause.md +1 -1
  24. package/skills/dev/dev-handoff/references/session-resume.md +1 -1
  25. package/skills/dev/dev-help/references/capabilities.md +0 -1
  26. package/skills/dev/dev-help/references/guide-setup.md +9 -9
  27. package/skills/dev/dev-help/references/harness-adapter.md +1 -1
  28. package/skills/dev/dev-help/references/help-method.md +3 -4
  29. package/skills/dev/dev-issue-fix/references/fix-method.md +1 -1
  30. package/skills/dev/dev-learn/references/module-exploration.md +1 -1
  31. package/skills/dev/dev-parallel/SKILL.md +2 -2
  32. package/skills/dev/dev-parallel/assets/worker-brief.md +1 -1
  33. package/skills/dev/dev-parallel/references/candidate-comparison.md +1 -1
  34. package/skills/dev/dev-parallel/references/parallel-coverage.md +1 -1
  35. package/skills/dev/dev-parallel/references/program-coordination.md +3 -3
  36. package/skills/dev/dev-plan/SKILL.md +1 -1
  37. package/skills/dev/dev-plan/references/plan-template.md +1 -1
  38. package/skills/dev/dev-plan/references/research-method.md +1 -1
  39. package/skills/dev/dev-program/SKILL.md +1 -1
  40. package/skills/dev/dev-program/assets/program.md +1 -1
  41. package/skills/dev/dev-program/references/batch.md +1 -1
  42. package/skills/dev/dev-review/references/adversarial-review.md +1 -1
  43. package/skills/dev/dev-review/references/eval.md +1 -1
  44. package/skills/dev/dev-review/references/two-axis-review.md +1 -1
  45. package/skills/dev/dev-setup/SKILL.md +3 -1
  46. package/skills/dev/dev-setup/assets/team.md +4 -0
  47. package/skills/dev/dev-setup/references/configure-team.md +13 -3
  48. package/skills/dev/dev-setup/references/formal-options.md +1 -1
  49. package/skills/dev/dev-verify/SKILL.md +1 -1
  50. package/skills/dev/dev-verify/references/verification-maintenance.md +1 -1
  51. package/skills/dev/dev-why/references/investigation-method.md +1 -1
  52. package/skills/dev/dev-workflow/SKILL.md +1 -2
  53. package/skills/dev/dev-workflow/references/autonomous-execution.md +1 -1
  54. package/skills/dev/dev-workflow/references/delegate-role.md +1 -1
  55. package/skills/dev/dev-workflow/references/execution-support.md +2 -2
  56. package/skills/dev/dev-workflow/references/operating-method.md +3 -3
  57. package/skills/dev/dev-workflow/references/phase-boundaries.md +3 -3
  58. package/skills/dev/dev-worktree/SKILL.md +1 -1
  59. package/skills/dev/dev-worktree/references/lifecycle.md +1 -1
  60. package/skills/dev/dev-worktree/references/worktree-cleanup.md +1 -1
  61. package/skills/home/home-doctor/SKILL.md +30 -0
  62. package/skills/home/home-doctor/references/diagnosis.md +40 -0
  63. package/skills/home/home-doctor/scripts/doctor.mjs +179 -0
  64. package/skills/home/home-history/SKILL.md +35 -0
  65. package/skills/home/home-history/assets/event.md +22 -0
  66. package/skills/home/home-history/assets/resumption.md +19 -0
  67. package/skills/home/home-history/references/history-method.md +90 -0
  68. package/skills/home/home-history/references/tools.md +57 -0
  69. package/skills/home/home-history/scripts/files.mjs +252 -0
  70. package/skills/home/home-history/scripts/history.mjs +184 -0
  71. package/skills/home/home-integrate/SKILL.md +23 -0
  72. package/skills/home/home-integrate/assets/integration.md +25 -0
  73. package/skills/home/home-integrate/references/integration.md +59 -0
  74. package/skills/home/home-knowledge/SKILL.md +37 -0
  75. package/skills/home/home-knowledge/assets/candidate.md +19 -0
  76. package/skills/home/home-knowledge/assets/exclusions.md +6 -0
  77. package/skills/home/home-knowledge/assets/topic.md +27 -0
  78. package/skills/home/home-knowledge/references/knowledge-method.md +55 -0
  79. package/skills/home/home-knowledge/references/maintenance.md +74 -0
  80. package/skills/home/home-knowledge/references/tools.md +55 -0
  81. package/skills/home/home-knowledge/scripts/files.mjs +252 -0
  82. package/skills/home/home-knowledge/scripts/knowledge.mjs +150 -0
  83. package/skills/home/home-map/SKILL.md +23 -0
  84. package/skills/home/home-map/assets/relations.md +25 -0
  85. package/skills/home/home-map/references/relations.md +60 -0
  86. package/skills/home/home-route/SKILL.md +32 -0
  87. package/skills/home/home-route/references/routing.md +48 -0
  88. package/skills/home/home-route/scripts/route.mjs +273 -0
  89. package/skills/home/home-setup/SKILL.md +46 -0
  90. package/skills/home/home-setup/assets/environment.md +18 -0
  91. package/skills/home/home-setup/assets/home-navigation.md +7 -0
  92. package/skills/home/home-setup/assets/local.schema.json +15 -0
  93. package/skills/home/home-setup/assets/preferences.md +16 -0
  94. package/skills/home/home-setup/assets/profile.md +19 -0
  95. package/skills/home/home-setup/assets/repos.schema.json +27 -0
  96. package/skills/home/home-setup/assets/team.md +24 -0
  97. package/skills/home/home-setup/references/configuration.md +71 -0
  98. package/skills/home/home-setup/references/environment.md +34 -0
  99. package/skills/home/home-setup/references/registry.md +110 -0
  100. package/skills/home/home-setup/scripts/registry.mjs +231 -0
  101. package/skills/home/home-workflow/SKILL.md +37 -0
  102. package/skills/home/home-workflow/assets/coordination.md +24 -0
  103. package/skills/home/home-workflow/assets/project-brief.md +25 -0
  104. package/skills/home/home-workflow/references/coordination.md +41 -0
  105. package/skills/home/home-workflow/references/delegation.md +86 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # skills-hub
2
2
 
3
- 按领域和独立技能分组组织的中文 Agent Skills,覆盖软件开发、系统维护、服务器运维和专门工具。每个技能包含使用入口、完整方法及所需模板、示例和脚本,可以单独安装,也可以按任务组合使用。
3
+ 按领域和独立技能分组组织的中文 Agent Skills,覆盖个人 Home、软件开发、系统维护、服务器运维和专门工具。每个技能包含使用入口、完整方法及所需模板、示例和脚本,可以单独安装,也可以按任务组合使用。
4
4
 
5
5
  ## 安装
6
6
 
@@ -16,6 +16,9 @@ npx @namewta/skills-hub list
16
16
  # 安装整个开发分组
17
17
  npx @namewta/skills-hub install --domain dev
18
18
 
19
+ # 构建、运营和管理个人 Home Repo
20
+ npx @namewta/skills-hub install --domain home
21
+
19
22
  # 单独安装 Issue 撰写与维护技能
20
23
  npx @namewta/skills-hub install --skill dev-issue
21
24
 
@@ -34,7 +37,7 @@ npx @namewta/skills-hub install --domain upstream-skills --dry-run
34
37
 
35
38
  交互界面默认勾选当前项目已安装的技能。使用 ↑/↓ 移动、Tab 展开或收拢领域、空格勾选、←/→ 翻页,按 Enter 查看安装确认。按 `/` 可搜索名称、分组或中文用途。非交互环境使用带 `--domain`、`--skill` 或 `--all` 的安装命令。
36
39
 
37
- 技能安装到当前项目的 `.agents/skills/<技能名>/`。重复安装时,相同内容保持不变,有差异的同名技能先备份再替换。安装器只复制文件,不执行技能中的工具;技能是否自动加载由所用 Agent 决定,也可以直接读取对应的 `SKILL.md`。
40
+ 技能的完整本体安装到当前项目的 `.agents/skills/<技能名>/`,同时建立 `.claude/skills/<技能名>` 到该本体的目录符号链接。两个入口读取同一份资源,更新一次即可。重复安装时,相同本体保持不变并补齐缺失链接,有差异的同名本体先备份再替换。别名位置有用户文件、目录或错向链接时先报告冲突。安装需要目录符号链接能力,不执行技能中的工具;自动发现仍由实际宿主决定,也可以显式读取 `SKILL.md`。
38
41
 
39
42
  全局命令、源码离线安装、备份恢复和旧版本迁移见[安装说明](docs/usage/installation.md)。
40
43
 
@@ -42,6 +45,7 @@ npx @namewta/skills-hub install --domain upstream-skills --dry-run
42
45
 
43
46
  | 分组 | 用途 | 常用入口 |
44
47
  | --- | --- | --- |
48
+ | `home` | Home Repo 构建、项目登记、用户配置、分层协作、持久知识和历史运营 | [home-workflow](skills/home/home-workflow/SKILL.md)、[home-setup](skills/home/home-setup/SKILL.md) |
45
49
  | `dev` | 需求澄清、设计、原型、计划、实现、验证、交付和项目知识 | [dev-help](skills/dev/dev-help/SKILL.md)、[dev-workflow](skills/dev/dev-workflow/SKILL.md) |
46
50
  | `system` | 主机检查、磁盘清理、代理、软件配置和终端协作 | [system-inspect](skills/system/system-inspect/SKILL.md) |
47
51
  | `ops` | 多项目、多服务器与共享服务的巡检、维护、恢复和操作历史 | [ops-workflow](skills/ops/ops-workflow/SKILL.md) |
@@ -86,11 +90,25 @@ npx @namewta/skills-hub install --domain upstream-skills --dry-run
86
90
 
87
91
  `upstream-skills` 只是安装分组,各技能按自身用途工作。中文说明与原版保持对应,代码、API、文件名和可执行命令保留。Archify 的完整交付检查需要 Chrome/Chromium;Modern Web Guidance 仍通过原 CLI 检索最新资料,返回内容可能是英文。运行前提与中文范围见[上游独立技能说明](docs/usage/upstream-skills.md)。
88
92
 
93
+ ## 个人 Home Repo
94
+
95
+ 在自己的 Home 仓库安装 `home` 后,可直接使用 `home-setup` 建立项目地图和按需配置,也可由 `home-workflow` 按任务调用八个方法。已有 clone 原地登记,不要求移动到 Home 下面。Agent、CLI、模型、思考参数和派遣方式由用户选择;保存配置不会启动任务。
96
+
97
+ Home 了解各项目基本背景和管理关系。涉及项目内部知识、代码、技能或验证时,由当地 Agent 进入实际项目读取和完成;项目可继续依当地规则派遣子 Agent。每层派遣记录归当地所选技能,Home 保留管理摘要与证据指针。Home 的现行知识、历史事件和当前执行状态各有明确位置,可由新会话读取普通 Markdown 接续。
98
+
99
+ ```text
100
+ 使用 home-setup:登记这些已有项目,沿用真实目录;先保存我明确选择的协作方式。
101
+ 使用 home-workflow:向项目 A 查询接口约定,让项目 B 验证兼容性,回报各自版本和证据。
102
+ 使用 home-history:查明当时为什么选择这个方案,再指出当前知识是否已经更正。
103
+ ```
104
+
105
+ 完整用法、方法归属和验证边界见 [Home 说明](docs/home/overview.md)。
106
+
89
107
  ## 项目结构
90
108
 
91
109
  | 位置 | 内容 |
92
110
  | --- | --- |
93
- | `skills/<domain>/<domain>-xxx/` | 按职责整合的开发、系统和运维技能 |
111
+ | `skills/<domain>/<domain>-xxx/` | 按职责整合的 Home、开发、系统和运维技能 |
94
112
  | `upstream-skills/zh-<原名>/` | 与原技能一一对应的独立中文运行包 |
95
113
  | `materials/` | 固定版本的来源原件、中文对照和逐文件运行映射 |
96
114
  | `docs/` | 使用说明、架构解释和维护规范 |
@@ -98,7 +116,7 @@ npx @namewta/skills-hub install --domain upstream-skills --dry-run
98
116
 
99
117
  安装器直接扫描两个运行根,完整复制所选技能的 `SKILL.md`、`references/`、`assets/`、`scripts/` 和其他配套资源。安装后所有技能位于 `.agents/skills/` 同一层级。`materials/` 供维护时对照,不参与技能发现或安装。
100
118
 
101
- 项目资料按领域保存:开发在 `.agents/dev/`,系统维护在 `.agents/system/`,运维在 `.agents/ops/`。安装 dev 或 system 技能时,安装器补根 `.gitignore` 的 `/temp/`;日志和截图等原件按需写到 `temp/dev/` 或 `temp/system/`。Change 的 `evidences/` 只放与 `tasks/` 完全同名的 `.md`,完成整体验收后才写 Change 根 `evidence.md`。独立上游分组不创建 `.agents/upstream-skills/`。详见[领域持久化与迁移](docs/reference/persistence-roots.md)。
119
+ 项目资料按领域保存:Home 在 `.agents/home/`,开发在 `.agents/dev/`,系统维护在 `.agents/system/`,运维在 `.agents/ops/`。安装 dev 或 system 技能时,安装器补根 `.gitignore` 的 `/temp/`;日志和截图等原件按需写到 `temp/dev/` 或 `temp/system/`。Change 的 `evidences/` 只放与 `tasks/` 完全同名的 `.md`,完成整体验收后才写 Change 根 `evidence.md`。独立上游分组不创建 `.agents/upstream-skills/`。详见[领域持久化与迁移](docs/reference/persistence-roots.md)。
102
120
 
103
121
  ## 文档导航
104
122
 
@@ -108,6 +126,7 @@ npx @namewta/skills-hub install --domain upstream-skills --dry-run
108
126
  | 安装、升级、恢复备份或迁移旧包 | [安装说明](docs/usage/installation.md) |
109
127
  | 组合开发技能,处理原型与交接 | [开发流程](docs/development/workflow.md)、[可交互原型](docs/development/prototype.md)、[开发交接](docs/development/handoff.md) |
110
128
  | 新建完整 Issue、更新正文或追加评论 | [Issue 撰写与维护](docs/development/issues.md) |
129
+ | 构建、运营和管理个人 Home | [Home 说明](docs/home/overview.md)、[方法归属](docs/home/method-ownership.md) |
111
130
  | 维护服务器和项目运行关系 | [运维说明](docs/operations/overview.md) |
112
131
  | 用 Herdr TUI 或 Core 启动 agent、派发任务和收取结果 | [Herdr 协作](docs/usage/herdr-coordination.md) |
113
132
  | 使用和更新独立中文技能 | [上游独立技能](docs/usage/upstream-skills.md) |
@@ -21,6 +21,7 @@
21
21
  | [openai/skills — Sentry](https://github.com/openai/skills/tree/main/skills/.curated/sentry),OpenAI 及贡献者 | `skills/.curated/sentry`;只读错误观测、范围核对与脱敏方法用于 `ops-inspect`。 | [Apache 2.0](licenses/openai-sentry-Apache-2.0.txt);[清单](materials/openai-sentry/manifest.tsv) |
22
22
  | [HumanLayer](https://github.com/humanlayer/humanlayer) / [Dex Horthy](https://github.com/dexhorthy),QueryTale, Inc. d/b/a HumanLayer | 既有 PR 视觉说明中的 show-me 方法;已作中文翻译和流程适配。NOTICE 中列出的其他程序组件未因此一并收录。 | [Apache 2.0](licenses/humanlayer-Apache-2.0.txt)、[NOTICE](licenses/humanlayer-NOTICE.txt) |
23
23
  | [abdiraimov-otabek/dashboard-design-skill](https://github.com/abdiraimov-otabek/dashboard-design-skill),Otabek Abdiraimov | 固定版本 `skills/dashboard-design/` 的 11 份 Markdown;完整翻译后独立提供 `zh-dashboard-design`。不包含来源仓库根部的示例页面、图片与 Claude 插件配置。 | [MIT](licenses/dashboard-design-skill-MIT.txt);[清单](materials/dashboard-design-skill/manifest.tsv) |
24
+ | [HKUDS/nanobot](https://github.com/HKUDS/nanobot),Xubin Ren 与 nanobot 贡献者 | `nanobot/skills/memory` 的完整短技能及中文底稿;采用按需读取、来源边界、已确认长期知识、读后更新、修复引用和历史检索方法。 | [MIT](licenses/nanobot-MIT.txt);[清单](materials/nanobot-memory/manifest.tsv) |
24
25
 
25
26
  ### 整合内容的修改范围
26
27
 
@@ -35,6 +36,7 @@
35
36
  - `system-herdr` 保留完整 CLI 方法;客户端启动示例与按 pane 的 task/report 文件通信属于本地扩展。
36
37
  - `system-herdr-core` 的运行版采用用户明确选用的触发条件,并增加客户端启动示例及按 Core 终端地址派发 task/report 的方法。许可原文与现有 Herdr Apache 2.0 文件字节相同。
37
38
  - ops 将调查、经验和只读观测方法适配到本领域的 registry、run、项目资料与实际工具能力。领域之间不因此产生自动安装依赖。
39
+ - home 采用 Matt 的直接负责人、上下文指针、按主题组织知识和交接资料方法,将来源中常驻会话、固定回顾频率和整套开发链改为用户按需选择的项目协作;现行知识、历史和用户配置分别由所属技能维护。nanobot 的记忆方法适配为 `.agents/home/` 下的 Markdown,保留项目当地知识归属,不接入其全局工作区、私有 history.jsonl、游标或 Dream 运行时。具体来源和研究取舍见 [Home 来源](docs/home/sources.md)。
38
40
  - issue 初始化、分诊和复现修复保留 pstack 较早 [Benny 自动化资料](https://github.com/cursor/plugins/tree/6b0300214a09fd6029cfb7077043125758cd1fd2/pstack/automations/benny)的方法;通用来源接口和项目配置属于本地适配,原 Slack 分支保留其身份核对与回读要求。
39
41
 
40
42
  ## 独立中文上游技能
@@ -123,6 +125,8 @@ Lucide 与 Unsplash 补充法律文件的来源 URL、取得时间、摘要和
123
125
 
124
126
  逐主机共享预算、未兑现峰值增长、允许新增量为零和 `.agents/dev/context/team/<team_name>.md` 是上述机制在本项目的适配,不是各来源共同制定的标准。v0.1.28 按用户纠正,删除其他阶段方法和帮助中的团队/模型配置转介、默认继承与通用模型选择提醒;保留独立判断、盲评覆盖和资源准入机制。来源证据与未采用事项见[研究记录](.agents/dev/changes/2026-11-24-resource-aware-setup/research.md)。
125
127
 
128
+ v0.1.29 继续按用户要求,移除其他 dev 运行技能对环境初始化技能的提及。环境与资源信息改为直接复用已有记录的有效部分,缺失或过期时依据实际执行主机核对;模板不要求预先建立环境文件。该调整保留资源预留、独立判断、覆盖和工作树回收机制,不改变上游来源版本或已复核对象。
129
+
126
130
  ### Issue 撰写与维护
127
131
 
128
132
  `dev-issue` 将以下资料作为正文完整性、仓库上下文和远程写入语义的对照,自行组织面向 GitHub 的创建、更新与评论流程。完整规格和本地切片方法继续分别由 `dev-spec`、`dev-plan` 维护,不复制其正文或增加第二个材料归属。以下网页和较新源码未整篇翻译收录,也不改变材料父清单的固定版本。
package/cli.mjs CHANGED
@@ -42,6 +42,7 @@ export async function interactive({ argv = [], project = process.cwd(), ui = pro
42
42
  }
43
43
  }
44
44
  ui.note(project, '目标项目(技能写入 .agents/skills/)');
45
+ ui.note('每个所选技能在 .claude/skills/ 建立指向同仓 .agents/skills/ 的目录符号链接。需要目录 symlink 权限;同名真实目录、文件或外来链接会阻止安装。', '技能入口');
45
46
  const installer = createInstaller();
46
47
  const skills = installer.catalog();
47
48
  const initialNames = installer.installedNames(skills, project);
@@ -50,7 +51,7 @@ export async function interactive({ argv = [], project = process.cwd(), ui = pro
50
51
  const selected = select(skills, [], names);
51
52
  if (!selected.length) throw new Error('请至少勾选一个技能。');
52
53
  ui.note(formatSummary(selected.map(skill => skill.name)), `${selected.length} 个技能`);
53
- if (selected.some(skill => ['dev', 'system', 'ops'].includes(skill.domain))) {
54
+ if (selected.some(skill => ['dev', 'system', 'ops', 'home'].includes(skill.domain))) {
54
55
  ui.note('将补齐所选领域的持久化目录和简短 AGENTS.md;固定模板自动更新,业务记录保留,预览不写入。', '领域初始化');
55
56
  }
56
57
  if (selected.some(skill => skill.domain === 'dev' || skill.domain === 'system')) {
@@ -59,6 +60,9 @@ export async function interactive({ argv = [], project = process.cwd(), ui = pro
59
60
  if (selected.some(skill => skill.domain === 'dev')) {
60
61
  ui.note('如缺少规则,将在项目根 .gitignore 追加 /.agents/dev/worktree/。', '开发工作树');
61
62
  }
63
+ if (selected.some(skill => skill.domain === 'home')) {
64
+ ui.note('如缺少规则,将补项目根 .gitignore 的 /.agents/home/local.json 默认规则,保留项目例外;Home 业务资料由相应技能按需创建。', 'Home 本机映射');
65
+ }
62
66
  if (!await ask(ui.confirm({ message: dryRun ? '检查安装计划?(不写入文件)' : '安装或更新以上技能?(有差异的现有技能会先备份)', initialValue: true }))) {
63
67
  ui.cancel('已取消,未修改文件。'); return 0;
64
68
  }
package/install.mjs CHANGED
@@ -132,6 +132,16 @@ export function createInstaller({ repository = repositoryRoot, fsOps = fs } = {}
132
132
  }
133
133
  }
134
134
 
135
+ function checkDirectoryPath(project, directory) {
136
+ if (!isWithin(directory, project)) throw new InstallError(`Destination is outside the current project: ${directory}`);
137
+ let current = project;
138
+ checkDirectory(current);
139
+ for (const part of path.relative(project, directory).split(path.sep).filter(Boolean)) {
140
+ current = path.join(current, part);
141
+ checkDirectory(current);
142
+ }
143
+ }
144
+
135
145
  function installedNames(skills, project) {
136
146
  const agents = path.join(project, '.agents');
137
147
  const target = path.join(agents, 'skills');
@@ -142,6 +152,53 @@ export function createInstaller({ repository = repositoryRoot, fsOps = fs } = {}
142
152
  }).map(({ name }) => name);
143
153
  }
144
154
 
155
+ function planLink(name, project, canonical) {
156
+ const relative = `.claude/skills/${name}`;
157
+ const destination = path.join(project, '.claude', 'skills', name);
158
+ const target = path.relative(path.dirname(destination), canonical);
159
+ const stat = exists(destination);
160
+ if (!stat) return { path: relative, destination, target, kind: 'link' };
161
+ if (!stat.isSymbolicLink()) {
162
+ throw new InstallError(`Claude skill entry conflict: ${destination} is not a symlink. Expected a directory symlink to ${canonical}; existing content was not changed.`);
163
+ }
164
+ const previous = fsOps.readlinkSync(destination);
165
+ const resolved = path.resolve(path.dirname(destination), previous);
166
+ // 预期本体尚未安装时,准确指向它的断链仍是可保留的入口。
167
+ let matches = path.relative(resolved, canonical) === '';
168
+ if (exists(canonical)) {
169
+ try {
170
+ matches = path.relative(fsOps.realpathSync(destination), fsOps.realpathSync(canonical)) === '' &&
171
+ fsOps.statSync(destination).isDirectory();
172
+ }
173
+ catch (error) {
174
+ if (!['ENOENT', 'ENOTDIR', 'ELOOP'].includes(error.code)) throw error;
175
+ matches = false;
176
+ }
177
+ }
178
+ if (!matches) {
179
+ throw new InstallError(`Claude skill entry conflict: ${destination} -> ${previous}. Expected ${canonical}; the existing link and its target were not changed.`);
180
+ }
181
+ return { path: relative, destination, target: previous, kind: 'preserved' };
182
+ }
183
+
184
+ function checkLinkParents(project) {
185
+ for (const relative of ['.agents', '.agents/skills', '.claude', '.claude/skills']) {
186
+ checkDirectory(path.join(project, relative));
187
+ }
188
+ }
189
+
190
+ function verifyLink(action, project) {
191
+ checkLinkParents(project);
192
+ checkDirectory(action.destination);
193
+ const actual = planLink(action.name, project, action.destination);
194
+ if (actual.kind !== 'preserved' || actual.target !== action.link.target ||
195
+ path.relative(fsOps.realpathSync(actual.destination), fsOps.realpathSync(action.destination)) !== '') {
196
+ throw new InstallError(`Claude skill link verification failed: ${action.link.destination}`);
197
+ }
198
+ const manifest = path.join(actual.destination, 'SKILL.md');
199
+ if (!exists(manifest)?.isFile()) throw new InstallError(`Expected a regular skill entry: ${manifest}`);
200
+ }
201
+
145
202
  function plan(skills, project, replace = true) {
146
203
  const actualProject = fsOps.realpathSync(project);
147
204
  for (const source of [skillRoot, upstreamRoot, licenseRoot]) {
@@ -149,41 +206,60 @@ export function createInstaller({ repository = repositoryRoot, fsOps = fs } = {}
149
206
  throw new InstallError("Run from the target project, outside this repository's source skills and licenses directories (including upstream-skills).");
150
207
  }
151
208
  }
209
+ project = actualProject;
152
210
  const agents = path.join(project, '.agents');
153
211
  const target = path.join(agents, 'skills');
154
212
  for (const filename of [agents, target, path.join(agents, '.skills-hub-backups')]) checkDirectory(filename);
213
+ checkLinkParents(project);
155
214
  const actions = [];
156
215
  const conflicts = [];
157
216
  const packages = skills.map((skill) => ({ source: skill.source, name: skill.name, destination: path.join(target, skill.name) }));
158
217
  for (const item of packages) {
159
- checkDirectory(item.destination);
160
- let kind;
161
- if (!exists(item.destination)) kind = 'install';
162
- else if (treeDigest(item.source, fsOps) === treeDigest(item.destination, fsOps)) kind = 'unchanged';
163
- else if (replace) kind = 'replace';
164
- else { conflicts.push(item.name); continue; }
165
- actions.push({ ...item, kind });
218
+ try {
219
+ checkDirectory(item.destination);
220
+ let kind;
221
+ if (!exists(item.destination)) kind = 'install';
222
+ else if (treeDigest(item.source, fsOps) === treeDigest(item.destination, fsOps)) kind = 'unchanged';
223
+ else if (replace) kind = 'replace';
224
+ else throw new InstallError(`Existing packages differ: ${item.name}. Inspect them first; --replace saves backups before replacement.`);
225
+ actions.push({ ...item, kind, link: planLink(item.name, project, item.destination) });
226
+ } catch (error) { conflicts.push(error.message); }
166
227
  }
228
+ try { planPersistence(skills, project, fsOps); }
229
+ catch (error) { conflicts.push(error.message); }
167
230
  if (conflicts.length) {
168
- throw new InstallError(`Existing packages differ: ${conflicts.join(', ')}. No skills were changed. Inspect them first; --replace saves backups before replacement.`);
231
+ throw new InstallError(`Installation conflicts; no files were changed:\n${conflicts.join('\n')}`);
169
232
  }
170
- planPersistence(skills, project, fsOps);
171
233
  return actions;
172
234
  }
173
235
 
174
236
  function persistencePlan(skills, project) { return planPersistence(skills, project, fsOps); }
175
237
 
176
238
  function apply(skills, project, replace = true) {
239
+ project = fsOps.realpathSync(project);
177
240
  let actions = plan(skills, project, replace);
178
241
  let persistence = persistencePlan(skills, project);
179
- if (actions.every((action) => action.kind === 'unchanged') && persistence.every(item => item.action === 'preserve')) {
242
+ if (actions.every((action) => action.kind === 'unchanged' && action.link.kind === 'preserved') && persistence.every(item => item.action === 'preserve')) {
243
+ for (const action of actions) verifyLink(action, project);
180
244
  return { actions, backup: null, persistence };
181
245
  }
182
246
  const agents = path.join(project, '.agents');
183
- fsOps.mkdirSync(agents, { recursive: true });
184
247
  const locks = [];
248
+ let staging = null;
249
+ let backup = null;
250
+ const journal = { skills: [], persistence: [], links: [], directories: [] };
251
+ const recoveryErrors = [];
252
+ let failure = null;
253
+ function ensureDirectory(directory) {
254
+ checkDirectoryPath(project, directory);
255
+ if (!exists(directory)) {
256
+ fsOps.mkdirSync(directory);
257
+ journal.directories.push(directory);
258
+ }
259
+ }
185
260
  try {
186
- // 先取得旧版共用锁,使改名前后的安装器不会同时写入 .agents/skills。
261
+ ensureDirectory(agents);
262
+ // 先取得旧版共用锁;链接补建也与现有安装事务互斥。
187
263
  for (const name of ['.skills-wta-install.lock', '.skills-hub-install.lock']) {
188
264
  const lock = path.join(agents, name);
189
265
  try { fsOps.mkdirSync(lock); }
@@ -193,28 +269,21 @@ export function createInstaller({ repository = repositoryRoot, fsOps = fs } = {}
193
269
  }
194
270
  locks.push(lock);
195
271
  }
196
- } catch (error) {
197
- for (const lock of locks.reverse()) fsOps.rmdirSync(lock);
198
- throw error;
199
- }
200
- let staging = null;
201
- let backup = null;
202
- const completed = [];
203
- const persistenceJournal = [];
204
- try {
205
272
  actions = plan(skills, project, replace);
206
273
  persistence = persistencePlan(skills, project);
207
- staging = fsOps.mkdtempSync(path.join(agents, '.skills-hub-stage-'));
274
+ if (actions.some(action => action.kind !== 'unchanged')) staging = fsOps.mkdtempSync(path.join(agents, '.skills-hub-stage-'));
208
275
  for (const action of actions) {
209
276
  if (action.kind !== 'unchanged') {
210
277
  fsOps.cpSync(action.source, path.join(staging, action.name), { recursive: true, errorOnExist: true, force: false });
211
278
  }
212
279
  }
213
- fsOps.mkdirSync(path.join(agents, 'skills'), { recursive: true });
280
+ ensureDirectory(path.join(agents, 'skills'));
214
281
  if (actions.some((action) => action.kind === 'replace')) {
215
282
  const stamp = new Date().toISOString().replace(/[-:]/g, '').replace(/\.\d{3}Z$/, 'Z');
216
- backup = path.join(agents, '.skills-hub-backups', `${stamp}-${randomUUID().replaceAll('-', '').slice(0, 8)}`);
217
- fsOps.mkdirSync(backup, { recursive: true });
283
+ const backups = path.join(agents, '.skills-hub-backups');
284
+ ensureDirectory(backups);
285
+ backup = path.join(backups, `${stamp}-${randomUUID().replaceAll('-', '').slice(0, 8)}`);
286
+ ensureDirectory(backup);
218
287
  }
219
288
  for (const action of actions) {
220
289
  if (action.kind === 'unchanged') continue;
@@ -222,29 +291,89 @@ export function createInstaller({ repository = repositoryRoot, fsOps = fs } = {}
222
291
  if (action.kind === 'replace') {
223
292
  previous = path.join(backup, action.name);
224
293
  fsOps.renameSync(action.destination, previous);
225
- completed.push({ destination: action.destination, previous });
294
+ journal.skills.push({ destination: action.destination, previous });
226
295
  }
227
296
  fsOps.renameSync(path.join(staging, action.name), action.destination);
228
- if (previous === null) completed.push({ destination: action.destination, previous });
297
+ if (previous === null) journal.skills.push({ destination: action.destination, previous });
298
+ }
299
+ applyPersistence(persistence, project, fsOps, journal.persistence);
300
+ ensureDirectory(path.join(project, '.claude'));
301
+ ensureDirectory(path.join(project, '.claude', 'skills'));
302
+ for (const action of actions) {
303
+ checkLinkParents(project);
304
+ checkDirectory(action.destination);
305
+ const current = planLink(action.name, project, action.destination);
306
+ if (current.kind !== action.link.kind || current.target !== action.link.target) {
307
+ throw new InstallError(`Claude skill entry changed during installation: ${action.link.destination}`);
308
+ }
309
+ if (action.link.kind === 'link') {
310
+ try { fsOps.symlinkSync(action.link.target, action.link.destination, 'dir'); }
311
+ catch (error) {
312
+ throw new InstallError(`Cannot create directory symlink ${action.link.destination} -> ${action.link.target}: ${error.code ?? ''} ${error.message}. Directory symlink support is required; no junction or copy fallback is used.`);
313
+ }
314
+ journal.links.push(action.link);
315
+ }
316
+ verifyLink(action, project);
317
+ }
318
+ for (const action of actions) {
319
+ verifyLink(action, project);
320
+ if (treeDigest(action.source, fsOps) !== treeDigest(action.destination, fsOps)) {
321
+ throw new InstallError(`Installed skill verification failed: ${action.destination}`);
322
+ }
323
+ }
324
+ if (persistencePlan(skills, project).some(item => item.action !== 'preserve')) {
325
+ throw new InstallError('Project initialization verification failed; check the reported paths and retry.');
229
326
  }
230
- applyPersistence(persistence, project, fsOps, persistenceJournal);
231
- return { actions, backup, persistence };
232
327
  } catch (error) {
233
- const recoveryErrors = rollbackPersistence(persistenceJournal, fsOps);
234
- for (const item of completed.reverse()) {
328
+ failure = error;
329
+ for (const link of [...journal.links].reverse()) {
235
330
  try {
331
+ checkLinkParents(project);
332
+ const stat = exists(link.destination);
333
+ if (!stat) continue;
334
+ if (!stat.isSymbolicLink() || fsOps.readlinkSync(link.destination) !== link.target) {
335
+ throw new InstallError('The created link changed; preserving the current entry for manual recovery.');
336
+ }
337
+ fsOps.unlinkSync(link.destination);
338
+ } catch (recoveryError) { recoveryErrors.push(`${link.destination}: ${recoveryError.message}`); }
339
+ }
340
+ recoveryErrors.push(...rollbackPersistence(journal.persistence, fsOps));
341
+ for (const item of [...journal.skills].reverse()) {
342
+ try {
343
+ checkDirectoryPath(project, path.dirname(item.destination));
344
+ if (item.previous !== null) checkDirectoryPath(project, path.dirname(item.previous));
236
345
  if (exists(item.destination)) fsOps.rmSync(item.destination, { recursive: true });
237
346
  if (item.previous !== null) fsOps.renameSync(item.previous, item.destination);
238
347
  } catch (recoveryError) { recoveryErrors.push(`${item.destination}: ${recoveryError.message}`); }
239
348
  }
349
+ } finally {
350
+ if (staging !== null) {
351
+ try { checkDirectoryPath(project, path.dirname(staging)); fsOps.rmSync(staging, { recursive: true, force: true }); }
352
+ catch (error) { recoveryErrors.push(`${staging}: ${error.message}`); }
353
+ }
354
+ for (const lock of locks.reverse()) {
355
+ try { checkDirectoryPath(project, lock); fsOps.rmdirSync(lock); }
356
+ catch (error) { recoveryErrors.push(`${lock}: ${error.message}`); }
357
+ }
358
+ if (failure) {
359
+ for (const directory of [...journal.directories].reverse()) {
360
+ try { checkDirectoryPath(project, directory); fsOps.rmdirSync(directory); }
361
+ catch (error) {
362
+ if (!['ENOENT', 'ENOTEMPTY', 'EEXIST'].includes(error.code)) recoveryErrors.push(`${directory}: ${error.message}`);
363
+ }
364
+ }
365
+ }
366
+ }
367
+ if (failure) {
240
368
  if (recoveryErrors.length) {
241
- throw new InstallError(`Installation failed: ${error.message}. Some files need manual recovery.${backup ? ` Keep ${backup}.` : ''} ${recoveryErrors.join('; ')}`);
369
+ throw new InstallError(`Installation failed: ${failure.message}. Some files need manual recovery.${backup ? ` Keep ${backup}.` : ''} ${recoveryErrors.join('; ')}`);
242
370
  }
243
- throw new InstallError(`Installation failed; changes to skill directories and project initialization files were rolled back: ${error.message}`);
244
- } finally {
245
- if (staging !== null) fsOps.rmSync(staging, { recursive: true, force: true });
246
- for (const lock of locks.reverse()) fsOps.rmdirSync(lock);
371
+ throw new InstallError(`Installation failed; changes to skill directories, Claude links and project initialization files were rolled back: ${failure.message}`);
372
+ }
373
+ if (recoveryErrors.length) {
374
+ throw new InstallError(`Installation files were updated, but temporary artifacts need manual cleanup: ${recoveryErrors.join('; ')}`);
247
375
  }
376
+ return { actions, backup, persistence };
248
377
  }
249
378
  return { catalog, installedNames, plan, apply, persistencePlan };
250
379
  }
@@ -254,10 +383,12 @@ export function catalog(repository = repositoryRoot) { return createInstaller({
254
383
  const usage = `Usage: skills-hub <list|install> [--domain DOMAIN ...] [--skill NAME ...] [--all]
255
384
  skills-hub install <selection> [--dry-run] [--replace]
256
385
 
257
- Install complete skills into the current project's .agents/skills/. No destination option.
386
+ Install complete skills into the current project's .agents/skills/ and link each selected .claude/skills/<name> to that same skill. No destination option.
387
+ Directory symlink support is required, including on Windows; conflicting Claude entries are never replaced.
258
388
  --domain upstream-skills selects the independent Chinese upstream skills; it creates no domain navigation.
259
- Selected dev/system/ops domains initialize domain AGENTS.md navigation; managed templates are updated and business records are preserved.
389
+ Selected dev/system/ops/home domains initialize domain AGENTS.md navigation; managed templates are updated and business records are preserved.
260
390
  Dev or system selections add /temp/ to the project .gitignore when missing; dev also adds /.agents/dev/worktree/.
391
+ Home selections add /.agents/home/local.json to .gitignore; Home business records are created on demand by their owning skills.
261
392
  --dry-run Preview without writing files.
262
393
  Differing selected skills are backed up and replaced automatically.
263
394
  --replace Accepted for compatibility; replacement is already the default.
@@ -311,8 +442,10 @@ export function main(argv = process.argv.slice(2), { repository = repositoryRoot
311
442
  ? { actions: installer.plan(selected, actualProject, args.replace), backup: null, persistence: installer.persistencePlan(selected, actualProject) }
312
443
  : installer.apply(selected, actualProject, args.replace);
313
444
  stdout(`Destination: ${path.join(actualProject, '.agents', 'skills')}`);
445
+ stdout(`Claude entries: ${path.join(actualProject, '.claude', 'skills')}`);
314
446
  for (const action of actions) {
315
- stdout(`${args.dryRun ? 'would ' : ''}${action.kind.padEnd(9)} ${action.name}`);
447
+ const prefix = args.dryRun ? 'would ' : '';
448
+ stdout(`${prefix}${action.kind.padEnd(9)} ${action.name} | ${prefix}${action.link.kind.padEnd(9)} ${action.link.path} -> ${action.link.target}`);
316
449
  }
317
450
  for (const item of persistence) stdout(`${args.dryRun ? 'would ' : ''}${item.action.padEnd(9)} ${item.path}`);
318
451
  if (backup !== null) stdout(`Backups: ${backup}`);
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Xubin Ren and the nanobot contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namewta/skills-hub",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "独立中文 Agent Skills:按领域安装,覆盖开发交付、项目知识与系统维护。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,6 +29,7 @@
29
29
  "check:package": "node scripts/check-package.mjs",
30
30
  "check:statechart": "node scripts/check-statechart-replay.mjs",
31
31
  "check:upstream": "node scripts/check-upstream-runtime.mjs",
32
+ "check:claude": "node scripts/check-claude-discovery.mjs",
32
33
  "test": "node scripts/check.mjs --full",
33
34
  "build": "node scripts/check.mjs --full",
34
35
  "hooks": "node scripts/install-hooks.mjs"
@@ -15,6 +15,7 @@ const targets = [
15
15
  ['dev', 'context', '.agents/dev/context'],
16
16
  ['system', 'system', '.agents/system'],
17
17
  ['ops', 'ops', '.agents/ops'],
18
+ ['home', 'home', '.agents/home'],
18
19
  ];
19
20
 
20
21
  function inspect(project, relative, fsOps) {
@@ -42,11 +43,12 @@ function ensureIgnoreRules(previous, rules) {
42
43
 
43
44
  const eol = original.match(/\r?\n/)?.[0] ?? '\n';
44
45
  let content = previous;
45
- if (original && missing.includes('/temp/')) {
46
- // 默认规则先于用户规则,不覆盖项目已有的重新纳入规则。
46
+ const defaults = missing.filter(rule => ['/temp/', '/.agents/home/local.json'].includes(rule));
47
+ if (original && defaults.length) {
48
+ // 新默认规则先于用户规则,保留用户对运行原件和本机映射的明确例外。
47
49
  const bom = text.startsWith('\uFEFF') ? 3 : 0;
48
- content = Buffer.concat([previous.subarray(0, bom), Buffer.from('/temp/' + eol), previous.subarray(bom)]);
49
- missing.splice(missing.indexOf('/temp/'), 1);
50
+ content = Buffer.concat([previous.subarray(0, bom), Buffer.from(defaults.join(eol) + eol), previous.subarray(bom)]);
51
+ for (const rule of defaults) missing.splice(missing.indexOf(rule), 1);
50
52
  }
51
53
  if (!missing.length) return content;
52
54
  const separator = original && !original.endsWith('\n') ? eol : '';
@@ -63,6 +65,7 @@ export function planPersistence(skills, project, fsOps = fs) {
63
65
  const ignoreRules = [];
64
66
  if (domains.has('dev')) ignoreRules.push('/.agents/dev/worktree/');
65
67
  if (domains.has('dev') || domains.has('system')) ignoreRules.push('/temp/');
68
+ if (domains.has('home')) ignoreRules.push('/.agents/home/local.json');
66
69
  if (ignoreRules.length) {
67
70
  entries.push(['.gitignore', previous => ensureIgnoreRules(previous ?? Buffer.alloc(0), ignoreRules)]);
68
71
  }
@@ -95,11 +98,11 @@ export function applyPersistence(plan, project, fsOps = fs, journal = []) {
95
98
  const directory = path.join(project, ...parts.slice(0, index + 1));
96
99
  if (!fsOps.lstatSync(directory, { throwIfNoEntry: false })) {
97
100
  fsOps.mkdirSync(directory);
98
- journal.push({ path: directory, directory: true });
101
+ journal.push({ project, path: directory, directory: true });
99
102
  }
100
103
  }
101
104
  const descriptor = fsOps.openSync(item.destination, item.action === 'update' ? 'r+' : 'wx');
102
- journal.push({ path: item.destination, directory: false, previous: item.previous });
105
+ journal.push({ project, path: item.destination, directory: false, previous: item.previous });
103
106
  try {
104
107
  fsOps.writeFileSync(descriptor, item.content);
105
108
  fsOps.ftruncateSync(descriptor, item.content.length);
@@ -112,6 +115,23 @@ export function rollbackPersistence(journal, fsOps = fs) {
112
115
  const errors = [];
113
116
  for (const item of [...journal].reverse()) {
114
117
  try {
118
+ // 回滚也不跟随安装期间被替换的父目录或文件链接。
119
+ const relative = path.relative(item.project, item.path);
120
+ if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
121
+ throw new Error('回滚路径不在原项目内:' + item.path);
122
+ }
123
+ let current = item.project;
124
+ const parts = relative.split(path.sep);
125
+ for (let index = -1; index < parts.length; index += 1) {
126
+ if (index >= 0) current = path.join(current, parts[index]);
127
+ const stat = fsOps.lstatSync(current, { throwIfNoEntry: false });
128
+ if (!stat) continue;
129
+ if (stat.isSymbolicLink()) throw new Error('回滚拒绝符号链接:' + current);
130
+ const directory = index < parts.length - 1 || item.directory;
131
+ if (directory ? !stat.isDirectory() : !stat.isFile()) {
132
+ throw new Error('回滚路径类型已变化:' + current);
133
+ }
134
+ }
115
135
  if (item.previous) fsOps.writeFileSync(item.path, item.previous);
116
136
  else if (item.directory) fsOps.rmdirSync(item.path);
117
137
  else fsOps.unlinkSync(item.path);
@@ -0,0 +1,11 @@
1
+ # Home 资料
2
+
3
+ - home-setup 管理 repos.json、派生 repos.md、本机 local.json 与 context/ 配置。
4
+ - home-map 管理 relations.md。
5
+ - home-knowledge 管理 notes/、inbox/、archive/notes/、exclusions.md 及知识索引。
6
+ - home-history 管理 history/、archive/history/ 及历史索引。
7
+ - home-workflow 管理 coordination/ 摘要;home-route 定位,home-integrate 协调联合验证,home-doctor 只读诊断。
8
+
9
+ 资料按需建立。项目内部资料由当地 Agent 读取,每层派遣记录归当地所选方法。用户选择决定工具与配置,保存不等于启动。历史不代替当前状态,跨 owner 更正和忘记由 workflow 协调。
10
+
11
+ 自定义规则放根 AGENTS.md。
@@ -18,7 +18,7 @@
18
18
 
19
19
  ### 2. 启动子智能体
20
20
 
21
- 有并行能力时,先按 `dev-setup` 从同一执行主机预算取得会话预留,让独立子智能体按名额并行或分批使用全新上下文提出候选;没有则自行依次推导。为存在重要取舍的设计至少比较两个**结构不同**的接口,下面列出三到四种可选优化方向,不强制固定代理数量。
21
+ 有并行能力时,按执行主机当前可用资源与已有预留分配会话名额,在工具上限内让独立子智能体并行或分批使用全新上下文提出候选;没有则自行依次推导。为存在重要取舍的设计至少比较两个**结构不同**的接口,下面列出三到四种可选优化方向,不强制固定代理数量。
22
22
 
23
23
  给每个子智能体一份独立技术简报,包括文件路径、耦合细节、[依赖与加深](dependency-design.md) 中的依赖类别,以及接缝后面包含什么。这份简报独立于第 1 步面向用户的问题空间说明。给每个智能体不同设计约束:
24
24
 
@@ -22,7 +22,7 @@
22
22
 
23
23
  带着设计任务和阶段 A 背景,按[替代设计](alternative-designs.md)独立探索候选。将[候选任务提示](alternative-brief.md)交给每个执行者。
24
24
 
25
- 有可用子智能体时,先按 `dev-setup` 从同一执行主机预算取得会话预留,再按名额一起或分批分配独立上下文与隔离写入位置;没有时自行依次推导不同结构。
25
+ 有可用子智能体时,按执行主机当前可用资源、已有预留和工具上限分配会话名额,再一起或分批分配独立上下文与隔离写入位置;没有时自行依次推导不同结构。
26
26
 
27
27
  设计两次。综合前至少要求两个结构不同的候选方案,即使第一个看起来已足够。通过比较覆盖真正不同的设计空间。需要整体形态的替代方案,而非同一形态内部的局部修补。
28
28
 
@@ -39,7 +39,7 @@ description: 在交付复盘、归档需求或整理项目记忆时,核对代
39
39
  5. **清理引用与导航。** 更新当前文档、`AGENTS.md` 和 `.agents/dev/notes/index.md` 的相关入口。索引只放主题、适用范围和链接,不再复制正文。修复移动/删除文件的入链;历史文件只有在明确引用过去时才作为目标。
40
40
  6. **归档并交接。** 原型 HTML、样式、脚本、资产及确认记录属于长期证据,一同保留;不得当作临时草稿清理。仍约束后续开发的确认版本从现役文档继续可达。按 change 收尾方法,在用户已授权范围内将已结束需求移入结果目录并增加主类型前缀,保留原创建日期,检查目标冲突、目录深度变化造成的相对路径和已知入链;不覆盖、不重复加前缀。有独立历史价值的退役笔记仍移到 archive/notes 并标明退役时间和当前替代位置。核对相对链接、原始证据和未完成事项,返回真实路径和结果。普通归档不要求另走审批流程;授权不足仅阻塞超出范围的操作。
41
41
 
42
- 收尾时核对本任务仍占用的 Agent、服务、构建、浏览器与工作树。已完成且已合并到直接父分支的检出交 `dev-worktree` 统一核实进程归属并回收,结果交 `dev-setup` 刷新环境预算。仍运行、保留或回收失败的对象继续计入占用;移动 change 文档不等于释放运行资源,不删除用户或其他任务实例。
42
+ 收尾时核对本任务仍占用的 Agent、服务、构建、浏览器与工作树。已完成且已合并到直接父分支的检出交 `dev-worktree` 统一核实进程归属并回收,按实际释放结果更新已有环境记录(如 `.agents/dev/context/environment.md`)与资源预留。仍运行、保留或回收失败的对象继续计入占用;移动 change 文档不等于释放运行资源,不删除用户或其他任务实例。
43
43
 
44
44
  ## 判断依据
45
45
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  ## 2. 完成三个审查视角
14
14
 
15
- 有独立子 Agent 能力时,先按 `dev-setup` 从同一执行主机预算取得会话预留,按名额并行或分批完成以下三个互补视角。所有评审只读,外部工具仅用于核验本次记录明确引用且任务范围内的背景。没有并行能力时按相同视角依次审阅,不伪造子任务运行结果。
15
+ 有独立子 Agent 能力时,按执行主机当前可用资源、已有预留和工具上限分配会话名额,并行或分批完成以下三个互补视角。所有评审只读,外部工具仅用于核验本次记录明确引用且任务范围内的背景。没有并行能力时按相同视角依次审阅,不伪造子任务运行结果。
16
16
 
17
17
  | 视角 | 任务 | 提示模板 |
18
18
  | --- | --- | --- |
@@ -5,7 +5,7 @@ description: 以延迟、吞吐、资源使用或指定指标为目标,诊断
5
5
 
6
6
  # 性能数字必须能被解释
7
7
 
8
- 先写清待作决定、真实工作负载、指标、预期方向和能改变决定的差异,再测量。一次观察、统计比较、持续优化与只读取证有不同交付边界。启动基准、重型采集或分析子代理前,按 `dev-setup` 从同一执行主机预算取得会话与重任务预留;额度不足时排队或分批,保留原定测量条件。
8
+ 先写清待作决定、真实工作负载、指标、预期方向和能改变决定的差异,再测量。一次观察、统计比较、持续优化与只读取证有不同交付边界。启动基准、重型采集或分析子代理前,复用 `.agents/dev/context/environment.md` 等已有记录中仍适用的预算与预留,缺失或过期的部分按实际执行主机核对,再分配会话与重任务名额;额度不足时排队或分批,保留原定测量条件。
9
9
 
10
10
  性能目标由本技能持续处理,已有调试中的负载、基线和复现证据直接复用。输出错误、崩溃等功能缺陷以 `dev-debug` 为主;本技能按需要核对测量中的正确性。
11
11