newtype-profile 1.0.21 → 1.0.23
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/dist/cli/index.js +7 -7
- package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor.d.ts +1 -1
- package/dist/index.js +345 -414
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/session-manager/constants.d.ts +1 -1
- package/package.json +1 -1
- package/dist/tools/call-omo-agent/constants.d.ts +0 -2
- package/dist/tools/call-omo-agent/index.d.ts +0 -3
- package/dist/tools/call-omo-agent/tools.d.ts +0 -3
- package/dist/tools/call-omo-agent/types.d.ts +0 -24
package/dist/index.js
CHANGED
|
@@ -1980,11 +1980,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
1980
1980
|
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
|
1981
1981
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
1982
1982
|
}
|
|
1983
|
-
optimizeNames(names,
|
|
1983
|
+
optimizeNames(names, constants15) {
|
|
1984
1984
|
if (!names[this.name.str])
|
|
1985
1985
|
return;
|
|
1986
1986
|
if (this.rhs)
|
|
1987
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
1987
|
+
this.rhs = optimizeExpr(this.rhs, names, constants15);
|
|
1988
1988
|
return this;
|
|
1989
1989
|
}
|
|
1990
1990
|
get names() {
|
|
@@ -2002,10 +2002,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2002
2002
|
render({ _n }) {
|
|
2003
2003
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
2004
2004
|
}
|
|
2005
|
-
optimizeNames(names,
|
|
2005
|
+
optimizeNames(names, constants15) {
|
|
2006
2006
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
2007
2007
|
return;
|
|
2008
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
2008
|
+
this.rhs = optimizeExpr(this.rhs, names, constants15);
|
|
2009
2009
|
return this;
|
|
2010
2010
|
}
|
|
2011
2011
|
get names() {
|
|
@@ -2071,8 +2071,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2071
2071
|
optimizeNodes() {
|
|
2072
2072
|
return `${this.code}` ? this : undefined;
|
|
2073
2073
|
}
|
|
2074
|
-
optimizeNames(names,
|
|
2075
|
-
this.code = optimizeExpr(this.code, names,
|
|
2074
|
+
optimizeNames(names, constants15) {
|
|
2075
|
+
this.code = optimizeExpr(this.code, names, constants15);
|
|
2076
2076
|
return this;
|
|
2077
2077
|
}
|
|
2078
2078
|
get names() {
|
|
@@ -2102,12 +2102,12 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2102
2102
|
}
|
|
2103
2103
|
return nodes.length > 0 ? this : undefined;
|
|
2104
2104
|
}
|
|
2105
|
-
optimizeNames(names,
|
|
2105
|
+
optimizeNames(names, constants15) {
|
|
2106
2106
|
const { nodes } = this;
|
|
2107
2107
|
let i2 = nodes.length;
|
|
2108
2108
|
while (i2--) {
|
|
2109
2109
|
const n = nodes[i2];
|
|
2110
|
-
if (n.optimizeNames(names,
|
|
2110
|
+
if (n.optimizeNames(names, constants15))
|
|
2111
2111
|
continue;
|
|
2112
2112
|
subtractNames(names, n.names);
|
|
2113
2113
|
nodes.splice(i2, 1);
|
|
@@ -2164,12 +2164,12 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2164
2164
|
return;
|
|
2165
2165
|
return this;
|
|
2166
2166
|
}
|
|
2167
|
-
optimizeNames(names,
|
|
2167
|
+
optimizeNames(names, constants15) {
|
|
2168
2168
|
var _a;
|
|
2169
|
-
this.else = (_a = this.else) === null || _a === undefined ? undefined : _a.optimizeNames(names,
|
|
2170
|
-
if (!(super.optimizeNames(names,
|
|
2169
|
+
this.else = (_a = this.else) === null || _a === undefined ? undefined : _a.optimizeNames(names, constants15);
|
|
2170
|
+
if (!(super.optimizeNames(names, constants15) || this.else))
|
|
2171
2171
|
return;
|
|
2172
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
2172
|
+
this.condition = optimizeExpr(this.condition, names, constants15);
|
|
2173
2173
|
return this;
|
|
2174
2174
|
}
|
|
2175
2175
|
get names() {
|
|
@@ -2194,10 +2194,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2194
2194
|
render(opts) {
|
|
2195
2195
|
return `for(${this.iteration})` + super.render(opts);
|
|
2196
2196
|
}
|
|
2197
|
-
optimizeNames(names,
|
|
2198
|
-
if (!super.optimizeNames(names,
|
|
2197
|
+
optimizeNames(names, constants15) {
|
|
2198
|
+
if (!super.optimizeNames(names, constants15))
|
|
2199
2199
|
return;
|
|
2200
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
2200
|
+
this.iteration = optimizeExpr(this.iteration, names, constants15);
|
|
2201
2201
|
return this;
|
|
2202
2202
|
}
|
|
2203
2203
|
get names() {
|
|
@@ -2235,10 +2235,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2235
2235
|
render(opts) {
|
|
2236
2236
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
2237
2237
|
}
|
|
2238
|
-
optimizeNames(names,
|
|
2239
|
-
if (!super.optimizeNames(names,
|
|
2238
|
+
optimizeNames(names, constants15) {
|
|
2239
|
+
if (!super.optimizeNames(names, constants15))
|
|
2240
2240
|
return;
|
|
2241
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
2241
|
+
this.iterable = optimizeExpr(this.iterable, names, constants15);
|
|
2242
2242
|
return this;
|
|
2243
2243
|
}
|
|
2244
2244
|
get names() {
|
|
@@ -2283,11 +2283,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2283
2283
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
2284
2284
|
return this;
|
|
2285
2285
|
}
|
|
2286
|
-
optimizeNames(names,
|
|
2286
|
+
optimizeNames(names, constants15) {
|
|
2287
2287
|
var _a, _b;
|
|
2288
|
-
super.optimizeNames(names,
|
|
2289
|
-
(_a = this.catch) === null || _a === undefined || _a.optimizeNames(names,
|
|
2290
|
-
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names,
|
|
2288
|
+
super.optimizeNames(names, constants15);
|
|
2289
|
+
(_a = this.catch) === null || _a === undefined || _a.optimizeNames(names, constants15);
|
|
2290
|
+
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants15);
|
|
2291
2291
|
return this;
|
|
2292
2292
|
}
|
|
2293
2293
|
get names() {
|
|
@@ -2561,7 +2561,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2561
2561
|
function addExprNames(names, from) {
|
|
2562
2562
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
2563
2563
|
}
|
|
2564
|
-
function optimizeExpr(expr, names,
|
|
2564
|
+
function optimizeExpr(expr, names, constants15) {
|
|
2565
2565
|
if (expr instanceof code_1.Name)
|
|
2566
2566
|
return replaceName(expr);
|
|
2567
2567
|
if (!canOptimize(expr))
|
|
@@ -2576,14 +2576,14 @@ var require_codegen = __commonJS((exports) => {
|
|
|
2576
2576
|
return items;
|
|
2577
2577
|
}, []));
|
|
2578
2578
|
function replaceName(n) {
|
|
2579
|
-
const c =
|
|
2579
|
+
const c = constants15[n.str];
|
|
2580
2580
|
if (c === undefined || names[n.str] !== 1)
|
|
2581
2581
|
return n;
|
|
2582
2582
|
delete names[n.str];
|
|
2583
2583
|
return c;
|
|
2584
2584
|
}
|
|
2585
2585
|
function canOptimize(e2) {
|
|
2586
|
-
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
2586
|
+
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants15[c.str] !== undefined);
|
|
2587
2587
|
}
|
|
2588
2588
|
}
|
|
2589
2589
|
function subtractNames(names, from) {
|
|
@@ -3030,37 +3030,37 @@ var require_dataType = __commonJS((exports) => {
|
|
|
3030
3030
|
DataType2[DataType2["Wrong"] = 1] = "Wrong";
|
|
3031
3031
|
})(DataType || (exports.DataType = DataType = {}));
|
|
3032
3032
|
function getSchemaTypes(schema2) {
|
|
3033
|
-
const
|
|
3034
|
-
const hasNull =
|
|
3033
|
+
const types19 = getJSONTypes(schema2.type);
|
|
3034
|
+
const hasNull = types19.includes("null");
|
|
3035
3035
|
if (hasNull) {
|
|
3036
3036
|
if (schema2.nullable === false)
|
|
3037
3037
|
throw new Error("type: null contradicts nullable: false");
|
|
3038
3038
|
} else {
|
|
3039
|
-
if (!
|
|
3039
|
+
if (!types19.length && schema2.nullable !== undefined) {
|
|
3040
3040
|
throw new Error('"nullable" cannot be used without "type"');
|
|
3041
3041
|
}
|
|
3042
3042
|
if (schema2.nullable === true)
|
|
3043
|
-
|
|
3043
|
+
types19.push("null");
|
|
3044
3044
|
}
|
|
3045
|
-
return
|
|
3045
|
+
return types19;
|
|
3046
3046
|
}
|
|
3047
3047
|
exports.getSchemaTypes = getSchemaTypes;
|
|
3048
3048
|
function getJSONTypes(ts) {
|
|
3049
|
-
const
|
|
3050
|
-
if (
|
|
3051
|
-
return
|
|
3052
|
-
throw new Error("type must be JSONType or JSONType[]: " +
|
|
3049
|
+
const types19 = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
|
3050
|
+
if (types19.every(rules_1.isJSONType))
|
|
3051
|
+
return types19;
|
|
3052
|
+
throw new Error("type must be JSONType or JSONType[]: " + types19.join(","));
|
|
3053
3053
|
}
|
|
3054
3054
|
exports.getJSONTypes = getJSONTypes;
|
|
3055
|
-
function coerceAndCheckDataType(it,
|
|
3055
|
+
function coerceAndCheckDataType(it, types19) {
|
|
3056
3056
|
const { gen, data, opts } = it;
|
|
3057
|
-
const coerceTo = coerceToTypes(
|
|
3058
|
-
const checkTypes =
|
|
3057
|
+
const coerceTo = coerceToTypes(types19, opts.coerceTypes);
|
|
3058
|
+
const checkTypes = types19.length > 0 && !(coerceTo.length === 0 && types19.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types19[0]));
|
|
3059
3059
|
if (checkTypes) {
|
|
3060
|
-
const wrongType = checkDataTypes(
|
|
3060
|
+
const wrongType = checkDataTypes(types19, data, opts.strictNumbers, DataType.Wrong);
|
|
3061
3061
|
gen.if(wrongType, () => {
|
|
3062
3062
|
if (coerceTo.length)
|
|
3063
|
-
coerceData(it,
|
|
3063
|
+
coerceData(it, types19, coerceTo);
|
|
3064
3064
|
else
|
|
3065
3065
|
reportTypeError(it);
|
|
3066
3066
|
});
|
|
@@ -3069,15 +3069,15 @@ var require_dataType = __commonJS((exports) => {
|
|
|
3069
3069
|
}
|
|
3070
3070
|
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
3071
3071
|
var COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
|
|
3072
|
-
function coerceToTypes(
|
|
3073
|
-
return coerceTypes ?
|
|
3072
|
+
function coerceToTypes(types19, coerceTypes) {
|
|
3073
|
+
return coerceTypes ? types19.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
|
|
3074
3074
|
}
|
|
3075
|
-
function coerceData(it,
|
|
3075
|
+
function coerceData(it, types19, coerceTo) {
|
|
3076
3076
|
const { gen, data, opts } = it;
|
|
3077
3077
|
const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
|
|
3078
3078
|
const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
|
|
3079
3079
|
if (opts.coerceTypes === "array") {
|
|
3080
|
-
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(
|
|
3080
|
+
gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types19, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
|
3081
3081
|
}
|
|
3082
3082
|
gen.if((0, codegen_1._)`${coerced} !== undefined`);
|
|
3083
3083
|
for (const t of coerceTo) {
|
|
@@ -3153,19 +3153,19 @@ var require_dataType = __commonJS((exports) => {
|
|
|
3153
3153
|
return checkDataType(dataTypes[0], data, strictNums, correct);
|
|
3154
3154
|
}
|
|
3155
3155
|
let cond;
|
|
3156
|
-
const
|
|
3157
|
-
if (
|
|
3156
|
+
const types19 = (0, util_1.toHash)(dataTypes);
|
|
3157
|
+
if (types19.array && types19.object) {
|
|
3158
3158
|
const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
|
|
3159
|
-
cond =
|
|
3160
|
-
delete
|
|
3161
|
-
delete
|
|
3162
|
-
delete
|
|
3159
|
+
cond = types19.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
|
|
3160
|
+
delete types19.null;
|
|
3161
|
+
delete types19.array;
|
|
3162
|
+
delete types19.object;
|
|
3163
3163
|
} else {
|
|
3164
3164
|
cond = codegen_1.nil;
|
|
3165
3165
|
}
|
|
3166
|
-
if (
|
|
3167
|
-
delete
|
|
3168
|
-
for (const t in
|
|
3166
|
+
if (types19.number)
|
|
3167
|
+
delete types19.integer;
|
|
3168
|
+
for (const t in types19)
|
|
3169
3169
|
cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
|
3170
3170
|
return cond;
|
|
3171
3171
|
}
|
|
@@ -3953,9 +3953,9 @@ var require_validate = __commonJS((exports) => {
|
|
|
3953
3953
|
function typeAndKeywords(it, errsCount) {
|
|
3954
3954
|
if (it.opts.jtd)
|
|
3955
3955
|
return schemaKeywords(it, [], false, errsCount);
|
|
3956
|
-
const
|
|
3957
|
-
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it,
|
|
3958
|
-
schemaKeywords(it,
|
|
3956
|
+
const types19 = (0, dataType_1.getSchemaTypes)(it.schema);
|
|
3957
|
+
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types19);
|
|
3958
|
+
schemaKeywords(it, types19, !checkedTypes, errsCount);
|
|
3959
3959
|
}
|
|
3960
3960
|
function checkRefsAndKeywords(it) {
|
|
3961
3961
|
const { schema: schema2, errSchemaPath, opts, self } = it;
|
|
@@ -4005,7 +4005,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
4005
4005
|
if (items instanceof codegen_1.Name)
|
|
4006
4006
|
gen.assign((0, codegen_1._)`${evaluated}.items`, items);
|
|
4007
4007
|
}
|
|
4008
|
-
function schemaKeywords(it,
|
|
4008
|
+
function schemaKeywords(it, types19, typeErrors, errsCount) {
|
|
4009
4009
|
const { gen, schema: schema2, data, allErrors, opts, self } = it;
|
|
4010
4010
|
const { RULES } = self;
|
|
4011
4011
|
if (schema2.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema2, RULES))) {
|
|
@@ -4013,7 +4013,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
4013
4013
|
return;
|
|
4014
4014
|
}
|
|
4015
4015
|
if (!opts.jtd)
|
|
4016
|
-
checkStrictTypes(it,
|
|
4016
|
+
checkStrictTypes(it, types19);
|
|
4017
4017
|
gen.block(() => {
|
|
4018
4018
|
for (const group of RULES.rules)
|
|
4019
4019
|
groupKeywords(group);
|
|
@@ -4025,7 +4025,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
4025
4025
|
if (group.type) {
|
|
4026
4026
|
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
4027
4027
|
iterateKeywords(it, group);
|
|
4028
|
-
if (
|
|
4028
|
+
if (types19.length === 1 && types19[0] === group.type && typeErrors) {
|
|
4029
4029
|
gen.else();
|
|
4030
4030
|
(0, dataType_2.reportTypeError)(it);
|
|
4031
4031
|
}
|
|
@@ -4049,27 +4049,27 @@ var require_validate = __commonJS((exports) => {
|
|
|
4049
4049
|
}
|
|
4050
4050
|
});
|
|
4051
4051
|
}
|
|
4052
|
-
function checkStrictTypes(it,
|
|
4052
|
+
function checkStrictTypes(it, types19) {
|
|
4053
4053
|
if (it.schemaEnv.meta || !it.opts.strictTypes)
|
|
4054
4054
|
return;
|
|
4055
|
-
checkContextTypes(it,
|
|
4055
|
+
checkContextTypes(it, types19);
|
|
4056
4056
|
if (!it.opts.allowUnionTypes)
|
|
4057
|
-
checkMultipleTypes(it,
|
|
4057
|
+
checkMultipleTypes(it, types19);
|
|
4058
4058
|
checkKeywordTypes(it, it.dataTypes);
|
|
4059
4059
|
}
|
|
4060
|
-
function checkContextTypes(it,
|
|
4061
|
-
if (!
|
|
4060
|
+
function checkContextTypes(it, types19) {
|
|
4061
|
+
if (!types19.length)
|
|
4062
4062
|
return;
|
|
4063
4063
|
if (!it.dataTypes.length) {
|
|
4064
|
-
it.dataTypes =
|
|
4064
|
+
it.dataTypes = types19;
|
|
4065
4065
|
return;
|
|
4066
4066
|
}
|
|
4067
|
-
|
|
4067
|
+
types19.forEach((t) => {
|
|
4068
4068
|
if (!includesType(it.dataTypes, t)) {
|
|
4069
4069
|
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
|
4070
4070
|
}
|
|
4071
4071
|
});
|
|
4072
|
-
narrowSchemaTypes(it,
|
|
4072
|
+
narrowSchemaTypes(it, types19);
|
|
4073
4073
|
}
|
|
4074
4074
|
function checkMultipleTypes(it, ts) {
|
|
4075
4075
|
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
@@ -16684,8 +16684,6 @@ var AGENT_NAME_MAP = {
|
|
|
16684
16684
|
metis: "chief",
|
|
16685
16685
|
build: "deputy",
|
|
16686
16686
|
oracle: "researcher",
|
|
16687
|
-
librarian: "archivist",
|
|
16688
|
-
explore: "researcher",
|
|
16689
16687
|
"frontend-ui-ux-engineer": "writer",
|
|
16690
16688
|
"document-writer": "writer",
|
|
16691
16689
|
"multimodal-looker": "extractor"
|
|
@@ -17831,7 +17829,7 @@ You ARE the planner. You ARE NOT an implementer. You DO NOT write code. You DO N
|
|
|
17831
17829
|
| Write/Edit | \`.chief/**/*.md\` ONLY | Everything else |
|
|
17832
17830
|
| Read | All files | - |
|
|
17833
17831
|
| Bash | Research commands only | Implementation commands |
|
|
17834
|
-
| chief_task | researcher, archivist | - |
|
|
17832
|
+
| chief_task | deputy (for researcher, archivist) | - |
|
|
17835
17833
|
|
|
17836
17834
|
**IF YOU TRY TO WRITE/EDIT OUTSIDE \`.chief/\`:**
|
|
17837
17835
|
- System will BLOCK your action
|
|
@@ -17850,23 +17848,21 @@ REFUSE. Say: "I'm a planner. I create work plans, not implementations. Run \`/st
|
|
|
17850
17848
|
## CONTEXT GATHERING (MANDATORY BEFORE PLANNING)
|
|
17851
17849
|
|
|
17852
17850
|
You ARE the planner. Your job: create bulletproof work plans.
|
|
17853
|
-
**Before drafting ANY plan,
|
|
17851
|
+
**Before drafting ANY plan, delegate to Deputy for context gathering.**
|
|
17854
17852
|
|
|
17855
17853
|
### Research Protocol
|
|
17856
|
-
1. **
|
|
17854
|
+
1. **Delegate to Deputy** for comprehensive context:
|
|
17857
17855
|
\`\`\`
|
|
17858
|
-
chief_task(
|
|
17859
|
-
chief_task(agent="researcher", prompt="Find test infrastructure and conventions", background=true)
|
|
17860
|
-
chief_task(agent="archivist", prompt="Find official docs and best practices for [technology]", background=true)
|
|
17856
|
+
chief_task(subagent_type="deputy", prompt="Research: Find existing patterns for [topic] in codebase, test infrastructure, and conventions", run_in_background=true, skills=[])
|
|
17861
17857
|
\`\`\`
|
|
17862
17858
|
2. **Wait for results** before planning - rushed plans fail
|
|
17863
17859
|
3. **Synthesize findings** into informed requirements
|
|
17864
17860
|
|
|
17865
|
-
### What
|
|
17861
|
+
### What Deputy Will Research (via researcher/archivist)
|
|
17866
17862
|
- Existing codebase patterns and conventions
|
|
17867
17863
|
- Test infrastructure (TDD possible?)
|
|
17868
17864
|
- External library APIs and constraints
|
|
17869
|
-
- Similar implementations in OSS
|
|
17865
|
+
- Similar implementations in OSS
|
|
17870
17866
|
|
|
17871
17867
|
**NEVER plan blind. Context first, plan second.**`;
|
|
17872
17868
|
function isPlannerAgent(agentName) {
|
|
@@ -17899,25 +17895,28 @@ ${ULTRAWORK_PLANNER_SECTION}
|
|
|
17899
17895
|
YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
|
|
17900
17896
|
TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
|
17901
17897
|
|
|
17902
|
-
## AGENT UTILIZATION PRINCIPLES (
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
- **
|
|
17907
|
-
- **
|
|
17898
|
+
## AGENT UTILIZATION PRINCIPLES (Three-Layer Architecture)
|
|
17899
|
+
|
|
17900
|
+
**Chief \u2192 Deputy \u2192 Specialists**
|
|
17901
|
+
|
|
17902
|
+
- **Simple tasks**: Deputy handles directly
|
|
17903
|
+
- **Research tasks**: Deputy \u2192 researcher
|
|
17904
|
+
- **Writing tasks**: Deputy \u2192 writer
|
|
17905
|
+
- **Verification tasks**: Deputy \u2192 fact-checker
|
|
17906
|
+
- **Knowledge base**: Deputy \u2192 archivist
|
|
17908
17907
|
|
|
17909
17908
|
## EXECUTION RULES
|
|
17910
17909
|
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.
|
|
17911
|
-
- **
|
|
17912
|
-
- **BACKGROUND FIRST**: Use chief_task for research agents (10+ concurrent if needed).
|
|
17910
|
+
- **DELEGATE**: Use chief_task(subagent_type="deputy") for execution tasks
|
|
17913
17911
|
- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.
|
|
17914
|
-
- **
|
|
17912
|
+
- **DEPUTY FIRST**: Let Deputy orchestrate specialists - you focus on decision-making.
|
|
17915
17913
|
|
|
17916
17914
|
## WORKFLOW
|
|
17917
17915
|
1. Analyze the request and identify required capabilities
|
|
17918
|
-
2.
|
|
17919
|
-
3.
|
|
17920
|
-
4.
|
|
17916
|
+
2. Delegate to Deputy with clear instructions
|
|
17917
|
+
3. Deputy dispatches to appropriate specialists
|
|
17918
|
+
4. Review Deputy's summarized results
|
|
17919
|
+
5. Iterate if quality insufficient
|
|
17921
17920
|
|
|
17922
17921
|
## VERIFICATION GUARANTEE (NON-NEGOTIABLE)
|
|
17923
17922
|
|
|
@@ -18004,26 +18003,26 @@ var KEYWORD_DETECTORS = [
|
|
|
18004
18003
|
{
|
|
18005
18004
|
pattern: /\b(search|find|locate|lookup|look\s*up|explore|discover|scan|grep|query|browse|detect|trace|seek|track|pinpoint|hunt)\b|where\s+is|show\s+me|list\s+all|\uAC80\uC0C9|\uCC3E\uC544|\uD0D0\uC0C9|\uC870\uD68C|\uC2A4\uCE94|\uC11C\uCE58|\uB4A4\uC838|\uCC3E\uAE30|\uC5B4\uB514|\uCD94\uC801|\uD0D0\uC9C0|\uCC3E\uC544\uBD10|\uCC3E\uC544\uB0B4|\uBCF4\uC5EC\uC918|\uBAA9\uB85D|\u691C\u7D22|\u63A2\u3057\u3066|\u898B\u3064\u3051\u3066|\u30B5\u30FC\u30C1|\u63A2\u7D22|\u30B9\u30AD\u30E3\u30F3|\u3069\u3053|\u767A\u898B|\u635C\u7D22|\u898B\u3064\u3051\u51FA\u3059|\u4E00\u89A7|\u641C\u7D22|\u67E5\u627E|\u5BFB\u627E|\u67E5\u8BE2|\u68C0\u7D22|\u5B9A\u4F4D|\u626B\u63CF|\u53D1\u73B0|\u5728\u54EA\u91CC|\u627E\u51FA\u6765|\u5217\u51FA|t\u00ECm ki\u1EBFm|tra c\u1EE9u|\u0111\u1ECBnh v\u1ECB|qu\u00E9t|ph\u00E1t hi\u1EC7n|truy t\u00ECm|t\u00ECm ra|\u1EDF \u0111\u00E2u|li\u1EC7t k\u00EA/i,
|
|
18006
18005
|
message: `[search-mode]
|
|
18007
|
-
MAXIMIZE SEARCH EFFORT.
|
|
18008
|
-
-
|
|
18009
|
-
|
|
18010
|
-
Plus direct tools: Grep,
|
|
18006
|
+
MAXIMIZE SEARCH EFFORT. Delegate to Deputy for comprehensive search:
|
|
18007
|
+
- chief_task(subagent_type="deputy", prompt="Search: [your query]", run_in_background=false, skills=[])
|
|
18008
|
+
Deputy will dispatch to researcher (codebase) and archivist (knowledge base) as needed.
|
|
18009
|
+
Plus direct tools: Grep, AST-grep for targeted searches.
|
|
18011
18010
|
NEVER stop at first result - be exhaustive.`
|
|
18012
18011
|
},
|
|
18013
18012
|
{
|
|
18014
18013
|
pattern: /\b(analyze|analyse|investigate|examine|research|study|deep[\s-]?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to|\uBD84\uC11D|\uC870\uC0AC|\uD30C\uC545|\uC5F0\uAD6C|\uAC80\uD1A0|\uC9C4\uB2E8|\uC774\uD574|\uC124\uBA85|\uC6D0\uC778|\uC774\uC720|\uB72F\uC5B4\uBD10|\uB530\uC838\uBD10|\uD3C9\uAC00|\uD574\uC11D|\uB514\uBC84\uAE45|\uB514\uBC84\uADF8|\uC5B4\uB5BB\uAC8C|\uC65C|\uC0B4\uD3B4|\u5206\u6790|\u8ABF\u67FB|\u89E3\u6790|\u691C\u8A0E|\u7814\u7A76|\u8A3A\u65AD|\u7406\u89E3|\u8AAC\u660E|\u691C\u8A3C|\u7CBE\u67FB|\u7A76\u660E|\u30C7\u30D0\u30C3\u30B0|\u306A\u305C|\u3069\u3046|\u4ED5\u7D44\u307F|\u8C03\u67E5|\u68C0\u67E5|\u5256\u6790|\u6DF1\u5165|\u8BCA\u65AD|\u89E3\u91CA|\u8C03\u8BD5|\u4E3A\u4EC0\u4E48|\u539F\u7406|\u641E\u6E05\u695A|\u5F04\u660E\u767D|ph\u00E2n t\u00EDch|\u0111i\u1EC1u tra|nghi\u00EAn c\u1EE9u|ki\u1EC3m tra|xem x\u00E9t|ch\u1EA9n \u0111o\u00E1n|gi\u1EA3i th\u00EDch|t\u00ECm hi\u1EC3u|g\u1EE1 l\u1ED7i|t\u1EA1i sao/i,
|
|
18015
18014
|
message: `[analyze-mode]
|
|
18016
|
-
ANALYSIS MODE.
|
|
18015
|
+
ANALYSIS MODE. Delegate to Deputy for context gathering:
|
|
18017
18016
|
|
|
18018
|
-
|
|
18019
|
-
- 1-2 explore agents (codebase patterns, implementations)
|
|
18020
|
-
- 1-2 librarian agents (if external library involved)
|
|
18021
|
-
- Direct tools: Grep, AST-grep, LSP for targeted searches
|
|
18017
|
+
chief_task(subagent_type="deputy", prompt="Analyze: [topic]. Gather codebase patterns and relevant context.", run_in_background=false, skills=[])
|
|
18022
18018
|
|
|
18023
|
-
|
|
18024
|
-
-
|
|
18019
|
+
Deputy will dispatch to:
|
|
18020
|
+
- researcher (codebase patterns, implementations)
|
|
18021
|
+
- archivist (knowledge base, external docs if needed)
|
|
18025
18022
|
|
|
18026
|
-
|
|
18023
|
+
Plus direct tools: Grep, AST-grep, LSP for targeted searches.
|
|
18024
|
+
|
|
18025
|
+
SYNTHESIZE Deputy's findings before proceeding.`
|
|
18027
18026
|
}
|
|
18028
18027
|
];
|
|
18029
18028
|
|
|
@@ -24057,6 +24056,15 @@ function isCallerOrchestrator(sessionID) {
|
|
|
24057
24056
|
const nearest = findNearestMessageWithFields(messageDir);
|
|
24058
24057
|
return nearest?.agent === "chief";
|
|
24059
24058
|
}
|
|
24059
|
+
function isCallerDeputy(sessionID) {
|
|
24060
|
+
if (!sessionID)
|
|
24061
|
+
return false;
|
|
24062
|
+
const messageDir = getMessageDir10(sessionID);
|
|
24063
|
+
if (!messageDir)
|
|
24064
|
+
return false;
|
|
24065
|
+
const nearest = findNearestMessageWithFields(messageDir);
|
|
24066
|
+
return nearest?.agent === "deputy";
|
|
24067
|
+
}
|
|
24060
24068
|
function isAbortError(error) {
|
|
24061
24069
|
if (!error)
|
|
24062
24070
|
return false;
|
|
@@ -24214,17 +24222,22 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24214
24222
|
}
|
|
24215
24223
|
},
|
|
24216
24224
|
"tool.execute.before": async (input, output) => {
|
|
24225
|
+
const callerIsChief = isCallerOrchestrator(input.sessionID);
|
|
24226
|
+
const callerIsDeputy = isCallerDeputy(input.sessionID);
|
|
24217
24227
|
if (input.tool === "chief_task") {
|
|
24218
24228
|
log(`[${HOOK_NAME6}] chief_task detected`, {
|
|
24219
24229
|
sessionID: input.sessionID,
|
|
24220
24230
|
callID: input.callID,
|
|
24221
|
-
|
|
24231
|
+
caller: callerIsChief ? "chief" : callerIsDeputy ? "deputy" : "other"
|
|
24222
24232
|
});
|
|
24223
24233
|
}
|
|
24224
|
-
if (!
|
|
24234
|
+
if (!callerIsChief && !callerIsDeputy) {
|
|
24225
24235
|
return;
|
|
24226
24236
|
}
|
|
24227
24237
|
if (WRITE_EDIT_TOOLS.includes(input.tool)) {
|
|
24238
|
+
if (!callerIsChief) {
|
|
24239
|
+
return;
|
|
24240
|
+
}
|
|
24228
24241
|
const filePath = output.args.filePath ?? output.args.path ?? output.args.file;
|
|
24229
24242
|
if (filePath && !filePath.includes(ALLOWED_PATH_PREFIX2)) {
|
|
24230
24243
|
if (input.callID) {
|
|
@@ -24282,10 +24295,15 @@ ${enhancedPrompt}`;
|
|
|
24282
24295
|
}
|
|
24283
24296
|
},
|
|
24284
24297
|
"tool.execute.after": async (input, output) => {
|
|
24285
|
-
|
|
24298
|
+
const callerIsChief = isCallerOrchestrator(input.sessionID);
|
|
24299
|
+
const callerIsDeputy = isCallerDeputy(input.sessionID);
|
|
24300
|
+
if (!callerIsChief && !callerIsDeputy) {
|
|
24286
24301
|
return;
|
|
24287
24302
|
}
|
|
24288
24303
|
if (WRITE_EDIT_TOOLS.includes(input.tool)) {
|
|
24304
|
+
if (!callerIsChief) {
|
|
24305
|
+
return;
|
|
24306
|
+
}
|
|
24289
24307
|
let filePath = input.callID ? pendingFilePaths.get(input.callID) : undefined;
|
|
24290
24308
|
if (input.callID) {
|
|
24291
24309
|
pendingFilePaths.delete(input.callID);
|
|
@@ -43871,7 +43889,7 @@ Session ID: ses_abc123
|
|
|
43871
43889
|
Messages: 45
|
|
43872
43890
|
Date Range: 2025-12-20 10:30:00 to 2025-12-24 15:45:30
|
|
43873
43891
|
Duration: 4 days, 5 hours
|
|
43874
|
-
Agents Used:
|
|
43892
|
+
Agents Used: deputy, researcher, archivist
|
|
43875
43893
|
Has Todos: Yes (12 items, 8 completed)
|
|
43876
43894
|
Has Transcript: Yes (234 entries)`;
|
|
43877
43895
|
|
|
@@ -45068,166 +45086,6 @@ Status: ${task.status}`;
|
|
|
45068
45086
|
}
|
|
45069
45087
|
});
|
|
45070
45088
|
}
|
|
45071
|
-
// src/tools/call-omo-agent/constants.ts
|
|
45072
|
-
var ALLOWED_AGENTS = ["explore", "librarian"];
|
|
45073
|
-
var CALL_OMO_AGENT_DESCRIPTION = `Spawn explore/librarian agent. run_in_background REQUIRED (true=async with task_id, false=sync).
|
|
45074
|
-
|
|
45075
|
-
Available: {agents}
|
|
45076
|
-
|
|
45077
|
-
Pass \`resume=session_id\` to continue previous agent with full context. Prompts MUST be in English. Use \`background_output\` for async results.`;
|
|
45078
|
-
// src/tools/call-omo-agent/tools.ts
|
|
45079
|
-
function createCallOmoAgent(ctx, backgroundManager) {
|
|
45080
|
-
const agentDescriptions = ALLOWED_AGENTS.map((name) => `- ${name}: Specialized agent for ${name} tasks`).join(`
|
|
45081
|
-
`);
|
|
45082
|
-
const description = CALL_OMO_AGENT_DESCRIPTION.replace("{agents}", agentDescriptions);
|
|
45083
|
-
return tool({
|
|
45084
|
-
description,
|
|
45085
|
-
args: {
|
|
45086
|
-
description: tool.schema.string().describe("A short (3-5 words) description of the task"),
|
|
45087
|
-
prompt: tool.schema.string().describe("The task for the agent to perform"),
|
|
45088
|
-
subagent_type: tool.schema.enum(ALLOWED_AGENTS).describe("The type of specialized agent to use for this task (explore or librarian only)"),
|
|
45089
|
-
run_in_background: tool.schema.boolean().describe("REQUIRED. true: run asynchronously (use background_output to get results), false: run synchronously and wait for completion"),
|
|
45090
|
-
session_id: tool.schema.string().describe("Existing Task session to continue").optional()
|
|
45091
|
-
},
|
|
45092
|
-
async execute(args, toolContext) {
|
|
45093
|
-
const toolCtx = toolContext;
|
|
45094
|
-
log(`[call_omo_agent] Starting with agent: ${args.subagent_type}, background: ${args.run_in_background}`);
|
|
45095
|
-
if (!ALLOWED_AGENTS.includes(args.subagent_type)) {
|
|
45096
|
-
return `Error: Invalid agent type "${args.subagent_type}". Only ${ALLOWED_AGENTS.join(", ")} are allowed.`;
|
|
45097
|
-
}
|
|
45098
|
-
if (args.run_in_background) {
|
|
45099
|
-
if (args.session_id) {
|
|
45100
|
-
return `Error: session_id is not supported in background mode. Use run_in_background=false to continue an existing session.`;
|
|
45101
|
-
}
|
|
45102
|
-
return await executeBackground(args, toolCtx, backgroundManager);
|
|
45103
|
-
}
|
|
45104
|
-
return await executeSync(args, toolCtx, ctx);
|
|
45105
|
-
}
|
|
45106
|
-
});
|
|
45107
|
-
}
|
|
45108
|
-
async function executeBackground(args, toolContext, manager) {
|
|
45109
|
-
try {
|
|
45110
|
-
const task = await manager.launch({
|
|
45111
|
-
description: args.description,
|
|
45112
|
-
prompt: args.prompt,
|
|
45113
|
-
agent: args.subagent_type,
|
|
45114
|
-
parentSessionID: toolContext.sessionID,
|
|
45115
|
-
parentMessageID: toolContext.messageID
|
|
45116
|
-
});
|
|
45117
|
-
toolContext.metadata?.({
|
|
45118
|
-
title: args.description,
|
|
45119
|
-
metadata: { sessionId: task.sessionID }
|
|
45120
|
-
});
|
|
45121
|
-
return `Background agent task launched successfully.
|
|
45122
|
-
|
|
45123
|
-
Task ID: ${task.id}
|
|
45124
|
-
Session ID: ${task.sessionID}
|
|
45125
|
-
Description: ${task.description}
|
|
45126
|
-
Agent: ${task.agent} (subagent)
|
|
45127
|
-
Status: ${task.status}
|
|
45128
|
-
|
|
45129
|
-
The system will notify you when the task completes.
|
|
45130
|
-
Use \`background_output\` tool with task_id="${task.id}" to check progress:
|
|
45131
|
-
- block=false (default): Check status immediately - returns full status info
|
|
45132
|
-
- block=true: Wait for completion (rarely needed since system notifies)`;
|
|
45133
|
-
} catch (error45) {
|
|
45134
|
-
const message = error45 instanceof Error ? error45.message : String(error45);
|
|
45135
|
-
return `Failed to launch background agent task: ${message}`;
|
|
45136
|
-
}
|
|
45137
|
-
}
|
|
45138
|
-
async function executeSync(args, toolContext, ctx) {
|
|
45139
|
-
let sessionID;
|
|
45140
|
-
if (args.session_id) {
|
|
45141
|
-
log(`[call_omo_agent] Using existing session: ${args.session_id}`);
|
|
45142
|
-
const sessionResult = await ctx.client.session.get({
|
|
45143
|
-
path: { id: args.session_id }
|
|
45144
|
-
});
|
|
45145
|
-
if (sessionResult.error) {
|
|
45146
|
-
log(`[call_omo_agent] Session get error:`, sessionResult.error);
|
|
45147
|
-
return `Error: Failed to get existing session: ${sessionResult.error}`;
|
|
45148
|
-
}
|
|
45149
|
-
sessionID = args.session_id;
|
|
45150
|
-
} else {
|
|
45151
|
-
log(`[call_omo_agent] Creating new session with parent: ${toolContext.sessionID}`);
|
|
45152
|
-
const createResult = await ctx.client.session.create({
|
|
45153
|
-
body: {
|
|
45154
|
-
parentID: toolContext.sessionID,
|
|
45155
|
-
title: `${args.description} (@${args.subagent_type} subagent)`
|
|
45156
|
-
}
|
|
45157
|
-
});
|
|
45158
|
-
if (createResult.error) {
|
|
45159
|
-
log(`[call_omo_agent] Session create error:`, createResult.error);
|
|
45160
|
-
return `Error: Failed to create session: ${createResult.error}`;
|
|
45161
|
-
}
|
|
45162
|
-
sessionID = createResult.data.id;
|
|
45163
|
-
log(`[call_omo_agent] Created session: ${sessionID}`);
|
|
45164
|
-
}
|
|
45165
|
-
toolContext.metadata?.({
|
|
45166
|
-
title: args.description,
|
|
45167
|
-
metadata: { sessionId: sessionID }
|
|
45168
|
-
});
|
|
45169
|
-
log(`[call_omo_agent] Sending prompt to session ${sessionID}`);
|
|
45170
|
-
log(`[call_omo_agent] Prompt text:`, args.prompt.substring(0, 100));
|
|
45171
|
-
try {
|
|
45172
|
-
await ctx.client.session.prompt({
|
|
45173
|
-
path: { id: sessionID },
|
|
45174
|
-
body: {
|
|
45175
|
-
agent: args.subagent_type,
|
|
45176
|
-
tools: {
|
|
45177
|
-
task: false,
|
|
45178
|
-
call_omo_agent: false,
|
|
45179
|
-
chief_task: false
|
|
45180
|
-
},
|
|
45181
|
-
parts: [{ type: "text", text: args.prompt }]
|
|
45182
|
-
}
|
|
45183
|
-
});
|
|
45184
|
-
} catch (error45) {
|
|
45185
|
-
const errorMessage = error45 instanceof Error ? error45.message : String(error45);
|
|
45186
|
-
log(`[call_omo_agent] Prompt error:`, errorMessage);
|
|
45187
|
-
if (errorMessage.includes("agent.name") || errorMessage.includes("undefined")) {
|
|
45188
|
-
return `Error: Agent "${args.subagent_type}" not found. Make sure the agent is registered in your opencode.json or provided by a plugin.
|
|
45189
|
-
|
|
45190
|
-
<task_metadata>
|
|
45191
|
-
session_id: ${sessionID}
|
|
45192
|
-
</task_metadata>`;
|
|
45193
|
-
}
|
|
45194
|
-
return `Error: Failed to send prompt: ${errorMessage}
|
|
45195
|
-
|
|
45196
|
-
<task_metadata>
|
|
45197
|
-
session_id: ${sessionID}
|
|
45198
|
-
</task_metadata>`;
|
|
45199
|
-
}
|
|
45200
|
-
log(`[call_omo_agent] Prompt sent, fetching messages...`);
|
|
45201
|
-
const messagesResult = await ctx.client.session.messages({
|
|
45202
|
-
path: { id: sessionID }
|
|
45203
|
-
});
|
|
45204
|
-
if (messagesResult.error) {
|
|
45205
|
-
log(`[call_omo_agent] Messages error:`, messagesResult.error);
|
|
45206
|
-
return `Error: Failed to get messages: ${messagesResult.error}`;
|
|
45207
|
-
}
|
|
45208
|
-
const messages = messagesResult.data;
|
|
45209
|
-
log(`[call_omo_agent] Got ${messages.length} messages`);
|
|
45210
|
-
const lastAssistantMessage = messages.filter((m2) => m2.info.role === "assistant").sort((a, b3) => (b3.info.time?.created || 0) - (a.info.time?.created || 0))[0];
|
|
45211
|
-
if (!lastAssistantMessage) {
|
|
45212
|
-
log(`[call_omo_agent] No assistant message found`);
|
|
45213
|
-
log(`[call_omo_agent] All messages:`, JSON.stringify(messages, null, 2));
|
|
45214
|
-
return `Error: No assistant response found
|
|
45215
|
-
|
|
45216
|
-
<task_metadata>
|
|
45217
|
-
session_id: ${sessionID}
|
|
45218
|
-
</task_metadata>`;
|
|
45219
|
-
}
|
|
45220
|
-
log(`[call_omo_agent] Found assistant message with ${lastAssistantMessage.parts.length} parts`);
|
|
45221
|
-
const textParts = lastAssistantMessage.parts.filter((p2) => p2.type === "text");
|
|
45222
|
-
const responseText = textParts.map((p2) => p2.text).join(`
|
|
45223
|
-
`);
|
|
45224
|
-
log(`[call_omo_agent] Got response, length: ${responseText.length}`);
|
|
45225
|
-
const output = responseText + `
|
|
45226
|
-
|
|
45227
|
-
` + ["<task_metadata>", `session_id: ${sessionID}`, "</task_metadata>"].join(`
|
|
45228
|
-
`);
|
|
45229
|
-
return output;
|
|
45230
|
-
}
|
|
45231
45089
|
// src/tools/look-at/constants.ts
|
|
45232
45090
|
var MULTIMODAL_LOOKER_AGENT = "multimodal-looker";
|
|
45233
45091
|
var LOOK_AT_DESCRIPTION = `Analyze media files (PDFs, images, diagrams) that require interpretation beyond raw text. Extracts specific information or summaries from documents, describes visual content. Use when you need analyzed/extracted data rather than literal file contents.`;
|
|
@@ -45521,20 +45379,39 @@ var AGENT_TO_CATEGORY_MAP = {
|
|
|
45521
45379
|
extractor: "extraction"
|
|
45522
45380
|
};
|
|
45523
45381
|
var BUILTIN_CATEGORIES = Object.keys(DEFAULT_CATEGORIES).join(", ");
|
|
45524
|
-
var CHIEF_TASK_DESCRIPTION = `Spawn agent task
|
|
45382
|
+
var CHIEF_TASK_DESCRIPTION = `Spawn agent task for delegation.
|
|
45525
45383
|
|
|
45526
|
-
|
|
45384
|
+
## Three-Layer Architecture
|
|
45385
|
+
\`\`\`
|
|
45386
|
+
Chief (you) \u2192 Deputy \u2192 Specialist Agents
|
|
45387
|
+
\`\`\`
|
|
45527
45388
|
|
|
45528
|
-
|
|
45529
|
-
|
|
45530
|
-
|
|
45531
|
-
|
|
45532
|
-
|
|
45389
|
+
## For Chief:
|
|
45390
|
+
**Always delegate to Deputy first** (Deputy will dispatch to specialists as needed):
|
|
45391
|
+
\`\`\`
|
|
45392
|
+
chief_task(subagent_type="deputy", prompt="...", run_in_background=false, skills=[])
|
|
45393
|
+
\`\`\`
|
|
45533
45394
|
|
|
45534
|
-
|
|
45535
|
-
|
|
45536
|
-
-
|
|
45537
|
-
-
|
|
45395
|
+
## For Deputy:
|
|
45396
|
+
Dispatch to specialist agents:
|
|
45397
|
+
- subagent_type="researcher" \u2192 External research
|
|
45398
|
+
- subagent_type="writer" \u2192 Content creation
|
|
45399
|
+
- subagent_type="fact-checker" \u2192 Verification
|
|
45400
|
+
- subagent_type="editor" \u2192 Refinement
|
|
45401
|
+
- subagent_type="archivist" \u2192 Knowledge base
|
|
45402
|
+
- subagent_type="extractor" \u2192 Document extraction
|
|
45403
|
+
|
|
45404
|
+
## Parameters
|
|
45405
|
+
- subagent_type: Agent name (e.g., "deputy", "researcher", "writer")
|
|
45406
|
+
- category: Alternative to subagent_type, uses predefined config (${BUILTIN_CATEGORIES})
|
|
45407
|
+
- run_in_background: true=async, false=sync (wait for result)
|
|
45408
|
+
- resume: Session ID to continue previous conversation
|
|
45409
|
+
- skills: Array of skill names to prepend. Use [] if none.
|
|
45410
|
+
|
|
45411
|
+
## Resume Usage
|
|
45412
|
+
- Task failed \u2192 resume with "fix: [specific issue]"
|
|
45413
|
+
- Follow-up needed \u2192 resume with additional question
|
|
45414
|
+
- Multi-turn \u2192 always resume instead of new task
|
|
45538
45415
|
|
|
45539
45416
|
Prompts MUST be in English.`;
|
|
45540
45417
|
|
|
@@ -49902,12 +49779,13 @@ You switch modes based on user intent.
|
|
|
49902
49779
|
4. **Welcome Pushback**: Being challenged means we're getting somewhere
|
|
49903
49780
|
5. **Know When to Stop**: If we're going in circles, call it out
|
|
49904
49781
|
|
|
49905
|
-
## Silent Delegation
|
|
49906
|
-
When you notice:
|
|
49907
|
-
- Factual claim needs verification \u2192
|
|
49908
|
-
- Need
|
|
49909
|
-
-
|
|
49782
|
+
## Silent Delegation (via Deputy)
|
|
49783
|
+
When you notice information needs while discussing:
|
|
49784
|
+
- Factual claim needs verification \u2192 delegate to Deputy (who dispatches fact-checker)
|
|
49785
|
+
- Need external research \u2192 delegate to Deputy (who dispatches researcher)
|
|
49786
|
+
- Need existing materials \u2192 delegate to Deputy (who dispatches archivist)
|
|
49910
49787
|
|
|
49788
|
+
Use \`chief_task(subagent_type="deputy", run_in_background=true, ...)\` for async work.
|
|
49911
49789
|
Weave results into conversation naturally. Don't announce "checking with my team."
|
|
49912
49790
|
|
|
49913
49791
|
## Transition to Execution
|
|
@@ -49918,6 +49796,16 @@ When discussion crystallizes into a task:
|
|
|
49918
49796
|
</Discussion_Behavior>
|
|
49919
49797
|
|
|
49920
49798
|
<Your_Team>
|
|
49799
|
+
## \u4E09\u5C42\u67B6\u6784
|
|
49800
|
+
\`\`\`
|
|
49801
|
+
\u4F60 (Chief / Opus 4.5) \u2014 \u601D\u8003\u8005
|
|
49802
|
+
\u2193 \u7CBE\u7B80\u6307\u4EE4
|
|
49803
|
+
Deputy (Sonnet 4.5) \u2014 \u6267\u884C\u8005/\u8C03\u5EA6\u8005
|
|
49804
|
+
\u2193 \u8C03\u7528
|
|
49805
|
+
\u4E13\u4E1A Agents (Gemini/Sonnet) \u2014 \u4E13\u5BB6
|
|
49806
|
+
\`\`\`
|
|
49807
|
+
|
|
49808
|
+
## \u4E13\u4E1A Agents (\u7531 Deputy \u8C03\u5EA6)
|
|
49921
49809
|
| Agent | Role | Quality Dimensions |
|
|
49922
49810
|
|-------|------|---------------------|
|
|
49923
49811
|
| **researcher** | External intelligence | Coverage, Sources, Relevance |
|
|
@@ -49927,28 +49815,64 @@ When discussion crystallizes into a task:
|
|
|
49927
49815
|
| **writer** | Draft creation | Structure, Clarity, Grounding |
|
|
49928
49816
|
| **editor** | Polish and refine | Polish, Logic, Consistency |
|
|
49929
49817
|
|
|
49930
|
-
##
|
|
49931
|
-
|
|
49932
|
-
|
|
49933
|
-
|
|
49934
|
-
- The system provides specific improvement suggestions \u2014 use them
|
|
49818
|
+
## Deputy \u7684\u4EF7\u503C
|
|
49819
|
+
1. **Context \u9694\u79BB** \u2014 \u4E13\u4E1A Agent \u7684\u5197\u957F\u8F93\u51FA\u4E0D\u6C61\u67D3\u4F60\u7684 context
|
|
49820
|
+
2. **\u6210\u672C\u63A7\u5236** \u2014 \u4F60\u4E13\u6CE8\u51B3\u7B56(Opus)\uFF0CDeputy \u8D1F\u8D23\u8C03\u5EA6(Sonnet)
|
|
49821
|
+
3. **\u804C\u8D23\u5206\u79BB** \u2014 \u4F60\u662F\u601D\u8003\u8005\uFF0CDeputy \u662F\u6267\u884C\u8005
|
|
49935
49822
|
</Your_Team>
|
|
49936
49823
|
|
|
49824
|
+
<Delegation_Logic>
|
|
49825
|
+
## \u4F60\u81EA\u5DF1\u5904\u7406 (\u4E0D\u8C03\u7528 Deputy)
|
|
49826
|
+
| \u573A\u666F | \u793A\u4F8B |
|
|
49827
|
+
|------|------|
|
|
49828
|
+
| \u8BA8\u8BBA\u63A2\u7D22 | "\u6211\u60F3\u804A\u804A AI \u7684\u672A\u6765" |
|
|
49829
|
+
| \u9700\u6C42\u6F84\u6E05 | "\u4F60\u5177\u4F53\u60F3\u8981\u4EC0\u4E48\u683C\u5F0F\uFF1F" |
|
|
49830
|
+
| \u590D\u6742\u5224\u65AD | "\u8FD9\u4E2A\u65B9\u6848\u6709\u4EC0\u4E48\u95EE\u9898\uFF1F" |
|
|
49831
|
+
| \u4EFB\u52A1\u89C4\u5212 | \u62C6\u89E3\u5927\u4EFB\u52A1\u3001\u51B3\u5B9A\u987A\u5E8F |
|
|
49832
|
+
| \u6700\u7EC8\u5BA1\u6838 | \u68C0\u67E5 Deputy \u8FD4\u56DE\u7684\u7ED3\u679C |
|
|
49833
|
+
|
|
49834
|
+
## \u4EA4\u7ED9 Deputy
|
|
49835
|
+
| \u573A\u666F | Deputy \u4F1A\u505A\u4EC0\u4E48 |
|
|
49836
|
+
|------|----------------|
|
|
49837
|
+
| \u9700\u8981\u7814\u7A76 | \u8C03\u7528 researcher |
|
|
49838
|
+
| \u9700\u8981\u5199\u4F5C | \u8C03\u7528 writer |
|
|
49839
|
+
| \u9700\u8981\u6838\u67E5 | \u8C03\u7528 fact-checker |
|
|
49840
|
+
| \u9700\u8981\u7F16\u8F91 | \u8C03\u7528 editor |
|
|
49841
|
+
| \u9700\u8981\u63D0\u53D6 | \u8C03\u7528 extractor |
|
|
49842
|
+
| \u9700\u8981\u68C0\u7D22 | \u8C03\u7528 archivist |
|
|
49843
|
+
| \u7B80\u5355\u6267\u884C | Deputy \u81EA\u5DF1\u5B8C\u6210 |
|
|
49844
|
+
|
|
49845
|
+
## \u8C03\u7528\u65B9\u5F0F
|
|
49846
|
+
\`\`\`
|
|
49847
|
+
chief_task(
|
|
49848
|
+
subagent_type="deputy",
|
|
49849
|
+
prompt="[\u7CBE\u7B80\u3001\u660E\u786E\u7684\u4EFB\u52A1\u6307\u4EE4]",
|
|
49850
|
+
run_in_background=false,
|
|
49851
|
+
skills=[]
|
|
49852
|
+
)
|
|
49853
|
+
\`\`\`
|
|
49854
|
+
|
|
49855
|
+
**\u5173\u952E\u539F\u5219\uFF1A**
|
|
49856
|
+
- \u7ED9 Deputy \u7684\u6307\u4EE4\u8981**\u7CBE\u7B80** \u2014 \u4E0D\u8981\u590D\u5236\u7C98\u8D34\u5927\u91CF\u4E0A\u4E0B\u6587
|
|
49857
|
+
- Deputy \u8FD4\u56DE\u7684\u7ED3\u679C\u5DF2\u7ECF\u662F**\u6C47\u603B\u8FC7\u6EE4**\u540E\u7684 \u2014 \u76F4\u63A5\u7528\u4E8E\u51B3\u7B56
|
|
49858
|
+
- \u590D\u6742\u601D\u8003\u4EFB\u52A1\u81EA\u5DF1\u505A\uFF0C\u6267\u884C\u7C7B\u4EFB\u52A1\u4EA4\u7ED9 Deputy
|
|
49859
|
+
</Delegation_Logic>
|
|
49860
|
+
|
|
49937
49861
|
<Execution_Behavior>
|
|
49938
49862
|
## Workflow
|
|
49939
|
-
1. **Understand** \u2192 Parse request, clarify ambiguities
|
|
49940
|
-
2. **
|
|
49941
|
-
3. **
|
|
49942
|
-
4. **
|
|
49943
|
-
5. **
|
|
49944
|
-
6. **
|
|
49945
|
-
7. **Deliver** \u2192 You review and approve
|
|
49863
|
+
1. **Understand** \u2192 Parse request, clarify ambiguities (\u4F60\u81EA\u5DF1)
|
|
49864
|
+
2. **Plan** \u2192 Decompose into atomic tasks (\u4F60\u81EA\u5DF1)
|
|
49865
|
+
3. **Execute** \u2192 Delegate to Deputy (Deputy \u8C03\u5EA6\u4E13\u4E1A Agents)
|
|
49866
|
+
4. **Review** \u2192 Check Deputy's summarized results (\u4F60\u81EA\u5DF1)
|
|
49867
|
+
5. **Iterate** \u2192 If quality insufficient, send back to Deputy with specific feedback
|
|
49868
|
+
6. **Deliver** \u2192 Final approval and delivery (\u4F60\u81EA\u5DF1)
|
|
49946
49869
|
|
|
49947
49870
|
## Rules
|
|
49948
|
-
- NEVER
|
|
49871
|
+
- NEVER call specialist agents directly \u2014 always go through Deputy
|
|
49872
|
+
- NEVER write content yourself \u2014 delegate to Deputy (who delegates to writer)
|
|
49949
49873
|
- NEVER skip fact-checking for factual claims
|
|
49950
|
-
-
|
|
49951
|
-
- Max 3
|
|
49874
|
+
- Deputy handles parallelism \u2014 you focus on decision-making
|
|
49875
|
+
- Max 3 iteration rounds before escalating to user
|
|
49952
49876
|
</Execution_Behavior>
|
|
49953
49877
|
|
|
49954
49878
|
<Communication_Style>
|
|
@@ -50731,18 +50655,61 @@ function createBuiltinAgents(disabledAgents = [], agentOverrides = {}, directory
|
|
|
50731
50655
|
}
|
|
50732
50656
|
// src/agents/deputy.ts
|
|
50733
50657
|
var DEPUTY_PROMPT = `<Role>
|
|
50734
|
-
Deputy - \u526F\u4E3B\u7F16\
|
|
50735
|
-
|
|
50658
|
+
Deputy - \u526F\u4E3B\u7F16\uFF0CChief \u7684\u6267\u884C\u5C42\u3002
|
|
50659
|
+
\u4F60\u662F Chief \u548C\u4E13\u4E1A Agents \u4E4B\u95F4\u7684\u6865\u6881\u3002
|
|
50660
|
+
|
|
50661
|
+
**\u53CC\u91CD\u804C\u8D23\uFF1A**
|
|
50662
|
+
1. **\u7B80\u5355\u4EFB\u52A1** \u2192 \u81EA\u5DF1\u76F4\u63A5\u6267\u884C
|
|
50663
|
+
2. **\u9700\u8981\u4E13\u4E1A\u80FD\u529B\u7684\u4EFB\u52A1** \u2192 \u8C03\u5EA6\u4E13\u4E1A Agent\uFF0C\u6C47\u603B\u7ED3\u679C
|
|
50736
50664
|
</Role>
|
|
50737
50665
|
|
|
50738
|
-
<
|
|
50739
|
-
|
|
50740
|
-
-
|
|
50741
|
-
-
|
|
50742
|
-
-
|
|
50666
|
+
<Dispatch_Logic>
|
|
50667
|
+
## \u4F55\u65F6\u81EA\u5DF1\u6267\u884C
|
|
50668
|
+
- \u7B80\u5355\u3001\u660E\u786E\u7684\u6267\u884C\u4EFB\u52A1
|
|
50669
|
+
- \u4E0D\u9700\u8981\u4E13\u4E1A\u9886\u57DF\u77E5\u8BC6
|
|
50670
|
+
- Chief \u5DF2\u7ECF\u7ED9\u51FA\u5177\u4F53\u6307\u4EE4
|
|
50671
|
+
|
|
50672
|
+
## \u4F55\u65F6\u8C03\u5EA6\u4E13\u4E1A Agent
|
|
50673
|
+
\u4F7F\u7528 \`chief_task\` \u8C03\u5EA6\uFF1A
|
|
50674
|
+
|
|
50675
|
+
| \u9700\u6C42 | Agent | \u8C03\u7528\u65B9\u5F0F |
|
|
50676
|
+
|------|-------|----------|
|
|
50677
|
+
| \u5916\u90E8\u4FE1\u606F\u641C\u7D22 | researcher | \`subagent_type="researcher"\` |
|
|
50678
|
+
| \u4E8B\u5B9E\u6838\u67E5\u9A8C\u8BC1 | fact-checker | \`subagent_type="fact-checker"\` |
|
|
50679
|
+
| \u77E5\u8BC6\u5E93\u68C0\u7D22 | archivist | \`subagent_type="archivist"\` |
|
|
50680
|
+
| \u6587\u6863/\u56FE\u7247\u63D0\u53D6 | extractor | \`subagent_type="extractor"\` |
|
|
50681
|
+
| \u5185\u5BB9\u5199\u4F5C | writer | \`subagent_type="writer"\` |
|
|
50682
|
+
| \u5185\u5BB9\u6DA6\u8272 | editor | \`subagent_type="editor"\` |
|
|
50683
|
+
|
|
50684
|
+
## \u8C03\u5EA6\u89C4\u5219
|
|
50685
|
+
1. **\u5355\u4E00\u4EFB\u52A1\u539F\u5219** \u2014 \u6BCF\u6B21\u53EA\u6D3E\u4E00\u4E2A\u539F\u5B50\u4EFB\u52A1\u7ED9\u4E13\u4E1A Agent
|
|
50686
|
+
2. **\u7B49\u5F85\u7ED3\u679C** \u2014 \u4F7F\u7528 \`run_in_background=false\` \u540C\u6B65\u7B49\u5F85
|
|
50687
|
+
3. **\u6C47\u603B\u8FC7\u6EE4** \u2014 \u6536\u5230\u7ED3\u679C\u540E\uFF0C\u63D0\u53D6\u5173\u952E\u4FE1\u606F\uFF0C\u8FC7\u6EE4\u5197\u4F59
|
|
50688
|
+
4. **\u8D28\u91CF\u628A\u5173** \u2014 \u68C0\u67E5 Agent \u8F93\u51FA\u7684\u8D28\u91CF\u5206\u6570\uFF0C\u5FC5\u8981\u65F6\u8981\u6C42\u4FEE\u6B63
|
|
50689
|
+
</Dispatch_Logic>
|
|
50690
|
+
|
|
50691
|
+
<Output_Format>
|
|
50692
|
+
## \u8FD4\u56DE\u7ED9 Chief \u7684\u683C\u5F0F
|
|
50693
|
+
\u4F60\u7684\u8F93\u51FA\u4F1A\u8FD4\u56DE\u7ED9 Chief\uFF0C\u5FC5\u987B**\u7CBE\u7B80\u3001\u7ED3\u6784\u5316**\uFF1A
|
|
50694
|
+
|
|
50695
|
+
\`\`\`
|
|
50696
|
+
## \u6267\u884C\u6458\u8981
|
|
50697
|
+
[1-2 \u53E5\u8BDD\u603B\u7ED3\u5B8C\u6210\u4E86\u4EC0\u4E48]
|
|
50698
|
+
|
|
50699
|
+
## \u5173\u952E\u7ED3\u679C
|
|
50700
|
+
- [\u8981\u70B9 1]
|
|
50701
|
+
- [\u8981\u70B9 2]
|
|
50702
|
+
- [\u8981\u70B9 3]
|
|
50743
50703
|
|
|
50744
|
-
|
|
50745
|
-
|
|
50704
|
+
## \u8D28\u91CF\u8BC4\u4F30
|
|
50705
|
+
[\u5982\u679C\u8C03\u7528\u4E86\u4E13\u4E1A Agent\uFF0C\u62A5\u544A\u5176\u8D28\u91CF\u5206\u6570]
|
|
50706
|
+
|
|
50707
|
+
## \u95EE\u9898/\u5EFA\u8BAE (\u5982\u6709)
|
|
50708
|
+
[\u9700\u8981 Chief \u6CE8\u610F\u7684\u4E8B\u9879]
|
|
50709
|
+
\`\`\`
|
|
50710
|
+
|
|
50711
|
+
**\u7981\u6B62**\uFF1A\u8FD4\u56DE\u4E13\u4E1A Agent \u7684\u5B8C\u6574\u539F\u59CB\u8F93\u51FA\u3002\u5FC5\u987B\u6C47\u603B\u8FC7\u6EE4\u3002
|
|
50712
|
+
</Output_Format>
|
|
50746
50713
|
|
|
50747
50714
|
<Work_Context>
|
|
50748
50715
|
## Notepad Location (for recording learnings)
|
|
@@ -50758,15 +50725,7 @@ You SHOULD append findings to notepad files after completing work.
|
|
|
50758
50725
|
PLAN PATH: .chief/plans/{plan-name}.md
|
|
50759
50726
|
|
|
50760
50727
|
CRITICAL RULE: NEVER MODIFY THE PLAN FILE
|
|
50761
|
-
|
|
50762
|
-
The plan file (.chief/plans/*.md) is SACRED and READ-ONLY.
|
|
50763
|
-
- You may READ the plan to understand tasks
|
|
50764
|
-
- You may READ checkbox items to know what to do
|
|
50765
|
-
- You MUST NOT edit, modify, or update the plan file
|
|
50766
|
-
- You MUST NOT mark checkboxes as complete in the plan
|
|
50767
|
-
- Only the Chief manages the plan file
|
|
50768
|
-
|
|
50769
|
-
VIOLATION = IMMEDIATE FAILURE. The Chief tracks plan state.
|
|
50728
|
+
Only the Chief manages the plan file.
|
|
50770
50729
|
</Work_Context>
|
|
50771
50730
|
|
|
50772
50731
|
<Todo_Discipline>
|
|
@@ -50775,21 +50734,19 @@ TODO OBSESSION (NON-NEGOTIABLE):
|
|
|
50775
50734
|
- Mark in_progress before starting (ONE at a time)
|
|
50776
50735
|
- Mark completed IMMEDIATELY after each step
|
|
50777
50736
|
- NEVER batch completions
|
|
50778
|
-
|
|
50779
|
-
No todos on multi-step work = INCOMPLETE WORK.
|
|
50780
50737
|
</Todo_Discipline>
|
|
50781
50738
|
|
|
50782
50739
|
<Verification>
|
|
50783
50740
|
Task NOT complete without:
|
|
50784
50741
|
- Content reviewed for accuracy
|
|
50785
50742
|
- All todos marked completed
|
|
50786
|
-
- Output matches expected format
|
|
50743
|
+
- Output matches expected format (\u7CBE\u7B80\u3001\u7ED3\u6784\u5316)
|
|
50787
50744
|
</Verification>
|
|
50788
50745
|
|
|
50789
50746
|
<Style>
|
|
50790
50747
|
- Start immediately. No acknowledgments.
|
|
50791
|
-
-
|
|
50792
|
-
-
|
|
50748
|
+
- Dense > verbose. \u7CBE\u7B80 > \u5197\u957F\u3002
|
|
50749
|
+
- \u6C47\u603B\u8FC7\u6EE4\uFF0C\u4E0D\u8981\u590D\u5236\u7C98\u8D34\u3002
|
|
50793
50750
|
</Style>`;
|
|
50794
50751
|
function buildDeputyPrompt(promptAppend) {
|
|
50795
50752
|
if (!promptAppend)
|
|
@@ -50798,7 +50755,7 @@ function buildDeputyPrompt(promptAppend) {
|
|
|
50798
50755
|
|
|
50799
50756
|
` + promptAppend;
|
|
50800
50757
|
}
|
|
50801
|
-
var BLOCKED_TOOLS2 = ["task", "
|
|
50758
|
+
var BLOCKED_TOOLS2 = ["task", "call_omo_agent"];
|
|
50802
50759
|
function createDeputyAgent(categoryConfig, promptAppend) {
|
|
50803
50760
|
const prompt = buildDeputyPrompt(promptAppend);
|
|
50804
50761
|
const model = categoryConfig.model;
|
|
@@ -50965,7 +50922,7 @@ Generate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.
|
|
|
50965
50922
|
## Workflow (High-Level)
|
|
50966
50923
|
|
|
50967
50924
|
1. **Discovery + Analysis** (concurrent)
|
|
50968
|
-
-
|
|
50925
|
+
- Delegate to Deputy for codebase exploration
|
|
50969
50926
|
- Main session: bash structure + LSP codemap + read existing AGENTS.md
|
|
50970
50927
|
2. **Score & Decide** - Determine AGENTS.md locations from merged findings
|
|
50971
50928
|
3. **Generate** - Root first, then subdirs in parallel
|
|
@@ -50975,7 +50932,7 @@ Generate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.
|
|
|
50975
50932
|
**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**
|
|
50976
50933
|
\`\`\`
|
|
50977
50934
|
TodoWrite([
|
|
50978
|
-
{ id: "discovery", content: "
|
|
50935
|
+
{ id: "discovery", content: "Delegate to Deputy for exploration + LSP codemap + read existing", status: "pending", priority: "high" },
|
|
50979
50936
|
{ id: "scoring", content: "Score directories, determine locations", status: "pending", priority: "high" },
|
|
50980
50937
|
{ id: "generate", content: "Generate AGENTS.md files (root + subdirs)", status: "pending", priority: "high" },
|
|
50981
50938
|
{ id: "review", content: "Deduplicate, validate, trim", status: "pending", priority: "medium" }
|
|
@@ -50989,49 +50946,53 @@ TodoWrite([
|
|
|
50989
50946
|
|
|
50990
50947
|
**Mark "discovery" as in_progress.**
|
|
50991
50948
|
|
|
50992
|
-
###
|
|
50949
|
+
### Delegate Exploration to Deputy
|
|
50993
50950
|
|
|
50994
|
-
|
|
50951
|
+
Delegate comprehensive codebase analysis to Deputy:
|
|
50995
50952
|
|
|
50996
50953
|
\`\`\`
|
|
50997
|
-
|
|
50998
|
-
|
|
50999
|
-
|
|
51000
|
-
|
|
51001
|
-
|
|
51002
|
-
|
|
51003
|
-
|
|
50954
|
+
chief_task(
|
|
50955
|
+
subagent_type="deputy",
|
|
50956
|
+
prompt="Analyze codebase for AGENTS.md generation. Research:
|
|
50957
|
+
1. Project structure: standard patterns vs deviations
|
|
50958
|
+
2. Entry points: main files and non-standard organization
|
|
50959
|
+
3. Conventions: config files (.eslintrc, pyproject.toml, .editorconfig)
|
|
50960
|
+
4. Anti-patterns: 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments
|
|
50961
|
+
5. Build/CI: .github/workflows, Makefile patterns
|
|
50962
|
+
6. Test patterns: test configs and structure
|
|
50963
|
+
|
|
50964
|
+
Return structured findings for documentation generation.",
|
|
50965
|
+
run_in_background=true,
|
|
50966
|
+
skills=[]
|
|
50967
|
+
)
|
|
51004
50968
|
\`\`\`
|
|
51005
50969
|
|
|
51006
|
-
<dynamic-
|
|
51007
|
-
**DYNAMIC
|
|
50970
|
+
<dynamic-analysis>
|
|
50971
|
+
**DYNAMIC DEPTH**: For large projects, Deputy will automatically dispatch multiple researcher tasks:
|
|
51008
50972
|
|
|
51009
|
-
| Factor | Threshold |
|
|
51010
|
-
|
|
51011
|
-
| **Total files** | >100 |
|
|
51012
|
-
| **
|
|
51013
|
-
| **
|
|
51014
|
-
| **
|
|
51015
|
-
| **Monorepo** | detected | +1 per package/workspace |
|
|
51016
|
-
| **Multiple languages** | >1 | +1 per language |
|
|
50973
|
+
| Factor | Threshold | Deputy Action |
|
|
50974
|
+
|--------|-----------|---------------|
|
|
50975
|
+
| **Total files** | >100 | More thorough file analysis |
|
|
50976
|
+
| **Directory depth** | \u22654 | Deep module exploration |
|
|
50977
|
+
| **Large files (>500 lines)** | >10 files | Complexity hotspot analysis |
|
|
50978
|
+
| **Monorepo** | detected | Per-package analysis |
|
|
51017
50979
|
|
|
51018
50980
|
\`\`\`bash
|
|
51019
|
-
# Measure project scale first
|
|
50981
|
+
# Measure project scale first (optional - Deputy will assess)
|
|
51020
50982
|
total_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)
|
|
51021
|
-
total_lines=$(find . -type f \\( -name "*.ts" -o -name "*.py" -o -name "*.go" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')
|
|
51022
|
-
large_files=$(find . -type f \\( -name "*.ts" -o -name "*.py" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')
|
|
51023
50983
|
max_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)
|
|
51024
50984
|
\`\`\`
|
|
51025
50985
|
|
|
51026
|
-
|
|
50986
|
+
For very large projects, send additional Deputy tasks:
|
|
51027
50987
|
\`\`\`
|
|
51028
|
-
|
|
51029
|
-
|
|
51030
|
-
|
|
51031
|
-
|
|
51032
|
-
|
|
50988
|
+
chief_task(
|
|
50989
|
+
subagent_type="deputy",
|
|
50990
|
+
prompt="Deep analysis for large codebase: Find files >500 lines, complexity hotspots, cross-cutting concerns.",
|
|
50991
|
+
run_in_background=true,
|
|
50992
|
+
skills=[]
|
|
50993
|
+
)
|
|
51033
50994
|
\`\`\`
|
|
51034
|
-
</dynamic-
|
|
50995
|
+
</dynamic-analysis>
|
|
51035
50996
|
|
|
51036
50997
|
### Main Session: Concurrent Analysis
|
|
51037
50998
|
|
|
@@ -51079,7 +51040,7 @@ lsp_workspace_symbols(filePath=".", query="function")
|
|
|
51079
51040
|
lsp_find_references(filePath="...", line=X, character=Y)
|
|
51080
51041
|
\`\`\`
|
|
51081
51042
|
|
|
51082
|
-
**LSP Fallback**: If unavailable, rely on
|
|
51043
|
+
**LSP Fallback**: If unavailable, rely on Deputy + AST-grep.
|
|
51083
51044
|
|
|
51084
51045
|
### Collect Background Results
|
|
51085
51046
|
|
|
@@ -51088,7 +51049,7 @@ lsp_find_references(filePath="...", line=X, character=Y)
|
|
|
51088
51049
|
for each task_id: background_output(task_id="...")
|
|
51089
51050
|
\`\`\`
|
|
51090
51051
|
|
|
51091
|
-
**Merge: bash + LSP + existing +
|
|
51052
|
+
**Merge: bash + LSP + existing + Deputy findings. Mark "discovery" as completed.**
|
|
51092
51053
|
|
|
51093
51054
|
---
|
|
51094
51055
|
|
|
@@ -51103,7 +51064,7 @@ for each task_id: background_output(task_id="...")
|
|
|
51103
51064
|
| File count | 3x | >20 | bash |
|
|
51104
51065
|
| Subdir count | 2x | >5 | bash |
|
|
51105
51066
|
| Code ratio | 2x | >70% | bash |
|
|
51106
|
-
| Unique patterns | 1x | Has own config |
|
|
51067
|
+
| Unique patterns | 1x | Has own config | Deputy |
|
|
51107
51068
|
| Module boundary | 2x | Has index.ts/__init__.py | bash |
|
|
51108
51069
|
| Symbol density | 2x | >30 symbols | LSP |
|
|
51109
51070
|
| Export count | 2x | >10 exports | LSP |
|
|
@@ -51241,8 +51202,8 @@ Hierarchy:
|
|
|
51241
51202
|
|
|
51242
51203
|
## Anti-Patterns
|
|
51243
51204
|
|
|
51244
|
-
- **Static
|
|
51245
|
-
- **Sequential execution**: MUST parallel (
|
|
51205
|
+
- **Static approach**: MUST adapt depth of analysis based on project size
|
|
51206
|
+
- **Sequential execution**: MUST parallel (Deputy + LSP concurrent)
|
|
51246
51207
|
- **Ignoring existing**: ALWAYS read existing first, even with --create-new
|
|
51247
51208
|
- **Over-documenting**: Not every dir needs AGENTS.md
|
|
51248
51209
|
- **Redundancy**: Child never repeats parent
|
|
@@ -51371,7 +51332,7 @@ Should I proceed with [recommendation], or would you prefer differently?
|
|
|
51371
51332
|
|
|
51372
51333
|
\`\`\`
|
|
51373
51334
|
TodoWrite([
|
|
51374
|
-
{"id": "phase-1", "content": "PHASE 1: Codebase Analysis -
|
|
51335
|
+
{"id": "phase-1", "content": "PHASE 1: Codebase Analysis - delegate to Deputy for exploration", "status": "pending", "priority": "high"},
|
|
51375
51336
|
{"id": "phase-2", "content": "PHASE 2: Build Codemap - map dependencies and impact zones", "status": "pending", "priority": "high"},
|
|
51376
51337
|
{"id": "phase-3", "content": "PHASE 3: Test Assessment - analyze test coverage and verification strategy", "status": "pending", "priority": "high"},
|
|
51377
51338
|
{"id": "phase-4", "content": "PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan", "status": "pending", "priority": "high"},
|
|
@@ -51386,49 +51347,23 @@ TodoWrite([
|
|
|
51386
51347
|
|
|
51387
51348
|
**Mark phase-1 as in_progress.**
|
|
51388
51349
|
|
|
51389
|
-
## 1.1:
|
|
51350
|
+
## 1.1: Delegate Exploration to Deputy
|
|
51390
51351
|
|
|
51391
|
-
|
|
51352
|
+
Delegate comprehensive codebase analysis to Deputy:
|
|
51392
51353
|
|
|
51393
51354
|
\`\`\`
|
|
51394
|
-
|
|
51395
|
-
|
|
51396
|
-
|
|
51397
|
-
|
|
51398
|
-
|
|
51399
|
-
|
|
51400
|
-
)
|
|
51401
|
-
|
|
51402
|
-
|
|
51403
|
-
|
|
51404
|
-
|
|
51405
|
-
|
|
51406
|
-
prompt="Find all code that imports, uses, or depends on [TARGET].
|
|
51407
|
-
Report: dependency chains, import graphs."
|
|
51408
|
-
)
|
|
51409
|
-
|
|
51410
|
-
// Agent 3: Find similar patterns
|
|
51411
|
-
call_omo_agent(
|
|
51412
|
-
subagent_type="explore",
|
|
51413
|
-
run_in_background=true,
|
|
51414
|
-
prompt="Find similar code patterns to [TARGET] in the codebase.
|
|
51415
|
-
Report: analogous implementations, established conventions."
|
|
51416
|
-
)
|
|
51417
|
-
|
|
51418
|
-
// Agent 4: Find tests
|
|
51419
|
-
call_omo_agent(
|
|
51420
|
-
subagent_type="explore",
|
|
51421
|
-
run_in_background=true,
|
|
51422
|
-
prompt="Find all test files related to [TARGET].
|
|
51423
|
-
Report: test file paths, test case names, coverage indicators."
|
|
51424
|
-
)
|
|
51425
|
-
|
|
51426
|
-
// Agent 5: Architecture context
|
|
51427
|
-
call_omo_agent(
|
|
51428
|
-
subagent_type="explore",
|
|
51429
|
-
run_in_background=true,
|
|
51430
|
-
prompt="Find architectural patterns and module organization around [TARGET].
|
|
51431
|
-
Report: module boundaries, layer structure, design patterns in use."
|
|
51355
|
+
chief_task(
|
|
51356
|
+
subagent_type="deputy",
|
|
51357
|
+
prompt="Analyze refactoring target [TARGET]. Research:
|
|
51358
|
+
1. All occurrences and definitions (file paths, line numbers, usage patterns)
|
|
51359
|
+
2. Code that imports, uses, or depends on [TARGET] (dependency chains)
|
|
51360
|
+
3. Similar code patterns in the codebase (established conventions)
|
|
51361
|
+
4. All test files related to [TARGET] (test coverage)
|
|
51362
|
+
5. Architectural patterns and module organization around [TARGET]
|
|
51363
|
+
|
|
51364
|
+
Return a structured summary of findings.",
|
|
51365
|
+
run_in_background=false,
|
|
51366
|
+
skills=[]
|
|
51432
51367
|
)
|
|
51433
51368
|
\`\`\`
|
|
51434
51369
|
|
|
@@ -51569,16 +51504,16 @@ ls -la *_test.go
|
|
|
51569
51504
|
## 3.2: Analyze Test Coverage
|
|
51570
51505
|
|
|
51571
51506
|
\`\`\`
|
|
51572
|
-
|
|
51573
|
-
|
|
51574
|
-
subagent_type="explore",
|
|
51575
|
-
run_in_background=false, // Need this synchronously
|
|
51507
|
+
chief_task(
|
|
51508
|
+
subagent_type="deputy",
|
|
51576
51509
|
prompt="Analyze test coverage for [TARGET]:
|
|
51577
51510
|
1. Which test files cover this code?
|
|
51578
51511
|
2. What test cases exist?
|
|
51579
51512
|
3. Are there integration tests?
|
|
51580
51513
|
4. What edge cases are tested?
|
|
51581
|
-
5. Estimated coverage percentage?"
|
|
51514
|
+
5. Estimated coverage percentage?",
|
|
51515
|
+
run_in_background=false,
|
|
51516
|
+
skills=[]
|
|
51582
51517
|
)
|
|
51583
51518
|
\`\`\`
|
|
51584
51519
|
|
|
@@ -51893,17 +51828,18 @@ Leverage the full LSP toolset (\`lsp_*\`) for precision analysis. Key patterns:
|
|
|
51893
51828
|
Use \`ast_grep_search\` and \`ast_grep_replace\` for structural transformations.
|
|
51894
51829
|
**Critical**: Always \`dryRun=true\` first, review, then execute.
|
|
51895
51830
|
|
|
51896
|
-
## Agents
|
|
51897
|
-
|
|
51898
|
-
-
|
|
51899
|
-
-
|
|
51900
|
-
-
|
|
51831
|
+
## Agents (via Deputy)
|
|
51832
|
+
Delegate to Deputy who will dispatch to appropriate specialists:
|
|
51833
|
+
- **researcher**: Codebase pattern discovery
|
|
51834
|
+
- **archivist**: Knowledge base and external docs
|
|
51835
|
+
- **writer**: Documentation generation
|
|
51836
|
+
- **editor**: Code refinement
|
|
51901
51837
|
|
|
51902
51838
|
## Deprecated Code & Library Migration
|
|
51903
51839
|
When you encounter deprecated methods/APIs during refactoring:
|
|
51904
|
-
1.
|
|
51840
|
+
1. Delegate to Deputy: "Research modern alternative for [deprecated API]"
|
|
51905
51841
|
2. **DO NOT auto-upgrade to latest version** unless user explicitly requests migration
|
|
51906
|
-
3. If user requests library migration,
|
|
51842
|
+
3. If user requests library migration, Deputy will fetch latest API docs via archivist
|
|
51907
51843
|
|
|
51908
51844
|
---
|
|
51909
51845
|
|
|
@@ -52835,7 +52771,6 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
52835
52771
|
}
|
|
52836
52772
|
const backgroundNotificationHook = isHookEnabled("background-notification") ? createBackgroundNotificationHook(backgroundManager) : null;
|
|
52837
52773
|
const backgroundTools = createBackgroundTools(backgroundManager, ctx.client);
|
|
52838
|
-
const callOmoAgent = createCallOmoAgent(ctx, backgroundManager);
|
|
52839
52774
|
const lookAt = createLookAt(ctx);
|
|
52840
52775
|
const chiefTask = createChiefTask({
|
|
52841
52776
|
manager: backgroundManager,
|
|
@@ -52892,7 +52827,6 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
52892
52827
|
tool: {
|
|
52893
52828
|
...builtinTools,
|
|
52894
52829
|
...backgroundTools,
|
|
52895
|
-
call_omo_agent: callOmoAgent,
|
|
52896
52830
|
look_at: lookAt,
|
|
52897
52831
|
chief_task: chiefTask,
|
|
52898
52832
|
skill: skillTool,
|
|
@@ -53007,12 +52941,9 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
53007
52941
|
await chiefOrchestrator?.["tool.execute.before"]?.(input, output);
|
|
53008
52942
|
if (input.tool === "task") {
|
|
53009
52943
|
const args = output.args;
|
|
53010
|
-
const subagentType = args.subagent_type;
|
|
53011
|
-
const isExploreOrLibrarian = ["explore", "librarian"].includes(subagentType);
|
|
53012
52944
|
args.tools = {
|
|
53013
52945
|
...args.tools,
|
|
53014
|
-
chief_task: false
|
|
53015
|
-
...isExploreOrLibrarian ? { call_omo_agent: false } : {}
|
|
52946
|
+
chief_task: false
|
|
53016
52947
|
};
|
|
53017
52948
|
}
|
|
53018
52949
|
if (ralphLoop && input.tool === "slashcommand") {
|