From 79e9e6856d88106e5c9a9d8eeeb1ef2054fe6b08 Mon Sep 17 00:00:00 2001 From: PsychoSid <75582188+kryptek2000@users.noreply.github.com> Date: Tue, 29 Sep 2026 18:49:47 -0400 Subject: [PATCH] chore: rename Writeprint to HonorCode (name was occupied in this niche) Same project, new name: package, imports, CLI, UI strings, env vars (HONORCODE_JUDGE_*), docs, CI. Verified: 43/43 tests pass, CLI smoke green under the new name. --- .github/workflows/ci.yml | 16 +++++------ README.md | 40 +++++++++++++------------- honorcode/__init__.py | 1 + {writeprint => honorcode}/calibrate.py | 0 {writeprint => honorcode}/cli.py | 12 ++++---- {writeprint => honorcode}/compare.py | 4 +-- {writeprint => honorcode}/export.py | 0 {writeprint => honorcode}/features.py | 0 {writeprint => honorcode}/judge.py | 18 ++++++------ {writeprint => honorcode}/web.py | 12 ++++---- tests/test_judge.py | 12 ++++---- tests/test_web.py | 6 ++-- tests/test_writeprint.py | 10 +++---- writeprint/__init__.py | 1 - 14 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 honorcode/__init__.py rename {writeprint => honorcode}/calibrate.py (100%) rename {writeprint => honorcode}/cli.py (93%) rename {writeprint => honorcode}/compare.py (95%) rename {writeprint => honorcode}/export.py (100%) rename {writeprint => honorcode}/features.py (100%) rename {writeprint => honorcode}/judge.py (91%) rename {writeprint => honorcode}/web.py (96%) delete mode 100644 writeprint/__init__.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98612b1..7ec4d49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# Writeprint CI: unit tests + end-to-end CLI smoke test on every push/PR. +# HonorCode CI: unit tests + end-to-end CLI smoke test on every push/PR. name: ci on: @@ -31,30 +31,30 @@ jobs: - name: CLI smoke test (build, check, calibrate, batch, serve) run: | set -euo pipefail - python -m writeprint.cli build \ + python -m honorcode.cli build \ samples/student_a_baseline1.txt \ samples/student_a_baseline2.txt \ samples/student_a_baseline3.txt \ -o /tmp/base.json --student student_a - python -m writeprint.cli check /tmp/base.json \ + python -m honorcode.cli check /tmp/base.json \ samples/student_a_homework_genuine.txt | grep -q CONSISTENT - python -m writeprint.cli check /tmp/base.json \ + python -m honorcode.cli check /tmp/base.json \ samples/student_a_homework_suspect.txt | grep -q CONVERSATION - python -m writeprint.cli calibrate \ + python -m honorcode.cli calibrate \ --samples samples/student_a_baseline1.txt \ samples/student_a_baseline2.txt \ samples/student_a_baseline3.txt \ --suspect samples/student_a_homework_suspect.txt \ --student student_a -o /tmp/thresholds.json - python -m writeprint.cli batch /tmp/base.json \ + python -m honorcode.cli batch /tmp/base.json \ samples/student_a_homework_genuine.txt \ samples/student_a_homework_suspect.txt \ -o /tmp/results.csv --thresholds /tmp/thresholds.json test "$(wc -l < /tmp/results.csv)" = "3" - (python -m writeprint.cli serve --port 8765 &>/tmp/serve.log & echo $! > /tmp/serve.pid) + (python -m honorcode.cli serve --port 8765 &>/tmp/serve.log & echo $! > /tmp/serve.pid) for i in $(seq 1 20); do curl -sf http://127.0.0.1:8765/ -o /dev/null && break sleep 1 done - curl -sf http://127.0.0.1:8765/ | grep -q Writeprint + curl -sf http://127.0.0.1:8765/ | grep -q HonorCode kill "$(cat /tmp/serve.pid)" diff --git a/README.md b/README.md index 8b1b6bf..5079fbd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Writeprint +# HonorCode **Authorship verification for the classroom — not an AI detector.** -Writeprint compares a student's submission against that student's *own* +HonorCode compares a student's submission against that student's *own* known-genuine writing and reports how far their writing habits diverge. The output is a reading — *consistent*, *mild divergence*, or *worth a conversation* — never a verdict. A human teacher always decides @@ -16,27 +16,27 @@ evasion via paraphrasing. Accusing a student on that basis is unjust. Asking "was this written by *this student*?" is a far more tractable question. Individual writing habits — sentence length, favorite transitions, -punctuation, contractions, function-word rates — form a *writeprint* that is -stable per author and hard to fake wholesale. Writeprint measures divergence +punctuation, contractions, function-word rates — form a writing +fingerprint that is stable per author and hard to fake wholesale. HonorCode measures divergence from that baseline. ## Quickstart (no dependencies, Python 3.8+) ```bash # 1. Build a baseline from 2+ samples of known-genuine writing -python -m writeprint.cli build samples/student_a_baseline1.txt \ +python -m honorcode.cli build samples/student_a_baseline1.txt \ samples/student_a_baseline2.txt \ -o baselines/student_a.json --student student_a # 2. Check a submission -python -m writeprint.cli check baselines/student_a.json \ +python -m honorcode.cli check baselines/student_a.json \ samples/student_a_homework_genuine.txt ``` ## Browser UI (no dependencies, runs offline) ```bash -python -m writeprint.cli serve +python -m honorcode.cli serve # → open http://127.0.0.1:8765 ``` @@ -49,7 +49,7 @@ calls: student text never leaves the machine. ## Batch scoring to CSV ```bash -python -m writeprint.cli batch baselines/student_a.json \ +python -m honorcode.cli batch baselines/student_a.json \ homework1.txt homework2.txt homework3.txt \ -o results.csv [--thresholds baselines/student_a.thresholds.json] ``` @@ -64,10 +64,10 @@ weigh the habits in prose. Offline-first: it does nothing unless you configure it. ```bash -export WRITEPRINT_JUDGE_URL=https://your-endpoint/v1/chat/completions -export WRITEPRINT_JUDGE_MODEL=your-model -export WRITEPRINT_JUDGE_KEY=... # omit for local servers like Ollama -python -m writeprint.cli judge baselines/student_a.json submission.txt +export HONORCODE_JUDGE_URL=https://your-endpoint/v1/chat/completions +export HONORCODE_JUDGE_MODEL=your-model +export HONORCODE_JUDGE_KEY=... # omit for local servers like Ollama +python -m honorcode.cli judge baselines/student_a.json submission.txt ``` Any OpenAI-compatible endpoint works, including a fully local Ollama @@ -122,7 +122,7 @@ Two findings: (Twain/Doyle quote heavily, Austen doesn't) proved scene-dependent rather than author-stable, so it was left out. -Honest scope: Writeprint distinguishes voices with strong personal +Honest scope: HonorCode distinguishes voices with strong personal habit markers. Telling apart polished authors in a shared register — or a student paraphrasing *well* — is beyond v1's features. Corpus: `samples/gutenberg_*` (Huck Finn, Pride & Prejudice, The Adventures @@ -175,13 +175,13 @@ on your own labeled set — genuine pieces plus known-suspect ones: # Leave-one-out scores each genuine sample against the others, # sweeps candidate thresholds, and recommends one (max F1, # ties break toward fewer false flags). -python -m writeprint.cli calibrate \ +python -m honorcode.cli calibrate \ --samples genuine1.txt genuine2.txt genuine3.txt \ --suspect suspect1.txt \ --student student_a -o baselines/student_a.thresholds.json # Use the calibrated threshold when checking -python -m writeprint.cli check baselines/student_a.json submission.txt \ +python -m honorcode.cli check baselines/student_a.json submission.txt \ --thresholds baselines/student_a.thresholds.json ``` @@ -198,11 +198,11 @@ Two warnings, both serious: ## How it works -1. **Extract** (`writeprint/features.py`) — 33 stylometric features per text: +1. **Extract** (`honorcode/features.py`) — 33 stylometric features per text: sentence/word length, type-token ratio, long-word ratio, first-person and contraction rates, punctuation rates, and 20 function-word rates. All rates are per-100-words so texts of different lengths compare fairly. -2. **Baseline** (`writeprint/compare.py`) — per-feature mean/std across the +2. **Baseline** (`honorcode/compare.py`) — per-feature mean/std across the student's samples, with a variance floor so rare habits can't produce explosive z-scores from sparse data. 3. **Compare** — mean absolute z-score across features, with per-feature @@ -223,9 +223,9 @@ Two warnings, both serious: ## Roadmap -- [x] Per-classroom calibration helper (`writeprint calibrate`, v1.1) -- [x] Local browser UI + print-friendly report (`writeprint serve`, v1.2) -- [x] Two-student validation corpus + CSV batch export (`writeprint batch`, v1.3) +- [x] Per-classroom calibration helper (`honorcode calibrate`, v1.1) +- [x] Local browser UI + print-friendly report (`honorcode serve`, v1.2) +- [x] Two-student validation corpus + CSV batch export (`honorcode batch`, v1.3) - [x] Real-prose validation: Gutenberg corpus, honest negative result (v1.4) - [x] Real student writing: ASAP false-flag study, published rates (v1.5) - [x] Opt-in LLM judge for nuanced cases, offline by default (v1.6) diff --git a/honorcode/__init__.py b/honorcode/__init__.py new file mode 100644 index 0000000..e633a6d --- /dev/null +++ b/honorcode/__init__.py @@ -0,0 +1 @@ +"""HonorCode: authorship verification for the classroom.""" diff --git a/writeprint/calibrate.py b/honorcode/calibrate.py similarity index 100% rename from writeprint/calibrate.py rename to honorcode/calibrate.py diff --git a/writeprint/cli.py b/honorcode/cli.py similarity index 93% rename from writeprint/cli.py rename to honorcode/cli.py index 3f29b29..ea1bb07 100644 --- a/writeprint/cli.py +++ b/honorcode/cli.py @@ -1,4 +1,4 @@ -"""Writeprint command line: build baselines, check submissions.""" +"""HonorCode command line: build baselines, check submissions.""" import argparse import json @@ -63,7 +63,7 @@ def cmd_judge(args): baseline, text, baseline.get("student", "?")) assessment = call_judge(system, user, endpoint, api_key, model) except JudgeError as exc: - print("writeprint judge: %s" % exc) + print("honorcode judge: %s" % exc) raise SystemExit(2) print(render_assessment(baseline.get("student", "?"), args.submission, assessment)) @@ -119,7 +119,7 @@ def read_many(paths): def main(argv=None): - parser = argparse.ArgumentParser(prog="writeprint", description="Authorship verification for the classroom.") + parser = argparse.ArgumentParser(prog="honorcode", description="Authorship verification for the classroom.") sub = parser.add_subparsers(dest="cmd", required=True) p_build = sub.add_parser("build", help="Build a baseline from known-genuine samples.") @@ -162,11 +162,11 @@ def main(argv=None): p_judge.add_argument("baseline", help="Baseline JSON from 'build'.") p_judge.add_argument("submission", help="Submission text file to assess.") p_judge.add_argument("--endpoint", default=None, - help="Chat-completions URL (or WRITEPRINT_JUDGE_URL).") + help="Chat-completions URL (or HONORCODE_JUDGE_URL).") p_judge.add_argument("--key", default=None, - help="Bearer token (or WRITEPRINT_JUDGE_KEY).") + help="Bearer token (or HONORCODE_JUDGE_KEY).") p_judge.add_argument("--model", default=None, - help="Model name (or WRITEPRINT_JUDGE_MODEL).") + help="Model name (or HONORCODE_JUDGE_MODEL).") p_judge.set_defaults(func=cmd_judge) args = parser.parse_args(argv) diff --git a/writeprint/compare.py b/honorcode/compare.py similarity index 95% rename from writeprint/compare.py rename to honorcode/compare.py index 346c414..42d823b 100644 --- a/writeprint/compare.py +++ b/honorcode/compare.py @@ -35,7 +35,7 @@ def compare(features, baseline, bands=None, eps=1e-9): """Compare a submission against a baseline profile. bands overrides (BAND_CONSISTENT, BAND_REVIEW), e.g. with values - from `writeprint calibrate --out`. Returns {"score": mean |z| (full precision — round only for display), + from `honorcode calibrate --out`. Returns {"score": mean |z| (full precision — round only for display), "band": ..., "flags": [...]} where flags are per-feature divergences with |z| >= 2, sorted worst first. """ @@ -69,7 +69,7 @@ def compare(features, baseline, bands=None, eps=1e-9): def render_report(student, filename, result): """Render a teacher-readable report (advisory, never a verdict).""" lines = [ - "Writeprint report", + "HonorCode report", " Student: %s" % student, " Submission: %s" % filename, " Score: %.3f (mean |z| vs. baseline)" % result["score"], diff --git a/writeprint/export.py b/honorcode/export.py similarity index 100% rename from writeprint/export.py rename to honorcode/export.py diff --git a/writeprint/features.py b/honorcode/features.py similarity index 100% rename from writeprint/features.py rename to honorcode/features.py diff --git a/writeprint/judge.py b/honorcode/judge.py similarity index 91% rename from writeprint/judge.py rename to honorcode/judge.py index 500647a..cc8cbd9 100644 --- a/writeprint/judge.py +++ b/honorcode/judge.py @@ -10,9 +10,9 @@ endpoint, and never use it as the sole basis for an accusation. Config (flags override env): - WRITEPRINT_JUDGE_URL chat-completions endpoint URL - WRITEPRINT_JUDGE_KEY bearer token (may be empty for local servers) - WRITEPRINT_JUDGE_MODEL model name + HONORCODE_JUDGE_URL chat-completions endpoint URL + HONORCODE_JUDGE_KEY bearer token (may be empty for local servers) + HONORCODE_JUDGE_MODEL model name """ import json @@ -100,14 +100,14 @@ def parse_response(text): def judge_config(endpoint=None, api_key=None, model=None): """Resolve config from flags-or-env. Raises JudgeError if unusable.""" - url = endpoint or os.environ.get("WRITEPRINT_JUDGE_URL", "") - key = api_key if api_key is not None else os.environ.get("WRITEPRINT_JUDGE_KEY", "") - name = model or os.environ.get("WRITEPRINT_JUDGE_MODEL", "") + url = endpoint or os.environ.get("HONORCODE_JUDGE_URL", "") + key = api_key if api_key is not None else os.environ.get("HONORCODE_JUDGE_KEY", "") + name = model or os.environ.get("HONORCODE_JUDGE_MODEL", "") missing = [n for n, v in (("endpoint URL", url), ("model", name)) if not v] if missing: raise JudgeError( - "LLM judge not configured (missing %s). Set WRITEPRINT_JUDGE_URL " - "and WRITEPRINT_JUDGE_MODEL (plus WRITEPRINT_JUDGE_KEY unless " + "LLM judge not configured (missing %s). Set HONORCODE_JUDGE_URL " + "and HONORCODE_JUDGE_MODEL (plus HONORCODE_JUDGE_KEY unless " "your endpoint needs none), or pass --endpoint/--model. " "Any OpenAI-compatible /chat/completions endpoint works, " "including a local Ollama server." % " and ".join(missing)) @@ -144,7 +144,7 @@ def call_judge(system, user, endpoint, api_key, model, timeout=60): def render_assessment(student, filename, assessment): """Render the assessment for the terminal.""" lines = [ - "Writeprint LLM assessment (second opinion — advisory only)", + "HonorCode LLM assessment (second opinion — advisory only)", " Student: %s" % student, " Submission: %s" % filename, " Reading: %s (confidence %.2f)" % ( diff --git a/writeprint/web.py b/honorcode/web.py similarity index 96% rename from writeprint/web.py rename to honorcode/web.py index f0ac387..470e0fb 100644 --- a/writeprint/web.py +++ b/honorcode/web.py @@ -1,4 +1,4 @@ -"""Local browser UI for Writeprint. Standard library only. +"""Local browser UI for HonorCode. Standard library only. Serves a single page on 127.0.0.1: paste baseline samples and a submission, get the report rendered with band coloring and a @@ -20,7 +20,7 @@
-