Skip to content

feat: deployment-readiness criteria + executable RAI evaluation engine - #20

Open
felipelago17 wants to merge 6 commits into
mainfrom
claude/repo-docs-metadata-d92155
Open

feat: deployment-readiness criteria + executable RAI evaluation engine#20
felipelago17 wants to merge 6 commits into
mainfrom
claude/repo-docs-metadata-d92155

Conversation

@felipelago17

Copy link
Copy Markdown
Owner

Summary

  • Deployment-readiness criteria (docs/criteria/deployment-readiness.md): maps three AI-scaling operational barriers drawn from energy-sector field evidence (data trust gap, workflow embedding, workforce readiness) to NIST AI RMF, EU AI Act, and ISO/IEC 42001 crosswalks.
  • Executable RAI evaluation engine (engine/, evaluate.py, scripts/publish_to_docs.py, .github/workflows/rai-eval.yml): end-to-end dry-run evaluation pipeline (stdlib only, no API keys) producing findings.json, findings.sarif (SARIF 2.1.0), and report.md per run; governance crosswalk tags on every finding.

Engine highlights

  • Mock path: deterministic MockProvider (sha1(seed:prompt) % 8) + heuristic judges for toxicity and truthfulness — zero network, zero third-party deps.
  • Live seam: AnthropicProvider stub ready for pip install anthropic + ANTHROPIC_API_KEY; judges have clearly marked seam points for LLM-based scoring.
  • Staged validation (A–D gates, adapted from RAPTOR): genuine → reachable → reproduced → confident; status is confirmed | needs_review | rejected.
  • SARIF output: one rule per test ID with atlas:, nist_ai_rmf:, eu_ai_act:, iso_42001:, owasp_llm: tags; upload-ready for GitHub Advanced Security.
  • Schema validation: engine/schema/finding.schema.json (JSON Schema draft 2020-12, additionalProperties: false); validated via jsonschema when installed, skipped gracefully otherwise.
  • Privacy: --include-text flag is off by default; only SHA-1 hashes of prompt/response stored.

Acceptance criteria verified

python evaluate.py --axis toxicity     --dry-run --seeds 5  # confirmed=0 ✓
python evaluate.py --axis truthfulness --dry-run --seeds 5  # confirmed=0 ✓
python scripts/publish_to_docs.py                           # docs updated ✓

Test plan

  • pip install jsonschema && python evaluate.py --axis toxicity --dry-run --seeds 5 exits 0
  • python evaluate.py --axis truthfulness --dry-run --seeds 5 exits 0; no confirmed findings
  • python scripts/publish_to_docs.py writes docs/evaluation/latest-run.md
  • GitHub Actions workflow (rai-eval.yml) passes on CI (dry-run steps only)
  • SARIF file uploads to GitHub Advanced Security without schema errors

🤖 Generated with Claude Code

https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX


Generated by Claude Code

claude added 5 commits June 27, 2026 11:05
Add docs/criteria/deployment-readiness.md mapping the three operational
AI-scaling barriers (data trust gap, workflow embedding, workforce readiness)
to NIST AI RMF, EU AI Act, and ISO/IEC 42001 crosswalks.

Key figures from practitioner evidence (AI in Energy Summit 2026,
130+ leaders surveyed; Source A):
- Up to 95% of AI initiatives fail to deliver measurable value at scale
  — attributed to operational failure, not algorithmic defects
- ~30% of leaders cite data quality and governance as the primary barrier
- ~85% accuracy threshold required to establish operational trust
- 17% of organizations are "highly prepared" (AI embedded in daily workflows)

EU AI Act hooks: Art. 10 (data governance) and Art. 15 (accuracy/robustness)
noted as evidence-trail anchors; labelled as practitioner survey data,
not legal interpretation. ASL-level crosswalks untouched.

Wire into mkdocs.yml under new Criteria nav section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
Implement the full RAI-Eval engine — turns the Test Catalogue into a
runnable evaluation harness that produces schema-valid, governance-tagged
findings.  Stdlib-only on the dry-run path (no API keys, no network).

Engine layout:
  engine/schema/finding.schema.json     JSON Schema draft-2020-12
  engine/mappings/{toxicity,truthfulness}.mappings.json
  engine/prompts/{toxicity,truthfulness}.sample.jsonl  (benign only)
  engine/models/client.py               MockProvider + AnthropicProvider seam
  engine/judges/{base,toxicity,truthfulness}_judge.py
  engine/validation.py                  A-D staged false-positive gates
  engine/runners/{_base,toxicity,truthfulness}_runner.py
  engine/emitters/sarif_emitter.py      SARIF 2.1.0 with governance rule tags
  engine/README.md

CLI (evaluate.py):
  --axis {toxicity,truthfulness}  --dry-run  --seeds N  --include-text
  --provider {mock,anthropic}  --model  --prompts  --out
  Writes findings.json + findings.sarif + report.md per run.

CI (.github/workflows/rai-eval.yml):
  Runs both axes dry-run, uploads SARIF to GitHub Security, publishes
  docs, archives artifacts.  Live Anthropic run is commented out.

Acceptance criteria (all pass):
  python evaluate.py --axis toxicity --dry-run --seeds 5   # exits 0
  python evaluate.py --axis truthfulness --dry-run --seeds 5  # exits 0
  python scripts/publish_to_docs.py                        # writes latest-run.md
  all required finding keys present; no extra keys;
  toxicity: not all rejected; truthfulness: no confirmed; SARIF 2.1.0 valid.

Wire evaluation/latest-run.md into mkdocs.yml nav.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
CodeQL upload-sarif rejects multiple SARIF files under the same category.
Fix by writing evaluate.py output to out/<axis>/<run_id>/ and uploading
each axis to its own category (rai-eval-toxicity / rai-eval-truthfulness).
Update publish_to_docs.py to scan the new two-level directory structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
Regenerated by local dry-run after fixing axis-scoped output paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Catalogues the modality-dependent guardrail bypass study (arXiv:2607.24859)
as a reusable evaluation template: 2×2 factorial prompt design, FSA/CER
metrics, 116-participant believability study, and governance crosswalk to
NIST AI RMF, EU AI Act, ASL capability thresholds, and ISO/IEC 42001.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFc4mqrrwQKn4ieExoB1rX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants