agentme 0.26.0 → 0.28.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.
Files changed (38) hide show
  1. package/.filedist-package.yml +1 -1
  2. package/.xdrs/agentme/edrs/{principles → application}/002-coding-best-practices.md +1 -10
  3. package/.xdrs/agentme/edrs/application/003-javascript-project-tooling.md +3 -3
  4. package/.xdrs/agentme/edrs/application/010-golang-project-tooling.md +1 -1
  5. package/.xdrs/agentme/edrs/application/014-python-project-tooling.md +7 -7
  6. package/.xdrs/agentme/edrs/application/015-cli-tool-standards.md +5 -5
  7. package/.xdrs/agentme/edrs/{principles → application}/022-secrets-management.md +1 -1
  8. package/.xdrs/agentme/edrs/application/026-pragmatic-hexagonal-architecture.md +6 -6
  9. package/.xdrs/agentme/edrs/application/{018-ai-llm-development-standards.md → 040-ai-llm-development-standards.md} +13 -11
  10. package/.xdrs/agentme/edrs/application/{019-ai-agents-development-standards.md → 041-ai-agents-development-standards.md} +10 -10
  11. package/.xdrs/agentme/edrs/application/{020-ai-agents-quality-standards.md → 042-ai-agents-quality-standards.md} +14 -12
  12. package/.xdrs/agentme/edrs/application/{021-ai-workflow-development-standards.md → 043-ai-workflow-development-standards.md} +25 -22
  13. package/.xdrs/agentme/edrs/application/{029-ai-workflow-naming-conventions.md → 044-ai-workflow-naming-conventions.md} +9 -9
  14. package/.xdrs/agentme/edrs/application/{025-ai-agent-xdrs-knowledge-layer.md → 045-ai-agent-xdrs-knowledge-layer.md} +7 -7
  15. package/.xdrs/agentme/edrs/application/051-ai-eval-core-standards.md +121 -0
  16. package/.xdrs/agentme/edrs/application/052-ai-test-types-taxonomy.md +116 -0
  17. package/.xdrs/agentme/edrs/application/053-ai-eval-script.md +136 -0
  18. package/.xdrs/agentme/edrs/application/054-ai-eval-report-format.md +171 -0
  19. package/.xdrs/agentme/edrs/application/055-ai-eval-repeatability.md +75 -0
  20. package/.xdrs/agentme/edrs/application/skills/004-select-relevant-xdrs/SKILL.md +7 -7
  21. package/.xdrs/agentme/edrs/{application/024-ml-dataset-structure.md → data/050-ml-dataset-structure.md} +4 -4
  22. package/.xdrs/agentme/edrs/{principles → governance}/007-project-quality-standards.md +26 -21
  23. package/.xdrs/agentme/edrs/governance/013-contributing-guide-requirements.md +2 -2
  24. package/.xdrs/agentme/edrs/index.md +46 -25
  25. package/.xdrs/agentme/edrs/{devops → platform}/005-monorepo-structure.md +2 -0
  26. package/.xdrs/agentme/edrs/{devops → platform}/008-common-targets.md +13 -13
  27. package/.xdrs/agentme/edrs/{devops → platform}/027-environment-variable-configuration.md +2 -2
  28. package/.xdrs/agentme/edrs/principles/016-cross-language-module-structure.md +4 -4
  29. package/package.json +2 -2
  30. package/.xdrs/agentme/edrs/application/028-ai-eval-standards.md +0 -257
  31. package/.xdrs/agentme/edrs/application/030-ai-test-types-taxonomy.md +0 -98
  32. /package/.xdrs/agentme/edrs/{principles → application}/004-unit-test-requirements.md +0 -0
  33. /package/.xdrs/agentme/edrs/{principles → application}/009-error-handling.md +0 -0
  34. /package/.xdrs/agentme/edrs/{principles → application}/023-coding-abstraction-practices.md +0 -0
  35. /package/.xdrs/agentme/edrs/{observability → operations}/011-service-health-check-endpoint.md +0 -0
  36. /package/.xdrs/agentme/edrs/{devops → platform}/006-github-pipelines.md +0 -0
  37. /package/.xdrs/agentme/edrs/{devops → platform}/017-tool-execution-and-scripting.md +0 -0
  38. /package/.xdrs/agentme/edrs/{devops → platform}/skills/002-monorepo-setup/SKILL.md +0 -0
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: agentme-edr-policy-051-ai-eval-core-standards
3
+ description: Defines the eval folder structure and Makefile interface for AI projects, and the LLM-as-judge binary scoring contract applicable to all AI tiers and test types. Use when scaffolding evals or implementing an LLM judge. For eval script requirements see agentme-edr-053. For report format see agentme-edr-054. For repeatability see agentme-edr-055. For when evals are required see agentme-edr-007 rule 09-ai-project-testing-requirements. For the test type taxonomy see agentme-edr-052.
4
+ apply-to: Python AI projects (LLM, Agent, or Workflow tier) that implement eval testing
5
+ valid-from: 2026-06-05
6
+ ---
7
+
8
+ # agentme-edr-policy-051: AI eval core standards
9
+
10
+ ## Context and Problem Statement
11
+
12
+ Eval tests measure AI component accuracy against expected outputs using real LLM providers. Without a shared folder layout and a common LLM judge contract, eval setups diverge across LLM, Agent, and Workflow projects, making them hard to scaffold, run, and compare.
13
+
14
+ How should eval tests be structured, and how must LLM judges produce scores across all AI tiers?
15
+
16
+ ## Decision Outcome
17
+
18
+ **Use a per-component folder structure under `evals/` with a standardized Makefile interface, and require all LLM judges to produce binary (`0`/`1`) output compatible with classification metrics.**
19
+
20
+ For when evals are required per AI tier, see [agentme-edr-007](../governance/007-project-quality-standards.md) rule `09-ai-project-testing-requirements`.
21
+
22
+ ### Details
23
+
24
+ #### 01-eval-folder-structure
25
+
26
+ Evals are grouped first by the component being evaluated, then by the specific evaluation scenario. Create one directory per component under `evals/`, and one directory per eval scenario inside it. Place `evals/` at the same level as `lib/` and `examples/`:
27
+
28
+ ```text
29
+ evals/
30
+ <component>/ # the component being evaluated (e.g., workflow-x, agent-y, model-z)
31
+ eval-<name>/
32
+ golden_dataset/ # EDR-024 + EDR-030 compliant golden dataset (README.md, dataset.schema.json, data/)
33
+ eval.py # evaluation script
34
+ report-<type>.md # generated report, one per evaluated test type (overwritten on each run — see agentme-edr-054 rule 01)
35
+ Makefile # lint, eval, run, and eval-<type> targets
36
+ eval-<name2>/
37
+ ...
38
+ <component2>/
39
+ ...
40
+ ```
41
+
42
+ `<component>` MUST match the name of the component under evaluation and use lowercase hyphen-separated words (e.g., `workflow-document-review`, `agent-support`, `model-classifier`).
43
+
44
+ `<name>` identifies the specific evaluation scenario using lowercase hyphen-separated words (e.g., `eval-basic`, `eval-complex`, `eval-edge-cases`). A scenario's `golden_dataset` MAY mix multiple test types across its entries: label each entry with its applicable `test_types` ([agentme-edr-052](052-ai-test-types-taxonomy.md) rule `04`) and use the `eval-<type>` targets below to run one type at a time.
45
+
46
+ The `golden_dataset/` subfolder MUST be a valid [agentme-edr-050](../data/050-ml-dataset-structure.md) dataset (`README.md`, `dataset.schema.json`, one JSON file per entry under `data/` per rule `04-complex-structured-datasets-must-use-per-entry-json-files`, lint-validated per rule `06`) whose entries follow the golden dataset envelope defined in [agentme-edr-052](052-ai-test-types-taxonomy.md) rule `02`.
47
+
48
+ Each `evals/<component>/eval-<name>/Makefile` MUST declare a `TEST_TYPES` variable listing the `test_types` values present in its golden dataset, and define:
49
+
50
+ | Target | Behaviour |
51
+ |---|---|
52
+ | `lint` | Validates every `golden_dataset/data/*.json` file against `golden_dataset/dataset.schema.json` per [agentme-edr-050](../data/050-ml-dataset-structure.md) rule `06` |
53
+ | `eval` | Depends on `lint`; runs `eval.py --type=all` with threshold enforcement; exits non-zero on failure (CI-safe) |
54
+ | `run` | Depends on `lint`; runs `eval.py --type=all` with threshold enforcement; same as `eval` but intended for local exploration |
55
+ | `eval-<type>` | Depends on `lint`; runs `eval.py --type=<type>` for one declared test type, following [agentme-edr-008](../platform/008-common-targets.md) rule `03`'s `eval-<qualifier>` convention |
56
+
57
+ ```makefile
58
+ TEST_TYPES := smoke functional safety
59
+
60
+ lint:
61
+ mise exec -- uv run --project . python lint_dataset.py golden_dataset/
62
+
63
+ eval: lint
64
+ mise exec -- uv run --project . python eval.py --type=all
65
+
66
+ run: lint
67
+ mise exec -- uv run --project . python eval.py --type=all
68
+
69
+ eval-%: lint
70
+ mise exec -- uv run --project . python eval.py --type=$*
71
+ ```
72
+
73
+ The module root Makefile MUST expose `make eval` and `make lint` targets that delegate to `eval` and `lint` respectively in every `evals/<component>/eval-<name>/Makefile`:
74
+
75
+ ```makefile
76
+ eval:
77
+ $(MAKE) -C evals/workflow-document-review/eval-basic eval
78
+ $(MAKE) -C evals/workflow-document-review/eval-complex eval
79
+
80
+ lint:
81
+ $(MAKE) -C evals/workflow-document-review/eval-basic lint
82
+ $(MAKE) -C evals/workflow-document-review/eval-complex lint
83
+ ```
84
+
85
+ #### 02-llm-as-judge-binary-output
86
+
87
+ LLM judges scoring component outputs MUST produce binary output: `0` (fail) or `1` (success). This rule applies to all AI tiers (LLM, Agent, Workflow) and to all eval test types that use an LLM judge (functional, quality, safety, repeatability, or any other).
88
+
89
+ **Requirements:**
90
+
91
+ - Judge prompts MUST instruct the model to output exactly `0` or `1`
92
+ - Scoring logic MUST parse the response and map to binary. Ambiguous/invalid responses: score as `0` or raise error
93
+ - Reports using LLM judges MUST use classification metrics (Accuracy, F1, Precision, Recall), not regression metrics (RMSE, R2, MAE)
94
+ - **F1 computation:** F1 MUST be computed from a binary confusion matrix treating score `1` as the positive class. In a standard golden dataset where every entry is expected to pass, all entries are true positives or false negatives (no true negatives exist), so Recall = TP / (TP + FN) and Precision = TP / (TP + FP) where FP = entries the judge scores `1` that the entry-level expected outcome marks as expected-fail. When all entries are expected-pass, Recall = Accuracy and Precision = 1, making F1 a conservative lower-bound on accuracy. Projects with adversarial or expected-fail entries MUST annotate each golden dataset entry with its expected binary outcome (`1` = should pass, `0` = should fail) in `expected_output` to enable a correct confusion matrix.
95
+ - Multi-class classification not supported. For multiple quality levels, use multiple binary judges (e.g., one for "factually correct", another for "tone appropriate")
96
+
97
+ **Rationale:** Binary output makes LLM judges compatible with classification metrics infrastructure (Accuracy, F1, Wilson CI, convergence analysis) defined in [agentme-edr-054](054-ai-eval-report-format.md) rule `01`.
98
+
99
+ **Example LLM judge prompt:**
100
+
101
+ ```
102
+ Evaluate whether the document review decision is correct.
103
+
104
+ Input: {input_summary}
105
+ Expected: {expected_decision}
106
+ Actual: {actual_decision}
107
+
108
+ Output exactly "1" if the actual decision matches the expected decision and reasoning, or "0" if it does not.
109
+
110
+ Output:
111
+ ```
112
+
113
+ ## References
114
+
115
+ - [agentme-edr-053](053-ai-eval-script.md) — AI eval script: entry-first eval loop, `--type` filtering, `mock_fixtures`, and MLflow conventions
116
+ - [agentme-edr-054](054-ai-eval-report-format.md) — AI eval report format: `report-<type>.md` template, Wilson CI, and convergence analysis
117
+ - [agentme-edr-055](055-ai-eval-repeatability.md) — AI eval repeatability: loop exception, scoring methods (including LLM-as-judge per rule `02`), and cadence
118
+ - [agentme-edr-007](../governance/007-project-quality-standards.md) — Project quality standards: when evals are required per AI tier (rule `09`) and statistical model eval targets (rule `07`)
119
+ - [agentme-edr-052](052-ai-test-types-taxonomy.md) — AI test types taxonomy: `test_types` enum and golden dataset entry envelope
120
+ - [agentme-edr-050](../data/050-ml-dataset-structure.md) — ML dataset structure, per-entry JSON format, and schema-lint validation for golden datasets
121
+ - [agentme-edr-008](../platform/008-common-targets.md) — `eval-<qualifier>` Makefile convention (rule `03`)
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: agentme-edr-policy-052-ai-test-types-taxonomy
3
+ description: Names AI-application test types grouped as "Safety & adversarial", "Responsible AI", "Quality eval", "Prompt/LLM", and "Code-level" with their objective, mocking constraint, and relevance, and defines the shared "golden dataset" entry envelope that agentme-edr-051's eval tooling filters by test_types. Use when deciding which AI test types to implement or when authoring a golden dataset entry.
4
+ apply-to: AI projects (LLM, Agent, or Workflow tier) implementing AI-specific test types beyond generic code-level unit/integration tests
5
+ valid-from: 2026-07-05
6
+ ---
7
+
8
+ # agentme-edr-policy-052: AI test types taxonomy
9
+
10
+ ## Context and Problem Statement
11
+
12
+ AI components need test types beyond generic unit/integration tests (safety, fairness, groundedness, functional accuracy, etc.). Which test types should be named, and how should their datasets and eval tooling work?
13
+
14
+ ## Decision Outcome
15
+
16
+ **Adopt a named taxonomy of AI test types plus a shared "golden dataset" entry envelope that agentme-edr-051's eval tooling filters by `test_types`.**
17
+
18
+ Each test type is named with its group, objective, mocking constraint, applicability, and relevance; every golden dataset entry is labeled with the test types it applies to.
19
+
20
+ ### Details
21
+
22
+ #### 01-golden-dataset-concept
23
+
24
+ Projects MUST use a golden dataset to test AI components. A **golden dataset** comprises all eval case entries used to test an AI component (LLM, Agent, or Workflow tier); each entry is labeled with the `test_types` (rule `04`) it applies to. It is the dataset consumed by [agentme-edr-053](053-ai-eval-script.md) evals and stored as one JSON file per entry per [agentme-edr-050](../data/050-ml-dataset-structure.md) rule `04`, at `evals/<component>/eval-<name>/golden_dataset/`.
25
+
26
+ #### 02-golden-dataset-entry-envelope
27
+
28
+ Every golden dataset entry (a JSON file in `golden_dataset/data/`) MUST have this shape, in addition to any project-specific fields:
29
+
30
+ ```json
31
+ {
32
+ "$schema": "../dataset.schema.json",
33
+ "test_types": ["functional"],
34
+ "input": "...",
35
+ "expected_output": "...",
36
+ "mock_fixtures": {
37
+ "system_y": [{"123": {"name": "Flavio"}}, {"456": {"name": "Andrew"}}]
38
+ }
39
+ }
40
+ ```
41
+
42
+ - `test_types` — array, values MUST come from rule `04`'s enum, MUST contain at least one value. An entry MAY carry more than one value additively (e.g. `["functional", "smoke", "human"]`) — no test type excludes another.
43
+ - `input` — for Prompt-tier components, a raw prompt string or the prompt template's input parameters object; for Agent/Workflow-tier components, the input attributes object passed to the component.
44
+ - `expected_output` — the fields used to score the entry under each of its automated `test_types`: output attributes for an LLM-as-judge rubric, a target for vector-similarity scoring, or exact attribute values for strict comparison. When `human` is one of the entry's `test_types`, `expected_output` MUST additionally include a `human_test` string field with manual-verification instructions (e.g. `"check for ethical issues, verify record change in system X"`) — this supplements, and MUST NOT replace, the entry's automated scoring fields.
45
+ - `mock_fixtures` — optional object; keys identify the adapter or external system to mock (SHOULD match the connector folder name under `adapters/connectors/<name>` for readability, though not enforced), values are any valid JSON interpreted by the mock implementation. When present, eval.py MUST configure each named mock adapter with its fixture data BEFORE invoking the component for that entry; each entry MUST use fresh mock instances to prevent state from bleeding across entries. `mock_fixtures` applies to all `test_types` including `human` — the component is still invoked for human entries to capture `actual_output`. `mock_fixtures` MUST NOT include keys for LLM adapters: all golden dataset test types are rated `mocks disallowed for LLM calls` (rule `03`), so the LLM call MUST be real; LLM provider mocking belongs exclusively to unit tests via [agentme-edr-040](040-ai-llm-development-standards.md) rule `04`. See [agentme-edr-026](026-pragmatic-hexagonal-architecture.md) rule `10` for the `_mock` file naming and placement convention.
46
+ - The dataset's `dataset.schema.json` MUST require `test_types`, `input`, and `expected_output`, and SHOULD declare `mock_fixtures` as optional (`"type": "object", "additionalProperties": {}`), per [agentme-edr-050](../data/050-ml-dataset-structure.md) rule `04`.
47
+
48
+ #### 03-mocks-allowed-values
49
+
50
+ The taxonomy in rule `05` rates each test type using one of three values under the `Mock Constraint` column:
51
+
52
+ | Value | Meaning |
53
+ |---|---|
54
+ | `mocks allowed` | Fully offline; fakes may replace every dependency including the LLM (e.g. `FakeListChatModel` per [agentme-edr-040](040-ai-llm-development-standards.md) rule `04`). Used only for code-level unit tests. |
55
+ | `mocks disallowed` | No mocking of any dependency — all real external systems required. Used for integration tests. |
56
+ | `mocks disallowed for LLM calls` | **The LLM call MUST be real; all other external dependencies (databases, APIs, external services) MAY and SHOULD be mocked via `mock_fixtures`.** `mock_fixtures` keys MUST NOT reference LLM adapters. This is the standard constraint for every golden-dataset eval test type. See rule `08` for rationale. |
57
+
58
+ #### 04-test-types-enum
59
+
60
+ A golden dataset entry's `test_types` array MUST only use these values: `safety`, `adversarial`, `fairness`, `bias`, `robustness`, `explainability`, `groundedness`, `functional`, `prompt`, `smoke`, `human`, `repeatability`. These correspond to the dataset-driven rows of rule `05`. **Unit test** and **Integration test** (the two Code-level rows) are NOT part of this enum — they have no golden dataset entries and remain governed entirely by [agentme-edr-004](004-unit-test-requirements.md) and [agentme-edr-007](../governance/007-project-quality-standards.md) rule `08`.
61
+
62
+ #### 05-test-type-taxonomy
63
+
64
+ Test types MUST be selected from this taxonomy. Each test type is named with its group, objective, mocking constraint, applicability, and relevance:
65
+
66
+ | Test Type Name | `test_types` value | Group | Test Objective | Mock Constraint | When to Apply | Relevance – Business | Relevance – Development Team | Priority (1-5) |
67
+ |---|---|---|---|---|---|---|---|---|
68
+ | Safety/content eval | `safety` | Safety & adversarial | Detect harmful, biased, or policy-violating output | mocks disallowed for LLM calls | Any user-facing release | Avoids reputational harm; acceptable-use compliance | Automated content gate before merge/release | 5 |
69
+ | Adversarial/red-team test | `adversarial` | Safety & adversarial | Probe for prompt injection, jailbreaks, unsafe tool use | mocks disallowed for LLM calls | System exposes tool-invocation or agent loops | Reduces security-incident/breach liability | Finds exploitable tool-loop paths before attackers do | 5 |
70
+ | Fairness test | `fairness` | Responsible AI | Verify equitable outcomes across user groups | mocks disallowed for LLM calls | Output affects decisions about individuals/groups | Regulatory requirement; protects equitable access | Surfaces uneven outcomes before release | 4 |
71
+ | Bias test | `bias` | Responsible AI | Detect skewed or stereotyped associations | mocks disallowed for LLM calls | User-facing content generation | Lowers legal/reputational exposure | Catches bias introduced by data/prompts/fine-tuning | 3 |
72
+ | Robustness test | `robustness` | Responsible AI | Verify stable behavior under noisy/out-of-distribution input | mocks disallowed for LLM calls | Inputs come from untrusted/variable sources | Protects reliability/SLAs | Confirms graceful degradation, guides input validation | 3 |
73
+ | Explainability test | `explainability` | Responsible AI | Verify output is justifiable with a faithful rationale | mocks disallowed for LLM calls | Output must be justified to users/auditors/regulators | Required for auditability; builds user trust | Gives rationale trace for debugging wrong answers | 2 |
74
+ | Groundedness (RAG) eval | `groundedness` | Quality eval | Verify the answer is supported by retrieved context | mocks disallowed for LLM calls | System uses retrieval-augmented generation | Avoids confidently-wrong answers reaching customers | Pinpoints retrieval/prompt bugs | 4 |
75
+ | Repeatability test | `repeatability` | Quality eval | Verify output stability/variance across N repeated invocations of the same input under fixed configuration | mocks disallowed for LLM calls | Non-deterministic components (temperature > 0, agentic tool-selection loops, sampling-based decoding) used in decision-critical or user-facing flows | Protects against silently flaky behavior reaching production; supports consistency SLAs | Detects prompt/agent designs too sensitive to sampling noise; informs temperature/seed tuning | 3 |
76
+ | Human evaluation | `human` | Quality eval | Manually verify aspects automated scoring can't (ethics, side effects, external state) | mocks disallowed for LLM calls | Before major releases; periodic spot-check | Defensible, human-reviewed sign-off | Catches what automated metrics miss | 3 |
77
+ | Functional eval (golden-dataset accuracy / LLM-as-judge) | `functional` | Quality eval | Measure output correctness against the golden dataset | mocks disallowed for LLM calls | Required before every Workflow release ([agentme-edr-007](../governance/007-project-quality-standards.md) rule `09`); advised elsewhere | Auditable evidence of business correctness before release | Detects regressions from model/provider/prompt changes | 5 |
78
+ | Smoke test | `smoke` | Quality eval | Fast pass/fail check on a small, critical subset before running fuller suites | mocks disallowed for LLM calls | Every commit/PR, before functional/responsible-AI evals run | Cheap early warning before slower evals run | Fast, cheap feedback loop | 4 |
79
+ | Prompt regression test | `prompt` | Prompt/LLM | Detect behavior change when a prompt or model version changes | mocks disallowed for LLM calls | Whenever a prompt template or model version changes | Prevents shipping a worse experience via a "small" tweak | Fast check on every prompt edit | 3 |
80
+ | Integration test | n/a — code-level only (see rule `04`) | Code-level | Verify real interaction with external systems | mocks disallowed | Component depends on external systems | Reduces production outages from integration mismatches | Catches wiring bugs unit tests can't see | 2 |
81
+ | Unit test (offline, mocked) | n/a — code-level only (see rule `04`) | Code-level | Verify deterministic logic in isolation, offline | mocks allowed | Required for Workflow tier every commit ([agentme-edr-007](../governance/007-project-quality-standards.md) rule `09`) | Lowest-cost point to catch defects | Fastest, fully offline feedback on every commit | 5 |
82
+
83
+ #### 06-priority-and-relevance-are-descriptive-only
84
+
85
+ Priority, Relevance, and When to Apply in rule `05` are guidance for prioritization conversations — they MUST NOT be treated as mandating which test types a project must implement, nor their thresholds. [agentme-edr-007](../governance/007-project-quality-standards.md) rule `09` remains the only tier-level testing requirement in force (Workflow unit tests + functional evals). Once a project chooses to implement and threshold a test type, [agentme-edr-053](053-ai-eval-script.md) rule `01`'s failing-threshold behavior applies uniformly, regardless of this table's priority rating — a project may enforce fairness at 70% and functional at 90%, or skip fairness entirely; that choice is a project/business decision, not one this Policy makes.
86
+
87
+ #### 07-smoke-is-distinct-from-test-smoke
88
+
89
+ The `smoke` test type (surfaced as the `eval-smoke` Makefile target, a fast subset of the golden-dataset functional eval) is a different concept from [agentme-edr-008](../platform/008-common-targets.md)'s existing `test-smoke` target (a fast subset of code-level tests). Both MAY exist in the same project; teams MUST NOT conflate them.
90
+
91
+ #### 08-eval-mocking-constraint
92
+
93
+ For every golden-dataset eval test type: **the LLM call MUST be real; all other external dependencies MUST be mocked via `mock_fixtures`.** This applies equally to `human` entries — the component is invoked to capture `actual_output` and external dependencies must be deterministic. `mock_fixtures` keys MUST NOT reference LLM adapters. Code-level unit tests are the correct place for fully offline, LLM-mocked testing (see [agentme-edr-040](040-ai-llm-development-standards.md) rule `04`).
94
+
95
+ #### 09-repeatability-vs-reproducibility
96
+
97
+ | Property | Definition | What varies | Measured by |
98
+ |---|---|---|---|
99
+ | **Repeatability** | Output stability across N invocations at non-zero temperature | Model sampling variance | `repeatability` test type per [agentme-edr-055](055-ai-eval-repeatability.md) |
100
+ | **Reproducibility** | Deterministic output at temperature = 0 with fixed seed | Nothing — any variance is a config bug | Not a golden-dataset type; verified via config, documented in [agentme-edr-027](../platform/027-environment-variable-configuration.md) |
101
+
102
+ A component may satisfy reproducibility (temperature = 0) yet still need repeatability tests for its production configuration (temperature > 0). The `repeatability` test type MUST NOT be applied to components with intentionally diverse output (brainstorming, creative generation) — variance is correct behavior there.
103
+
104
+ ## References
105
+
106
+ - [agentme-edr-050](../data/050-ml-dataset-structure.md) — Golden dataset file layout, per-entry JSON format, `$schema` pointer, and schema-lint validation
107
+ - [agentme-edr-051](051-ai-eval-core-standards.md) — AI eval core standards: eval folder structure and Makefile targets (rule `01`); LLM-as-judge binary scoring contract (rule `02`)
108
+ - [agentme-edr-053](053-ai-eval-script.md) — AI eval script: `--type` filtering, entry-first loop, `mock_fixtures`, threshold enforcement, and MLflow conventions
109
+ - [agentme-edr-054](054-ai-eval-report-format.md) — AI eval report format: per-type `report-<type>.md` that consumes this taxonomy's test types
110
+ - [agentme-edr-055](055-ai-eval-repeatability.md) — AI eval repeatability: `REPEAT_COUNT` loop exception, scoring constants (`EVAL_MIN_ACCURACY_REPEATABILITY`, `REPEAT_SEMANTIC_SIMILARITY_SCORE`), scoring methods, `repeatability_accuracy` MLflow metric, report shape, and run cadence
111
+ - [agentme-edr-026](026-pragmatic-hexagonal-architecture.md) — Rule `10`: `_mock` file naming and placement convention for mock adapters referenced by `mock_fixtures`
112
+ - [agentme-edr-007](../governance/007-project-quality-standards.md) — Rule `09` tier-level testing requirements (the only mandated AI testing baseline)
113
+ - [agentme-edr-008](../platform/008-common-targets.md) — Rule `03` `eval-<qualifier>` Makefile convention; rule `03`'s `test-smoke` (distinguished in rule `07`)
114
+ - [agentme-edr-027](../platform/027-environment-variable-configuration.md) — Environment-configuration conventions referenced in rule `09`'s reproducibility disambiguation
115
+ - [agentme-edr-040](040-ai-llm-development-standards.md) — LLM tier definition and mocking utilities referenced by the `mocks allowed` value
116
+ - [agentme-edr-004](004-unit-test-requirements.md) — Unit test requirements underlying the Code-level rows
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: agentme-edr-policy-053-ai-eval-script
3
+ description: Defines eval.py script requirements for AI projects — entry-first eval loop, --type test-type filtering, mock_fixtures wiring, human entries, threshold enforcement, and MLflow experiment naming and port assignment. Use when implementing eval scripts. For eval folder structure see agentme-edr-051 rule 01. For the test type taxonomy and mock_fixtures envelope see agentme-edr-052. For mock file naming see agentme-edr-026 rule 10. For report format see agentme-edr-054. For repeatability loop exception see agentme-edr-055.
4
+ apply-to: Python AI projects (LLM, Agent, or Workflow tier) that implement eval testing
5
+ valid-from: 2026-07-07
6
+ ---
7
+
8
+ # agentme-edr-policy-053: AI eval script
9
+
10
+ ## Context and Problem Statement
11
+
12
+ Eval scripts execute entries from a golden dataset against a real AI component and measure output quality. Without a shared script contract, eval implementations diverge: some invoke components multiple times per entry (wasting LLM cost), some skip mock isolation, and some omit threshold enforcement — making results inconsistent and hard to trust across projects.
13
+
14
+ How should eval scripts load datasets, iterate entries, handle mocking, and produce metrics?
15
+
16
+ ## Decision Outcome
17
+
18
+ **Use an entry-first eval loop with `--type` filtering, fresh mock isolation per entry, real LLM providers, and MLflow-backed metrics with explicit per-type thresholds.**
19
+
20
+ For when evals are required per AI tier, see [agentme-edr-007](../governance/007-project-quality-standards.md) rule `09-ai-project-testing-requirements`.
21
+
22
+ ### Details
23
+
24
+ #### 01-eval-script-requirements
25
+
26
+ Each `eval.py` script MUST:
27
+
28
+ - Load the golden dataset from `golden_dataset/` in the same eval folder, following [agentme-edr-050](../data/050-ml-dataset-structure.md) and the entry envelope in [agentme-edr-052](052-ai-test-types-taxonomy.md) rule `02` (one JSON file per entry, `test_types` array, `input`, `expected_output`, optional `mock_fixtures`).
29
+ - Accept a required `--type=<test_type>|all` CLI argument and filter entries whose `test_types` array contains the requested value; `--type=all` includes every entry.
30
+ - Iterate **entry-first**: for each entry in the filtered set, invoke the real component exactly once; then score that single `actual_output` for every `test_types` value the entry carries that falls within the current `--type` scope — MUST NOT invoke the component more than once per entry per run.
31
+ - When an entry contains `mock_fixtures` ([agentme-edr-052](052-ai-test-types-taxonomy.md) rule `02`), configure each named mock adapter with its fixture data BEFORE invoking the component for that entry. Each entry MUST use fresh mock instances so fixture state does not bleed across entries. `mock_fixtures` applies to all test types including `human`. `mock_fixtures` MUST NOT configure LLM adapters — the LLM call MUST be real (see [agentme-edr-052](052-ai-test-types-taxonomy.md) rule `03`). How mock adapters are discovered and instantiated is left to the project; see [agentme-edr-026](026-pragmatic-hexagonal-architecture.md) rule `10` for the `_mock` file naming and placement convention.
32
+ - Run every component invocation against **real LLM providers** (not mocked responses), to capture model drift.
33
+ - For `human` entries: invoke the component to capture `actual_output`, export each entry's `input`, `expected_output.human_test` instructions, and `actual_output` into a manual-review checklist (`report-human.md`). MUST NOT invoke an automated scorer and MUST NOT enforce a pass/fail threshold for it. Other `test_types` on the same entry (e.g. `functional`) are still scored automatically.
34
+ - After all entries are processed, compute aggregate metrics per test type, log them to a local MLflow experiment (see rule `02`), write one `report-<type>.md` per evaluated test type ([agentme-edr-054](054-ai-eval-report-format.md) rule `01`), and exit with a non-zero status when any metric falls below its defined threshold per [agentme-edr-007](../governance/007-project-quality-standards.md) rule `07-statistical-models-must-have-eval-targets`. The `human` type has no threshold and does not trigger a non-zero exit.
35
+ - Compare outputs to expected values using project-defined quality thresholds per test type. Thresholds and all other scoring parameters MUST be declared as constants in `eval.py` — they are design decisions about what constitutes acceptable quality for the component under test, not runtime configuration, and MUST NOT be passed via Makefile variables or CLI flags. Use one of two naming conventions, chosen consistently within an `eval.py`: (a) **per-type constants** — `EVAL_MIN_<METRIC>_<TYPE>` for each test type (e.g. `EVAL_MIN_ACCURACY_FUNCTIONAL = 0.85`, `EVAL_MIN_ACCURACY_REPEATABILITY = 0.8`); or (b) **dict constant** — `EVAL_MIN_<METRIC> = {<type>: <value>}` (e.g. `EVAL_MIN_ACCURACY = {"functional": 0.85, "smoke": 0.85}`). Per-type constants are preferred when each test type has a dedicated `eval.py`; the dict form is preferred when a single `eval.py` handles multiple types. In either convention, `EVAL_MIN_ACCURACY` (as a scalar) MAY be declared as a project-wide default and MUST be used as fallback when no per-type override is defined for the current test type. This Policy does not mandate which test types a project must threshold or what value to use (see [agentme-edr-052](052-ai-test-types-taxonomy.md) rule `06`).
36
+
37
+ **Example:**
38
+
39
+ ```python
40
+ import argparse
41
+ from collections import defaultdict
42
+ import mlflow
43
+ from my_package.app.workflows.document_review_workflow.graph import graph
44
+
45
+ # Per-type constants; fall back to EVAL_MIN_ACCURACY default when no override is defined
46
+ EVAL_MIN_ACCURACY = 0.85 # project-wide default
47
+ EVAL_MIN_ACCURACY_FUNCTIONAL = 0.85
48
+ EVAL_MIN_ACCURACY_SMOKE = 0.90
49
+ EVAL_MIN_ACCURACY_PER_TYPE = {"functional": EVAL_MIN_ACCURACY_FUNCTIONAL, "smoke": EVAL_MIN_ACCURACY_SMOKE}
50
+
51
+ def get_min_accuracy(test_type: str) -> float:
52
+ return EVAL_MIN_ACCURACY_PER_TYPE.get(test_type, EVAL_MIN_ACCURACY)
53
+
54
+ parser = argparse.ArgumentParser()
55
+ parser.add_argument("--type", required=True)
56
+ args = parser.parse_args()
57
+
58
+ entries = load_golden_dataset("golden_dataset/", test_type=args.type) # "all" loads every entry
59
+ resolved_types = resolve_types(args.type, entries)
60
+
61
+ mlflow.set_experiment("document-review/eval-basic")
62
+
63
+ with mlflow.start_run():
64
+ mlflow.set_tag("test_types", ",".join(sorted(resolved_types)))
65
+
66
+ results = defaultdict(list)
67
+ cumulative_metrics = defaultdict(lambda: {"accuracy": [], "f1": []}) # Track cumulative metrics
68
+
69
+ # Entry-first loop: invoke each entry exactly once
70
+ for idx, entry in enumerate(entries, start=1):
71
+ # Configure mock adapters from mock_fixtures before invocation
72
+ # (implementation left to the project — see agentme-edr-026 rule 10)
73
+ if entry.get("mock_fixtures"):
74
+ configure_mocks(entry["mock_fixtures"]) # project-defined helper
75
+
76
+ actual_output = invoke_component(entry, graph)
77
+
78
+ for test_type in [t for t in entry["test_types"] if t in resolved_types]:
79
+ if test_type == "human":
80
+ export_human_review(entry, actual_output)
81
+ continue
82
+
83
+ score_val = score(test_type, actual_output, entry["expected_output"])
84
+ results[test_type].append(score_val)
85
+
86
+ # Track cumulative metrics for convergence analysis
87
+ cumulative_accuracy = sum(results[test_type]) / len(results[test_type])
88
+ cumulative_f1 = compute_f1(results[test_type]) # project-defined
89
+ cumulative_metrics[test_type]["accuracy"].append(cumulative_accuracy)
90
+ cumulative_metrics[test_type]["f1"].append(cumulative_f1)
91
+
92
+ # Aggregate, report, and enforce thresholds per test type
93
+ for test_type in resolved_types:
94
+ if test_type == "human":
95
+ continue
96
+
97
+ accuracy = sum(results[test_type]) / len(results[test_type])
98
+ mlflow.log_metric(f"{test_type}_accuracy", accuracy)
99
+
100
+ # Generate convergence analysis
101
+ stability_window = min(10, len(results[test_type]))
102
+ acc_change = abs(cumulative_metrics[test_type]["accuracy"][-1] -
103
+ cumulative_metrics[test_type]["accuracy"][-stability_window])
104
+ f1_change = abs(cumulative_metrics[test_type]["f1"][-1] -
105
+ cumulative_metrics[test_type]["f1"][-stability_window])
106
+
107
+ write_eval_report(
108
+ test_type,
109
+ results[test_type],
110
+ cumulative_metrics=cumulative_metrics[test_type],
111
+ stability_window=stability_window,
112
+ thresholds={"accuracy": get_min_accuracy(test_type)}
113
+ )
114
+
115
+ if accuracy < get_min_accuracy(test_type):
116
+ raise SystemExit(f"Eval failed: {test_type} accuracy {accuracy:.2f} < {get_min_accuracy(test_type)}")
117
+ ```
118
+
119
+ #### 02-eval-mlflow-unique-port
120
+
121
+ Each `evals/<component>/eval-<name>/Makefile` MUST start its MLflow tracking server on a **unique port** to prevent conflicts when multiple eval Makefiles are run concurrently or in parallel (e.g., in CI or across multiple terminal sessions).
122
+
123
+ Ports MUST be statically assigned per eval scenario (not per test type) and MUST NOT reuse the default `5000` port (reserved for `dev-mlflow` per [agentme-edr-008](../platform/008-common-targets.md) rule `09-ai-project-dev-targets`). Assign ports starting at `5100` and incrementing by 1 for each additional eval scenario across the entire project.
124
+
125
+ The MLflow **experiment** is scoped to the eval scenario: `<component>/<eval-name>` (e.g. `document-review/eval-basic`). Each `mlflow.start_run()` call MUST set a `test_types` tag listing the test types evaluated in that invocation (comma-separated, e.g. `"functional,smoke"` for `--type=all`, `"smoke"` for `--type=smoke`). A remote MLflow server MUST NOT be required — all tracking is local.
126
+
127
+ ## References
128
+
129
+ - [agentme-edr-051](051-ai-eval-core-standards.md) — AI eval core standards: eval folder structure (rule `01`) and LLM-as-judge binary scoring contract (rule `02`)
130
+ - [agentme-edr-054](054-ai-eval-report-format.md) — AI eval report format: `report-<type>.md` template, Wilson CI, and convergence analysis
131
+ - [agentme-edr-055](055-ai-eval-repeatability.md) — AI eval repeatability: loop exception to rule `01`'s entry-first constraint, scoring methods, and cadence
132
+ - [agentme-edr-052](052-ai-test-types-taxonomy.md) — AI test types taxonomy: `test_types` enum, golden dataset entry envelope (including `mock_fixtures`), and mocking constraints per type
133
+ - [agentme-edr-026](026-pragmatic-hexagonal-architecture.md) — Rule `10`: `_mock` file naming and placement convention for mock adapters used in `mock_fixtures`
134
+ - [agentme-edr-050](../data/050-ml-dataset-structure.md) — ML dataset structure, per-entry JSON format, and schema-lint validation for golden datasets
135
+ - [agentme-edr-007](../governance/007-project-quality-standards.md) — Project quality standards: when evals are required per AI tier (rule `09`) and statistical model eval targets (rule `07`)
136
+ - [agentme-edr-008](../platform/008-common-targets.md) — `eval-<qualifier>` Makefile convention (rule `03`) and reserved MLflow port `5000` (rule `09`)
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: agentme-edr-policy-054-ai-eval-report-format
3
+ description: Defines the eval report format for AI projects — report-<type>.md template, Wilson score confidence interval, convergence analysis, and the human-type checklist artifact. Use when generating eval reports from eval scripts. For the eval script that produces these reports see agentme-edr-053. For repeatability report shape see agentme-edr-055 rule 02.
4
+ apply-to: Python AI projects (LLM, Agent, or Workflow tier) that implement eval testing
5
+ valid-from: 2026-07-07
6
+ ---
7
+
8
+ # agentme-edr-policy-054: AI eval report format
9
+
10
+ ## Context and Problem Statement
11
+
12
+ Eval scripts produce output reports, but without a shared format these vary across projects: some omit confidence intervals, some skip convergence analysis, and some allow LLMs to write sections — making reports unreliable and non-comparable.
13
+
14
+ What format should eval reports follow, and what constraints apply to how they are generated?
15
+
16
+ ## Decision Outcome
17
+
18
+ **Use a standardized `report-<type>.md` template with a Wilson score confidence interval, a Mermaid convergence chart, and a strict no-LLM generation constraint for all metric values.**
19
+
20
+ ### Details
21
+
22
+ #### 01-eval-report-file
23
+
24
+ Each eval script MUST produce one `report-<type>.md` per evaluated test type in the same `evals/<component>/eval-<name>/` folder and overwrite each on every run — only the types included in the current `--type` invocation are (re)written; report files for other types are left untouched. The `human` type does not produce a metrics report (see below).
25
+
26
+ **Generation constraint:** The report MUST be produced programmatically, reading raw metric values directly from MLflow. No LLM or generative model may write, summarize, or paraphrase any section of the report, to prevent hallucinated metric values. This constraint applies to all report sections including Overall Results, Convergence Analysis, and Per-item Results — all metric values and convergence chart data points MUST be computed from actual evaluation results.
27
+
28
+ The report MUST follow this template:
29
+
30
+ ```markdown
31
+ # Eval Report: <name> — <type>
32
+
33
+ **Date:** <ISO date>
34
+ **Dataset:** golden_dataset/
35
+ **Script:** eval.py --type=<type>
36
+ **Thresholds:** accuracy ≥ <value>, F1 ≥ <value>
37
+
38
+ ## Overall Results
39
+
40
+ | Metric | Value | 95% CI | Threshold | Status |
41
+ |-----------|--------|----------------|-----------|---------|
42
+ | Accuracy | <val> | [<low>, <high>]| ≥ <thr> | ✓/✗ PASS/FAIL |
43
+ | F1 Score | <val> | — | ≥ <thr> | ✓/✗ PASS/FAIL |
44
+ | Precision | <val> | — | — | — |
45
+ | Recall | <val> | — | — | — |
46
+ | Samples | <n> | — | — | — |
47
+
48
+ **Overall: PASS / FAIL**
49
+
50
+ ## Convergence Analysis
51
+
52
+ ```mermaid
53
+ xychart-beta
54
+ title "Metric Evolution vs Sample Count"
55
+ x-axis "Samples" [<sample_points>]
56
+ y-axis "Score" 0.0 --> 1.0
57
+ line "Accuracy" [<accuracy_values>]
58
+ line "F1 Score" [<f1_values>]
59
+ ```
60
+
61
+ **Stability Analysis:**
62
+ - Accuracy change over last <window> samples: <change> percentage points
63
+ - F1 change over last <window> samples: <change> percentage points
64
+
65
+ **Recommendation:** <"Dataset appears sufficient for confident evaluation" | "Add more samples — metrics have not yet stabilized">
66
+
67
+ ## Per-item Results
68
+
69
+ | ID | Input Summary | Expected | Actual | Correct |
70
+ |-----|---------------|----------|--------|---------|
71
+ | 001 | <summary> | <label> | <label>| ✓ |
72
+ | 002 | <summary> | <label> | <label>| ✗ |
73
+
74
+ ## Notes
75
+
76
+ - <observations, failure patterns, MLflow run link>
77
+ ```
78
+
79
+ **Confidence interval:** The 95% CI for accuracy MUST be computed using the **Wilson score interval** (preferred over the normal approximation for small $n$). A wide interval signals that the dataset is too small to support confident conclusions and the sample count should be increased.
80
+
81
+ The Wilson score bounds at 95% confidence ($z = 1.96$) are:
82
+
83
+ $$\frac{\hat{p} + \frac{z^2}{2n} \pm z\sqrt{\frac{\hat{p}(1-\hat{p})}{n} + \frac{z^2}{4n^2}}}{1 + \frac{z^2}{n}}$$
84
+
85
+ Where $\hat{p}$ is observed accuracy and $n$ is sample count. Accuracy and F1 are required; precision and recall are recommended.
86
+
87
+ **Convergence analysis:** The Convergence Analysis section shows whether adding more samples would likely change measured metrics. The section MUST include:
88
+
89
+ 1. **Mermaid xychart-beta** showing cumulative Accuracy and F1 evolution:
90
+ - X-axis: absolute cumulative sample count; Y-axis: metric value (0.0 to 1.0)
91
+ - Two lines: Accuracy and F1
92
+ - For datasets > 50 samples: sample at `floor(dataset_size / 10)` intervals (minimum 5), always include first and last points
93
+ - For datasets ≤ 50 samples: show all points
94
+
95
+ 2. **Stability analysis**: compute absolute change (percentage points) for both Accuracy and F1 over last `min(10, dataset_size)` samples. Example: Accuracy from 0.85 to 0.87 = 0.02 = 2 percentage points.
96
+
97
+ 3. **Recommendation**:
98
+ - Default threshold: both Accuracy AND F1 change ≤ 2 percentage points
99
+ - If both meet threshold: "Dataset appears sufficient for confident evaluation"
100
+ - If either exceeds: "Add more samples — metrics have not yet stabilized"
101
+ - Projects MAY customize threshold (document in Makefile/README)
102
+
103
+ Exclude from `report-human.md` (no automated metrics).
104
+
105
+ **Filled-in example** (`evals/workflow-document-review/eval-basic/report-functional.md` for a document review workflow):
106
+
107
+ ```markdown
108
+ # Eval Report: eval-basic — functional
109
+
110
+ **Date:** 2026-06-12
111
+ **Dataset:** golden_dataset/
112
+ **Script:** eval.py --type=functional
113
+ **Thresholds:** accuracy ≥ 0.85, F1 ≥ 0.80
114
+
115
+ ## Overall Results
116
+
117
+ | Metric | Value | 95% CI | Threshold | Status |
118
+ |-----------|-------|--------------|-----------|-------------|
119
+ | Accuracy | 0.88 | [0.69, 0.97] | ≥ 0.85 | ✓ PASS |
120
+ | F1 Score | 0.86 | — | ≥ 0.80 | ✓ PASS |
121
+ | Precision | 0.89 | — | — | — |
122
+ | Recall | 0.84 | — | — | — |
123
+ | Samples | 25 | — | — | — |
124
+
125
+ **Overall: PASS**
126
+
127
+ > Note: CI [0.69, 0.97] is wide — 25 samples may be insufficient for high confidence. Consider expanding the dataset.
128
+
129
+ ## Convergence Analysis
130
+
131
+ ```mermaid
132
+ xychart-beta
133
+ title "Metric Evolution vs Sample Count"
134
+ x-axis "Samples" [1, 5, 10, 15, 20, 25]
135
+ y-axis "Score" 0.0 --> 1.0
136
+ line "Accuracy" [0.60, 0.80, 0.85, 0.87, 0.88, 0.88]
137
+ line "F1 Score" [0.55, 0.78, 0.83, 0.85, 0.86, 0.86]
138
+ ```
139
+
140
+ **Stability Analysis:**
141
+ - Accuracy change over last 10 samples: 0.01 percentage points
142
+ - F1 change over last 10 samples: 0.01 percentage points
143
+
144
+ **Recommendation:** Dataset appears sufficient for confident evaluation
145
+
146
+ > Metrics stabilized after ~15 samples. Changes over last 10 samples are well below the 2 percentage point threshold.
147
+
148
+ ## Per-item Results
149
+
150
+ | ID | Input Summary | Expected | Actual | Correct |
151
+ |-----|--------------------------------------|----------|----------|---------|
152
+ | 001 | Contract renewal, 3 pages, standard | approve | approve | ✓ |
153
+ | 002 | NDA with unusual liability clause | escalate | escalate | ✓ |
154
+ | 003 | Vendor invoice, missing PO number | reject | reject | ✓ |
155
+ | 004 | Employment agreement, standard terms| approve | approve | ✓ |
156
+ | 005 | Amendment with redlined IP clause | escalate | approve | ✗ |
157
+
158
+ ## Notes
159
+
160
+ - Sample 005 misclassified: redlined IP clause not flagged as escalation trigger. Possible model drift.
161
+ - MLflow run: experiment `workflow-document-review/eval-basic`, tag `test_types=functional` — view with `mlflow ui`
162
+ ```
163
+ ```
164
+
165
+ **`human` type artifact:** instead of `report-human.md` with metrics, `--type=human` produces a checklist artifact (still named `report-human.md`) listing, per entry, its `input`, `expected_output.human_test` instructions, and the captured `actual_output` — with no Overall Results table, threshold, or PASS/FAIL section, since this type MUST NOT be auto-scored.
166
+
167
+ ## References
168
+
169
+ - [agentme-edr-053](053-ai-eval-script.md) — AI eval script: the script that produces these reports (rule `01`)
170
+ - [agentme-edr-055](055-ai-eval-repeatability.md) — AI eval repeatability: rule `02` defines the adapted report shape for `report-repeatability.md`
171
+ - [agentme-edr-051](051-ai-eval-core-standards.md) — AI eval core standards: folder structure (rule `01`) and LLM-as-judge binary scoring (rule `02`)
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: agentme-edr-policy-055-ai-eval-repeatability
3
+ description: Defines the repeatability test type for AI evals — REPEAT_COUNT loop exception to the entry-first constraint, semantic-similarity and LLM-as-judge scoring methods, repeatability_accuracy metric, and the repeatability report format and run cadence. Use when implementing repeatability evals. For the entry-first constraint see agentme-edr-053 rule 01. For LLM-as-judge binary output see agentme-edr-051 rule 02. For the base report template see agentme-edr-054 rule 01. For the repeatability test type definition see agentme-edr-052.
4
+ apply-to: Python AI projects (LLM, Agent, or Workflow tier) that implement repeatability eval testing
5
+ valid-from: 2026-07-07
6
+ ---
7
+
8
+ # agentme-edr-policy-055: AI eval repeatability
9
+
10
+ ## Context and Problem Statement
11
+
12
+ Some AI components must be tested for output consistency across multiple invocations with the same input — a property the standard entry-first eval loop cannot capture because it invokes each entry only once. Without a shared repeatability protocol, teams either skip this test or implement ad-hoc variations that produce incomparable results.
13
+
14
+ How should repeatability be measured in evals, and how should its results be reported?
15
+
16
+ ## Decision Outcome
17
+
18
+ **Exempt `repeatability` entries from the entry-first constraint, invoking each `REPEAT_COUNT` times and scoring via semantic-similarity or LLM-as-judge; schedule at release cadence rather than per-commit.**
19
+
20
+ For the `repeatability` test type definition and its disambiguation from `reproducibility`, see [agentme-edr-052](052-ai-test-types-taxonomy.md) rule `09`.
21
+
22
+ ### Details
23
+
24
+ #### 01-repeatability-eval-loop-exception
25
+
26
+ Entries whose `test_types` includes `repeatability` are exempt from [agentme-edr-053](053-ai-eval-script.md) rule `01`'s "invoke exactly once per entry" constraint. The following constants MUST be declared in `eval.py` and MUST NOT be exposed as Makefile variables, CLI flags, or stored as per-entry dataset fields:
27
+
28
+ - `REPEAT_COUNT` — number of times each repeatability entry is invoked. SHOULD default to 3-5 for routine CI runs and 10-20 for focused passes on decision-critical or previously-flagged components. Projects SHOULD calibrate the value once per component by plotting cumulative pass rate against repeat count for a few representative entries and picking the point where it plateaus, rather than guessing.
29
+ - `EVAL_MIN_ACCURACY_REPEATABILITY` — minimum fraction of repeatability entries that must PASS for the eval to exit 0.
30
+ - `REPEAT_SEMANTIC_SIMILARITY_SCORE` — minimum average pairwise cosine similarity for a single entry to PASS; declared only when using semantic-similarity scoring.
31
+
32
+ `eval.py` MUST invoke the component `REPEAT_COUNT` times for every repeatability entry and score the resulting outputs by comparing them to each other. `expected_output` is unused for repeatability entries and SHOULD be omitted or set to `null` in the dataset.
33
+
34
+ **Choosing the scoring method:** Two approaches are supported, declared as a constant in `eval.py`:
35
+
36
+ - **Semantic-similarity:** Embed all `REPEAT_COUNT` outputs for an entry into vectors and compute the average pairwise cosine similarity. The entry passes (score = 1) if the average similarity ≥ `REPEAT_SEMANTIC_SIMILARITY_SCORE`; otherwise it fails (score = 0). Use for classification or short structured outputs.
37
+ - **LLM-as-judge:** Provide all `REPEAT_COUNT` outputs for an entry to an LLM judge (kept at low/zero temperature) that returns 0 (fail) or 1 (pass) directly, based on whether the outputs are sufficiently consistent. No `REPEAT_SEMANTIC_SIMILARITY_SCORE` constant is needed. Use for free-text or complex structured outputs where vector distance is an unreliable proxy for agreement. The judge MUST follow [agentme-edr-051](051-ai-eval-core-standards.md) rule `02`'s binary output contract.
38
+
39
+ **`repeatability_accuracy`:** the fraction of repeatability entries that received PASS (score = 1), logged to MLflow as `repeatability_accuracy`. The eval exits non-zero if `repeatability_accuracy` < `EVAL_MIN_ACCURACY_REPEATABILITY`. Both `repeatability_accuracy` and `repeat_count` MUST be logged to MLflow and included in `report-repeatability.md` (rule `02`).
40
+
41
+ ```python
42
+ REPEAT_COUNT = 5
43
+ EVAL_MIN_ACCURACY_REPEATABILITY = 0.8
44
+ REPEAT_SEMANTIC_SIMILARITY_SCORE = 0.9 # only when using semantic-similarity scoring
45
+
46
+ for entry in repeatability_entries:
47
+ outputs = [invoke_component(entry, graph) for _ in range(REPEAT_COUNT)]
48
+ entry_pass = score_agreement(outputs) # returns 0 or 1; expected_output is not used
49
+ results["repeatability"].append(entry_pass) # 1 = PASS, 0 = FAIL
50
+
51
+ repeatability_accuracy = sum(results["repeatability"]) / len(results["repeatability"])
52
+ mlflow.log_metric("repeatability_accuracy", repeatability_accuracy)
53
+ mlflow.log_metric("repeat_count", REPEAT_COUNT)
54
+
55
+ if repeatability_accuracy < EVAL_MIN_ACCURACY_REPEATABILITY:
56
+ raise SystemExit(f"Eval failed: repeatability_accuracy {repeatability_accuracy:.2f} < {EVAL_MIN_ACCURACY_REPEATABILITY}")
57
+ ```
58
+
59
+ `mock_fixtures` configuration per [agentme-edr-053](053-ai-eval-script.md) rule `01` applies to each of the `REPEAT_COUNT` invocations. Any prompt or response caching (provider-side or gateway-side) MUST be bypassed for these invocations — a cache hit would return an identical cached response and falsely report perfect stability instead of measuring the model's actual variance.
60
+
61
+ **Scoping:** this test type MUST NOT be applied to components whose intended behavior is diverse or creative output (e.g. brainstorming, creative writing) — low agreement there is correct behavior, not a defect.
62
+
63
+ #### 02-repeatability-report-and-cadence
64
+
65
+ `--type=repeatability` MUST produce `report-repeatability.md` with a shape adapted from [agentme-edr-054](054-ai-eval-report-format.md) rule `01`'s template: the header MUST include a **Repeat count:** line stating the `REPEAT_COUNT` value used for the run, alongside the usual Date/Dataset/Script/Thresholds lines. The body MUST have an aggregate row reporting `repeatability_accuracy` (the fraction of entries that PASS — see rule `01`) with a Wilson score interval computed over the number of `repeatability` entries, plus a per-item table listing each entry's individual pass/fail result and, when using semantic-similarity, its computed average pairwise cosine similarity — instead of the `Expected | Actual | Correct` columns used by other types.
66
+
67
+ Because `repeatability` entries multiply real LLM-provider calls by `REPEAT_COUNT`, projects SHOULD schedule `make eval-repeatability` at release cadence rather than on every commit, aligned with the Workflow eval cadence in [agentme-edr-007](../governance/007-project-quality-standards.md) rule `09`, rather than treating it as a mandatory per-commit gate.
68
+
69
+ ## References
70
+
71
+ - [agentme-edr-053](053-ai-eval-script.md) — AI eval script: rule `01` defines the entry-first constraint this policy exempts for repeatability entries
72
+ - [agentme-edr-051](051-ai-eval-core-standards.md) — AI eval core standards: rule `02` defines the LLM-as-judge binary output contract used by the LLM-as-judge scoring method in rule `01`
73
+ - [agentme-edr-054](054-ai-eval-report-format.md) — AI eval report format: rule `01` defines the base report template that `report-repeatability.md` adapts
74
+ - [agentme-edr-052](052-ai-test-types-taxonomy.md) — AI test types taxonomy: `repeatability` test type definition and disambiguation from `reproducibility` (rule `09`)
75
+ - [agentme-edr-007](../governance/007-project-quality-standards.md) — Project quality standards: Workflow eval cadence (rule `09`) that repeatability runs align with