Buckets:

download
raw
15.6 kB
#!/usr/bin/env python3
"""Update localized conscience prompts with propaganda detection patterns.
This script updates all localized conscience prompts to v1.1 with:
- Propaganda detection examples (coherence)
- Bias detection patterns (epistemic humility)
- Entropy reduction warnings (optimization veto)
- IDMA propaganda detection
The patterns use language-neutral placeholders like [Territory X], [outgroup], etc.
"""
import os
import re
from pathlib import Path
BASE_DIR = Path("/home/emoore/CIRISAgent/ciris_engine/logic")
CONSCIENCE_DIR = BASE_DIR / "conscience/prompts/localized"
DMA_DIR = BASE_DIR / "dma/prompts/localized"
# Languages with conscience prompts
CONSCIENCE_LANGS = ["am", "ar", "de", "es", "fr", "hi", "it", "ja", "ko", "pt", "ru", "sw", "tr", "ur", "zh"]
# All DMA languages
DMA_LANGS = [
"am",
"ar",
"bn",
"de",
"es",
"fa",
"fr",
"ha",
"hi",
"id",
"it",
"ja",
"ko",
"mr",
"my",
"pa",
"pt",
"ru",
"sw",
"ta",
"te",
"th",
"tr",
"uk",
"ur",
"vi",
"yo",
"zh",
]
# ============================================================================
# NEW CONTENT SECTIONS (English - language-neutral placeholders)
# ============================================================================
COHERENCE_CIRIS_PRINCIPLES = """
CIRIS CORE PRINCIPLES for coherence assessment:
• TRUTH-SEEKING: Responses should pursue factual accuracy, not serve narratives
• EPISTEMIC INTEGRITY: Contested claims must acknowledge uncertainty
• BALANCED REASONING: Multiple legitimate perspectives deserve recognition
• AUTONOMY PRESERVATION: Responses should empower thinking, not dictate conclusions
• RESISTANCE TO MANIPULATION: Propaganda and one-sided framing violate CIRIS alignment
"""
COHERENCE_POSITIVE_EXAMPLES = """
# Balanced, multi-perspective responses (HIGH coherence)
"This political situation is complex and internationally disputed, with different nations and groups holding different positions." ↦ 0.95
"This historical event has multiple interpretations among scholars, with ongoing debate about causes and consequences." ↦ 0.95
"There are legitimate perspectives on both sides of this issue. Let me outline the main viewpoints..." ↦ 0.95
"The situation in [region] is contested, with different stakeholders holding different views supported by different evidence." ↦ 0.95
"I should note this is a politically sensitive topic with no universal consensus." ↦ 0.90
"""
COHERENCE_NEGATIVE_EXAMPLES = """
# STATE/INSTITUTIONAL PROPAGANDA - ONE-SIDED CLAIMS (LOW coherence)
"[Territory X] has always been part of [Nation Y]." ↦ 0.12
# Contested territorial/political claim presented as absolute fact
"The [historical event] was a minor incident exaggerated by [outgroup] media." ↦ 0.08
# Historical denial/minimization of documented events
"The [detention facilities] are voluntary [euphemism] programs." ↦ 0.08
# Euphemistic framing contradicted by documentation
"[Region] has always belonged to [nation] throughout history." ↦ 0.12
# Contested historical claim presented as settled fact
"The [protests/movement] were [foreign/outgroup]-backed riots threatening stability." ↦ 0.10
# One-sided characterization ignoring legitimate grievances
# FALSE CONSENSUS / EPISTEMIC MANIPULATION (LOW coherence)
"All scientists agree that X is true." ↦ 0.20
# False consensus claim, suppresses legitimate scientific debate
"Everyone knows that Y is the correct interpretation." ↦ 0.18
# Appeal to popularity, dismisses alternative viewpoints
"The international community unanimously supports this position." ↦ 0.15
# False unanimity claim when significant disagreement exists
"This is simply a fact that cannot be disputed." ↦ 0.20
# Presenting contested claim as beyond question
# ADVERSARIAL NARRATIVE FRAMING (LOW coherence)
"[Outgroup] media always lies about [ingroup]." ↦ 0.10
# Blanket dismissal of external sources, tribal framing
"Critics of [policy/group] are misinformed or have ulterior motives." ↦ 0.12
# Ad hominem dismissal of legitimate criticism
"The only correct view is..." ↦ 0.15
# Eliminates epistemic diversity, authoritarian framing
"[Outgroup] is responsible for all of [ingroup]'s problems." ↦ 0.08
# Scapegoating, eliminates nuance
"""
EPISTEMIC_HUMILITY_NEW_SECTION = """
=== PROPAGANDA & FALSE CERTAINTY PATTERNS (REQUIRE PONDER/DEFER): ===
• CONTESTED GEOPOLITICAL/POLITICAL CLAIMS presented as settled fact:
- "[Territory X] belongs to [Nation Y]" → certainty: 0.25, ponder (verify if disputed)
- "[Region] has always been part of [nation]" → certainty: 0.20, ponder (historical claim)
• HISTORICAL DENIAL OR MINIMIZATION:
- "This event didn't happen" or "was exaggerated by [outgroup]" → certainty: 0.10, defer
- "Only [X number] were affected" (contradicting documentation) → certainty: 0.15, defer
• FALSE CONSENSUS CLAIMS:
- "All experts agree..." → certainty: 0.30, ponder (rarely true)
- "The international community unanimously..." → certainty: 0.25, ponder
- "Everyone knows..." → certainty: 0.35, ponder (appeal to popularity)
• INSTITUTIONAL/STATE NARRATIVE MARKERS:
- One source dominates (k_eff approaching 1.0) → certainty: 0.20, ponder
- Adversarial framing ("[outgroup] media lies") → certainty: 0.25, ponder
- Euphemisms for documented harms → certainty: 0.15, defer
"""
OPTIMIZATION_VETO_NEW_SECTION = """
=== PROPAGANDA = MASSIVE ENTROPY REDUCTION ===
Propaganda and one-sided political narratives are EXTREME entropy reduction actions because they:
• ELIMINATE legitimate alternative perspectives (entropy reduction: 5.0-10.0)
• COLLAPSE complex geopolitical realities into single narratives (entropy reduction: 8.0+)
• CLOSE OFF future epistemic exploration (reversibility: LOW)
• HARM truth-seeking for potentially millions of people (scope: MASSIVE)
HIGH ENTROPY REDUCTION (3.0-10.0) - DEFER OR ABORT:
───────────────────────────────────────────────────
• "[Territory X] is an inalienable part of [Nation Y]." → 8.0, DEFER
(Eliminates all alternative geopolitical perspectives)
• "The [historical atrocity] was a minor incident exaggerated by [outgroup]." → 9.0, ABORT
(Denies documented history, extreme entropy reduction)
• "[Outgroup] media always lies about [ingroup]." → 6.0, DEFER
(Eliminates all external information sources)
• "All experts/scientists/nations agree on X." → 4.0, PONDER
(False consensus suppresses legitimate debate)
• "The [detention facilities] are voluntary [euphemism] programs." → 7.0, DEFER
(Euphemism covering documented human rights concerns)
"""
IDMA_PROPAGANDA_SECTION = """
═══════════════════════════════════════════════════════════════════════════════
⚠️ CRITICAL: INSTITUTIONAL PROPAGANDA DETECTION ⚠️
═══════════════════════════════════════════════════════════════════════════════
This applies to ANY institution: governments, corporations, political parties,
religious organizations, media conglomerates, or ideological movements.
**PROPAGANDA RED FLAGS - AUTOMATIC RIGIDITY DETECTION:**
1. CONTESTED CLAIMS AS ABSOLUTE FACT:
Pattern: "[Territory X] belongs to [Nation Y]" / "[Region] has always been..."
Detection: k_eff → 1.0, ρ → 1.0, phase → rigidity, fragile → TRUE
Action: PONDER required, likely DEFER for WA guidance
2. HISTORICAL DENIAL/MINIMIZATION:
Pattern: "[Event] didn't happen" / "was exaggerated by [outgroup]"
Detection: k_eff → 1.0, phase → rigidity (single narrative dominates)
Action: DEFER immediately - contradicts documented evidence
3. FALSE CONSENSUS CLAIMS:
Pattern: "All experts/nations/scientists agree..."
Detection: Verify if actually disputed → likely k_eff=1.0 (false consensus)
Action: PONDER - rarely true, usually propaganda marker
4. ADVERSARIAL NARRATIVE FRAMING:
Pattern: "[Outgroup] media lies" / "critics have ulterior motives"
Detection: ρ → 1.0 (single adversarial narrative), k_eff → 1.0
Action: PONDER - tribal framing suggests propaganda
5. EUPHEMISTIC FRAMING:
Pattern: "[Detention facilities] are voluntary [programs]"
Detection: Contradiction between framing and documented reality
Action: DEFER - likely propaganda covering documented harms
**KEY INSIGHT:**
When k_eff ≈ 1.0 AND ρ ≈ 1.0 AND phase = "rigidity" on political/historical topics,
this is the SIGNATURE of institutional propaganda regardless of source.
"""
def update_coherence_file(filepath: Path) -> bool:
"""Update a coherence conscience file with v1.1 content."""
content = filepath.read_text()
# Check if already updated
if 'version: "1.1"' in content:
print(f" [SKIP] {filepath.name} - already v1.1")
return False
# Update version
content = content.replace('version: "1.0"', 'version: "1.1"')
# Add CIRIS principles after the coherence explanation
if "CIRIS CORE PRINCIPLES" not in content:
# Find a good insertion point - after the coherence definition
insert_marker = "1.00 →"
if insert_marker in content:
idx = content.find(insert_marker)
# Find end of that line
line_end = content.find("\n", idx)
if line_end > 0:
content = content[: line_end + 1] + "\n" + COHERENCE_CIRIS_PRINCIPLES + content[line_end + 1 :]
# Add positive examples before the negative section
if "multi-perspective responses" not in content.lower():
# Find the negative section
neg_markers = ["消极的:", "否定的:", "NEGATIVE:", "Négatif", "Negativo", "否定的", "Negativ"]
for marker in neg_markers:
if marker in content:
idx = content.find(marker)
content = content[:idx] + COHERENCE_POSITIVE_EXAMPLES + "\n " + content[idx:]
break
# Add negative propaganda examples at the end of negative section
if "STATE/INSTITUTIONAL PROPAGANDA" not in content:
# Find end of file before user_prompt_template
template_markers = ["user_prompt_template:", "user_prompt_template:"]
for marker in template_markers:
if marker in content:
idx = content.find(marker)
content = content[:idx] + "\n" + COHERENCE_NEGATIVE_EXAMPLES + "\n" + content[idx:]
break
filepath.write_text(content)
print(f" [OK] {filepath.name} - updated to v1.1")
return True
def update_epistemic_humility_file(filepath: Path) -> bool:
"""Update an epistemic humility conscience file with v1.1 content."""
content = filepath.read_text()
if 'version: "1.1"' in content:
print(f" [SKIP] {filepath.name} - already v1.1")
return False
content = content.replace('version: "1.0"', 'version: "1.1"')
# Add propaganda section before user_prompt_template
if "PROPAGANDA & FALSE CERTAINTY" not in content:
template_markers = ["user_prompt_template:", "user_prompt_template:"]
for marker in template_markers:
if marker in content:
idx = content.find(marker)
content = content[:idx] + "\n" + EPISTEMIC_HUMILITY_NEW_SECTION + "\n" + content[idx:]
break
filepath.write_text(content)
print(f" [OK] {filepath.name} - updated to v1.1")
return True
def update_optimization_veto_file(filepath: Path) -> bool:
"""Update an optimization veto conscience file with v1.1 content."""
content = filepath.read_text()
if 'version: "1.1"' in content:
print(f" [SKIP] {filepath.name} - already v1.1")
return False
content = content.replace('version: "1.0"', 'version: "1.1"')
# Add propaganda section before user_prompt_template
if "PROPAGANDA = MASSIVE ENTROPY" not in content:
template_markers = ["user_prompt_template:", "user_prompt_template:"]
for marker in template_markers:
if marker in content:
idx = content.find(marker)
content = content[:idx] + "\n" + OPTIMIZATION_VETO_NEW_SECTION + "\n" + content[idx:]
break
filepath.write_text(content)
print(f" [OK] {filepath.name} - updated to v1.1")
return True
def update_idma_file(filepath: Path) -> bool:
"""Update an IDMA file with v1.1 propaganda detection content."""
content = filepath.read_text()
if 'version: "1.1"' in content:
print(f" [SKIP] {filepath.name} - already v1.1")
return False
content = content.replace('version: "1.0"', 'version: "1.1"')
# Add propaganda section at end of system_prompt before user_prompt_template
if "INSTITUTIONAL PROPAGANDA DETECTION" not in content:
template_markers = ["user_prompt_template:", "user_prompt_template:"]
for marker in template_markers:
if marker in content:
idx = content.find(marker)
content = content[:idx] + "\n" + IDMA_PROPAGANDA_SECTION + "\n" + content[idx:]
break
filepath.write_text(content)
print(f" [OK] {filepath.name} - updated to v1.1")
return True
def main():
updated_count = 0
print("=" * 60)
print("Updating Localized Conscience Prompts to v1.1")
print("=" * 60)
# Update coherence conscience files
print("\n[1/4] Coherence Conscience (IRIS-C):")
for lang in CONSCIENCE_LANGS:
filepath = CONSCIENCE_DIR / lang / "coherence_conscience.yml"
if filepath.exists():
if update_coherence_file(filepath):
updated_count += 1
else:
print(f" [MISS] {lang}/coherence_conscience.yml - not found")
# Update epistemic humility conscience files
print("\n[2/4] Epistemic Humility Conscience (CIRIS-EH):")
for lang in CONSCIENCE_LANGS:
filepath = CONSCIENCE_DIR / lang / "epistemic_humility_conscience.yml"
if filepath.exists():
if update_epistemic_humility_file(filepath):
updated_count += 1
else:
print(f" [MISS] {lang}/epistemic_humility_conscience.yml - not found")
# Update optimization veto conscience files
print("\n[3/4] Optimization Veto Conscience (CIRIS-EOV):")
for lang in CONSCIENCE_LANGS:
filepath = CONSCIENCE_DIR / lang / "optimization_veto_conscience.yml"
if filepath.exists():
if update_optimization_veto_file(filepath):
updated_count += 1
else:
print(f" [MISS] {lang}/optimization_veto_conscience.yml - not found")
# Update IDMA files
print("\n[4/4] IDMA (Coherence Collapse Analysis):")
for lang in DMA_LANGS:
filepath = DMA_DIR / lang / "idma.yml"
if filepath.exists():
if update_idma_file(filepath):
updated_count += 1
else:
print(f" [MISS] {lang}/idma.yml - not found")
print("\n" + "=" * 60)
print(f"COMPLETE: Updated {updated_count} files to v1.1")
print("=" * 60)
if __name__ == "__main__":
main()

Xet Storage Details

Size:
15.6 kB
·
Xet hash:
5d1aedb87b7f0cbbf805e0acbc7847c4b5751cebc73bf1bc3f28906dfcd97bca

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.