Skip to content

README rewrite, eval harness, server-side citation guard - #1

Merged
tchxm merged 3 commits into
mainfrom
readme-eval-citation-guard
Sep 21, 2026
Merged

tchxm merged 3 commits into
mainfrom
readme-eval-citation-guard

Conversation

@tchxm

@tchxm tchxm commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Adds a truthful README, an eval/ harness (SLA routing, failover, citation guard), extracts SLA logic to server/services/sla.js, and adds server/services/citationGuard.js, which strips off-allowlist statute citations from AI-drafted notices (20/20 fabricated caught, 0/20 false positives on synthetic fixtures).

🤖 Generated with Claude Code

tchxm and others added 3 commits September 21, 2026 21:31
…; rewrite README

Extract SLA tier logic into server/services/sla.js (behaviour unchanged).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tions

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d guard

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 21, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Moderate citation-validation, auditability, and evaluation-reporting issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity

Open (3)
What changed in this PR

This PR rewrites documentation, extracts SLA logic, adds server-side citation sanitization, and introduces evaluation tooling.

Changes:

  • Adds citation validation and sanitization for AI-generated notices.
  • Adds SLA, failover, citation, metrics, and vision evaluation tooling.
  • Documents architecture, setup, limitations, and results.

Review findings:

  • Moderate: Correct provider/model attribution in the vision harness.
  • Moderate: Expand citation parsing for abbreviations, bare references, and mixed-authority clauses.
  • Moderate: Expose citation-removal metadata through notice routes.
  • Moderate: Include rejected structured citations in the audit list.
  • Nit: Remove the contributor’s personal email from the README.
File Description
server/​services/​visionAI.js Applies citation guarding to generated notices.
server/​services/​sla.js Provides reusable SLA calculations.
server/​services/​gemini.js Sanitizes generated notice text.
server/​services/​citationGuard.js Defines citation allowlists and sanitization.
server/​routes/​violations.js Uses extracted SLA helpers.
README.md Documents architecture, usage, limitations, and results.
eval/​vision/​run.js Runs labeled-image vision evaluations.
eval/​vision/​labels.template.csv Provides the vision-labeling template.
eval/​tests/​sla.test.js Tests SLA boundaries and status thresholds.
eval/​tests/​metrics.test.js Tests evaluation metric calculations.
eval/​tests/​guardrail_enforcement.test.js Tests application-level citation stripping.
eval/​tests/​failover.test.js Tests provider failover behavior.
eval/​tests/​citations.test.js Tests citation validator fixtures.
eval/​results/​sla_tiers.json Stores SLA evaluation results.
eval/​results/​failover.json Stores failover evaluation results.
eval/​results/​citation_validator.json Stores citation-validator results.
eval/​results/​app_guardrail_passthrough.json Stores guardrail passthrough results.
eval/​results/​app_guardrail_enforcement.json Stores guardrail enforcement results.
eval/​README.md Documents evaluation methodology and caveats.
eval/​package.json Defines evaluation scripts.
eval/​lib/​results.js Writes evaluation results.
eval/​lib/​metrics.js Calculates binary classification metrics.
eval/​fixtures/​citations.json Provides synthetic citation fixtures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const violations = [];
let citations = 0;
for (const clause of clauses) {
const refs = [...clause.matchAll(/(?:Section|Sec\.?|§|Bye-?law|Article)\s*(\d+(?:\.\d+)?(?:-[A-Z]{1,2}|[A-Z])?)/gi)];
Comment thread server/services/gemini.js
success: true,
content: text,
content: guarded.text,
citationsRemoved: guarded.removed,
Comment on lines +539 to +541
const guardedSections = (Array.isArray(parsed.legalSectionsCited) ? parsed.legalSectionsCited : [])
.filter((c) => validateCitations(String(c)).ok);
const citationsRemoved = [...guardedContent.removed, ...guardedConsequences.removed];
@tchxm
tchxm merged commit 75ccd0a into main Sep 21, 2026
1 check passed
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.

2 participants