Skip to content

Repository files navigation

The Gate

Deployment layer:The-Gate-VPS runs this engine in production as a multi-tenant MCP server, exposing evaluation as agent-callable tools.

Docs:PRD · Changelog

An editorial quality gate API. Submit a draft and a brief; receive a machine-readable verdict with a scored rubric, evidence quotes, and specific revision instructions. Fixed eight-criterion evaluation — the model cannot freestyle.


Verdicts

Every evaluation returns one of four outcomes:

VerdictMeaning
APPROVEDMeets the bar. Publish or pass forward.
APPROVED_WITH_NOTESPasses with documented weaknesses — review the gaps before publishing.
REVISEFails one or more criteria. revision_instructions is populated. Send back to the writer.
BLOCKEDHard failure. Do not publish. Fabrication, severe brief mismatch, or fundamental structural problem.

Evaluation structure

Every response includes:

  • Scorecard — each criterion scored 1–5 with an assessment and a verbatim quote from the draft as evidence
  • Strengths — what's working and why
  • Gaps — what's missing or weak, with specifics
  • Revision instructions — populated only on REVISE / BLOCKED; tells the writer exactly what to fix
  • Confidence score — how certain the model is about the verdict

Universal criteria (all modes)

CriterionWhat it checks
context_groundingNo invented facts or sources not in the brief
brief_fidelityAnswers what was asked — format, audience, scope, length
completenessNo placeholders, no [TBD], no trailing sections
internal_consistencyNo contradictions in claims, tone, or structure
specificityConcrete and evidence-backed, not generic

Modes

Apply domain-specific criteria on top of the universal five:

ModeAdditional criteria
contentvoice_compliance, structural_quality, factual_integrity
strategystrategic_alignment, actionability, audience_calibration
technicaltechnical_accuracy, reproducibility, safety_completeness
communicationtone_appropriateness, clarity, call_to_action

API

Base URL: /api

Authentication

Gate evaluations and review history — Bearer token:

Authorization: Bearer gate_sk_<prefix>_<secret>

Key management — Admin secret header:

X-Admin-Secret: <GATE_ADMIN_SECRET>

Core endpoints

POST /api/gate Run an evaluation
GET /api/gate/reviews List reviews for the authenticated key
GET /api/gate/reviews/:id Get a single review by UUID
POST /api/gate/keys Create an API key
GET /api/gate/keys List all keys
DELETE /api/gate/keys/:prefix Revoke a key
GET /api/healthz Health check (no auth)

Request — POST /api/gate

{
"draft": "string (required, 1–50000 chars)",
"brief": "string (required, 1–5000 chars)",
"voice_guide": "string (optional, max 10000 chars)",
"mode": "content | strategy | technical | communication (default: content)"
}

Response

{
"id": "uuid",
"verdict": "APPROVED | APPROVED_WITH_NOTES | REVISE | BLOCKED",
"confidence": 0.0,
"weighted_score": 1.0,
"criteria_results": {
"<criterion>": {
"pass": true,
"score": 1,
"assessment": "string",
"evidence": "verbatim quote from the draft"
}
},
"strengths": ["string"],
"gaps": ["string"],
"revision_instructions": "string | null",
"missing_context": "string | null",
"meta": {
"mode": "content",
"draft_hash": "string",
"has_voice_guide": false,
"rate_limit": { "used": 1, "limit": 100, "reset_at": "ISO 8601" }
}
}

Full OpenAPI 3.1.0 spec: lib/api-spec/openapi.yaml


Stack

LayerTechnology
RuntimeNode.js 24
FrameworkExpress 5
ORMDrizzle ORM
DatabasePostgreSQL
AIAnthropic claude-sonnet via AI Integrations
Buildesbuild (single-file bundle)
LanguageTypeScript (strict)

Running locally

pnpm install
pnpm --filter @workspace/db run push # push DB schema on first run
pnpm --filter @workspace/api-server run dev

Server starts on $PORT (default 8080 in dev).

Environment variables

VariableDescription
GATE_ADMIN_SECRETRequired for all key management endpoints
ANTHROPIC_API_KEYAnthropic API key
DATABASE_URLPostgreSQL connection string
PORTServer port

Self-hosting

The API is plain Node.js/Express with no platform-specific runtime dependencies. Deploy configs for Railway, Render, and VPS are included (railway.json, render.yaml, DEPLOY-VPS.md). Build output is a single bundled .mjs file.

pnpm run build # bundles to dist/index.mjs
pnpm run start # node --enable-source-maps ./dist/index.mjs

Contact:signalstudio.io · editorial.operating.system@gmail.com

About

Editorial quality gate API. Fixed 8-criterion rubric, 1–5 scoring with evidence quotes, machine-readable verdicts: APPROVED / REVISE / BLOCKED. TypeScript · Express 5 · PostgreSQL · OpenAPI 3.1 · Claude.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages