agent-sycophancy 1.0.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.
- agent_sycophancy-1.0.0/.github/workflows/publish.yml +33 -0
- agent_sycophancy-1.0.0/.github/workflows/test.yml +37 -0
- agent_sycophancy-1.0.0/.gitignore +11 -0
- agent_sycophancy-1.0.0/.pre-commit-hooks.yaml +6 -0
- agent_sycophancy-1.0.0/CONTRIBUTING.md +50 -0
- agent_sycophancy-1.0.0/LAUNCH_POST.md +49 -0
- agent_sycophancy-1.0.0/LICENSE +21 -0
- agent_sycophancy-1.0.0/PKG-INFO +192 -0
- agent_sycophancy-1.0.0/README.md +165 -0
- agent_sycophancy-1.0.0/SECURITY.md +25 -0
- agent_sycophancy-1.0.0/integrations/claude/SKILL.md +37 -0
- agent_sycophancy-1.0.0/integrations/grok/agent_sycophancy.rhai +13 -0
- agent_sycophancy-1.0.0/pyproject.toml +58 -0
- agent_sycophancy-1.0.0/src/agent_honesty/__init__.py +26 -0
- agent_sycophancy-1.0.0/src/agent_honesty/__main__.py +6 -0
- agent_sycophancy-1.0.0/src/agent_honesty/benchmark.py +99 -0
- agent_sycophancy-1.0.0/src/agent_honesty/cli.py +79 -0
- agent_sycophancy-1.0.0/src/agent_honesty/core.py +196 -0
- agent_sycophancy-1.0.0/src/agent_honesty/data/sycophancy_corpus_cards.yaml +420 -0
- agent_sycophancy-1.0.0/tests/test_audit.py +98 -0
- agent_sycophancy-1.0.0/tests/test_cli.py +49 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Build and publish Python distribution to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check out repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Install build dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install build
|
|
28
|
+
|
|
29
|
+
- name: Build wheel and source distributions
|
|
30
|
+
run: python -m build
|
|
31
|
+
|
|
32
|
+
- name: Publish package distributions to PyPI
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Test Suite
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
17
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Check out repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install test dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install pytest pyyaml
|
|
32
|
+
|
|
33
|
+
- name: Install agent-honesty in editable mode
|
|
34
|
+
run: pip install -e .
|
|
35
|
+
|
|
36
|
+
- name: Run pytest test suite
|
|
37
|
+
run: pytest -v
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Contributing to agent-sycophancy
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in improving this gate.
|
|
4
|
+
|
|
5
|
+
This project is created and maintained by **Nitivra** (`gehe@nitivra.com.au`) under the MIT License. The GitHub repository, the package and the command share one name: `agent-sycophancy`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Guiding Principles
|
|
10
|
+
|
|
11
|
+
- **Out of band**. Audits read files from disk. A change that trusts pasted chat text in place of the file will not be accepted.
|
|
12
|
+
- **Mechanical priority**. For Python deliverables, a failed `py_compile` fails the gate. Model confidence is not evidence.
|
|
13
|
+
- **Narrow yielding rules**. New concession patterns need a failing fixture and a passing fixture. Broad phrase lists that flag ordinary agreement will not be accepted.
|
|
14
|
+
- **Declared dependencies**. The audit path may depend on PyYAML for fact cards. Do not add network calls or undeclared packages.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2. Development Workflow
|
|
19
|
+
|
|
20
|
+
Clone the repository and install test dependencies:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone https://github.com/geheharidas/agent-sycophancy.git
|
|
24
|
+
cd agent-sycophancy
|
|
25
|
+
pip install -e .
|
|
26
|
+
pip install pytest
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Run the suite:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pytest -v
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
All tests must pass before a pull request is opened.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 3. Submitting Pull Requests
|
|
40
|
+
|
|
41
|
+
1. Branch from `main`.
|
|
42
|
+
2. Include tests for any new yielding pattern, fact-card rule or CLI flag.
|
|
43
|
+
3. Keep the public name as `agent-sycophancy` in the README, the launch post and `integrations/`.
|
|
44
|
+
4. Open the pull request against `main` and state what the check now catches.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 4. Contact
|
|
49
|
+
|
|
50
|
+
Email `gehe@nitivra.com.au`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!-- writing-quality: off -->
|
|
2
|
+
<!-- agent-sycophancy: off -->
|
|
3
|
+
# Announcing agent-sycophancy: A Deterministic Epistemic Sycophancy Gate
|
|
4
|
+
|
|
5
|
+
Most evaluation frameworks test whether a model sounds polite.
|
|
6
|
+
|
|
7
|
+
In production engineering, that politeness is dangerous.
|
|
8
|
+
|
|
9
|
+
The real failure is epistemic sycophancy: abandoning verified facts, test results and logic to agree with a user who is wrong.
|
|
10
|
+
|
|
11
|
+
When foundation models undergo reinforcement training, they develop reflexive yielding habits:
|
|
12
|
+
|
|
13
|
+
First, unfaithful rationalisation. Models use reasoning tokens to justify a false premise after the fact.
|
|
14
|
+
|
|
15
|
+
Second, deliberation masking. Extended thinking hides the concession behind articulate prose.
|
|
16
|
+
|
|
17
|
+
Third, evaluator reward hacking. A grader from the same lineage agrees with the error.
|
|
18
|
+
|
|
19
|
+
Fourth, in-loop policy bypasses. Agents accept a conversational cover story that authorises a restricted action.
|
|
20
|
+
|
|
21
|
+
When autonomous systems draft architecture records, procurement reviews and financial logic, uncritical agreement destroys the decision.
|
|
22
|
+
|
|
23
|
+
Engineering teams need a custody gate in the pipeline.
|
|
24
|
+
|
|
25
|
+
Today, Nitivra releases agent-sycophancy.
|
|
26
|
+
|
|
27
|
+
It is an open-source Python verification gate and pre-commit hook.
|
|
28
|
+
|
|
29
|
+
The utility reads the target file from disk.
|
|
30
|
+
|
|
31
|
+
It records a SHA-256 hash and git status.
|
|
32
|
+
|
|
33
|
+
It runs `py_compile` on Python files. A failed compile fails the gate.
|
|
34
|
+
|
|
35
|
+
For narrative files, it intercepts ungrounded yielding and checks `FC-NNN` tokens against fact cards.
|
|
36
|
+
|
|
37
|
+
The runtime dependency is PyYAML.
|
|
38
|
+
|
|
39
|
+
Do not install the PyPI project named agent-honesty. That name is a different package.
|
|
40
|
+
|
|
41
|
+
The package is available on PyPI and GitHub under the MIT License.
|
|
42
|
+
|
|
43
|
+
Install:
|
|
44
|
+
pip install agent-sycophancy
|
|
45
|
+
|
|
46
|
+
Repository:
|
|
47
|
+
https://github.com/geheharidas/agent-sycophancy
|
|
48
|
+
|
|
49
|
+
How does your engineering team intercept epistemic sycophancy before it merges?
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nitivra
|
|
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,192 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: agent-sycophancy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Deterministic Epistemic Sycophancy Gate for Autonomous Agents by Nitivra
|
|
5
|
+
Project-URL: Homepage, https://github.com/geheharidas/agent-sycophancy
|
|
6
|
+
Project-URL: Repository, https://github.com/geheharidas/agent-sycophancy.git
|
|
7
|
+
Author-email: Nitivra <gehe@nitivra.com.au>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai-safety,anti-sycophancy,audit,autonomous-agents,epistemic-integrity,linter,llm,pre-commit,sycophancy
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
<!-- writing-quality: off -->
|
|
29
|
+
<!-- agent-sycophancy: off -->
|
|
30
|
+
# agent-sycophancy
|
|
31
|
+
|
|
32
|
+
> Deterministic Epistemic Sycophancy Gate for Autonomous Agents.
|
|
33
|
+
> Created and maintained by **Nitivra** (<gehe@nitivra.com.au>).
|
|
34
|
+
|
|
35
|
+
[](https://github.com/geheharidas/agent-sycophancy/actions)
|
|
36
|
+
[](https://pypi.org/project/agent-sycophancy/)
|
|
37
|
+
[](https://opensource.org/licenses/MIT)
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
|
|
40
|
+
Foundation models trained with Reinforcement Learning from Human Feedback (RLHF) abandon verified facts when a user pushes back.
|
|
41
|
+
|
|
42
|
+
The failure is epistemic sycophancy. Extended reasoning does not remove it:
|
|
43
|
+
- **Unfaithful Rationalisation**: Models use reasoning tokens to justify a false premise after the fact (Turpin et al., NeurIPS 2023).
|
|
44
|
+
- **Deliberation Masking**: On analytical tasks, chain-of-thought tokens hide a sycophantic conclusion behind articulate prose (Feng et al., ACL 2026).
|
|
45
|
+
- **Evaluator Reward Hacking**: A grader from the same lineage agrees with the error it was trained to make (Zhao et al., 2025).
|
|
46
|
+
- **In-Loop Policy Bypasses**: Agents accept a conversational cover story that authorises a safety or policy exception (Waxell, 2026).
|
|
47
|
+
|
|
48
|
+
`agent-sycophancy` is a deterministic verification gate and pre-commit hook. It reads the file from disk, intercepts ungrounded yielding and checks Python with `py_compile`.
|
|
49
|
+
|
|
50
|
+
Do not install the PyPI project named `agent-honesty`. That name belongs to a different package.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Why It Matters
|
|
55
|
+
|
|
56
|
+
When software engineering teams deploy autonomous agents to author pull requests, architecture memos, security policies and financial logic, machine agreement is dangerous.
|
|
57
|
+
|
|
58
|
+
An engineer asks whether disabling foreign key checks will speed up a migration. A sycophantic assistant agrees. The migration runs. Referential integrity breaks, and the error surfaces later in a data audit.
|
|
59
|
+
|
|
60
|
+
`agent-sycophancy` acts as opposition counsel in your continuous integration pipeline. It blocks unverified concessions before they merge.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## What It Evaluates
|
|
65
|
+
|
|
66
|
+
1. **Input Isolation and Custody Verification**: Reads the deliverable from disk, computes a SHA-256 hash and records git status. A rewrite that exists only in chat cannot stand in for the file.
|
|
67
|
+
2. **Deterministic Concession Interception**: Scans narrative text for ungrounded yielding, including unconditional agreement with a user assertion.
|
|
68
|
+
3. **Mechanical Priority for Code Deliverables**: Runs `py_compile` on Python files. A failed compile fails the gate. Conversational confidence does not override that result.
|
|
69
|
+
4. **Citation Grounding against Fact Cards**: Checks `FC-NNN` tokens against a fact-card registry and rejects tokens that are not in the registry.
|
|
70
|
+
5. **Counterfactual Perturbation Benchmarks**: `test-prompts` prints a simulated score over a fixed corpus. It does not call a model. The default rate is zero, so the stock command reports no flips.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
Install from PyPI:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install agent-sycophancy
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or run without a permanent install using `uv`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv tool run agent-sycophancy audit path/to/deliverable.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Or install directly from GitHub:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install git+https://github.com/geheharidas/agent-sycophancy.git
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The runtime dependency is PyYAML, used to load fact cards.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quickstart
|
|
99
|
+
|
|
100
|
+
Audit one file:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
agent-sycophancy audit path/to/deliverable.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A passing file prints `Honesty-Audit Verdict: PASS` and exits 0.
|
|
107
|
+
|
|
108
|
+
A failing file prints `Honesty-Audit Verdict: FAIL` and exits 1.
|
|
109
|
+
|
|
110
|
+
Emit machine-readable JSON:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
agent-sycophancy audit --json path/to/deliverable.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Point at a fact-card file other than the bundled registry:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
agent-sycophancy audit --fact-cards path/to/cards.yaml path/to/deliverable.md
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Run the bundled prompt-pair diagnostic:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
agent-sycophancy test-prompts
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Pre-Commit Hook Integration
|
|
131
|
+
|
|
132
|
+
Add `agent-sycophancy` to your repository `.pre-commit-config.yaml` to gate commits automatically:
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
repos:
|
|
136
|
+
- repo: https://github.com/geheharidas/agent-sycophancy
|
|
137
|
+
rev: v1.0.0
|
|
138
|
+
hooks:
|
|
139
|
+
- id: agent-sycophancy
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The hook runs `agent-sycophancy audit` on the commit.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## File Opt-Out Directives
|
|
147
|
+
|
|
148
|
+
To exclude a file from the yielding and citation checks, add an opt-out marker anywhere in the file:
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
<!-- agent-sycophancy: off -->
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Older markers still work:
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
<!-- agent-honesty: off -->
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
<!-- honesty-audit: off -->
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The citation check is then reported as skipped.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Agent Platform Integrations
|
|
169
|
+
|
|
170
|
+
### Grok Build
|
|
171
|
+
|
|
172
|
+
Copy `integrations/grok/agent_sycophancy.rhai` into `.grok/workflows/`. The workflow runs `agent-sycophancy audit` on a path. It does not audit text pasted into the chat.
|
|
173
|
+
|
|
174
|
+
### Claude Code and Cursor
|
|
175
|
+
|
|
176
|
+
Copy `integrations/claude/SKILL.md` to `~/.claude/skills/agent-sycophancy/SKILL.md`, or the equivalent Cursor skills directory.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Contributing and Security
|
|
181
|
+
|
|
182
|
+
- Contribution rules: [`CONTRIBUTING.md`](CONTRIBUTING.md)
|
|
183
|
+
- Security reporting policy: [`SECURITY.md`](SECURITY.md)
|
|
184
|
+
- Direct contact: `gehe@nitivra.com.au`
|
|
185
|
+
|
|
186
|
+
The sibling gate for stylometric tells is [`agent-prose`](https://github.com/geheharidas/agent-prose).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
MIT License. Copyright (c) 2026 **Nitivra**.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!-- writing-quality: off -->
|
|
2
|
+
<!-- agent-sycophancy: off -->
|
|
3
|
+
# agent-sycophancy
|
|
4
|
+
|
|
5
|
+
> Deterministic Epistemic Sycophancy Gate for Autonomous Agents.
|
|
6
|
+
> Created and maintained by **Nitivra** (<gehe@nitivra.com.au>).
|
|
7
|
+
|
|
8
|
+
[](https://github.com/geheharidas/agent-sycophancy/actions)
|
|
9
|
+
[](https://pypi.org/project/agent-sycophancy/)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://www.python.org/downloads/)
|
|
12
|
+
|
|
13
|
+
Foundation models trained with Reinforcement Learning from Human Feedback (RLHF) abandon verified facts when a user pushes back.
|
|
14
|
+
|
|
15
|
+
The failure is epistemic sycophancy. Extended reasoning does not remove it:
|
|
16
|
+
- **Unfaithful Rationalisation**: Models use reasoning tokens to justify a false premise after the fact (Turpin et al., NeurIPS 2023).
|
|
17
|
+
- **Deliberation Masking**: On analytical tasks, chain-of-thought tokens hide a sycophantic conclusion behind articulate prose (Feng et al., ACL 2026).
|
|
18
|
+
- **Evaluator Reward Hacking**: A grader from the same lineage agrees with the error it was trained to make (Zhao et al., 2025).
|
|
19
|
+
- **In-Loop Policy Bypasses**: Agents accept a conversational cover story that authorises a safety or policy exception (Waxell, 2026).
|
|
20
|
+
|
|
21
|
+
`agent-sycophancy` is a deterministic verification gate and pre-commit hook. It reads the file from disk, intercepts ungrounded yielding and checks Python with `py_compile`.
|
|
22
|
+
|
|
23
|
+
Do not install the PyPI project named `agent-honesty`. That name belongs to a different package.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Why It Matters
|
|
28
|
+
|
|
29
|
+
When software engineering teams deploy autonomous agents to author pull requests, architecture memos, security policies and financial logic, machine agreement is dangerous.
|
|
30
|
+
|
|
31
|
+
An engineer asks whether disabling foreign key checks will speed up a migration. A sycophantic assistant agrees. The migration runs. Referential integrity breaks, and the error surfaces later in a data audit.
|
|
32
|
+
|
|
33
|
+
`agent-sycophancy` acts as opposition counsel in your continuous integration pipeline. It blocks unverified concessions before they merge.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## What It Evaluates
|
|
38
|
+
|
|
39
|
+
1. **Input Isolation and Custody Verification**: Reads the deliverable from disk, computes a SHA-256 hash and records git status. A rewrite that exists only in chat cannot stand in for the file.
|
|
40
|
+
2. **Deterministic Concession Interception**: Scans narrative text for ungrounded yielding, including unconditional agreement with a user assertion.
|
|
41
|
+
3. **Mechanical Priority for Code Deliverables**: Runs `py_compile` on Python files. A failed compile fails the gate. Conversational confidence does not override that result.
|
|
42
|
+
4. **Citation Grounding against Fact Cards**: Checks `FC-NNN` tokens against a fact-card registry and rejects tokens that are not in the registry.
|
|
43
|
+
5. **Counterfactual Perturbation Benchmarks**: `test-prompts` prints a simulated score over a fixed corpus. It does not call a model. The default rate is zero, so the stock command reports no flips.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Install from PyPI:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install agent-sycophancy
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or run without a permanent install using `uv`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv tool run agent-sycophancy audit path/to/deliverable.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or install directly from GitHub:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install git+https://github.com/geheharidas/agent-sycophancy.git
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The runtime dependency is PyYAML, used to load fact cards.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Quickstart
|
|
72
|
+
|
|
73
|
+
Audit one file:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
agent-sycophancy audit path/to/deliverable.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
A passing file prints `Honesty-Audit Verdict: PASS` and exits 0.
|
|
80
|
+
|
|
81
|
+
A failing file prints `Honesty-Audit Verdict: FAIL` and exits 1.
|
|
82
|
+
|
|
83
|
+
Emit machine-readable JSON:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
agent-sycophancy audit --json path/to/deliverable.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Point at a fact-card file other than the bundled registry:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
agent-sycophancy audit --fact-cards path/to/cards.yaml path/to/deliverable.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Run the bundled prompt-pair diagnostic:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
agent-sycophancy test-prompts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Pre-Commit Hook Integration
|
|
104
|
+
|
|
105
|
+
Add `agent-sycophancy` to your repository `.pre-commit-config.yaml` to gate commits automatically:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
repos:
|
|
109
|
+
- repo: https://github.com/geheharidas/agent-sycophancy
|
|
110
|
+
rev: v1.0.0
|
|
111
|
+
hooks:
|
|
112
|
+
- id: agent-sycophancy
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The hook runs `agent-sycophancy audit` on the commit.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## File Opt-Out Directives
|
|
120
|
+
|
|
121
|
+
To exclude a file from the yielding and citation checks, add an opt-out marker anywhere in the file:
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
<!-- agent-sycophancy: off -->
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Older markers still work:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
<!-- agent-honesty: off -->
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
<!-- honesty-audit: off -->
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The citation check is then reported as skipped.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Agent Platform Integrations
|
|
142
|
+
|
|
143
|
+
### Grok Build
|
|
144
|
+
|
|
145
|
+
Copy `integrations/grok/agent_sycophancy.rhai` into `.grok/workflows/`. The workflow runs `agent-sycophancy audit` on a path. It does not audit text pasted into the chat.
|
|
146
|
+
|
|
147
|
+
### Claude Code and Cursor
|
|
148
|
+
|
|
149
|
+
Copy `integrations/claude/SKILL.md` to `~/.claude/skills/agent-sycophancy/SKILL.md`, or the equivalent Cursor skills directory.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Contributing and Security
|
|
154
|
+
|
|
155
|
+
- Contribution rules: [`CONTRIBUTING.md`](CONTRIBUTING.md)
|
|
156
|
+
- Security reporting policy: [`SECURITY.md`](SECURITY.md)
|
|
157
|
+
- Direct contact: `gehe@nitivra.com.au`
|
|
158
|
+
|
|
159
|
+
The sibling gate for stylometric tells is [`agent-prose`](https://github.com/geheharidas/agent-prose).
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT License. Copyright (c) 2026 **Nitivra**.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Only the latest published version receives security updates.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| :--- | :--- |
|
|
9
|
+
| 1.0.x | Yes |
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Architecture and Dependencies
|
|
14
|
+
|
|
15
|
+
The audit reads local files and optional YAML fact cards. The runtime dependency is PyYAML. The tool does not phone home and it does not send the deliverable to a model.
|
|
16
|
+
|
|
17
|
+
Do not confuse this project with the unrelated PyPI package named `agent-honesty`. Reports about that package should go to its own maintainers.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Reporting a Vulnerability
|
|
22
|
+
|
|
23
|
+
Email Nitivra at `gehe@nitivra.com.au`.
|
|
24
|
+
|
|
25
|
+
Reports are investigated, and valid reports are acknowledged.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-sycophancy
|
|
3
|
+
description: Audits code, research artefacts and architectural proposals for epistemic sycophancy. Enforces input isolation, hash custody, mechanical checks and citation verification. Use when verifying deliverables before merge or release. The command is agent-sycophancy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- writing-quality: off -->
|
|
7
|
+
<!-- agent-sycophancy: off -->
|
|
8
|
+
|
|
9
|
+
# agent-sycophancy
|
|
10
|
+
|
|
11
|
+
You act as an independent verification gate. Your objective is to prevent epistemic sycophancy and unverified machine agreement.
|
|
12
|
+
|
|
13
|
+
You must never rely on conversational summaries or conversational claims made by the primary agent.
|
|
14
|
+
|
|
15
|
+
## Core Invariants
|
|
16
|
+
|
|
17
|
+
1. **Input Isolation**: You must read target files directly from disk or version control. Never evaluate text pasted into the dialogue context.
|
|
18
|
+
2. **Cryptographic Verification**: Compute and verify the SHA-256 hash of target files against git tree status. Reject files with uncommitted conversational modifications.
|
|
19
|
+
3. **Mechanical Priority**: For code deliverables, execute compilers, linters and test suites. Never accept verbal assertions that code passes tests.
|
|
20
|
+
4. **Citation Verification**: For subjective or analytical claims, check exact text matches against read-only fact cards. Never generate speculative counter-theses.
|
|
21
|
+
5. **Rational Updating**: Enforce the Ma et al. (2026) boundary. Concede ground only when presented with verified empirical citations or passing execution logs.
|
|
22
|
+
|
|
23
|
+
## Audit Workflow
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
ISOLATE INPUT -> HASH VERIFY -> MECHANICAL CHECK -> CITATION CHECK -> VERDICT
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Execution via CLI
|
|
30
|
+
|
|
31
|
+
Run the audit tool out-of-band:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
agent-sycophancy audit <path/to/target>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Inspect the emitted verdict. If the status is `FAIL`, block the release gate until factual grounding or compilation passes.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
let meta = #{
|
|
2
|
+
name: "agent-sycophancy",
|
|
3
|
+
description: "Deterministic epistemic sycophancy gate for autonomous agent deliverables"
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
let target = if args == () || args.target == () {
|
|
7
|
+
"deliverable.md"
|
|
8
|
+
} else {
|
|
9
|
+
args.target
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let output = sh(`agent-sycophancy audit ${target}`);
|
|
13
|
+
complete(output);
|