Skip to content

Update README.md

Update README.md #499

name: Epistemic Validation Auditor
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ main ]
workflow_dispatch:
jobs:
audit-patterns:
runs-on: ubuntu-latest
steps:
- name: Checkout repository (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed documentation files
id: changed-files
run: |
# For push events: diff between before and current SHA
# For PR: github.sha is merge commit or last commit; before is target branch tip
BEFORE_SHA="${{ github.event.before || 'HEAD^' }}"
CURRENT_SHA="${{ github.sha }}"
echo "Comparing $BEFORE_SHA → $CURRENT_SHA"
CHANGED_FILES=$(git diff --name-only "$BEFORE_SHA" "\( CURRENT_SHA" | grep -E "\.(md|pdf|yaml|yml|txt) \)" | tr '\n' ' ' || true)
echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
if [ -z "$CHANGED_FILES" ]; then
echo "No relevant documentation files changed — skipping audit."
exit 0
else
echo "Changed files to audit: $CHANGED_FILES"
fi
- name: Install required utilities
run: |
sudo apt update
sudo apt install -y pandoc jq grep bc
- name: Perform Epistemic Audit (FSVE/GENESIS Principle Check)
run: |
CHANGED="${{ steps.changed-files.outputs.changed_files }}"
if [ -z "$CHANGED" ]; then
echo "No files to audit."
exit 0
fi
echo "Auditing changed files: $CHANGED" > audit_report.txt
echo "Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> audit_report.txt
echo "" >> audit_report.txt
echo "## Principle Presence Check (in changed files)" >> audit_report.txt
FOUND=false
for file in $CHANGED; do
if grep -i -E "Uncertainty Is Conserved|No Free Certainty|Pattern Legitimacy Precedes Performance|Composition Compounds Uncertainty|No Phantom Patterns|Algorithmic Explainability Is Required|Translation Requires Causal Equivalence" "$file" >> audit_report.txt 2>/dev/null; then
echo "Found in $file" >> audit_report.txt
FOUND=true
fi
done
if ! $FOUND; then
echo "⚠️ No core principle references found in changed files." >> audit_report.txt
fi
echo "" >> audit_report.txt
# Basic legitimacy score heuristic (only on changed files)
echo "## Estimated Pattern Legitimacy Score (PLS)" >> audit_report.txt
PRINCIPLE_COUNT=$(grep -i -E "Uncertainty|Legitimacy|Phantom|Explainability|Causal" $CHANGED 2>/dev/null | wc -l || echo 0)
FILE_COUNT=$(echo "$CHANGED" | wc -w)
if [ "$FILE_COUNT" -gt 0 ]; then
PLS=$(echo "scale=2; $PRINCIPLE_COUNT / ($FILE_COUNT * 5)" | bc)
PLS=$(echo "if($PLS > 1) 1 else $PLS" | bc)
else
PLS=0.00
fi
echo "Basic heuristic PLS: $PLS (0.00–1.00)" >> audit_report.txt
echo "(Rough: \~5 expected principle refs per file)" >> audit_report.txt
if (( $(echo "$PLS < 0.40" | bc -l) )); then
echo "::error file=audit_report.txt::Low legitimacy score ($PLS) — potential FSVE/GENESIS violation. Review for uncertainty conservation and structural honesty." >> $GITHUB_STEP_SUMMARY
echo "FAIL: PLS too low ($PLS < 0.40)" >> audit_report.txt
exit 1
else
echo "PASS: PLS $PLS ≥ 0.40" >> audit_report.txt
fi
echo "" >> audit_report.txt
echo "*Audit uses basic keyword matching on changed files only. For advanced LLM scoring, add API integration.*" >> audit_report.txt
- name: Upload Audit Report
if: always()
uses: actions/upload-artifact@v4
with:
name: epistemic-audit-report
path: audit_report.txt
- name: Comment on PR if Audit Failed
if: failure() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ Epistemic audit failed: Low PLS or missing core principles (e.g., Uncertainty conserved, No free certainty). Review changed docs for FSVE/GENESIS compliance. See attached artifact: epistemic-audit-report'
})