explaingit

scandnavik/writing-harness

15PythonAudience · writerComplexity · 2/5LicenseSetup · easy

TLDR

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.

Mindmap

mindmap
  root((repo))
    Input Gate
      Pre-draft checklist
      AI hook triggers
    Mechanical Gate
      Python script
      11 rule categories
      Exit codes
    Judgment Gate
      5 written questions
      Self-attestation
    Rule Library
      Regex rules
      Grows over time
    AI Hooks
      Claude Code
      OpenAI Codex CLI
      Hermes
    Glossary
      Taiwan vocabulary
      Swappable regions
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Screen Chinese articles or blog posts for AI-sounding phrases before hitting publish.

USE CASE 2

Add to a CI pipeline so every commit to a writing repo is checked automatically.

USE CASE 3

Use the self-attestation questions to build a personal editing habit and keep a paper trail.

USE CASE 4

Swap the glossary file to enforce regional style rules for any Chinese-speaking market.

Tech stack

PythonRegexClaude Code hooksOpenAI Codex CLICI pipeline

Getting it running

Difficulty · easy Time to first run · 5min

Requires only Python standard library. Run taiwan-style-check.py directly on any text file. Optional: wire the included hooks into Claude Code, Codex CLI, or Hermes for automatic post-write checks.

MIT license, free to use, modify, and distribute for any purpose, including commercial projects.

In plain English

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.

Copy-paste prompts

Prompt 1
I'm using writing-harness to check my Chinese draft. Here are the violations taiwan-style-check.py flagged: [paste output]. Suggest natural rewrites for each line that avoid the flagged patterns.
Prompt 2
Based on the writing-harness methodology, review this Chinese paragraph and identify any AI-style filler phrases, overused sentence templates, or punctuation issues I should fix before running the script.
Prompt 3
I want to add a new rule to the writing-harness rule library. The pattern is [describe pattern]. Help me write a Python regex that matches it and exits with code 10 if found.
Prompt 4
Help me answer the five S2 judgment-gate questions for this draft: [paste draft]. Give honest, specific answers I can attach as evidence that a human reviewed the text.
Prompt 5
I want to adapt writing-harness for a different Chinese region. Which parts of the glossary file should I change, and what types of vocabulary or punctuation rules should I add for [region]?
Open on GitHub → Explain another repo

← scandnavik on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.