# AI Content Publish Gate & Provenance

> Four gates in front of an AI writer's publish path: a named human approval, near-duplicate titles, unverifiable first-person claims, and an immutable slug and publish date. Ships a PostgreSQL trigger, a provenance record, a bypass audit, and 61 tests.

AI Content Publish Gate & Provenance is a paid AI agent skill on Agensi by Tive Fi, in Marketing & SEO. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $15 (one-time purchase)
- Creator: [Tive Fi](https://www.agensi.io/creators/tive-fi)
- Category: [Marketing & SEO](https://www.agensi.io/skills/marketing-seo)
- Version: 1.0
- Last updated: 2026-11-30
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ai-content-publish-gate-provenance
- Tags: marketing, writing, content-moderation, postgresql, python, cms-security

## About this skill

An AI writer with database credentials is a publishing pipeline that can go live on its own. This skill puts four gates in front of that path, installs the same rule in the database, and records who checked what — so "AI draft, human review" is a constraint instead of a promise in a policy document.

THE PROBLEM IT SOLVES

Every team that publishes with an agent has the same conversation: the model writes, a person is supposed to review, nobody can prove that the review happened or that it happened before the date in the sitemap. Then a cron job publishes one unreviewed post, or a translation batch bumps updated_at and every article suddenly claims to be freshly updated, or two posts are written about the same question three weeks apart.

The gate exists because the failure is not a bad sentence. It is a missing step in the path between the draft and the reader.

THE FOUR GATES
1. HUMAN APPROVAL. A publish request passes only when approval_confirmed is the boolean true and reviewed_by is a name. A string "true", a 1, an empty value and a placeholder like "AI" or "test" all fail. The writer never supplies either field on its own behalf.

2. NEAR DUPLICATE. The title's token Jaccard similarity is compared with every published title. At 0.50 or above the draft is held and the report names the post it collided with (duplicate_of: title, slug, similarity), so the agent picks a different topic instead of rewording the headline.

3. UNVERIFIABLE EXPERIENCE. First-person and private-environment claims that an article cannot evidence are held with the matched text and its context: "I personally tested", "in our production cluster", "our team benchmarked", "제가 직접 테스트한 결과", "우리 회사에서는", "장애의 43%". Three honest fixes are offered for each: rewrite as procedure, source it, or release it explicitly with --allow-claim, which is recorded in the report.

4. IMMUTABLE FIELDS. An update may not change slug, published_at or reviewed_at. The URL holds the page's history, a rewritten publish date is a false date, and the review record is history; a re-review belongs in an audit log.

Each run prints one JSON report — PASS or HELD_AS_DRAFT — with the gate that blocked, the evidence for it, and the next step. Exit codes 0/1/2 make it usable in CI.

BEYOND THE CHECK
- DATABASE TRIGGER. references/publish-gate.sql installs enforce_review_before_publish(): a move into published without reviewed_at and reviewed_by raises an exception. Edits and upserts of already-published rows pass. The function never assigns status or published_at — a gate that "fixes" a row can silently unpublish someone's article. A second trigger freezes the three identity fields. trigger-test.sql runs twelve cases and ends in ROLLBACK.

- WRITE-PATH GUARD. The request contract, the column whitelist, the held_as_draft response, and sketches for Node/Next, Django and Rails.

- PROVENANCE RECORD. verifiedAt, reviewScope (what was checked AND what was not), environment, officialSources with https links, reviewer human|ai. The validator fails when a page's dateModified equals the row's updated_at, when dateModified has no contentUpdatedAt behind it, or when datePublished disagrees with published_at. The jsonld command refuses to emit a date the record cannot support.

- PIPELINE AUDIT. Scans code and SQL for the ways around the gate: status assigned the literal 'published', a published_at copied from another row, a hard-coded reviewer, approval flipped in code, updated_at rendered as dateModified, a DEFAULT 'published', a COMMIT inside the gate migration, a trigger function that assigns state, or a skip-approval switch. Test and fixture paths are reported as suppressed rather than hidden.

WHAT MAKES IT DIFFERENT
- It works at the layer the failure happens in. A checklist tells a person to review; a trigger makes the database refuse the row.

- The gate audits itself: the package passes its own scanner, and the tests include an unguarded sample that must fail and a guarded one that must not.

- Date integrity is treated as part of the gate, not a formatting concern. Row updated_at is never allowed to become dateModified, lastmod or a badge.

- It refuses to backfill review records for old posts. A fabricated record destroys the only evidence you had.

- Standard-library Python 3.8+, no network, no keys, no model calls. There is nothing to authenticate and nothing that can call out.

WHAT'S INSIDE

- SKILL.md — the workflow, four gates, five invariants, the limits.

- 4 scripts: gate_check.py (gates → JSON), evidence_builder.py (build/validate/jsonld), audit_pipeline.py (bypass scan), gate_common.py.

- 6 references: publish-gate.sql, trigger-test.sql, gate-policy.md, write-path-guard.md, provenance-schema.md, checklist.md.

- 25 example files: a 15-row corpus (14 published) as JSON and CSV, one passing draft with its provenance record and page, two blocked drafts (duplicate, fake experience in English and Korean), one blocked update, an unguarded and a guarded write path, a bad gate migration, and eight reference reports.

- 61 tests you can run in under a second.

WHO IT'S FOR
- Teams whose agent or script writes into a Postgres/Supabase CMS.

- Anyone who has to answer "who reviewed this, and when" about an AI-assisted post.

- Sites that publish in more than one language and have seen updated_at drift.

- Agents with shell or repo access: the package is files and commands, not a hosted service.

REQUIREMENTS

- Python 3.8 or newer, standard library only.

- Postgres 12+ for the database trigger (Postgres 17 tested). MySQL works with the API guard alone.

- A list of published titles for gate 2, from an export or one SELECT.

KNOWN LIMITATIONS

- Gate 2 compares title tokens, not meaning. Two posts can serve one search intent with no shared words; search data or a human decides that case.

- Gate 3 is a pattern match. It misses paraphrases and occasionally holds a legitimate sentence; a held draft is a question for the reviewer.

- The gate cannot prove a human read the draft. It makes skipping review hard, visible and attributable, and records who is accountable.

- No ranking, traffic or ad-approval outcome is promised. This protects integrity, not performance.

- The bundled SQL targets a posts table with id, slug, status, reviewed_at, reviewed_by. Adapting it is a column rename and a comment in the file.

VERSION 1.0.0

## Requires

- Python

## Known limitations

PostgreSQL-specific triggers. Title similarity checks are token-based, not semantic. Requires existing published titles in JSON/CSV for duplicate detection.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the AI Content Publish Gate & Provenance skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this gate differ from simply prompting an AI agent not to publish without permission?

This skill functions as a hard technical barrier at the database and API level, preventing AI agents from publishing content—even if they ignore their system prompts or instructions—unless specific human-approval metadata is present.

### Which database systems and web frameworks are compatible with the AI Content Publish Gate?

The skill is built for PostgreSQL and Python environments, but it includes implementation patterns for popular web frameworks like Django, Next.js, and Ruby on Rails to ensure your API remains secure regardless of your frontend choice.

### What specific files and assets are included in the skill package?

You will receive the PostgreSQL trigger scripts, the Python CLI tool for similarity and claim checking, an audit script to identify insecure write paths, and standard implementation patterns for major web frameworks.

### How does the duplicate content detection work to protect my SEO?

The skill uses Jaccard similarity to compare new titles against your existing database, flagging potential duplicates to prevent keyword cannibalization before the content ever reaches your live site.

### What does the initial installation process look like for an existing content pipeline?

Setup involves running the provided audit script to find existing publish paths, applying the PostgreSQL triggers to your database schema, and integrating the CLI check into your agent's pre-publish workflow.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
