gitmyhub

writing-harness

Python ★ 20 updated 2d ago

花 4 個月慢慢一步一步調整到可以自動化去防 AI Slop 的機制,包括:CLAUDE.md 跟 Hook 之間的設定跟腳本,目的就是幫助整個系統在運作的時候減少 AI Slop。

A three-checkpoint quality gate that catches AI-style writing patterns in Chinese long-form text before publishing, using automated regex rules plus a required human self-attestation step.

PythonRegexClaude Code hooksOpenAI Codex CLICI pipelinesetup: easycomplexity 2/5

This repository is a quality gate system designed to catch AI-style writing in Chinese long-form text before it gets published. The author spent four months refining it, and the README is written in Traditional Chinese (with an English summary at the top). Its core idea is that telling an AI model to avoid certain patterns with a prompt does not reliably work, so this system uses a three-station checkpoint instead: an input gate before drafting, a mechanical script gate after drafting, and a human judgment gate that requires written self-attestation.

The mechanical gate is a Python script called taiwan-style-check.py. It scans a document for 11 categories of hard rules: things like half-width punctuation mixed into Chinese text, excessive dashes, mainland Chinese vocabulary used in a Taiwan context, overused sentence templates, and filler phrases at the start of sentences. The script exits with code 0 if the document passes and code 10 if it finds violations, listing every hit with a line number. It has no dependencies beyond the Python standard library, so it can run in any editor, any AI coding agent, or a CI pipeline.

The judgment gate (S2) is a set of five questions the writer must answer in writing and attach to the document as evidence. This is meant to prevent the gate from being a checkbox that gets ticked without thought. A separate script compares drafts against edited versions to surface patterns worth adding to the rule library. The rule library is designed to grow only, never shrink: each new flaw found by a human editor either becomes a new regex rule in S1 or a new judgment question in S2.

The system ships with hooks for Claude Code, OpenAI Codex CLI, and NousResearch Hermes. These hooks fire automatically after the AI writes to certain directories and remind the writer that the three stations have not yet been passed. The hooks are warn-only by default.

The methodology is language-independent. The Taiwan-specific vocabulary and punctuation rules live in a separate glossary file that can be swapped for another region's rules. The project is licensed under MIT.

Where it fits