ai-engineering-loop 1.10.0 → 1.11.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/.agents/devil-advocate.md +13 -1
- package/.agents/judge.md +10 -0
- package/.agents/skills/backend-development/SKILL.md +272 -0
- package/.agents/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.agents/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.agents/skills/backend-development/references/security-checklist.md +60 -0
- package/.agents/workflows/ai-engineering-loop.md +4 -4
- package/.claude/agents/devil-advocate.md +13 -1
- package/.claude/agents/judge.md +10 -0
- package/.claude/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.claude/skills/backend-development/SKILL.md +272 -0
- package/.claude/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.claude/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.claude/skills/backend-development/references/security-checklist.md +60 -0
- package/.gemini/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.gemini/skills/backend-development/SKILL.md +272 -0
- package/.gemini/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.gemini/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.gemini/skills/backend-development/references/security-checklist.md +60 -0
- package/.grok/agents/devil-advocate.md +13 -1
- package/.grok/agents/judge.md +10 -0
- package/.grok/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.grok/skills/backend-development/SKILL.md +272 -0
- package/.grok/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.grok/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.grok/skills/backend-development/references/security-checklist.md +60 -0
- package/README.md +33 -1
- package/README.npm.md +8 -1
- package/agents/shared/devil-advocate.body.md +13 -1
- package/agents/shared/judge.body.md +10 -0
- package/bin/ai-engineering-loop.js +207 -2
- package/core/runtime-safety.md +43 -0
- package/lib/budget.js +35 -0
- package/lib/doctor.js +4 -0
- package/lib/run-compaction.js +170 -0
- package/lib/runtime-policy.js +24 -1
- package/lib/safe-context.js +32 -7
- package/lib/smart-context.js +643 -0
- package/lib/studio-server.js +19 -2
- package/lib/sync-hosts.js +20 -0
- package/lib/update-manager.js +147 -0
- package/lib/verification-summary.js +130 -0
- package/package.json +1 -1
- package/policies/review-budget.md +12 -0
- package/studio/app.js +5 -2
package/lib/sync-hosts.js
CHANGED
|
@@ -23,6 +23,22 @@ function applyGrokSkillOverlay(content) {
|
|
|
23
23
|
return `---\n${nextYaml}\n---\n${normalized.slice(match[0].length)}`;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const BACKEND_SKILL_FILES = [
|
|
27
|
+
'SKILL.md',
|
|
28
|
+
'references/api-design-guidelines.md',
|
|
29
|
+
'references/query-and-database-best-practices.md',
|
|
30
|
+
'references/security-checklist.md'
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
function backendSkillFiles(srcRoot, destRoot, { grokSkillOverlay = false } = {}) {
|
|
34
|
+
return BACKEND_SKILL_FILES.map((file) => ({
|
|
35
|
+
src: path.posix.join(srcRoot, file),
|
|
36
|
+
dest: path.join(destRoot, file),
|
|
37
|
+
mode: 'upsert',
|
|
38
|
+
...(grokSkillOverlay && file === 'SKILL.md' ? { grokSkillOverlay: true } : {})
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
function hostFileMap(home) {
|
|
27
43
|
const claude = path.join(home, '.claude');
|
|
28
44
|
const grok = path.join(home, '.grok');
|
|
@@ -34,6 +50,7 @@ function hostFileMap(home) {
|
|
|
34
50
|
root: claude,
|
|
35
51
|
files: [
|
|
36
52
|
{ src: '.claude/skills/ai-engineering-loop/SKILL.md', dest: path.join(claude, 'skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' },
|
|
53
|
+
...backendSkillFiles('.claude/skills/backend-development', path.join(claude, 'skills/backend-development')),
|
|
37
54
|
{ src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(claude, 'skills/task-impact-inquiry/SKILL.md'), mode: 'upsert' },
|
|
38
55
|
{ src: 'adapters/generate-adapter/SKILL.md', dest: path.join(claude, 'skills/generate-adapter/SKILL.md'), mode: 'upsert' },
|
|
39
56
|
{ src: 'adapters/generate-workflow/SKILL.md', dest: path.join(claude, 'skills/generate-workflow/SKILL.md'), mode: 'upsert' },
|
|
@@ -47,6 +64,7 @@ function hostFileMap(home) {
|
|
|
47
64
|
root: grok,
|
|
48
65
|
files: [
|
|
49
66
|
{ src: '.grok/skills/ai-engineering-loop/SKILL.md', dest: path.join(grok, 'skills/ai-engineering-loop/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
|
|
67
|
+
...backendSkillFiles('.grok/skills/backend-development', path.join(grok, 'skills/backend-development'), { grokSkillOverlay: true }),
|
|
50
68
|
{ src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(grok, 'skills/task-impact-inquiry/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
|
|
51
69
|
{ src: 'adapters/generate-adapter/SKILL.md', dest: path.join(grok, 'skills/generate-adapter/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
|
|
52
70
|
{ src: 'adapters/generate-workflow/SKILL.md', dest: path.join(grok, 'skills/generate-workflow/SKILL.md'), mode: 'upsert', grokSkillOverlay: true },
|
|
@@ -60,6 +78,7 @@ function hostFileMap(home) {
|
|
|
60
78
|
root: gemini,
|
|
61
79
|
files: [
|
|
62
80
|
{ src: '.gemini/skills/ai-engineering-loop/SKILL.md', dest: path.join(gemini, 'config/skills/ai-engineering-loop/SKILL.md'), mode: 'upsert' },
|
|
81
|
+
...backendSkillFiles('.gemini/skills/backend-development', path.join(gemini, 'config/skills/backend-development')),
|
|
63
82
|
{ src: 'adapters/dot/skills/task-impact-inquiry/SKILL.md', dest: path.join(gemini, 'config/skills/task-impact-inquiry/SKILL.md'), mode: 'upsert' },
|
|
64
83
|
{ src: 'adapters/generate-adapter/SKILL.md', dest: path.join(gemini, 'config/skills/generate-adapter/SKILL.md'), mode: 'upsert' },
|
|
65
84
|
{ src: 'adapters/generate-workflow/SKILL.md', dest: path.join(gemini, 'config/skills/generate-workflow/SKILL.md'), mode: 'upsert' }
|
|
@@ -69,6 +88,7 @@ function hostFileMap(home) {
|
|
|
69
88
|
id: 'antigravity',
|
|
70
89
|
root: agents,
|
|
71
90
|
files: [
|
|
91
|
+
...backendSkillFiles('.agents/skills/backend-development', path.join(agents, 'skills/backend-development')),
|
|
72
92
|
{ src: '.agents/devil-advocate.md', dest: path.join(agents, 'devil-advocate.md'), mode: 'upsert' },
|
|
73
93
|
{ src: '.agents/judge.md', dest: path.join(agents, 'judge.md'), mode: 'upsert' },
|
|
74
94
|
{ src: '.agents/workflows/ai-engineering-loop.md', dest: path.join(agents, 'workflows/ai-engineering-loop.md'), mode: 'upsert' }
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execFileSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_UPDATE_TIMEOUT_MS = 8_000;
|
|
8
|
+
|
|
9
|
+
function updateError(message, code = 'UPDATE_ERROR') {
|
|
10
|
+
const err = new Error(message);
|
|
11
|
+
err.code = code;
|
|
12
|
+
return err;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function loadPackageMetadata(rootDir) {
|
|
16
|
+
const packagePath = path.join(rootDir, 'package.json');
|
|
17
|
+
const metadata = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
18
|
+
if (!metadata.name || !metadata.version) {
|
|
19
|
+
throw updateError('package.json must include name and version', 'INVALID_PACKAGE_METADATA');
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
name: metadata.name,
|
|
23
|
+
version: metadata.version
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseVersion(version) {
|
|
28
|
+
const match = String(version || '').trim().match(/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/);
|
|
29
|
+
if (!match) throw updateError(`Invalid semantic version: ${version || '(empty)'}`, 'INVALID_VERSION');
|
|
30
|
+
return match.slice(1).map((part) => Number(part));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function compareVersions(leftVersion, rightVersion) {
|
|
34
|
+
const left = parseVersion(leftVersion);
|
|
35
|
+
const right = parseVersion(rightVersion);
|
|
36
|
+
for (let index = 0; index < left.length; index++) {
|
|
37
|
+
if (left[index] > right[index]) return 1;
|
|
38
|
+
if (left[index] < right[index]) return -1;
|
|
39
|
+
}
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function npmViewLatestVersion(packageName, { timeoutMs = DEFAULT_UPDATE_TIMEOUT_MS } = {}) {
|
|
44
|
+
if (process.env.AEL_UPDATE_LATEST_VERSION) return process.env.AEL_UPDATE_LATEST_VERSION;
|
|
45
|
+
try {
|
|
46
|
+
const output = execFileSync('npm', ['view', `${packageName}@latest`, 'version', '--json'], {
|
|
47
|
+
encoding: 'utf8',
|
|
48
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
49
|
+
timeout: timeoutMs
|
|
50
|
+
}).trim();
|
|
51
|
+
return JSON.parse(output);
|
|
52
|
+
} catch (cause) {
|
|
53
|
+
throw updateError(`Unable to check npm for ${packageName}@latest: ${cause.message}`, 'UPDATE_CHECK_FAILED');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function detectInstallScope(rootDir) {
|
|
58
|
+
const override = process.env.AEL_INSTALL_SCOPE;
|
|
59
|
+
if (override === 'global' || override === 'project') return override;
|
|
60
|
+
try {
|
|
61
|
+
const globalRoot = execFileSync('npm', ['root', '--global'], {
|
|
62
|
+
encoding: 'utf8',
|
|
63
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
64
|
+
timeout: 3_000
|
|
65
|
+
}).trim();
|
|
66
|
+
const packageRoot = fs.realpathSync(rootDir);
|
|
67
|
+
const realGlobalRoot = fs.realpathSync(globalRoot);
|
|
68
|
+
const relative = path.relative(realGlobalRoot, packageRoot);
|
|
69
|
+
const isGlobalPackage = relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
70
|
+
return isGlobalPackage ? 'global' : 'project';
|
|
71
|
+
} catch {
|
|
72
|
+
return 'project';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function command(cmd, args) {
|
|
77
|
+
return {
|
|
78
|
+
cmd,
|
|
79
|
+
args,
|
|
80
|
+
display: [cmd, ...args].join(' ')
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function updateCommands(packageName, installScope) {
|
|
85
|
+
if (installScope === 'global') {
|
|
86
|
+
return [
|
|
87
|
+
command('npm', ['install', '--global', `${packageName}@latest`]),
|
|
88
|
+
command('ai-engineering-loop', ['sync-hosts']),
|
|
89
|
+
command('ai-engineering-loop', ['refresh']),
|
|
90
|
+
command('ai-engineering-loop', ['doctor'])
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
return [
|
|
94
|
+
command('npm', ['install', `${packageName}@latest`, '--save-dev']),
|
|
95
|
+
command('npx', ['ai-engineering-loop', 'sync-hosts']),
|
|
96
|
+
command('npx', ['ai-engineering-loop', 'refresh']),
|
|
97
|
+
command('npx', ['ai-engineering-loop', 'doctor'])
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function buildUpdatePlan({ packageName, currentVersion, latestVersion, installScope }) {
|
|
102
|
+
const comparison = compareVersions(currentVersion, latestVersion);
|
|
103
|
+
return {
|
|
104
|
+
schemaVersion: 1,
|
|
105
|
+
packageName,
|
|
106
|
+
currentVersion,
|
|
107
|
+
latestVersion,
|
|
108
|
+
installScope,
|
|
109
|
+
updateAvailable: comparison < 0,
|
|
110
|
+
upToDate: comparison >= 0,
|
|
111
|
+
commands: updateCommands(packageName, installScope)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function checkForUpdate(rootDir, {
|
|
116
|
+
latestVersion,
|
|
117
|
+
installScope,
|
|
118
|
+
timeoutMs = DEFAULT_UPDATE_TIMEOUT_MS
|
|
119
|
+
} = {}) {
|
|
120
|
+
const metadata = loadPackageMetadata(rootDir);
|
|
121
|
+
const resolvedLatestVersion = latestVersion || npmViewLatestVersion(metadata.name, { timeoutMs });
|
|
122
|
+
const resolvedInstallScope = installScope || detectInstallScope(rootDir);
|
|
123
|
+
return buildUpdatePlan({
|
|
124
|
+
packageName: metadata.name,
|
|
125
|
+
currentVersion: metadata.version,
|
|
126
|
+
latestVersion: resolvedLatestVersion,
|
|
127
|
+
installScope: resolvedInstallScope
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function executeUpdatePlan(plan, { stdio = 'inherit' } = {}) {
|
|
132
|
+
for (const item of plan.commands) {
|
|
133
|
+
execFileSync(item.cmd, item.args, { stdio });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = {
|
|
138
|
+
DEFAULT_UPDATE_TIMEOUT_MS,
|
|
139
|
+
buildUpdatePlan,
|
|
140
|
+
checkForUpdate,
|
|
141
|
+
compareVersions,
|
|
142
|
+
detectInstallScope,
|
|
143
|
+
executeUpdatePlan,
|
|
144
|
+
npmViewLatestVersion,
|
|
145
|
+
parseVersion,
|
|
146
|
+
updateCommands
|
|
147
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { atomicWriteJson, getCurrentRun, loadRun, runsDir } = require('./run-state.js');
|
|
6
|
+
|
|
7
|
+
function verificationSummaryError(message, code = 'VERIFICATION_SUMMARY_ERROR') {
|
|
8
|
+
const err = new Error(message);
|
|
9
|
+
err.code = code;
|
|
10
|
+
return err;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function resolveRun(rootDir, runId) {
|
|
14
|
+
if (runId) return loadRun(rootDir, runId);
|
|
15
|
+
const current = getCurrentRun(rootDir);
|
|
16
|
+
if (!current) throw verificationSummaryError('No current run. Pass --run <id>.', 'NO_CURRENT_RUN');
|
|
17
|
+
return current;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseCount(patterns, text) {
|
|
21
|
+
for (const pattern of patterns) {
|
|
22
|
+
const match = String(text || '').match(pattern);
|
|
23
|
+
if (match) return Number(match[1]);
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function testCountsFromText(text) {
|
|
29
|
+
const total = parseCount([
|
|
30
|
+
/\btests?\s+(\d+)\b/i,
|
|
31
|
+
/\b(\d+)\s+tests?\b/i,
|
|
32
|
+
/\btotal[:=\s]+(\d+)\b/i
|
|
33
|
+
], text);
|
|
34
|
+
const passed = parseCount([
|
|
35
|
+
/\bpass(?:ed)?\s+(\d+)\b/i,
|
|
36
|
+
/\b(\d+)\s+pass(?:ed)?\b/i
|
|
37
|
+
], text);
|
|
38
|
+
const failed = parseCount([
|
|
39
|
+
/\bfail(?:ed)?\s+(\d+)\b/i,
|
|
40
|
+
/\b(\d+)\s+fail(?:ed)?\b/i
|
|
41
|
+
], text);
|
|
42
|
+
return {
|
|
43
|
+
passed: passed ?? null,
|
|
44
|
+
failed: failed ?? null,
|
|
45
|
+
total: total ?? (passed != null && failed != null ? passed + failed : null)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function mergeCounts(left, right) {
|
|
50
|
+
const sumOrNull = (a, b) => (a == null && b == null ? null : (a || 0) + (b || 0));
|
|
51
|
+
return {
|
|
52
|
+
passed: sumOrNull(left.passed, right.passed),
|
|
53
|
+
failed: sumOrNull(left.failed, right.failed),
|
|
54
|
+
total: sumOrNull(left.total, right.total)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function failureExcerpt(command) {
|
|
59
|
+
if (Number(command.exitCode || 0) === 0 && !command.timedOut) return null;
|
|
60
|
+
const source = [command.stderr, command.stdout].map((value) => String(value || '').trim()).find(Boolean);
|
|
61
|
+
if (!source) return command.timedOut ? 'Command timed out' : `Command exited ${command.exitCode}`;
|
|
62
|
+
return source.split('\n').map((line) => line.trim()).filter(Boolean).slice(0, 3).join('\n').slice(0, 800);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function summarizeCommand(command) {
|
|
66
|
+
const output = `${command.stdout || ''}\n${command.stderr || ''}`;
|
|
67
|
+
return {
|
|
68
|
+
command: String(command.command || ''),
|
|
69
|
+
exitCode: Number(command.exitCode || 0),
|
|
70
|
+
timedOut: Boolean(command.timedOut || command.timeoutStatus === 'TIMED_OUT'),
|
|
71
|
+
durationMs: Number.isFinite(command.durationMs) ? command.durationMs : null,
|
|
72
|
+
startedAt: command.startedAt || null,
|
|
73
|
+
finishedAt: command.finishedAt || null,
|
|
74
|
+
testCounts: testCountsFromText(output),
|
|
75
|
+
failureExcerpt: failureExcerpt(command)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function summarizeVerificationBundle(bundle) {
|
|
80
|
+
if (!bundle || typeof bundle !== 'object' || Array.isArray(bundle)) {
|
|
81
|
+
throw verificationSummaryError('verification bundle must be a JSON object', 'INVALID_VERIFICATION');
|
|
82
|
+
}
|
|
83
|
+
const commands = (bundle.commands || []).map(summarizeCommand);
|
|
84
|
+
const testCounts = commands
|
|
85
|
+
.map((command) => command.testCounts)
|
|
86
|
+
.reduce(mergeCounts, { passed: null, failed: null, total: null });
|
|
87
|
+
const exitCode = commands.some((command) => command.timedOut)
|
|
88
|
+
? 1
|
|
89
|
+
: commands.reduce((highest, command) => Math.max(highest, command.exitCode), 0);
|
|
90
|
+
return {
|
|
91
|
+
schemaVersion: 1,
|
|
92
|
+
runId: bundle.runId || null,
|
|
93
|
+
generatedAt: new Date().toISOString(),
|
|
94
|
+
gitRevision: bundle.gitRevision || bundle.revision || null,
|
|
95
|
+
diffHash: bundle.diffHash || null,
|
|
96
|
+
commandCount: commands.length,
|
|
97
|
+
exitCode,
|
|
98
|
+
passed: exitCode === 0,
|
|
99
|
+
testCounts,
|
|
100
|
+
commands
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function readVerificationBundle(rootDir, runId) {
|
|
105
|
+
const run = resolveRun(rootDir, runId);
|
|
106
|
+
const filePath = path.join(runsDir(rootDir), run.runId, 'verification.json');
|
|
107
|
+
let parsed;
|
|
108
|
+
try {
|
|
109
|
+
parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
110
|
+
} catch (cause) {
|
|
111
|
+
throw verificationSummaryError(`Unable to read verification.json: ${cause.message}`, 'INVALID_VERIFICATION');
|
|
112
|
+
}
|
|
113
|
+
return { run, filePath, bundle: parsed };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function writeVerificationSummary(rootDir, { runId } = {}) {
|
|
117
|
+
const { run, bundle } = readVerificationBundle(rootDir, runId);
|
|
118
|
+
const summary = summarizeVerificationBundle({ ...bundle, runId: bundle.runId || run.runId });
|
|
119
|
+
const filePath = path.join(runsDir(rootDir), run.runId, 'verification-summary.json');
|
|
120
|
+
atomicWriteJson(filePath, summary);
|
|
121
|
+
return {
|
|
122
|
+
summary,
|
|
123
|
+
path: path.relative(rootDir, filePath).split(path.sep).join('/')
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = {
|
|
128
|
+
summarizeVerificationBundle,
|
|
129
|
+
writeVerificationSummary
|
|
130
|
+
};
|
package/package.json
CHANGED
|
@@ -13,15 +13,26 @@ Host files (`.claude/agents/`, `.grok/agents/`, `.agents/`) may differ only in Y
|
|
|
13
13
|
|
|
14
14
|
- Write `git diff` to `.ai-engineering-loop/tasks/current.diff` before review.
|
|
15
15
|
- Pass artifact **paths**, not Maker chat.
|
|
16
|
+
- Use the runtime policy `reviewProfile` to size context packs. Default `lean` protects Codex/GPT Plus-style sessions from repeated full-file prompts while keeping all gates intact.
|
|
17
|
+
- Prefer `npx ai-engineering-loop context diff-hunks --run <run-id>` for review. It writes a private hunk-only pack with file summaries and unresolved findings, so reviewers do not need full source bodies unless a cited hunk is insufficient.
|
|
18
|
+
- Run `npx ai-engineering-loop verification summarize --run <run-id>` after writing `verification.json`; pass the summary path to Judge before raw logs.
|
|
16
19
|
- Spawn DA and Judge as siblings. Do not nest.
|
|
17
20
|
- Prefer named types `devil-advocate` and `judge`. Use `general-purpose` only if the named type is rejected.
|
|
18
21
|
- Skip `*.css`, `*report-css*`, generated/vendor. Do not run `git log`.
|
|
19
22
|
|
|
23
|
+
| Profile | Intended use | Context behavior |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `lean` | Default for normal paid-agent sessions | Smaller packs, compact findings, iteration-delta review |
|
|
26
|
+
| `standard` | Broader routine changes | Moderate packs; still path-first and hunk-first |
|
|
27
|
+
| `thorough` | Explicit human opt-in for expensive review | Previous larger limits; use only when risk justifies cost |
|
|
28
|
+
|
|
20
29
|
## Devil's Advocate
|
|
21
30
|
|
|
22
31
|
- At most **8** tool calls, then emit the Finding Ledger.
|
|
23
32
|
- Read the diff file first. Do not run `git diff` if that path was given.
|
|
24
33
|
- Open at most **8** files that appear in the diff. Prefer quoting a hunk over opening the whole file.
|
|
34
|
+
- Emit at most **5** findings unless another finding is a BLOCKER. Keep evidence fields short and concrete.
|
|
35
|
+
- On iteration 2+, review only the smart diff-hunk pack's new hunks plus unresolved findings unless the changed evidence reopens an accepted finding.
|
|
25
36
|
- Report Spec and Standards as separate findings. Do not spawn children to split axes. Do not merge the two axes.
|
|
26
37
|
|
|
27
38
|
## Judge
|
|
@@ -30,3 +41,4 @@ Host files (`.claude/agents/`, `.grok/agents/`, `.agents/`) may differ only in Y
|
|
|
30
41
|
- Read the Finding Ledger and Goal Contract first.
|
|
31
42
|
- Open source only to fact-check a `location` the ledger already cited.
|
|
32
43
|
- Do not re-review the whole diff. Do not roam the repo.
|
|
44
|
+
- Keep the verdict compact: blocking IDs, accepted tradeoff IDs, and the shortest action that unblocks the next step.
|
package/studio/app.js
CHANGED
|
@@ -2077,7 +2077,6 @@ function renderLive() {
|
|
|
2077
2077
|
(active ? runtimeNode.activity || `${runtimeNode.status} · attempt ${runtimeNode.attempts}` : `Final state: ${live.run.state}`);
|
|
2078
2078
|
const journeyStatuses = new Set(['pending', 'active', 'complete']);
|
|
2079
2079
|
const degradedSources = live.journey?.degradedSources || [];
|
|
2080
|
-
byId('run-journey').dataset.degraded = degradedSources.join(', ');
|
|
2081
2080
|
byId('run-journey').innerHTML = (live.journey?.steps || []).map((step) => {
|
|
2082
2081
|
const status = String(step?.status || '').toLowerCase();
|
|
2083
2082
|
const safeStatus = journeyStatuses.has(status) ? status : 'unknown';
|
|
@@ -2104,13 +2103,17 @@ function renderLive() {
|
|
|
2104
2103
|
const limit = live.budget.perRunTokenLimit;
|
|
2105
2104
|
byId('meter').style.width = `${Math.min(100, limit ? (spent / limit) * 100 : 0)}%`;
|
|
2106
2105
|
byId('budget').textContent = `${spent.toLocaleString()} / ${limit.toLocaleString()} TOKENS`;
|
|
2107
|
-
|
|
2106
|
+
const liveEventsHtml = lifecycleEvents.slice(-7).reverse().map((event) => `
|
|
2108
2107
|
<p class="${event.type === 'NODE_ACTIVITY' || event.type.includes('START') ? 'event-active' : ''}">
|
|
2109
2108
|
${escapeHtml(event.at.slice(11, 19))} · ${escapeHtml(event.type)} · ${escapeHtml(event.message)}
|
|
2110
2109
|
</p>
|
|
2111
2110
|
`).join('') || live.events.slice(-7).reverse().map((event) => `
|
|
2112
2111
|
<p>${escapeHtml(event.at.slice(11, 19))} · ${escapeHtml(event.type)}</p>
|
|
2113
2112
|
`).join('');
|
|
2113
|
+
const eventsDetailNote = live.summary?.eventsTruncated
|
|
2114
|
+
? '<p class="muted">Older workflow events are kept out of live polling; node detail and lifecycle stream load them on demand.</p>'
|
|
2115
|
+
: '';
|
|
2116
|
+
byId('events').innerHTML = liveEventsHtml + eventsDetailNote;
|
|
2114
2117
|
renderRunActivityDock(live, active, runtimeNode, lifecycle);
|
|
2115
2118
|
updateRuntimePresentation();
|
|
2116
2119
|
followActiveNode();
|