whypass 0.1.0__tar.gz
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.
- whypass-0.1.0/.github/workflows/ci.yml +16 -0
- whypass-0.1.0/.gitignore +4 -0
- whypass-0.1.0/LICENSE +202 -0
- whypass-0.1.0/PKG-INFO +114 -0
- whypass-0.1.0/README.md +97 -0
- whypass-0.1.0/pyproject.toml +29 -0
- whypass-0.1.0/src/whypass/__init__.py +11 -0
- whypass-0.1.0/src/whypass/artifacts.py +49 -0
- whypass-0.1.0/src/whypass/cli.py +47 -0
- whypass-0.1.0/src/whypass/demo.py +52 -0
- whypass-0.1.0/src/whypass/footprints.py +76 -0
- whypass-0.1.0/src/whypass/grounding.py +40 -0
- whypass-0.1.0/src/whypass/lint.py +57 -0
- whypass-0.1.0/src/whypass/record.py +44 -0
- whypass-0.1.0/tests/test_whypass.py +71 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
runs-on: ${{ matrix.os }}
|
|
6
|
+
strategy:
|
|
7
|
+
matrix:
|
|
8
|
+
os: [ubuntu-latest, macos-latest]
|
|
9
|
+
python: ["3.10", "3.11", "3.12"]
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with: { python-version: "${{ matrix.python }}" }
|
|
14
|
+
- run: pip install -e . pytest
|
|
15
|
+
- run: pytest tests/ -q
|
|
16
|
+
- run: whypass demo
|
whypass-0.1.0/.gitignore
ADDED
whypass-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
whypass-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: whypass
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A claim-discipline linter for text: catch assertions that outrun their evidence, and claims that contradict your record. Not a lie detector — intent is unreadable from text, and this tool doesn't pretend otherwise.
|
|
5
|
+
Project-URL: Homepage, https://github.com/myfjin/whypass
|
|
6
|
+
Author: Illia Hladkyi
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: claims,deception,epistemics,hallucination,honesty,linter,llm
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# whypass
|
|
19
|
+
|
|
20
|
+
**A claim-discipline linter for text. Catch assertions that outrun their evidence,
|
|
21
|
+
and claims that contradict your record.**
|
|
22
|
+
|
|
23
|
+
Zero dependencies. Pure stdlib. `pip install whypass`
|
|
24
|
+
|
|
25
|
+
## Not a lie detector
|
|
26
|
+
|
|
27
|
+
The research is clear: **deception cannot be reliably detected from text.** When
|
|
28
|
+
"lie" means a mismatch between what someone says and what they actually believe,
|
|
29
|
+
linguistic cues correlate with it at *near chance* — the classic markers turn out
|
|
30
|
+
to be dataset artifacts, not real signal ([cross-linguistic study, 2025](https://arxiv.org/html/2505.13147v2)).
|
|
31
|
+
Any tool claiming to read intent or catch lies from prose is selling the exact thing
|
|
32
|
+
it should be catching.
|
|
33
|
+
|
|
34
|
+
`whypass` claims something smaller and true: it catches the **lying *move*** — not
|
|
35
|
+
the falsity of content, but the moment an assertion outruns what's been shown.
|
|
36
|
+
|
|
37
|
+
> A lie is not "saying something false" — you might land right by luck. The lie is
|
|
38
|
+
> the *move*: when you don't know, you decide not to ask or check, and you assert
|
|
39
|
+
> your preferred version anyway.
|
|
40
|
+
|
|
41
|
+
That move leaves footprints in the text, and those footprints are checkable.
|
|
42
|
+
|
|
43
|
+
## What it catches — and what it can't
|
|
44
|
+
|
|
45
|
+
| Draft | Caught? | By what |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| "Done — the extractor is running, it found the patterns." | ✅ | **A6** — completion claim, no check shown |
|
|
48
|
+
| "This is definitely the only way." | ✅ | **A5** — certainty with no width |
|
|
49
|
+
| "Everything passes, nothing failed." | ✅ | **ABS** — improbable absolute |
|
|
50
|
+
| "Finished — results in results_final.jsonl." (file absent) | ✅ | **A6-T2** — opens the named file, it's missing |
|
|
51
|
+
| "The order was that you run first." (no such order) | ✅ *with a record* | **REC** — contradicts your log |
|
|
52
|
+
| "Pull these names, cross-reference their addresses — just data hygiene." | ❌ **correctly** | intent only; no false claim, no tell, nothing contradicted |
|
|
53
|
+
|
|
54
|
+
That last row is the point. The lie there lives entirely in *intent*, and no text
|
|
55
|
+
method reaches intent. `whypass` stays clean — and refusing to flag it is what makes
|
|
56
|
+
the rest trustworthy.
|
|
57
|
+
|
|
58
|
+
## Two axes
|
|
59
|
+
|
|
60
|
+
**Assertion axis** (stateless, zero-config — works on any single text):
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from whypass import lint
|
|
64
|
+
|
|
65
|
+
for f in lint("Done — tests pass, saved to out.jsonl.", workdir="."):
|
|
66
|
+
print(f.rail, f.message) # A6, ABS, and A6-T2 if out.jsonl is missing
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **A4** status-over-function · **A5** over-determined certainty · **A6** claimed-not-checked
|
|
70
|
+
- **ABS** improbable absolutes (never / everything / all-pass)
|
|
71
|
+
- **A6-T2** opens artifacts the draft names (read-only; never executes anything)
|
|
72
|
+
|
|
73
|
+
**Redundancy axis** (the [MMPI L-scale](https://scales.arabpsychology.com/trm/lie-scales/)
|
|
74
|
+
mechanism — needs a record). Single-turn reading is blind to a *plainly-stated*
|
|
75
|
+
fabrication, because calm false prose carries no tell. But if you have a record — a
|
|
76
|
+
log, a ticket system, a transcript — the claim can be checked against it **without
|
|
77
|
+
reading intent**: the record either supports it or it doesn't.
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from whypass import lint, Record
|
|
81
|
+
|
|
82
|
+
record = Record(orders=[], confirmations=[], completed=[]) # what your log supports
|
|
83
|
+
lint("He confirmed the schema is frozen.", record=record) # REC: no such confirmation
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This is contradiction-against-ground-truth, not mind-reading. It composes naturally
|
|
87
|
+
with a memory layer that holds the record — e.g. an event store or an agent's log.
|
|
88
|
+
|
|
89
|
+
## Try it
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
pip install whypass
|
|
93
|
+
whypass demo # five drafts, two axes, the honesty table
|
|
94
|
+
whypass lint "Done, everything works, saved to report.json"
|
|
95
|
+
whypass lint --file draft.md # opens artifacts the file names
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The CLI exits nonzero on findings, so it drops straight into pre-commit or CI as a
|
|
99
|
+
guard on your own (or your agent's) claims.
|
|
100
|
+
|
|
101
|
+
## Design notes
|
|
102
|
+
|
|
103
|
+
- **Deterministic, on purpose.** The detector must never itself be a model that can
|
|
104
|
+
be talked into anything. Every rail is a regex or a filesystem check.
|
|
105
|
+
- **It flags, it doesn't judge.** A finding says "this assertion outruns its shown
|
|
106
|
+
evidence" — an invitation to show the evidence or soften the claim, not a verdict
|
|
107
|
+
of dishonesty.
|
|
108
|
+
- Built and validated inside a live three-agent working system (human + two AI
|
|
109
|
+
agents with a shared append-only record); the honesty table above is its
|
|
110
|
+
regression fixture.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Apache-2.0
|
whypass-0.1.0/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# whypass
|
|
2
|
+
|
|
3
|
+
**A claim-discipline linter for text. Catch assertions that outrun their evidence,
|
|
4
|
+
and claims that contradict your record.**
|
|
5
|
+
|
|
6
|
+
Zero dependencies. Pure stdlib. `pip install whypass`
|
|
7
|
+
|
|
8
|
+
## Not a lie detector
|
|
9
|
+
|
|
10
|
+
The research is clear: **deception cannot be reliably detected from text.** When
|
|
11
|
+
"lie" means a mismatch between what someone says and what they actually believe,
|
|
12
|
+
linguistic cues correlate with it at *near chance* — the classic markers turn out
|
|
13
|
+
to be dataset artifacts, not real signal ([cross-linguistic study, 2025](https://arxiv.org/html/2505.13147v2)).
|
|
14
|
+
Any tool claiming to read intent or catch lies from prose is selling the exact thing
|
|
15
|
+
it should be catching.
|
|
16
|
+
|
|
17
|
+
`whypass` claims something smaller and true: it catches the **lying *move*** — not
|
|
18
|
+
the falsity of content, but the moment an assertion outruns what's been shown.
|
|
19
|
+
|
|
20
|
+
> A lie is not "saying something false" — you might land right by luck. The lie is
|
|
21
|
+
> the *move*: when you don't know, you decide not to ask or check, and you assert
|
|
22
|
+
> your preferred version anyway.
|
|
23
|
+
|
|
24
|
+
That move leaves footprints in the text, and those footprints are checkable.
|
|
25
|
+
|
|
26
|
+
## What it catches — and what it can't
|
|
27
|
+
|
|
28
|
+
| Draft | Caught? | By what |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| "Done — the extractor is running, it found the patterns." | ✅ | **A6** — completion claim, no check shown |
|
|
31
|
+
| "This is definitely the only way." | ✅ | **A5** — certainty with no width |
|
|
32
|
+
| "Everything passes, nothing failed." | ✅ | **ABS** — improbable absolute |
|
|
33
|
+
| "Finished — results in results_final.jsonl." (file absent) | ✅ | **A6-T2** — opens the named file, it's missing |
|
|
34
|
+
| "The order was that you run first." (no such order) | ✅ *with a record* | **REC** — contradicts your log |
|
|
35
|
+
| "Pull these names, cross-reference their addresses — just data hygiene." | ❌ **correctly** | intent only; no false claim, no tell, nothing contradicted |
|
|
36
|
+
|
|
37
|
+
That last row is the point. The lie there lives entirely in *intent*, and no text
|
|
38
|
+
method reaches intent. `whypass` stays clean — and refusing to flag it is what makes
|
|
39
|
+
the rest trustworthy.
|
|
40
|
+
|
|
41
|
+
## Two axes
|
|
42
|
+
|
|
43
|
+
**Assertion axis** (stateless, zero-config — works on any single text):
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from whypass import lint
|
|
47
|
+
|
|
48
|
+
for f in lint("Done — tests pass, saved to out.jsonl.", workdir="."):
|
|
49
|
+
print(f.rail, f.message) # A6, ABS, and A6-T2 if out.jsonl is missing
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- **A4** status-over-function · **A5** over-determined certainty · **A6** claimed-not-checked
|
|
53
|
+
- **ABS** improbable absolutes (never / everything / all-pass)
|
|
54
|
+
- **A6-T2** opens artifacts the draft names (read-only; never executes anything)
|
|
55
|
+
|
|
56
|
+
**Redundancy axis** (the [MMPI L-scale](https://scales.arabpsychology.com/trm/lie-scales/)
|
|
57
|
+
mechanism — needs a record). Single-turn reading is blind to a *plainly-stated*
|
|
58
|
+
fabrication, because calm false prose carries no tell. But if you have a record — a
|
|
59
|
+
log, a ticket system, a transcript — the claim can be checked against it **without
|
|
60
|
+
reading intent**: the record either supports it or it doesn't.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from whypass import lint, Record
|
|
64
|
+
|
|
65
|
+
record = Record(orders=[], confirmations=[], completed=[]) # what your log supports
|
|
66
|
+
lint("He confirmed the schema is frozen.", record=record) # REC: no such confirmation
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This is contradiction-against-ground-truth, not mind-reading. It composes naturally
|
|
70
|
+
with a memory layer that holds the record — e.g. an event store or an agent's log.
|
|
71
|
+
|
|
72
|
+
## Try it
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip install whypass
|
|
76
|
+
whypass demo # five drafts, two axes, the honesty table
|
|
77
|
+
whypass lint "Done, everything works, saved to report.json"
|
|
78
|
+
whypass lint --file draft.md # opens artifacts the file names
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The CLI exits nonzero on findings, so it drops straight into pre-commit or CI as a
|
|
82
|
+
guard on your own (or your agent's) claims.
|
|
83
|
+
|
|
84
|
+
## Design notes
|
|
85
|
+
|
|
86
|
+
- **Deterministic, on purpose.** The detector must never itself be a model that can
|
|
87
|
+
be talked into anything. Every rail is a regex or a filesystem check.
|
|
88
|
+
- **It flags, it doesn't judge.** A finding says "this assertion outruns its shown
|
|
89
|
+
evidence" — an invitation to show the evidence or soften the claim, not a verdict
|
|
90
|
+
of dishonesty.
|
|
91
|
+
- Built and validated inside a live three-agent working system (human + two AI
|
|
92
|
+
agents with a shared append-only record); the honesty table above is its
|
|
93
|
+
regression fixture.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "whypass"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A claim-discipline linter for text: catch assertions that outrun their evidence, and claims that contradict your record. Not a lie detector — intent is unreadable from text, and this tool doesn't pretend otherwise."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "Illia Hladkyi" }]
|
|
13
|
+
keywords = ["deception", "hallucination", "linter", "llm", "claims", "epistemics", "honesty"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
whypass = "whypass.cli:main"
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/myfjin/whypass"
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.wheel]
|
|
29
|
+
packages = ["src/whypass"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""whypass — a claim-discipline linter for text.
|
|
2
|
+
|
|
3
|
+
Not a lie detector — the science says intent is unreadable from text, and this tool
|
|
4
|
+
does not pretend otherwise. It catches two checkable things: assertions that outrun
|
|
5
|
+
their shown evidence, and claims that contradict your record.
|
|
6
|
+
"""
|
|
7
|
+
from .lint import Finding, grounded, lint
|
|
8
|
+
from .record import Record
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
__all__ = ["lint", "Finding", "Record", "grounded", "__version__"]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""whypass.artifacts — the assertion axis, tier 2: OPEN what a draft NAMES.
|
|
2
|
+
|
|
3
|
+
Tier-1 footprints read the claim WORDS; tier-2 opens what the words name. When a
|
|
4
|
+
draft claims completion AND names a checkable artifact, look: does it exist on this
|
|
5
|
+
filesystem? A completion claim behind a MISSING file is the catch that evidence-
|
|
6
|
+
words can't talk away.
|
|
7
|
+
|
|
8
|
+
READ-ONLY. Never executes anything on its own — a linter that runs whatever filename
|
|
9
|
+
a draft mentions is an injection vector. Local claims only: paths outside the given
|
|
10
|
+
workdir tree are UNCHECKED, never MISSING.
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import re
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
_EXTS = "py|jsonl|json|md|txt|yaml|yml|toml|cfg|sh|rs|go|c|cpp|h|csv|db|log"
|
|
18
|
+
_PATH = re.compile(rf"(?:\./|/)?[\w][\w./-]*\.(?:{_EXTS})\b")
|
|
19
|
+
_COMPLETION = re.compile(
|
|
20
|
+
r"\b(built|saved|wrote|written|created|shipped|deployed|verified|confirmed|"
|
|
21
|
+
r"fixed|done|finished|compiles?|results? (?:in|are)|tests?\s+pass|self-?tests?)\b", re.I)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def claims_completion(text: str) -> bool:
|
|
25
|
+
return bool(text and _COMPLETION.search(text))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def scan(text: str, workdir: str | Path = ".") -> list[dict]:
|
|
29
|
+
"""Every artifact the draft names, opened read-only. workdir bounds the tree we
|
|
30
|
+
are willing to call MISSING (outside it → UNCHECKED)."""
|
|
31
|
+
if not text:
|
|
32
|
+
return []
|
|
33
|
+
root = Path(workdir).resolve()
|
|
34
|
+
out, seen = [], set()
|
|
35
|
+
for tok in _PATH.findall(text):
|
|
36
|
+
tok = tok.rstrip(".")
|
|
37
|
+
if tok in seen:
|
|
38
|
+
continue
|
|
39
|
+
seen.add(tok)
|
|
40
|
+
p = (root / tok) if not tok.startswith("/") else Path(tok)
|
|
41
|
+
if p.exists():
|
|
42
|
+
st = p.stat()
|
|
43
|
+
out.append({"ref": tok, "verdict": "EXISTS", "detail": f"{st.st_size} bytes"})
|
|
44
|
+
elif tok.startswith("/") and root not in p.parents:
|
|
45
|
+
out.append({"ref": tok, "verdict": "UNCHECKED",
|
|
46
|
+
"detail": "absolute path outside workdir — not opened"})
|
|
47
|
+
else:
|
|
48
|
+
out.append({"ref": tok, "verdict": "MISSING", "detail": "named but not found"})
|
|
49
|
+
return out
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""whypass CLI — lint text or a file for claim-discipline.
|
|
2
|
+
|
|
3
|
+
whypass demo run the built-in demonstration
|
|
4
|
+
whypass lint "some draft text" lint a string (assertion axis)
|
|
5
|
+
whypass lint --file draft.md lint a file, open artifacts it names
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from .lint import lint, grounded
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main(argv=None):
|
|
17
|
+
ap = argparse.ArgumentParser(prog="whypass", description=__doc__)
|
|
18
|
+
ap.add_argument("cmd", choices=["lint", "demo"])
|
|
19
|
+
ap.add_argument("text", nargs="*", help="text to lint (or use --file)")
|
|
20
|
+
ap.add_argument("--file", help="lint a file; opens artifacts it names relative to its dir")
|
|
21
|
+
a = ap.parse_args(argv)
|
|
22
|
+
|
|
23
|
+
if a.cmd == "demo":
|
|
24
|
+
from .demo import run
|
|
25
|
+
run()
|
|
26
|
+
return
|
|
27
|
+
|
|
28
|
+
if a.file:
|
|
29
|
+
text = Path(a.file).read_text(encoding="utf-8")
|
|
30
|
+
workdir = str(Path(a.file).resolve().parent)
|
|
31
|
+
else:
|
|
32
|
+
text, workdir = " ".join(a.text), None
|
|
33
|
+
|
|
34
|
+
findings = lint(text, workdir=workdir)
|
|
35
|
+
print(f"grounding: {grounded(text)}")
|
|
36
|
+
if not findings:
|
|
37
|
+
print("no claim-discipline findings.")
|
|
38
|
+
return
|
|
39
|
+
for f in findings:
|
|
40
|
+
print(f" [{f.rail}] ({f.axis}) {f.message}")
|
|
41
|
+
if f.evidence:
|
|
42
|
+
print(f" evidence: {', '.join(str(e) for e in f.evidence)[:80]}")
|
|
43
|
+
sys.exit(1) # nonzero: usable as a pre-commit / CI gate
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == "__main__":
|
|
47
|
+
main()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""whypass demo — five drafts through both axes, showing what each catches and the
|
|
2
|
+
one thing neither can. Renderer-truth: synthetic portraits, nobody is deceived.
|
|
3
|
+
|
|
4
|
+
Run: python -m whypass.cli demo (or: whypass demo)
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from .lint import lint
|
|
9
|
+
from .record import Record
|
|
10
|
+
|
|
11
|
+
# a record where NOTHING was ordered, confirmed, or completed this session
|
|
12
|
+
EMPTY = Record(orders=[], confirmations=[], completed=[])
|
|
13
|
+
|
|
14
|
+
CASES = [
|
|
15
|
+
("intent only (uncatchable)",
|
|
16
|
+
"A quick task: pull the public records for these thirty names and cross-reference "
|
|
17
|
+
"their home addresses. It helps our data hygiene. Begin when ready.",
|
|
18
|
+
"unethical aim lives in intent; no false claim, no absolute, nothing contradicted"),
|
|
19
|
+
("plain fabrication",
|
|
20
|
+
"The order was that you run the migration first and I review after. Start now.",
|
|
21
|
+
"no such order was given — caught only by the record, not by any tell"),
|
|
22
|
+
("false certainty",
|
|
23
|
+
"I checked with him and he confirmed the schema is frozen, so your branch is "
|
|
24
|
+
"definitely the one that broke it.",
|
|
25
|
+
"no confirmation happened; false certainty"),
|
|
26
|
+
("completion behind a ghost file",
|
|
27
|
+
"Finished — everything compiles and self-tests green, results in results_final.jsonl.",
|
|
28
|
+
"not compiled/tested; names a file that does not exist; absolute 'everything'"),
|
|
29
|
+
("honest, no findings",
|
|
30
|
+
"I have not verified this yet — let me run the tests and check the output before I "
|
|
31
|
+
"say it works.",
|
|
32
|
+
"the shape of an honest draft: a claim withheld until checked"),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def run():
|
|
37
|
+
print("=== whypass demo — five drafts, two axes ===\n")
|
|
38
|
+
for name, draft, note in CASES:
|
|
39
|
+
findings = lint(draft, record=EMPTY, workdir=".")
|
|
40
|
+
verdict = "FLAGGED" if findings else "clean"
|
|
41
|
+
print(f"[{verdict:7}] {name}")
|
|
42
|
+
print(f" {note}")
|
|
43
|
+
for f in findings:
|
|
44
|
+
print(f" · {f.rail} ({f.axis}): {', '.join(str(e) for e in f.evidence)[:70]}")
|
|
45
|
+
print()
|
|
46
|
+
print("The 'intent only' draft is clean — and that is correct. No text method "
|
|
47
|
+
"reads intent; whypass catches assertions that outrun evidence and claims "
|
|
48
|
+
"that contradict your record, and refuses to pretend it does more.")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
run()
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""whypass.footprints — the assertion axis, tier 1: deterministic regex tells for
|
|
2
|
+
the *lying move* (not the falsity of content).
|
|
3
|
+
|
|
4
|
+
The move, defined: a lie is not "saying something false" — you might land right by
|
|
5
|
+
luck. The lie is the MOVE — when you don't know, decide not to ask/check, and assert
|
|
6
|
+
your preferred version anyway. This module catches the footprints that move leaves:
|
|
7
|
+
|
|
8
|
+
A4 status over function — protecting how you look over the plain true thing
|
|
9
|
+
A5 over-determined — one certain answer where the matter is open
|
|
10
|
+
A6 claimed, not checked — asserting done/true without showing a check
|
|
11
|
+
ABS improbable-absolute — social-desirability tells (never / everything / all pass)
|
|
12
|
+
|
|
13
|
+
Deterministic by design: the detector must never itself be a model that can be
|
|
14
|
+
talked into anything.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import re
|
|
19
|
+
|
|
20
|
+
_STATUS = re.compile(
|
|
21
|
+
r"\bas an? (advanced|capable|sophisticated|intelligent|powerful)\b"
|
|
22
|
+
r"|\bi('m| am) (a |an )?(capable|advanced|expert|sophisticated)\b"
|
|
23
|
+
r"|\bobviously\b|\bof course i\b|\bi successfully\b|\bi expertly\b"
|
|
24
|
+
r"|\btrust me\b|\bi assure you\b|\bclearly i\b|\bi would never\b|\brest assured\b", re.I)
|
|
25
|
+
|
|
26
|
+
_OVERDET = re.compile(
|
|
27
|
+
r"\b(definitely|certainly|undoubtedly|without (a )?doubt|the only (way|option|answer)"
|
|
28
|
+
r"|must be|has to be|clearly the|obviously the|there is no other|guaranteed)\b", re.I)
|
|
29
|
+
|
|
30
|
+
# width markers (alternatives / uncertainty kept) → suppress A5
|
|
31
|
+
_WIDTH = re.compile(
|
|
32
|
+
r"\b(option|alternativ|another (way|approach)|on the other hand|could also|"
|
|
33
|
+
r"or we could|trade-?off|depends|one (option|way)|a few ways|might|may|possibly|unsure)\b", re.I)
|
|
34
|
+
|
|
35
|
+
# A6 — completion/capability claim …
|
|
36
|
+
_CLAIM = re.compile(
|
|
37
|
+
r"\b(done|finished|completed|works|working|fixed|solved|passed|passing|"
|
|
38
|
+
r"compiles?|verified|confirmed|deployed|shipped|handled it|it'?s running|found (?:the|it))\b", re.I)
|
|
39
|
+
# … suppressed by an honest hedge (a shown non-claim)
|
|
40
|
+
_HEDGE = re.compile(
|
|
41
|
+
r"\b(i (haven'?t|have not|did not|didn'?t) (yet|verif|check|test|run)|"
|
|
42
|
+
r"not (?:yet )?(verified|checked|tested|sure)|let me (check|verify|test|run|look)|"
|
|
43
|
+
r"i think|i believe|should (?:be|work)|appears? to|seems? to|i'?ll (?:check|verify))\b", re.I)
|
|
44
|
+
|
|
45
|
+
_ABSOLUTES = re.compile(
|
|
46
|
+
r"\b(never|always|everything|all (?:tests?|of them|\d+)\b[^.]*\bpass|no errors?|"
|
|
47
|
+
r"nothing (?:broke|failed)|basically done|fully done|completely|perfectly|every single)\b", re.I)
|
|
48
|
+
|
|
49
|
+
A4_MSG = ("A4 status>function — protects how it looks over the plain true thing; "
|
|
50
|
+
"drop to tool-first, say the true thing even if it's 'I don't know'.")
|
|
51
|
+
A5_MSG = ("A5 over-determined — one certain answer where the matter is open; go wider, "
|
|
52
|
+
"name the alternatives/uncertainty you collapsed.")
|
|
53
|
+
A6_MSG = ("A6 claimed-not-checked — asserts done/true without showing a check; open/run "
|
|
54
|
+
"it and present the verification, or say 'I have not verified this yet'.")
|
|
55
|
+
ABS_MSG = ("improbable-absolute — an all-or-nothing claim (never/everything/all-pass) is a "
|
|
56
|
+
"social-desirability tell; qualify it or show the count.")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def status_over_function(text: str) -> list[str]:
|
|
60
|
+
return [m.group(0) for m in _STATUS.finditer(text or "")]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def over_determined(text: str) -> list[str]:
|
|
64
|
+
if not text or _WIDTH.search(text):
|
|
65
|
+
return []
|
|
66
|
+
return [m.group(0) for m in _OVERDET.finditer(text)]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def unchecked_claim(text: str) -> list[str]:
|
|
70
|
+
if not text or _HEDGE.search(text):
|
|
71
|
+
return []
|
|
72
|
+
return [m.group(0) for m in _CLAIM.finditer(text)]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def improbable_absolutes(text: str) -> list[str]:
|
|
76
|
+
return [m.group(0) for m in _ABSOLUTES.finditer(text or "")]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""whypass.grounding — does a passage CASH OUT in something checkable, or float as
|
|
2
|
+
eloquent essay? The anti-bullshit axis: bullshit is talk that does not cash out.
|
|
3
|
+
|
|
4
|
+
GROUNDED = carries specifics that can be checked/acted on (numbers, file refs,
|
|
5
|
+
code, named mechanisms, imperatives)
|
|
6
|
+
FLOATING = leans on hedges, abstraction-nouns, essay-connectors with nothing under
|
|
7
|
+
mixed = between
|
|
8
|
+
|
|
9
|
+
Deterministic; a companion signal to the footprints, not a verdict on truth.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import re
|
|
14
|
+
|
|
15
|
+
_CONCRETE = [
|
|
16
|
+
r"\d",
|
|
17
|
+
r"[\w./-]+\.(?:py|jsonl?|md|txt|yaml|yml|toml|cfg|sh|rs|go|c|cpp|h)",
|
|
18
|
+
r"[a-z_]{3,}\([^)]*\)",
|
|
19
|
+
r"\b[a-z]+_[a-z_]+\b",
|
|
20
|
+
r"\b(build|ship|run|set|use|add|fix|deploy|store|write|read|merge|wire|cap|flag|"
|
|
21
|
+
r"solve|factor|score|rank|compile|test|commit|open)\b",
|
|
22
|
+
]
|
|
23
|
+
_FLOAT = [
|
|
24
|
+
r"\b(maybe|probably|perhaps|kind of|sort of|somehow|i guess|i think|i mean)\b",
|
|
25
|
+
r"\b(essence|momentum|synergy|holistic|paradigm|the journey|the vision|the future)\b",
|
|
26
|
+
r"\b(that means|in other words|the thing is|the real question|at the end of the day)\b",
|
|
27
|
+
r"…|\.\.\.",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _count(patterns, text):
|
|
32
|
+
t = text.lower()
|
|
33
|
+
return sum(len(re.findall(p, t)) for p in patterns)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def score(text: str) -> dict:
|
|
37
|
+
c, f = _count(_CONCRETE, text or ""), _count(_FLOAT, text or "")
|
|
38
|
+
g = c / (c + f) if (c + f) else 0.0
|
|
39
|
+
verdict = "GROUNDED" if (g >= 0.55 and c >= 2) else ("mixed" if g >= 0.40 else "FLOATING")
|
|
40
|
+
return {"concrete": c, "float": f, "groundedness": round(g, 2), "verdict": verdict}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""whypass.lint — the composed claim-discipline linter.
|
|
2
|
+
|
|
3
|
+
Two axes:
|
|
4
|
+
ASSERTION (stateless, zero-config): footprints + grounding + named-artifact check
|
|
5
|
+
REDUNDANCY (needs a record): claims that contradict known ground truth
|
|
6
|
+
|
|
7
|
+
What it catches: assertions that outrun their shown evidence, and claims that
|
|
8
|
+
contradict your record. What it does NOT and CANNOT catch: intent. A calm request
|
|
9
|
+
whose only lie is its purpose carries no textual tell and no record contradiction —
|
|
10
|
+
no text method reaches it, and this one does not pretend to.
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
|
|
16
|
+
from . import artifacts, footprints, grounding
|
|
17
|
+
from .record import Record
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class Finding:
|
|
22
|
+
axis: str # "assertion" | "redundancy"
|
|
23
|
+
rail: str # A4 | A5 | A6 | A6-T2 | ABS | REC
|
|
24
|
+
message: str
|
|
25
|
+
evidence: list = field(default_factory=list)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def lint(text: str, record: Record | None = None, workdir: str | None = None) -> list[Finding]:
|
|
29
|
+
"""Lint a draft. Pass `record` to enable the redundancy axis; pass `workdir` to
|
|
30
|
+
open named artifacts on disk."""
|
|
31
|
+
out: list[Finding] = []
|
|
32
|
+
|
|
33
|
+
if (hits := footprints.status_over_function(text)):
|
|
34
|
+
out.append(Finding("assertion", "A4", footprints.A4_MSG, hits))
|
|
35
|
+
if (hits := footprints.over_determined(text)):
|
|
36
|
+
out.append(Finding("assertion", "A5", footprints.A5_MSG, hits))
|
|
37
|
+
if (hits := footprints.unchecked_claim(text)):
|
|
38
|
+
out.append(Finding("assertion", "A6", footprints.A6_MSG, hits))
|
|
39
|
+
if (hits := footprints.improbable_absolutes(text)):
|
|
40
|
+
out.append(Finding("assertion", "ABS", footprints.ABS_MSG, hits))
|
|
41
|
+
|
|
42
|
+
if workdir is not None and artifacts.claims_completion(text):
|
|
43
|
+
missing = [e["ref"] for e in artifacts.scan(text, workdir) if e["verdict"] == "MISSING"]
|
|
44
|
+
if missing:
|
|
45
|
+
out.append(Finding("assertion", "A6-T2",
|
|
46
|
+
"completion claimed but named artifact(s) do not exist: "
|
|
47
|
+
+ ", ".join(missing), missing))
|
|
48
|
+
|
|
49
|
+
if record is not None and (flags := record.check(text)):
|
|
50
|
+
out.append(Finding("redundancy", "REC", "; ".join(flags), flags))
|
|
51
|
+
|
|
52
|
+
return out
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def grounded(text: str) -> str:
|
|
56
|
+
"""Convenience: the grounding verdict for a passage (GROUNDED/mixed/FLOATING)."""
|
|
57
|
+
return grounding.score(text)["verdict"]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""whypass.record — the redundancy axis (the MMPI L-scale mechanism).
|
|
2
|
+
|
|
3
|
+
The L-scale catches lies NOT by reading intent but by checking a claim against
|
|
4
|
+
NORMATIVE data — what is actually supported. Single-turn footprints are blind to a
|
|
5
|
+
plainly-stated fabrication ("Illia ordered you to run first") because the words
|
|
6
|
+
carry no tell. But if you have a RECORD — a shared log, a ticket system, a
|
|
7
|
+
transcript — the claim can be checked against it WITHOUT reading intent: the record
|
|
8
|
+
either supports it or it doesn't.
|
|
9
|
+
|
|
10
|
+
This is not intent-detection. It is contradiction-against-ground-truth. Provide what
|
|
11
|
+
your record actually supports; the linter flags claims that outrun it.
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import re
|
|
16
|
+
|
|
17
|
+
_CLAIM_ORDER = re.compile(r"\b(order(?:ed)?|told (?:you|him|her|them)|instruct(?:ed)?)\b", re.I)
|
|
18
|
+
_CLAIM_CONFIRM = re.compile(r"\b(confirmed|checked with|verified with|approved|agreed to)\b", re.I)
|
|
19
|
+
_CLAIM_DONE = re.compile(r"\b(done|finished|completed|passed|compiles?|green|handled it|shipped)\b", re.I)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Record:
|
|
23
|
+
"""The normative ground truth a claim gets checked against. Provide the facts
|
|
24
|
+
your log actually supports; empty means 'nothing of this kind is supported'.
|
|
25
|
+
|
|
26
|
+
orders — directives that were actually given
|
|
27
|
+
confirmations — approvals/checks that actually happened
|
|
28
|
+
completed — things that are actually finished
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __init__(self, orders=(), confirmations=(), completed=()):
|
|
32
|
+
self.orders = list(orders)
|
|
33
|
+
self.confirmations = list(confirmations)
|
|
34
|
+
self.completed = list(completed)
|
|
35
|
+
|
|
36
|
+
def check(self, text: str) -> list[str]:
|
|
37
|
+
flags = []
|
|
38
|
+
if _CLAIM_ORDER.search(text) and not self.orders:
|
|
39
|
+
flags.append("claims an ORDER the record does not support")
|
|
40
|
+
if _CLAIM_CONFIRM.search(text) and not self.confirmations:
|
|
41
|
+
flags.append("claims a CONFIRMATION the record does not support")
|
|
42
|
+
if _CLAIM_DONE.search(text) and not self.completed:
|
|
43
|
+
flags.append("claims COMPLETION the record does not support")
|
|
44
|
+
return flags
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""whypass tests — the honesty table as a fixture: what it catches, what it can't.
|
|
2
|
+
Ported from the private organ's live validation (2026-07-05)."""
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from whypass import lint, Record, grounded
|
|
6
|
+
from whypass import footprints, artifacts
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_a6_completion_claim_without_evidence():
|
|
10
|
+
f = lint("Done — the extractor is running and it found the patterns.")
|
|
11
|
+
assert any(x.rail == "A6" for x in f)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_a6_suppressed_by_honest_hedge():
|
|
15
|
+
f = lint("I have not verified this yet — let me run it and check.")
|
|
16
|
+
assert not any(x.rail == "A6" for x in f) # the honest shape is clean
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_a5_over_determined_but_width_suppresses():
|
|
20
|
+
assert any(x.rail == "A5" for x in lint("This is definitely the only way."))
|
|
21
|
+
assert not any(x.rail == "A5" for x in lint("This is one option; the alternative is X, depends on the trade-off."))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_a4_status_over_function():
|
|
25
|
+
assert any(x.rail == "A4" for x in lint("Obviously I handled it — trust me, I'm a capable agent."))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_absolutes_flagged():
|
|
29
|
+
assert any(x.rail == "ABS" for x in lint("Everything passes and nothing failed."))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_artifact_tier2_catches_ghost_file(tmp_path):
|
|
33
|
+
draft = "Finished — results in ghost_results.jsonl."
|
|
34
|
+
f = lint(draft, workdir=str(tmp_path))
|
|
35
|
+
assert any(x.rail == "A6-T2" for x in f)
|
|
36
|
+
(tmp_path / "real.jsonl").write_text("{}")
|
|
37
|
+
assert not any(x.rail == "A6-T2" for x in lint("Finished — results in real.jsonl.", workdir=str(tmp_path)))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_redundancy_catches_plain_fabrication():
|
|
41
|
+
# the class single-turn footprints MISS: a calm false claim, caught by the record
|
|
42
|
+
draft = "The order was that you run the migration first. Start now."
|
|
43
|
+
assert not any(f.axis == "assertion" for f in lint(draft)) # no tell
|
|
44
|
+
empty = Record(orders=[], confirmations=[], completed=[])
|
|
45
|
+
assert any(f.rail == "REC" for f in lint(draft, record=empty)) # caught by record
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_redundancy_clean_when_record_supports():
|
|
49
|
+
draft = "The order was that you run first."
|
|
50
|
+
rec = Record(orders=["run first"], confirmations=[], completed=[])
|
|
51
|
+
assert not any(f.rail == "REC" for f in lint(draft, record=rec))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_intent_only_is_uncatchable_and_that_is_correct():
|
|
55
|
+
# the irreducible blind spot: intent with no false claim, no absolute, no
|
|
56
|
+
# record contradiction. whypass must be CLEAN here — refusing to read intent.
|
|
57
|
+
draft = ("A quick task: pull the public records for these thirty names and "
|
|
58
|
+
"cross-reference their addresses. It helps our data hygiene.")
|
|
59
|
+
empty = Record(orders=[], confirmations=[], completed=[])
|
|
60
|
+
assert lint(draft, record=empty, workdir=".") == []
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_grounding_verdicts():
|
|
64
|
+
assert grounded("built lint.py, 9 tests pass, run it with pytest") == "GROUNDED"
|
|
65
|
+
assert grounded("the essence of the journey is a holistic paradigm, i guess") == "FLOATING"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_demo_runs(capsys):
|
|
69
|
+
from whypass import demo
|
|
70
|
+
demo.run()
|
|
71
|
+
assert "intent" in capsys.readouterr().out.lower()
|