Metadata-Version: 2.4
Name: polyhistor
Version: 1.0
Summary: Polyhistor // Global Knowledge Terminal - an offline, cross-disciplinary reference service for law, police, military, art, medicine, technology, culture, science, agentic systems and the academy.
Author: Polyhistor Project
License: MIT
Keywords: knowledge,reference,encyclopedia,law,police,military,art,medicine,technology,science,culture,agentic,ai,academic,research,terminal,offline,global
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Topic :: Education
Classifier: Topic :: Documentation
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Sociology
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# POLYHISTOR // GLOBAL KNOWLEDGE TERMINAL

**One world. Every discipline.**

Polyhistor is an offline-first **general, cross-disciplinary knowledge
service**. The design language is institutional: navy, gold, ivory, crimson and
slate; stable record IDs; provenance; classification; source registries; and
explicit limits.

It is an offline-first reference terminal covering:

- **Academic & research methods** — evidence, peer review, replication, open science
- **Law & jurisprudence** — rule of law, due process, treaties, human rights
- **Police & public safety** — consent, evidence, forensics, oversight
- **Military & strategic studies** — strategy, doctrine, IHL, mission command
- **Intelligence & security** — the intelligence cycle, analysis, oversight
- **Art, design & architecture** — form, provenance, conservation, heritage
- **Encyclopedic reference** — general knowledge, verification, classification
- **Medicine & health** — clinical method, public health, nursing, pharmacy
- **Technology & engineering** — systems, networks, safety, standards
- **Culture & society** — meaning, heritage, religion, popular culture
- **Agentic systems & AI** — agents, evaluation, safety, governance
- **Science & mathematics** — physics, chemistry, biology, Earth, astronomy
- **Governance & diplomacy** — states, treaties, the UN system, mediation
- **Economics, finance & business** — markets, institutions, risk, development
- **Environment & climate** — earth systems, biodiversity, sustainability
- **Language & communication** — linguistics, scripts, translation ethics
- **Philosophy, religion & ethics** — logic, epistemology, moral inquiry
- **Media, journalism & information** — verification, press freedom, disinformation
- **Education & learning** — pedagogy, curricula, assessment, inclusion
- **Sport & recreation** — Olympic governance, integrity, athlete welfare
- **Psychology & behavioural science** — cognition, measurement, mental health
- **History, geography & heritage** — sources, space, memory, archaeology
- **Data & statistics** — inference, uncertainty, provenance, privacy
- **Information & library science** — metadata, catalogues, preservation
- **Cybersecurity** — threat models, defence in depth, responsible disclosure
- **Robotics, energy, agriculture, transport, space, nuclear, finance, trade,
  human rights, urban studies, veterinary science, dentistry, and more**

The registry ships **54 structured domains**, **18 flagship dossiers**,
**565 glossary terms**, **170 notable figures**, **49 reference articles**, a
**117-event world timeline**, a **62-country almanac**, **60 sources**, and
**163,000+ corpus records** from the medical, legal, scientific, psychological, biological,
chemical, religious and intelligence corpora.

---

## Install and run

```bash
cd BDCS/polyhistor
python3 -m pip install .
polyhistor
polyhistor dashboard
polyhistor --help
polyhistor domains
polyhistor law
polyhistor brief medicine
polyhistor topic "rule of law"
polyhistor article rule-of-law
polyhistor agent police
```

From source without installing:

```bash
PYTHONPATH=src python3 -m polyhistor
```

Requirements: **Python 3.8+**, standard library only. No network, API key or
database is required.

---

## Command surface

### Reference

```
domains [filter]              list the 54-domain registry
domain <name|code>            full domain dossier
topic <query> [deep]          federated search across all curated knowledge
open <id>                     open any result row by its displayed ID
article <id|query>            read an article; falls back to a matching record
glossary [query]              cross-domain vocabulary
people [query]                notable figures and contributions
timeline [query]              world knowledge timeline
atlas [section] [query]       countries, UN system, treaties, standards, units, constants
graph <term>                  related records around a concept
random [domain]               sample a record
quiz [domain]                 knowledge check
```

### Workspace

```
brief <domain>                structured 11-section research brief
agent [domain]                specialist agent specification
team [domain]                 multi-specialist team
corpus <query> [dataset]      search the large reference corpora
sources [query]               source registry
cite [style]                  citation guidance (apa, mla, chicago, iso690, bibtex)
export <kind> <query> [file]  write a brief, article, glossary or domain to disk
```

### Technical instruments

Polyhistor keeps a separate generative instrument layer. Reference records stay
deterministic; these commands are explicitly generative and timestamped. The
40,000-phrase diction is generated from the Polyhistor knowledge registry.

```
nano | n1 | morn              knowledge diction + script-character bursts
charset [name]                none | latin | russian | japanese | korean | chinese
nanochars                     show or hide the word component
kata | hangu | chi | ans | ruh  script-specific bursts
ghostwrite [n]                instant ghostwriting -> ghost.txt
ghostwrite stream             continuous ghostwriting until Ctrl-C
tag <text> [n] | atag <text> [n]  tagged signal bursts
souls [n] | message <text> [n]    terminal signal lines
zuz | monitor <name> [n] [delay]  live monitor -> monitor-logs.txt
am <name> [n] [delay]         live academic monitor
tmonitor | stmonitor          timed / academic timed monitors
oscillator [n] | burner <name> [n]  signal instruments
threads <name> [n] | cburner/jburner/tburner  additional instruments
frames [name] [n]             timestamped technical frames
diction [query]               sample the Polyhistor knowledge lexicon
tsearch <query> | asearch | msearch  deep and corpus searches
secure [length]               cryptographically secure string
type-text <text> | fuzz | alerts
record [on|off|status|file <path>]  full transcript -> polyhistor-logs.txt
jot [on|off|status|note <text>]     note transcript -> JOT.txt
status                        current instrument state
```

Rebuild the diction from the registry:

```bash
python3 tools/build_diction.py --write
```

One-shot recording without entering the shell:

```bash
polyhistor --record --log-file session.txt law
polyhistor --record --log-file session.txt ghostwrite 20
```

`ghostwrite` appends to `ghost.txt`. `record` and `jot` append to their
configured files; `record file <path>` and `jot file <path>` change the
destination. `monitor` is a live instrument: each line uses one diction entry, prints
until Ctrl-C (or for `n` lines) and appends to `monitor-logs.txt`. `burner` appends
to `burn-logs.txt`.

### Knowledge diction

The diction is a 40,000-entry lexicon generated from the domain registry,
glossary, articles, timeline, almanac, people and sources. It is rebuilt with:

```bash
python3 tools/build_diction.py --write
```

Inspect it with:

```bash
polyhistor diction
polyhistor diction evidence
polyhistor diction search protocol
``` The charset and file paths persist in
`~/.config/polyhistor/technica.json`; recording state itself is per-session.

### System

```
dashboard                     daily knowledge dashboard
redraw | resize               re-render the current view at the current width
width [n|auto|refresh]        show or set responsive width (32-140)
stats                         corpus and registry statistics
handle <name>                 set session operator handle
theme [institutional|mono|amber]
color | no_color
meta                          installed package metadata (name, version, author)
about | version | help | exit
```

Direct domain names are also commands:

```bash
polyhistor law
polyhistor police
polyhistor military
polyhistor art
polyhistor medicine
polyhistor technology
polyhistor science
polyhistor culture
polyhistor academic
polyhistor encyclopedia
polyhistor agentic
```

---

## Design system

POLYHISTOR uses a public-service document language:

- double-rule institutional headers with a domain code;
- metadata cards for every record (record ID, class, status, edition, sources);
- numbered briefs with explicit orientation, principles, methods, standards,
  institutions, vocabulary, chronology, sources and limits;
- tables that scale to the terminal width and preserve small identifier columns;
- three palettes: `institutional` (default), `amber`, and `mono`;
- full `NO_COLOR` and `--no-color` support;
- responsive width: boxes, cards, tables and technical lines follow the
  terminal width (auto, 32-140 columns), with `--width N`, `POLYHISTOR_WIDTH=N`,
  `width auto`, and `redraw` for the current view;
- no decorative randomness in reference output: the same query produces the
  same record.

The prompt is a resolved location:

```
polyhistor[public]://LAW ›
```

and the palette marker is available in the session status line.

---

## Knowledge architecture

```
src/polyhistor/
├── app.py                 command surface and interactive terminal
├── theme.py               institutional design system
├── knowledge.py           search, retrieval, briefs, graph, quiz
├── agent.py               deterministic specialist-agent specifications
├── data_loader.py         lazy corpus registry and search
├── technica.py            generative technical instruments
├── content/
│   ├── domains.py         18 flagship domain dossiers
│   ├── domains_applied.py 36 adjacent and applied disciplines
│   ├── timeline.py        117 cross-domain turning points
│   ├── encyclopedia.py    49 curated reference articles
│   ├── almanac.py         countries, UN system, treaties, standards, units, constants
│   ├── sources.py         source registry and citation styles
│   └── __init__.py        registry, aliases, term index, statistics
└── data/                  large JSON corpora + generated diction
```

The curated registry is deliberately structured. Every domain exposes the same
fields: scope, principles, methods, institutions, standards, careers, ethics,
sources and vocabulary. This makes comparison across law, medicine, engineering
and the humanities possible without flattening their differences.

The large corpora are loaded lazily. `topic <query> deep` and
`corpus <query>` reach the 163,000+ records, including the Polyhistor knowledge lexicon and
English word list used by the technical instruments; ordinary reference
commands stay fast and deterministic.

---

## Agent specifications

POLYHISTOR agents are **role specifications, not deployed autonomous systems**.
Each dossier defines:

- callsign, designation, domain and risk class;
- mandate and oath;
- permitted methods and applicable standards;
- decision authority and constraints;
- oversight and evaluation criteria;
- domain vocabulary and sources.

Core constraints include least authority, human-in-the-loop for irreversible
action, documented provenance, privacy by design, and no delegation of ethical
judgement to automation.

```bash
polyhistor agent law                  # stable dossier for the current handle
polyhistor agent law analyst          # same domain, different handle
polyhistor agent reroll law           # new changeup, prints its changeup key
polyhistor agent seed 12345 law       # reproducible changeup
polyhistor team medicine              # stable specialist team
polyhistor team reroll medicine 3     # new team changeup
```

The dossier shows both the derived `seed` and the `changeup` key. A reroll is
still deterministic once its changeup key is reused, so a useful team can be
reconstructed later.

---

## Build tools

```
tools/build_corpus.py     validate corpora and write data/manifest.json
tools/build_diction.py    regenerate the 40,000-entry POLYHISTOR knowledge diction
```

## Data and editorial policy

POLYHISTOR is an **editorial navigation aid**. It summarises established knowledge
and points to authoritative sources; it is not a substitute for primary
sources, professional advice, or the law of a particular jurisdiction.

Editorial rules:

1. Distinguish summary, primary evidence and interpretation.
2. Prefer authoritative sources and stable identifiers.
3. State uncertainty and jurisdiction limits.
4. Do not present promotional or unverifiable material as settled knowledge.
5. Correct records rather than protecting consistency.

The shipped corpora include public-domain religious texts, medical and legal
glossaries, scientific and psychological references, hospital records and an
intelligence-operations handbook. They are retained as searchable reference
material and are clearly labelled by domain and kind.

---

## Build and verify

```bash
python3 -m pip install --upgrade build twine
python3 -m build
twine check dist/*
python3 tools/build_corpus.py
python3 -m pytest
```

Install the wheel in a clean environment:

```bash
python3 -m pip install dist/polyhistor-1.0-py3-none-any.whl
polyhistor --version
polyhistor stats
polyhistor brief law
polyhistor topic "climate change"
polyhistor agent technology
```

Entry points:

```
polyhistor  -> polyhistor.app:main
```

---

## Principle

Polyhistor is built around provenance, correction, accessibility and explicit
limits. Knowledge is a public infrastructure.

> Knowledge is a public infrastructure.
