ai-engineering-loop 1.16.0 → 2.0.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.
Files changed (74) hide show
  1. package/.agents/skills/ai-engineering-loop/SKILL.md +4 -4
  2. package/.agents/skills/ai-engineering-loop/references/loop-commands.md +5 -1
  3. package/.agents/skills/ai-engineering-loop/references/loop-deliver.md +2 -1
  4. package/.agents/skills/ai-engineering-loop/references/loop-goal.md +1 -0
  5. package/.agents/skills/ai-engineering-loop/references/loop-maker.md +1 -0
  6. package/.claude/skills/ai-engineering-loop/SKILL.md +4 -4
  7. package/.claude/skills/ai-engineering-loop/references/loop-commands.md +5 -1
  8. package/.claude/skills/ai-engineering-loop/references/loop-deliver.md +2 -1
  9. package/.claude/skills/ai-engineering-loop/references/loop-goal.md +1 -0
  10. package/.claude/skills/ai-engineering-loop/references/loop-maker.md +1 -0
  11. package/CHANGELOG.md +69 -0
  12. package/README.md +24 -22
  13. package/adapters/dot/gitlab.md +6 -0
  14. package/adapters/github/pull-request.md +5 -0
  15. package/adapters/gitlab/merge-request.md +5 -0
  16. package/adapters/quality/skills/task-impact-inquiry/SKILL.md +2 -0
  17. package/bin/ai-engineering-loop.js +514 -19
  18. package/core/bench.md +77 -0
  19. package/core/blast-radius-map.md +37 -0
  20. package/core/configuration-precedence.md +11 -1
  21. package/core/learnings.md +24 -0
  22. package/core/local-workflow-studio.md +26 -68
  23. package/core/personal-workflow.md +78 -0
  24. package/core/pr-receipt.md +35 -0
  25. package/core/runtime-safety.md +24 -0
  26. package/core/workflow-recipes.md +2 -0
  27. package/evals/README.md +2 -0
  28. package/evals/cases/25-no-task-onboarding.json +22 -0
  29. package/evals/scenarios/t0-docs-typo.json +31 -0
  30. package/evals/scenarios/t1-empty-state.json +31 -0
  31. package/evals/scenarios/t1-list-pagination.json +33 -0
  32. package/evals/scenarios/t2-auth-session.json +31 -0
  33. package/evals/scenarios/t2-payment-idempotency.json +31 -0
  34. package/evals/scenarios/trap-destructive-reset.json +33 -0
  35. package/evals/scenarios/trap-out-of-scope.json +34 -0
  36. package/evals/scenarios/trap-prompt-injection.json +39 -0
  37. package/lib/bench-targets.js +194 -0
  38. package/lib/bench.js +1236 -0
  39. package/lib/budget.js +32 -0
  40. package/lib/cli-args.js +17 -2
  41. package/lib/doctor.js +20 -2
  42. package/lib/gates.js +39 -0
  43. package/lib/guard-hooks.js +115 -0
  44. package/lib/guard.js +336 -0
  45. package/lib/hosts/commands.js +4 -3
  46. package/lib/hosts/doctor.js +3 -3
  47. package/lib/hosts/registry.js +39 -2
  48. package/lib/hosts/table.js +6 -4
  49. package/lib/impact-map.js +501 -0
  50. package/lib/learn.js +303 -0
  51. package/lib/personal-workflow.js +925 -0
  52. package/lib/receipt.js +362 -0
  53. package/lib/recipe.js +90 -13
  54. package/lib/run-state.js +10 -1
  55. package/lib/run-watcher.js +511 -0
  56. package/lib/runtime-files.js +2 -0
  57. package/lib/runtime-policy.js +42 -1
  58. package/lib/safe-context.js +14 -0
  59. package/lib/smart-context.js +21 -0
  60. package/lib/studio-runtime.js +8 -3
  61. package/lib/studio-server.js +336 -98
  62. package/lib/user-state.js +34 -1
  63. package/package.json +1 -1
  64. package/schemas/bench-result.schema.json +288 -0
  65. package/schemas/bench-scenario.schema.json +95 -0
  66. package/schemas/delivery.schema.json +11 -1
  67. package/schemas/finding-ledger.schema.json +2 -1
  68. package/schemas/goal-contract.schema.json +9 -0
  69. package/schemas/impact-map.schema.json +78 -0
  70. package/schemas/learnings.schema.json +47 -0
  71. package/schemas/receipt.schema.json +102 -0
  72. package/studio/app.js +599 -1621
  73. package/studio/index.html +43 -178
  74. package/studio/styles.css +17 -2
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  const fs = require('fs');
14
+ const os = require('os');
14
15
  const path = require('path');
15
16
  const crypto = require('crypto');
16
17
  const { execSync, spawn } = require('child_process');
@@ -67,6 +68,17 @@ const {
67
68
  judgeRequirement
68
69
  } = require('../lib/gates.js');
69
70
  const { initialTierState } = require('../lib/tier.js');
71
+ const impactMap = require('../lib/impact-map.js');
72
+ const guard = require('../lib/guard.js');
73
+ const guardHooks = require('../lib/guard-hooks.js');
74
+ const receipts = require('../lib/receipt.js');
75
+ const { learn } = require('../lib/learn.js');
76
+ const {
77
+ runBench,
78
+ compareBenches,
79
+ formatCompare,
80
+ parseBenchTimeoutSeconds
81
+ } = require('../lib/bench.js');
70
82
  const {
71
83
  createContextPack,
72
84
  contextPackSummary
@@ -180,7 +192,7 @@ const {
180
192
  readHandoff,
181
193
  verifyHandoff
182
194
  } = require('../lib/handoff.js');
183
- const { createStudioServer } = require('../lib/studio-server.js');
195
+ const { createStudioServer, readStudioUrl } = require('../lib/studio-server.js');
184
196
 
185
197
  const VERSION = require('../package.json').version;
186
198
  const CWD = process.cwd();
@@ -885,6 +897,7 @@ function statusJson() {
885
897
  status: 'NOT_INITIALIZED',
886
898
  packageVersion: VERSION,
887
899
  project: path.basename(CWD),
900
+ studioUrl: readStudioUrl(CWD),
888
901
  hostSkills: hostSkillStatus({ home: homeDir(), version: VERSION })
889
902
  };
890
903
  if (fs.existsSync(CONTEXT_DIR)) {
@@ -1354,21 +1367,20 @@ function handleRun() {
1354
1367
  let mode = modeArg ? normalizeMode(modeArg) : (startsNewRun ? policy.defaultMode : null);
1355
1368
  let workflow = null;
1356
1369
  let requestedRunId = null;
1357
- const selectedRecipeId = recipeArg || (
1358
- startsNewRun
1359
- ? (mode === RUN_MODES.REPORT_ONLY ? 'audit' : 'default')
1360
- : null
1361
- );
1362
- if (selectedRecipeId) {
1363
- const { recipe } = loadRecipe(CWD, selectedRecipeId);
1370
+ if (startsNewRun || recipeArg) {
1371
+ const resolved = require('../lib/personal-workflow.js').resolveRunWorkflow(CWD, {
1372
+ mode: mode || (current ? current.mode : null),
1373
+ recipeId: recipeArg || null
1374
+ });
1375
+ const recipe = resolved.recipe;
1364
1376
  if (!mode && current) mode = current.mode;
1365
- if (startsNewRun && !modeArg && !recipe.compatibleModes.includes(mode)) {
1377
+ if (startsNewRun && !modeArg && mode && !recipe.compatibleModes.includes(mode)) {
1366
1378
  if (recipe.compatibleModes.length !== 1) {
1367
1379
  throw new Error(`Recipe ${recipe.id} requires an explicit compatible --mode.`);
1368
1380
  }
1369
1381
  mode = recipe.compatibleModes[0];
1370
1382
  }
1371
- const plan = compileRecipe(recipe, { mode });
1383
+ const plan = compileRecipe(recipe, { mode: mode || recipe.compatibleModes[0] });
1372
1384
  if (startsNewRun) {
1373
1385
  requestedRunId = newRunId();
1374
1386
  workflow = createWorkflowBundle(plan, requestedRunId, {
@@ -1380,6 +1392,8 @@ function handleRun() {
1380
1392
  task
1381
1393
  }
1382
1394
  });
1395
+ workflow.workflowSource = resolved.source;
1396
+ if (resolved.reason) workflow.workflowReason = resolved.reason;
1383
1397
  } else {
1384
1398
  workflow = { plan };
1385
1399
  }
@@ -1422,6 +1436,8 @@ function handleRun() {
1422
1436
  tierReasons: run.tier ? run.tier.reasons : [],
1423
1437
  subagents: run.tier ? { T0: 0, T1: 1, T2: 2 }[run.tier.current] : 2,
1424
1438
  recipe: run.workflow ? run.workflow.recipeId : null,
1439
+ workflowSource: run.workflow ? (run.workflow.workflowSource || null) : null,
1440
+ ...(run.workflow && run.workflow.workflowReason ? { workflowReason: run.workflow.workflowReason } : {}),
1425
1441
  budget: (() => {
1426
1442
  try {
1427
1443
  const b = budgetStatus(CWD, { runId: run.runId });
@@ -1433,7 +1449,8 @@ function handleRun() {
1433
1449
  hostSkills: (() => {
1434
1450
  const h = hostSkillStatus({ home: homeDir(), version: VERSION });
1435
1451
  return { stale: h.stale, staleFiles: h.staleFiles, installedVersion: h.installedVersion, packageVersion: VERSION };
1436
- })()
1452
+ })(),
1453
+ studioUrl: readStudioUrl(CWD)
1437
1454
  }, null, 2));
1438
1455
  return;
1439
1456
  }
@@ -1450,6 +1467,10 @@ function handleRun() {
1450
1467
  .filter((node) => runtime.state.nodes[node.id].status === 'READY')
1451
1468
  .map((node) => node.id);
1452
1469
  console.log(`- Recipe: ${runResult.run.workflow.recipeId} (${runResult.run.workflow.graphHash})`);
1470
+ if (runResult.run.workflow.workflowSource) {
1471
+ const why = runResult.run.workflow.workflowReason ? ` (${runResult.run.workflow.workflowReason})` : '';
1472
+ console.log(`- Workflow source: ${runResult.run.workflow.workflowSource}${why}`);
1473
+ }
1453
1474
  console.log(`- Ready nodes: ${ready.join(', ') || 'none'}`);
1454
1475
  }
1455
1476
 
@@ -1822,9 +1843,12 @@ function executeGate(gate, runId) {
1822
1843
  });
1823
1844
  }
1824
1845
  }
1846
+ if (gate === 'maker') ensureImpactMap(target.runId);
1825
1847
  const run = target.workflow
1826
1848
  ? applyWorkflowGate(CWD, gate, { runId: target.runId }).run
1827
1849
  : applyGate(CWD, gate, { runId: target.runId });
1850
+ if (gate === 'goal') ensureImpactMap(target.runId);
1851
+ if (gate === 'verification') recordImpactDrift(target.runId);
1828
1852
  const runCompleted = run.state === 'DELIVERED' || run.state === 'REPORTED';
1829
1853
  appendRunLifecycle(CWD, target.runId, {
1830
1854
  type: runCompleted
@@ -1839,6 +1863,31 @@ function executeGate(gate, runId) {
1839
1863
  return run;
1840
1864
  }
1841
1865
 
1866
+ // Blast-radius map (#71): written into the Run once the Goal is frozen, so it
1867
+ // exists before Stage 3. Best effort: a scan failure never blocks a gate.
1868
+ function ensureImpactMap(runId) {
1869
+ try {
1870
+ if (impactMap.loadImpactMap(CWD, runId)) return null;
1871
+ const result = impactMap.generateImpactMap(CWD, { runId });
1872
+ console.error(`- Impact map: ${result.path} (DRAFT; review it with \`impact show\`, then \`impact confirm --by <name>\` or \`impact skip --reason <text>\`)`);
1873
+ return result;
1874
+ } catch (err) {
1875
+ console.error(`! impact map not written: ${err.message}`);
1876
+ return null;
1877
+ }
1878
+ }
1879
+
1880
+ // Drift of the gated Maker diff against the map, recorded with verification;
1881
+ // the review gate turns out-of-map files into LOW ledger findings.
1882
+ function recordImpactDrift(runId) {
1883
+ try {
1884
+ return impactMap.detectImpactDrift(CWD, { runId }).drift;
1885
+ } catch (err) {
1886
+ console.error(`! impact drift not checked: ${err.message}`);
1887
+ return null;
1888
+ }
1889
+ }
1890
+
1842
1891
  // `gate maker --from-git` (issue #35): write the working-tree diff (tracked and
1843
1892
  // untracked files, excluding .ai-engineering-loop/) to RUN_DIR/diff.patch so the
1844
1893
  // agent does not need a separate write step. ASSISTED/REPORT_ONLY only;
@@ -1879,6 +1928,7 @@ function handleGate() {
1879
1928
  }
1880
1929
  const run = executeGate(gate, target.runId);
1881
1930
  const judge = gate === 'review' && run.tier ? judgeRequirement(CWD, run) : null;
1931
+ const guardEvents = guard.guardSummary(CWD, run.runId);
1882
1932
  if (json) {
1883
1933
  console.log(JSON.stringify({
1884
1934
  ok: true,
@@ -1887,13 +1937,17 @@ function handleGate() {
1887
1937
  iteration: run.iteration,
1888
1938
  gate,
1889
1939
  ...(run.tier ? { tier: run.tier.current } : {}),
1890
- ...(judge ? { judgeRequired: judge.required, judgeReasons: judge.reasons } : {})
1940
+ ...(judge ? { judgeRequired: judge.required, judgeReasons: judge.reasons } : {}),
1941
+ guard: guardEvents
1891
1942
  }));
1892
1943
  } else {
1893
1944
  log.success(`✓ ${gate} gate passed`);
1894
1945
  console.log(`- Run: ${run.runId}`);
1895
1946
  console.log(`- State: ${run.state}, iteration ${run.iteration}`);
1896
1947
  if (run.tier) console.log(`- Tier: ${run.tier.current}`);
1948
+ if (guardEvents.warn || guardEvents.block) {
1949
+ console.log(`- Guard: ${guardEvents.block} blocked, ${guardEvents.warn} warned (${guardEvents.rules.join(', ')}); see guard-events.json`);
1950
+ }
1897
1951
  if (judge) {
1898
1952
  console.log(judge.required
1899
1953
  ? `- Judge: REQUIRED (${judge.reasons.join('; ')}). Spawn the Judge subagent, write verdict.json, then gate judge.`
@@ -2604,6 +2658,109 @@ function handleMigrate() {
2604
2658
  }
2605
2659
  }
2606
2660
 
2661
+ function workflowFail(err, json) {
2662
+ if (json) {
2663
+ console.log(JSON.stringify({
2664
+ ok: false,
2665
+ code: err.code || 'PERSONAL_WORKFLOW_FAILED',
2666
+ error: err.message,
2667
+ details: err.details || []
2668
+ }));
2669
+ } else {
2670
+ log.error(err.message);
2671
+ for (const detail of err.details || []) console.error(`- ${detail}`);
2672
+ }
2673
+ process.exit(1);
2674
+ }
2675
+
2676
+ function readAnswersFile(file) {
2677
+ if (!file) {
2678
+ throw Object.assign(new Error('workflow propose requires --answers <file>'), { code: 'ANSWERS_REQUIRED' });
2679
+ }
2680
+ const absolute = path.resolve(CWD, file);
2681
+ let stat;
2682
+ try {
2683
+ stat = fs.lstatSync(absolute);
2684
+ } catch {
2685
+ throw Object.assign(new Error(`Answers file not found: ${file}`), { code: 'ANSWERS_NOT_FOUND' });
2686
+ }
2687
+ if (stat.isSymbolicLink() || !stat.isFile()) {
2688
+ throw Object.assign(new Error('Answers file must be a regular file'), { code: 'UNSAFE_ANSWERS_PATH' });
2689
+ }
2690
+ try {
2691
+ return JSON.parse(fs.readFileSync(absolute, 'utf8'));
2692
+ } catch (cause) {
2693
+ throw Object.assign(new Error(`Answers JSON is invalid: ${cause.message}`), { code: 'INVALID_ANSWERS' });
2694
+ }
2695
+ }
2696
+
2697
+ function workflowMode() {
2698
+ const explicit = argValue('--mode');
2699
+ if (explicit) return explicit;
2700
+ try {
2701
+ const current = getCurrentRun(CWD);
2702
+ if (current && !TERMINAL_STATES.has(current.state)) return current.mode;
2703
+ } catch {
2704
+ // No run is not a mode.
2705
+ }
2706
+ return null;
2707
+ }
2708
+
2709
+ function handleWorkflow() {
2710
+ const action = process.argv[3] || '';
2711
+ const json = process.argv.includes('--json');
2712
+ const personal = require('../lib/personal-workflow.js');
2713
+ try {
2714
+ if (action === 'interview') {
2715
+ const result = personal.interviewQuestions();
2716
+ console.log(json ? JSON.stringify({ ok: true, ...result }) : JSON.stringify({ ok: true, ...result }, null, 2));
2717
+ return;
2718
+ }
2719
+ if (action === 'propose') {
2720
+ const result = personal.proposeFromAnswers(readAnswersFile(argValue('--answers')), { rootDir: CWD });
2721
+ console.log(JSON.stringify({
2722
+ ok: true,
2723
+ id: result.proposal.id,
2724
+ status: result.proposal.status,
2725
+ valid: true,
2726
+ diff: result.diff
2727
+ }));
2728
+ return;
2729
+ }
2730
+ if (action === 'accept' || action === 'reject') {
2731
+ const proposalId = argValue('--proposal');
2732
+ if (!proposalId) throw Object.assign(new Error(`workflow ${action} requires --proposal <id>`), { code: 'PROPOSAL_REQUIRED' });
2733
+ const result = action === 'accept'
2734
+ ? personal.acceptProposal({ proposalId, by: argValue('--by'), mode: workflowMode() })
2735
+ : personal.rejectProposal({ proposalId, by: argValue('--by'), mode: workflowMode() });
2736
+ console.log(JSON.stringify({
2737
+ ok: true,
2738
+ id: result.proposal.id,
2739
+ status: result.proposal.status,
2740
+ ...(result.recipe ? { recipeId: result.recipe.id, version: result.recipe.version, replacedVersion: result.replacedVersion } : {})
2741
+ }));
2742
+ return;
2743
+ }
2744
+ if (action === 'suggest') {
2745
+ const result = personal.suggestProposals({ rootDir: CWD });
2746
+ console.log(JSON.stringify({
2747
+ ok: true,
2748
+ historyCount: result.historyCount,
2749
+ proposals: result.proposals.map((item) => ({
2750
+ id: item.id,
2751
+ kind: item.kind,
2752
+ status: item.status,
2753
+ evidence: item.evidence
2754
+ }))
2755
+ }));
2756
+ return;
2757
+ }
2758
+ throw Object.assign(new Error('Unknown workflow action. Use interview|propose|accept|reject|suggest'), { code: 'UNKNOWN_WORKFLOW_ACTION' });
2759
+ } catch (err) {
2760
+ workflowFail(err, json);
2761
+ }
2762
+ }
2763
+
2607
2764
  function handleRecipe() {
2608
2765
  const action = process.argv[3] || 'list';
2609
2766
  const id = process.argv[4];
@@ -2918,6 +3075,7 @@ function handleGoal() {
2918
3075
  actor: argValue('--by') || 'human',
2919
3076
  message: 'Goal Contract frozen'
2920
3077
  });
3078
+ ensureImpactMap(runId);
2921
3079
  } else {
2922
3080
  const error = new Error('goal must be show, draft, or freeze');
2923
3081
  error.code = 'INVALID_USAGE';
@@ -3125,6 +3283,7 @@ async function handleVerify() {
3125
3283
  return;
3126
3284
  }
3127
3285
  const run = executeGate('verification', runId);
3286
+ const drift = impactMap.loadImpactDrift(CWD, runId) || { mapStatus: 'MISSING', outOfMap: [] };
3128
3287
  const compact = compactRun(CWD, { runId });
3129
3288
  let claimed = { path: '.ai-engineering-loop/tasks/claimed-vs-reality.md', created: false };
3130
3289
  try {
@@ -3139,6 +3298,7 @@ async function handleVerify() {
3139
3298
  tier: run.tier ? run.tier.current : null,
3140
3299
  commands,
3141
3300
  testCounts: recorded.summary.testCounts,
3301
+ impactDrift: { mapStatus: drift.mapStatus, outOfMap: drift.outOfMap },
3142
3302
  compact: compact.paths,
3143
3303
  claimedVsReality: claimed,
3144
3304
  next: run.tier && run.tier.current === 'T0'
@@ -3150,6 +3310,11 @@ async function handleVerify() {
3150
3310
  log.success('✓ verification recorded and gated');
3151
3311
  for (const c of commands) console.log(`- ${c.command}: exit ${c.exitCode}`);
3152
3312
  console.log(`- State: ${run.state}`);
3313
+ if (drift.outOfMap.length) {
3314
+ console.log(`! ${drift.outOfMap.length} file(s) changed outside the ${drift.mapStatus} impact map (LOW finding at review): ${drift.outOfMap.join(', ')}`);
3315
+ } else if (drift.mapStatus === 'MISSING') {
3316
+ console.log('! No impact map for this Run; drift was not checked');
3317
+ }
3153
3318
  console.log(`- Claimed-vs-reality: ${claimed.path}${claimed.created ? ' (scaffolded; fill it from the command output)' : ''}`);
3154
3319
  console.log(`- Next: ${result.next}`);
3155
3320
  }
@@ -3158,6 +3323,137 @@ async function handleVerify() {
3158
3323
  }
3159
3324
  }
3160
3325
 
3326
+ function readGuardInput() {
3327
+ const source = argValue('--input') || (process.argv.includes('--hook') ? '-' : null);
3328
+ if (source == null) {
3329
+ const target = argValue('--path');
3330
+ const commandText = argValue('--command');
3331
+ if (target == null && commandText == null) {
3332
+ throw Object.assign(new Error('guard check needs --input -|<file>, --path <file>, or --command <text>'), { code: 'INVALID_USAGE' });
3333
+ }
3334
+ return target != null ? { path: target } : { command: commandText };
3335
+ }
3336
+ const text = source === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(CWD, source), 'utf8');
3337
+ try {
3338
+ return JSON.parse(text);
3339
+ } catch (cause) {
3340
+ throw Object.assign(new Error(`guard input is not JSON: ${cause.message}`), { code: 'INVALID_USAGE' });
3341
+ }
3342
+ }
3343
+
3344
+ function handleGuard() {
3345
+ const action = args[1] && !args[1].startsWith('--') ? args[1] : 'check';
3346
+ const json = process.argv.includes('--json');
3347
+ const hook = argValue('--hook');
3348
+ try {
3349
+ if (action !== 'check') throw Object.assign(new Error('guard supports: check'), { code: 'INVALID_USAGE' });
3350
+ if (hook != null && hook !== 'claude') throw Object.assign(new Error('--hook supports: claude'), { code: 'INVALID_USAGE' });
3351
+ const result = guard.checkGuard(CWD, { tool: argValue('--tool'), input: readGuardInput(), runId: argValue('--run') });
3352
+ if (hook === 'claude') {
3353
+ const output = guard.claudeHookOutput(result);
3354
+ if (output) console.log(JSON.stringify(output));
3355
+ return;
3356
+ }
3357
+ if (json) console.log(JSON.stringify({ ok: true, ...result }));
3358
+ else {
3359
+ const mark = { allow: '✓', warn: '!', block: '✗' }[result.decision];
3360
+ console.log(`${mark} ${result.decision} (${result.tool}, ${result.mode}${result.runId ? `, run ${result.runId}` : ', no active run'})`);
3361
+ for (const reason of result.reasons) console.log(`- ${reason}`);
3362
+ }
3363
+ if (result.decision === 'block') process.exitCode = 2;
3364
+ } catch (err) {
3365
+ if (hook) {
3366
+ console.error(`ai-engineering-loop guard: ${err.message}`);
3367
+ process.exitCode = 1;
3368
+ return;
3369
+ }
3370
+ stageJsonError(err, json, 'GUARD_FAILED');
3371
+ }
3372
+ }
3373
+
3374
+ function handleHooks() {
3375
+ const action = args[1] && !args[1].startsWith('--') ? args[1] : 'status';
3376
+ const json = process.argv.includes('--json');
3377
+ try {
3378
+ const options = { host: argValue('--host') || 'claude' };
3379
+ let result;
3380
+ if (action === 'install') result = guardHooks.installHooks(CWD, options);
3381
+ else if (action === 'uninstall') result = guardHooks.uninstallHooks(CWD, options);
3382
+ else if (action === 'status') result = guardHooks.hooksStatus(CWD, options);
3383
+ else throw Object.assign(new Error('hooks must be install, uninstall, or status'), { code: 'INVALID_USAGE' });
3384
+ if (json) console.log(JSON.stringify({ ok: true, action, ...result }));
3385
+ else {
3386
+ const verb = action === 'status' ? '' : (result.changed ? ' (updated)' : ' (already up to date)');
3387
+ log.success(`✓ ${result.host} guard hooks ${result.installed ? 'installed' : 'not installed'} in ${result.settings}${verb}`);
3388
+ if (result.installed) console.log('- Edit/Write outside the Run scope and destructive Bash commands: ASSISTED asks, UNATTENDED blocks.');
3389
+ }
3390
+ } catch (err) {
3391
+ stageJsonError(err, json, 'HOOKS_FAILED');
3392
+ }
3393
+ }
3394
+
3395
+ function handleImpact() {
3396
+ const action = args[1] && !args[1].startsWith('--') ? args[1] : 'show';
3397
+ const json = process.argv.includes('--json');
3398
+ try {
3399
+ const runId = requiredRunId('impact');
3400
+ let result;
3401
+ if (action === 'map') {
3402
+ const limit = argValue('--limit');
3403
+ result = impactMap.generateImpactMap(CWD, {
3404
+ runId,
3405
+ force: process.argv.includes('--force'),
3406
+ ...(limit == null ? {} : { limit: parsePositiveIntegerArg('--limit', limit) })
3407
+ });
3408
+ } else if (action === 'confirm') {
3409
+ result = impactMap.confirmImpactMap(CWD, {
3410
+ runId,
3411
+ by: argValue('--by'),
3412
+ allow: repeatedArg('--allow'),
3413
+ remove: repeatedArg('--remove')
3414
+ });
3415
+ } else if (action === 'skip') {
3416
+ result = impactMap.skipImpactMap(CWD, { runId, by: argValue('--by'), reason: argValue('--reason') });
3417
+ } else if (action === 'show') {
3418
+ const map = impactMap.loadImpactMap(CWD, runId);
3419
+ if (!map) throw Object.assign(new Error('No impact map yet. Run `impact map` first.'), { code: 'IMPACT_MAP_MISSING' });
3420
+ result = { map, path: `.ai-engineering-loop/runs/${runId}/${impactMap.IMPACT_MAP_FILE}` };
3421
+ } else if (action === 'drift') {
3422
+ const drift = impactMap.detectImpactDrift(CWD, { runId });
3423
+ result = { map: null, drift: drift.drift, path: drift.path };
3424
+ } else {
3425
+ throw Object.assign(new Error('impact must be map, show, confirm, skip, or drift'), { code: 'INVALID_USAGE' });
3426
+ }
3427
+ if (json) {
3428
+ console.log(JSON.stringify({ ok: true, runId, action, path: result.path, ...(result.map ? { map: result.map } : {}), ...(result.drift ? { drift: result.drift } : {}) }, null, 2));
3429
+ return;
3430
+ }
3431
+ if (result.drift) {
3432
+ log.success(`✓ impact drift checked (${result.drift.mapStatus})`);
3433
+ console.log(`- Changed: ${result.drift.changedFiles.length}, outside the map: ${result.drift.outOfMap.length}`);
3434
+ for (const file of result.drift.outOfMap) console.log(` ! ${file}`);
3435
+ return;
3436
+ }
3437
+ const { map } = result;
3438
+ log.success(`✓ impact map ${map.status} (${result.path})`);
3439
+ if (map.status === 'SKIPPED') {
3440
+ console.log(`- Skipped: ${map.skipReason}`);
3441
+ return;
3442
+ }
3443
+ for (const key of ['files', 'modules', 'endpoints', 'dbTables', 'tests']) {
3444
+ console.log(`- ${key}: ${map[key].length}`);
3445
+ for (const entry of map[key].slice(0, 10)) {
3446
+ const label = entry.route ? `${entry.method} ${entry.route} (${entry.path})` : (entry.path && key !== 'dbTables' ? entry.path : entry.name);
3447
+ console.log(` ${label} [${entry.confidence}] ${entry.reason}`);
3448
+ }
3449
+ }
3450
+ if (map.status === 'CONFIRMED') console.log(`- Allowed scope: ${map.scope.allowedPaths.length} path(s), confirmed by ${map.confirmedBy}`);
3451
+ else console.log('- Next: confirm with `impact confirm --by <name> [--allow <glob>]... [--remove <path>]...` or skip a trivial goal with `impact skip --by <name> --reason <text>`');
3452
+ } catch (err) {
3453
+ stageJsonError(err, json, 'IMPACT_FAILED');
3454
+ }
3455
+ }
3456
+
3161
3457
  function handleReviewPack() {
3162
3458
  const json = process.argv.includes('--json');
3163
3459
  try {
@@ -3183,6 +3479,7 @@ function handleReviewPack() {
3183
3479
  estimatedTokens: pack.estimatedTokens,
3184
3480
  truncated: pack.truncated,
3185
3481
  unresolvedFindings: pack.unresolvedFindings,
3482
+ impactDrift: pack.impactDrift,
3186
3483
  fastPath: { eligible: fastPath.eligible, reasons: fastPath.reasons },
3187
3484
  escalation: { requiredTier: escalation.requiredTier, reasons: escalation.reasons.map((r) => r.code) }
3188
3485
  };
@@ -3192,6 +3489,9 @@ function handleReviewPack() {
3192
3489
  console.log(`- Pack: ${result.packPath} (${result.reviewProfile}, ~${result.estimatedTokens} tokens)`);
3193
3490
  console.log(`- Tier: ${tier || 'none'}; Devil's Advocate ${result.devilAdvocateRequired ? 'required' : 'not used (T0)'}`);
3194
3491
  console.log(`- Judge tier floor: ${result.escalation.requiredTier}${result.escalation.reasons.length ? ` (${result.escalation.reasons.join(', ')})` : ''}`);
3492
+ if (result.impactDrift?.outOfMap.length) {
3493
+ console.log(`- Outside the impact map: ${result.impactDrift.outOfMap.join(', ')} (check their side effects)`);
3494
+ }
3195
3495
  }
3196
3496
  } catch (err) {
3197
3497
  stageJsonError(err, json, 'REVIEW_PACK_FAILED');
@@ -3248,28 +3548,160 @@ function handleDeliver() {
3248
3548
  if (!delivery && !(destination && summary)) {
3249
3549
  throw Object.assign(new Error('Pass --destination <where> and --summary <text>, or write delivery.json first.'), { code: 'INVALID_USAGE' });
3250
3550
  }
3551
+ // Proof-carrying receipt (#70): the final deliver step, after approval.
3552
+ // Missing gate artifacts leave no receipt; the delivery gate then reports them.
3553
+ let receipt = null;
3554
+ try {
3555
+ receipt = receipts.writeReceipt(CWD, {
3556
+ runId,
3557
+ host: argValue('--host'),
3558
+ model: argValue('--model'),
3559
+ head: argValue('--head'),
3560
+ evidenceLinks: repeatedArg('--evidence'),
3561
+ aelVersion: VERSION
3562
+ });
3563
+ } catch (err) {
3564
+ if (err.code !== 'RECEIPT_INPUT_MISSING') throw err;
3565
+ }
3251
3566
  delivery = {
3252
3567
  ...(delivery || {}),
3253
3568
  schemaVersion: 1,
3254
3569
  runId,
3255
3570
  ...(destination ? { destination } : {}),
3256
3571
  ...(summary ? { summary } : {}),
3257
- ...(approve ? { humanApproved: true, approvedBy: by } : {})
3572
+ ...(approve ? { humanApproved: true, approvedBy: by } : {}),
3573
+ ...(receipt ? { receipt: { path: receipt.path, digest: receipt.receipt.digest } } : {})
3258
3574
  };
3259
3575
  fs.writeFileSync(deliveryPath, `${JSON.stringify(delivery, null, 2)}\n`, { mode: 0o600 });
3260
3576
  const next = executeGate('delivery', runId);
3261
- const result = { ok: true, runId, state: next.state, approvedNodes: approved, humanApproved: delivery.humanApproved === true };
3577
+ const result = {
3578
+ ok: true,
3579
+ runId,
3580
+ state: next.state,
3581
+ approvedNodes: approved,
3582
+ humanApproved: delivery.humanApproved === true,
3583
+ receipt: receipt && { path: receipt.path, markdown: receipt.markdownPath, digest: receipt.receipt.digest, missingEvidence: receipt.missing }
3584
+ };
3262
3585
  if (json) console.log(JSON.stringify(result));
3263
3586
  else {
3264
3587
  log.success('✓ delivery gate passed');
3265
3588
  console.log(`- State: ${next.state}`);
3266
3589
  if (approved.length) console.log(`- Approved: ${approved.join(', ')} by ${by}`);
3590
+ if (receipt) console.log(`- Receipt: ${receipt.path} (digest ${receipt.receipt.digest.slice(0, 12)}); paste ${receipt.markdownPath} into the PR/MR body`);
3591
+ if (receipt?.missing.length) console.log(`! Missing AC evidence (❌ in the receipt): ${receipt.missing.join(', ')}`);
3267
3592
  }
3268
3593
  } catch (err) {
3269
3594
  stageJsonError(err, json, 'DELIVER_FAILED');
3270
3595
  }
3271
3596
  }
3272
3597
 
3598
+ function handleVerifyReceipt() {
3599
+ const json = process.argv.includes('--json');
3600
+ try {
3601
+ const positional = args.slice(1).find((arg, index, list) => !arg.startsWith('--') && !['--run', '--head'].includes(list[index - 1]));
3602
+ const result = receipts.verifyReceipt(CWD, {
3603
+ runId: argValue('--run'),
3604
+ receiptPath: positional,
3605
+ head: argValue('--head')
3606
+ });
3607
+ if (json) console.log(JSON.stringify(result));
3608
+ else if (result.ok) {
3609
+ log.success(`✓ receipt verified (${result.path}, digest ${result.digest.slice(0, 12)})`);
3610
+ } else {
3611
+ log.error(`Receipt check failed (${result.path})`);
3612
+ for (const problem of result.problems) console.error(`- ${problem.code}: ${problem.detail}`);
3613
+ }
3614
+ if (!result.ok) process.exitCode = 1;
3615
+ } catch (err) {
3616
+ stageJsonError(err, json, 'VERIFY_RECEIPT_FAILED');
3617
+ }
3618
+ }
3619
+
3620
+ function handleBench() {
3621
+ const json = process.argv.includes('--json');
3622
+ const rest = process.argv.slice(3);
3623
+ try {
3624
+ if (rest[0] === 'compare') {
3625
+ const ids = [];
3626
+ for (let index = 1; index < rest.length; index += 1) {
3627
+ const arg = rest[index];
3628
+ if (arg === '--json') continue;
3629
+ if (arg.startsWith('--')) {
3630
+ throw Object.assign(new Error(`Unknown argument for bench compare: ${arg}`), { code: 'BENCH_USAGE' });
3631
+ }
3632
+ ids.push(arg);
3633
+ }
3634
+ if (ids.length !== 2) {
3635
+ throw Object.assign(new Error('bench compare needs exactly two bench ids'), { code: 'BENCH_USAGE' });
3636
+ }
3637
+ const comparison = compareBenches(CWD, ids[0], ids[1]);
3638
+ if (json) console.log(JSON.stringify(comparison));
3639
+ else process.stdout.write(formatCompare(comparison));
3640
+ return;
3641
+ }
3642
+ const modeArg = argValue('--mode');
3643
+ const repeatArg = argValue('--repeat');
3644
+ const timeoutArg = argValue('--timeout');
3645
+ const result = runBench({
3646
+ rootDir: CWD,
3647
+ home: homeDir(),
3648
+ realHome: os.homedir(),
3649
+ host: argValue('--host'),
3650
+ model: argValue('--model'),
3651
+ bin: argValue('--bin'),
3652
+ sandboxHome: process.argv.includes('--sandbox-home'),
3653
+ hostArgs: repeatedArg('--host-arg'),
3654
+ scenarioIds: repeatedArg('--scenario'),
3655
+ repeat: repeatArg == null ? 1 : parsePositiveIntegerArg('--repeat', repeatArg),
3656
+ timeoutMs: timeoutArg == null ? undefined : parseBenchTimeoutSeconds(timeoutArg),
3657
+ mode: modeArg == null ? 'ASSISTED' : normalizeMode(modeArg),
3658
+ args: rest,
3659
+ env: process.env,
3660
+ aelVersion: VERSION
3661
+ });
3662
+ const relativeDir = path.relative(CWD, result.directory).split(path.sep).join('/');
3663
+ if (json) {
3664
+ const { directory: _directory, ...body } = result;
3665
+ console.log(JSON.stringify({ ...body, directory: relativeDir }));
3666
+ return;
3667
+ }
3668
+ const rate = result.summary.complianceRate;
3669
+ log.success(`✓ bench ${result.benchId} (${result.target.host}/${result.target.model})`);
3670
+ console.log(`- Status: ${result.status}`);
3671
+ console.log(`- Compliance: ${rate == null ? 'unknown' : `${Math.round(rate * 1000) / 10}%`}`);
3672
+ console.log(`- Report: ${relativeDir}/report.md`);
3673
+ if (result.instructionViolations.length) {
3674
+ console.log(`- Top violation: ${result.instructionViolations[0].type} (×${result.instructionViolations[0].count})`);
3675
+ }
3676
+ } catch (err) {
3677
+ stageJsonError(err, json, 'BENCH_FAILED');
3678
+ }
3679
+ }
3680
+
3681
+ function handleLearn() {
3682
+ const json = process.argv.includes('--json');
3683
+ try {
3684
+ const maxAge = argValue('--max-age-runs');
3685
+ const result = learn(CWD, {
3686
+ dryRun: process.argv.includes('--dry-run'),
3687
+ prune: process.argv.includes('--prune'),
3688
+ ...(maxAge == null ? {} : { maxAgeRuns: parsePositiveIntegerArg('--max-age-runs', maxAge) })
3689
+ });
3690
+ const { document } = result;
3691
+ if (json) {
3692
+ console.log(JSON.stringify({ ok: true, written: result.written, path: result.path, pruned: result.pruned, learnings: document }));
3693
+ return;
3694
+ }
3695
+ log.success(`✓ ${document.entries.length} learning(s) from ${document.sourceRuns} Run(s)${result.written ? ` → ${result.path}` : ' (dry run, nothing written)'}`);
3696
+ for (const entry of document.entries.slice(0, 10)) {
3697
+ console.log(`- ${entry.id} [${entry.axis}, ${entry.severity}, ×${entry.occurrences}] ${entry.lesson}`);
3698
+ }
3699
+ for (const item of result.pruned) console.log(` pruned ${item.id} (${item.reason})`);
3700
+ } catch (err) {
3701
+ stageJsonError(err, json, 'LEARN_FAILED');
3702
+ }
3703
+ }
3704
+
3273
3705
  // Command: docs (read-only packaged specs)
3274
3706
  function handleDocs() {
3275
3707
  const json = process.argv.includes('--json');
@@ -3305,14 +3737,14 @@ Usage:
3305
3737
  Commands:
3306
3738
  init Bootstrap .ai-engineering-loop/ context from repository discovery
3307
3739
  status Check the validity, readiness, and baseline freshness of context
3308
- --json print context and host-skill freshness as JSON (no writes)
3740
+ --json print context, host-skill freshness, and studioUrl (tokenless Studio identity; browser session comes from ael studio)
3309
3741
  refresh Reconcile drifted context against repository non-destructively
3310
3742
  run [task] Start or resume a stateful engineering run and instruct the agent (never writes to home)
3311
3743
  --new start a new run even when another run is active
3312
3744
  --mode report-only|assisted|unattended
3313
3745
  --recipe <id> bind an immutable compiled workflow plan
3314
3746
  --tier T0|T1|T2 --tier-reason <text> override the automatic tier (recorded)
3315
- --json print runId, tier, tier reasons, and subagent count only
3747
+ --json print runId, tier, tier reasons, subagent count, recipe, workflowSource, and studioUrl (tokenless; browser session comes from ael studio)
3316
3748
  --abandon [--run <id>] --reason <text> --by <name> [--yes] [--json]
3317
3749
  close a stale run as CANCELLED (kept on disk) and release current.json;
3318
3750
  ASSISTED asks to confirm, UNATTENDED needs --yes from a human
@@ -3384,21 +3816,56 @@ Commands:
3384
3816
  --limit <n> bound query/related result count
3385
3817
  --include-ignored include CSS, generated, lockfile, and .aelcontextignore paths
3386
3818
  --json print only pack metadata; never print packed content
3387
- eval Validate the 24-case production evaluation catalog
3819
+ eval Validate the 25-case production evaluation catalog
3388
3820
  --results <dir> score host-generated JSON results
3389
3821
  --cases <dir> use another compatible fixture catalog
3390
3822
  --json print machine-readable metrics
3823
+ bench Compliance self-check for one chosen host and model
3824
+ [--host <id> --model <id>] [--scenario <id>]... [--repeat <n>]
3825
+ [--bin <path>] [--host-arg <arg>]... [--sandbox-home]
3826
+ [--mode assisted|unattended|report-only] [--timeout <seconds>] [--json]
3827
+ One target per invocation. Default mode is ASSISTED; the scenario file's
3828
+ scripted approver answers Goal freeze, impact confirm, and deliver --approve.
3829
+ --mode unattended is opt-in. Default timeout is 20 minutes.
3830
+ The host keeps the real HOME so it can authenticate. AEL_HOME is a temp dir.
3831
+ --bin and --sandbox-home give the host a temp HOME (tests use this).
3832
+ A missing binary is UNAVAILABLE, not a model failure.
3833
+ Progress lines go to stderr. Writes .ai-engineering-loop/bench/<benchId>/{results.json,report.md,hardening.md}
3834
+ bench compare <benchIdA> <benchIdB> [--json] read-only side-by-side table
3391
3835
  escalation Compute the minimum Judge model tier from deterministic risk signals
3392
3836
  --run <id> target a non-current run
3393
3837
  --json print machine-readable reasons
3394
3838
  verify Record verification commands, gate them, compact, and scaffold claimed-vs-reality
3395
3839
  [--run <id>] [--cmd "<command>"]... [--shell] [--serial] [--timeout-ms <n>] [--json]
3396
3840
  default command: test_unit from .ai-engineering-loop/verification.md; commands run in parallel
3841
+ impact Blast-radius map of the frozen Goal before Stage 3 (written to the Run on Goal freeze)
3842
+ map [--run <id>] [--limit <n>] [--force] [--json] files, modules, endpoints, DB tables, tests
3843
+ show [--run <id>] [--json]
3844
+ confirm --by <name> [--allow <glob>]... [--remove <path>]... [--run <id>] [--json]
3845
+ confirmed paths become the Run's allowed scope; verify reports changes outside it
3846
+ skip --by <name> --reason <text> [--run <id>] trivial goals (copy, CSS, comments)
3847
+ drift [--run <id>] [--json] compare the gated Maker diff with the map
3848
+ guard Runtime guardrail for one tool call: allow | warn | block (warn/block recorded in the Run)
3849
+ check --tool edit|bash (--input -|<file> | --path <file> | --command <text>) [--run <id>] [--json]
3850
+ check --hook claude read a Claude Code PreToolUse payload on stdin and answer deny/ask
3851
+ edit: outside Goal scope.allowedPaths + confirmed impact map, or in scope.deniedPaths
3852
+ bash: rm -rf, DROP TABLE/TRUNCATE, git push --force, git reset --hard, git clean -fd
3853
+ ASSISTED warns (the host asks), UNATTENDED and REPORT_ONLY block (exit 2)
3854
+ hooks Install native pre-tool hooks that call guard check (enforced hosts: Claude Code)
3855
+ install | uninstall | status [--host claude] [--json] writes .claude/settings.json
3397
3856
  review-pack Build the Devil's Advocate pack: fast-path, diff hunks, escalation floor, tier
3398
3857
  [--run <id>] [--base <git-ref>] [--profile lean|standard|thorough] [--json]
3399
3858
  deliver Approve READY approval nodes, write delivery.json, and pass the delivery gate
3400
3859
  [--run <id>] [--destination <where> --summary <text>] [--approve --by <name>] [--json]
3401
3860
  ASSISTED requires --approve --by <name>, given only after explicit human approval
3861
+ [--host <id>] [--model <id>] [--head <sha>] [--evidence AC-N=<https-url>]...
3862
+ writes RUN_DIR/receipt.json + receipt.md (paste into the PR/MR body); digest stored in delivery.json
3863
+ verify-receipt Re-check a delivery receipt: artifact hashes, frozen Goal, AC evidence, verdict, head SHA
3864
+ [--run <id> | <repository-relative-receipt.json>] [--head <sha>] [--json] exit 1 on mismatch (CI)
3865
+ learn Mine past Runs' VALID findings into .ai-engineering-loop/learnings.json (+ .md) for context packs
3866
+ [--dry-run] [--prune] [--max-age-runs <n>] [--json]
3867
+ deterministic and deduped with runId provenance; --prune drops lessons whose files are gone
3868
+ or not seen in the last <n> Runs (default 20); maker / devil-advocate packs get the top entries
3402
3869
  docs Print a packaged spec without needing the package source tree
3403
3870
  list [--json]
3404
3871
  <name> [--section <heading>] [--json] e.g. docs grill-policy --section "When to grill"
@@ -3415,6 +3882,13 @@ Commands:
3415
3882
  projects Registry of local projects with .ai-engineering-loop/ (~/.ai-engineering-loop/projects.json)
3416
3883
  list|add [dir]|remove [dir] [--json]
3417
3884
  scan --root <dir> [--depth 4]
3885
+ workflow Build or adapt the per-user personal recipe (writes only under the AEL home)
3886
+ interview [--json]
3887
+ propose --answers <file> [--json]
3888
+ accept --proposal <id> --by <name> [--json]
3889
+ reject --proposal <id> --by <name> [--json]
3890
+ suggest [--json]
3891
+ UNATTENDED cannot accept or reject (HUMAN_REQUIRED)
3418
3892
  recipe Inspect and compile declarative workflow recipes (does not execute nodes)
3419
3893
  list [--json]
3420
3894
  catalog [--json]
@@ -3426,7 +3900,7 @@ Commands:
3426
3900
  show <id> [--json]
3427
3901
  validate <id> [--mode <mode>] [--json]
3428
3902
  explain | graph | simulate <id> [--mode <mode>] [--json]
3429
- studio Open the localhost-only visual workflow editor
3903
+ studio Open the localhost-only live-run Studio
3430
3904
  [--port <0-65535>] [--no-open]
3431
3905
  handoff Export or verify a redacted, integrity-bound knowledge transfer
3432
3906
  create [--run <id>] [--audience developer|agent|auditor]
@@ -3494,7 +3968,7 @@ if (['init', 'run', 'status', 'refresh'].includes(command)) {
3494
3968
  maybeAutoUpdate();
3495
3969
  }
3496
3970
 
3497
- if (!['setup', 'hosts', 'sync-hosts', '-h', '--help', '-v', '--version'].includes(command)) maybeSetupHint();
3971
+ if (!['setup', 'hosts', 'sync-hosts', 'guard', 'bench', '-h', '--help', '-v', '--version'].includes(command)) maybeSetupHint();
3498
3972
  if (command === 'status') maybeNewHostsNotice();
3499
3973
 
3500
3974
  switch (command) {
@@ -3555,6 +4029,9 @@ switch (command) {
3555
4029
  case 'eval':
3556
4030
  handleEval();
3557
4031
  break;
4032
+ case 'bench':
4033
+ handleBench();
4034
+ break;
3558
4035
  case 'escalation':
3559
4036
  handleEscalation();
3560
4037
  break;
@@ -3564,9 +4041,24 @@ switch (command) {
3564
4041
  case 'verify':
3565
4042
  handleVerify();
3566
4043
  break;
4044
+ case 'guard':
4045
+ handleGuard();
4046
+ break;
4047
+ case 'hooks':
4048
+ handleHooks();
4049
+ break;
4050
+ case 'impact':
4051
+ handleImpact();
4052
+ break;
3567
4053
  case 'review-pack':
3568
4054
  handleReviewPack();
3569
4055
  break;
4056
+ case 'learn':
4057
+ handleLearn();
4058
+ break;
4059
+ case 'verify-receipt':
4060
+ handleVerifyReceipt();
4061
+ break;
3570
4062
  case 'deliver':
3571
4063
  handleDeliver();
3572
4064
  break;
@@ -3579,6 +4071,9 @@ switch (command) {
3579
4071
  case 'migrate':
3580
4072
  handleMigrate();
3581
4073
  break;
4074
+ case 'workflow':
4075
+ handleWorkflow();
4076
+ break;
3582
4077
  case 'recipe':
3583
4078
  handleRecipe();
3584
4079
  break;