Home / Ops / More in this area

How to push a new Mission & Opportunity PDF (for the Code chat)

Updated Jun 29, 2026 · Affirmology_UpdateMissionPDF_Instructions.md

Summary. The live demo's "Read it" card and download link point at ONE fixed R2 URL: https://media.affirmology.ai/docs/mission-and-opportunities.pdf

How to push a new Mission & Opportunity PDF (for the Code chat)

The live demo's "Read it" card and download link point at ONE fixed R2 URL: https://media.affirmology.ai/docs/mission-and-opportunities.pdf

So updating the doc = overwrite that one key. No code change, no redeploy. The page is current the moment the upload finishes (modulo a short edge-cache delay; see purge below).

Update it (run on the Mac, from the project folder)

Put the new PDF anywhere in the project folder, then run this (edit LOCAL to the new filename if different):

cd /Users/jeffreyparker/CLAUDE/AFFIRMOLOGY && affirmology-agent/.venv/bin/python - <<'PY'
import boto3
LOCAL = "Affirmology_Mission_and_Opportunity_v1.pdf"   # the updated PDF in the project folder
KEY   = "docs/mission-and-opportunities.pdf"           # CANONICAL key the live page points at; do NOT change it
env = {}
for line in open('affirmology-agent/.env'):
    line = line.strip()
    if line and not line.startswith('#') and '=' in line:
        k, v = line.split('=', 1); env[k.strip()] = v.strip()
cl = boto3.client('s3',
    endpoint_url=f"https://{env['R2_ACCOUNT_ID']}.r2.cloudflarestorage.com",
    aws_access_key_id=env['R2_ACCESS_KEY_ID'],
    aws_secret_access_key=env['R2_SECRET_ACCESS_KEY'], region_name='auto')
cl.upload_file(LOCAL, env['R2_BUCKET'], KEY, ExtraArgs={'ContentType': 'application/pdf'})
print("LIVE -> https://media.affirmology.ai/" + KEY)
PY

(If boto3 is missing: affirmology-agent/.venv/bin/pip install boto3.)

Verify

curl -I https://media.affirmology.ai/docs/mission-and-opportunities.pdf

Expect 200/206 and content-type: application/pdf. Or just open the URL.

If the OLD version still shows (edge cache)

Cloudflare may cache the file at the edge for a bit. Two ways to force the new one: - Dashboard: Cloudflare → affirmology.ai → Caching → Configuration → Purge Cache → "Custom purge" → enter https://media.affirmology.ai/docs/mission-and-opportunities.pdf. - API (uses CLOUDFLARE_API_TOKEN in affirmology-studio/.env):

cd /Users/jeffreyparker/CLAUDE/AFFIRMOLOGY && python3 - <<'PY'
import os, json, urllib.request
tok=[l.split('=',1)[1].strip() for l in open('affirmology-studio/.env') if l.startswith('CLOUDFLARE_API_TOKEN=')][0]
def cf(path, data=None, method='GET'):
    req=urllib.request.Request("https://api.cloudflare.com/client/v4"+path,
        data=json.dumps(data).encode() if data else None,
        headers={"Authorization":"Bearer "+tok,"Content-Type":"application/json"}, method=method)
    return json.load(urllib.request.urlopen(req))
zone=[z for z in cf("/zones?name=affirmology.ai")["result"]][0]["id"]
print(cf(f"/zones/{zone}/purge_cache", {"files":["https://media.affirmology.ai/docs/mission-and-opportunities.pdf"]}, "POST"))
PY

Rules