ai-engineering-loop 2.3.0 → 2.5.0
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/skills/{ai-engineering-loop → ael}/SKILL.md +2 -2
- package/.agents/skills/{ai-engineering-loop → ael}/references/loop-risky.md +1 -0
- package/CHANGELOG.md +30 -0
- package/README.md +5 -4
- package/README.npm.md +6 -6
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/adapters/dot/README.md +3 -3
- package/adapters/dot/skills/dot-dev-skill-router/SKILL.md +13 -13
- package/adapters/dot/skills/dot-dev-workflow/SKILL.md +3 -3
- package/adapters/generate-adapter/SKILL.md +1 -1
- package/adapters/generate-workflow/SKILL.md +1 -1
- package/adapters/quality/skills/task-impact-inquiry/SKILL.md +2 -2
- package/adapters/spec/LICENSE +202 -0
- package/adapters/spec/NOTICE-AEL.md +26 -0
- package/adapters/spec/agents/ael-spec-codebase-details.md +71 -0
- package/adapters/spec/agents/ael-spec-comprehension.md +71 -0
- package/adapters/spec/agents/ael-spec-design.md +65 -0
- package/adapters/spec/agents/ael-spec-implementation-readiness.md +64 -0
- package/adapters/spec/agents/ael-spec-structural.md +67 -0
- package/adapters/spec/agents/ael-spec-style.md +68 -0
- package/adapters/spec/agents/ael-spec-synthesizer.md +73 -0
- package/adapters/spec/agents/ael-spec-zoom-out.md +76 -0
- package/adapters/spec/skills/ael-spec-brainstorm/SKILL.md +265 -0
- package/adapters/spec/skills/ael-spec-draft/SKILL.md +315 -0
- package/adapters/spec/skills/ael-spec-draft/references/design_doc.md +179 -0
- package/adapters/spec/skills/ael-spec-drift/SKILL.md +68 -0
- package/adapters/spec/skills/ael-spec-resolve/SKILL.md +188 -0
- package/adapters/spec/skills/ael-spec-review/SKILL.md +403 -0
- package/adapters/spec/skills/ael-spec-review-loop/SKILL.md +191 -0
- package/adapters/spec/standards/ael-spec-execution-instructions.md +36 -0
- package/adapters/spec/standards/ael-spec-feature-spec-standard.md +38 -0
- package/adapters/spec/standards/ael-spec-heilmeier-standard.md +32 -0
- package/adapters/spec/standards/ael-spec-implementation-readiness-standard.md +36 -0
- package/adapters/spec/standards/ael-spec-re-implementation-standard.md +39 -0
- package/adapters/spec/standards/ael-spec-zoom-out-standard.md +62 -0
- package/agents/instruction-only/AGENTS.md +1 -1
- package/bin/ai-engineering-loop.js +47 -7
- package/core/grill-policy.md +1 -1
- package/core/project-initialization.md +2 -2
- package/core/spec-pack.md +47 -0
- package/lib/bench.js +12 -12
- package/lib/design-ref.js +178 -0
- package/lib/docs.js +1 -1
- package/lib/doctor.js +2 -2
- package/lib/gates.js +1 -0
- package/lib/goal-runtime.js +5 -0
- package/lib/host-skill-build.js +1 -1
- package/lib/hosts/doctor.js +21 -3
- package/lib/impact-map.js +29 -1
- package/lib/receipt.js +12 -1
- package/lib/smart-context.js +10 -1
- package/lib/sync-hosts.js +28 -5
- package/package.json +3 -2
- package/schemas/goal-contract.schema.json +87 -11
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-commands.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-deliver.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-goal.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-hosts.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-maker.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-review.md +0 -0
- /package/.agents/skills/{ai-engineering-loop → ael}/references/loop-verify.md +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Design documents as Goal input (#97). `goal draft --from-design <doc.md>`
|
|
4
|
+
// turns a reviewed design (for example from the `spec` pack, #96) into a
|
|
5
|
+
// Goal draft with placeholder rows, and records `designRef` so later stages
|
|
6
|
+
// can tell which design a Run implements and whether it changed.
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { sha256 } = require('./fsutil.js');
|
|
11
|
+
|
|
12
|
+
const MAX_BYTES = 256 * 1024;
|
|
13
|
+
const PLACEHOLDER = '<fill:';
|
|
14
|
+
|
|
15
|
+
function designError(message, code) {
|
|
16
|
+
return Object.assign(new Error(message), { code });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toPosix(file) {
|
|
20
|
+
return file.split(path.sep).join('/');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Bounded, repository-local Markdown file. Returns { path, sha256, text }.
|
|
24
|
+
function readDesignDoc(rootDir, fileName) {
|
|
25
|
+
if (!fileName) throw designError('--from-design requires a Markdown file path', 'INVALID_USAGE');
|
|
26
|
+
const file = path.resolve(rootDir, fileName);
|
|
27
|
+
const relative = path.relative(rootDir, file);
|
|
28
|
+
if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
29
|
+
throw designError('Design document must stay inside the repository', 'UNSAFE_DESIGN_PATH');
|
|
30
|
+
}
|
|
31
|
+
if (!/\.(md|markdown)$/i.test(file)) throw designError('Design document must be a .md file', 'INVALID_DESIGN_DOC');
|
|
32
|
+
let stat;
|
|
33
|
+
try {
|
|
34
|
+
stat = fs.lstatSync(file);
|
|
35
|
+
} catch {
|
|
36
|
+
throw designError(`Design document not found: ${toPosix(relative)}`, 'DESIGN_DOC_MISSING');
|
|
37
|
+
}
|
|
38
|
+
if (stat.isSymbolicLink() || !stat.isFile() || stat.size > MAX_BYTES) {
|
|
39
|
+
throw designError('Design document must be a regular file of at most 256 KB', 'INVALID_DESIGN_DOC');
|
|
40
|
+
}
|
|
41
|
+
const buf = fs.readFileSync(file);
|
|
42
|
+
return { path: toPosix(relative), sha256: sha256(buf), text: buf.toString('utf8').replace(/\r\n?/g, '\n') };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const SECTION_KINDS = [
|
|
46
|
+
['nonGoals', /\b(non[- ]?goals?|out of scope|anti[- ]?goals?)\b/],
|
|
47
|
+
['goals', /^(\d+[.)]\s*)?(goals?|objectives?)\b/],
|
|
48
|
+
['targetFiles', /\b(target scope|affected files|files? (to )?(change|changed|touch|touched|modify)|file changes|file plan)\b/],
|
|
49
|
+
['testCases', /\b(test plan|testing|test cases|verification plan)\b/]
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
function sectionKind(heading) {
|
|
53
|
+
const text = heading.toLowerCase().replace(/[*_`]/g, '').trim();
|
|
54
|
+
const hit = SECTION_KINDS.find(([, pattern]) => pattern.test(text));
|
|
55
|
+
return hit ? hit[0] : null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function cleanItem(line) {
|
|
59
|
+
return line.replace(/^\s*(?:[-*+]|\d+[.)])\s+(\[[ xX]\]\s+)?/, '').replace(/\*\*/g, '').trim();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Lenient: any heading level; top-level bullets (indent <= 1) are items.
|
|
63
|
+
function parseDesignDoc(text) {
|
|
64
|
+
const parsed = { title: null, goals: [], nonGoals: [], targetFiles: [], testCases: [], warnings: [] };
|
|
65
|
+
let kind = null;
|
|
66
|
+
let kindLevel = 0;
|
|
67
|
+
let inFence = false;
|
|
68
|
+
const files = new Set();
|
|
69
|
+
for (const line of String(text).split('\n')) {
|
|
70
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
71
|
+
inFence = !inFence;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (inFence) continue;
|
|
75
|
+
const heading = line.match(/^(#{1,6})\s+(.*)$/);
|
|
76
|
+
if (heading) {
|
|
77
|
+
const level = heading[1].length;
|
|
78
|
+
if (!parsed.title && level === 1) parsed.title = heading[2].replace(/[*_`]/g, '').trim();
|
|
79
|
+
const next = sectionKind(heading[2]);
|
|
80
|
+
if (next) {
|
|
81
|
+
kind = next;
|
|
82
|
+
kindLevel = level;
|
|
83
|
+
} else if (kind && level <= kindLevel) {
|
|
84
|
+
kind = null;
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (!kind) continue;
|
|
89
|
+
if (kind === 'targetFiles') {
|
|
90
|
+
for (const match of line.matchAll(/`([^`\s]+)`/g)) {
|
|
91
|
+
const candidate = match[1].replace(/^\.\//, '');
|
|
92
|
+
if (/[/.]/.test(candidate) && !candidate.startsWith('/') && !candidate.split('/').includes('..') && !/[()=:]/.test(candidate)) files.add(candidate);
|
|
93
|
+
}
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (/^\s{0,1}(?:[-*+]|\d+[.)])\s+\S/.test(line)) {
|
|
97
|
+
const item = cleanItem(line);
|
|
98
|
+
if (item) parsed[kind].push(item);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
parsed.targetFiles = [...files];
|
|
102
|
+
if (!parsed.testCases.length) parsed.warnings.push('No Test Plan section with bullet items: acceptance rows come from Goals or are placeholders.');
|
|
103
|
+
if (!parsed.targetFiles.length) parsed.warnings.push('No Target Scope section with `file` paths: designRef.targetFiles is empty, so design drift cannot be checked.');
|
|
104
|
+
return parsed;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function placeholderRow(index, statement) {
|
|
108
|
+
return {
|
|
109
|
+
id: `AC-${index + 1}`,
|
|
110
|
+
statement,
|
|
111
|
+
evidenceRequired: `${PLACEHOLDER} test file and command that prove this>`,
|
|
112
|
+
failureCases: [`${PLACEHOLDER} what would still look green if this broke>`]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function designRefFrom(doc, parsed) {
|
|
117
|
+
return { path: doc.path, sha256: doc.sha256, targetFiles: parsed.targetFiles };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// A draft contract built from the document. Never frozen here.
|
|
121
|
+
function draftFromDesign(doc, parsed) {
|
|
122
|
+
const rows = parsed.testCases.length ? parsed.testCases : parsed.goals;
|
|
123
|
+
const objective = parsed.goals[0] || parsed.title || `Implement ${doc.path}`;
|
|
124
|
+
return {
|
|
125
|
+
objective: parsed.title && parsed.goals[0] ? `${parsed.title}: ${parsed.goals[0]}` : objective,
|
|
126
|
+
acceptanceCriteria: rows.length
|
|
127
|
+
? rows.map((row, index) => placeholderRow(index, row))
|
|
128
|
+
: [placeholderRow(0, `${PLACEHOLDER} acceptance criterion from ${doc.path}>`)],
|
|
129
|
+
...(parsed.nonGoals.length ? { outOfScope: parsed.nonGoals } : {}),
|
|
130
|
+
designRef: designRefFrom(doc, parsed)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function validateDesignRef(ref) {
|
|
135
|
+
if (ref === undefined) return [];
|
|
136
|
+
if (!ref || typeof ref !== 'object' || Array.isArray(ref)) return ['designRef must be an object'];
|
|
137
|
+
const errors = [];
|
|
138
|
+
if (typeof ref.path !== 'string' || !ref.path || ref.path.startsWith('/') || ref.path.split('/').includes('..')) {
|
|
139
|
+
errors.push('designRef.path must be a repository-relative path');
|
|
140
|
+
}
|
|
141
|
+
if (!/^[a-f0-9]{64}$/.test(String(ref.sha256 || ''))) errors.push('designRef.sha256 must be a sha256 hex digest');
|
|
142
|
+
if (ref.targetFiles !== undefined && (!Array.isArray(ref.targetFiles) || ref.targetFiles.some((item) => typeof item !== 'string' || !item))) {
|
|
143
|
+
errors.push('designRef.targetFiles must be an array of paths');
|
|
144
|
+
}
|
|
145
|
+
return errors;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// AC ids that still hold `<fill:` placeholders; freeze refuses them.
|
|
149
|
+
function placeholderRows(contract) {
|
|
150
|
+
return (contract?.acceptanceCriteria || [])
|
|
151
|
+
.filter((row) => [row.statement, row.evidenceRequired, ...(row.failureCases || [])].some((value) => String(value || '').includes(PLACEHOLDER)))
|
|
152
|
+
.map((row) => row.id);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Whether the referenced design still matches the hash recorded in the contract.
|
|
156
|
+
function designStatus(rootDir, ref) {
|
|
157
|
+
if (!ref) return null;
|
|
158
|
+
const file = path.resolve(rootDir, ref.path);
|
|
159
|
+
let current = null;
|
|
160
|
+
try {
|
|
161
|
+
const stat = fs.lstatSync(file);
|
|
162
|
+
if (stat.isFile() && !stat.isSymbolicLink()) current = sha256(fs.readFileSync(file));
|
|
163
|
+
} catch {
|
|
164
|
+
current = null;
|
|
165
|
+
}
|
|
166
|
+
return { path: ref.path, missing: current === null, designChanged: current !== ref.sha256 };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
module.exports = {
|
|
170
|
+
PLACEHOLDER,
|
|
171
|
+
readDesignDoc,
|
|
172
|
+
parseDesignDoc,
|
|
173
|
+
draftFromDesign,
|
|
174
|
+
designRefFrom,
|
|
175
|
+
validateDesignRef,
|
|
176
|
+
placeholderRows,
|
|
177
|
+
designStatus
|
|
178
|
+
};
|
package/lib/docs.js
CHANGED
|
@@ -8,7 +8,7 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
|
|
10
10
|
// Loop stage references are generated host-neutral copies (issue #35).
|
|
11
|
-
const DOC_ROOTS = Object.freeze(['core', 'policies', 'profiles', 'agents', 'adapters', '.agents/skills/
|
|
11
|
+
const DOC_ROOTS = Object.freeze(['core', 'policies', 'profiles', 'agents', 'adapters', '.agents/skills/ael/references']);
|
|
12
12
|
|
|
13
13
|
function packageRoot() {
|
|
14
14
|
return path.join(__dirname, '..');
|
package/lib/doctor.js
CHANGED
|
@@ -16,8 +16,8 @@ const REQUIRED_HOST_ASSETS = [
|
|
|
16
16
|
'.claude/agents/judge.md',
|
|
17
17
|
'.grok/agents/devil-advocate.md',
|
|
18
18
|
'.grok/agents/judge.md',
|
|
19
|
-
'.agents/skills/
|
|
20
|
-
'.agents/skills/
|
|
19
|
+
'.agents/skills/ael/SKILL.md',
|
|
20
|
+
'.agents/skills/ael/references/loop-hosts.md',
|
|
21
21
|
'.agents/skills/backend-development/SKILL.md',
|
|
22
22
|
'.agents/skills/emil-design-eng/SKILL.md',
|
|
23
23
|
'.agents/skills/animate/SKILL.md',
|
package/lib/gates.js
CHANGED
|
@@ -157,6 +157,7 @@ function validateGoalContract(contract) {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
errors.push(...validateGoalScope(contract.scope));
|
|
160
|
+
errors.push(...require('./design-ref.js').validateDesignRef(contract.designRef));
|
|
160
161
|
return { valid: errors.length === 0, errors };
|
|
161
162
|
}
|
|
162
163
|
|
package/lib/goal-runtime.js
CHANGED
|
@@ -5,6 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const { ACTOR_ID } = require('./fsutil.js');
|
|
6
6
|
const { validateGoalContract, hashFile } = require('./gates.js');
|
|
7
7
|
const { sha256 } = require('./recipe.js');
|
|
8
|
+
const { placeholderRows } = require('./design-ref.js');
|
|
8
9
|
const {
|
|
9
10
|
RUN_STATES,
|
|
10
11
|
atomicWritePrivateFile,
|
|
@@ -182,6 +183,10 @@ function freezeGoal(
|
|
|
182
183
|
}
|
|
183
184
|
const validation = validateGoalContract(contract);
|
|
184
185
|
if (!validation.valid) throw goalError('Goal Contract gate failed', 'GATE_FAILED', validation.errors);
|
|
186
|
+
const unfilled = placeholderRows(contract);
|
|
187
|
+
if (unfilled.length) {
|
|
188
|
+
throw goalError(`Fill the <fill: ...> placeholders before freezing: ${unfilled.join(', ')}`, 'GOAL_PLACEHOLDERS', unfilled);
|
|
189
|
+
}
|
|
185
190
|
const human = actorId(actor);
|
|
186
191
|
if (fs.existsSync(paths.version)) {
|
|
187
192
|
throw goalError(`Goal version ${version} already exists`, 'GOAL_VERSION_EXISTS');
|
package/lib/host-skill-build.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
|
|
14
|
-
const SOURCE_DIR = 'skill-src/
|
|
14
|
+
const SOURCE_DIR = 'skill-src/ael';
|
|
15
15
|
const SKILL_CHAR_LIMIT = 4000;
|
|
16
16
|
// Compact digest for instruction-only hosts (#60), served by `docs AGENTS`.
|
|
17
17
|
const DIGEST_SOURCE = 'digest.md';
|
package/lib/hosts/doctor.js
CHANGED
|
@@ -10,7 +10,9 @@ const { sha256 } = require('../fsutil.js');
|
|
|
10
10
|
const { HOSTS, guardrailSupport, usesSharedSkills } = require('./registry.js');
|
|
11
11
|
const { certificationLabel } = require('./table.js');
|
|
12
12
|
|
|
13
|
-
const CORE_SKILL = '
|
|
13
|
+
const CORE_SKILL = 'ael';
|
|
14
|
+
// Pre-#107 name of the core skill; a leftover copy shows a second slash command.
|
|
15
|
+
const LEGACY_CORE_SKILL = 'ai-engineering-loop';
|
|
14
16
|
|
|
15
17
|
function realOrSelf(file) {
|
|
16
18
|
try {
|
|
@@ -36,6 +38,18 @@ function visibleCopies(host, home, skill = CORE_SKILL) {
|
|
|
36
38
|
return [...seen.values()];
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
// Spec pack (#99): installed when the host can see `ael-spec-review`.
|
|
42
|
+
// Instruction-only hosts have no subagent tool, so the pack's reviews run
|
|
43
|
+
// in-session as CONTEXT_ISOLATION_ONLY. Informational; never fails doctor.
|
|
44
|
+
const SPEC_PROBE = 'ael-spec-review';
|
|
45
|
+
|
|
46
|
+
function specStatus(host, home) {
|
|
47
|
+
return {
|
|
48
|
+
installed: visibleCopies(host, home, SPEC_PROBE).length > 0,
|
|
49
|
+
reviewMode: host.certification === 'instruction-only' ? 'CONTEXT_ISOLATION_ONLY' : 'FRESH_SUBAGENT'
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
39
53
|
// `plan` is planHostSync(...) output; groups are host ids plus 'shared'.
|
|
40
54
|
function hostsDoctor({ home, selection, plan }) {
|
|
41
55
|
const rows = [];
|
|
@@ -51,7 +65,9 @@ function hostsDoctor({ home, selection, plan }) {
|
|
|
51
65
|
if (!copies.length) problems.push('core skill not installed');
|
|
52
66
|
if (hashes.size > 1) problems.push(`${copies.length} copies with different content`);
|
|
53
67
|
if (resync.length) problems.push(`${resync.length} file(s) need sync`);
|
|
54
|
-
|
|
68
|
+
const legacy = visibleCopies(host, home, LEGACY_CORE_SKILL).map((c) => c.path);
|
|
69
|
+
if (legacy.length) problems.push(`legacy ${LEGACY_CORE_SKILL} skill left over (duplicate command): ${legacy.join(', ')}`);
|
|
70
|
+
rows.push({ id: host.id, name: host.name, certification: host.certification, certifiedBy: host.certifiedBy || null, guardrails: guardrailSupport(host), copies, identical: hashes.size <= 1, resync, ok: problems.length === 0, problems, spec: specStatus(host, home) });
|
|
55
71
|
}
|
|
56
72
|
return { ok: rows.every((row) => row.ok), hosts: rows };
|
|
57
73
|
}
|
|
@@ -62,12 +78,14 @@ function formatHostsDoctor(report) {
|
|
|
62
78
|
for (const row of report.hosts) {
|
|
63
79
|
const where = row.copies.map((c) => c.path).join(', ') || '-';
|
|
64
80
|
lines.push(` ${row.ok ? '✓' : '✗'} ${row.id.padEnd(16)} [${certificationLabel(row)}, guardrails ${row.guardrails}] ${row.copies.length} cop${row.copies.length === 1 ? 'y' : 'ies'}${row.copies.length > 1 ? (row.identical ? ' (identical)' : ' (DIFFERENT)') : ''}: ${where}`);
|
|
81
|
+
if (row.spec?.installed) lines.push(` spec pack: installed (${row.spec.reviewMode === 'FRESH_SUBAGENT' ? 'reviews in fresh subagents' : 'no subagents: reviews run in-session, CONTEXT_ISOLATION_ONLY'})`);
|
|
65
82
|
for (const problem of row.problems) lines.push(` ${problem}`);
|
|
66
83
|
for (const file of row.resync.slice(0, 5)) lines.push(` needs sync: ${file}`);
|
|
67
84
|
if (row.resync.length > 5) lines.push(` ... and ${row.resync.length - 5} more`);
|
|
68
85
|
}
|
|
69
86
|
if (!report.ok) lines.push('Fix: "ai-engineering-loop sync-hosts" (edited files are kept; remove an old copy by hand if it differs).');
|
|
87
|
+
if (!report.hosts.some((row) => row.spec?.installed)) lines.push('Optional: "ai-engineering-loop sync-hosts --pack spec" adds the ael-spec-* design review skills (used at T2).');
|
|
70
88
|
return lines.join('\n');
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
module.exports = { CORE_SKILL, visibleCopies, hostsDoctor, formatHostsDoctor };
|
|
91
|
+
module.exports = { CORE_SKILL, LEGACY_CORE_SKILL, visibleCopies, specStatus, hostsDoctor, formatHostsDoctor };
|
package/lib/impact-map.js
CHANGED
|
@@ -431,6 +431,7 @@ function detectImpactDrift(rootDir, { runId, now = new Date() } = {}) {
|
|
|
431
431
|
else if (map?.status === 'DRAFT') allowed = mappedPaths(map);
|
|
432
432
|
const compared = map && map.status !== 'SKIPPED';
|
|
433
433
|
const outOfMap = compared ? changedFiles.filter((file) => !matchesAnyGlob(file, allowed)) : [];
|
|
434
|
+
const design = designDrift(rootDir, run, changedFiles);
|
|
434
435
|
const drift = {
|
|
435
436
|
schemaVersion: 1,
|
|
436
437
|
runId: run.runId,
|
|
@@ -439,13 +440,40 @@ function detectImpactDrift(rootDir, { runId, now = new Date() } = {}) {
|
|
|
439
440
|
...(map?.status === 'SKIPPED' ? { skipReason: map.skipReason } : {}),
|
|
440
441
|
checkedAt: now.toISOString(),
|
|
441
442
|
changedFiles,
|
|
442
|
-
outOfMap
|
|
443
|
+
outOfMap,
|
|
444
|
+
...(design ? { design } : {})
|
|
443
445
|
};
|
|
444
446
|
const filePath = driftPath(rootDir, run.runId);
|
|
445
447
|
atomicWriteJson(filePath, drift);
|
|
446
448
|
return { drift, path: relative(rootDir, filePath) };
|
|
447
449
|
}
|
|
448
450
|
|
|
451
|
+
// Design-scope drift (#98): when the frozen Goal has a designRef, compare the
|
|
452
|
+
// design's planned files with the Maker diff. Informational only; it never
|
|
453
|
+
// adds a ledger finding or fails a gate. Run evidence under the context dir
|
|
454
|
+
// is not "unplanned".
|
|
455
|
+
function designDrift(rootDir, run, changedFiles) {
|
|
456
|
+
let goal;
|
|
457
|
+
try {
|
|
458
|
+
goal = readGoal(rootDir, run);
|
|
459
|
+
} catch {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
const ref = goal?.designRef;
|
|
463
|
+
if (!ref || typeof ref.path !== 'string') return null;
|
|
464
|
+
const { designStatus } = require('./design-ref.js');
|
|
465
|
+
const status = designStatus(rootDir, ref);
|
|
466
|
+
const planned = Array.isArray(ref.targetFiles) ? ref.targetFiles : [];
|
|
467
|
+
const code = changedFiles.filter((file) => !file.startsWith('.ai-engineering-loop/'));
|
|
468
|
+
return {
|
|
469
|
+
path: ref.path,
|
|
470
|
+
docChanged: status.designChanged,
|
|
471
|
+
planned: planned.length,
|
|
472
|
+
unplanned: planned.length ? code.filter((file) => !matchesAnyGlob(file, planned)) : [],
|
|
473
|
+
untouched: planned.filter((pattern) => !code.some((file) => matchesGlob(file, pattern)))
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
449
477
|
function loadImpactDrift(rootDir, runId) {
|
|
450
478
|
const filePath = driftPath(rootDir, runId);
|
|
451
479
|
return readJsonOptional(filePath);
|
package/lib/receipt.js
CHANGED
|
@@ -222,7 +222,18 @@ function buildReceipt(rootDir, { runId, host, model, head, evidenceLinks = [], a
|
|
|
222
222
|
reason: safeText(verdict.reason)
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
|
-
impact: drift ? {
|
|
225
|
+
impact: drift ? {
|
|
226
|
+
mapStatus: drift.mapStatus,
|
|
227
|
+
outOfMap: (drift.outOfMap || []).map(safeText),
|
|
228
|
+
...(drift.design ? {
|
|
229
|
+
design: {
|
|
230
|
+
path: safeText(drift.design.path),
|
|
231
|
+
docChanged: drift.design.docChanged === true,
|
|
232
|
+
unplanned: (drift.design.unplanned || []).length,
|
|
233
|
+
untouched: (drift.design.untouched || []).length
|
|
234
|
+
}
|
|
235
|
+
} : {})
|
|
236
|
+
} : null,
|
|
226
237
|
guard: {
|
|
227
238
|
warn: guardEvents.filter((event) => event.decision === 'warn').length,
|
|
228
239
|
block: guardEvents.filter((event) => event.decision === 'block').length
|
package/lib/smart-context.js
CHANGED
|
@@ -468,7 +468,16 @@ function boundedHunks(file, limits, remainingBytes) {
|
|
|
468
468
|
function impactDriftSummary(rootDir, runId) {
|
|
469
469
|
const drift = require('./impact-map.js').loadImpactDrift(rootDir, runId);
|
|
470
470
|
if (!drift) return null;
|
|
471
|
-
|
|
471
|
+
const summary = { mapStatus: drift.mapStatus, outOfMap: (drift.outOfMap || []).slice(0, 50) };
|
|
472
|
+
// Design drift (#98): two short lines for the Devil's Advocate, not the lists.
|
|
473
|
+
if (drift.design) {
|
|
474
|
+
const d = drift.design;
|
|
475
|
+
summary.design = [
|
|
476
|
+
`Design ${d.path}${d.docChanged ? ' changed after the Goal was drafted' : ''}: ${d.unplanned.length} changed file(s) outside its plan${d.unplanned.length ? ` (${d.unplanned.slice(0, 3).join(', ')}${d.unplanned.length > 3 ? ', ...' : ''})` : ''}.`,
|
|
477
|
+
`${d.untouched.length} planned file(s) untouched${d.untouched.length ? ` (${d.untouched.slice(0, 3).join(', ')}${d.untouched.length > 3 ? ', ...' : ''})` : ''}; check whether the plan or the diff is wrong.`
|
|
478
|
+
];
|
|
479
|
+
}
|
|
480
|
+
return summary;
|
|
472
481
|
}
|
|
473
482
|
|
|
474
483
|
function createDiffHunkPack(rootDir, { runId, base = 'HEAD', profile, includeIgnored = false } = {}) {
|
package/lib/sync-hosts.js
CHANGED
|
@@ -21,7 +21,7 @@ function packageRoot() {
|
|
|
21
21
|
|
|
22
22
|
// Host packs. `core` is always installed; the others are opt-in so unrelated
|
|
23
23
|
// skills do not enter every session's skill index (issue #31).
|
|
24
|
-
const HOST_PACKS = Object.freeze(['core', 'backend', 'design', 'quality']);
|
|
24
|
+
const HOST_PACKS = Object.freeze(['core', 'backend', 'design', 'quality', 'spec']);
|
|
25
25
|
const DEFAULT_HOST_PACKS = Object.freeze(['core']);
|
|
26
26
|
const MANIFEST_FILE = 'host-manifest.json';
|
|
27
27
|
|
|
@@ -101,6 +101,27 @@ function adoptedSkillFiles(destRoot) {
|
|
|
101
101
|
];
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
// Spec pack (#96): host-neutral ael-spec-* skills generated from the EGM fork
|
|
105
|
+
// by scripts/sync-spec-pack.js. Personas and standards stay in the package
|
|
106
|
+
// and are read with `ai-engineering-loop docs <name>`.
|
|
107
|
+
const SPEC_SKILL_FILES = Object.freeze({
|
|
108
|
+
'ael-spec-brainstorm': ['SKILL.md'],
|
|
109
|
+
'ael-spec-draft': ['SKILL.md', 'references/design_doc.md'],
|
|
110
|
+
'ael-spec-review': ['SKILL.md'],
|
|
111
|
+
'ael-spec-review-loop': ['SKILL.md'],
|
|
112
|
+
'ael-spec-resolve': ['SKILL.md'],
|
|
113
|
+
'ael-spec-drift': ['SKILL.md']
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
function specSkillFiles(destRoot) {
|
|
117
|
+
return Object.entries(SPEC_SKILL_FILES).flatMap(([skill, files]) => files.map((file) => ({
|
|
118
|
+
src: `adapters/spec/skills/${skill}/${file}`,
|
|
119
|
+
dest: path.join(destRoot, skill, file),
|
|
120
|
+
mode: 'upsert',
|
|
121
|
+
pack: 'spec'
|
|
122
|
+
})));
|
|
123
|
+
}
|
|
124
|
+
|
|
104
125
|
// Loop stage references sit beside each host's SKILL.md (issue #35).
|
|
105
126
|
const LOOP_REFERENCE_FILES = Object.freeze([
|
|
106
127
|
'loop-commands.md',
|
|
@@ -122,20 +143,21 @@ function loopReferenceFiles(srcDir, destDir) {
|
|
|
122
143
|
}
|
|
123
144
|
|
|
124
145
|
// The host-neutral core skill (#48): one source, byte-identical everywhere.
|
|
125
|
-
const CORE_SKILL_SRC = '.agents/skills/
|
|
146
|
+
const CORE_SKILL_SRC = '.agents/skills/ael';
|
|
126
147
|
|
|
127
148
|
// Every skill a host's skill folder gets: core loop skill, helpers, packs.
|
|
128
149
|
function skillFolderFiles(skillsDir) {
|
|
129
150
|
return [
|
|
130
|
-
{ src: `${CORE_SKILL_SRC}/SKILL.md`, dest: path.join(skillsDir, '
|
|
131
|
-
...loopReferenceFiles(CORE_SKILL_SRC, path.join(skillsDir, '
|
|
151
|
+
{ src: `${CORE_SKILL_SRC}/SKILL.md`, dest: path.join(skillsDir, 'ael/SKILL.md'), mode: 'upsert' },
|
|
152
|
+
...loopReferenceFiles(CORE_SKILL_SRC, path.join(skillsDir, 'ael')),
|
|
132
153
|
...backendSkillFiles('.agents/skills/backend-development', path.join(skillsDir, 'backend-development')),
|
|
133
154
|
...emilKowalskiSkillFiles('.agents/skills', skillsDir),
|
|
134
155
|
// Adapter-neutral (#64): installed by default, not part of the opt-in quality pack.
|
|
135
156
|
{ src: 'adapters/quality/skills/task-impact-inquiry/SKILL.md', dest: path.join(skillsDir, 'task-impact-inquiry/SKILL.md'), mode: 'upsert' },
|
|
136
157
|
{ src: 'adapters/generate-adapter/SKILL.md', dest: path.join(skillsDir, 'generate-adapter/SKILL.md'), mode: 'upsert' },
|
|
137
158
|
{ src: 'adapters/generate-workflow/SKILL.md', dest: path.join(skillsDir, 'generate-workflow/SKILL.md'), mode: 'upsert' },
|
|
138
|
-
...adoptedSkillFiles(skillsDir)
|
|
159
|
+
...adoptedSkillFiles(skillsDir),
|
|
160
|
+
...specSkillFiles(skillsDir)
|
|
139
161
|
];
|
|
140
162
|
}
|
|
141
163
|
|
|
@@ -626,6 +648,7 @@ function formatHostSyncReport(results, { version, dryRun = false } = {}) {
|
|
|
626
648
|
|
|
627
649
|
module.exports = {
|
|
628
650
|
QUALITY_SKILLS,
|
|
651
|
+
SPEC_SKILL_FILES,
|
|
629
652
|
LOOP_REFERENCE_FILES,
|
|
630
653
|
HOST_PACKS,
|
|
631
654
|
DEFAULT_HOST_PACKS,
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-engineering-loop",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A visual workspace that helps AI coding agents plan, build, review, and ship reliable software.",
|
|
5
5
|
"main": "bin/ai-engineering-loop.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"ai-engineering-loop": "bin/ai-engineering-loop.js"
|
|
7
|
+
"ai-engineering-loop": "bin/ai-engineering-loop.js",
|
|
8
|
+
"ael": "bin/ai-engineering-loop.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"bin/",
|
|
@@ -3,25 +3,55 @@
|
|
|
3
3
|
"$id": "https://github.com/egagofur/ai-engineering-loop/schemas/goal-contract.schema.json",
|
|
4
4
|
"title": "AI Engineering Loop Goal Contract",
|
|
5
5
|
"type": "object",
|
|
6
|
-
"required": [
|
|
6
|
+
"required": [
|
|
7
|
+
"schemaVersion",
|
|
8
|
+
"runId",
|
|
9
|
+
"objective",
|
|
10
|
+
"acceptanceCriteria"
|
|
11
|
+
],
|
|
7
12
|
"properties": {
|
|
8
|
-
"schemaVersion": {
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
"schemaVersion": {
|
|
14
|
+
"const": 1
|
|
15
|
+
},
|
|
16
|
+
"runId": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1
|
|
19
|
+
},
|
|
20
|
+
"objective": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"minLength": 1
|
|
23
|
+
},
|
|
11
24
|
"acceptanceCriteria": {
|
|
12
25
|
"type": "array",
|
|
13
26
|
"minItems": 1,
|
|
14
27
|
"items": {
|
|
15
28
|
"type": "object",
|
|
16
|
-
"required": [
|
|
29
|
+
"required": [
|
|
30
|
+
"id",
|
|
31
|
+
"statement",
|
|
32
|
+
"evidenceRequired",
|
|
33
|
+
"failureCases"
|
|
34
|
+
],
|
|
17
35
|
"properties": {
|
|
18
|
-
"id": {
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
"id": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^AC-[0-9]+$"
|
|
39
|
+
},
|
|
40
|
+
"statement": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"minLength": 1
|
|
43
|
+
},
|
|
44
|
+
"evidenceRequired": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"minLength": 1
|
|
47
|
+
},
|
|
21
48
|
"failureCases": {
|
|
22
49
|
"type": "array",
|
|
23
50
|
"minItems": 1,
|
|
24
|
-
"items": {
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
}
|
|
25
55
|
}
|
|
26
56
|
},
|
|
27
57
|
"additionalProperties": true
|
|
@@ -31,10 +61,56 @@
|
|
|
31
61
|
"description": "Optional file scope frozen with the Goal (#59). Absent = no path enforcement. Globs: ** crosses directories, * stays in one segment, a trailing / is a directory prefix.",
|
|
32
62
|
"type": "object",
|
|
33
63
|
"properties": {
|
|
34
|
-
"allowedPaths": {
|
|
35
|
-
|
|
64
|
+
"allowedPaths": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"deniedPaths": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"additionalProperties": false
|
|
80
|
+
},
|
|
81
|
+
"designRef": {
|
|
82
|
+
"description": "Optional design document this Goal implements (#97): written by `goal draft --from-design`. targetFiles feed the design drift check.",
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": [
|
|
85
|
+
"path",
|
|
86
|
+
"sha256"
|
|
87
|
+
],
|
|
88
|
+
"properties": {
|
|
89
|
+
"path": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"minLength": 1
|
|
92
|
+
},
|
|
93
|
+
"sha256": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
96
|
+
},
|
|
97
|
+
"targetFiles": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
}
|
|
103
|
+
}
|
|
36
104
|
},
|
|
37
105
|
"additionalProperties": false
|
|
106
|
+
},
|
|
107
|
+
"outOfScope": {
|
|
108
|
+
"description": "Optional list of things this Goal must not change.",
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"minLength": 1
|
|
113
|
+
}
|
|
38
114
|
}
|
|
39
115
|
},
|
|
40
116
|
"additionalProperties": true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|