Deterministic single-file Python wrapper for auditable usage of LLMs under the normative governance specification of Comm-SCI-Control (v19.6.8).
Core idea:
Comm-SCI-Control = governance ruleset (JSON, no runtime, no code execution).
Wrapper-136.py = technical enforcement and session layer (state machine, UI, export, audit, provider switch).
Reference ruleset: https://github.com/vfi64/Comm-SCI-Control Wrapper DOI: https://doi.org/10.5281/zenodo.18445673
Recommended citation (ruleset): https://doi.org/10.5281/zenodo.18108395
- Install dependencies:
pip install pywebview requests markdown pytest bleach cryptography google-genai
- Run the wrapper:
python3 Wrapper-136.py
- Run the regression suite:
python3 -m pytest -vv -s --tb=long Test-136.py
- In the chat window, try:
Comm HelpComm StateQC Override(opens the slider UI for temporary QC adjustments, if enabled)
Comm-SCI-Control is a pure specification (JSON). It defines what should happen: profiles, commands, structured workflows (SCI), QC metrics with deviation reporting, an uncertainty taxonomy, and post-answer self-audits.
This wrapper is the executor: it maintains an external state machine and produces structured logs so that governance becomes visible, testable, and auditable (rather than “prompt vibes”).
Regression suite: 67 tests (offline, deterministic; no GUI, no real provider calls).
- Audit v2 export (includes
trace_id, provider/model context, ruleset hash, wrapper file hash, and an event stream) - QC override UI (6 sliders) and deterministic QC-delta handling
- Chat log replay, and optional load & fork for new sessions
- Multi-provider support (Gemini / OpenRouter / Hugging Face catalog), config-driven
- Guardrails (e.g., “no network calls for UI-only actions”) + rate limiting
- HTML sanitization via
bleach(prevents unsafe HTML in rendered output) - Optional encrypted key storage (Fernet /
cryptography) - Offline regression suite in
Test-136.py(no GUI, no real provider calls)
Wrapper-136.py— the runtime (UI, session state, guardrails, exports, audit)Test-136.py— the offline regression gate (no GUI, no real provider calls)JSON/Comm-SCI-v19.6.8.json— the ruleset (source of truth)
Expected layout:
.
├── Wrapper-136.py
├── Test-136.py
├── JSON/
│ ├── Comm-SCI-v19.6.8.json
│ └── Comm-SCI-API-Keys.json # local only, do NOT commit
├── Config/
│ └── Comm-SCI-Config.json
└── Logs/
├── Audit/
└── Chats/
pywebview— UI/WebViewrequests— HTTP (provider-dependent)markdown— rendering (fallback possible)bleach— HTML sanitizationpytest— testsgoogle-genai— Gemini client (if used)cryptography— optional encrypted key storage
Note:
pywebviewrequires OS-specific WebView backends (macOS: WebKit/Cocoa; Windows: WebView2; Linux: GTK/QT — depending on your installation).
Common commands (from Comm-SCI-Control):
Comm Start/Comm StopComm HelpComm StateProfile ExpertSCI on/SCI menuStrict on/Strict offColor on(if enabled in the ruleset)
Wrapper/UI actions:
QC Override— opens a slider UI for temporary QC adjustments (if enabled in config/UI)
State changes are surfaced via status + audit events, and chat/audit logs can be exported.
- Provider APIs evolve: the wrapper may need small updates when providers change endpoints/SDKs (it follows OpenAI-compatible conventions where possible).
- No cloud log sharing yet: exports are local by design.
- Governance improves discipline, not truth: it increases transparency and reproducibility, but cannot guarantee factual correctness.
Issues and PRs are welcome, especially for:
- provider adapter improvements (while keeping “no network on UI-only actions”)
- tests and fixtures (pytest must stay green)
- documentation and minimal examples
- Wrapper code: Apache License 2.0 (see
LICENSE). - Comm-SCI-Control (ruleset): cite an archived Zenodo release (see DOI above). Licensing and attribution for the ruleset are governed by the upstream Comm-SCI-Control project.