---
type: "Source File"
title: "!/usr/bin/env python3"
description: "#!/usr/bin/env python3 \"\"\" openai_signals_oracle.py — Generate DT 3.3 Oracle commentary on OpenAI Signals data. Uses MiniMax only (no Gemini fallback per project rules). Saves commentary to."
resource: "https://data.copecheck.com"
tags: ["copecheck", "data", "source-file", "py"]
timestamp: "2026-09-25T21:31:44Z"
site: "data"
source_path: "copecheck-data/openai_signals_oracle.py"
---

# !/usr/bin/env python3

Source path: `copecheck-data/openai_signals_oracle.py`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-09-25T21:31:44Z`

```py
#!/usr/bin/env python3
"""
openai_signals_oracle.py — Generate DT 3.3 Oracle commentary on OpenAI Signals data.
Uses MiniMax only (no Gemini fallback per project rules).
Saves commentary to data/openai_signals_commentary.json
"""
import json, os, re, sys, requests
from pathlib import Path

BASE = Path(__file__).parent
SUMMARY = BASE / "data" / "openai_signals_summary.json"
OUT     = BASE / "data" / "openai_signals_commentary.json"

[redacted secret-like line]
MINIMAX_URL   = "https://api.minimax.io/v1/chat/completions"
MINIMAX_MODEL = "minimax-m2.7"

SYSTEM = """You are the CopeCheck Oracle, applying the Discontinuity Thesis v3.3 framework.

The Discontinuity Thesis v3.3 holds that AI creates a structural break — not a gradual transition — in labour markets. Four tests:
1. Unit-Cost Collision (30%): AI dramatically undercuts human labour costs. Score 0-100.
2. Interface Collapse (25%): Credentials/tacit knowledge protecting workers is dissolving. Score 0-100.
3. Propagation Blindness (25%): Policymakers/institutions failing to recognise displacement speed. Score 0-100.
4. Coordination Feasibility (20%): Realistic coordination to prevent mass displacement is impossible (high=unlikely). Score 0-100.

COPE SCORING: 0-20=reality, 21-40=somewhat-lucid, 41-60=partial-cope, 61-80=heavy-cope, 81-100=pure-cope.

IMPORTANT: OpenAI framing data as "people use ChatGPT for many things!" is itself a cope signal — the question is what the underlying patterns reveal about work displacement.

Respond with VALID JSON ONLY. No markdown outside JSON."""

def build_prompt(s):
    return f"""Analyse OpenAI Signals data through the DT 3.3 framework.

OPENAI SIGNALS KEY FINDINGS (ChatGPT usage data, Jul 2024 – Jun 2026):

WORK-RELATED USAGE TREND:
- First month ({s['first_month']}): {s['first_work_share']}% of all ChatGPT messages were work-related
- Latest month ({s['latest_month']}): {s['latest_work_share']}% work-related
- Change: {s['change_pp']}pp decline over 24 months
- Peak work share was {s['peak_work_share']}% in {s['peak_month']}

CURRENT USAGE BREAKDOWN (Jun 2026):
- Pure "Work" use: {s['latest_pure_work']}% of all messages
- Schoolwork: {s['latest_schoolwork']}%
- Other/personal/leisure: {s['latest_other']}%

TOPIC CONTEXT:
- Technical help is the most work-concentrated topic (consistently 75-80% work-related)
- Writing and Practical Guidance split roughly 40/60 work vs non-work
- Self-expression is 90%+ non-work

OPENAI'S FRAMING: They present this as evidence of "broad consumer adoption" and "diverse use cases." The NBER paper (Chatterji et al., WP 34255) focuses on usage patterns, not displacement.

Score this dataset against the DT 3.3 framework. Consider:
- What does the declining work-share reveal about how AI integration is evolving?
- Is the "Other" growth evidence of AI normalisation into daily life (accelerating displacement) or harmless leisure use?
- Does OpenAI's own framing of this data constitute cope?

Produce THREE separate commentary entries for different angles:

1. "work_decline" — focused on the 51.3% → 30.4% work-related message decline
2. "other_surge" — focused on the surge of "Other/personal" use from 49% → 67%  
3. "openai_framing" — focused on what OpenAI's choice to publish and frame this data reveals

Respond with this exact JSON:
{{
  "generated_at": "{s['latest_month']}",
  "commentaries": {{
    "work_decline": {{
      "headline": "Short punchy headline max 12 words",
      "commentary_md": "3-paragraph analysis: (a) What the data shows with specific numbers, (b) What it means for DT 3.3 thesis, (c) Counterarguments and caveats",
      "cope_score": <0-100>,
      "cope_type": "<reality|somewhat-lucid|partial-cope|heavy-cope|pure-cope>",
      "scores": {{"unit_cost_collision": <0-100>, "interface_collapse": <0-100>, "propagation_blindness": <0-100>, "coordination_feasibility": <0-100>}},
      "verdict": "One sentence DT 3.3 verdict"
    }},
    "other_surge": {{
      "headline": "...",
      "commentary_md": "...",
      "cope_score": <0-100>,
      "cope_type": "...",
      "scores": {{"unit_cost_collision": <0-100>, "interface_collapse": <0-100>, "propagation_blindness": <0-100>, "coordination_feasibility": <0-100>}},
      "verdict": "..."
    }},
    "openai_framing": {{
      "headline": "...",
      "commentary_md": "...",
      "cope_score": <0-100>,
      "cope_type": "...",
      "scores": {{"unit_cost_collision": <0-100>, "interface_collapse": <0-100>, "propagation_blindness": <0-100>, "coordination_feasibility": <0-100>}},
      "verdict": "..."
    }}
  }}
}}"""

def strip_think(text):
    m = re.search(r'</think>', text)
    return text[m.end():].strip() if m else text

def extract_json(text):
    text = strip_think(text)
    m = re.search(r'```(?:json)?\s*(\{.*?\})\s*```', text, re.DOTALL)
    if m: return m.group(1)
    m = re.search(r'\{.*\}', text, re.DOTALL)
    return m.group(0) if m else text

def call_minimax(system_prompt, user_prompt):
    resp = requests.post(
        MINIMAX_URL,
[redacted secret-like line]
        json={
            "model": MINIMAX_MODEL,
            "messages": [
                {"role": "system", "content": system_prompt},
                {"role": "user", "content": user_prompt},
            ],
[redacted secret-like line]
            "temperature": 0.7,
        },
        timeout=60,
    )
    if resp.status_code == 200:
        content = resp.json().get("choices", [{}])[0].get("message", {}).get("content", "")
        if content:
            return content
    print(f"MiniMax error {resp.status_code}: {resp.text[:300]}", file=sys.stderr)
    return None

def main():
    s = json.loads(SUMMARY.read_text())['summary']
    prompt = build_prompt(s)
    print("Calling MiniMax...", file=sys.stderr)
    raw = call_minimax(SYSTEM, prompt)
    if not raw:
        print("MiniMax failed. No fallback per project rules. Exiting.", file=sys.stderr)
        sys.exit(1)

    try:
        result = json.loads(extract_json(raw))
    except json.JSONDecodeError as e:
        print(f"JSON parse error: {e}\nRaw (500 chars): {raw[:500]}", file=sys.stderr)
        sys.exit(1)

    # Validate cope types match scores
    for key, c in result.get('commentaries', {}).items():
        score = c.get('cope_score', 50)
        if score >= 80:   c['cope_type'] = 'pure-cope'
        elif score >= 60: c['cope_type'] = 'heavy-cope'
        elif score >= 40: c['cope_type'] = 'partial-cope'
        elif score >= 20: c['cope_type'] = 'somewhat-lucid'
        else:             c['cope_type'] = 'reality'

    result['model'] = MINIMAX_MODEL
    OUT.write_text(json.dumps(result, indent=2))
    print(f"OK — commentary written to {OUT}", file=sys.stderr)
    for key, c in result.get('commentaries', {}).items():
        print(f"  [{key}] {c.get('cope_type')} ({c.get('cope_score')}) — {c.get('headline')}")

if __name__ == '__main__':
    main()
```
