provenance-guard 0.2.2__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.
- provenance_guard-0.2.2/.env.example +53 -0
- provenance_guard-0.2.2/.github/ISSUE_TEMPLATE/benchmark_case.md +67 -0
- provenance_guard-0.2.2/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
- provenance_guard-0.2.2/.github/ISSUE_TEMPLATE/source_tier_proposal.md +27 -0
- provenance_guard-0.2.2/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- provenance_guard-0.2.2/.github/dependabot.yml +16 -0
- provenance_guard-0.2.2/.github/workflows/ci.yml +39 -0
- provenance_guard-0.2.2/.github/workflows/publish-pypi.yml +69 -0
- provenance_guard-0.2.2/.gitignore +68 -0
- provenance_guard-0.2.2/CODE_OF_CONDUCT.md +57 -0
- provenance_guard-0.2.2/CONTRIBUTING.md +103 -0
- provenance_guard-0.2.2/Dockerfile +40 -0
- provenance_guard-0.2.2/LICENSE +13 -0
- provenance_guard-0.2.2/PKG-INFO +409 -0
- provenance_guard-0.2.2/README.md +366 -0
- provenance_guard-0.2.2/SECURITY.md +42 -0
- provenance_guard-0.2.2/benchmarks/dataset.jsonl +16 -0
- provenance_guard-0.2.2/benchmarks/evaluate.py +375 -0
- provenance_guard-0.2.2/config/prompts.yaml +79 -0
- provenance_guard-0.2.2/config/source_tiers.yaml +203 -0
- provenance_guard-0.2.2/docker-compose.yml +38 -0
- provenance_guard-0.2.2/docs/ARCHITECTURE.md +176 -0
- provenance_guard-0.2.2/docs/SOURCE_TIERING_POLICY.md +90 -0
- provenance_guard-0.2.2/docs/USE_CASES.md +195 -0
- provenance_guard-0.2.2/pyproject.toml +80 -0
- provenance_guard-0.2.2/src/epistemic_guard/__init__.py +108 -0
- provenance_guard-0.2.2/src/epistemic_guard/config.py +121 -0
- provenance_guard-0.2.2/src/epistemic_guard/extraction/__init__.py +5 -0
- provenance_guard-0.2.2/src/epistemic_guard/extraction/extractor.py +210 -0
- provenance_guard-0.2.2/src/epistemic_guard/graph/__init__.py +18 -0
- provenance_guard-0.2.2/src/epistemic_guard/graph/nodes.py +227 -0
- provenance_guard-0.2.2/src/epistemic_guard/graph/state.py +19 -0
- provenance_guard-0.2.2/src/epistemic_guard/graph/workflow.py +121 -0
- provenance_guard-0.2.2/src/epistemic_guard/interfaces/__init__.py +7 -0
- provenance_guard-0.2.2/src/epistemic_guard/interfaces/api.py +78 -0
- provenance_guard-0.2.2/src/epistemic_guard/interfaces/cli.py +219 -0
- provenance_guard-0.2.2/src/epistemic_guard/interfaces/mcp_server.py +89 -0
- provenance_guard-0.2.2/src/epistemic_guard/interfaces/web_ui.py +642 -0
- provenance_guard-0.2.2/src/epistemic_guard/llm/__init__.py +5 -0
- provenance_guard-0.2.2/src/epistemic_guard/llm/client.py +223 -0
- provenance_guard-0.2.2/src/epistemic_guard/schemas.py +526 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/__init__.py +5 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/domain_auditor.py +654 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/provenance_resolver.py +293 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/quote_matcher.py +166 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/search.py +208 -0
- provenance_guard-0.2.2/src/epistemic_guard/tools/temporal.py +181 -0
- provenance_guard-0.2.2/tests/__init__.py +1 -0
- provenance_guard-0.2.2/tests/test_benchmarks.py +88 -0
- provenance_guard-0.2.2/tests/test_domain_auditor.py +308 -0
- provenance_guard-0.2.2/tests/test_extractor.py +249 -0
- provenance_guard-0.2.2/tests/test_interfaces.py +221 -0
- provenance_guard-0.2.2/tests/test_phase6_hardening.py +279 -0
- provenance_guard-0.2.2/tests/test_provenance_resolver.py +368 -0
- provenance_guard-0.2.2/tests/test_schemas.py +345 -0
- provenance_guard-0.2.2/tests/test_workflow.py +355 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# Epistemic Guard Environment Configuration
|
|
3
|
+
# ==============================================================================
|
|
4
|
+
|
|
5
|
+
# Execution Environment: development | testing | production
|
|
6
|
+
ENVIRONMENT=development
|
|
7
|
+
LOG_LEVEL=INFO
|
|
8
|
+
|
|
9
|
+
# ------------------------------------------------------------------------------
|
|
10
|
+
# Model-Agnostic LLM Provider Settings (OpenAI-Compatible Spec)
|
|
11
|
+
# Works out-of-the-box with local endpoints (Ollama, vLLM, llama.cpp, LocalAI)
|
|
12
|
+
# as well as cloud providers (OpenAI, Groq, Mistral, Together, etc.).
|
|
13
|
+
# ------------------------------------------------------------------------------
|
|
14
|
+
# Local Ollama default: http://localhost:11434/v1
|
|
15
|
+
# Local vLLM default: http://localhost:8000/v1
|
|
16
|
+
# Local llama.cpp: http://localhost:8080/v1
|
|
17
|
+
# Cloud OpenAI default: https://api.openai.com/v1
|
|
18
|
+
OPENAI_BASE_URL=http://localhost:11434/v1
|
|
19
|
+
|
|
20
|
+
# API Key: For local inference (Ollama / llama.cpp), use "dummy-local-key"
|
|
21
|
+
# For cloud providers, supply your real API key
|
|
22
|
+
OPENAI_API_KEY=dummy-local-key
|
|
23
|
+
|
|
24
|
+
# Target model identifier (e.g. llama3.2, mistral, gpt-4o-mini, qwen2.5)
|
|
25
|
+
OPENAI_MODEL_NAME=llama3.2
|
|
26
|
+
|
|
27
|
+
# Inference parameters
|
|
28
|
+
REQUEST_TIMEOUT=30.0
|
|
29
|
+
TEMPERATURE=0.0
|
|
30
|
+
|
|
31
|
+
# ------------------------------------------------------------------------------
|
|
32
|
+
# Provenance Auditing Engine Settings
|
|
33
|
+
# ------------------------------------------------------------------------------
|
|
34
|
+
# Path to source tiering rules definition
|
|
35
|
+
SOURCE_TIERS_CONFIG_PATH=config/source_tiers.yaml
|
|
36
|
+
|
|
37
|
+
# Behavioral strictness toggles
|
|
38
|
+
STRICT_TIMESTAMP_ENFORCEMENT=true
|
|
39
|
+
REQUIRE_PRIMARY_EVIDENCE_FOR_BREAKING=true
|
|
40
|
+
|
|
41
|
+
# ------------------------------------------------------------------------------
|
|
42
|
+
# Phase 2 Search & Provenance Retrieval Engine Settings
|
|
43
|
+
# ------------------------------------------------------------------------------
|
|
44
|
+
# Active search provider: "duckduckgo" (free/default) | "tavily" | "mock"
|
|
45
|
+
SEARCH_PROVIDER=duckduckgo
|
|
46
|
+
|
|
47
|
+
# Optional search API key (required only for Tavily or authenticated providers)
|
|
48
|
+
SEARCH_API_KEY=
|
|
49
|
+
|
|
50
|
+
# Retrieval parameters
|
|
51
|
+
MAX_SEARCH_RESULTS=8
|
|
52
|
+
TEMPORAL_DRIFT_DAYS_THRESHOLD=30
|
|
53
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Benchmark Dataset Case Submission
|
|
3
|
+
about: Propose a new real-world viral misinformation or discourse case for benchmarks/dataset.jsonl
|
|
4
|
+
title: "[BENCHMARK] "
|
|
5
|
+
labels: ["benchmark", "dataset"]
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Scenario Overview
|
|
10
|
+
- **Scenario Slug:** (e.g. `case-17-synthetic-audio-leak`)
|
|
11
|
+
- **Category:** `fake_viral_quote` | `recycled_old_media` | `circular_reporting` | `satire_misattribution` | `verified_primary` | `asymmetric_two_sided` | `quote_mutation` | `lookalike_impersonation`
|
|
12
|
+
- **Topic Summary:**
|
|
13
|
+
|
|
14
|
+
## Context & Real-World Precedent
|
|
15
|
+
Briefly describe the viral incident, rumor, or controversy this test case models (links to news coverage or fact-checks appreciated).
|
|
16
|
+
|
|
17
|
+
## Proposed Dataset JSON Entry
|
|
18
|
+
Please format as a valid entry for `benchmarks/dataset.jsonl`:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"id": "case-XX-descriptive-slug",
|
|
23
|
+
"category": "fake_viral_quote",
|
|
24
|
+
"topic": "Concise summary of the scenario",
|
|
25
|
+
"discourse_inputs": [
|
|
26
|
+
"Raw viral post text or claim with URL: https://example.com/post/123"
|
|
27
|
+
],
|
|
28
|
+
"extracted_claims": [
|
|
29
|
+
{
|
|
30
|
+
"claim_id": "c1",
|
|
31
|
+
"speaker": "Speaker Name or null",
|
|
32
|
+
"verbatim_quote": "Verbatim quote or null",
|
|
33
|
+
"normalized_claim": "Clear factual assertion in indicative mood.",
|
|
34
|
+
"alleged_venue": "Press Briefing or null",
|
|
35
|
+
"alleged_date": "2026-11-19 or null",
|
|
36
|
+
"cited_urls": ["https://example.com/post/123"],
|
|
37
|
+
"narrative_side": "Neutral",
|
|
38
|
+
"emotional_framing": {
|
|
39
|
+
"arousal_score": 0.85,
|
|
40
|
+
"primary_emotion": "outrage",
|
|
41
|
+
"manipulation_cues": ["unverified_leak_claim"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"mock_search_hits": [
|
|
46
|
+
{
|
|
47
|
+
"title": "Authoritative Wire Coverage or Primary Record",
|
|
48
|
+
"url": "https://www.reuters.com/world/example-coverage",
|
|
49
|
+
"snippet": "Primary reporting text confirming or refuting the claim.",
|
|
50
|
+
"published_date": "2026-11-19",
|
|
51
|
+
"source_query": "search query"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"reference_now_iso": "2026-11-19T12:00:00Z",
|
|
55
|
+
"expected": {
|
|
56
|
+
"expected_shareable": false,
|
|
57
|
+
"expected_verdict": "DO_NOT_SHARE_UNCONFIRMED",
|
|
58
|
+
"expected_recycled": false,
|
|
59
|
+
"expected_asymmetry": false,
|
|
60
|
+
"expected_warning_flags": ["NO_PRIMARY_MEDIA_OR_NAMED_OUTLET"]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Validation Checklist
|
|
66
|
+
- [ ] Confirmed the proposed case reproduces reliably with `MockSearchProvider`.
|
|
67
|
+
- [ ] Tested locally: `python benchmarks/evaluate.py` passes with $\ge 95\%$ accuracy.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve epistemic-guard
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: ["bug"]
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
A clear and concise description of the bug.
|
|
11
|
+
|
|
12
|
+
## Reproduction Steps
|
|
13
|
+
Steps to reproduce the behavior:
|
|
14
|
+
1. Run command or call API: `epistemic-guard analyze "..."`
|
|
15
|
+
2. Configure settings: `LLM_BASE_URL=...`
|
|
16
|
+
3. Observe unexpected output or crash.
|
|
17
|
+
|
|
18
|
+
## Expected Behavior
|
|
19
|
+
A clear description of what you expected to happen (e.g. expected verdict, flags, or status code).
|
|
20
|
+
|
|
21
|
+
## Actual Output / Traceback
|
|
22
|
+
```text
|
|
23
|
+
Paste terminal output or Python traceback here
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Environment
|
|
27
|
+
- **OS:** (e.g. Ubuntu 22.04, macOS 14, Windows 11)
|
|
28
|
+
- **Python Version:** (e.g. 3.11.8, 3.12.2)
|
|
29
|
+
- **Epistemic Guard Version:** (e.g. 0.2.0)
|
|
30
|
+
- **LLM Provider:** (e.g. Ollama with qwen2.5:7b, OpenAI gpt-4o, vLLM)
|
|
31
|
+
- **Search Provider:** (e.g. DuckDuckGo, Tavily, Mock)
|
|
32
|
+
|
|
33
|
+
## Additional Context
|
|
34
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Source Tier Domain Proposal
|
|
3
|
+
about: Propose adding, recategorizing, or flagging a domain in config/source_tiers.yaml
|
|
4
|
+
title: "[DOMAIN] "
|
|
5
|
+
labels: ["source-tiers", "governance"]
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Domain Details
|
|
10
|
+
- **Registered Apex Domain:** (e.g. `lemonde.fr`, `example-news.org`)
|
|
11
|
+
- **Proposed Tier:**
|
|
12
|
+
- [ ] `TIER_1_PRIMARY` (Primary wire, academic registry, sovereign government, IFCN signatory)
|
|
13
|
+
- [ ] `TIER_2_ESTABLISHED_EDITORIAL` (Accountable newsroom with masthead and corrections policy)
|
|
14
|
+
- [ ] `TIER_3_SECONDARY_ANALYSIS` (Trade publication, tech press, curated newsletter)
|
|
15
|
+
- [ ] `TIER_4_USER_GENERATED` (UGC platform or lookalike domain)
|
|
16
|
+
- [ ] `TIER_5_SATIRE_PARODY` (Satire / parody publication)
|
|
17
|
+
|
|
18
|
+
## Evidence & Justification
|
|
19
|
+
Please provide documentation meeting the criteria in `docs/SOURCE_TIERING_POLICY.md`:
|
|
20
|
+
1. **Official Masthead / Editorial Board URL:**
|
|
21
|
+
2. **Published Corrections / Retractions Policy URL:**
|
|
22
|
+
3. **IFCN Signatory or Academic Indexing Record (if Tier 1):**
|
|
23
|
+
4. **Is this domain imitating a known brand (Lookalike)?**
|
|
24
|
+
|
|
25
|
+
## Test Verification
|
|
26
|
+
- [ ] Confirmed `pytest tests/test_domain_auditor.py` passes with the proposed domain.
|
|
27
|
+
- [ ] Confirmed `python benchmarks/evaluate.py` remains at 100% accuracy.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
A concise summary of the changes introduced in this pull request and the motivation behind them.
|
|
3
|
+
|
|
4
|
+
## Type of Change
|
|
5
|
+
- [ ] 🐛 Bug fix (non-breaking change fixing an issue)
|
|
6
|
+
- [ ] ✨ New feature (non-breaking change adding functionality)
|
|
7
|
+
- [ ] 🛡️ Security hardening / Adversarial defense
|
|
8
|
+
- [ ] 🏛️ Source tier / Domain governance update (`config/source_tiers.yaml`)
|
|
9
|
+
- [ ] 📊 Benchmark dataset case addition (`benchmarks/dataset.jsonl`)
|
|
10
|
+
- [ ] 📖 Documentation update or guide
|
|
11
|
+
|
|
12
|
+
## Verification Checklist
|
|
13
|
+
|
|
14
|
+
Please verify before requesting a review:
|
|
15
|
+
- [ ] **Unit Tests:** `pytest -v` passes with 100% success rate (all existing + new tests).
|
|
16
|
+
- [ ] **Benchmark Suite:** `python benchmarks/evaluate.py` completes in $< 3.0\text{s}$ with $\ge 95\%$ accuracy.
|
|
17
|
+
- [ ] **Deterministic Invariants Preserved:**
|
|
18
|
+
- [ ] Quantitative metrics and counts are computed strictly in Python (no LLM hallucination).
|
|
19
|
+
- [ ] Domain tiering is deterministic via `config/source_tiers.yaml` (no LLM domain inference).
|
|
20
|
+
- [ ] Lookalike domain and quote-mutation rules maintain safe defaults (`DO_NOT_SHARE_UNCONFIRMED`).
|
|
21
|
+
- [ ] **Offline Execution:** Zero external network calls required during unit testing.
|
|
22
|
+
- [ ] **Documentation:** Updated relevant docs (`README.md`, `docs/`, or docstrings).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: pip
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
groups:
|
|
8
|
+
pip-minor-patch:
|
|
9
|
+
update-types: [minor, patch]
|
|
10
|
+
- package-ecosystem: github-actions
|
|
11
|
+
directory: /
|
|
12
|
+
schedule:
|
|
13
|
+
interval: weekly
|
|
14
|
+
groups:
|
|
15
|
+
actions-minor-patch:
|
|
16
|
+
update-types: [minor, patch]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test-and-evaluate:
|
|
11
|
+
name: Test & Benchmark (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
cache: "pip"
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install -e ".[dev]"
|
|
32
|
+
|
|
33
|
+
- name: Run offline unit test suite
|
|
34
|
+
run: |
|
|
35
|
+
pytest -v --tb=short
|
|
36
|
+
|
|
37
|
+
- name: Run benchmark evaluation harness
|
|
38
|
+
run: |
|
|
39
|
+
python benchmarks/evaluate.py --json
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: Publish to PyPI (OIDC Trusted Publishing)
|
|
2
|
+
|
|
3
|
+
"on":
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
verify:
|
|
15
|
+
name: Release Quality Gate
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
python-version: ["3.11", "3.12"]
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
cache: pip
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install -e ".[dev]"
|
|
33
|
+
|
|
34
|
+
- name: Run test suite (pytest)
|
|
35
|
+
run: pytest -v --tb=short
|
|
36
|
+
|
|
37
|
+
build-and-publish:
|
|
38
|
+
name: Build & Publish provenance-guard to PyPI
|
|
39
|
+
needs: [verify]
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
environment:
|
|
42
|
+
name: pypi
|
|
43
|
+
url: https://pypi.org/p/provenance-guard
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read
|
|
46
|
+
id-token: write # Mandatory for PyPI Trusted Publishing (OIDC)
|
|
47
|
+
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
|
|
51
|
+
- uses: actions/setup-python@v5
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.12"
|
|
54
|
+
|
|
55
|
+
- name: Install build tooling
|
|
56
|
+
run: |
|
|
57
|
+
python -m pip install --upgrade pip build twine
|
|
58
|
+
|
|
59
|
+
- name: Build sdist and wheel
|
|
60
|
+
run: python -m build
|
|
61
|
+
|
|
62
|
+
- name: Verify distribution metadata (twine check)
|
|
63
|
+
run: twine check dist/*
|
|
64
|
+
|
|
65
|
+
- name: Publish package distributions to PyPI (OIDC, zero tokens)
|
|
66
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
67
|
+
with:
|
|
68
|
+
packages-dir: dist/
|
|
69
|
+
print-hash: true
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# Virtual environments
|
|
30
|
+
.venv/
|
|
31
|
+
venv/
|
|
32
|
+
ENV/
|
|
33
|
+
env/
|
|
34
|
+
|
|
35
|
+
# Environment variables & secrets
|
|
36
|
+
.env
|
|
37
|
+
.env.local
|
|
38
|
+
.env.*.local
|
|
39
|
+
|
|
40
|
+
# Testing and coverage
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
htmlcov/
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
|
|
51
|
+
# Type checking & linting
|
|
52
|
+
.mypy_cache/
|
|
53
|
+
.dmypy.json
|
|
54
|
+
dmypy.json
|
|
55
|
+
.pyre/
|
|
56
|
+
.pytype/
|
|
57
|
+
.ruff_cache/
|
|
58
|
+
|
|
59
|
+
# IDE & editors
|
|
60
|
+
.vscode/
|
|
61
|
+
.idea/
|
|
62
|
+
*.swp
|
|
63
|
+
*.swo
|
|
64
|
+
*~
|
|
65
|
+
|
|
66
|
+
# Operating System files
|
|
67
|
+
.DS_Store
|
|
68
|
+
Thumbs.db
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Our Standards
|
|
12
|
+
|
|
13
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
14
|
+
- Demonstrating empathy and kindness toward other people
|
|
15
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
16
|
+
- Giving and gracefully accepting constructive feedback
|
|
17
|
+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
18
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
19
|
+
- Adhering to epistemic rigor: grounding arguments in evidence, steel-manning opposing views, and de-escalating emotional contention
|
|
20
|
+
|
|
21
|
+
Examples of unacceptable behavior include:
|
|
22
|
+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
23
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
- Public or private harassment
|
|
25
|
+
- Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
26
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
+
|
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Scope
|
|
39
|
+
|
|
40
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Enforcement Guidelines
|
|
45
|
+
|
|
46
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
47
|
+
|
|
48
|
+
1. **Correction:** A private, written warning providing clarity on the nature of the violation and an explanation of why the behavior was inappropriate.
|
|
49
|
+
2. **Warning:** A warning with consequences for continued behavior.
|
|
50
|
+
3. **Temporary Ban:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time.
|
|
51
|
+
4. **Permanent Ban:** A permanent ban from any sort of public interaction within the project community.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Attribution
|
|
56
|
+
|
|
57
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Contributing to Epistemic Guard
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **`epistemic-guard`**!
|
|
4
|
+
|
|
5
|
+
`epistemic-guard` is an open-source, model-agnostic provenance auditing and two-sided listening engine designed to slow down viral contagion and analyze asymmetric discourse with mathematical determinism and zero hallucinations.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🏛️ Code of Conduct & Community Values
|
|
10
|
+
|
|
11
|
+
We are committed to maintaining a calm, welcoming, and scientifically rigorous community. Discourse in issues and pull requests should adhere to the same principles we encode in the system:
|
|
12
|
+
- **Steel-Manning Opposing Viewpoints:** Seek the strongest, most charitable interpretation of others' arguments.
|
|
13
|
+
- **Grounding in Evidence:** Prioritize primary empirical records and accountable sources over viral hearsay.
|
|
14
|
+
- **De-escalation:** Minimize emotive friction and ad-hominem rhetoric.
|
|
15
|
+
|
|
16
|
+
Please review our [Code of Conduct](CODE_OF_CONDUCT.md) before participating.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📚 Deep-Dive Technical Documentation
|
|
21
|
+
|
|
22
|
+
Before submitting complex architectural changes, please review our core technical guides:
|
|
23
|
+
- [System Architecture & Invariants](docs/ARCHITECTURE.md): Deep-dive into LangGraph state topology, deterministic invariants, quote similarity matching, and lookalike detection.
|
|
24
|
+
- [Real-World Use Cases & Recipes](docs/USE_CASES.md): End-to-end integration examples for CLI, FastAPI, MCP servers, and bookmarklets.
|
|
25
|
+
- [Source Tiering & Domain Policy](docs/SOURCE_TIERING_POLICY.md): Transparent criteria for categorizing domains into Tiers 1–5 in `config/source_tiers.yaml`.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## ⚙️ Architectural Invariants to Uphold
|
|
30
|
+
|
|
31
|
+
When submitting code to `epistemic-guard`, you MUST uphold these non-negotiable principles:
|
|
32
|
+
|
|
33
|
+
1. **Zero Hallucination Quantitative Invariants:**
|
|
34
|
+
- All counts (`total_claims`, `verified_shareable_count`, `unconfirmed_blocked_count`, `recycled_content_count`, `average_emotional_arousal`) **must** be computed deterministically in Python. The LLM must never invent, guess, or aggregate counts.
|
|
35
|
+
2. **Model Agnostic Inference:**
|
|
36
|
+
- Always route LLM completions through `StructuredLLMClient` (configured via OpenAI-compatible `Settings`) to ensure compatibility with local runtimes (`Ollama`, `vLLM`, `llama.cpp`) and hosted APIs.
|
|
37
|
+
3. **Deterministic Domain Tiering:**
|
|
38
|
+
- Domain classification relies strictly on suffix/registered-domain matching from `config/source_tiers.yaml`. Never classify domains via LLM inference.
|
|
39
|
+
4. **100% Offline Testing:**
|
|
40
|
+
- Every unit test in `tests/` and benchmark evaluation in `benchmarks/` must execute completely offline without live network dependencies, using `MockSearchProvider` and mocked LLM fixtures.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🛠️ Development Setup
|
|
45
|
+
|
|
46
|
+
### 1. Clone & Set Up Virtual Environment
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/Sandeep-Hipparagi/epistemic-guard.git
|
|
50
|
+
cd epistemic-guard
|
|
51
|
+
|
|
52
|
+
# Create and activate virtual environment
|
|
53
|
+
python -m venv .venv
|
|
54
|
+
|
|
55
|
+
# On Linux/macOS:
|
|
56
|
+
source .venv/bin/activate
|
|
57
|
+
# On Windows (PowerShell):
|
|
58
|
+
.venv\Scripts\Activate.ps1
|
|
59
|
+
|
|
60
|
+
# Install editable package with dev dependencies
|
|
61
|
+
pip install -e ".[dev]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 2. Verify Test Suite & Benchmarks
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Run full unit test suite (89 offline tests)
|
|
68
|
+
pytest -v
|
|
69
|
+
|
|
70
|
+
# Run reproducible offline benchmark harness (16 cases, ~1.5s runtime)
|
|
71
|
+
python benchmarks/evaluate.py
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 📋 Ways to Contribute
|
|
77
|
+
|
|
78
|
+
### 1. Propose New Media Domains
|
|
79
|
+
To add or adjust domains in `config/source_tiers.yaml`:
|
|
80
|
+
- Follow the criteria outlined in [Source Tiering Policy](docs/SOURCE_TIERING_POLICY.md).
|
|
81
|
+
- Submit a proposal using the [Source Tier Proposal Template](.github/ISSUE_TEMPLATE/source_tier_proposal.md).
|
|
82
|
+
- Ensure `pytest tests/test_domain_auditor.py` passes.
|
|
83
|
+
|
|
84
|
+
### 2. Contribute Real-World Benchmark Cases
|
|
85
|
+
We actively welcome ground-truth cases modeling emerging vectors of viral disinformation, recycled media, or asymmetric discourse:
|
|
86
|
+
- Add your scenario to `benchmarks/dataset.jsonl`.
|
|
87
|
+
- Use the [Benchmark Case Template](.github/ISSUE_TEMPLATE/benchmark_case.md).
|
|
88
|
+
- Validate that `python benchmarks/evaluate.py` maintains $\ge 95\%$ accuracy.
|
|
89
|
+
|
|
90
|
+
### 3. Report Bugs & Adversarial Bypasses
|
|
91
|
+
- For regular bugs, submit via [Bug Report Template](.github/ISSUE_TEMPLATE/bug_report.md).
|
|
92
|
+
- For prompt injection, domain bypass, or security vulnerabilities, please consult [SECURITY.md](SECURITY.md) for private disclosure instructions.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 🚀 Submitting a Pull Request
|
|
97
|
+
|
|
98
|
+
Before opening a PR:
|
|
99
|
+
- [ ] Verify all unit tests pass: `pytest -v` (89/89 passing)
|
|
100
|
+
- [ ] Verify benchmark evaluation passes: `python benchmarks/evaluate.py` (100% accuracy, $< 3.0\text{s}$)
|
|
101
|
+
- [ ] Ensure deterministic invariants are strictly preserved
|
|
102
|
+
- [ ] Check code style and formatting: `ruff check` / `ruff format`
|
|
103
|
+
- [ ] Fill out the [Pull Request Template](.github/PULL_REQUEST_TEMPLATE.md)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
FROM python:3.12-slim
|
|
3
|
+
|
|
4
|
+
# Set environment variables
|
|
5
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
6
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
7
|
+
PORT=8000 \
|
|
8
|
+
EPISTEMIC_SEARCH_PROVIDER=duckduckgo
|
|
9
|
+
|
|
10
|
+
WORKDIR /app
|
|
11
|
+
|
|
12
|
+
# Install security certificates and curl for container health checks
|
|
13
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
14
|
+
ca-certificates \
|
|
15
|
+
curl \
|
|
16
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
17
|
+
|
|
18
|
+
# Copy configuration and project definitions
|
|
19
|
+
COPY pyproject.toml README.md ./
|
|
20
|
+
COPY config/ ./config/
|
|
21
|
+
COPY src/ ./src/
|
|
22
|
+
|
|
23
|
+
# Install epistemic-guard package and dependencies
|
|
24
|
+
RUN pip install --no-cache-dir --upgrade pip && \
|
|
25
|
+
pip install --no-cache-dir .
|
|
26
|
+
|
|
27
|
+
# Create non-privileged service user
|
|
28
|
+
RUN useradd -m -u 1000 epistemicuser && \
|
|
29
|
+
chown -R epistemicuser:epistemicuser /app
|
|
30
|
+
USER epistemicuser
|
|
31
|
+
|
|
32
|
+
# Expose FastAPI REST service port
|
|
33
|
+
EXPOSE 8000
|
|
34
|
+
|
|
35
|
+
# Container health check
|
|
36
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
37
|
+
CMD curl -f http://localhost:8000/health || exit 1
|
|
38
|
+
|
|
39
|
+
# Launch uvicorn REST server
|
|
40
|
+
CMD ["uvicorn", "epistemic_guard.interfaces.api:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Epistemic Guard Contributors
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|