@givolt/i3-composer-agent 2.2.2 → 2.2.3
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.
- package/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +28 -21
- package/bin/i3-composer-agent.cjs +5 -4
- package/bin/install.cjs +22 -10
- package/bin/native-command-validation.cjs +8 -13
- package/bin/native-layout.cjs +62 -28
- package/bin/native-migration.cjs +13 -7
- package/bin/native-runtime.cjs +10 -5
- package/docs/advanced-per-agent-configuration.md +78 -0
- package/docs/codebuddy-setup.md +3 -3
- package/docs/codex-setup.md +2 -2
- package/docs/workbuddy-setup.md +7 -7
- package/evals/README.md +26 -16
- package/package.json +37 -18
- package/plugin.json +1 -1
- package/scripts/floor-guard-reference-test.js +291 -0
- package/scripts/lib/skill-lint-test.js +650 -0
- package/scripts/run-evals-test.js +623 -0
- package/scripts/run-regressions.js +19 -0
- package/scripts/validate-artifact-paths-test.js +179 -0
- package/scripts/validate-commands-test.js +216 -0
- package/scripts/validate-reference-links-test.js +495 -0
- package/scripts/validate-versions-test.js +32 -0
- package/bin/native-version-validation.cjs +0 -8
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# i3 Composer Agent v2.2.
|
|
1
|
+
# i3 Composer Agent v2.2.3
|
|
2
2
|
|
|
3
3
|
**Intelligence. Integration. Innovation.**
|
|
4
4
|
|
|
@@ -54,7 +54,7 @@ CodeBuddy 和 WorkBuddy 的项目安装共用 `.codebuddy/`,相同目标只安
|
|
|
54
54
|
同版本、同范围的清单所属未修改内容会复用,新增客户端合并到清单。
|
|
55
55
|
升级、修改过的内容及未登记同名冲突需确认替换;非交互使用 `--force` 前可先看 dry-run。
|
|
56
56
|
安装成功后清理替换掉的旧内容及本安装器所属历史备份,失败则恢复原文件。
|
|
57
|
-
|
|
57
|
+
升级按文件归属清理旧副本,保留用户新增文件;2.2.2 的分散配套资料迁入工具根;2.2.1 的评测结果保留原位。
|
|
58
58
|
同名结果内容不同时会在写入前停止;未归属本包的资料冲突也需先处理,`--force` 不会接管。
|
|
59
59
|
成功后不保留临时备份。`npx -y` 确认 npm 下载;包的 `--yes` 确认安装计划。
|
|
60
60
|
|
|
@@ -63,11 +63,11 @@ CodeBuddy 和 WorkBuddy 的项目安装共用 `.codebuddy/`,相同目标只安
|
|
|
63
63
|
| 内容 | 默认安装 | 用途 |
|
|
64
64
|
| --- | --- | --- |
|
|
65
65
|
| `skills/`(含技能内部的 `scripts/` 等资源) | 是 | 工程工作流及运行辅助文件 |
|
|
66
|
-
| `
|
|
66
|
+
| `i3-composer-agent/references/` | 是 | 技能引用的检查清单与参考资料 |
|
|
67
67
|
| `commands/`、`agents/` | 是;发现与调用依宿主支持 | 短命令与专业角色提示 |
|
|
68
|
-
| `hooks/` | 是,文件安装后按宿主方式启用 | 会话注入、文档缓存和代码块保护 |
|
|
69
|
-
| `scripts/` | 是 |
|
|
70
|
-
| `evals/` | 是 | 中英文触发/行为用例、测试项目样例及插件评分规则 |
|
|
68
|
+
| `i3-composer-agent/hooks/` | 是,文件安装后按宿主方式启用 | 会话注入、文档缓存和代码块保护 |
|
|
69
|
+
| `i3-composer-agent/scripts/` | 是 | 评测运行器、五项校验、全部原版脚本回归测试及共享库 |
|
|
70
|
+
| `i3-composer-agent/evals/` | 是 | 中英文触发/行为用例、测试项目样例及插件评分规则 |
|
|
71
71
|
|
|
72
72
|
以项目安装的 `.codebuddy/` 为例,默认目录为:
|
|
73
73
|
|
|
@@ -76,42 +76,49 @@ CodeBuddy 和 WorkBuddy 的项目安装共用 `.codebuddy/`,相同目标只安
|
|
|
76
76
|
├─ skills/ # 宿主和评测共用的实际技能
|
|
77
77
|
├─ commands/ # 一份命令
|
|
78
78
|
├─ agents/ # 一份角色提示
|
|
79
|
-
├─
|
|
80
|
-
├─
|
|
81
|
-
├─
|
|
82
|
-
├─ scripts/
|
|
83
|
-
├─
|
|
79
|
+
├─ i3-composer-agent/ # 配套工具根,不是第二份插件
|
|
80
|
+
│ ├─ package.json # 独立 CommonJS 配置,提供 npm test
|
|
81
|
+
│ ├─ README.md
|
|
82
|
+
│ ├─ scripts/ # 全部脚本、原有回归测试及 lib/
|
|
83
|
+
│ ├─ evals/ # 中英文用例、样例、插件评测及结果
|
|
84
|
+
│ ├─ hooks/
|
|
85
|
+
│ ├─ references/
|
|
86
|
+
│ ├─ docs/
|
|
87
|
+
│ └─ adapters/ # 其他命令格式和插件清单的校验输入
|
|
84
88
|
└─ .i3-composer-agent.json # 版本、布局、能力与文件归属清单
|
|
85
89
|
```
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
每个宿主基址只有一份技能;公共资料集中在配套工具根目录。技能内部的 scripts/references 保留。
|
|
88
92
|
WorkBuddy 全局安装将基址换为 `~/.workbuddy/`,Codex 项目安装为 `.agents/`。
|
|
89
93
|
评测、校验和适用的 Hook 读取宿主使用的实际内容,不生成第二份完整插件。
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
进入配套目录后运行以下命令,不调用模型:
|
|
92
96
|
|
|
93
97
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
node
|
|
97
|
-
node .codebuddy/scripts/i3-composer-agent/validate-reference-links.cjs
|
|
98
|
-
node .codebuddy/scripts/i3-composer-agent/validate-artifact-paths.cjs
|
|
99
|
-
node .codebuddy/scripts/i3-composer-agent/run-evals.cjs --locale zh-CN --min-rank1 95
|
|
98
|
+
cd .codebuddy/i3-composer-agent
|
|
99
|
+
npm test
|
|
100
|
+
node scripts/run-evals.js --locale zh-CN --min-rank1 95
|
|
100
101
|
```
|
|
101
102
|
|
|
103
|
+
`npm test` 执行五项校验、中英文确定性评测和全部原版脚本回归测试。
|
|
104
|
+
原版英文案例完整保留,中文案例作为增量,两种语言分别通过门槛。
|
|
105
|
+
脚本也可使用绝对路径从任意目录运行;无需 `npm install`。
|
|
106
|
+
|
|
102
107
|
模型行为评测需要主动运行并消耗模型额度,详见 [评测说明](evals/README.md)。
|
|
103
108
|
原生脚本按安装清单检查本包内容,支持业务项目的 ESM/CommonJS 设置。
|
|
104
|
-
|
|
109
|
+
配套根与独立插件导出目录均可执行 `npm test`;这些检查均不能代替业务项目测试或宿主执行验收。
|
|
105
110
|
评测结果不进入安装替换清单。安装过程不执行评测,也不自动启用 Hook。
|
|
106
111
|
|
|
107
112
|
可选 Hook 不影响普通技能和命令的使用,默认中文交互也不依赖 Hook。
|
|
108
113
|
未配置 Hook 时,自动注入、缓存和代码块保护这些增强功能不会运行。
|
|
109
114
|
会话注入仅适合缺少原生技能路由的宿主;已有原生路由时不应重复注入元技能。
|
|
110
|
-
缓存与代码块保护的配置说明位于 `
|
|
115
|
+
缓存与代码块保护的配置说明位于 `i3-composer-agent/hooks/` 下的 `SDD-CACHE.md`、
|
|
111
116
|
`SIMPLIFY-IGNORE.md`,当前示例针对 Claude Code,其他宿主需适配自己的事件协议。
|
|
112
117
|
脚本依赖 Bash、jq;缓存还需 curl 和哈希工具,代码块保护还需其文档列出的工具。
|
|
113
118
|
Windows PowerShell 本身不会自动提供这些脚本依赖。
|
|
114
119
|
|
|
120
|
+
`i3-composer-agent/adapters/` 中的其他命令格式与插件清单用于完整回归校验,不自动注册插件。
|
|
121
|
+
|
|
115
122
|
## 通过宿主插件管理器安装
|
|
116
123
|
|
|
117
124
|
默认配套已包含 Skills、Commands、Agents、references、evals、hooks 和 scripts。
|
|
@@ -46,7 +46,7 @@ ${pkg.name}
|
|
|
46
46
|
上下键移动/跨页,空格勾选/取消,回车确认;列表下实时显示已选,q/Esc 退出。
|
|
47
47
|
CodeBuddy、WorkBuddy、Claude Code 同时安装短命令和 Agent 角色。
|
|
48
48
|
其他工具通过 Skills 调用,短命令支持取决于宿主。
|
|
49
|
-
所有工具默认安装单份 skills、commands、agents
|
|
49
|
+
所有工具默认安装单份 skills、commands、agents;配套资料集中在 i3-composer-agent/。
|
|
50
50
|
评测、脚本和 Hook 读取同一份已安装技能。--prepare 用于另行导出标准插件并按宿主方式注册。
|
|
51
51
|
WorkBuddy 桌面版建议全局安装,便于技能列表和输入补全发现。
|
|
52
52
|
评测需主动运行;Hook 文件已提供,需按宿主事件协议单独启用。
|
|
@@ -205,12 +205,13 @@ async function main() {
|
|
|
205
205
|
if (target.nativeCommands) console.log(`命令:/i3-spec、/i3-plan、/i3-build、/i3-ship(共 ${target.catalog.commands.length} 个工作流):${target.commandsDirectory}`);
|
|
206
206
|
else console.log(`命令和角色资料已提供;是否自动发现取决于宿主:${target.commandsDirectory}、${target.personasDirectory}`);
|
|
207
207
|
console.log(`评测资料:${target.evalsDirectory}`);
|
|
208
|
-
console.log(
|
|
208
|
+
console.log(`完整校验:进入 "${target.toolkitDirectory}" 后运行 npm test`);
|
|
209
|
+
console.log(`中文评测:node "${path.join(target.scriptsDirectory, 'run-evals.js')}" --locale zh-CN --min-rank1 95`);
|
|
209
210
|
console.log(`Hook:${target.hooksDirectory}(尚未启用)`);
|
|
210
211
|
}
|
|
211
|
-
for (const
|
|
212
|
+
for (const file of plan.preserved || []) console.log(`保留了用户文件:${file}`);
|
|
212
213
|
console.log('请重新加载 IDE 窗口或新建宿主会话以发现安装内容。');
|
|
213
214
|
if (plan.agents.some(id => !['codebuddy', 'workbuddy', 'claude-code'].includes(id))) console.log('这些工具通过技能 ID 调用;生命周期短命令支持取决于宿主。');
|
|
214
|
-
console.log('安装完成。评测说明见
|
|
215
|
+
console.log('安装完成。评测说明见 i3-composer-agent/evals/README.md;Hook 需按宿主事件协议启用。');
|
|
215
216
|
}
|
|
216
217
|
main().catch(error => { console.error(`${name}: ${error.message}`); process.exitCode = 1; });
|
package/bin/install.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const crypto = require('node:crypto');
|
|
|
7
7
|
const registry = require('./agent-targets.json');
|
|
8
8
|
const { cleanupBackups } = require('./cleanup-backups.cjs');
|
|
9
9
|
const { nativeAssets, renderAsset } = require('./native-layout.cjs');
|
|
10
|
-
const { migrationAssets, pruneRetiredDirectories } = require('./native-migration.cjs');
|
|
10
|
+
const { migrationAssets, pruneRetiredDirectories, ownsAsset } = require('./native-migration.cjs');
|
|
11
11
|
const { fingerprint } = require('./asset-fingerprint.cjs');
|
|
12
12
|
const root = path.resolve(__dirname, '..');
|
|
13
13
|
const name = 'i3-composer-agent';
|
|
@@ -50,7 +50,7 @@ function checkDestination(file) {
|
|
|
50
50
|
}
|
|
51
51
|
function assetPath(base, file) { return path.relative(base, file).split(path.sep).join('/'); }
|
|
52
52
|
function manifestContent(plan, asset) {
|
|
53
|
-
return JSON.stringify({ name, version, layoutVersion:
|
|
53
|
+
return JSON.stringify({ name, version, layoutVersion: 3, entryPrefix: 'i3-', scope: plan.scope, agents: asset.target.agents,
|
|
54
54
|
capabilities: { nativeCommands: !!asset.target.nativeCommands, nativeAgents: !!asset.target.nativeCommands, hooks: 'manual' },
|
|
55
55
|
catalog: asset.target.catalog, resources: asset.target.resources,
|
|
56
56
|
assets: plan.assets.filter(item => item.base === asset.base && !['legacy', 'result'].includes(item.kind)).map(item => assetPath(asset.base, item.destination)) }, null, 2) + '\n';
|
|
@@ -64,10 +64,10 @@ function planInstallation({ agents, scope, projectDir = process.cwd(), home = os
|
|
|
64
64
|
const agent = registry.agents.find(item => item.id === id);
|
|
65
65
|
const skillsDirectory = destination(scope === 'project' ? path.resolve(projectDir, agent.projectSkillsDir) : globalSkillsDir(agent, home, env));
|
|
66
66
|
const base = path.dirname(skillsDirectory);
|
|
67
|
-
if (!targets.has(skillsDirectory)) targets.set(skillsDirectory, { agents: [], skillsDirectory, referencesDirectory: path.join(base, 'references'
|
|
67
|
+
if (!targets.has(skillsDirectory)) targets.set(skillsDirectory, { agents: [], skillsDirectory, toolkitDirectory: path.join(base, name), referencesDirectory: path.join(base, name, 'references'),
|
|
68
68
|
commandsDirectory: path.join(base, 'commands'), personasDirectory: path.join(base, 'agents'),
|
|
69
|
-
evalsDirectory: path.join(base, 'evals'
|
|
70
|
-
hooksDirectory: path.join(base, 'hooks'
|
|
69
|
+
evalsDirectory: path.join(base, name, 'evals'), scriptsDirectory: path.join(base, name, 'scripts'),
|
|
70
|
+
hooksDirectory: path.join(base, name, 'hooks'), docsDirectory: path.join(base, name, 'docs'), base });
|
|
71
71
|
const target = targets.get(skillsDirectory);
|
|
72
72
|
target.agents.push(id);
|
|
73
73
|
if (['codebuddy', 'workbuddy', 'claude-code'].includes(id)) {
|
|
@@ -83,7 +83,7 @@ function planInstallation({ agents, scope, projectDir = process.cwd(), home = os
|
|
|
83
83
|
// Earlier Windows installs persisted backslashes. Normalize before lookup
|
|
84
84
|
// and containment checks so owned upgrades work across both manifest forms.
|
|
85
85
|
if (owned) previous.assets = previous.assets.map(relative => typeof relative === 'string' ? relative.replaceAll('\\', '/') : relative);
|
|
86
|
-
const sameVersion = owned && previous.layoutVersion ===
|
|
86
|
+
const sameVersion = owned && previous.layoutVersion === 3 && previous.version === version && previous.scope === scope && previous.entryPrefix === 'i3-';
|
|
87
87
|
if (owned && previous.scope === scope && Array.isArray(previous.agents)) {
|
|
88
88
|
const applicable = previous.agents.filter(id => {
|
|
89
89
|
const agent = registry.agents.find(item => item.id === id);
|
|
@@ -101,9 +101,8 @@ function planInstallation({ agents, scope, projectDir = process.cwd(), home = os
|
|
|
101
101
|
for (const asset of additions) {
|
|
102
102
|
// A new grouped resource must not take ownership of an unrelated file,
|
|
103
103
|
// even when --force confirms replacement of a previous installation.
|
|
104
|
-
const previousOwned = owned && previous
|
|
105
|
-
|
|
106
|
-
asset.protectedResource = /^(references|evals|hooks|scripts|docs)\//.test(asset.relative);
|
|
104
|
+
const previousOwned = owned && ownsAsset(previous, asset.relative);
|
|
105
|
+
asset.protectedResource = /^(references|evals|hooks|scripts|docs|i3-composer-agent)\//.test(asset.relative);
|
|
107
106
|
if (exists(asset.destination) && !previousOwned && asset.protectedResource) {
|
|
108
107
|
throw new Error(`未归属本包的同名资源,不能覆盖,请先处理:${asset.destination}`);
|
|
109
108
|
}
|
|
@@ -201,7 +200,20 @@ function executeInstallation(plan, { force = false } = {}) {
|
|
|
201
200
|
}
|
|
202
201
|
pruneRetiredDirectories(plan.assets);
|
|
203
202
|
completed = true;
|
|
204
|
-
|
|
203
|
+
const ownedPaths = new Set(plan.assets.filter(asset => asset.kind !== 'legacy').map(asset => asset.destination));
|
|
204
|
+
plan.preserved = [];
|
|
205
|
+
function findUserFiles(directory) {
|
|
206
|
+
if (!exists(directory) || fs.lstatSync(directory).isSymbolicLink()) return;
|
|
207
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
208
|
+
const file = path.join(directory, entry.name);
|
|
209
|
+
if (entry.isDirectory()) findUserFiles(file);
|
|
210
|
+
else if (!ownedPaths.has(file) && !file.split(path.sep).includes('results')) plan.preserved.push(file);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
for (const target of plan.targets) {
|
|
214
|
+
findUserFiles(path.join(target.base, name));
|
|
215
|
+
for (const category of ['references', 'evals', 'hooks', 'scripts', 'docs']) findUserFiles(path.join(target.base, category, name));
|
|
216
|
+
}
|
|
205
217
|
return [];
|
|
206
218
|
} catch (error) {
|
|
207
219
|
for (const change of committed.reverse()) {
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
const fs = require('node:fs');
|
|
5
4
|
const path = require('node:path');
|
|
6
|
-
const {
|
|
7
|
-
const { frontmatterYamlErrors } = require('./lib/skill-lint.cjs');
|
|
5
|
+
const { frontmatterYamlErrors } = require('./skill-lint.js');
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
const { root, catalog } = loadInstallation();
|
|
7
|
+
function validateAgents({ root, catalog }) {
|
|
11
8
|
let errors = 0;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const relative = `${category}/${name}.md`;
|
|
9
|
+
for (const name of catalog.agents) {
|
|
10
|
+
const relative = `agents/${name}.md`;
|
|
15
11
|
const text = fs.readFileSync(path.join(root, relative), 'utf8');
|
|
16
12
|
const issues = frontmatterYamlErrors(text);
|
|
17
13
|
const frontmatter = text.match(/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/)?.[1] || '';
|
|
18
14
|
if (!/^description:\s*\S/m.test(frontmatter)) issues.push('缺少 description');
|
|
19
|
-
if (
|
|
15
|
+
if (!new RegExp(`^name:\\s*["']?${name}["']?\\s*$`, 'm').test(frontmatter)) issues.push('角色 name 与文件名不一致');
|
|
20
16
|
if (!text.replace(/^---[\s\S]*?\n---/, '').trim()) issues.push('缺少提示正文');
|
|
21
17
|
console.log(`${issues.length ? '✗' : '✓'} ${relative}`);
|
|
22
18
|
for (const issue of issues) { console.error(` ${issue}`); errors++; }
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
20
|
+
return errors;
|
|
21
|
+
}
|
|
22
|
+
module.exports = { validateAgents };
|
package/bin/native-layout.cjs
CHANGED
|
@@ -11,34 +11,52 @@ function replaceOnce(text, before, after, label) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function nativeScript(text, relative) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// Copied upstream test fixtures keep their original repository paths; the
|
|
15
|
+
// real installed runners always require the installation manifest.
|
|
16
|
+
const setup = "const INSTALLATION = (require('node:fs').existsSync(require('node:path').join(__dirname, 'lib', 'installation.js')) || require('node:path').basename(require('node:path').resolve(__dirname, '..')) === 'i3-composer-agent') ? require('./lib/installation.js').loadInstallation() : null;";
|
|
17
|
+
if (relative.startsWith('scripts/lib/') || relative === 'scripts/run-regressions.js') return text;
|
|
18
|
+
if (relative === 'scripts/validate-versions.js' || relative === 'scripts/validate-versions-test.js') {
|
|
19
|
+
return replaceOnce(text, 'const manifestPaths = [', setup + "\nconst MANIFEST_ROOT = INSTALLATION ? INSTALLATION.resources.adapters : require('node:path').resolve(__dirname, '..');\nconst manifestPaths = [", relative)
|
|
20
|
+
.replace('readFileSync(manifestPath, "utf8")', 'readFileSync(require("node:path").join(INSTALLATION && manifestPath === "package.json" ? INSTALLATION.toolkitRoot : MANIFEST_ROOT, manifestPath), "utf8")')
|
|
21
|
+
.replace('const expectedVersion = readManifestVersion("plugin.json");', 'const expectedVersion = readManifestVersion("plugin.json");\nif (INSTALLATION && expectedVersion !== INSTALLATION.manifest.version) throw new Error("插件版本与实际安装版本不一致");');
|
|
22
|
+
}
|
|
23
|
+
if (relative === 'scripts/floor-guard-reference-test.js') {
|
|
24
|
+
return replaceOnce(text, 'const REFERENCE = path.join(', setup + '\nconst REFERENCE = path.join(', relative)
|
|
25
|
+
.replace("__dirname, '..', 'skills',", "(INSTALLATION ? INSTALLATION.root : path.resolve(__dirname, '..')), 'skills',");
|
|
26
|
+
}
|
|
27
|
+
if (/-test\.js$/.test(relative)) return text;
|
|
17
28
|
if (relative === 'scripts/validate-skills.js') {
|
|
18
|
-
text = replaceOnce(text, "const SKILLS_DIR = path.resolve(__dirname, '..', 'skills');",
|
|
19
|
-
return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
|
|
29
|
+
text = replaceOnce(text, "const SKILLS_DIR = path.resolve(__dirname, '..', 'skills');", setup + "\nconst SKILLS_DIR = INSTALLATION ? INSTALLATION.skillsDirectory : path.resolve(__dirname, '..', 'skills');", relative);
|
|
30
|
+
return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', '(INSTALLATION ? INSTALLATION.catalog.skills : fs.readdirSync(SKILLS_DIR))', relative);
|
|
20
31
|
}
|
|
21
32
|
const rootDeclaration = relative === 'scripts/run-evals.js'
|
|
22
33
|
? "const ROOT = path.join(__dirname, '..');" : "const ROOT = path.resolve(__dirname, '..');";
|
|
23
|
-
text = replaceOnce(text, rootDeclaration,
|
|
34
|
+
text = replaceOnce(text, rootDeclaration, setup + "\nconst ROOT = INSTALLATION ? INSTALLATION.root : path.resolve(__dirname, '..');", relative);
|
|
24
35
|
if (relative === 'scripts/run-evals.js') {
|
|
25
|
-
text = text.replaceAll("path.join(ROOT, 'evals',", "path.join(INSTALLATION.resources.evals,")
|
|
26
|
-
.replaceAll("path.join(ROOT, 'evals/zh-CN/cases')", "path.join(INSTALLATION.resources.evals, 'zh-CN/cases')");
|
|
27
|
-
return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
|
|
36
|
+
text = text.replaceAll("path.join(ROOT, 'evals',", "path.join(INSTALLATION ? INSTALLATION.resources.evals : path.join(ROOT, 'evals'),")
|
|
37
|
+
.replaceAll("path.join(ROOT, 'evals/zh-CN/cases')", "path.join(INSTALLATION ? INSTALLATION.resources.evals : path.join(ROOT, 'evals'), 'zh-CN/cases')");
|
|
38
|
+
return replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', '(INSTALLATION ? INSTALLATION.catalog.skills : fs.readdirSync(SKILLS_DIR))', relative);
|
|
28
39
|
}
|
|
29
40
|
if (relative === 'scripts/validate-reference-links.js') {
|
|
30
|
-
text = replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', 'INSTALLATION.catalog.skills', relative);
|
|
31
|
-
return replaceOnce(text, 'references\\/[A-Za-z0-9._-]+\\.md', 'references\\/(?:[A-Za-z0-9._-]+\\/)*[A-Za-z0-9._-]+\\.md', relative);
|
|
41
|
+
text = replaceOnce(text, 'fs.readdirSync(SKILLS_DIR)', '(INSTALLATION ? INSTALLATION.catalog.skills : fs.readdirSync(SKILLS_DIR))', relative);
|
|
42
|
+
return replaceOnce(text, 'references\\/[A-Za-z0-9._-]+\\.md', '(?:i3-composer-agent\\/)?references\\/(?:[A-Za-z0-9._-]+\\/)*[A-Za-z0-9._-]+\\.md', relative);
|
|
43
|
+
}
|
|
44
|
+
if (relative === 'scripts/validate-commands.js') {
|
|
45
|
+
text = replaceOnce(text, "path.join(ROOT, '.claude', 'commands')", "path.join(ROOT, INSTALLATION ? 'commands' : '.claude/commands')", relative);
|
|
46
|
+
text = replaceOnce(text, "path.join(ROOT, '.gemini', 'commands')", "path.join(INSTALLATION ? INSTALLATION.resources.adapters : ROOT, '.gemini', 'commands')", relative);
|
|
47
|
+
text = replaceOnce(text, "path.join(ROOT, 'commands')", "path.join(INSTALLATION ? INSTALLATION.resources.adapters : ROOT, 'commands')", relative);
|
|
48
|
+
text = replaceOnce(text, 'fs.readdirSync(dir)', "(INSTALLATION ? (ext === '.md' ? INSTALLATION.catalog.commands.map(name => name + '.md') : fs.readdirSync(dir).filter(file => INSTALLATION.catalog.commands.includes(NAME_MAP_REVERSE[path.basename(file, ext)] ?? path.basename(file, ext)))) : fs.readdirSync(dir))", relative);
|
|
49
|
+
return replaceOnce(text, ' let errors = 0;', " let errors = INSTALLATION ? require('./lib/validate-agents.js').validateAgents(INSTALLATION) : 0;", relative);
|
|
32
50
|
}
|
|
33
51
|
if (relative === 'scripts/validate-artifact-paths.js') {
|
|
34
52
|
const guarded = text.match(/const GUARDED_FILES = \[[\s\S]*?\n\];/)?.[0];
|
|
35
53
|
if (!guarded) throw new Error(`缺少原生产物检查配置:${relative}`);
|
|
36
|
-
|
|
37
|
-
...INSTALLATION.catalog.commands.map(name => 'commands/' + name + '.md')
|
|
38
|
-
'skills/i3-spec-driven-development/SKILL.md',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
text = text.replace(guarded, 'const GUARDED_FILES = INSTALLATION ? [\n' +
|
|
55
|
+
" ...INSTALLATION.catalog.commands.map(name => 'commands/' + name + '.md'),\n" +
|
|
56
|
+
" 'skills/i3-spec-driven-development/SKILL.md', 'skills/i3-planning-and-task-breakdown/SKILL.md',\n" +
|
|
57
|
+
" ...INSTALLATION.manifest.assets.filter(file => /^(?:i3-composer-agent\\/docs\\/(getting-started|adoption-guide|copilot-setup)\\.md|i3-composer-agent\\/adapters\\/(?:\\.gemini\\/commands|commands)\\/i3-(spec|planning|build)\\.toml)$/.test(file)),\n" +
|
|
58
|
+
'] : ' + guarded.slice('const GUARDED_FILES = '.length));
|
|
59
|
+
return text.replace(/^GUARDED_FILES\.push\(.*\);$/m, "if (!INSTALLATION) $&");
|
|
42
60
|
}
|
|
43
61
|
throw new Error(`尚未适配的公共脚本:${relative}`);
|
|
44
62
|
}
|
|
@@ -47,6 +65,18 @@ function renderAsset(buffer, asset) {
|
|
|
47
65
|
const relative = asset.sourceRelative || '';
|
|
48
66
|
if (relative.startsWith('evals/fixtures/')) return buffer;
|
|
49
67
|
let text = buffer.toString('utf8');
|
|
68
|
+
if (asset.kind === 'toolkit-package') {
|
|
69
|
+
const pkg = JSON.parse(text);
|
|
70
|
+
return Buffer.from(JSON.stringify({ name: pkg.name, version: pkg.version, private: true,
|
|
71
|
+
type: 'commonjs', engines: pkg.engines, scripts: Object.fromEntries(
|
|
72
|
+
Object.entries(pkg.scripts).filter(([key]) => ['test', 'validate', 'eval', 'test:regression'].includes(key))) }, null, 2) + '\n');
|
|
73
|
+
}
|
|
74
|
+
if (asset.kind === 'toolkit-readme') return Buffer.from(
|
|
75
|
+
'# i3 Composer Agent 配套工具\n\n' +
|
|
76
|
+
'本目录提供评测、校验、回归测试、Hook、共享参考资料和使用指南。技能、命令和 Agent 位于上一级的对应目录,只有一份;这里的评测读取宿主实际安装的内容。\n\n' +
|
|
77
|
+
'进入本目录后运行:\n\n```bash\nnpm test\nnode scripts/run-evals.js --locale zh-CN --min-rank1 95\n```\n\n' +
|
|
78
|
+
'`npm test` 执行内容校验、中英文确定性评测及全部脚本回归测试,不需要 npm install。模型行为评测需要另行配置执行宿主;详见 [evals/README.md](evals/README.md)。\n\n' +
|
|
79
|
+
'`adapters/` 保留其他命令格式和插件清单,供原版一致性校验与回归测试使用,不自动注册或启用插件。Hook 需按宿主支持的事件单独启用;缓存与代码块保护分别详见 [hooks/SDD-CACHE.md](hooks/SDD-CACHE.md) 和 [hooks/SIMPLIFY-IGNORE.md](hooks/SIMPLIFY-IGNORE.md)。\n');
|
|
50
80
|
if (asset.kind === 'runtime') return Buffer.from(text.replace('__I3_INSTALL_VERSION__', asset.version));
|
|
51
81
|
if (asset.kind === 'script') return Buffer.from(nativeScript(text, relative));
|
|
52
82
|
if (relative === 'hooks/session-start.sh') {
|
|
@@ -71,7 +101,7 @@ function renderAsset(buffer, asset) {
|
|
|
71
101
|
});
|
|
72
102
|
}
|
|
73
103
|
// Shared references move; skill-local references and executable assets stay.
|
|
74
|
-
text = text.replace(/((?:\.\.\/){2,})references
|
|
104
|
+
text = text.replace(/((?:\.\.\/){2,})references\//g, '$1' + name + '/references/');
|
|
75
105
|
// Resolve actual Markdown links through the same source-to-destination map.
|
|
76
106
|
text = text.replace(/(\]\()([^\s)#]+)(#[^\s)]+)?(\))/g, (match, open, link, fragment = '', close) => {
|
|
77
107
|
if (/^(?:[a-z]+:|\/)/i.test(link)) return match;
|
|
@@ -81,9 +111,9 @@ function renderAsset(buffer, asset) {
|
|
|
81
111
|
return open + path.posix.relative(path.posix.dirname(asset.relative), mapped) + fragment + close;
|
|
82
112
|
});
|
|
83
113
|
if (asset.kind === 'command' || asset.kind === 'persona') {
|
|
84
|
-
text = text.replaceAll('docs/agents.md',
|
|
114
|
+
text = text.replaceAll('docs/agents.md', name + '/docs/agents.md');
|
|
85
115
|
}
|
|
86
|
-
if (relative.startsWith('hooks/')) text = text.replace(/\bhooks
|
|
116
|
+
if (relative.startsWith('hooks/')) text = text.replace(/\bhooks\//g, name + '/hooks/');
|
|
87
117
|
return Buffer.from(text);
|
|
88
118
|
}
|
|
89
119
|
|
|
@@ -110,24 +140,28 @@ function nativeAssets(root, target, packageFiles, version) {
|
|
|
110
140
|
visit('skills', 'skills', 'skill');
|
|
111
141
|
visit('.claude/commands', 'commands', 'command');
|
|
112
142
|
visit('agents', 'agents', 'persona');
|
|
113
|
-
visit('references',
|
|
114
|
-
visit('README.md',
|
|
143
|
+
visit('references', name + '/references', 'reference');
|
|
144
|
+
visit('README.md', name + '/docs/README.md', 'docs');
|
|
145
|
+
visit('README.md', name + '/README.md', 'toolkit-readme');
|
|
146
|
+
visit('package.json', name + '/package.json', 'toolkit-package');
|
|
115
147
|
for (const file of packageFiles) {
|
|
116
148
|
const category = file.split('/')[0];
|
|
117
149
|
if (!['evals', 'hooks', 'scripts', 'docs'].includes(category)) continue;
|
|
118
|
-
|
|
119
|
-
const relative = `${category}/${name}${file.slice(category.length)}`.replace(/\.js$/, category === 'scripts' ? '.cjs' : '.js');
|
|
150
|
+
const relative = name + '/' + file;
|
|
120
151
|
visit(file, relative, category === 'scripts' ? 'script' : category);
|
|
121
152
|
}
|
|
122
|
-
visit('bin/native-runtime.cjs',
|
|
123
|
-
visit('bin/native-command-validation.cjs',
|
|
124
|
-
|
|
153
|
+
visit('bin/native-runtime.cjs', name + '/scripts/lib/installation.js', 'runtime');
|
|
154
|
+
visit('bin/native-command-validation.cjs', name + '/scripts/lib/validate-agents.js', 'runtime');
|
|
155
|
+
for (const file of ['commands', '.gemini/commands', 'plugin.json', '.codex-plugin/plugin.json',
|
|
156
|
+
'.claude-plugin/plugin.json', '.claude-plugin/marketplace.json', '.agents/plugins/marketplace.json']) {
|
|
157
|
+
visit(file, name + '/adapters/' + file, 'adapter');
|
|
158
|
+
}
|
|
125
159
|
target.catalog = {
|
|
126
160
|
skills: fs.readdirSync(path.join(root, 'skills')).filter(id => fs.existsSync(path.join(root, 'skills', id, 'SKILL.md'))).sort(),
|
|
127
161
|
commands: fs.readdirSync(path.join(root, '.claude/commands')).filter(file => file.endsWith('.md')).map(file => file.slice(0, -3)).sort(),
|
|
128
162
|
agents: fs.readdirSync(path.join(root, 'agents')).filter(file => file.endsWith('.md')).map(file => file.slice(0, -3)).sort(),
|
|
129
163
|
};
|
|
130
|
-
target.resources = Object.fromEntries(['references', 'evals', 'hooks', 'scripts', 'docs'].map(category => [category,
|
|
164
|
+
target.resources = Object.fromEntries(['references', 'evals', 'hooks', 'scripts', 'docs', 'adapters'].map(category => [category, name + '/' + category]));
|
|
131
165
|
for (const asset of assets) { asset.mapping = mapping; asset.base = target.base; }
|
|
132
166
|
return assets;
|
|
133
167
|
}
|
package/bin/native-migration.cjs
CHANGED
|
@@ -5,6 +5,12 @@ const path = require('node:path');
|
|
|
5
5
|
const { fingerprint } = require('./asset-fingerprint.cjs');
|
|
6
6
|
const inventory = require('./legacy-native-files.json').files;
|
|
7
7
|
const name = 'i3-composer-agent';
|
|
8
|
+
const publishedFiles = new Set(inventory);
|
|
9
|
+
|
|
10
|
+
function ownsAsset(previous, relative) {
|
|
11
|
+
return previous.assets.some(file => file === relative
|
|
12
|
+
|| (!(previous.layoutVersion >= 2) && publishedFiles.has(relative) && relative.startsWith(file + '/')));
|
|
13
|
+
}
|
|
8
14
|
|
|
9
15
|
function allowed(relative) {
|
|
10
16
|
return typeof relative === 'string' && !relative.includes('\0') && !relative.includes(':') && !relative.includes('\\')
|
|
@@ -41,7 +47,7 @@ function migrationAssets(target, previous, current) {
|
|
|
41
47
|
const file = fileAt(base, relative);
|
|
42
48
|
if (!file) continue;
|
|
43
49
|
if (fs.statSync(file).isFile()) oldFiles.add(relative);
|
|
44
|
-
else if (previous.layoutVersion
|
|
50
|
+
else if (!(previous.layoutVersion >= 2)) {
|
|
45
51
|
// Old manifests registered directories, not their contents. Expand only
|
|
46
52
|
// paths in the published inventory, never the current filesystem tree.
|
|
47
53
|
for (const known of inventory) if (known.startsWith(relative + '/')) oldFiles.add(known);
|
|
@@ -51,8 +57,8 @@ function migrationAssets(target, previous, current) {
|
|
|
51
57
|
|
|
52
58
|
// Evaluation output is user data, not an installed package asset. Move it
|
|
53
59
|
// transactionally, including plugin and locale-specific result folders.
|
|
54
|
-
if (previous.
|
|
55
|
-
const oldEvals = path.join(base,
|
|
60
|
+
if (previous.layoutVersion === 2) {
|
|
61
|
+
const oldEvals = path.join(base, 'evals', name);
|
|
56
62
|
function visit(directory, relative = '') {
|
|
57
63
|
if (!fs.existsSync(directory)) return;
|
|
58
64
|
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
@@ -61,7 +67,7 @@ function migrationAssets(target, previous, current) {
|
|
|
61
67
|
if (entry.isSymbolicLink()) continue;
|
|
62
68
|
if (entry.isDirectory()) visit(source, subpath);
|
|
63
69
|
else if (entry.isFile() && subpath.split('/').includes('results')) {
|
|
64
|
-
const destinationRelative =
|
|
70
|
+
const destinationRelative = `${name}/evals/${subpath}`;
|
|
65
71
|
const destination = path.join(base, destinationRelative);
|
|
66
72
|
let reusable = false;
|
|
67
73
|
if (fs.existsSync(destination)) {
|
|
@@ -70,11 +76,11 @@ function migrationAssets(target, previous, current) {
|
|
|
70
76
|
}
|
|
71
77
|
assets.push({ base, source, destination, relative: destinationRelative, kind: 'result', reusable,
|
|
72
78
|
expectedFingerprint: fingerprint(source) });
|
|
73
|
-
retire(
|
|
79
|
+
retire(`evals/${name}/${subpath}`);
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
|
-
if (fileAt(base,
|
|
83
|
+
if (fileAt(base, `evals/${name}`)) visit(oldEvals);
|
|
78
84
|
}
|
|
79
85
|
return assets;
|
|
80
86
|
}
|
|
@@ -90,4 +96,4 @@ function pruneRetiredDirectories(assets) {
|
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
module.exports = { migrationAssets, pruneRetiredDirectories };
|
|
99
|
+
module.exports = { migrationAssets, pruneRetiredDirectories, ownsAsset };
|
package/bin/native-runtime.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Installed as
|
|
3
|
+
// Installed as i3-composer-agent/scripts/lib/installation.js. Resolve from
|
|
4
4
|
// this file, never the caller's working directory or the host's package.json.
|
|
5
5
|
const fs = require('node:fs');
|
|
6
6
|
const path = require('node:path');
|
|
@@ -27,7 +27,7 @@ function loadInstallation() {
|
|
|
27
27
|
let manifest;
|
|
28
28
|
try { manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); }
|
|
29
29
|
catch (error) { throw new Error(`无法读取安装清单 ${manifestPath}:${error.message}`); }
|
|
30
|
-
if (manifest.name !== 'i3-composer-agent' || manifest.layoutVersion !==
|
|
30
|
+
if (manifest.name !== 'i3-composer-agent' || manifest.layoutVersion !== 3
|
|
31
31
|
|| manifest.version !== EXPECTED_VERSION || !Array.isArray(manifest.assets) || !manifest.assets.length) {
|
|
32
32
|
throw new Error(`安装清单的名称、布局或版本不匹配:${manifestPath}`);
|
|
33
33
|
}
|
|
@@ -44,14 +44,19 @@ function loadInstallation() {
|
|
|
44
44
|
}
|
|
45
45
|
for (const relative of assets) resolveOwned(relative);
|
|
46
46
|
const resources = {};
|
|
47
|
-
for (const category of ['references', 'evals', 'hooks', 'scripts', 'docs']) {
|
|
48
|
-
const relative =
|
|
47
|
+
for (const category of ['references', 'evals', 'hooks', 'scripts', 'docs', 'adapters']) {
|
|
48
|
+
const relative = 'i3-composer-agent/' + category;
|
|
49
49
|
if (manifest.resources?.[category] !== relative || ![...assets].some(file => file.startsWith(relative + '/'))) {
|
|
50
50
|
throw new Error(`安装清单缺少资源:${category}`);
|
|
51
51
|
}
|
|
52
52
|
resources[category] = path.join(root, relative);
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
const toolkitRoot = path.join(root, 'i3-composer-agent');
|
|
55
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(toolkitRoot, 'package.json'), 'utf8'));
|
|
56
|
+
if (pkg.name !== '@givolt/i3-composer-agent' || pkg.type !== 'commonjs' || pkg.version !== EXPECTED_VERSION) {
|
|
57
|
+
throw new Error('配套 package.json 的名称、模块格式或版本与安装不一致');
|
|
58
|
+
}
|
|
59
|
+
return { root, toolkitRoot, manifest, catalog: manifest.catalog, resources, skillsDirectory: path.join(root, 'skills') };
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
module.exports = { loadInstallation };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Advanced per-agent configuration
|
|
2
|
+
|
|
3
|
+
<!-- i3:zh-guide:start -->
|
|
4
|
+
## 中文使用说明
|
|
5
|
+
|
|
6
|
+
按下文完整工程步骤、检查项与验证条件执行。根据任务选择适用步骤,保留证据、风险和退出条件;正文示例中的英文标签在面向用户输出时译为中文。
|
|
7
|
+
|
|
8
|
+
默认使用简体中文解释、追问及生成报告;用户明确要求其他语言时可切换。原方法正文、引用、阈值和审批条件完整保留。代码标识、路径、命令、工具参数、JSON 键/枚举与原文引用保持原样。
|
|
9
|
+
<!-- i3:zh-guide:end -->
|
|
10
|
+
|
|
11
|
+
Skills in this repository are intentionally portable. Every `SKILL.md` keeps its frontmatter limited to the fields the [Agent Skills specification](https://agentskills.io) defines, so the same file works across Claude Code, Cursor, Gemini CLI, Antigravity, and any other spec-conformant client.
|
|
12
|
+
|
|
13
|
+
Several agents also support extra runtime controls: model routing, tool restrictions, turn limits, execution isolation. These controls are valuable, but they are vendor-specific and do not belong in the shared, portable frontmatter. This document explains which controls each agent supports, where they belong, and how to apply them as an opt-in without breaking portability.
|
|
14
|
+
|
|
15
|
+
This is the canonical reference for per-agent configuration, and it supersedes the earlier approach of adding vendor fields to top-level `SKILL.md` frontmatter. Fields such as `kind`, `model`, `temperature`, `max_turns`, `tools`, and `context` must not appear at the top level of a skill. They belong under `metadata` or in a separate per-agent adapter file, as described below.
|
|
16
|
+
|
|
17
|
+
## Principles
|
|
18
|
+
|
|
19
|
+
1. **Keep `SKILL.md` portable.** The Agent Skills specification reserves top-level frontmatter for `name`, `description`, `license`, `compatibility`, `metadata`, and the experimental `allowed-tools`. Vendor or client-specific properties belong under `metadata`, not at the top level.
|
|
20
|
+
2. **Unknown top-level fields are not guaranteed to be ignored.** Many parsers only read `name` and `description` and silently drop the rest, but a strict spec-conformant validator or client may flag or reject unrecognized top-level keys. Putting vendor fields under `metadata` keeps the file conformant everywhere.
|
|
21
|
+
3. **Opt-in, not global.** Runtime controls should be something a user adds for their own agent and workflow, not a default baked into every skill in the repository.
|
|
22
|
+
4. **Prefer generation over hand-editing.** Where a configuration is repetitive and mechanical, generate it from a single source of truth instead of maintaining copies by hand. See [Automating with scripts](#automating-with-scripts).
|
|
23
|
+
|
|
24
|
+
## Where vendor fields belong
|
|
25
|
+
|
|
26
|
+
| Field type | Example | Correct home |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Spec fields | `name`, `description`, `license`, `compatibility` | Top-level frontmatter in `SKILL.md` |
|
|
29
|
+
| Vendor metadata | model hints, routing tags | Under the `metadata` key in `SKILL.md` |
|
|
30
|
+
| Runtime orchestration | subagent definitions, turn limits, tool allowlists | A separate per-agent adapter file (see each agent below) |
|
|
31
|
+
|
|
32
|
+
## Claude Code
|
|
33
|
+
|
|
34
|
+
Claude Code reads `name` and `description` for discovery. Custom commands and skills share the same frontmatter, so the `context` and `allowed-tools` fields below work in both `.claude/commands/*.md` and `.claude/skills/*/SKILL.md`.
|
|
35
|
+
|
|
36
|
+
- **`context: fork`** runs a command or skill in an isolated subagent context instead of the active conversation. This gives context isolation, repeatable execution from a clean state, execution tokens spent in the fork rather than the main session, and a cleaner handoff where only the result surfaces back. An optional **`agent`** field selects which subagent type runs the fork (for example `agent: Plan`); it defaults to `general-purpose`.
|
|
37
|
+
- **`allowed-tools`** pre-approves tools; it does not restrict them. Listed tools run without a permission prompt for the turn that invokes the command or skill, and the grant clears on your next message. Nothing is removed from the tool pool.
|
|
38
|
+
- **`disallowed-tools`** is the field that actually restricts: it removes the listed tools from the available pool while the skill is active, which is what least-privilege needs for passive stages such as review or audit. The restriction also clears on your next message. Note it is a Claude Code field and not one of the specification's six, so it belongs in a local copy or an adapter file; in a published `SKILL.md` it fails packaging with an unexpected-key error.
|
|
39
|
+
|
|
40
|
+
These are Claude Code conventions. Keep the shared, published `SKILL.md` limited to spec fields; apply these runtime controls in your own local command or skill copies instead.
|
|
41
|
+
|
|
42
|
+
## Gemini CLI and Antigravity
|
|
43
|
+
|
|
44
|
+
Gemini CLI and Antigravity discover skills the same way: they match `name` and `description`, then load the full skill on demand. Runtime orchestration lives in a separate resource, not in the skill frontmatter.
|
|
45
|
+
|
|
46
|
+
- **Subagent definitions** live in `.gemini/agents/*.md`, which are distinct from skills. Their schema is `kind` (`local` or `remote`), `model`, `temperature`, `max_turns`, and `tools`. Note that this is a subagent schema, not a skill schema: the two should not be merged into one `SKILL.md`.
|
|
47
|
+
- **Model routing** can send lighter tasks (formatting, documentation, git operations) to a faster model and reserve a stronger model for cognitively demanding work (debugging, security auditing, interface design).
|
|
48
|
+
- **Tool restrictions** enforce least-privilege per subagent, which also trims unused tool schemas from the prompt.
|
|
49
|
+
- **Turn limits** (`max_turns`) cap execution to avoid runaway correction loops.
|
|
50
|
+
|
|
51
|
+
### Model guidance
|
|
52
|
+
|
|
53
|
+
Google recommends omitting `temperature` for Gemini 3.x models and using `thinking_level` instead. Do not hardcode `temperature` on skills or subagents routed to 3.x models; prefer `thinking_level` and revisit this guidance as the models evolve.
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
# .gemini/agents/security-auditor.md
|
|
57
|
+
---
|
|
58
|
+
kind: local
|
|
59
|
+
model: gemini-3-pro
|
|
60
|
+
thinking_level: high # not: temperature: 0.1
|
|
61
|
+
tools: [read_file, grep]
|
|
62
|
+
max_turns: 10
|
|
63
|
+
---
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Automating with scripts
|
|
67
|
+
|
|
68
|
+
Maintaining per-agent metadata by hand across every skill is repetitive, drifts out of sync, and is easy to get wrong. A better approach is to keep a single source of truth and generate the agent-specific output:
|
|
69
|
+
|
|
70
|
+
- A generator reads a per-skill configuration map (which model, tool allowlist, turn limit, and isolation each skill should use for a given agent).
|
|
71
|
+
- For metadata-style fields, it injects them under the `metadata` key of each `SKILL.md`, keeping the file spec-conformant.
|
|
72
|
+
- For orchestration-style fields, it emits the separate adapter files an agent expects, for example `.gemini/agents/*.md` subagent definitions, leaving `SKILL.md` untouched.
|
|
73
|
+
|
|
74
|
+
Generation also lets the tooling validate **semantics, not just shape**: confirm that a model name is a known model, that a tool name is a real tool, that `max_turns` is a positive integer, and that `temperature` (where still applicable) is a valid number in range. Shape-only checks let invalid values such as `parseInt("1.5")` or `parseFloat("0.2oops")` slip through.
|
|
75
|
+
|
|
76
|
+
## Status
|
|
77
|
+
|
|
78
|
+
It is the single reference for per-agent configuration: it keeps the shared skills portable while documenting the advanced controls each agent offers as an opt-in. The script-based automation described above is a proposal pending agreement before any implementation.
|