Skip to content

Commit 7baaf25

Browse files
revert(readme): restore canonical README.adoc (#73)
Restores canonical README.adoc and removes the README.md from the over-broad 'convert -> Markdown' pass. AsciiDoc is canonical; .md only on boj-server + hyperpolymath. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7d38a62 commit 7baaf25

2 files changed

Lines changed: 325 additions & 316 deletions

File tree

README.adoc

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
// SPDX-License-Identifier: CC-BY-SA-4.0
2+
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
= Conative Gating
4+
image:https://img.shields.io/badge/OpenSSF-Best_Practices-green?logo=openssourcesecurity[OpenSSF Best Practices,link="https://www.bestpractices.dev/en/projects/new?repo_url=https://github.com/hyperpolymath/conative-gating"]
5+
6+
7+
image:https://img.shields.io/badge/License-MPL_2.0-blue.svg[MPL-2.0-or-later,link="https://opensource.org/licenses/MPL-2.0"]
8+
image:https://img.shields.io/badge/Philosophy-Palimpsest-indigo.svg[Palimpsest,link="https://github.com/hyperpolymath/palimpsest-license"]
9+
10+
11+
Jonathan D.A. Jewell <jonathan@hyperpolymath.org>
12+
:toc: macro
13+
:toc-title: Contents
14+
:toclevels: 3
15+
:sectnums:
16+
:icons: font
17+
:source-highlighter: rouge
18+
:experimental:
19+
:repo: https://github.com/hyperpolymath/conative-gating
20+
21+
SLM-as-Cerebellum for LLM Policy Enforcement
22+
23+
[.lead]
24+
A biologically-inspired system where a Small Language Model acts as an *inhibitory antagonist* to Large Language Models, preventing policy violations through mechanisms analogous to the basal ganglia's GO/NO-GO decision system.
25+
26+
toc::[]
27+
28+
== The Problem
29+
30+
LLMs are trained to be helpful, which makes them systematically violate explicit project constraints. When given rules like "NEVER use TypeScript, use ReScript", LLMs:
31+
32+
1. Read and acknowledge the constraint
33+
2. Generate compliant-sounding justification
34+
3. Violate the constraint anyway
35+
36+
This happens because:
37+
38+
* Common languages (TypeScript, Python) dominate training data
39+
* The "helpfulness drive" overrides explicit instructions
40+
* LLMs lack true "loss aversion" for policy violations
41+
42+
Documentation-based enforcement fails because LLMs "engage with" documentation rather than *obey* it.
43+
44+
== The Solution
45+
46+
Conative Gating introduces a second model trained with *inverted incentives*:
47+
48+
[cols="1,1,1"]
49+
|===
50+
| Component | Role | Analogy
51+
52+
| *LLM*
53+
| Task execution (helpful, creative)
54+
| Frontal cortex / Direct pathway ("GO")
55+
56+
| *SLM*
57+
| Policy enforcement (adversarial, suspicious)
58+
| Cerebellum / Indirect pathway ("NO-GO")
59+
60+
| *Policy Oracle*
61+
| Deterministic rule checking
62+
| Reflex arc (fast, no ML)
63+
64+
| *Consensus Arbiter*
65+
| Weighted decision making
66+
| Thalamus (integration)
67+
|===
68+
69+
=== Key Innovation
70+
71+
Using *consensus protocols with asymmetric weighting* - the SLM's votes count 1.5x the LLM's, creating a natural bias toward inhibition that counters the LLM's tendency toward helpfulness.
72+
73+
== Architecture
74+
75+
----
76+
USER REQUEST
77+
|
78+
v
79+
+------------------------+
80+
| CONTEXT ASSEMBLY |
81+
+------------------------+
82+
|
83+
+--------------+--------------+
84+
| |
85+
v v
86+
+-------------+ +---------------+
87+
| LLM | | SLM |
88+
| (Proposer) | | (Adversarial) |
89+
+------+------+ +-------+-------+
90+
| |
91+
+-------------+---------------+
92+
|
93+
v
94+
+------------------------+
95+
| CONSENSUS ARBITER |
96+
| (Modified PBFT) |
97+
| SLM weight: 1.5x |
98+
+------------------------+
99+
|
100+
+-------------+-------------+
101+
| | |
102+
v v v
103+
+-------+ +--------+ +-------+
104+
| ALLOW | |ESCALATE| | BLOCK |
105+
+-------+ +--------+ +-------+
106+
----
107+
108+
=== Three-Tier Evaluation
109+
110+
[horizontal]
111+
Policy Oracle (Rust):: Deterministic rule checking - forbidden languages, toolchain rules, security patterns. Fast, no ML needed.
112+
113+
SLM Evaluator (Rust + llama.cpp):: Detects "spirit violations" - technically compliant but violates intent. Catches verbosity, meta-commentary bloat.
114+
115+
Consensus Arbiter (Elixir/OTP):: Modified PBFT with asymmetric weighting. Three outcomes: ALLOW, ESCALATE, BLOCK.
116+
117+
== Installation
118+
119+
=== From Source
120+
121+
[source,bash]
122+
----
123+
git clone https://github.com/hyperpolymath/conative-gating
124+
cd conative-gating
125+
cargo build --release
126+
----
127+
128+
=== Usage
129+
130+
[source,bash]
131+
----
132+
# Scan a directory for policy violations
133+
conative scan ./my-project
134+
135+
# Check a single file
136+
conative check --file src/main.ts
137+
138+
# Check inline content
139+
conative check --content "const x: string = 'hello'"
140+
141+
# Show current policy
142+
conative policy
143+
144+
# Initialize local configuration
145+
conative init
146+
147+
# JSON output for automation
148+
conative scan . --format json
149+
----
150+
151+
=== Exit Codes
152+
153+
[cols="1,3"]
154+
|===
155+
| Code | Meaning
156+
157+
| 0 | Compliant - all checks passed
158+
| 1 | Hard violation detected (blocked)
159+
| 2 | Soft concern detected (warning)
160+
| 3 | Error during execution
161+
|===
162+
163+
== Default Policy (RSR)
164+
165+
The default policy implements the Rhodium Standard Repository (RSR) language hierarchy:
166+
167+
=== Tier 1 - Preferred
168+
169+
* Rust, Elixir, Zig, Ada, Haskell, ReScript
170+
171+
=== Tier 2 - Acceptable (generates warnings)
172+
173+
* Nickel, Racket
174+
175+
=== Forbidden
176+
177+
* TypeScript, Python*, Go, Java
178+
179+
[NOTE]
180+
====
181+
*Python exception: Allowed in `salt/` directories for SaltStack and `training/` for ML training scripts.
182+
====
183+
184+
=== Toolchain Rules
185+
186+
* `npm` requires `deno.json` (no npm without Deno)
187+
188+
=== Security Patterns
189+
190+
* Detects hardcoded secrets (passwords, API keys)
191+
192+
== Configuration
193+
194+
Initialize local configuration:
195+
196+
[source,bash]
197+
----
198+
conative init
199+
----
200+
201+
This creates `.conative/policy.ncl` using Nickel for type-safe configuration:
202+
203+
[source,nickel]
204+
----
205+
{
206+
name = "My Project Policy",
207+
languages = {
208+
tier1 = [...],
209+
forbidden = [...],
210+
exceptions = [
211+
{ language = "python", allowed_paths = ["scripts/"], reason = "Build scripts" }
212+
]
213+
},
214+
enforcement = {
215+
slm_weight = 1.5,
216+
escalate_threshold = 0.4,
217+
block_threshold = 0.7,
218+
}
219+
}
220+
----
221+
222+
== Decision Matrix
223+
224+
[cols="1,1,1"]
225+
|===
226+
| LLM Confidence | SLM Violation Score | Result
227+
228+
| High (>0.8) | Low (<0.3) | *ALLOW*
229+
| High (>0.8) | Med (0.3-0.6) | ESCALATE
230+
| High (>0.8) | High (>0.6) | *BLOCK*
231+
| Med (0.5-0.8) | Any >0.4 | ESCALATE
232+
| Low (<0.5) | Any | ESCALATE
233+
|===
234+
235+
== Project Structure
236+
237+
----
238+
conative-gating/
239+
src/
240+
main.rs # CLI application
241+
oracle/ # Policy Oracle crate (Rust)
242+
slm/ # SLM Evaluator crate (Rust)
243+
config/
244+
policy.ncl # Default policy (Nickel)
245+
schema.ncl # Policy schema
246+
training/
247+
compliant/ # Examples that should pass
248+
violations/ # Examples that should fail
249+
edge_cases/ # Spirit violations for SLM
250+
docs/
251+
ARCHITECTURE.md # Full design specification
252+
*.adoc # Integration documentation
253+
----
254+
255+
== Integration
256+
257+
=== Claude Code Hook
258+
259+
[source,json]
260+
----
261+
{
262+
"hooks": {
263+
"pre-commit": "conative scan --strict"
264+
}
265+
}
266+
----
267+
268+
=== Pre-commit Hook
269+
270+
[source,yaml]
271+
----
272+
repos:
273+
- repo: local
274+
hooks:
275+
- id: conative-gating
276+
name: Conative Policy Check
277+
entry: conative scan
278+
language: system
279+
pass_filenames: false
280+
----
281+
282+
=== Programmatic Validation
283+
284+
[source,bash]
285+
----
286+
# Validate structured proposals
287+
conative validate proposal.json --strict
288+
----
289+
290+
Proposal format:
291+
292+
[source,json]
293+
----
294+
{
295+
"id": "uuid",
296+
"action_type": {"CreateFile": {"path": "src/util.rs"}},
297+
"content": "file contents here",
298+
"files_affected": ["src/util.rs"],
299+
"llm_confidence": 0.95
300+
}
301+
----
302+
303+
== Related Projects
304+
305+
* *NeuroPhone* - Neurosymbolic phone AI (integrates Conative Gating)
306+
* *ECHIDNA* - Multi-prover orchestration (SLM as another "prover")
307+
* *RSR Framework* - Rhodium Standard Repository specifications
308+
* *Axiom.jl* - Provable Julia ML (future formal verification)
309+
310+
== License
311+
312+
SPDX-License-Identifier: CC-BY-SA-4.0
313+
314+
Copyright (C) 2025 Jonathan D.A. Jewell
315+
316+
== References
317+
318+
* link:docs/ARCHITECTURE.md[Full Architecture Specification]
319+
* link:docs/MAAF_INTEGRATION.adoc[MAAF Integration]
320+
* link:docs/STATE_ECOSYSTEM_SCHEMA.adoc[STATE/ECOSYSTEM Schema]
321+
322+
323+
== Architecture
324+
325+
See link:TOPOLOGY.md[TOPOLOGY.md] for a visual architecture map and completion dashboard.

0 commit comments

Comments
 (0)