@ngockhoale/ukit 1.3.1 → 1.4.1
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/CHANGELOG.md +29 -1
- package/package.json +1 -1
- package/src/bug/triageBug.js +1 -33
- package/src/cli/commands/install.js +5 -10
- package/src/context/detectProjectContext.js +3 -24
- package/src/core/compact/index.js +19 -27
- package/src/core/ensureGitignore.js +1 -1
- package/src/core/fileOps.js +41 -2
- package/src/core/memory/hygiene.js +17 -1
- package/src/core/memory/store.js +14 -36
- package/src/core/metadata.js +5 -5
- package/src/core/output/index.js +20 -20
- package/src/core/packageManager.js +51 -0
- package/src/core/router/router.js +22 -6
- package/src/core/runInstallPipeline.js +1 -36
- package/src/core/runtimeConfig.js +27 -6
- package/src/core/token/index.js +21 -1
- package/src/core/uninstall.js +15 -38
- package/src/index/buildIndex.js +217 -49
- package/src/index/gitHooks.js +32 -7
- package/src/index/impactContext.js +16 -6
- package/src/index/importResolution.js +105 -28
- package/src/index/paths.js +29 -0
- package/src/index/queryIndex.js +20 -35
- package/src/index/relatedTests.js +15 -2
- package/src/index/routeCatalog.js +1 -1
- package/src/index/taskRouting.js +96 -17
- package/src/index/verificationPlan.js +12 -38
- package/templates/.claude/hooks/skill-router.sh +5 -2
- package/templates/.claude/ukit/index/route-catalog.mjs +1 -1
- package/templates/.claude/ukit/index/route-task.mjs +41 -5
- package/templates/.claude/ukit/index/verify-context.mjs +10 -2
- package/templates/.codex/README.md +1 -1
- package/templates/CLAUDE.md +9 -1
- package/templates/ukit/README.md +1 -1
- package/templates/ukit/storage/config.json +23 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
+
import { detectPackageManagerFromFingerprint, getDeclaredPackageManager } from '../core/packageManager.js';
|
|
4
5
|
import { resolveContext } from './resolveContext.js';
|
|
5
6
|
|
|
6
7
|
const RISKY_SKILL_IDS = new Set(['discover-security', 'repo-maintenance']);
|
|
@@ -25,6 +26,7 @@ export async function deriveVerificationPlan({
|
|
|
25
26
|
contextResult = null,
|
|
26
27
|
impactContext = null,
|
|
27
28
|
skillIds = [],
|
|
29
|
+
autonomyLevel = 'balanced',
|
|
28
30
|
} = {}) {
|
|
29
31
|
const absoluteRoot = path.resolve(rootDir);
|
|
30
32
|
const resolvedContext = contextResult ?? await resolveContext({
|
|
@@ -43,6 +45,7 @@ export async function deriveVerificationPlan({
|
|
|
43
45
|
taskType: effectiveTaskType,
|
|
44
46
|
skillIds,
|
|
45
47
|
context,
|
|
48
|
+
autonomyLevel,
|
|
46
49
|
});
|
|
47
50
|
|
|
48
51
|
const cachedPlan = getRecentCacheEntry(VERIFICATION_PLAN_CACHE, verificationPlanCacheKey);
|
|
@@ -160,6 +163,7 @@ export async function deriveVerificationPlan({
|
|
|
160
163
|
fallbackCommands: fallbackCommandList,
|
|
161
164
|
reasons: reasonList,
|
|
162
165
|
context,
|
|
166
|
+
autonomyLevel,
|
|
163
167
|
}),
|
|
164
168
|
context,
|
|
165
169
|
};
|
|
@@ -274,7 +278,7 @@ async function loadProjectVerificationEnvironment({
|
|
|
274
278
|
.then((resolvedPkg) => ({
|
|
275
279
|
pkg: resolvedPkg,
|
|
276
280
|
scripts: extractScripts(resolvedPkg),
|
|
277
|
-
packageManager:
|
|
281
|
+
packageManager: detectPackageManagerFromFingerprint({ fingerprintEntries, pkg: resolvedPkg }),
|
|
278
282
|
}))
|
|
279
283
|
.catch((error) => {
|
|
280
284
|
PROJECT_VERIFICATION_ENV_CACHE.delete(cacheKey);
|
|
@@ -294,41 +298,6 @@ function extractScripts(pkg = null) {
|
|
|
294
298
|
return pkg?.scripts && typeof pkg.scripts === 'object' ? pkg.scripts : {};
|
|
295
299
|
}
|
|
296
300
|
|
|
297
|
-
function detectPackageManager({ fingerprintEntries = [], pkg = null } = {}) {
|
|
298
|
-
const declaredPackageManager = getDeclaredPackageManager(pkg);
|
|
299
|
-
if (declaredPackageManager) return declaredPackageManager;
|
|
300
|
-
|
|
301
|
-
const existingFiles = new Set(
|
|
302
|
-
fingerprintEntries
|
|
303
|
-
.filter((entry) => entry && entry.mtimeMs !== null)
|
|
304
|
-
.map((entry) => entry.filePath),
|
|
305
|
-
);
|
|
306
|
-
const checks = [
|
|
307
|
-
['pnpm-lock.yaml', 'pnpm'],
|
|
308
|
-
['yarn.lock', 'yarn'],
|
|
309
|
-
['bun.lockb', 'bun'],
|
|
310
|
-
['bun.lock', 'bun'],
|
|
311
|
-
['package-lock.json', 'npm'],
|
|
312
|
-
];
|
|
313
|
-
|
|
314
|
-
for (const [lockFile, pm] of checks) {
|
|
315
|
-
if (existingFiles.has(lockFile)) {
|
|
316
|
-
return pm;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return 'npm';
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function getDeclaredPackageManager(pkg = null) {
|
|
324
|
-
const declared = String(pkg?.packageManager ?? '').toLowerCase();
|
|
325
|
-
if (declared.startsWith('pnpm')) return 'pnpm';
|
|
326
|
-
if (declared.startsWith('yarn')) return 'yarn';
|
|
327
|
-
if (declared.startsWith('bun')) return 'bun';
|
|
328
|
-
if (declared.startsWith('npm')) return 'npm';
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
301
|
function buildScriptCommand(packageManager, scriptName, args = []) {
|
|
333
302
|
const filteredArgs = args.filter(Boolean);
|
|
334
303
|
|
|
@@ -354,6 +323,7 @@ function deriveExecutionPolicy({
|
|
|
354
323
|
fallbackCommands = [],
|
|
355
324
|
reasons = [],
|
|
356
325
|
context = {},
|
|
326
|
+
autonomyLevel = 'balanced',
|
|
357
327
|
} = {}) {
|
|
358
328
|
const relatedTests = context.relatedTests ?? [];
|
|
359
329
|
const sharedAbstractions = context.sharedAbstractions ?? [];
|
|
@@ -366,10 +336,12 @@ function deriveExecutionPolicy({
|
|
|
366
336
|
const sharedScope = sharedAbstractions.length > 0;
|
|
367
337
|
const noRelatedTests = relatedTests.length === 0;
|
|
368
338
|
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
369
|
-
const
|
|
339
|
+
const isConservative = autonomyLevel === 'conservative';
|
|
340
|
+
const isFreeRun = autonomyLevel === 'free-run';
|
|
341
|
+
const requiresHumanConfirmationForBroadOrRisky = !isFreeRun && risky && broadOnlyPrimary;
|
|
370
342
|
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
371
343
|
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
372
|
-
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
344
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky && !isConservative;
|
|
373
345
|
|
|
374
346
|
let policyMode = 'recommend-only';
|
|
375
347
|
if (docsOnly) {
|
|
@@ -409,6 +381,7 @@ function buildVerificationPlanCacheKey({
|
|
|
409
381
|
taskType,
|
|
410
382
|
skillIds = [],
|
|
411
383
|
context = {},
|
|
384
|
+
autonomyLevel = 'balanced',
|
|
412
385
|
} = {}) {
|
|
413
386
|
return JSON.stringify({
|
|
414
387
|
rootDir,
|
|
@@ -417,6 +390,7 @@ function buildVerificationPlanCacheKey({
|
|
|
417
390
|
taskType: String(taskType || '').trim(),
|
|
418
391
|
skillIds: unique(skillIds).sort(),
|
|
419
392
|
context,
|
|
393
|
+
autonomyLevel: String(autonomyLevel || 'balanced').trim(),
|
|
420
394
|
});
|
|
421
395
|
}
|
|
422
396
|
|
|
@@ -945,10 +945,13 @@ const { pathToFileURL } = require('url');
|
|
|
945
945
|
const sharedScope = sharedAbstractions.length > 0;
|
|
946
946
|
const noRelatedTests = relatedTests.length === 0;
|
|
947
947
|
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
948
|
-
const
|
|
948
|
+
const autonomyLevel = runtimeConfig?.autonomy?.level || 'balanced';
|
|
949
|
+
const isConservative = autonomyLevel === 'conservative';
|
|
950
|
+
const isFreeRun = autonomyLevel === 'free-run';
|
|
951
|
+
const requiresHumanConfirmationForBroadOrRisky = !isFreeRun && risky && broadOnlyPrimary;
|
|
949
952
|
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
950
953
|
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
951
|
-
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
954
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky && !isConservative;
|
|
952
955
|
|
|
953
956
|
let policyMode = 'recommend-only';
|
|
954
957
|
if (docsOnly) {
|
|
@@ -66,7 +66,7 @@ export const ROUTE_CATALOG = [
|
|
|
66
66
|
{
|
|
67
67
|
id: 'postgres',
|
|
68
68
|
path: '.claude/skills/postgres/SKILL.md',
|
|
69
|
-
order: 4,
|
|
69
|
+
order: 4.5,
|
|
70
70
|
signals: [
|
|
71
71
|
{ type: 'prompt', regex: /\b(sql|postgres|postgresql|migration|schema|table|view|index|trigger|function|stored procedure|materialized view|query plan|explain)\b/i, score: 5 },
|
|
72
72
|
{ type: 'command', regex: /\b(psql|prisma|drizzle|knex|sequelize|typeorm)\b/i, score: 4 },
|
|
@@ -1105,6 +1105,7 @@ function deriveDelegationRecommendation({
|
|
|
1105
1105
|
routingContext = {},
|
|
1106
1106
|
contextRecommendation = null,
|
|
1107
1107
|
verificationRecommendation = null,
|
|
1108
|
+
autonomyLevel = 'balanced',
|
|
1108
1109
|
} = {}) {
|
|
1109
1110
|
const skillIds = activeSkills.map((item) => item.id);
|
|
1110
1111
|
const lower = `${routingContext.promptText ?? ''}\n${routingContext.commandText ?? ''}`.toLowerCase();
|
|
@@ -1129,6 +1130,21 @@ function deriveDelegationRecommendation({
|
|
|
1129
1130
|
return null;
|
|
1130
1131
|
}
|
|
1131
1132
|
|
|
1133
|
+
if (autonomyLevel === 'conservative') {
|
|
1134
|
+
if (
|
|
1135
|
+
skillIds.includes('executing-plans')
|
|
1136
|
+
|| /\b(execute this plan|follow this plan|implementation plan|rollout plan|controlled batches?|review checkpoints?|batch execution|execute in batches)\b/.test(lower)
|
|
1137
|
+
) {
|
|
1138
|
+
return {
|
|
1139
|
+
hint: 'subagent-driven-development',
|
|
1140
|
+
when,
|
|
1141
|
+
reason: 'Explicit plan/batch execution is separable enough for deliberate subagent passes.',
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
return null;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1132
1148
|
if (
|
|
1133
1149
|
skillIds.includes('executing-plans')
|
|
1134
1150
|
|| /\b(execute this plan|follow this plan|implementation plan|rollout plan|controlled batches?|review checkpoints?|batch execution|execute in batches)\b/.test(lower)
|
|
@@ -1145,7 +1161,8 @@ function deriveDelegationRecommendation({
|
|
|
1145
1161
|
|| /\b(debug|error|crash|stack(?: trace)?|failing|flake|flaky|timeout|triage|root cause)\b/.test(lower)
|
|
1146
1162
|
|| verificationRecommendation?.executionPolicy?.policyMode === 'confirm-then-broad'
|
|
1147
1163
|
);
|
|
1148
|
-
|
|
1164
|
+
const debugDelegationThreshold = autonomyLevel === 'free-run' ? 3 : 4;
|
|
1165
|
+
if (noisyDebugLane && (!localizedIndexedLane || !hasRelatedTests || contextBreadth >= debugDelegationThreshold)) {
|
|
1149
1166
|
return {
|
|
1150
1167
|
hint: 'bug-debugger',
|
|
1151
1168
|
when,
|
|
@@ -1156,11 +1173,15 @@ function deriveDelegationRecommendation({
|
|
|
1156
1173
|
const hasImplementationSkill = skillIds.some((id) => DELEGATABLE_IMPLEMENTATION_SKILL_IDS.has(id));
|
|
1157
1174
|
const clearImplementationSignal = /\b(implement|build|create|add|ship|deliver|refactor|integrat(?:e|ion)|scaffold|feature)\b/.test(lower);
|
|
1158
1175
|
const multiLaneSignal = /\b(multiple|several|parallel|independent|across files|across modules|batch)\b/.test(lower);
|
|
1176
|
+
const featureDelegationTaskType = autonomyLevel === 'free-run'
|
|
1177
|
+
? (routingContext.taskType === 'non-trivial' || routingContext.taskType === 'simple')
|
|
1178
|
+
: routingContext.taskType === 'non-trivial';
|
|
1179
|
+
const featureDelegationBreadth = autonomyLevel === 'free-run' ? 3 : 4;
|
|
1159
1180
|
if (
|
|
1160
1181
|
hasImplementationSkill
|
|
1161
1182
|
&& clearImplementationSignal
|
|
1162
|
-
&&
|
|
1163
|
-
&& (!localizedIndexedLane || !hasExplicitTarget || contextBreadth >=
|
|
1183
|
+
&& featureDelegationTaskType
|
|
1184
|
+
&& (autonomyLevel === 'free-run' || !localizedIndexedLane || !hasExplicitTarget || contextBreadth >= featureDelegationBreadth || multiLaneSignal)
|
|
1164
1185
|
) {
|
|
1165
1186
|
return {
|
|
1166
1187
|
hint: 'feature-implementer',
|
|
@@ -1179,11 +1200,13 @@ function buildRouteSummary({
|
|
|
1179
1200
|
verificationRecommendation = null,
|
|
1180
1201
|
nextAction = null,
|
|
1181
1202
|
} = {}) {
|
|
1203
|
+
const autonomyLevel = routingContext.autonomyLevel ?? 'balanced';
|
|
1182
1204
|
const delegationRecommendation = deriveDelegationRecommendation({
|
|
1183
1205
|
activeSkills,
|
|
1184
1206
|
routingContext,
|
|
1185
1207
|
contextRecommendation,
|
|
1186
1208
|
verificationRecommendation,
|
|
1209
|
+
autonomyLevel,
|
|
1187
1210
|
});
|
|
1188
1211
|
const preview = contextRecommendation?.preview ?? {};
|
|
1189
1212
|
const primaryTargets = summarizeCompactList(preview.primaryTargets ?? [], 2);
|
|
@@ -1197,6 +1220,8 @@ function buildRouteSummary({
|
|
|
1197
1220
|
);
|
|
1198
1221
|
const policyMode = verificationRecommendation?.executionPolicy?.policyMode ?? null;
|
|
1199
1222
|
const editGuardHint = isSharedImpactFile(routingContext.targetFile) ? 'anchor-required' : null;
|
|
1223
|
+
const taskType = routingContext.taskType ?? null;
|
|
1224
|
+
const contextMode = deriveContextMode(taskType);
|
|
1200
1225
|
const compactHelperLane = nextAction?.type === 'pull-indexed-context'
|
|
1201
1226
|
&& typeof contextRecommendation?.command === 'string'
|
|
1202
1227
|
&& contextRecommendation.command.trim();
|
|
@@ -1218,6 +1243,7 @@ function buildRouteSummary({
|
|
|
1218
1243
|
editGuardHint ? `editGuard=${editGuardHint}` : null,
|
|
1219
1244
|
delegationRecommendation?.hint ? `delegate=${delegationRecommendation.hint}` : null,
|
|
1220
1245
|
policyMode ? `policy=${policyMode}` : null,
|
|
1246
|
+
contextMode ? `mode=${contextMode}` : null,
|
|
1221
1247
|
].filter(Boolean).join(' | ');
|
|
1222
1248
|
|
|
1223
1249
|
return {
|
|
@@ -1231,10 +1257,17 @@ function buildRouteSummary({
|
|
|
1231
1257
|
nextActionType: nextAction?.type ?? null,
|
|
1232
1258
|
nextActionCommand,
|
|
1233
1259
|
helperHint,
|
|
1260
|
+
contextMode,
|
|
1234
1261
|
line: line || 'task=unknown',
|
|
1235
1262
|
};
|
|
1236
1263
|
}
|
|
1237
1264
|
|
|
1265
|
+
function deriveContextMode(taskType) {
|
|
1266
|
+
if (taskType === 'trivial' || taskType === 'simple') return 'LITE';
|
|
1267
|
+
if (taskType === 'non-trivial' || taskType === 'shared-simple') return 'FULL';
|
|
1268
|
+
return null;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1238
1271
|
function deriveExecutionPolicy({
|
|
1239
1272
|
taskType = 'simple',
|
|
1240
1273
|
mode = 'minimal',
|
|
@@ -1242,6 +1275,7 @@ function deriveExecutionPolicy({
|
|
|
1242
1275
|
fallbackCommands = [],
|
|
1243
1276
|
reasons = [],
|
|
1244
1277
|
context = {},
|
|
1278
|
+
autonomyLevel = 'balanced',
|
|
1245
1279
|
} = {}) {
|
|
1246
1280
|
const relatedTests = context.relatedTests ?? [];
|
|
1247
1281
|
const sharedAbstractions = context.sharedAbstractions ?? [];
|
|
@@ -1254,10 +1288,12 @@ function deriveExecutionPolicy({
|
|
|
1254
1288
|
const sharedScope = sharedAbstractions.length > 0;
|
|
1255
1289
|
const noRelatedTests = relatedTests.length === 0;
|
|
1256
1290
|
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
1257
|
-
const
|
|
1291
|
+
const isConservative = autonomyLevel === 'conservative';
|
|
1292
|
+
const isFreeRun = autonomyLevel === 'free-run';
|
|
1293
|
+
const requiresHumanConfirmationForBroadOrRisky = !isFreeRun && risky && broadOnlyPrimary;
|
|
1258
1294
|
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
1259
1295
|
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
1260
|
-
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
1296
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky && !isConservative;
|
|
1261
1297
|
|
|
1262
1298
|
let policyMode = 'recommend-only';
|
|
1263
1299
|
if (docsOnly) {
|
|
@@ -23,6 +23,7 @@ const args = process.argv.slice(2);
|
|
|
23
23
|
const rootDir = getRootDir(args);
|
|
24
24
|
const targetFile = readFlagValue(args, '--target');
|
|
25
25
|
const taskType = readFlagValue(args, '--type');
|
|
26
|
+
const autonomyLevel = readFlagValue(args, '--autonomy') ?? 'balanced';
|
|
26
27
|
const intent = collectPositionalArgs(args, ['--root', '--target', '--type']);
|
|
27
28
|
const effectiveIntent = deriveHelperIntent({ intent, targetFile });
|
|
28
29
|
|
|
@@ -42,6 +43,7 @@ if (!intent && !targetFile) {
|
|
|
42
43
|
intent: effectiveIntent,
|
|
43
44
|
targetFile,
|
|
44
45
|
taskType,
|
|
46
|
+
autonomyLevel,
|
|
45
47
|
});
|
|
46
48
|
const cached = await readRecentCacheEntry(cachePath, requestKey, {
|
|
47
49
|
maxEntries: DEFAULT_RECENT_CACHE_MAX_ENTRIES,
|
|
@@ -71,6 +73,7 @@ if (!intent && !targetFile) {
|
|
|
71
73
|
contextResult: expandHelperContext(cachedContext?.result ?? null),
|
|
72
74
|
fingerprintEntries: projectVerification.entries,
|
|
73
75
|
pkg: projectVerification.pkg,
|
|
76
|
+
autonomyLevel,
|
|
74
77
|
});
|
|
75
78
|
|
|
76
79
|
if (!cached) {
|
|
@@ -122,6 +125,7 @@ async function deriveVerificationPlan({
|
|
|
122
125
|
contextResult = null,
|
|
123
126
|
fingerprintEntries = [],
|
|
124
127
|
pkg = null,
|
|
128
|
+
autonomyLevel = 'balanced',
|
|
125
129
|
} = {}) {
|
|
126
130
|
const absoluteRoot = path.resolve(rootDir);
|
|
127
131
|
const context = expandHelperContext(contextResult ?? await resolveContext({
|
|
@@ -223,6 +227,7 @@ async function deriveVerificationPlan({
|
|
|
223
227
|
fallbackCommands: fallbackCommandList,
|
|
224
228
|
reasons: reasonList,
|
|
225
229
|
context: summarizedContext,
|
|
230
|
+
autonomyLevel,
|
|
226
231
|
}),
|
|
227
232
|
};
|
|
228
233
|
}
|
|
@@ -614,6 +619,7 @@ function deriveExecutionPolicy({
|
|
|
614
619
|
fallbackCommands = [],
|
|
615
620
|
reasons = [],
|
|
616
621
|
context = {},
|
|
622
|
+
autonomyLevel = 'balanced',
|
|
617
623
|
} = {}) {
|
|
618
624
|
const relatedTests = context.relatedTests ?? [];
|
|
619
625
|
const sharedAbstractions = context.sharedAbstractions ?? [];
|
|
@@ -626,10 +632,12 @@ function deriveExecutionPolicy({
|
|
|
626
632
|
const sharedScope = sharedAbstractions.length > 0;
|
|
627
633
|
const noRelatedTests = relatedTests.length === 0;
|
|
628
634
|
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
629
|
-
const
|
|
635
|
+
const isConservative = autonomyLevel === 'conservative';
|
|
636
|
+
const isFreeRun = autonomyLevel === 'free-run';
|
|
637
|
+
const requiresHumanConfirmationForBroadOrRisky = !isFreeRun && risky && broadOnlyPrimary;
|
|
630
638
|
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
631
639
|
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
632
|
-
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
640
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky && !isConservative;
|
|
633
641
|
|
|
634
642
|
let policyMode = 'recommend-only';
|
|
635
643
|
if (docsOnly) {
|
|
@@ -12,7 +12,7 @@ Auto-generated by UKit for OpenAI Codex.
|
|
|
12
12
|
- Do not make end users memorize skill names, helper scripts, or routing internals unless they are debugging UKit itself.
|
|
13
13
|
- **Treat helper commands as internal orchestration. Do not ask end users to run them.**
|
|
14
14
|
|
|
15
|
-
## UKit v1.
|
|
15
|
+
## UKit v1.4.1 Shared Runtime
|
|
16
16
|
|
|
17
17
|
- Shared runtime state lives in `.ukit/storage/`.
|
|
18
18
|
- Treat `.ukit/storage/config.json` as the source of compact, token-pipeline, router, memory, validation, and Safe Patch guardrail toggles.
|
package/templates/CLAUDE.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
- **Do not ask normal contributors to run internal helper commands**; run them yourself or tell them to rerun `ukit install`.
|
|
43
43
|
- Do not ask normal contributors to memorize `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they explicitly need maintainer/debug help.
|
|
44
44
|
|
|
45
|
-
## UKit v1.
|
|
45
|
+
## UKit v1.4.1 Shared Runtime
|
|
46
46
|
|
|
47
47
|
- Shared runtime state lives in `.ukit/storage/`.
|
|
48
48
|
- Treat `.ukit/storage/config.json` as the source of runtime toggles for compact, token pipeline, router, memory, validation, and Safe Patch behavior.
|
|
@@ -95,6 +95,14 @@
|
|
|
95
95
|
- Good delegation triggers: noisy research/log lanes, 3+ independent failures, explicit batch execution, or a broad debug/implementation lane with a clean handoff.
|
|
96
96
|
- If route memory includes `delegate=<lane>`, treat it as an internal hint after any required indexed-context step.
|
|
97
97
|
|
|
98
|
+
## Adaptive Autonomy
|
|
99
|
+
|
|
100
|
+
- `autonomy.level` in `.ukit/storage/config.json` controls how much UKit acts without asking first: `conservative` (ask more), `balanced` (default, current behavior), `free-run` (auto-run more).
|
|
101
|
+
- `conservative`: do not auto-run fallback verification; ask before broad/risky escalation; suppress non-essential delegation (except explicit plan/batch execution and small-task maintainer).
|
|
102
|
+
- `balanced`: default behavior unchanged — targeted verification auto-runs, broad risky asks confirmation, delegation follows existing thresholds.
|
|
103
|
+
- `free-run`: auto-run fallback verification; remove broad verification confirmation for escalation-only; lower feature/debug delegation thresholds slightly.
|
|
104
|
+
- End users should not need to change this; maintainers may tune it per-project.
|
|
105
|
+
|
|
98
106
|
## Project Snapshot
|
|
99
107
|
|
|
100
108
|
- Project: {{project.name}} | Root: {{project.root}}
|
package/templates/ukit/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# UKit Shared Runtime
|
|
2
2
|
|
|
3
|
-
This folder stores shared UKit runtime state for v1.
|
|
3
|
+
This folder stores shared UKit runtime state for v1.4.1 features.
|
|
4
4
|
|
|
5
5
|
- `storage/config.json` — runtime feature flags and defaults
|
|
6
6
|
- `storage/cache/` — prompt-cache, compact history, compact pressure state, output summaries, and preserved raw tool outputs under `storage/cache/tee/`
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4.1",
|
|
3
3
|
"agent": "claude-code",
|
|
4
|
+
"autonomy": {
|
|
5
|
+
"level": "balanced",
|
|
6
|
+
"affectVerification": true,
|
|
7
|
+
"affectDelegation": true
|
|
8
|
+
},
|
|
4
9
|
"compact": {
|
|
5
10
|
"enabled": true,
|
|
6
11
|
"tokenThreshold": 100000,
|
|
@@ -141,15 +146,23 @@
|
|
|
141
146
|
"stepBudgets": {
|
|
142
147
|
"trivial": {
|
|
143
148
|
"maxSteps": 1,
|
|
144
|
-
"verification": "skip-unless-risky"
|
|
149
|
+
"verification": "skip-unless-risky",
|
|
150
|
+
"label": "LITE"
|
|
145
151
|
},
|
|
146
152
|
"simple": {
|
|
147
153
|
"maxSteps": 2,
|
|
148
|
-
"verification": "targeted-if-covered"
|
|
154
|
+
"verification": "targeted-if-covered",
|
|
155
|
+
"label": "LITE"
|
|
156
|
+
},
|
|
157
|
+
"sharedSimple": {
|
|
158
|
+
"maxSteps": 3,
|
|
159
|
+
"verification": "targeted-then-widen-on-risk",
|
|
160
|
+
"label": "FULL"
|
|
149
161
|
},
|
|
150
162
|
"nonTrivial": {
|
|
151
163
|
"maxSteps": 4,
|
|
152
|
-
"verification": "targeted-then-widen-on-risk"
|
|
164
|
+
"verification": "targeted-then-widen-on-risk",
|
|
165
|
+
"label": "FULL"
|
|
153
166
|
}
|
|
154
167
|
},
|
|
155
168
|
"executionMode": "sidecar-parallel",
|
|
@@ -196,6 +209,11 @@
|
|
|
196
209
|
},
|
|
197
210
|
"version": "Phiên bản config runtime đi kèm package UKit.",
|
|
198
211
|
"agent": "Adapter mặc định của workspace. Thường giữ nguyên theo lúc install.",
|
|
212
|
+
"autonomy": {
|
|
213
|
+
"level": "Mức tự chủ của UKit. conservative: hỏi trước khi fallback/escalate, không tự delegate. balanced: mặc định, hành vi hiện tại. free-run: tự chạy fallback, delegate tự nhiên hơn, bớt xác nhận.",
|
|
214
|
+
"affectVerification": "Nếu true, autonomy.level ảnh hưởng hành vi verification plan.",
|
|
215
|
+
"affectDelegation": "Nếu true, autonomy.level ảnh hưởng ngưỡng delegation."
|
|
216
|
+
},
|
|
199
217
|
"compact": {
|
|
200
218
|
"enabled": "Bật/tắt toàn bộ helper compact của UKit.",
|
|
201
219
|
"tokenThreshold": "Ngưỡng token chung cho runtime compact dùng chung.",
|
|
@@ -282,7 +300,7 @@
|
|
|
282
300
|
"maxSidecarWaitMs": "0 nghĩa là không chờ sidecar trước khi tiếp tục task chính.",
|
|
283
301
|
"optimizeOrder": "Thứ tự ưu tiên khi ra quyết định nội bộ.",
|
|
284
302
|
"decisions": "Nhóm quyết định sidecar được phép hỗ trợ.",
|
|
285
|
-
"stepBudgets": "Gợi ý số bước planning tối đa theo độ lớn task trước khi reassess."
|
|
303
|
+
"stepBudgets": "Gợi ý số bước planning tối đa theo độ lớn task trước khi reassess. label LITE/FULL cho biết subagent dùng model nhỏ hay đầy đủ."
|
|
286
304
|
}
|
|
287
305
|
},
|
|
288
306
|
"safePatch": {
|