@omniralph/agent 2.3.0 → 2.3.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/dist/cli.js CHANGED
@@ -381,6 +381,10 @@ var MAX_UNMERGED_BRANCH_TIMEOUT_MINUTES = 7 * 24 * 60;
381
381
  var PUSH_TIMINGS = ["per-story", "end"];
382
382
  var DRAFT_PULL_REQUEST_TIMINGS = ["early", "end"];
383
383
  var DEFAULT_PR_DESCRIPTION_TASK_ID = "builtin:describe-pr";
384
+ var DEFAULT_VERIFIER_TASK_ID = "builtin:verify-task";
385
+ var DEFAULT_AUDIT_TASK_ID = "builtin:audit-epic";
386
+ var DEFAULT_MAX_AUDIT_ROUNDS = 2;
387
+ var MAX_AUDIT_ROUNDS = 10;
384
388
  var FixRounds = z6.int().min(0).max(CODING_MAX_FIX_ROUNDS);
385
389
  var CodingCommand = z6.string().trim().min(1, "Enter a command.").max(
386
390
  MAX_CODING_COMMAND_LENGTH,
@@ -402,6 +406,23 @@ var CODING_FIELDS = {
402
406
  draftPullRequest: z6.enum(DRAFT_PULL_REQUEST_TIMINGS).optional(),
403
407
  /** Query task (accepting `run.invoked`) that writes the PR title and description. */
404
408
  prDescriptionTaskId: DefinitionId.optional(),
409
+ /**
410
+ * Query task (accepting `run.invoked`) that checks a story attempt its session reported
411
+ * complete against the story's acceptance criteria before the story counts as done. A
412
+ * story playbook's run spec always names one (`DEFAULT_VERIFIER_TASK_ID` by default).
413
+ */
414
+ verifierTaskId: DefinitionId.optional(),
415
+ /**
416
+ * Query task (accepting `run.invoked`) that audits a finished epic against its
417
+ * requirements before its PR opens; each gap becomes a task in the epic. A story
418
+ * playbook's run spec always names one (`DEFAULT_AUDIT_TASK_ID` by default).
419
+ */
420
+ auditTaskId: DefinitionId.optional(),
421
+ /**
422
+ * Audit rounds an epic gets: after this many rounds with gaps left, its PR opens
423
+ * anyway, listing them. Story playbooks only (`DEFAULT_MAX_AUDIT_ROUNDS` by default).
424
+ */
425
+ maxAuditRounds: z6.int().min(1).max(MAX_AUDIT_ROUNDS).optional(),
405
426
  /** Run once in a fresh branch worktree (e.g. `pnpm install`); null for none. */
406
427
  worktreeSetupCommand: CodingCommand.nullable().optional(),
407
428
  /** Also run the PRD's `## Quality Gates` commands. */
@@ -531,6 +552,7 @@ var FINDING_TRIGGERS = [
531
552
  ];
532
553
  var CODING_TRIGGERS = [...STORY_TRIGGERS, ...REQUEST_TRIGGERS];
533
554
  var CODING_RUN_TRIGGERS = [...CODING_TRIGGERS, "run.invoked"];
555
+ var STORY_RUN_TRIGGERS = [...STORY_TRIGGERS, "run.invoked"];
534
556
  var TRACKER_TRIGGERS = [
535
557
  "tracker.delegated",
536
558
  "tracker.triage",
@@ -878,9 +900,41 @@ var VARIABLES = [
878
900
  "First 10 characters of the story's commit (null without one)."
879
901
  ],
880
902
  ["story.id", STORY_TRIGGERS, "ID of the story the run works on (its tracker identifier)."],
881
- ["story.identifier", STORY_TRIGGERS, "Tracker identifier of the story (null without one)."],
903
+ [
904
+ "story.identifier",
905
+ STORY_RUN_TRIGGERS,
906
+ "Tracker identifier of the story (null without one)."
907
+ ],
882
908
  ["story.url", STORY_TRIGGERS, "URL of the story in the tracker (null without one)."],
883
- ["story.title", STORY_TRIGGERS, "Title of the story, on one line."],
909
+ ["story.title", STORY_RUN_TRIGGERS, "Title of the story, on one line."],
910
+ [
911
+ "commit",
912
+ ["run.invoked"],
913
+ "Full SHA checked out: the story attempt a task verifier checks (null when it committed nothing), or the head an epic audit checks (null: the branch as checked out)."
914
+ ],
915
+ [
916
+ "requirements.items.id",
917
+ ["run.invoked"],
918
+ "Identifier of an epic requirement an audit checks (e.g. `FR-2`)."
919
+ ],
920
+ [
921
+ "tasks.items.identifier",
922
+ ["run.invoked"],
923
+ "Tracker identifier of a done task of the epic an audit checks."
924
+ ],
925
+ ["tasks.items.title", ["run.invoked"], "Title of the task, on one line."],
926
+ [
927
+ "tasks.items.repository",
928
+ ["run.invoked"],
929
+ "Repo the task was worked in, when it isn't the audited one (else null)."
930
+ ],
931
+ ["audit.round", ["run.invoked"], "This epic audit round (1 on the first)."],
932
+ ["audit.maxRounds", ["run.invoked"], "Most audit rounds the epic gets (`maxAuditRounds`)."],
933
+ [
934
+ "audit.last",
935
+ ["run.invoked"],
936
+ "True on the last audit round: its gaps are listed in the PR description rather than filed."
937
+ ],
884
938
  [
885
939
  "story.kind",
886
940
  STORY_TRIGGERS,
@@ -942,7 +996,7 @@ var VARIABLES = [
942
996
  source: "trigger",
943
997
  trust: "untrusted",
944
998
  fence: "markdown",
945
- triggers: STORY_TRIGGERS,
999
+ triggers: STORY_RUN_TRIGGERS,
946
1000
  description: "Description of the story, without its acceptance criteria, `Covers:` line or a Fix's behavior sections (null when blank)."
947
1001
  },
948
1002
  ...[
@@ -968,9 +1022,23 @@ var VARIABLES = [
968
1022
  name: "story.acceptanceCriteria.items",
969
1023
  source: "trigger",
970
1024
  trust: "untrusted",
971
- triggers: STORY_TRIGGERS,
1025
+ triggers: STORY_RUN_TRIGGERS,
972
1026
  description: "An acceptance criterion of the story (`story.acceptanceCriteria` is null without any)."
973
1027
  },
1028
+ {
1029
+ name: "requirements.items.text",
1030
+ source: "trigger",
1031
+ trust: "untrusted",
1032
+ triggers: ["run.invoked"],
1033
+ description: "Text of the epic requirement (its `## Requirements` or `## Functional Requirements` line)."
1034
+ },
1035
+ {
1036
+ name: "tasks.items.acceptanceCriteria.items",
1037
+ source: "trigger",
1038
+ trust: "untrusted",
1039
+ triggers: ["run.invoked"],
1040
+ description: "An acceptance criterion of the task (`tasks.items.acceptanceCriteria` is null without any)."
1041
+ },
974
1042
  {
975
1043
  name: "story.notes",
976
1044
  source: "trigger",
@@ -1492,50 +1560,91 @@ function deriveAgentRequirements(task, agent) {
1492
1560
  // ../../packages/tasks/src/playbooks.ts
1493
1561
  var REVIEW_TRIGGERS = ["pr.updated", "pr.mention", "review.rerun"];
1494
1562
  var PLAYBOOK_ROLES = {
1495
- review: { taskType: "review", triggers: REVIEW_TRIGGERS, sink: "review", builtinOnly: false },
1563
+ review: {
1564
+ taskType: "review",
1565
+ triggers: REVIEW_TRIGGERS,
1566
+ sink: "review",
1567
+ builtinOnly: false,
1568
+ loop: "looped"
1569
+ },
1496
1570
  "review-summary": {
1497
1571
  taskType: "review",
1498
1572
  triggers: REVIEW_TRIGGERS,
1499
1573
  sink: "sticky-comment",
1500
- builtinOnly: false
1574
+ builtinOnly: false,
1575
+ loop: "none"
1501
1576
  },
1502
1577
  correlation: {
1503
1578
  taskType: "query",
1504
1579
  triggers: ["run.invoked"],
1505
1580
  sink: "run-result",
1506
- builtinOnly: false
1581
+ builtinOnly: false,
1582
+ loop: "none"
1583
+ },
1584
+ story: {
1585
+ taskType: "coding",
1586
+ triggers: STORY_TRIGGERS,
1587
+ sink: "ralph-run",
1588
+ builtinOnly: false,
1589
+ loop: "looped"
1507
1590
  },
1508
- story: { taskType: "coding", triggers: STORY_TRIGGERS, sink: "ralph-run", builtinOnly: false },
1509
1591
  request: {
1510
1592
  taskType: "coding",
1511
1593
  triggers: REQUEST_TRIGGERS,
1512
1594
  sink: "ralph-run",
1513
- builtinOnly: false
1595
+ builtinOnly: false,
1596
+ loop: "none"
1514
1597
  },
1515
1598
  "pr-description": {
1516
1599
  taskType: "query",
1517
1600
  triggers: ["run.invoked"],
1518
1601
  sink: "run-result",
1519
- builtinOnly: false
1602
+ builtinOnly: false,
1603
+ loop: "none"
1520
1604
  },
1521
1605
  "chat-ask": {
1522
1606
  taskType: "query",
1523
1607
  triggers: ["chat.request"],
1524
1608
  sink: "chat-thread",
1525
- builtinOnly: false
1609
+ builtinOnly: false,
1610
+ loop: "none"
1611
+ },
1612
+ triage: {
1613
+ taskType: "query",
1614
+ triggers: ["tracker.triage"],
1615
+ sink: "triage",
1616
+ builtinOnly: true,
1617
+ loop: "looped"
1526
1618
  },
1527
- triage: { taskType: "query", triggers: ["tracker.triage"], sink: "triage", builtinOnly: true },
1528
1619
  "learn-rule": {
1529
1620
  taskType: "query",
1530
1621
  triggers: ["finding.dismissed"],
1531
1622
  sink: "learned-rule",
1532
- builtinOnly: true
1623
+ builtinOnly: true,
1624
+ loop: "none"
1533
1625
  },
1534
1626
  "reply-to-finding": {
1535
1627
  taskType: "query",
1536
1628
  triggers: ["finding.mention"],
1537
1629
  sink: "finding-thread",
1538
- builtinOnly: true
1630
+ builtinOnly: true,
1631
+ loop: "none"
1632
+ },
1633
+ /** Checks a worker's output (a task against its acceptance criteria): a loop's helper. */
1634
+ verifier: {
1635
+ taskType: "query",
1636
+ triggers: ["run.invoked"],
1637
+ sink: "run-result",
1638
+ builtinOnly: true,
1639
+ loop: "none"
1640
+ },
1641
+ /** Checks a finished epic against its requirements before its PR opens: a loop's helper. */
1642
+ audit: {
1643
+ taskType: "query",
1644
+ triggers: ["run.invoked"],
1645
+ sink: "run-result",
1646
+ builtinOnly: true,
1647
+ loop: "none"
1539
1648
  }
1540
1649
  };
1541
1650
  var PLAYBOOK_ROLE_IDS = Object.keys(PLAYBOOK_ROLES);
@@ -1543,6 +1652,15 @@ var PlaybookRoleSchema = z8.enum(PLAYBOOK_ROLE_IDS);
1543
1652
  var CUSTOM_PLAYBOOK_ROLES = PLAYBOOK_ROLE_IDS.filter(
1544
1653
  (role) => !PLAYBOOK_ROLES[role].builtinOnly
1545
1654
  );
1655
+ function roleLoops(role) {
1656
+ return PLAYBOOK_ROLES[role].loop === "looped";
1657
+ }
1658
+ function roleHasLoopSettings(role) {
1659
+ return roleLoops(role) && roleTaskType(role) !== "coding";
1660
+ }
1661
+ function roleTaskType(role) {
1662
+ return PLAYBOOK_ROLES[role].taskType;
1663
+ }
1546
1664
  var PlaybookTools = AgentTools.extend({
1547
1665
  mcpServers: z8.array(
1548
1666
  z8.string().min(1).max(300).refine(
@@ -1554,12 +1672,34 @@ var PlaybookTools = AgentTools.extend({
1554
1672
  var {
1555
1673
  draftPullRequest: _draftPullRequest,
1556
1674
  prDescriptionTaskId: _prDescriptionTaskId,
1675
+ verifierTaskId: _verifierTaskId,
1676
+ auditTaskId: _auditTaskId,
1557
1677
  ...KEPT_CODING_FIELDS
1558
1678
  } = CODING_FIELDS;
1559
1679
  var PlaybookCoding = z8.object({
1560
1680
  ...KEPT_CODING_FIELDS,
1561
1681
  /** The `pr-description` playbook that writes the PR title and description. */
1562
- prDescriptionPlaybookId: DefinitionId.optional()
1682
+ prDescriptionPlaybookId: DefinitionId.optional(),
1683
+ /**
1684
+ * Story playbooks only: the `verifier` playbook that checks each task its session
1685
+ * reports complete against the task's acceptance criteria (`builtin:verify-task` when unset).
1686
+ */
1687
+ verifierPlaybookId: DefinitionId.optional(),
1688
+ /**
1689
+ * Story playbooks only: the `audit` playbook that checks a finished epic against its
1690
+ * requirements before its PR opens (`builtin:audit-epic` when unset).
1691
+ */
1692
+ auditPlaybookId: DefinitionId.optional()
1693
+ });
1694
+ var MAX_LOOP_ITERATIONS = 50;
1695
+ var MAX_LOOP_STALL_ROUNDS = 20;
1696
+ var PlaybookLoop = z8.object({
1697
+ /** The `verifier` playbook that checks each iteration's work; none runs one session. */
1698
+ verifierPlaybookId: DefinitionId.optional(),
1699
+ /** Most worker-then-verifier iterations a run gets. */
1700
+ maxIterations: z8.int().min(1).max(MAX_LOOP_ITERATIONS).optional(),
1701
+ /** Iterations in a row the reported metric may fail to beat its best. */
1702
+ stallRounds: z8.int().min(1).max(MAX_LOOP_STALL_ROUNDS).optional()
1563
1703
  });
1564
1704
  var Model2 = z8.string().min(1).max(200);
1565
1705
  var PlaybookFields = z8.object({
@@ -1590,6 +1730,8 @@ var PlaybookFields = z8.object({
1590
1730
  tokenBudget: TokenBudget.default(null),
1591
1731
  /** Story and request playbooks only. */
1592
1732
  coding: PlaybookCoding.optional(),
1733
+ /** Looped non-coding roles only (`roleHasLoopSettings`); unset limits get `LOOP_DEFAULTS`. */
1734
+ loop: PlaybookLoop.optional(),
1593
1735
  /**
1594
1736
  * Most characters of a variable's value rendered into the prompt, by
1595
1737
  * catalog name (e.g. `{ hunk: 5000 }`); longer values are cut and marked.
@@ -1658,6 +1800,29 @@ var Playbook = z8.preprocess(
1658
1800
  message: "Only story and request playbooks have coding settings."
1659
1801
  });
1660
1802
  }
1803
+ if (playbook.coding?.verifierPlaybookId !== void 0 && playbook.role !== "story") {
1804
+ ctx.addIssue({
1805
+ code: "custom",
1806
+ path: ["coding", "verifierPlaybookId"],
1807
+ message: `Only story playbooks verify their tasks; remove verifierPlaybookId from a ${playbook.role} playbook.`
1808
+ });
1809
+ }
1810
+ for (const field2 of ["auditPlaybookId", "maxAuditRounds"]) {
1811
+ if (playbook.coding?.[field2] !== void 0 && playbook.role !== "story") {
1812
+ ctx.addIssue({
1813
+ code: "custom",
1814
+ path: ["coding", field2],
1815
+ message: `Only story playbooks audit their epics; remove ${field2} from a ${playbook.role} playbook.`
1816
+ });
1817
+ }
1818
+ }
1819
+ if (playbook.loop !== void 0 && !roleHasLoopSettings(playbook.role)) {
1820
+ ctx.addIssue({
1821
+ code: "custom",
1822
+ path: ["loop"],
1823
+ message: roleLoops(playbook.role) ? `A ${playbook.role} playbook loops by its coding settings; remove loop.` : `A ${playbook.role} playbook doesn't loop: its runs are one session. Remove loop.`
1824
+ });
1825
+ }
1661
1826
  if (taskType === "review") {
1662
1827
  if (playbook.model !== null) {
1663
1828
  ctx.addIssue({
@@ -1702,11 +1867,18 @@ function playbookRunSpec(playbook) {
1702
1867
  });
1703
1868
  let coding = {};
1704
1869
  if (role.taskType === "coding") {
1705
- const { prDescriptionPlaybookId, ...settings } = playbook.coding ?? {};
1870
+ const { prDescriptionPlaybookId, verifierPlaybookId, auditPlaybookId, ...settings } = playbook.coding ?? {};
1706
1871
  coding = {
1707
1872
  ...CODING_DEFAULTS,
1708
1873
  ...dropUndefined2(settings),
1709
- prDescriptionTaskId: prDescriptionPlaybookId ?? DEFAULT_PR_DESCRIPTION_TASK_ID
1874
+ prDescriptionTaskId: prDescriptionPlaybookId ?? DEFAULT_PR_DESCRIPTION_TASK_ID,
1875
+ // Only story runs verify their tasks.
1876
+ ...playbook.role === "story" && {
1877
+ verifierTaskId: verifierPlaybookId ?? DEFAULT_VERIFIER_TASK_ID,
1878
+ // Only story runs audit their epics.
1879
+ auditTaskId: auditPlaybookId ?? DEFAULT_AUDIT_TASK_ID,
1880
+ maxAuditRounds: settings.maxAuditRounds ?? DEFAULT_MAX_AUDIT_ROUNDS
1881
+ }
1710
1882
  };
1711
1883
  }
1712
1884
  const task = TaskDefinition.parse(
@@ -1795,6 +1967,119 @@ var ASK_ABOUT_CODE_PLAYBOOK = {
1795
1967
  variableLimits: { conventions: 2e4, "chat.context": 8e3, question: 4e3 }
1796
1968
  };
1797
1969
 
1970
+ // ../../packages/tasks/src/builtin/audit-epic.ts
1971
+ var EPIC_AUDITOR_PERSONA = {
1972
+ systemPrompt: `You are "Omniralph", auditing an epic whose tasks other sessions have built and committed. You haven't seen how they were built, and you judge only the code as it is now.
1973
+ - Only read: inspect the repository and its git history (\`git log\`, \`git diff\`, \`git show\`). Don't edit files, commit, push, install dependencies or run gh/glab.
1974
+ - Report your findings in your structured result (\`requirements\`, \`summary\`).`,
1975
+ tools: {
1976
+ builtin: ["Read", "Grep", "Glob", "Bash"],
1977
+ agent: [],
1978
+ tracker: [],
1979
+ mcpServers: []
1980
+ }
1981
+ };
1982
+ var AUDIT_EPIC_TEMPLATE = `Every task of "{{epic.title}}" ({{epic.identifier}}) is done, and each one was checked against its own acceptance criteria. Before it goes up for review, check the epic as a whole against each of its requirements (audit round {{audit.round}} of {{audit.maxRounds}}).
1983
+
1984
+ ## Requirements
1985
+ {{#requirements}}
1986
+ {{#items}}
1987
+ ### {{id}}
1988
+ {{text}}
1989
+
1990
+ {{/items}}
1991
+ {{/requirements}}
1992
+ {{#tasks}}
1993
+ ## Tasks done
1994
+ What each task was built and checked against, so you know where to look:
1995
+
1996
+ {{#items}}
1997
+ ### {{identifier}}: {{title}}{{#repository}} (in \`{{repository}}\`, not this checkout){{/repository}}
1998
+ {{#acceptanceCriteria}}
1999
+ Acceptance criteria:
2000
+ {{#items}}
2001
+ {{.}}
2002
+ {{/items}}
2003
+ {{/acceptanceCriteria}}
2004
+
2005
+ {{/items}}
2006
+ {{/tasks}}
2007
+ {{#epic.prd}}
2008
+ The epic, for context:
2009
+ <epic>
2010
+ {{epic.prd}}
2011
+ </epic>
2012
+
2013
+ {{/epic.prd}}
2014
+ ## Audit the code
2015
+ {{#commit}}
2016
+ 1. The working directory is a checkout of \`{{commit}}\`, the head of the epic's work on \`{{branch}}\`. Look at what it changed against \`{{baseBranch}}\` (\`git log --oneline origin/{{baseBranch}}..HEAD\`, \`git diff --stat origin/{{baseBranch}}...HEAD\`) and read the code itself.
2017
+ {{/commit}}
2018
+ {{^commit}}
2019
+ 1. The working directory is a checkout of \`{{branch}}\`, the epic's branch. Look at what it changed against \`{{baseBranch}}\` (\`git log --oneline origin/{{baseBranch}}..HEAD\`, \`git diff --stat origin/{{baseBranch}}...HEAD\`) and read the code itself.
2020
+ {{/commit}}
2021
+ 2. For each requirement, decide whether the code meets it:
2022
+ - \`met\`: the code does what it says. In \`evidence\`, name the file (and function) or the test that shows it, in one or two sentences. Leave \`missing\` and \`title\` empty.
2023
+ - \`gap\`: it isn't met, or only partly. In \`missing\`, say concretely what is missing or wrong, so a new task can close it without guessing; in \`title\`, give that task a short imperative title. In \`evidence\`, say where you looked.
2024
+ - A requirement covered only by a task done in another repo counts as met on that task: say so in \`evidence\`.
2025
+ - Judge what the requirement asks for, not how you would have built it. Style, refactors and work the epic doesn't ask for are never a gap.
2026
+ 3. Don't change any files.
2027
+ {{#audit.last}}
2028
+
2029
+ This is the last audit round: gaps you report now are listed in the {{prTerm}} description rather than built, so report only real ones.
2030
+ {{/audit.last}}
2031
+
2032
+ Report one entry per requirement in \`requirements\` (\`id\` as written above, \`status\`, \`evidence\`, \`missing\` and \`title\`), and a short \`summary\` of the audit.`;
2033
+ var AUDIT_EPIC_PLAYBOOK = {
2034
+ id: "builtin:audit-epic",
2035
+ name: "Audit an epic",
2036
+ description: "Checks an epic whose tasks are all done against each of its requirements before its PR opens; each gap becomes a new task in the epic.",
2037
+ role: "audit",
2038
+ ...EPIC_AUDITOR_PERSONA,
2039
+ promptTemplate: AUDIT_EPIC_TEMPLATE,
2040
+ toolSettings: { shell: true, trackerRead: false, network: false },
2041
+ outputSchema: {
2042
+ type: "object",
2043
+ properties: {
2044
+ requirements: {
2045
+ type: "array",
2046
+ description: "One finding per requirement, in the order given.",
2047
+ items: {
2048
+ type: "object",
2049
+ properties: {
2050
+ id: { type: "string", description: "The requirement's identifier, as written." },
2051
+ status: {
2052
+ type: "string",
2053
+ enum: ["met", "gap"],
2054
+ description: "Whether the code meets it."
2055
+ },
2056
+ evidence: {
2057
+ type: "string",
2058
+ description: "The file or test that shows it's met, or where you looked."
2059
+ },
2060
+ missing: {
2061
+ type: "string",
2062
+ description: "For a gap: what is missing or wrong. Empty when met."
2063
+ },
2064
+ title: {
2065
+ type: "string",
2066
+ description: "For a gap: a short imperative title for the task that closes it."
2067
+ }
2068
+ },
2069
+ required: ["id", "status", "evidence", "missing", "title"],
2070
+ additionalProperties: false
2071
+ }
2072
+ },
2073
+ summary: { type: "string", description: "A short summary of the audit." }
2074
+ },
2075
+ required: ["requirements", "summary"],
2076
+ additionalProperties: false
2077
+ },
2078
+ // Reading the whole epic's code against its requirements is the harder check: the stronger model.
2079
+ model: "claude-opus-5-5",
2080
+ tokenBudget: null
2081
+ };
2082
+
1798
2083
  // ../../packages/tasks/src/builtin/correlate-findings.ts
1799
2084
  var SEVERITIES = ["critical", "high", "medium", "low", "info"];
1800
2085
  var CATEGORIES = [
@@ -2228,21 +2513,6 @@ ${heading(FIX_SECTIONS.acceptanceCriteria)}
2228
2513
 
2229
2514
  - [ ] [Evidence to check]
2230
2515
  - [ ] [More evidence to check]`;
2231
- var VALIDATION_AUDIT_INTRO = `Audit the finished epic against its requirements. For each requirement below, find the evidence that it holds on the epic's branch: the code that implements it, and the tests the repo's conventions call for on that behavior. Check every story's acceptance criteria the same way. Fix each gap you find, as part of this task.`;
2232
- var VALIDATION_AUDIT_CLOSING = [
2233
- "Every acceptance criterion of the other tasks in this epic holds",
2234
- "The repo's checks pass"
2235
- ];
2236
- function renderValidationAudit(requirements) {
2237
- const lines = requirements.length > 0 ? requirements.map((requirement) => `${requirement.id}: ${requirement.text.trim()}`) : [`${REQUIREMENT_PREFIX}1: [the requirement, as the epic words it]`];
2238
- const criteria = [...lines, ...VALIDATION_AUDIT_CLOSING].map((line) => `- [ ] ${line}`);
2239
- return `${VALIDATION_AUDIT_INTRO}
2240
-
2241
- ${heading(ACCEPTANCE_CRITERIA_SECTION)}
2242
-
2243
- ${criteria.join("\n")}`;
2244
- }
2245
- var VALIDATION_AUDIT_TEMPLATE = renderValidationAudit([]);
2246
2516
 
2247
2517
  // ../../packages/planning/src/methodology/rules.ts
2248
2518
  function fence2(text3) {
@@ -2301,18 +2571,18 @@ A fix in an epic may add a ${code(`${COVERS_LABEL}:`)} line before ${code(headin
2301
2571
 
2302
2572
  ${fence2(FIX_TEMPLATE)}`
2303
2573
  };
2304
- var VALIDATION_AUDIT_RULE = {
2305
- id: "validation-audit",
2306
- title: "Validation audit",
2307
- body: `Every epic ends with a validation audit: its last task, titled ${code(VALIDATION_AUDIT_TITLE)}, blocked by every other task in the epic. It has one criterion per requirement of the epic, copied as the epic words it, and this body:
2308
-
2309
- ${fence2(VALIDATION_AUDIT_TEMPLATE)}`
2574
+ var EPIC_AUDIT_RULE = {
2575
+ id: "epic-audit",
2576
+ title: "Epic audit",
2577
+ body: `When every task of an epic is done, Omniralph audits the epic against its requirements before its pull request opens: it checks each requirement against the code, and files each gap it finds as a new task in the epic. So an epic carries only real work:
2578
+ - Plan no validation or audit task (no ${code(VALIDATION_AUDIT_TITLE)} task). Keep the epic's requirements in its description, where the audit reads them.
2579
+ - An epic that already has a ${code(VALIDATION_AUDIT_TITLE)} task keeps it: it still runs as a task, and the epic is audited too.`
2310
2580
  };
2311
2581
  var SIZING_RULE = {
2312
2582
  id: "sizing",
2313
2583
  title: "Sizing",
2314
2584
  body: `Size the whole body of work, not one piece of it: XS, S, M, L or XL. Weigh the number of distinct requirements, the surface it touches (database, API, UI, integrations, infrastructure), the unknowns and risk, and how many focused agent sessions it would realistically take.
2315
- - **L or larger (L, XL): an epic.** One task per story or fix, then the validation audit as the last task.
2585
+ - **L or larger (L, XL): an epic.** One task per story or fix, and no validation task: the epic audit checks the requirements.
2316
2586
  - **Smaller than L (XS, S, M): a single task.** One story, or one fix when it is a bug, with its acceptance criteria in its own description and no sub-issues.`
2317
2587
  };
2318
2588
  var SPLITTING_RULE = {
@@ -2363,7 +2633,7 @@ var SHARED_RULES = [
2363
2633
  CHECKABLE_CRITERIA_RULE,
2364
2634
  SIZING_RULE,
2365
2635
  SPLITTING_RULE,
2366
- VALIDATION_AUDIT_RULE,
2636
+ EPIC_AUDIT_RULE,
2367
2637
  DEPENDENCY_RULE
2368
2638
  ];
2369
2639
  var PLACEHOLDER = /\{\{(\w+)\}\}/g;
@@ -2424,7 +2694,7 @@ var TRIAGE_STORIES_STEP = {
2424
2694
  - \`priority\`: 1 Urgent, 2 High, 3 Medium, 4 Low. Priority beats order when Omniralph picks the next task, so use one priority for the whole epic, or priorities that agree with the order on purpose.
2425
2695
  - \`dependsOn\`: the 0-based indexes, in \`stories\`, of the tasks it really depends on. These become "blocks" relations.
2426
2696
  - \`manual\`: true for a step only a person can do.
2427
- - The **last** entry is the validation audit, titled \`${VALIDATION_AUDIT_TITLE}\`, depending on every other entry. Its body is the validation audit; Omniralph writes it from the epic's requirements, whatever you put there.`
2697
+ - No validation or audit entry (no \`${VALIDATION_AUDIT_TITLE}\` task): Omniralph audits the epic against its requirements before its pull request opens, so every entry is real work.`
2428
2698
  };
2429
2699
  var TRIAGE_REFORMAT_STEP = {
2430
2700
  id: "triage-reformat",
@@ -2635,7 +2905,8 @@ A fix filed in the same epic, titled \`Sort priorities by rank, not by name\`:
2635
2905
  ${EXAMPLE_FIX}
2636
2906
  \`\`\`
2637
2907
 
2638
- The epic ends with the validation audit, listing FR-1 to FR-4.`
2908
+ There is no validation task: Omniralph audits FR-1 to FR-4 before the epic's
2909
+ pull request opens.`
2639
2910
  };
2640
2911
 
2641
2912
  // ../../packages/planning/src/plugin/modes.ts
@@ -2657,7 +2928,8 @@ var PLAN_CHECKLIST = `- [ ] Sized the whole body of work and chose the structure
2657
2928
  - [ ] Steps for a person are separate manual tasks
2658
2929
  - [ ] Every task has a priority, and its dependencies as blocks relations the
2659
2930
  dependency rules allow; no drafting labels or metadata in titles or bodies
2660
- - [ ] An epic ends with the validation audit, blocked by every other task
2931
+ - [ ] An epic has no validation task: Omniralph audits its requirements
2932
+ before its pull request opens
2661
2933
  - [ ] The issue is in the team or project (or has the label) that routes it; no
2662
2934
  \`[repo=\u2026]\` tag unless the user asked for one
2663
2935
  - [ ] No \`## Open Questions\` section left in any description`;
@@ -2712,7 +2984,8 @@ story or fix) before continuing.
2712
2984
  Split the epic into tasks by the Splitting rule, each in the story format (or
2713
2985
  the fix format for a bug), with a \`Covers:\` line naming the requirements it
2714
2986
  owns. Present them as \`common.md\` \u2192 "Drafting tasks with the user" shows.
2715
- End with the validation audit.
2987
+ Don't add a validation task: Omniralph audits the epic against its
2988
+ requirements before its pull request opens.
2716
2989
 
2717
2990
  ## Final step: save to {{trackerName}}
2718
2991
 
@@ -2732,7 +3005,6 @@ user review and confirm it is ready to save. Only after they confirm, use the
2732
3005
  - Use the task in the story or fix format as the description.
2733
3006
  - Set its priority, its \`blockedBy\` dependencies, and the manual label for
2734
3007
  steps for a person.
2735
- - Create the validation audit sub-issue, blocked by all the other sub-issues.
2736
3008
  - Do the post-creation steps: replace drafting labels with {{trackerName}}
2737
3009
  identifiers, and verify the blocks relations.
2738
3010
 
@@ -2762,9 +3034,9 @@ a loose collection of thoughts, a feature request with partial detail, or an
2762
3034
  older format. Your job is to elicit the missing context and write the full
2763
3035
  structure back to the **same** issue.
2764
3036
 
2765
- Depending on the size, the issue becomes an epic (with one sub-issue per task
2766
- and the validation audit, when the work is **L** or larger) or stays a single
2767
- story or fix (when smaller).
3037
+ Depending on the size, the issue becomes an epic (with one sub-issue per task,
3038
+ when the work is **L** or larger) or stays a single story or fix (when
3039
+ smaller).
2768
3040
 
2769
3041
  Follow the planning rules in \`common.md\`.
2770
3042
 
@@ -2825,7 +3097,8 @@ resulting structure before continuing.
2825
3097
 
2826
3098
  Split the epic into tasks by the Splitting rule, in the story or fix format,
2827
3099
  each with its \`Covers:\` line, and present them as \`common.md\` \u2192 "Drafting
2828
- tasks with the user" shows. End with the validation audit.
3100
+ tasks with the user" shows. Don't add a validation task: Omniralph audits the
3101
+ epic against its requirements before its pull request opens.
2829
3102
 
2830
3103
  ## Final step: update the issue in {{trackerName}}
2831
3104
 
@@ -2850,7 +3123,6 @@ In both cases:
2850
3123
  - Create a sub-issue for each task, in task order: plain task title, the task
2851
3124
  in the story or fix format, a priority, its \`blockedBy\` dependencies, and
2852
3125
  the manual label for steps for a person.
2853
- - Create the validation audit sub-issue, blocked by all the other sub-issues.
2854
3126
  - Do the post-creation steps: replace drafting labels with {{trackerName}}
2855
3127
  identifiers, and verify the blocks relations.
2856
3128
 
@@ -2887,7 +3159,8 @@ Before doing anything else, use the {{trackerName}} MCP tools to fetch the
2887
3159
  issue and all of its sub-issues.
2888
3160
 
2889
3161
  - Read the epic's (or the task's) full description.
2890
- - Enumerate every sub-issue, including the validation audit if one exists.
3162
+ - Enumerate every sub-issue, including a legacy \`Validate functional
3163
+ requirements\` task if one exists.
2891
3164
  - Note each sub-issue's identifier, title, description, status, priority,
2892
3165
  labels (especially the manual label), and blocking relations.
2893
3166
  - Note any sub-issues already completed, in progress, or cancelled: these
@@ -2907,7 +3180,8 @@ Then summarize for the user:
2907
3180
  in-progress task is mid-run, and that changes are picked up by replying in
2908
3181
  the Omniralph session or by re-delegating.
2909
3182
  - The tasks that exist today, in order.
2910
- - Whether the validation audit exists.
3183
+ - Whether a legacy validation task exists (it still runs as a task; new epics
3184
+ don't get one, since Omniralph audits each epic before its pull request).
2911
3185
  - The current state of each sub-issue (completed tasks cannot be meaningfully
2912
3186
  edited; in-progress tasks should be flagged before changing).
2913
3187
 
@@ -3023,10 +3297,10 @@ Guidelines:
3023
3297
  uses a legacy \`Ralph Priority\` when a sub-issue has no {{trackerName}}
3024
3298
  priority, so set the {{trackerName}} priority first. Leave completed and
3025
3299
  in-progress tasks untouched.
3026
- - Make sure the validation audit follows \`common.md\`. If it is labelled
3027
- manual, explain that Omniralph opens the pull request only once every task is
3028
- done (unless the repo sets \`openPullRequestEarly\`), and ask whether to keep
3029
- it that way.
3300
+ - Don't add a validation task. A legacy one is kept as a task; if it is
3301
+ labelled manual, explain that Omniralph opens the pull request only once
3302
+ every task is done (unless the repo sets \`openPullRequestEarly\`), and ask
3303
+ whether to keep it that way.
3030
3304
 
3031
3305
  ## Step 6: Update the requirements
3032
3306
 
@@ -3067,10 +3341,10 @@ they confirm, use the {{trackerName}} MCP tools:
3067
3341
  is cosmetic, so don't mention it to the user.
3068
3342
  - Replace any \`new-N\` labels in descriptions with the new {{trackerName}}
3069
3343
  identifiers.
3070
- - Update the validation audit to list the revised requirements, and make sure
3071
- it is blocked by every new task too.
3072
- - If a single task is being turned into an epic, create the tasks and the
3073
- validation audit as in the \`new\` and \`triage\` final steps.
3344
+ - If the epic has a legacy validation task, update it to list the revised
3345
+ requirements, and make sure it is blocked by every new task too.
3346
+ - If a single task is being turned into an epic, create the tasks as in the
3347
+ \`new\` and \`triage\` final steps, with no validation task.
3074
3348
 
3075
3349
  **If the issue stays (or becomes) a single task, smaller than L:**
3076
3350
 
@@ -3861,7 +4135,7 @@ var TRIAGE_OUTPUT_SCHEMA = {
3861
4135
  required: ["title", "body", "priority", "dependsOn", "manual"],
3862
4136
  additionalProperties: false
3863
4137
  },
3864
- description: "outcome prd, L or larger only: the tasks to create as sub-issues, in order, the validation audit last. Empty otherwise."
4138
+ description: "outcome prd, L or larger only: the tasks to create as sub-issues, in order, with no validation task (Omniralph audits the epic before its pull request). Empty otherwise."
3865
4139
  },
3866
4140
  subIssueUpdates: {
3867
4141
  type: "array",
@@ -3932,6 +4206,104 @@ var TRIAGE_PLAYBOOK = {
3932
4206
  idleTimeoutMs: 5 * 6e4
3933
4207
  };
3934
4208
 
4209
+ // ../../packages/tasks/src/builtin/verify-task.ts
4210
+ var TASK_VERIFIER_PERSONA = {
4211
+ systemPrompt: `You are "Omniralph", verifying work another session has already committed. You haven't seen how it was done, and you judge only the change itself.
4212
+ - Only read: inspect the repository and its git history (\`git show\`, \`git log\`, \`git diff\`). Don't edit files, commit, push, install dependencies or run gh/glab.
4213
+ - Report your verdicts in your structured result (\`criteria\`, \`summary\`).`,
4214
+ tools: {
4215
+ builtin: ["Read", "Grep", "Glob", "Bash"],
4216
+ agent: [],
4217
+ tracker: [],
4218
+ mcpServers: []
4219
+ }
4220
+ };
4221
+ var VERIFY_TASK_TEMPLATE = `A session working through "{{epic.title}}" ({{epic.identifier}}) reported the task below complete, and its checks passed. Before the task counts as done, check the change against each of its acceptance criteria.
4222
+
4223
+ ## Task: {{story.identifier}} - {{story.title}}
4224
+ {{#story.description}}
4225
+ ### Description
4226
+ {{story.description}}
4227
+
4228
+ {{/story.description}}
4229
+ {{#story.acceptanceCriteria}}
4230
+ ### Acceptance Criteria
4231
+ A criterion is evidence to check, not a test to demand: it holds when the code, a command's output or an existing test shows it. A test that only asserts a file exists or what a config contains doesn't show a criterion holds.
4232
+ {{#items}}
4233
+ - {{.}}
4234
+ {{/items}}
4235
+
4236
+ {{/story.acceptanceCriteria}}
4237
+ {{^story.acceptanceCriteria}}
4238
+ The task lists no acceptance criteria: check the change against what its description asks for, as one criterion ("The change does what the task describes").
4239
+
4240
+ {{/story.acceptanceCriteria}}
4241
+ {{#epic.prd}}
4242
+ Background from the epic, for context only (don't check its other requirements; other tasks own them):
4243
+ <epic-background>
4244
+ {{epic.prd}}
4245
+ </epic-background>
4246
+
4247
+ {{/epic.prd}}
4248
+ {{#qualityGates}}
4249
+ These checks already passed, so don't run them again:
4250
+ {{#items}}
4251
+ - \`{{.}}\`
4252
+ {{/items}}
4253
+
4254
+ {{/qualityGates}}
4255
+ ## Check the change
4256
+ {{#commit}}
4257
+ 1. The working directory is a checkout of the task's commit \`{{commit}}\` on \`{{branch}}\`. Read what it changed: \`git show --stat {{commit}}\`, then \`git show {{commit}}\`, opening files where the diff alone isn't clear.
4258
+ {{/commit}}
4259
+ {{^commit}}
4260
+ 1. The session committed nothing for this task, so the work must already be on \`{{branch}}\`, which is checked out. Look at what the branch changed against \`{{baseBranch}}\` (\`git log origin/{{baseBranch}}..HEAD\`, \`git diff origin/{{baseBranch}}...HEAD\`) and at the code itself.
4261
+ {{/commit}}
4262
+ 2. For each acceptance criterion, decide whether the code meets it:
4263
+ - Accept it when the change (or code already there) does what it says. Give the evidence in one or two sentences, naming the files or tests.
4264
+ - Send it back when it isn't met, or is only partly met. Say concretely what is missing or wrong, so the next session can fix it without guessing.
4265
+ - Judge what the criterion asks for, not how you would have built it. Style preferences, refactors and work outside the task are never a reason to send a criterion back.
4266
+ 3. Don't change any files.
4267
+
4268
+ Report one entry per criterion in \`criteria\` (\`criterion\` as written above, \`accepted\`, and the \`reason\`), and a short \`summary\` of your verdict.`;
4269
+ var VERIFY_TASK_PLAYBOOK = {
4270
+ id: "builtin:verify-task",
4271
+ name: "Verify a task",
4272
+ description: "Checks a task its session reported complete against the task's acceptance criteria, before the task counts as done.",
4273
+ role: "verifier",
4274
+ ...TASK_VERIFIER_PERSONA,
4275
+ promptTemplate: VERIFY_TASK_TEMPLATE,
4276
+ toolSettings: { shell: true, trackerRead: false, network: false },
4277
+ outputSchema: {
4278
+ type: "object",
4279
+ properties: {
4280
+ criteria: {
4281
+ type: "array",
4282
+ description: "One verdict per acceptance criterion, in the order given.",
4283
+ items: {
4284
+ type: "object",
4285
+ properties: {
4286
+ criterion: { type: "string", description: "The criterion, as written." },
4287
+ accepted: { type: "boolean", description: "Whether the change meets it." },
4288
+ reason: {
4289
+ type: "string",
4290
+ description: "The evidence it's met, or what is missing or wrong."
4291
+ }
4292
+ },
4293
+ required: ["criterion", "accepted", "reason"],
4294
+ additionalProperties: false
4295
+ }
4296
+ },
4297
+ summary: { type: "string", description: "A short summary of the verdict." }
4298
+ },
4299
+ required: ["criteria", "summary"],
4300
+ additionalProperties: false
4301
+ },
4302
+ // A different (lighter) model than the worker's by default: it reads, it doesn't build.
4303
+ model: "claude-sonnet-5-5",
4304
+ tokenBudget: null
4305
+ };
4306
+
3935
4307
  // ../../packages/tasks/src/output-schema.ts
3936
4308
  import { z as z9 } from "zod";
3937
4309
 
@@ -3946,7 +4318,9 @@ var PLAYBOOK_INPUTS = [
3946
4318
  CORRELATE_FINDINGS_PLAYBOOK,
3947
4319
  IMPLEMENT_STORY_PLAYBOOK,
3948
4320
  HANDLE_REQUEST_PLAYBOOK,
3949
- DESCRIBE_PR_PLAYBOOK
4321
+ DESCRIBE_PR_PLAYBOOK,
4322
+ VERIFY_TASK_PLAYBOOK,
4323
+ AUDIT_EPIC_PLAYBOOK
3950
4324
  ];
3951
4325
  var BUILTIN_PLAYBOOKS = PLAYBOOK_INPUTS.map(
3952
4326
  (playbook) => Playbook.parse(playbook)
@@ -5183,6 +5557,8 @@ var RALPH_PREPARE_JOB_TYPE = "ralph.prepare";
5183
5557
  var RALPH_REQUEST_JOB_TYPE = "ralph.request";
5184
5558
  var RALPH_CLEANUP_JOB_TYPE = "ralph.cleanup";
5185
5559
  var RALPH_PUSH_JOB_TYPE = "ralph.push";
5560
+ var RALPH_VERIFY_TASK_JOB_TYPE = "ralph.verify-task";
5561
+ var RALPH_AUDIT_EPIC_JOB_TYPE = "ralph.audit-epic";
5186
5562
  var RALPH_JOB_TYPES = [RALPH_PREPARE_JOB_TYPE, RALPH_CLEANUP_JOB_TYPE];
5187
5563
  var MAX_ATTEMPTS_PER_STORY = 3;
5188
5564
  var MAX_DOCUMENT_LENGTH = 2e5;
@@ -5238,6 +5614,8 @@ var RalphAttachment = z22.object({
5238
5614
  sources: z22.array(z22.string().min(1).max(500)).min(1).max(50)
5239
5615
  });
5240
5616
  var RalphAttachments = z22.array(RalphAttachment).max(200).default([]);
5617
+ var MAX_VERIFIED_CRITERIA = 100;
5618
+ var MAX_CRITERION_LENGTH = 4e3;
5241
5619
  var RalphStoryListItem = RalphIssue.extend({
5242
5620
  status: z22.enum(RALPH_STORY_LIST_STATUSES),
5243
5621
  /** A step for a person, never for an agent. */
@@ -5268,7 +5646,12 @@ var RalphStoryPayload = RalphJobBase.extend({
5268
5646
  url: z22.url().nullable().default(null),
5269
5647
  description: z22.string().max(MAX_DOCUMENT_LENGTH),
5270
5648
  /** `fix` when the work item has one of the tracker's fix labels, else `story`. */
5271
- kind: z22.enum(RALPH_STORY_KINDS).default("story")
5649
+ kind: z22.enum(RALPH_STORY_KINDS).default("story"),
5650
+ /**
5651
+ * The work item's acceptance criteria, which `description` doesn't carry. Absent from
5652
+ * older servers' payloads: the agent then parses them from `description`.
5653
+ */
5654
+ acceptanceCriteria: z22.array(z22.string().min(1).max(MAX_CRITERION_LENGTH)).max(MAX_VERIFIED_CRITERIA).optional()
5272
5655
  }),
5273
5656
  /** Every story of the epic in order (the prompt lists them); may be empty. */
5274
5657
  stories: z22.array(RalphStoryListItem).max(500).default([]),
@@ -5367,6 +5750,39 @@ var RalphDescribePrResult = z22.object({
5367
5750
  body: z22.string().trim().min(1).max(6e4),
5368
5751
  usage: TokenUsage
5369
5752
  });
5753
+ var RalphVerifyTaskPayload = RalphJobBase.extend({
5754
+ /** The `ralph_stories` row. */
5755
+ storyId: z22.uuid(),
5756
+ /** The attempt it checks (1 on the story's first). */
5757
+ attempt: z22.int().min(1),
5758
+ epic: RalphIssue.extend({
5759
+ /** The epic's PRD (its description), for context; empty for a single issue. */
5760
+ prd: z22.string().max(MAX_DOCUMENT_LENGTH)
5761
+ }),
5762
+ story: RalphIssue.extend({
5763
+ /** The story's description without its acceptance criteria. */
5764
+ description: z22.string().max(MAX_DOCUMENT_LENGTH),
5765
+ acceptanceCriteria: z22.array(z22.string().min(1).max(MAX_CRITERION_LENGTH)).max(MAX_VERIFIED_CRITERIA)
5766
+ }),
5767
+ /** The attempt's commit (checked out); null when it committed nothing. */
5768
+ commitSha: CommitSha.nullable(),
5769
+ /** The checks the attempt passed. */
5770
+ qualityGates: z22.array(z22.string().min(1).max(4e3)).max(100).default([])
5771
+ });
5772
+ var RalphVerifyTaskTriggerContext = z22.looseObject({
5773
+ invoker: RalphRunInvoker,
5774
+ payload: RalphVerifyTaskPayload
5775
+ });
5776
+ var RalphCriterionVerdict = z22.object({
5777
+ criterion: z22.string().trim().min(1).max(MAX_CRITERION_LENGTH),
5778
+ accepted: z22.boolean(),
5779
+ /** The evidence it accepted the criterion on, or why it sends it back. */
5780
+ reason: z22.string().trim().max(MAX_CRITERION_LENGTH)
5781
+ });
5782
+ var RalphTaskVerdict = z22.object({
5783
+ criteria: z22.array(RalphCriterionVerdict).max(MAX_VERIFIED_CRITERIA),
5784
+ summary: z22.string().trim().max(1e4)
5785
+ });
5370
5786
  var RalphPreparePayload = RalphJobBase.extend({
5371
5787
  /** The manual story whose preparation was approved. */
5372
5788
  story: RalphIssue,
@@ -5592,6 +6008,51 @@ var RalphActivity = z22.object({
5592
6008
  /** Replaced by the session's next activity in the tracker. */
5593
6009
  ephemeral: z22.boolean().default(false)
5594
6010
  });
6011
+ var MAX_AUDITED_REQUIREMENTS = 100;
6012
+ var MAX_AUDITED_TASKS = 200;
6013
+ var MAX_REQUIREMENT_LENGTH = 4e3;
6014
+ var RalphRequirement = z22.object({
6015
+ /** Its identifier, e.g. `FR-2`. */
6016
+ id: z22.string().trim().min(1).max(64),
6017
+ text: z22.string().trim().min(1).max(MAX_REQUIREMENT_LENGTH)
6018
+ });
6019
+ var RalphAuditEpicPayload = RalphJobBase.extend({
6020
+ epic: RalphIssue.extend({
6021
+ /** The epic's PRD (its description), for context. */
6022
+ prd: z22.string().max(MAX_DOCUMENT_LENGTH)
6023
+ }),
6024
+ requirements: z22.array(RalphRequirement).min(1).max(MAX_AUDITED_REQUIREMENTS),
6025
+ /** The epic's done tasks, with the criteria each one was checked against. */
6026
+ tasks: z22.array(
6027
+ RalphIssue.extend({
6028
+ /** The repo it was worked in when that isn't the audited one. */
6029
+ repository: z22.string().max(500).nullable(),
6030
+ acceptanceCriteria: z22.array(z22.string().min(1).max(MAX_CRITERION_LENGTH)).max(MAX_VERIFIED_CRITERIA)
6031
+ })
6032
+ ).max(MAX_AUDITED_TASKS),
6033
+ /** The commit audited (checked out); null to audit the branch as it is. */
6034
+ commitSha: CommitSha.nullable(),
6035
+ /** This audit round (1 on the epic's first) and the most it gets. */
6036
+ round: z22.int().min(1),
6037
+ maxRounds: z22.int().min(1)
6038
+ });
6039
+ var RalphAuditEpicTriggerContext = z22.looseObject({
6040
+ invoker: RalphRunInvoker,
6041
+ payload: RalphAuditEpicPayload
6042
+ });
6043
+ var RalphRequirementFinding = z22.object({
6044
+ id: z22.string().trim().min(1).max(64),
6045
+ /** `met`: the code does it (`evidence` names the file or test); `gap`: it doesn't (`missing`). */
6046
+ status: z22.enum(["met", "gap"]),
6047
+ evidence: z22.string().trim().max(MAX_REQUIREMENT_LENGTH),
6048
+ missing: z22.string().trim().max(MAX_REQUIREMENT_LENGTH),
6049
+ /** For a gap: the title of the task that closes it (else empty). */
6050
+ title: z22.string().trim().max(200).default("")
6051
+ });
6052
+ var RalphEpicAuditResult = z22.object({
6053
+ requirements: z22.array(RalphRequirementFinding).max(MAX_AUDITED_REQUIREMENTS),
6054
+ summary: z22.string().trim().max(1e4)
6055
+ });
5595
6056
 
5596
6057
  // ../../packages/shared/src/triage-job.ts
5597
6058
  import { z as z23 } from "zod";
@@ -5847,6 +6308,13 @@ var PHRASES = {
5847
6308
  "Pushed",
5848
6309
  namedThing(present(c.story) ?? present(c.workItem), "branch")
5849
6310
  ),
6311
+ [RALPH_VERIFY_TASK_JOB_TYPE]: (c) => phrase("check", "Checking", "Checked", `${workTarget(c)} against its acceptance criteria`),
6312
+ [RALPH_AUDIT_EPIC_JOB_TYPE]: (c) => phrase(
6313
+ "audit",
6314
+ "Auditing",
6315
+ "Audited",
6316
+ `${present(c.workItem) ?? RUN_FALLBACK} against its requirements`
6317
+ ),
5850
6318
  [RALPH_PREPARE_JOB_TYPE]: preparation,
5851
6319
  [WORKTREE_EXEC_JOB_TYPE]: preparation,
5852
6320
  [RALPH_CLEANUP_JOB_TYPE]: cleanup,
@@ -10260,7 +10728,7 @@ var TriageAgentOutput = z30.object({
10260
10728
  manual: z30.boolean().describe("True for a step only a person can do.")
10261
10729
  })
10262
10730
  ).describe(
10263
- "outcome prd, L or larger only: the tasks to create as sub-issues, in order, the validation audit last. Empty otherwise."
10731
+ "outcome prd, L or larger only: the tasks to create as sub-issues, in order, with no validation task (Omniralph audits the epic before its pull request). Empty otherwise."
10264
10732
  ),
10265
10733
  subIssueUpdates: z30.array(
10266
10734
  z30.object({
@@ -12585,7 +13053,8 @@ function promptEpic(payload) {
12585
13053
  ...payload.story.url && { url: payload.story.url },
12586
13054
  title: payload.story.title,
12587
13055
  description: body.description,
12588
- acceptanceCriteria: body.acceptanceCriteria,
13056
+ // Older servers send no criteria field: they're then in the description, if anywhere.
13057
+ acceptanceCriteria: payload.story.acceptanceCriteria ?? body.acceptanceCriteria,
12589
13058
  priority: 0,
12590
13059
  dependsOn: listed?.dependsOn ?? [],
12591
13060
  status: "in_progress",