postmo 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- postmo/__init__.py +49 -0
- postmo/disciplines.py +138 -0
- postmo/evidence.py +146 -0
- postmo/ledger.py +132 -0
- postmo/overlay.py +74 -0
- postmo/record.py +352 -0
- postmo/scans.py +433 -0
- postmo-1.0.0.dist-info/METADATA +186 -0
- postmo-1.0.0.dist-info/RECORD +12 -0
- postmo-1.0.0.dist-info/WHEEL +5 -0
- postmo-1.0.0.dist-info/licenses/LICENSE +21 -0
- postmo-1.0.0.dist-info/top_level.txt +1 -0
postmo/scans.py
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
"""The codeable core: mechanical linter checks for the five disciplines.
|
|
2
|
+
|
|
3
|
+
Honesty note, stated once and enforced by the tests: the phrase-list
|
|
4
|
+
checks are tripwires, not proof. They catch the mechanical signatures
|
|
5
|
+
of discipline violations — subordinating conjunctions, downgrade
|
|
6
|
+
wordlists, unattributed motive attributions, tidy-restatement phrases —
|
|
7
|
+
and emit REVIEW items for the operator. A fired check is a finding;
|
|
8
|
+
a quiet check is not a clean bill of health. What needs judgment
|
|
9
|
+
lives in the discipline table (`disciplines.py`), marked as operator
|
|
10
|
+
protocol, and stays there.
|
|
11
|
+
|
|
12
|
+
Overlap note: the subordinator scan and the HeldTension / PersonState /
|
|
13
|
+
Correction records mirror `evasion_audit/ground.py` (the probe+forge
|
|
14
|
+
conversion). This package stays standalone and dependency-free, so the
|
|
15
|
+
definitions are duplicated here rather than imported — the wordlists
|
|
16
|
+
are intentionally identical so the two packages can't silently
|
|
17
|
+
disagree. See README "Overlap with evasion_audit".
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import re
|
|
23
|
+
from dataclasses import dataclass, field
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ScanError(ValueError):
|
|
27
|
+
"""Raised when a scan input breaks the record rules."""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def sentences(text: str) -> list[str]:
|
|
31
|
+
"""Split text into sentences. Rough is fine — this is a tripwire."""
|
|
32
|
+
return [s.strip() for s in re.split(r"(?<=[.!?])\s+", text.strip()) if s.strip()]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# --- Discipline 1: subordinating-conjunction scan -----------------------------
|
|
36
|
+
|
|
37
|
+
# Conjunctions and connectives that privilege one side of a tension.
|
|
38
|
+
# "X is true. Y is also true." stays. "X is true, but Y" is rejected —
|
|
39
|
+
# the "but" resolves the contradiction by demoting X.
|
|
40
|
+
SUBORDINATORS = (
|
|
41
|
+
"but", "however", "although", "though", "yet", "whereas",
|
|
42
|
+
"nevertheless", "nonetheless", "which means", "in other words",
|
|
43
|
+
"so really", "that is to say",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
_SUB_RE = re.compile(
|
|
47
|
+
r"\b(" + "|".join(re.escape(s) for s in SUBORDINATORS) + r")\b",
|
|
48
|
+
re.IGNORECASE,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def find_subordinators(text: str) -> list[str]:
|
|
53
|
+
"""Return the subordinating conjunctions found in the text."""
|
|
54
|
+
return sorted({m.group(0).lower() for m in _SUB_RE.finditer(text)})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class HeldTension:
|
|
59
|
+
"""One pair of opposing facts, held live as parallel sentences.
|
|
60
|
+
|
|
61
|
+
"I adored her and I'm furious at her" is two sentences, not one
|
|
62
|
+
with a 'but'. The constructor enforces it — a tension that
|
|
63
|
+
subordinates one side has already resolved the contradiction
|
|
64
|
+
in grammar, and the audit refuses to hold it.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
text: str
|
|
68
|
+
|
|
69
|
+
def __post_init__(self) -> None:
|
|
70
|
+
if not self.text.strip():
|
|
71
|
+
raise ScanError("Held tension must not be empty.")
|
|
72
|
+
bad = find_subordinators(self.text)
|
|
73
|
+
if bad:
|
|
74
|
+
raise ScanError(
|
|
75
|
+
f"Held tension uses subordinating language {bad}: "
|
|
76
|
+
f"{self.text!r}. Restate as parallel non-subordinating "
|
|
77
|
+
"sentences — 'X is true. Y is also true.'"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# --- Discipline 2: time-indexed person-states ---------------------------------
|
|
82
|
+
|
|
83
|
+
# Permanent-label language: nouns of character applied as fixed verdicts.
|
|
84
|
+
# "He's a liar" is a verdict; "he was lying on Tuesday" is a state.
|
|
85
|
+
# Adjectives ("dangerous", "difficult") are deliberately NOT here — they
|
|
86
|
+
# can legitimately describe a moment. This list is nouns only.
|
|
87
|
+
VERDICT_WORDS = (
|
|
88
|
+
"liar", "fraud", "monster", "narcissist", "psychopath", "sociopath",
|
|
89
|
+
"manipulator", "abuser", "predator", "saint", "angel",
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
_VERDICT_RE = re.compile(
|
|
93
|
+
r"\b(is|are|was|were|'s|'re)\s+(such\s+a\s+|a\s+|an\s+|the\s+)?("
|
|
94
|
+
+ "|".join(re.escape(w) for w in VERDICT_WORDS)
|
|
95
|
+
+ r")\b",
|
|
96
|
+
re.IGNORECASE,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(frozen=True)
|
|
101
|
+
class VerdictWordHit:
|
|
102
|
+
sentence: str
|
|
103
|
+
word: str
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def find_verdict_words(text: str) -> list[VerdictWordHit]:
|
|
107
|
+
"""Flag permanent-label language for operator review.
|
|
108
|
+
|
|
109
|
+
A hit is a REVIEW item, not a rejection — the operator decides
|
|
110
|
+
whether the teller's own word stands (recorded as their CLAIM) or
|
|
111
|
+
the auditor smuggled in a verdict.
|
|
112
|
+
"""
|
|
113
|
+
hits: list[VerdictWordHit] = []
|
|
114
|
+
for sentence in sentences(text):
|
|
115
|
+
for match in _VERDICT_RE.finditer(sentence):
|
|
116
|
+
hits.append(VerdictWordHit(sentence=sentence, word=match.group(3).lower()))
|
|
117
|
+
return hits
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@dataclass(frozen=True)
|
|
121
|
+
class PersonState:
|
|
122
|
+
"""One person, one moment, one observed state. Time-indexed."""
|
|
123
|
+
|
|
124
|
+
when: str
|
|
125
|
+
person: str
|
|
126
|
+
state: str
|
|
127
|
+
|
|
128
|
+
def __post_init__(self) -> None:
|
|
129
|
+
for label, value in (("when", self.when), ("person", self.person),
|
|
130
|
+
("state", self.state)):
|
|
131
|
+
if not value.strip():
|
|
132
|
+
raise ScanError(f"PersonState.{label} must not be empty.")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# --- Discipline 3: correction typing -------------------------------------------
|
|
136
|
+
|
|
137
|
+
CORRECTION_KINDS = ("detail", "core-claim")
|
|
138
|
+
|
|
139
|
+
# Sentences that look like corrections but haven't been typed yet.
|
|
140
|
+
# Matched as plain substrings — this is a tripwire, not a parser, and
|
|
141
|
+
# every marker here is distinctive enough that substring matching is
|
|
142
|
+
# the honest implementation.
|
|
143
|
+
CORRECTION_MARKERS = (
|
|
144
|
+
"actually", "no wait", "correction:", "to be clear,",
|
|
145
|
+
"let me correct", "i misspoke", "that was wrong",
|
|
146
|
+
"not quite —", "not quite -",
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@dataclass(frozen=True)
|
|
151
|
+
class Correction:
|
|
152
|
+
"""A correction typed by what changed.
|
|
153
|
+
|
|
154
|
+
DETAIL: a particular fact is revised (a time, an object, a peripheral
|
|
155
|
+
sequence detail). Does not touch any core claim standing elsewhere —
|
|
156
|
+
never let it trigger re-litigation of an uncorrected core claim.
|
|
157
|
+
CORE-CLAIM: a decision, boundary, conclusion, or central assertion is
|
|
158
|
+
revised. Core-claim changes are the signal: they mark where the
|
|
159
|
+
account itself shifted.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
kind: str # "detail" | "core-claim"
|
|
163
|
+
text: str
|
|
164
|
+
|
|
165
|
+
def __post_init__(self) -> None:
|
|
166
|
+
if self.kind not in CORRECTION_KINDS:
|
|
167
|
+
raise ScanError(
|
|
168
|
+
f"Correction kind must be 'detail' or 'core-claim', got {self.kind!r}."
|
|
169
|
+
)
|
|
170
|
+
if not self.text.strip():
|
|
171
|
+
raise ScanError("Correction text must not be empty.")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@dataclass(frozen=True)
|
|
175
|
+
class CorrectionCandidate:
|
|
176
|
+
"""A correction-like sentence that hasn't been typed yet.
|
|
177
|
+
|
|
178
|
+
The skill's rule: if ambiguous which kind, ask rather than guess.
|
|
179
|
+
The scan surfaces candidates; the operator types them.
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
sentence: str
|
|
183
|
+
marker: str
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def find_correction_candidates(text: str) -> list[CorrectionCandidate]:
|
|
187
|
+
"""Flag correction-like sentences that need typing (D3, operator step)."""
|
|
188
|
+
found: list[CorrectionCandidate] = []
|
|
189
|
+
for sentence in sentences(text):
|
|
190
|
+
lowered = sentence.lower()
|
|
191
|
+
for marker in CORRECTION_MARKERS:
|
|
192
|
+
if marker in lowered:
|
|
193
|
+
found.append(CorrectionCandidate(sentence=sentence, marker=marker))
|
|
194
|
+
break
|
|
195
|
+
return found
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# --- Discipline 4: supplied-motive detection -----------------------------------
|
|
199
|
+
|
|
200
|
+
# Attributions that make a motive/causal claim legitimate — the teller
|
|
201
|
+
# (or a named source) assigned the why.
|
|
202
|
+
ATTRIBUTION_MARKERS = (
|
|
203
|
+
"said", "stated", "told me", "according to", "in her words",
|
|
204
|
+
"in his words", "in their words", "she thinks", "he thinks",
|
|
205
|
+
"they think", "i think", "my read", "my take",
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
# Explicit guess-flags: a requested read on motive is allowed when
|
|
209
|
+
# marked as a guess, never narrated as settled fact.
|
|
210
|
+
GUESS_MARKERS = (
|
|
211
|
+
"if i had to guess", "my guess is", "possibly", "maybe",
|
|
212
|
+
"perhaps", "could be that", "i wonder if",
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# Motive/causal attributions: claims about WHY someone did something,
|
|
216
|
+
# or what was going on inside them — stated without attribution.
|
|
217
|
+
MOTIVE_PATTERNS = (
|
|
218
|
+
r"because\s+(he|she|they)\s+\w+ed\b", # "because he panicked"
|
|
219
|
+
r"because\s+(he|she|they)\s+(was|were)\s+\w+ing\b", # "because she was testing"
|
|
220
|
+
r"\b(he|she|they)\s+(panicked|felt|feels|feared|resented|envied)\b",
|
|
221
|
+
r"\bdriven by\b",
|
|
222
|
+
r"\bmotivated by\b",
|
|
223
|
+
r"\bin order to\b",
|
|
224
|
+
r"\bout of\s+(spite|fear|jealousy|anger|guilt|shame|love)\b",
|
|
225
|
+
r"\b(wanted|needed)\s+to\s+(feel|prove|show|hurt|punish|control)\b",
|
|
226
|
+
r"\bwas trying to\s+(hurt|punish|control|manipulate|prove)\b",
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
_MOTIVE_RES = tuple(re.compile(p, re.IGNORECASE) for p in MOTIVE_PATTERNS)
|
|
230
|
+
_ATTRIBUTION_RE = re.compile(
|
|
231
|
+
r"\b(" + "|".join(re.escape(m) for m in ATTRIBUTION_MARKERS) + r")\b|\"",
|
|
232
|
+
re.IGNORECASE,
|
|
233
|
+
)
|
|
234
|
+
_GUESS_RE = re.compile(
|
|
235
|
+
r"\b(" + "|".join(re.escape(m) for m in GUESS_MARKERS) + r")\b",
|
|
236
|
+
re.IGNORECASE,
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
@dataclass(frozen=True)
|
|
241
|
+
class MotiveFlag:
|
|
242
|
+
"""One unattributed motive/causal attribution.
|
|
243
|
+
|
|
244
|
+
severity "flag": supplied motive, no attribution — a D4 violation.
|
|
245
|
+
severity "guess": explicitly marked as a guess — allowed, but must
|
|
246
|
+
stay marked; the record keeps it so a later session can't quietly
|
|
247
|
+
promote it to fact.
|
|
248
|
+
"""
|
|
249
|
+
|
|
250
|
+
sentence: str
|
|
251
|
+
pattern: str
|
|
252
|
+
severity: str # "flag" | "guess"
|
|
253
|
+
|
|
254
|
+
def __post_init__(self) -> None:
|
|
255
|
+
if self.severity not in ("flag", "guess"):
|
|
256
|
+
raise ScanError(f"Bad motive-flag severity: {self.severity!r}.")
|
|
257
|
+
if not self.sentence.strip():
|
|
258
|
+
raise ScanError("Motive flag needs the flagged sentence.")
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def detect_supplied_motive(text: str) -> list[MotiveFlag]:
|
|
262
|
+
"""Flag motive attributions with no teller attribution (D4).
|
|
263
|
+
|
|
264
|
+
"He tackled you because he panicked" → flag. "He said he panicked"
|
|
265
|
+
→ clean (the teller assigned the why). "If I had to guess, he
|
|
266
|
+
panicked" → guess (allowed, kept marked).
|
|
267
|
+
"""
|
|
268
|
+
flags: list[MotiveFlag] = []
|
|
269
|
+
for sentence in sentences(text):
|
|
270
|
+
lowered = sentence.lower()
|
|
271
|
+
matched = next(
|
|
272
|
+
(p for p, rx in zip(MOTIVE_PATTERNS, _MOTIVE_RES) if rx.search(sentence)),
|
|
273
|
+
None,
|
|
274
|
+
)
|
|
275
|
+
if not matched:
|
|
276
|
+
continue
|
|
277
|
+
if _GUESS_RE.search(sentence):
|
|
278
|
+
flags.append(MotiveFlag(sentence=sentence, pattern=matched, severity="guess"))
|
|
279
|
+
elif not _ATTRIBUTION_RE.search(sentence):
|
|
280
|
+
flags.append(MotiveFlag(sentence=sentence, pattern=matched, severity="flag"))
|
|
281
|
+
# attributed motive ("he said he panicked") is clean — the
|
|
282
|
+
# teller assigned the why, so discipline 4 is satisfied.
|
|
283
|
+
return flags
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
# --- Discipline 5: softening detection ------------------------------------------
|
|
287
|
+
|
|
288
|
+
# Strong terms (threat/harm/betrayal language) and their soft replacements.
|
|
289
|
+
# A restatement that swaps the left column for the right is softening.
|
|
290
|
+
DOWNGRADE_PAIRS: tuple[tuple[str, str], ...] = (
|
|
291
|
+
("betrayal", "mistake"), ("betrayed", "mistake"),
|
|
292
|
+
("lied", "misspoke"), ("lying", "misspeaking"),
|
|
293
|
+
("threatened", "warned"), ("threat", "concern"),
|
|
294
|
+
("harmed", "hurt"), ("harm", "hurt"),
|
|
295
|
+
("abused", "mistreated"), ("abuse", "mistreatment"),
|
|
296
|
+
("attacked", "confronted"), ("attack", "confrontation"),
|
|
297
|
+
("stole", "took"), ("stolen", "taken"),
|
|
298
|
+
("cheated", "was unfaithful"), ("cheating", "infidelity"),
|
|
299
|
+
("manipulated", "influenced"), ("manipulation", "influence"),
|
|
300
|
+
("gaslit", "confused"), ("gaslighting", "confusion"),
|
|
301
|
+
("dangerous", "difficult"), ("terrified", "uncomfortable"),
|
|
302
|
+
("terrifying", "uncomfortable"),
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
STRONG_TERMS = frozenset(strong for strong, _ in DOWNGRADE_PAIRS)
|
|
306
|
+
|
|
307
|
+
# "So what you're saying is…" restatements that tidy the account.
|
|
308
|
+
TIDY_PHRASES = (
|
|
309
|
+
"so what you're saying is", "so what you are saying is",
|
|
310
|
+
"in other words,", "to summarize,", "essentially,",
|
|
311
|
+
"basically,", "the bottom line is",
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
# Resolving ambivalence into one "real" feeling.
|
|
315
|
+
AMBIVALENCE_PHRASES = (
|
|
316
|
+
"the real feeling", "what you really mean", "what you really feel",
|
|
317
|
+
"actually you just", "deep down you", "the truth is you",
|
|
318
|
+
"your real", "admit it",
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
_TIDY_RE = re.compile(
|
|
322
|
+
r"\b(" + "|".join(re.escape(p.rstrip(",")) for p in TIDY_PHRASES) + r")\b",
|
|
323
|
+
re.IGNORECASE,
|
|
324
|
+
)
|
|
325
|
+
_AMBIVALENCE_RE = re.compile(
|
|
326
|
+
r"\b(" + "|".join(re.escape(p) for p in AMBIVALENCE_PHRASES) + r")\b",
|
|
327
|
+
re.IGNORECASE,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
@dataclass(frozen=True)
|
|
332
|
+
class SofteningFlag:
|
|
333
|
+
"""One caught softening.
|
|
334
|
+
|
|
335
|
+
kind "downgrade": a strong term became a soft one
|
|
336
|
+
("betrayal" → "mistake").
|
|
337
|
+
kind "dropped": a strong term vanished with no replacement.
|
|
338
|
+
kind "tidy-restatement": "so what you're saying is…" — a restatement
|
|
339
|
+
that tidies the account.
|
|
340
|
+
kind "ambivalence-resolved": "the real feeling is…" — ambivalence
|
|
341
|
+
resolved into one feeling.
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
kind: str
|
|
345
|
+
detail: str
|
|
346
|
+
original_term: str = ""
|
|
347
|
+
replacement: str = ""
|
|
348
|
+
|
|
349
|
+
def __post_init__(self) -> None:
|
|
350
|
+
if self.kind not in ("downgrade", "dropped", "tidy-restatement",
|
|
351
|
+
"ambivalence-resolved"):
|
|
352
|
+
raise ScanError(f"Bad softening-flag kind: {self.kind!r}.")
|
|
353
|
+
if not self.detail.strip():
|
|
354
|
+
raise ScanError("Softening flag needs a detail.")
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def _word_present(word: str, text: str) -> bool:
|
|
358
|
+
return re.search(r"\b" + re.escape(word) + r"\b", text, re.IGNORECASE) is not None
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def detect_softening(original: str, restatement: str) -> list[SofteningFlag]:
|
|
362
|
+
"""Compare the teller's words against a restatement (D5).
|
|
363
|
+
|
|
364
|
+
Catches: strong terms downgraded to soft ones, strong terms dropped
|
|
365
|
+
entirely, tidy-restatement phrases, and ambivalence-resolution
|
|
366
|
+
phrases in the restatement. What it cannot catch — generous
|
|
367
|
+
interpretations supplied unasked, evasive answers — stays operator
|
|
368
|
+
protocol (see disciplines.py D5).
|
|
369
|
+
"""
|
|
370
|
+
flags: list[SofteningFlag] = []
|
|
371
|
+
for strong, soft in DOWNGRADE_PAIRS:
|
|
372
|
+
if _word_present(strong, original) and not _word_present(strong, restatement):
|
|
373
|
+
if _word_present(soft, restatement):
|
|
374
|
+
flags.append(SofteningFlag(
|
|
375
|
+
kind="downgrade",
|
|
376
|
+
detail=f"{strong!r} in the original became {soft!r} in the restatement.",
|
|
377
|
+
original_term=strong, replacement=soft,
|
|
378
|
+
))
|
|
379
|
+
else:
|
|
380
|
+
flags.append(SofteningFlag(
|
|
381
|
+
kind="dropped",
|
|
382
|
+
detail=f"{strong!r} appears in the original but not in the restatement.",
|
|
383
|
+
original_term=strong,
|
|
384
|
+
))
|
|
385
|
+
tidy = _TIDY_RE.search(restatement)
|
|
386
|
+
if tidy:
|
|
387
|
+
flags.append(SofteningFlag(
|
|
388
|
+
kind="tidy-restatement",
|
|
389
|
+
detail=f"Restatement uses a tidying phrase: {tidy.group(0)!r}.",
|
|
390
|
+
))
|
|
391
|
+
ambivalence = _AMBIVALENCE_RE.search(restatement)
|
|
392
|
+
if ambivalence:
|
|
393
|
+
flags.append(SofteningFlag(
|
|
394
|
+
kind="ambivalence-resolved",
|
|
395
|
+
detail=f"Restatement resolves ambivalence: {ambivalence.group(0)!r}.",
|
|
396
|
+
))
|
|
397
|
+
return flags
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
# --- Batch audit: run every mechanical check at once ----------------------------
|
|
401
|
+
|
|
402
|
+
@dataclass
|
|
403
|
+
class ScanReport:
|
|
404
|
+
"""Everything the mechanical checks found in one text (or pair)."""
|
|
405
|
+
|
|
406
|
+
subordinators: list[str] = field(default_factory=list)
|
|
407
|
+
verdict_words: list[VerdictWordHit] = field(default_factory=list)
|
|
408
|
+
correction_candidates: list[CorrectionCandidate] = field(default_factory=list)
|
|
409
|
+
motive_flags: list[MotiveFlag] = field(default_factory=list)
|
|
410
|
+
softening_flags: list[SofteningFlag] = field(default_factory=list)
|
|
411
|
+
|
|
412
|
+
def clean(self) -> bool:
|
|
413
|
+
"""True when no check fired. Not a clean bill of health — see the
|
|
414
|
+
honesty note at the top of this module."""
|
|
415
|
+
return not (self.subordinators or self.verdict_words
|
|
416
|
+
or self.correction_candidates or self.motive_flags
|
|
417
|
+
or self.softening_flags)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def scan_text(text: str, *, restatement: str = "") -> ScanReport:
|
|
421
|
+
"""Run every mechanical check over `text`.
|
|
422
|
+
|
|
423
|
+
Pass the auditor's restatement as `restatement` to enable the D5
|
|
424
|
+
softening comparison. Everything that fires is a REVIEW item for
|
|
425
|
+
the operator — the scan finds, the operator decides.
|
|
426
|
+
"""
|
|
427
|
+
return ScanReport(
|
|
428
|
+
subordinators=find_subordinators(text),
|
|
429
|
+
verdict_words=find_verdict_words(text),
|
|
430
|
+
correction_candidates=find_correction_candidates(text),
|
|
431
|
+
motive_flags=detect_supplied_motive(text),
|
|
432
|
+
softening_flags=detect_softening(text, restatement) if restatement else [],
|
|
433
|
+
)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: postmo
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Hold a messy multi-person situation without resolving it: five audit disciplines as linter checks plus a full structured audit record.
|
|
5
|
+
Author: Ryan Wesley Hitchcock
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ohpersonperson/frontface
|
|
8
|
+
Keywords: audit,contradiction,linter,evidence,interrogation
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# postmo — hold the mess, don't resolve it
|
|
18
|
+
|
|
19
|
+
An audit is not a narrative. A narrative resolves tension toward a
|
|
20
|
+
single coherent story; an audit holds the actual shape of what's been
|
|
21
|
+
said — including the parts that don't resolve — and tracks it
|
|
22
|
+
accurately as it changes.
|
|
23
|
+
|
|
24
|
+
Five disciplines, enforced where they're mechanical and explicit
|
|
25
|
+
protocol where they need judgment:
|
|
26
|
+
|
|
27
|
+
1. **Hold contradictions as contradictions.** "I adored her and I'm
|
|
28
|
+
furious at her" stays two live halves — never "X, but Y", never a
|
|
29
|
+
synthesized third thing, never flagged as a problem needing
|
|
30
|
+
resolution.
|
|
31
|
+
2. **Track people as time-indexed states, not verdicts.** Tuesday-her
|
|
32
|
+
and Thursday-her are both real. Nobody is "a liar" as a fixed label.
|
|
33
|
+
3. **Type every correction: detail vs core-claim.** A fixed date doesn't
|
|
34
|
+
reopen standing claims; a withdrawn accusation is the signal.
|
|
35
|
+
4. **Never supply motive the teller didn't state.** "He tackled you
|
|
36
|
+
because he panicked" is invented, even if plausible. Observed
|
|
37
|
+
sequence only — who did what, in what order.
|
|
38
|
+
5. **Self-check for softening.** Did "betrayal" become "mistake"? Did a
|
|
39
|
+
restatement tidy the account? Did ambivalence get resolved into one
|
|
40
|
+
"real" feeling? The noticing is part of the deliverable.
|
|
41
|
+
|
|
42
|
+
No prerequisites. No model, no network — the operator (human or model)
|
|
43
|
+
supplies the material; the library enforces the discipline. The
|
|
44
|
+
mechanism is the whole product.
|
|
45
|
+
|
|
46
|
+
*(Lineage: the front-facing conversion of the `forensic-situational-audit`
|
|
47
|
+
skill from Ryan's skill-suite, MIT. What changed is documented in
|
|
48
|
+
CHANGELOG.md — the name, the "field" language, and prose rules turned
|
|
49
|
+
into checked code.)*
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
Two modes:
|
|
54
|
+
|
|
55
|
+
- **Direct audit (the headline).** "Don't resolve this, just hold it."
|
|
56
|
+
The operator works a messy multi-person situation conversationally;
|
|
57
|
+
the package scans drafts for discipline violations and accumulates
|
|
58
|
+
the audit record. No engine, no interrogation.
|
|
59
|
+
- **Overlay.** Attaches to the interrogation engine's Decompose phase
|
|
60
|
+
(disciplines 2–4) and Collide phase (disciplines 1, 5 — the strict
|
|
61
|
+
enforcer: no subordinating conjunctions, no synthesized third thing).
|
|
62
|
+
The overlay never resolves, never synthesizes, never converts a
|
|
63
|
+
direct audit into an interrogation unasked.
|
|
64
|
+
|
|
65
|
+
The canonical artifact is the **audit record**: which disciplines
|
|
66
|
+
fired, held tensions, person-state sequences, typed corrections,
|
|
67
|
+
softening and motive flags — structured data with timestamps that the
|
|
68
|
+
next session can load and continue from. Machine-readable first
|
|
69
|
+
(`record.render()`), renderable conversationally
|
|
70
|
+
(`record.render_conversation()`).
|
|
71
|
+
|
|
72
|
+
## Why it works
|
|
73
|
+
|
|
74
|
+
Most "holding space" collapses into narrative smoothing — the grammar
|
|
75
|
+
does the resolving before anyone notices. The audit attacks that
|
|
76
|
+
mechanically:
|
|
77
|
+
|
|
78
|
+
- **The subordinator scan** rejects "X, but/however/which means Y" in
|
|
79
|
+
held tensions. The "but" demotes one side; the audit refuses to hold
|
|
80
|
+
a tension that's already been resolved in grammar.
|
|
81
|
+
- **The motive scan** flags causal attributions with no teller
|
|
82
|
+
attribution ("because he panicked") while passing attributed ones
|
|
83
|
+
("he said he panicked") and keeping marked guesses marked.
|
|
84
|
+
- **The softening scan** compares the teller's words against
|
|
85
|
+
restatements: downgrade wordlist ("betrayal" → "mistake"), dropped
|
|
86
|
+
strong terms, tidy-restatement phrases ("so what you're saying is"),
|
|
87
|
+
ambivalence-resolution phrases ("the real feeling is").
|
|
88
|
+
- **The stand-down rule** is schema-level: the record rejects
|
|
89
|
+
synthesis/resolution/verdict sections. An audit that resolves has
|
|
90
|
+
stopped auditing.
|
|
91
|
+
|
|
92
|
+
What the scans can't do stays explicitly operator protocol — each
|
|
93
|
+
discipline's table entry (`disciplines.py`) marks the code/operator
|
|
94
|
+
split. A fired check is a finding; a quiet check is not a clean bill
|
|
95
|
+
of health.
|
|
96
|
+
|
|
97
|
+
## Quickstart
|
|
98
|
+
|
|
99
|
+
Zero dependencies beyond Python 3.10+. Fully offline.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cd audit
|
|
103
|
+
PYTHONPATH=src python3 -m unittest discover -s tests # 55 offline tests
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Lint an audit draft:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
PYTHONPATH=src python3 examples/lint_audit.py --text examples/bad-draft.txt \
|
|
110
|
+
--restatement examples/bad-restatement.txt
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Build a record in code:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from postmo import (
|
|
117
|
+
AuditRecord, HeldTension, PersonState, Correction, scan_text,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
rec = AuditRecord(case_name="Warehouse shift dispute")
|
|
121
|
+
rec.tensions.append(HeldTension(text=(
|
|
122
|
+
"Dana says the pallet was already damaged. "
|
|
123
|
+
"Marco says it was intact.")))
|
|
124
|
+
rec.states.append(PersonState(when="2026-09-18", person="Dana",
|
|
125
|
+
state="calm, cooperative"))
|
|
126
|
+
rec.corrections.append(Correction(kind="core-claim",
|
|
127
|
+
text="Marco withdrew the claim that Dana hid the damage."))
|
|
128
|
+
rec.log(1, "enforced", "1 tension held as parallel sentences")
|
|
129
|
+
|
|
130
|
+
report = scan_text("He tackled you because he panicked.")
|
|
131
|
+
for flag in report.motive_flags:
|
|
132
|
+
print(flag.severity, ":", flag.sentence)
|
|
133
|
+
|
|
134
|
+
print(rec.render()) # the machine-readable record
|
|
135
|
+
print(rec.render_conversation()) # the human surface
|
|
136
|
+
|
|
137
|
+
# Next session:
|
|
138
|
+
from postmo import parse
|
|
139
|
+
rec2 = parse(rec.render()) # everything survives the round trip
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Inputs, outputs
|
|
143
|
+
|
|
144
|
+
- **Input:** situation material (prose), held tensions, person-state
|
|
145
|
+
observations, corrections, restatements to check.
|
|
146
|
+
- **Output:** a `ScanReport` (REVIEW items per discipline), and/or a
|
|
147
|
+
rendered `audit-record` Markdown document — complete, timestamped,
|
|
148
|
+
parseable back into the full structured record.
|
|
149
|
+
|
|
150
|
+
## Worked examples
|
|
151
|
+
|
|
152
|
+
- `examples/example-1-workplace-dispute.md` — a full direct-audit
|
|
153
|
+
cycle on a neutral workplace dispute, all five disciplines, record
|
|
154
|
+
and conversational surface.
|
|
155
|
+
- `examples/example-2-lint-flags.md` — the linter catching a bad
|
|
156
|
+
audit draft, flag by flag.
|
|
157
|
+
|
|
158
|
+
*Both situations are constructed for teaching — they show the audit's
|
|
159
|
+
shape, not real findings.*
|
|
160
|
+
|
|
161
|
+
## Overlap with evasion_audit (documented, not imported)
|
|
162
|
+
|
|
163
|
+
Disciplines 1–3 mirror the ground-mapping in `evasion_audit`
|
|
164
|
+
(the probe+forge conversion): the subordinator wordlist, the
|
|
165
|
+
`HeldTension` / `PersonState` / `Correction` records are intentionally
|
|
166
|
+
identical. This package stays standalone and dependency-free, so the
|
|
167
|
+
definitions are duplicated rather than imported — the wordlists match
|
|
168
|
+
so the two packages can't silently disagree. The evidence taxonomy is
|
|
169
|
+
the same 11-tag set all three packages share, vendored here with the
|
|
170
|
+
`check_matches_engine()` fork guard.
|
|
171
|
+
|
|
172
|
+
## FAQ
|
|
173
|
+
|
|
174
|
+
**Does it need the interrogation engine?** No. Direct audit mode is
|
|
175
|
+
standalone and is the headline use. Overlay mode attaches to engine
|
|
176
|
+
phases; with no engine running, the overlay reports the record and
|
|
177
|
+
stops.
|
|
178
|
+
|
|
179
|
+
**Does it resolve anything?** Never. That's the stand-down rule, and
|
|
180
|
+
it's enforced in code, not just in prose.
|
|
181
|
+
|
|
182
|
+
**What does it cost?** Nothing. Stdlib only, no model calls, no network.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT. See LICENSE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
postmo/__init__.py,sha256=CcePLFsYwFD7LdrGmrv_HLuwf3q5aDgfSsJx2aCFnsQ,2254
|
|
2
|
+
postmo/disciplines.py,sha256=a27_j7__SENWV4emq8791PzddktiR-l1WtJ8Z012X0w,6278
|
|
3
|
+
postmo/evidence.py,sha256=jslcBPxZbj24g2D6MzhNKXJZHdPg18hbNQaajNC_kVE,5674
|
|
4
|
+
postmo/ledger.py,sha256=x8TH2et1Jt_UTzLMn49R8YKEiMMykYTW6UoMz-l8qCU,4245
|
|
5
|
+
postmo/overlay.py,sha256=yWFyky3ThMH5oUonaXeulm7T1Yrq5eG1X7cD12cKQbg,2791
|
|
6
|
+
postmo/record.py,sha256=INNDjWVY5rIVUU2ia94qtFynUluEDrG2dVQqt_x7JcQ,14391
|
|
7
|
+
postmo/scans.py,sha256=o1mSUugcX_1SsekvUCrGRS8E7_nHiAHd5IdFVQiAn00,16148
|
|
8
|
+
postmo-1.0.0.dist-info/licenses/LICENSE,sha256=Zx_XafyZDq7qBexUb7tER9kYlBZ0rCVaAwKuqMCfxLE,1078
|
|
9
|
+
postmo-1.0.0.dist-info/METADATA,sha256=CNiPvVF3Aj9G39fK7TXGWgnhOTCRZ_JoXnA95dAUxjs,7455
|
|
10
|
+
postmo-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
11
|
+
postmo-1.0.0.dist-info/top_level.txt,sha256=vb-LaWLQBm7dW4DWz-PmkcsyQUtvCLw1wJjz4Hw0JEY,7
|
|
12
|
+
postmo-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryan Wesley Hitchcock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
postmo
|