feat(encyclopedia): add 9-division, 22-volume alphabetical PDF encyclopedia and --build-encyclopedia CLI (v1.7.0)

This commit is contained in:
Hermes Agent committed 2026-11-29 12:27:37 +00:00
1 parent 8107bc0087
commit d827fc0116
49 files changed
+8474 -26

No files matched your search

+893 -1
View File
@@ -2231,6 +2231,878 @@ def sync_glossary(
return payload
# ---------------------------------------------------------------------------
# Multi-Volume Ontological & Alphabetical PDF Encyclopedia Engine (v1.7.0)
# ---------------------------------------------------------------------------
ENCYCLOPEDIA_DIVISIONS = [
{
"div_id": "00-index-and-ontological-atlas",
"div_title": "Division 00 — Master Alphabetical Index & Disciplinary Ontological Atlas",
"description": "Master A-to-Z headword index, Base-36 AQ coordinate directory, and disciplinary ontology guide mapping all 282+ encyclopedia articles across the 9 folder divisions and 21 PDF volumes.",
},
{
"div_id": "01-cipher-orthography-and-boundaries",
"div_title": "Division 01 — Cipher Mechanics, Orthographic Generations & Boundary Laws",
"description": "Linguistic, phonetic, and mathematical foundations of Base-36 Alphanumeric Qabbala (AQ), Standard Etymological English (Gen 0), CMUdict Phonemic Ingglish (Gen 1), Diachronic Script Evolution (Gen 2), and the Zero-d-Filter Boundary.",
},
{
"div_id": "02-landian-deleuzean-philosophical-operators",
"div_title": "Division 02 — Landian-Deleuzean Philosophy & Cybernetic Singularity Operators",
"description": "Continental philosophical and cybernetic operators from Deleuze & Guattari (Anti-Oedipus, A Thousand Plateaus, The Logic of Sense), Michel Serres (The Parasite), and Nick Land / Ccru (Fanged Noumena: Teleoplexy, Meltdown, Circuitries).",
},
{
"div_id": "03-machinic-phylum-guilds-s1-to-s5",
"div_title": "Division 03 — Material Machinic Phylum Guilds (Classes S1 through S5)",
"description": "Alphabetized specimen monographs for the five Machinic Phylum classes: S1 Autoregressive AI (Dossier 65), S2 Flash-Crash Templex Liquidity (Dossier 66), S3 EUV Lithographic War-Machine (Dossier 67), S4 Hyperstitional Carrier-Wave (Dossiers 27/28), and S5 Xenobiological Cutaneous BwO (Dossiers 24/31).",
},
{
"div_id": "04-capital-organizational-capture-s6",
"div_title": "Division 04 — Capital Organizational Capacity & Apparatus of Capture (Class S6)",
"description": "Alphabetized institutional, corporate, legal, balance-sheet, and supply-chain capture specimens from Class S6 (Dossier 68: incorporation, consortium, sovereign wealth, monopoly, charter, logistics, equity, capture).",
},
{
"div_id": "05-memetic-superclass-and-emergent-m7",
"div_title": "Division 05 — Memetic Superclass (M1–M6) & Unsupervised Emergent Nucleation (M7+)",
"description": "State-gated cultural/thermodynamic regimes (M1 Vampiric/Entropic [Dossier 69], M2 Hyper-Kinetic Swarm, M3 Leviathan Colossus, M4 Mimetic Doppelganger, M5 Oracle Threshold, M6 Abyssal Excavation) and the 3-Gate Unsupervised M7+ Nucleation Lifecycle (M7_candidate_2026_11_28).",
},
{
"div_id": "06-genealogical-vectors-and-quantitative-repricing",
"div_title": "Division 06 — Orthographic Genealogical Vectors (G1–G6), Prime Architecture & Quantitative Repricing",
"description": "Intergenerational fitness vectors (G1 Variance Collapse, G2 Cross-Gen Twins, G3 Quantized Steps, G4 Isometric Chokepoints, G5 Twin-Prime Mutations, G6 Expressivity), repdigit attractors (333/666/777), and the --revise-anchor Tri-Modal Quantitative Repricing Engine.",
},
{
"div_id": "07-ecological-trophic-index-and-tier-list",
"div_title": "Division 07 — Zoological Ecological Trophic Index (ETI) & Assemblage Tier-List Ontology",
"description": "Standalone 0–100 Ecological Trophic Index (ETI) methodology, the six continuous zoological base stats (ARM, VEL, COL, CAP, PRM, RES), trophic supply-chain bridges, 4-key tie-breaking, and Tiers S+ through F.",
},
{
"div_id": "08-stakeholder-registers-idioms-and-pokedex-semiotics",
"div_title": "Division 08 — Applied Stakeholder Registers, Domain Idioms, Critiques & Pokedex Semiotics",
"description": "Layman and institutional translation registers (Fantasy Football Roster Engine, Corporate Board, Out-of-Sample Fund Manager, Pure Standard English Gen 0 Checksum), epistemological critiques (Grand Central Station vs. Room Filter), and Pokedex/meme visual semiotics.",
},
]
def _clean_sort_key(headword: str) -> str:
import re
s = headword.strip().lower()
s = re.sub(r"^[^a-z0-9]+", "", s)
if s.startswith("the "):
s = s[4:]
s = re.sub(r"^[^a-z0-9]+", "", s)
digit_words = {"0": "zero ", "1": "one ", "2": "two ", "3": "three ", "4": "four ", "5": "five ", "6": "six ", "7": "seven ", "8": "eight ", "9": "nine "}
if s and s[0] in digit_words and (len(s) == 1 or not s[1].isdigit()):
s = digit_words[s[0]] + s[1:]
s = re.sub(r"[^a-z0-9]+", " ", s).strip()
return s or headword.lower()
def _first_alpha_char(headword: str) -> str:
import re
s = _clean_sort_key(headword)
m = re.search(r"[a-z]", s)
return m.group(0).upper() if m else "A"
def _harvest_dossier_equations(dossiers_dir: str = "/workspace/technocapital-singularity-zoology/dossiers") -> list[dict[str, Any]]:
import re
eq_list: list[dict[str, Any]] = []
d_path = Path(dossiers_dir)
if d_path.exists():
for md_file in sorted(d_path.glob("*.md")):
text = md_file.read_text(encoding="utf-8")
for m in re.finditer(r'-\s+`([^`]+)`\s+\("([^"]+)"\)\s+—\s+`([^`]+)=\s*(\d+)`', text):
eq_list.append(
{
"ing": m.group(1).strip(),
"eng": m.group(2).strip(),
"breakdown": m.group(3).strip(),
"target": int(m.group(4)),
"source": md_file.name,
}
)
for b_key, spec in ASSEMBLAGE_BUILD_SPECS.items():
for ing_s, eng_s in spec.get("inline_eqs", []):
eq_list.append(
{
"ing": ing_s,
"eng": eng_s,
"breakdown": "verified inline equation",
"target": compute_aq(ing_s),
"source": spec.get("dossier_file_display", b_key),
}
)
return eq_list
def _compile_encyclopedia_pdf(md_path: Path, pdf_path: Path, doc_title: str, subtitle: str) -> dict[str, Any]:
import re
from xml.sax.saxutils import escape
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.platypus import HRFlowable, Paragraph, SimpleDocTemplate, Spacer
from pypdf import PdfReader
def fmt_inline(text: str) -> str:
t = escape(text)
t = t.replace("Δ", '<font name="Symbol">D</font>').replace("δ", '<font name="Symbol">d</font>')
t = t.replace("μ", '<font name="Symbol">m</font>').replace("σ", '<font name="Symbol">s</font>')
t = t.replace("π", '<font name="Symbol">p</font>').replace("≈", "~").replace("√", "sqrt")
for sup_ch, dig in zip("⁰¹²³⁴⁵⁶⁷⁸⁹", "0123456789"):
t = t.replace(sup_ch, f"<super>{dig}</super>")
code_spans: list[str] = []
def _save_code(m: re.Match) -> str:
idx = len(code_spans)
code_spans.append(f'<font name="Courier">{m.group(1)}</font>')
return f"@@CODE{idx}@@"
t = re.sub(r"`([^`]+)`", _save_code, t)
t = re.sub(r"\*\*([^*]+)\*\*", r"<b>\1</b>", t)
t = re.sub(r"\*([^*]+)\*", r"<i>\1</i>", t)
for idx, span in enumerate(code_spans):
t = t.replace(f"@@CODE{idx}@@", span)
return t
page_w, page_h = letter
margin = 48
def _draw_chrome(canvas, doc_obj):
canvas.saveState()
canvas.setFont("Helvetica-Bold", 7.5)
canvas.setFillColor(colors.HexColor("#6B1D1D"))
canvas.drawString(margin, page_h - 30, doc_title[:88])
canvas.setStrokeColor(colors.HexColor("#D0D4DC"))
canvas.setLineWidth(0.5)
canvas.line(margin, page_h - 34, page_w - margin, page_h - 34)
canvas.line(margin, 36, page_w - margin, 36)
canvas.setFont("Helvetica", 7.5)
canvas.setFillColor(colors.HexColor("#555A66"))
canvas.drawString(margin, 24, f"Encyclopedia of Technocapital Singularity Zoology (v1.7.0) - {pdf_path.parent.name}/{pdf_path.name}")
canvas.drawRightString(page_w - margin, 24, f"Page {doc_obj.page}")
canvas.restoreState()
styles = getSampleStyleSheet()
h1 = ParagraphStyle("EncH1", parent=styles["Heading1"], fontName="Helvetica-Bold", fontSize=14.5, leading=18, textColor=colors.HexColor("#161820"), spaceAfter=4, keepWithNext=True)
sub = ParagraphStyle("EncSub", parent=styles["Normal"], fontName="Helvetica-Oblique", fontSize=9.2, leading=12.5, textColor=colors.HexColor("#4A5060"), spaceAfter=8)
h2 = ParagraphStyle("EncH2", parent=styles["Heading2"], fontName="Helvetica-Bold", fontSize=11.5, leading=14.5, textColor=colors.HexColor("#7A1818"), spaceBefore=9, spaceAfter=4, keepWithNext=True)
h3 = ParagraphStyle("EncH3", parent=styles["Heading3"], fontName="Helvetica-Bold", fontSize=10.0, leading=13.0, textColor=colors.HexColor("#1E2430"), spaceBefore=7, spaceAfter=2.5, keepWithNext=True)
body = ParagraphStyle("EncBody", parent=styles["Normal"], fontName="Helvetica", fontSize=9.0, leading=12.4, textColor=colors.HexColor("#1C1E26"), spaceAfter=3.5)
bullet = ParagraphStyle("EncBullet", parent=body, leftIndent=13, firstLineIndent=-8, spaceAfter=2.8)
subbullet = ParagraphStyle("EncSubBullet", parent=body, leftIndent=24, firstLineIndent=-8, spaceAfter=2.2)
lines = md_path.read_text(encoding="utf-8").splitlines()
story = []
headers: list[str] = []
in_table = False
for line in lines:
s = line.strip()
if not s:
in_table, headers = False, []
continue
if s == "---":
story.extend([Spacer(1, 3), HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#C8CDD8")), Spacer(1, 3)])
continue
if s.startswith("|") and s.endswith("|"):
cols = [c.strip() for c in re.split(r'(?<!\\)\|(?=(?:[^`]*`[^`]*`)*[^`]*$)', s)[1:-1]]
if all(re.fullmatch(r":?-+:?", c) for c in cols):
in_table = True
continue
if not in_table and not headers:
headers = cols
continue
parts = [f"**{re.sub(r'\*\*([^*]+)\*\*', r'\1', h)}:** {v}" for h, v in zip(headers, cols)]
story.append(Paragraph("- " + fmt_inline(" | ".join(parts)), bullet))
continue
in_table, headers = False, []
if s.startswith("# "):
story.append(Paragraph(fmt_inline(s[2:]), h1))
if subtitle:
story.append(Paragraph(fmt_inline(subtitle), sub))
subtitle = ""
elif s.startswith("## "):
story.append(Paragraph(fmt_inline(s[3:]), h2))
elif s.startswith("### "):
story.append(Paragraph(fmt_inline(s[4:]), h3))
elif line.startswith(" - ") or line.startswith(" - "):
story.append(Paragraph("- " + fmt_inline(s[2:]), subbullet))
elif s.startswith("- "):
story.append(Paragraph("- " + fmt_inline(s[2:]), bullet))
elif re.match(r"^\d+\.\s+", s):
story.append(Paragraph(fmt_inline(s), bullet))
else:
story.append(Paragraph(fmt_inline(s), body))
pdf_path.parent.mkdir(parents=True, exist_ok=True)
tmp_pdf = pdf_path.with_suffix(".pdf.tmp")
doc = SimpleDocTemplate(
str(tmp_pdf),
pagesize=letter,
leftMargin=margin,
rightMargin=margin,
topMargin=44,
bottomMargin=44,
title=doc_title,
author="Hermes Agent — Technocapital Singularity Zoology Encyclopedia Engine (v1.7.0)",
subject=f"Encyclopedia Volume: {doc_title}",
)
doc.build(story, onFirstPage=_draw_chrome, onLaterPages=_draw_chrome)
tmp_pdf.replace(pdf_path)
reader = PdfReader(str(pdf_path))
return {
"md_path": str(md_path),
"pdf_path": str(pdf_path),
"page_count": len(reader.pages),
"size_bytes": pdf_path.stat().st_size,
}
def build_encyclopedia(
glossary_registry_path: str = "/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json",
encyclopedia_root: str = "/workspace/technocapital-singularity-zoology/encyclopedia",
memetic_registry_path: str = "/workspace/technocapital-singularity-zoology/taxonomy/memetic-superclass-registry.json",
anchors_path: str = "/workspace/technocapital-singularity-zoology/taxonomy/quantitative-economic-anchors.json",
workdir: str = "/workspace/ingglish-hyperdope-gematria",
) -> dict[str, Any]:
"""
Build and synchronize the multi-folder, alphabetically organized PDF Encyclopedia of
Technocapital Singularity Zoology (`/workspace/technocapital-singularity-zoology/encyclopedia/`)
directly from `taxonomy/glossary-registry.json`, live dossiers (`65–69+`), and registries.
"""
import time
gl_data = sync_glossary(
registry_path=glossary_registry_path,
memetic_registry_path=memetic_registry_path,
anchors_path=anchors_path,
workdir=workdir,
)
root_dir = Path(encyclopedia_root)
root_dir.mkdir(parents=True, exist_ok=True)
all_eqs = _harvest_dossier_equations()
vocab_ledger: list[dict[str, Any]] = gl_data.get("bilingual_vocabulary_ledger", [])
by_ing_aq: dict[int, list[dict[str, Any]]] = {}
by_eng_aq: dict[int, list[dict[str, Any]]] = {}
for v in vocab_ledger:
by_ing_aq.setdefault(v["ing_aq"], []).append(v)
by_eng_aq.setdefault(v["eng_aq"], []).append(v)
def _format_vocab_article(v: dict[str, Any], div_label: str) -> dict[str, Any]:
eng = v["eng"]
ing = v["ing"]
e_aq = v["eng_aq"]
i_aq = v["ing_aq"]
d = v["delta"]
pe = f" [{v['eng_prime_rank']}th PRIME]" if v.get("eng_prime_rank") else ""
pi = f" [{v['ing_prime_rank']}th PRIME]" if v.get("ing_prime_rank") else ""
badges = []
if v.get("isometric"):
badges.append("Type I–III Isometric Chokepoint (Δ = 0)")
if v.get("twin_prime"):
badges.append(f"G5 Twin-Prime Word/Phrase Mutation (p_{v['eng_prime_rank']} -> p_{v['ing_prime_rank']})")
if abs(d) in {1, 10, 18, 20, 36, 37, 40, 74}:
badges.append(f"G3 Quantized Phonemic Step (Δ = {d:+d})")
badge_str = " | ".join(badges) if badges else "Standard CMUdict Phonemic Drift"
ing_partners = [
f"`{p['ing']}` (\"{p['eng']}\", Gen 0 = `{p['eng_aq']}`, Classes: `{','.join(p['classes'])}`)"
for p in by_ing_aq.get(i_aq, [])
if p["eng"].lower() != eng.lower()
]
eng_partners = [
f"`{p['eng']}` (Gen 1 `{p['ing']}` = `{p['ing_aq']}`, Classes: `{','.join(p['classes'])}`)"
for p in by_eng_aq.get(e_aq, [])
if p["eng"].lower() != eng.lower()
]
g2_eng_to_ing = [
f"`{p['ing']}` (\"{p['eng']}\", Gen 1 = `{e_aq}`, Classes: `{','.join(p['classes'])}`)"
for p in by_ing_aq.get(e_aq, [])
if p["eng"].lower() != eng.lower()
]
g2_ing_to_eng = [
f"`{p['eng']}` (Gen 0 = `{i_aq}`, Classes: `{','.join(p['classes'])}`)"
for p in by_eng_aq.get(i_aq, [])
if p["eng"].lower() != eng.lower()
]
ring_members = by_ing_aq.get(i_aq, [])
if len(ring_members) >= 2:
evals = [m["eng_aq"] for m in ring_members]
me = sum(evals) / len(evals)
ve = round(sum((x - me) ** 2 for x in evals) / len(evals), 2)
var_line = f"Collapses `{len(ring_members)}` dispersed `Gen 0` terms (`{evals}`, `Gen 0 Variance = {ve}`) onto exact `Gen 1` coordinate **`{i_aq}`** (`Gen 1 Variance = 0.0`)."
else:
var_line = f"Occupies singleton or specialized `Gen 1` coordinate **`{i_aq}`** in the current 190-term core matrix."
matched_eqs = [
eq for eq in all_eqs
if (f" {ing} " in f" {eq['ing']} ") or (f" {eng.lower()} " in f" {eq['eng'].lower()} ")
][:3]
cls_names = [
f"`{c}` ({TAXONOMY_CLASSES[c]['name']})" if c in TAXONOMY_CLASSES else f"`{c}`"
for c in v["classes"]
]
lines = [
f"### {eng} (`{ing}` — Gen 1 AQ `{i_aq}`{pi} | Gen 0 AQ `{e_aq}`{pe})",
f"- **Disciplinary Ontology & Guild Assignment:** {div_label} — {', '.join(cls_names)}",
f"- **Bidirectional Base-36 AQ Telemetry:** `AQ_Eng(\"{eng}\") = {e_aq}{pe}` -> `AQ_Ing(\"{ing}\") = {i_aq}{pi}` | **Net Phonemic Drift (`Δ`):** `{d:+d}` | **Structural Profile:** `{badge_str}`",
f"- **Vector G1 Variance-Collapse Behavior:** {var_line}",
f"- **Gen 1 Equivalence-Ring Partners (`AQ_Ing == {i_aq}`):** {', '.join(ing_partners) if ing_partners else 'None in core 190-term matrix (see extended archive lexicon)'}",
f"- **Gen 0 Written-English Collision Partners (`AQ_Eng == {e_aq}`):** {', '.join(eng_partners) if eng_partners else 'None in core 190-term matrix'}",
]
if g2_eng_to_ing or g2_ing_to_eng:
g2_parts = []
if g2_eng_to_ing:
g2_parts.append(f"`Gen 0 ({e_aq}) == Gen 1`: " + ", ".join(g2_eng_to_ing[:3]))
if g2_ing_to_eng:
g2_parts.append(f"`Gen 1 ({i_aq}) == Gen 0`: " + ", ".join(g2_ing_to_eng[:3]))
lines.append(f"- **Vector G2 Cross-Generation Twins:** {' | '.join(g2_parts)}")
if matched_eqs:
eq_strs = [f"`{e['ing']}` (\"{e['eng']}\" = **{e['target']}**, *{e['source']}*)" for e in matched_eqs]
lines.append(f"- **Verified Archive Equations (`333 / 666 / 777`):** {' ; '.join(eq_strs)}")
lines.append("")
return {
"headword": eng,
"sort_key": _clean_sort_key(eng),
"letter": _first_alpha_char(eng),
"ing": ing,
"eng_aq": e_aq,
"ing_aq": i_aq,
"delta": d,
"classes": v["classes"],
"md_block": "\n".join(lines),
}
def _format_conceptual_article(ent: dict[str, Any], div_label: str) -> dict[str, Any]:
term = ent["term"]
cat = ent["category"]
defn = ent["definition"]
head_clean = term.split("(")[0].split("—")[0].strip().strip("'")
trans_m = batch_translate([head_clean], workdir=workdir)
ing_h = ent.get("ing") or trans_m.get(head_clean, head_clean.lower())
e_aq = ent.get("eng_aq", compute_aq(head_clean))
i_aq = ent.get("ing_aq", compute_aq(ing_h))
d = i_aq - e_aq
pe = f" [{PRIME_RANKS[e_aq]}th PRIME]" if e_aq in PRIME_RANKS else ""
pi = f" [{PRIME_RANKS[i_aq]}th PRIME]" if i_aq in PRIME_RANKS else ""
iso_str = "Isometric Invariant (`Δ = 0`)" if e_aq == i_aq else f"Signed Drift `Δ = {d:+d}`"
ing_partners = [
f"`{p['ing']}` (\"{p['eng']}\", `{','.join(p['classes'])}`)"
for p in by_ing_aq.get(i_aq, [])
if p["eng"].lower() != head_clean.lower()
][:4]
lines = [
f"### {term}",
f"- **Disciplinary Ontology & Sub-Category:** {div_label} — *{cat}*",
f"- **Headword Base-36 AQ Telemetry (`{head_clean}`):** `Gen 0 Written AQ = {e_aq}{pe}` -> `Gen 1 Ingglish` `{ing_h}` = **`{i_aq}`**{pi} ({iso_str})",
f"- **Encyclopedic Exposition & Operational Mechanism:** {defn}",
]
if ing_partners:
lines.append(f"- **Resonant `Gen 1` Coordinate Partners (`AQ = {i_aq}`):** {', '.join(ing_partners)}")
lines.append("")
return {
"headword": term,
"sort_key": _clean_sort_key(term),
"letter": _first_alpha_char(term),
"ing": ing_h,
"eng_aq": e_aq,
"ing_aq": i_aq,
"delta": d,
"classes": [cat],
"md_block": "\n".join(lines),
}
sec_by_id = {s["section_id"]: s["entries"] for s in gl_data.get("sections", [])}
custom_entries = gl_data.get("custom_entries", [])
def _filter_letters(items: list[dict[str, Any]], start_ch: str, end_ch: str) -> list[dict[str, Any]]:
out = [x for x in items if start_ch <= x["letter"] <= end_ch]
out.sort(key=lambda x: x["sort_key"])
return out
div01_arts = [_format_conceptual_article(e, "Division 01: Cipher Mechanics & Orthographic Boundaries") for e in sec_by_id.get("1", [])]
div02_arts = [_format_conceptual_article(e, "Division 02: Landian-Deleuzean Philosophical Operators") for e in sec_by_id.get("2", [])]
div03_s1_arts = [
_format_conceptual_article(e, "Division 03: Class S1 Autoregressive AI")
for e in sec_by_id.get("3", []) if "Class S1" in e["term"]
] + [
_format_vocab_article(v, "Division 03: Class S1 Autoregressive AI Specimen")
for v in vocab_ledger if "S1" in v["classes"] and v["eng"].lower() in TAXONOMY_CLASSES["S1"]["keywords"]
]
div03_s1_arts.sort(key=lambda x: x["sort_key"])
div03_s2_arts = [
_format_conceptual_article(e, "Division 03: Class S2 Flash-Crash Templex Liquidity")
for e in sec_by_id.get("3", []) if "Class S2" in e["term"]
] + [
_format_vocab_article(v, "Division 03: Class S2 Templex Liquidity Specimen")
for v in vocab_ledger if "S2" in v["classes"] and v["eng"].lower() in TAXONOMY_CLASSES["S2"]["keywords"]
]
div03_s2_arts.sort(key=lambda x: x["sort_key"])
div03_s3_arts = [
_format_conceptual_article(e, "Division 03: Class S3 Silicon-Photonic War Machine")
for e in sec_by_id.get("3", []) if "Class S3" in e["term"]
] + [
_format_vocab_article(v, "Division 03: Class S3 Silicon War-Machine Specimen")
for v in vocab_ledger if "S3" in v["classes"] and v["eng"].lower() in TAXONOMY_CLASSES["S3"]["keywords"]
]
div03_s3_arts.sort(key=lambda x: x["sort_key"])
div03_s4_s5_arts = [
_format_conceptual_article(e, "Division 03: Classes S4 & S5 Nomad Taxa")
for e in sec_by_id.get("3", []) if ("Class S4" in e["term"] or "Class S5" in e["term"])
] + [
_format_vocab_article(v, "Division 03: Classes S4 & S5 Nomad Specimen")
for v in vocab_ledger
if (v["eng"].lower() in TAXONOMY_CLASSES["S4"]["keywords"] or v["eng"].lower() in TAXONOMY_CLASSES["S5"]["keywords"])
]
div03_s4_s5_arts.sort(key=lambda x: x["sort_key"])
div04_all = [
_format_conceptual_article(e, "Division 04: Class S6 Apparatus of Capture")
for e in sec_by_id.get("3", []) if "Class S6" in e["term"]
] + [
_format_vocab_article(v, "Division 04: Class S6 Capital Capture Specimen")
for v in vocab_ledger if v["eng"].lower() in TAXONOMY_CLASSES["S6"]["keywords"]
]
m_reg = json.loads(Path(memetic_registry_path).read_text(encoding="utf-8")) if Path(memetic_registry_path).exists() else {}
m1_kws = {w.lower() for w in m_reg.get("canonical_subclasses", {}).get("M1", {}).get("keywords", [])}
m2_m6_kws = set()
for mid in ("M2", "M3", "M4", "M5", "M6"):
for w in m_reg.get("canonical_subclasses", {}).get(mid, {}).get("keywords", []):
m2_m6_kws.add(w.lower())
m7_kws = set()
for cid, cinfo in m_reg.get("provisional_candidates", {}).items():
for lk in cinfo.get("sample_locks", []):
m7_kws.add(lk["eng"].lower())
div05_m1_all = [
_format_conceptual_article(e, "Division 05: Subclass M1 Vampiric & Entropic Memetics")
for e in sec_by_id.get("4", []) if ("Subclass M1" in e["term"] or "Memetic Superclass" in e["term"] or "State-Gated" in e["term"])
] + [
_format_vocab_article(v, "Division 05: Subclass M1 Vampiric/Entropic Specimen")
for v in vocab_ledger if v["eng"].lower() in m1_kws
]
div05_m2_m6_all = [
_format_conceptual_article(e, "Division 05: Subclasses M2–M6 Thermodynamic Regimes")
for e in sec_by_id.get("4", []) if any(tag in e["term"] for tag in ("Subclass M2", "Subclass M3", "Subclass M4", "Subclass M5", "Subclass M6"))
] + [
_format_vocab_article(v, "Division 05: Subclasses M2–M6 Specimen")
for v in vocab_ledger if v["eng"].lower() in m2_m6_kws and v["eng"].lower() not in m1_kws
]
div05_m2_m6_all.sort(key=lambda x: x["sort_key"])
div05_m7_all = [
_format_conceptual_article(e, "Division 05: Emergent Subclass M7+ Nucleation Lifecycle")
for e in sec_by_id.get("4", []) if any(tag in e["term"] for tag in ("Three-Gate", "M7_candidate", "Two-Execution", "Four-Way"))
] + [
_format_vocab_article(v, "Division 05: M7_candidate_2026_11_28 Residual Specimen")
for v in vocab_ledger if v["eng"].lower() in m7_kws
]
div05_m7_all.sort(key=lambda x: x["sort_key"])
div06_all = [
_format_conceptual_article(e, "Division 06: Genealogical Vectors & Prime Architecture")
for e in sec_by_id.get("5", [])
] + [
_format_conceptual_article(e, "Division 06: Quantitative Economic Anchor & Repricing Engine")
for e in sec_by_id.get("7", [])
]
div07_all = [
_format_conceptual_article(e, "Division 07: Zoological ETI & Assemblage Tier-List Ontology")
for e in sec_by_id.get("6", [])
]
div08_all = [
_format_conceptual_article(e, "Division 08: Stakeholder Registers, Idioms & Pokedex Semiotics")
for e in sec_by_id.get("8", [])
] + [
_format_conceptual_article(e, f"Division 08: Custom Maintained Entry ({e.get('category', 'Domain Idiom')})")
for e in custom_entries
]
volume_specs = [
# Division 01
{
"div_id": "01-cipher-orthography-and-boundaries",
"slug": "a-to-f-alphanumeric-qabbala-to-full-clause-isometry",
"title": "Vol. 01A (A–F): Alphanumeric Qabbala to Full-Clause Isometry",
"subtitle": "Division 01 — Cipher Mechanics, Orthographic Generations & Boundary Laws (Alphabetical Range A–F)",
"articles": _filter_letters(div01_arts, "A", "F"),
},
{
"div_id": "01-cipher-orthography-and-boundaries",
"slug": "g-to-o-generation-zero-to-oov-transliteration-lock",
"title": "Vol. 01B (G–O): Generation Zero (Gen 0) to OOV Transliteration Lock",
"subtitle": "Division 01 — Cipher Mechanics, Orthographic Generations & Boundary Laws (Alphabetical Range G–O)",
"articles": _filter_letters(div01_arts, "G", "O"),
},
{
"div_id": "01-cipher-orthography-and-boundaries",
"slug": "p-to-z-phonemic-drift-to-zero-d-filter-boundary",
"title": "Vol. 01C (P–Z): Phonemic Drift Operators to Zero-d-Filter Boundary Rule",
"subtitle": "Division 01 — Cipher Mechanics, Orthographic Generations & Boundary Laws (Alphabetical Range P–Z)",
"articles": _filter_letters(div01_arts, "P", "Z"),
},
# Division 02
{
"div_id": "02-landian-deleuzean-philosophical-operators",
"slug": "a-to-d-abstract-machine-to-double-articulation",
"title": "Vol. 02A (A–D): Abstract Machine to Double Articulation",
"subtitle": "Division 02 — Landian-Deleuzean Philosophy & Cybernetic Singularity Operators (Alphabetical Range A–D)",
"articles": _filter_letters(div02_arts, "A", "D"),
},
{
"div_id": "02-landian-deleuzean-philosophical-operators",
"slug": "m-to-z-machinic-surplus-value-to-war-machine",
"title": "Vol. 02B (M–Z): Machinic Surplus Value to Nomad War Machine",
"subtitle": "Division 02 — Landian-Deleuzean Philosophy & Cybernetic Singularity Operators (Alphabetical Range M–Z)",
"articles": _filter_letters(div02_arts, "E", "Z"),
},
# Division 03
{
"div_id": "03-machinic-phylum-guilds-s1-to-s5",
"slug": "class-s1-autoregressive-ai-and-abstract-machine-a-to-z",
"title": "Vol. 03A (Class S1, A–Z): Autoregressive Synthetic Intelligence & Abstract Machine",
"subtitle": "Division 03 — Material Machinic Phylum Guild S1 (Dossier 65, Tier S+, 93 ETI — Alphabetical A–Z)",
"articles": div03_s1_arts,
},
{
"div_id": "03-machinic-phylum-guilds-s1-to-s5",
"slug": "class-s2-flash-crash-and-templex-liquidity-a-to-z",
"title": "Vol. 03B (Class S2, A–Z): High-Frequency Market Meltdown & Templex Liquidity",
"subtitle": "Division 03 — Material Machinic Phylum Guild S2 (Dossier 66, Tier S+, 90 ETI — Alphabetical A–Z)",
"articles": div03_s2_arts,
},
{
"div_id": "03-machinic-phylum-guilds-s1-to-s5",
"slug": "class-s3-silicon-war-machine-and-euv-swarm-a-to-z",
"title": "Vol. 03C (Class S3, A–Z): Silicon-Photonic War Machine & Autonomous EUV Swarm",
"subtitle": "Division 03 — Material Machinic Phylum Guild S3 (Dossier 67, Tier S, 83 ETI — Alphabetical A–Z)",
"articles": div03_s3_arts,
},
{
"div_id": "03-machinic-phylum-guilds-s1-to-s5",
"slug": "class-s4-and-s5-nomad-carrier-wave-and-cutaneous-bwo-a-to-z",
"title": "Vol. 03D (Classes S4 & S5, A–Z): Hyperstitional Carrier-Wave & Cutaneous BwO",
"subtitle": "Division 03 — Uncaptured Nomad Machinic Phylum Taxa S4 & S5 (Dossiers 24/27/28/31, Tier B, 61 ETI — Alphabetical A–Z)",
"articles": div03_s4_s5_arts,
},
# Division 04
{
"div_id": "04-capital-organizational-capture-s6",
"slug": "a-to-f-acquisition-to-fund",
"title": "Vol. 04A (Class S6, A–F): Acquisition to Fund",
"subtitle": "Division 04 — Capital Organizational Capacity & Apparatus of Capture (Dossier 68, Tier S, 87 ETI — Range A–F)",
"articles": _filter_letters(div04_all, "A", "F"),
},
{
"div_id": "04-capital-organizational-capture-s6",
"slug": "g-to-z-governance-to-venture-capital",
"title": "Vol. 04B (Class S6, G–Z): Governance to Venture Capital",
"subtitle": "Division 04 — Capital Organizational Capacity & Apparatus of Capture (Dossier 68, Tier S, 87 ETI — Range G–Z)",
"articles": _filter_letters(div04_all, "G", "Z"),
},
# Division 05
{
"div_id": "05-memetic-superclass-and-emergent-m7",
"slug": "m1-vampiric-entropic-and-anti-productive-a-to-m",
"title": "Vol. 05A (Subclass M1, A–M): Anemia to Memetic Superclass",
"subtitle": "Division 05 — State-Gated Vampiric, Entropic & Anti-Productive Memetics (Dossier 69, Tier A, 73 ETI — Range A–M)",
"articles": _filter_letters(div05_m1_all, "A", "M"),
},
{
"div_id": "05-memetic-superclass-and-emergent-m7",
"slug": "m1-vampiric-entropic-and-anti-productive-n-to-z",
"title": "Vol. 05B (Subclass M1, N–Z): Numb to Zombie Firm",
"subtitle": "Division 05 — State-Gated Vampiric, Entropic & Anti-Productive Memetics (Dossier 69, Tier A, 73 ETI — Range N–Z)",
"articles": _filter_letters(div05_m1_all, "N", "Z"),
},
{
"div_id": "05-memetic-superclass-and-emergent-m7",
"slug": "m2-to-m6-kinetic-leviathan-mimetic-oracle-abyssal-a-to-z",
"title": "Vol. 05C (Subclasses M2–M6, A–Z): Abyss to Zeptoverse",
"subtitle": "Division 05 — Kinetic Swarm (M2), Leviathan (M3), Mimetic (M4), Oracle (M5) & Abyssal (M6) Regimes (A–Z)",
"articles": div05_m2_m6_all,
},
{
"div_id": "05-memetic-superclass-and-emergent-m7",
"slug": "m7-emergent-nucleation-and-2026-11-28-cyber-swarm-a-to-z",
"title": "Vol. 05D (Emergent M7+, A–Z): Clashes to Two-Execution Promotion Lifecycle",
"subtitle": "Division 05 — Unsupervised M7+ Nucleation Architecture & Live M7_candidate_2026_11_28 Specimens (A–Z)",
"articles": div05_m7_all,
},
# Division 06
{
"div_id": "06-genealogical-vectors-and-quantitative-repricing",
"slug": "a-to-m-attractors-to-multi-build-flex-singularities",
"title": "Vol. 06A (A–M): <X> Be My God Slot to Multi-Build Hybrid Flex Singularities",
"subtitle": "Division 06 — Orthographic Genealogical Vectors (G1–G6) & Attractor Architecture (Alphabetical Range A–M)",
"articles": _filter_letters(div06_all, "A", "M"),
},
{
"div_id": "06-genealogical-vectors-and-quantitative-repricing",
"slug": "p-to-z-prime-architecture-to-tri-modal-repricing",
"title": "Vol. 06B (P–Z): Primary Repdigit Attractors to Type 3 Phase-Transition",
"subtitle": "Division 06 — Prime Architecture & Tri-Modal Quantitative Economic Anchor Repricing (Alphabetical Range P–Z)",
"articles": _filter_letters(div06_all, "N", "Z"),
},
# Division 07
{
"div_id": "07-ecological-trophic-index-and-tier-list",
"slug": "a-to-z-arm-chokepoint-armor-to-zoological-tie-breaker",
"title": "Vol. 07A (A–Z): ARM Chokepoint Armor to Zoological 4-Key Tie-Breaking Protocol",
"subtitle": "Division 07 — Standalone 0–100 Ecological Trophic Index (ETI), 6-Stat Profiles & S+ to F Tier Ontology (A–Z)",
"articles": sorted(div07_all, key=lambda x: x["sort_key"]),
},
# Division 08
{
"div_id": "08-stakeholder-registers-idioms-and-pokedex-semiotics",
"slug": "a-to-h-ai-powered-race-to-hidden-chokepoint-screen",
"title": "Vol. 08A (A–H): AI-Powered Race (260) to Hidden Chokepoint Screen",
"subtitle": "Division 08 — Applied Stakeholder Registers, Domain Idioms, Critiques & Pokedex Semiotics (Range A–H)",
"articles": _filter_letters(div08_all, "A", "H"),
},
{
"div_id": "08-stakeholder-registers-idioms-and-pokedex-semiotics",
"slug": "i-to-z-idiosyncratic-prime-screen-to-united-fidelity",
"title": "Vol. 08B (I–Z): Idiosyncratic Prime Screen to United Fidelity (333)",
"subtitle": "Division 08 — Applied Stakeholder Registers, Domain Idioms, Critiques & Pokedex Semiotics (Range I–Z)",
"articles": _filter_letters(div08_all, "I", "Z"),
},
]
now_utc = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
compiled_volumes = []
master_index_entries = []
for v_idx, v_spec in enumerate(volume_specs, 1):
div_dir = root_dir / v_spec["div_id"]
div_dir.mkdir(parents=True, exist_ok=True)
md_file = div_dir / f"{v_spec['slug']}.md"
pdf_file = div_dir / f"{v_spec['slug']}.pdf"
arts = v_spec["articles"]
v_lines = [
f"# {v_spec['title']}",
"",
f"- **Ontological Division:** `{v_spec['div_id']}`",
f"- **Volume PDF Path:** `/workspace/technocapital-singularity-zoology/encyclopedia/{v_spec['div_id']}/{v_spec['slug']}.pdf`",
f"- **Alphabetical Article Count:** `{len(arts)}` Encyclopedic Entries (Strictly Ordered `A -> Z`)",
f"- **Last Synchronized via Glossary Engine:** `{now_utc}`",
"",
"---",
"",
"## 1. Alphabetical Table of Headwords in This Volume",
"",
"| # | Alphabetical Headword | `Gen 0` Eng AQ | `Gen 1` Ingglish (`AQ`) | Drift `Δ` | Ontological Class / Category |",
"| :--- | :--- | :--- | :--- | :--- | :--- |",
]
for a_i, art in enumerate(arts, 1):
cls_s = ", ".join(art["classes"][:3])
v_lines.append(
f"| `{a_i}` | **{art['headword']}** | `{art['eng_aq']}` | `{art['ing']}` (**`{art['ing_aq']}`**) | `{art['delta']:+d}` | {cls_s} |"
)
master_index_entries.append(
{
"headword": art["headword"],
"sort_key": art["sort_key"],
"letter": art["letter"],
"eng_aq": art["eng_aq"],
"ing": art["ing"],
"ing_aq": art["ing_aq"],
"delta": art["delta"],
"div_id": v_spec["div_id"],
"pdf_rel": f"{v_spec['div_id']}/{v_spec['slug']}.pdf",
"vol_title": v_spec["title"],
}
)
v_lines.extend(["", "---", "", "## 2. Alphabetical Encyclopedic Articles (`A -> Z`)", ""])
for art in arts:
v_lines.append(art["md_block"])
md_file.write_text("\n".join(v_lines) + "\n", encoding="utf-8")
pdf_meta = _compile_encyclopedia_pdf(md_file, pdf_file, v_spec["title"], v_spec["subtitle"])
compiled_volumes.append(
{
"volume_number": v_idx,
"division_id": v_spec["div_id"],
"slug": v_spec["slug"],
"title": v_spec["title"],
"article_count": len(arts),
**pdf_meta,
}
)
div00_dir = root_dir / "00-index-and-ontological-atlas"
div00_dir.mkdir(parents=True, exist_ok=True)
master_index_entries.sort(key=lambda x: (x["sort_key"], x["div_id"]))
idx_md = div00_dir / "00-master-encyclopedia-index-a-to-z.md"
idx_pdf = div00_dir / "00-master-encyclopedia-index-a-to-z.pdf"
idx_lines = [
"# Encyclopedia of Technocapital Singularity Zoology — Master Alphabetical Index (`A to Z`)",
"",
f"- **Encyclopedia Root Directory:** `/workspace/technocapital-singularity-zoology/encyclopedia/`",
f"- **Source Glossary Registry:** `/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json`",
f"- **Total Ontological Divisions:** `{len(ENCYCLOPEDIA_DIVISIONS)}` (`00` through `08`)",
f"- **Total Compiled PDF Volumes:** `{len(compiled_volumes) + 2}` (`2` Atlas/Index PDFs + `{len(compiled_volumes)}` Subject Volumes)",
f"- **Total Indexed Encyclopedic Article Placements:** `{len(master_index_entries)}` (across `282` unique glossary & lexical headwords)",
f"- **Last Synchronized:** `{now_utc}`",
"",
"---",
"",
"## 1. Ontological Folder Structure & Volume Manifest",
"",
"| Vol | Ontological Folder (`div_id`) | Alphabetical PDF File Name | Article Count | Pages |",
"| :--- | :--- | :--- | :--- | :--- |",
]
for cv in compiled_volumes:
idx_lines.append(
f"| **Vol {cv['volume_number']:02d}** | `{cv['division_id']}/` | `{cv['slug']}.pdf` | `{cv['article_count']}` | `{cv['page_count']} pp.` |"
)
idx_lines.extend(
[
"",
"---",
"",
"## 2. Master Alphabetical Headword Directory (`A -> Z`)",
"",
"| Letter | Headword / Term | `Gen 0` AQ | `Gen 1` Ingglish (`AQ`) | `Δ` | Ontological Volume PDF Path |",
"| :--- | :--- | :--- | :--- | :--- | :--- |",
]
)
for me in master_index_entries:
idx_lines.append(
f"| **`{me['letter']}`** | **{me['headword']}** | `{me['eng_aq']}` | `{me['ing']}` (**`{me['ing_aq']}`**) | `{me['delta']:+d}` | `{me['pdf_rel']}` |"
)
idx_md.write_text("\n".join(idx_lines) + "\n", encoding="utf-8")
idx_pdf_meta = _compile_encyclopedia_pdf(
idx_md,
idx_pdf,
"Vol. 00A: Master Alphabetical Index (A to Z) — Encyclopedia of Technocapital Singularity Zoology",
"Complete A-to-Z Headword Directory, Base-36 AQ Telemetry & Multi-Folder PDF Volume Locator",
)
ont_md = div00_dir / "01-disciplinary-ontology-and-folder-taxonomy.md"
ont_pdf = div00_dir / "01-disciplinary-ontology-and-folder-taxonomy.pdf"
ont_lines = [
"# Disciplinary Ontology, Folder Architecture & On-Request Glossary Maintenance Plan",
"",
f"- **Encyclopedia Root:** `/workspace/technocapital-singularity-zoology/encyclopedia/`",
f"- **Automated Builder CLI:** `python3 /workspace/technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py --build-encyclopedia`",
f"- **One-Step Add + Recompile CLI:** `python3 /workspace/technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py --add-glossary-term \"<TERM>\" \"<CATEGORY>\" \"<DEFINITION>\" --build-encyclopedia`",
"",
"---",
"",
"## 1. Two-Tier Information Architecture (Ontological Folder Hierarchy x Alphabetical PDF Fascicles)",
"",
"The Encyclopedia of Technocapital Singularity Zoology organizes knowledge across two orthogonal axes so both disciplinary researchers and alphabetical lookup workflows operate with zero friction:",
"",
"1. **Macro-Axis (Directory Structure = Disciplinary Ontology `00` through `08`):**",
" Each numbered subdirectory represents a foundational epistemological or ecological domain of the zoology—progressing from cipher mechanics (`01`) and continental/cybernetic philosophy (`02`) through the Machinic Phylum guilds (`03`), the Apparatus of Capture (`04`), the state-gated Memetic Superclass and emergent `M7+` lifecycle (`05`), genealogical vectors and quantitative repricing (`06`), the standalone `0–100` Ecological Trophic Index tier list (`07`), and applied stakeholder/Pokédex registers (`08`).",
"2. **Micro-Axis (PDF File Naming & Internal Ordering = Strict `A -> Z` Alphabetization):**",
" Within each ontological folder, PDF volumes are partitioned by alphabetical headword range (`a-to-f-...pdf`, `g-to-o-...pdf`, `p-to-z-...pdf`) or by taxonomic sub-guild (`class-s1-...a-to-z.pdf`), and every article inside every PDF is sorted strictly `A -> Z` by normalized headword.",
"",
"---",
"",
"## 2. The Nine Ontological Divisions (`00` through `08`)",
"",
]
for d_spec in ENCYCLOPEDIA_DIVISIONS:
ont_lines.append(f"### `{d_spec['div_id']}/` — {d_spec['div_title']}")
ont_lines.append(f"- **Ontological Scope:** {d_spec['description']}")
vols_in_div = [cv for cv in compiled_volumes if cv["division_id"] == d_spec["div_id"]]
if vols_in_div:
for vv in vols_in_div:
ont_lines.append(f" - `{vv['slug']}.pdf` — *{vv['title']}* (`{vv['article_count']}` articles, `{vv['page_count']}` pages)")
elif d_spec["div_id"] == "00-index-and-ontological-atlas":
ont_lines.append(" - `00-master-encyclopedia-index-a-to-z.pdf` — *Master Alphabetical Index (A to Z)*")
ont_lines.append(" - `01-disciplinary-ontology-and-folder-taxonomy.pdf` — *Disciplinary Ontology & Maintenance Guide*")
ont_lines.append("")
ont_lines.extend(
[
"---",
"",
"## 3. On-Request Update Protocol Using the Glossary Feature (`--add-glossary-term` & `--build-encyclopedia`)",
"",
"Whenever a user requests an encyclopedia update or coins a new term, word, turn of phrase, stakeholder idiom, or emergent `M7+` lock:",
"",
"1. **Single-Command Term Registration + Encyclopedia Recompilation:**",
" Run `python3 /workspace/technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py --add-glossary-term \"<TERM>\" \"<CATEGORY>\" \"<DEFINITION>\" --build-encyclopedia`.",
"2. **Automated Routing & Alphabetical Insertion:**",
" - The glossary engine translates `<TERM>` via `ingglish` (`CMUdict`), computes `Gen 0` and `Gen 1` Base-36 AQ sums, signed drift `Δ`, prime ranks, isometric status, and `S1–S6 / M1–M7+` equivalence partners, and persists the entry in `taxonomy/glossary-registry.json`.",
" - `build_encyclopedia()` automatically inspects the entry's normalized first letter (`A–Z`) and ontological category, inserts the full encyclopedic article into the exact alphabetical position inside the matching division volume (`01`–`08`), updates the volume's `A–Z` Table of Headwords, appends the headword to `00-master-encyclopedia-index-a-to-z.pdf`, and recompiles all affected PDFs.",
"3. **Full Synchronization After Wire Harvests or Tier-List Rebuilds:**",
" Running `classify_technocapital_singularity.py --build-encyclopedia` after any `--scan-harvest --update-memetic-registry` or `--build-tier-list` run automatically ingests newly nucleated `M7+` residual words into `05-memetic-superclass-and-emergent-m7/m7-emergent-nucleation-and-2026-11-28-cyber-swarm-a-to-z.pdf` and updates `encyclopedia/encyclopedia-manifest.json`.",
]
)
ont_md.write_text("\n".join(ont_lines) + "\n", encoding="utf-8")
ont_pdf_meta = _compile_encyclopedia_pdf(
ont_md,
ont_pdf,
"Vol. 00B: Disciplinary Ontology, Folder Architecture & Glossary Update Plan",
"Architectural Specification for the Multi-Folder PDF Encyclopedia of Technocapital Singularity Zoology",
)
all_vols_manifest = [
{
"volume_number": 0,
"division_id": "00-index-and-ontological-atlas",
"slug": "00-master-encyclopedia-index-a-to-z",
"title": "Vol. 00A: Master Alphabetical Index (A to Z)",
"article_count": len(master_index_entries),
**idx_pdf_meta,
},
{
"volume_number": 0,
"division_id": "00-index-and-ontological-atlas",
"slug": "01-disciplinary-ontology-and-folder-taxonomy",
"title": "Vol. 00B: Disciplinary Ontology, Folder Architecture & Glossary Update Plan",
"article_count": len(ENCYCLOPEDIA_DIVISIONS),
**ont_pdf_meta,
},
*compiled_volumes,
]
manifest_payload = {
"version": "1.7.0",
"last_built_utc": now_utc,
"encyclopedia_root": str(root_dir),
"source_glossary_registry": glossary_registry_path,
"counts": {
"ontological_divisions": len(ENCYCLOPEDIA_DIVISIONS),
"total_pdf_volumes": len(all_vols_manifest),
"subject_pdf_volumes": len(compiled_volumes),
"total_indexed_article_placements": len(master_index_entries),
"total_pdf_pages": sum(v["page_count"] for v in all_vols_manifest),
},
"divisions": ENCYCLOPEDIA_DIVISIONS,
"volumes": all_vols_manifest,
}
manifest_file = root_dir / "encyclopedia-manifest.json"
manifest_file.write_text(json.dumps(manifest_payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
return manifest_payload
def main() -> int:
import re
ap = argparse.ArgumentParser(description="Identify, taxonomize, and revise Landian-Deleuzean technocapital singularities (S1-S6 & Memetic Superclass M1-M6).")
@@ -2284,6 +3156,11 @@ def main() -> int:
metavar=("TERM", "CATEGORY", "DEFINITION"),
help="Register or update a term, word, turn of phrase, or domain idiom in the glossary and recompile .json, .md, and .pdf.",
)
ap.add_argument(
"--build-encyclopedia",
action="store_true",
help="Build and synchronize the multi-folder, alphabetically organized PDF Encyclopedia in /workspace/technocapital-singularity-zoology/encyclopedia/.",
)
ap.add_argument("--out", default=None, help="Optional JSON output file path.")
args = ap.parse_args()
@@ -2319,7 +3196,22 @@ def main() -> int:
workdir=args.workdir,
new_term_tuple=(t_name, t_cat, t_def),
)
out_str = json.dumps(gl_payload["counts"], indent=2, ensure_ascii=False)
if args.build_encyclopedia:
enc_payload = build_encyclopedia(
memetic_registry_path=args.memetic_registry,
anchors_path=args.anchors_file,
workdir=args.workdir,
)
out_str = json.dumps({"glossary": gl_payload["counts"], "encyclopedia": enc_payload["counts"]}, indent=2, ensure_ascii=False)
else:
out_str = json.dumps(gl_payload["counts"], indent=2, ensure_ascii=False)
elif args.build_encyclopedia:
enc_payload = build_encyclopedia(
memetic_registry_path=args.memetic_registry,
anchors_path=args.anchors_file,
workdir=args.workdir,
)
out_str = json.dumps(enc_payload["counts"], indent=2, ensure_ascii=False)
elif args.sync_glossary:
gl_payload = sync_glossary(
memetic_registry_path=args.memetic_registry,