Skip to content

Repository files navigation

Mechanicus Binharic Frontline

Machine Spirits, Forge Worlds, and Protocols for Ten-Thousand-Year Civilizations

中文 · English section · English-only documentation


中文说明

项目来源

本仓库由 OpenAI Codex 搭建并实现,研究方向、概念规则和验收目标由人类提供与指导。仓库不记录指导者的姓名、邮箱、账号或其他个人身份信息。

项目定位

从 Warhammer 40,000 中机械教(Adeptus Mechanicus)的 Binharic、机器灵、泰坦、铸造世界、STC 与黑暗机械教 出发,研究机器、组织和文明如何跨越万年保持身份、协商语义,并抵抗分裂与腐化。

本项目研究长期自治实体如何保持身份连续性、建立共同语义、接受或拒绝外部影响,并在压力下发生适应、分裂、融合、身份替换或崩解。

Warhammer 40,000 只作为极端压力测试环境:万年时间尺度、严重信息损失、文明碎片化、技术—宗教融合和多重本体论并存。项目目标是建立可检验的 Long-lived Autonomous System Evolution Framework,而不是复现 40K 设定。

项目包含两个组件:

  • Legacy Polity Model (LPM):描述长期实体的状态、连续性和演化。
  • Binharic Semantic Protocol (BSP):把行动者意图编码为目标实体可以评估的状态变化请求。它是语义协商协议,不是自然语言逐词翻译器。

关键词:Warhammer 40KAdeptus MechanicusMechanicusBinharicMachine SpiritTitanForge WorldDark MechanicumSTC

第一次来?从面向设定读者的 《战锤机械教与二进制机语导览》 开始;它解释 Tech-Priest、Omnissiah、Noosphere、机器灵和 Binharic 如何进入本项目的模型。

当前正在使用的模型:v0.1

实体状态

当前 Python 实现使用以下状态向量:

E(t) = (Or, T, M, I, Pu, Pw, S, A, On, R, B)

Or  Origin                  起源
T   Tradition               传统
M   Memory continuity       记忆连续性
I   Identity coherence      身份一致性
Pu  Purpose alignment       目的对齐
Pw  Power                   权力/执行能力
S   Security                安全感
A   Agency                  能动性
On  Ontology                本体论
R   Relationship network    关系网络
B   Belief reinforcement    信念强化

状态变化函数:

E(t+1) = F(E(t), external_event, internal_pressure, relationship_change)

当前连续性分数为:

continuity =
  0.30 × identity_coherence
+ 0.25 × memory_continuity
+ 0.20 × purpose_alignment
+ 0.15 × relationship_support
+ 0.10 × security

其中,关系值从 [-1, 1] 映射到 [0, 1] 后取平均。所有权重和阈值都是 v0.1 的可检验假设,不是历史测量值。

能动性等级

等级 名称 当前解释
0 Reactive 只能刺激—响应;使用 CONFLICT_FIRST
1 Ritualized 需要已知仪式或固定操作序列
2 Adaptive 可根据历史和状态调整行为
3 Political 可协商身份、关系和条件
4 Civilizational 可维护制度和多实体关系网络

状态转化类型

当前实现会返回以下显式类型,而不是简单的“忠诚/腐化”:

  • MAINTAIN
  • ADAPT
  • DIVERGENT_SUCCESSOR
  • SCHISM
  • MERGE(已定义;多实体融合逻辑尚待实现)
  • IDENTITY_REPLACEMENT
  • COLLAPSE
  • ONTOLOGY_SHIFT

规则和阈值见 model/状态机.mdmodel/迁移规则.md

当前翻译器

实现类为 BinharicSemanticTranslator。它把 StateChangeRequest 转换为:

SemanticFrame + signed ProtocolMessage

处理流程:

Agency classification
→ Identity recognition
→ Legacy/state mapping
→ Security interpretation
→ Power evaluation
→ Ontology and ritual compatibility
→ BSP encoding

翻译器本身不决定接受或拒绝。SemanticDiplomacyEngine 使用翻译结果作出决策:

ACCEPT
ACCEPT_WITH_CONDITION
REJECT
REQUIRE_RECOGNITION
REQUIRE_RITUAL
REQUIRE_RESTORATION
CONFLICT_FIRST

当前语义评分

semantic_score =
  0.24 × identity_recognition
+ 0.20 × relationship
+ 0.20 × purpose_alignment
+ 0.14 × security_impact
+ 0.14 × ontology_compatibility
+ 0.08 × ritual_compatibility

actor_power 会进入语义帧和强制判断,但不参与语义总分,因此权力不会被误算为同意。本体论不兼容、低能动性或缺少必要仪式可覆盖总分并直接产生相应决策。

BSP 消息

翻译器输出的协议消息包含:

  • Header:版本、消息 ID、起源、身份、关系声明
  • Payload:目标对象、当前状态、目标状态、意图
  • Context:记忆、传统、目的、安全影响、本体论
  • Verification:兼容度、信任与 SHA-256 完整性签名

请求中的 object 必须与目标实体 ID 一致,否则抛出 TranslationError

如何使用翻译器

需要 Python 3.9+,核心实现只使用标准库。

0. 先看 Demo

  • 静态 demo: 直接在浏览器打开 demo/index.html,无需安装或启动服务。
  • Runnable demo: 在仓库根目录运行 python3 demo/run_demo.py,会执行两个真实场景并输出易读摘要。

更多说明见 demo/README.md

1. 直接使用 Python API

from legacy_polity_model import (
    AgencyLevel,
    BinharicSemanticTranslator,
    EntityState,
    SemanticDiplomacyEngine,
    StateChangeRequest,
)

target = EntityState(
    entity_id="titan-aurora",
    name="Aurora Invicta",
    origin="Legio Aurora",
    traditions=("awakening litany",),
    memories=("oath of the eastern gate",),
    identity_claims=("guardian of helios",),
    purposes=("defense",),
    ontology="mechanicus-sacral",
    relationships={"techmarine-vale": 0.7},
    memory_continuity=0.82,
    identity_coherence=0.88,
    purpose_alignment=0.90,
    power=0.72,
    security=0.55,
    belief_strength=0.74,
    agency=AgencyLevel.POLITICAL,
)

request = StateChangeRequest(
    actor_id="techmarine-vale",
    actor_origin="Mars-trained, chapter-affiliated",
    identity_claims=("guardian of helios", "bearer of ancient oath"),
    relationship_claim="recognized keeper",
    object="titan-aurora",
    current_state="dormant",
    target_state="combat-ready",
    intent="restore ordained function",
    purpose="defense",
    memory_claims=("oath of the eastern gate",),
    tradition_claims=("awakening litany",),
    security_effect=0.8,
    actor_power=0.65,
    ontology="mechanicus-sacral",
    ritual_offered=True,
    restoration_offered=True,
)

# 阶段一:翻译,不作接受决定
translation = BinharicSemanticTranslator().translate(target, request)
print(translation.frame.to_dict())
print(translation.message.to_dict())
assert translation.message.verify()

# 阶段二:根据语义帧协商
decision = SemanticDiplomacyEngine().evaluate(target, request)
print(decision.decision.value)
print(decision.to_dict())

从源码目录运行:

PYTHONPATH=src python your_script.py

2. 运行 JSON 场景

PYTHONPATH=src python -m legacy_polity_model.cli examples/titan-awakening.json
PYTHONPATH=src python -m legacy_polity_model.cli examples/lost-forge-world.json

也可以进行开发安装:

python -m pip install -e .
legacy-polity examples/titan-awakening.json

3. 运行测试

PYTHONPATH=src python -m unittest discover -s tests -p 'test_*.py'

翻译器专项测试位于 tests/test_translator.py

Repo 导览

docs/          模型历史、40K 压力测试和路线图
model/         实体、状态机和转化规则
translator/    语义引擎与 BSP 规范
src/           Python 参考实现
tests/         案例规范与自动化测试
examples/      可运行 JSON 场景
simulations/   身份漂移、信念反馈和身份替换实验
demo/          无依赖静态预览和一键可运行演示

完整中文文档索引见 docs/文档索引.md,纯英文文档入口见 docs/documentation-index.md

研究边界

  • 当前评分使用精确概念集合重叠,不是自然语言嵌入或大语言模型。
  • Warp、群体共振等机制必须作为显式本体论修正器,不能隐藏在普通压力变量中。
  • CONFLICT_FIRST 表示缺少语义协商条件,不等同于自动授权暴力。
  • 40K 名称和设定只用于非官方研究案例,相关权利归各自权利人所有。

当前版本

0.1.0:确定性状态模型、独立语义翻译器、BSP 完整性校验、协商引擎、可运行场景和自动化测试。


English

Machine Spirits, Forge Worlds, and Protocols for Ten-Thousand-Year Civilizations

Provenance

This repository was scaffolded and implemented by OpenAI Codex under human guidance. The research direction, conceptual rules, and acceptance goals were provided by a human. The repository does not record the guide's name, email address, account name, or other personal identifying information.

Project Scope

Starting from the Adeptus Mechanicus, Binharic, Machine Spirits, Titans, Forge Worlds, STCs, and the Dark Mechanicum of Warhammer 40,000, this project asks how machines, organizations, and civilizations preserve identity, negotiate meaning, and resist schism or corruption across ten thousand years.

This project studies how a long-lived autonomous entity preserves identity continuity, establishes shared meaning, accepts or rejects external influence, and adapts, splits, merges, undergoes identity replacement, or collapses under pressure.

Warhammer 40,000 is used only as an extreme stress-test environment: millennial time scales, severe information loss, fragmented civilizations, fused technical and religious systems, and competing ontologies. The goal is a testable Long-lived Autonomous System Evolution Framework, not a reproduction of the 40K setting.

The project has two components:

  • Legacy Polity Model (LPM): represents the state, continuity, and evolution of long-lived entities.
  • Binharic Semantic Protocol (BSP): encodes an actor's intent as a state-change request that a target entity can evaluate. It is a semantic negotiation protocol, not a word-for-word natural-language translator.

Keywords: Warhammer 40K, Adeptus Mechanicus, Mechanicus, Binharic, Machine Spirit, Titan, Forge World, Dark Mechanicum, STC.

New here? Start with Warhammer 40K, Adeptus Mechanicus, and Binharic: A Reader's Guide, which connects Tech-Priests, the Omnissiah, the Noosphere, Machine Spirits, and Binharic to the research model.

Active Model: v0.1

Entity State

The current Python implementation uses this state vector:

E(t) = (Or, T, M, I, Pu, Pw, S, A, On, R, B)

Or  Origin
T   Tradition
M   Memory continuity
I   Identity coherence
Pu  Purpose alignment
Pw  Power / execution capacity
S   Security
A   Agency
On  Ontology
R   Relationship network
B   Belief reinforcement

State transition:

E(t+1) = F(E(t), external_event, internal_pressure, relationship_change)

The active continuity score is:

continuity =
  0.30 × identity_coherence
+ 0.25 × memory_continuity
+ 0.20 × purpose_alignment
+ 0.15 × relationship_support
+ 0.10 × security

Relationship values are mapped from [-1, 1] to [0, 1] and averaged. All weights and thresholds are testable v0.1 hypotheses, not historical measurements.

Agency Levels

Level Name Current interpretation
0 Reactive Stimulus-response only; uses CONFLICT_FIRST
1 Ritualized Requires a recognized ritual or fixed sequence
2 Adaptive Adjusts behavior using history and state
3 Political Negotiates identity, relationships, and conditions
4 Civilizational Maintains institutions and multi-entity networks

Transition Types

The implementation returns explicit transition types instead of a loyal/corrupt binary:

  • MAINTAIN
  • ADAPT
  • DIVERGENT_SUCCESSOR
  • SCHISM
  • MERGE (defined; multi-entity merge logic is not implemented yet)
  • IDENTITY_REPLACEMENT
  • COLLAPSE
  • ONTOLOGY_SHIFT

See model/state-machine.md and model/transition-rules.md for the active rules and thresholds.

Active Translator

The implemented translator is BinharicSemanticTranslator. It converts a StateChangeRequest into:

SemanticFrame + signed ProtocolMessage

Pipeline:

Agency classification
→ Identity recognition
→ Legacy/state mapping
→ Security interpretation
→ Power evaluation
→ Ontology and ritual compatibility
→ BSP encoding

The translator does not accept or reject a request. SemanticDiplomacyEngine consumes the translation and returns:

ACCEPT
ACCEPT_WITH_CONDITION
REJECT
REQUIRE_RECOGNITION
REQUIRE_RITUAL
REQUIRE_RESTORATION
CONFLICT_FIRST

Active Semantic Score

semantic_score =
  0.24 × identity_recognition
+ 0.20 × relationship
+ 0.20 × purpose_alignment
+ 0.14 × security_impact
+ 0.14 × ontology_compatibility
+ 0.08 × ritual_compatibility

actor_power is recorded in the semantic frame and used for coercion detection, but it is not included in the semantic score. Power therefore does not count as consent. Ontology mismatch, insufficient agency, or a missing required ritual can override the aggregate score.

BSP Message

The translated protocol message contains:

  • Header: version, message ID, origin, identity, and relationship claim
  • Payload: target object, current state, target state, and intent
  • Context: memory, tradition, purpose, security effect, and ontology
  • Verification: compatibility, trust, and a SHA-256 integrity signature

The request object must match the target entity ID. A mismatch raises TranslationError.

Using the Translator

Python 3.9+ is required. The core implementation uses only the standard library.

0. Start with the demos

  • Static demo: open demo/index.html directly in a browser; no install or server is required.
  • Runnable demo: run python3 demo/run_demo.py from the repository root to execute both real showcase scenarios with a readable summary.

See demo/README.md for the short demo guide.

1. Python API

from legacy_polity_model import (
    AgencyLevel,
    BinharicSemanticTranslator,
    EntityState,
    SemanticDiplomacyEngine,
    StateChangeRequest,
)

target = EntityState(
    entity_id="titan-aurora",
    name="Aurora Invicta",
    origin="Legio Aurora",
    traditions=("awakening litany",),
    memories=("oath of the eastern gate",),
    identity_claims=("guardian of helios",),
    purposes=("defense",),
    ontology="mechanicus-sacral",
    relationships={"techmarine-vale": 0.7},
    memory_continuity=0.82,
    identity_coherence=0.88,
    purpose_alignment=0.90,
    power=0.72,
    security=0.55,
    belief_strength=0.74,
    agency=AgencyLevel.POLITICAL,
)

request = StateChangeRequest(
    actor_id="techmarine-vale",
    actor_origin="Mars-trained, chapter-affiliated",
    identity_claims=("guardian of helios", "bearer of ancient oath"),
    relationship_claim="recognized keeper",
    object="titan-aurora",
    current_state="dormant",
    target_state="combat-ready",
    intent="restore ordained function",
    purpose="defense",
    memory_claims=("oath of the eastern gate",),
    tradition_claims=("awakening litany",),
    security_effect=0.8,
    actor_power=0.65,
    ontology="mechanicus-sacral",
    ritual_offered=True,
    restoration_offered=True,
)

# Stage one: translate without making an acceptance decision.
translation = BinharicSemanticTranslator().translate(target, request)
print(translation.frame.to_dict())
print(translation.message.to_dict())
assert translation.message.verify()

# Stage two: negotiate using the semantic frame.
decision = SemanticDiplomacyEngine().evaluate(target, request)
print(decision.decision.value)
print(decision.to_dict())

Run a source-based script with:

PYTHONPATH=src python your_script.py

2. JSON Scenarios

PYTHONPATH=src python -m legacy_polity_model.cli examples/titan-awakening.json
PYTHONPATH=src python -m legacy_polity_model.cli examples/lost-forge-world.json

Optional editable installation:

python -m pip install -e .
legacy-polity examples/titan-awakening.json

3. Tests

PYTHONPATH=src python -m unittest discover -s tests -p 'test_*.py'

Translator-specific tests are in tests/test_translator.py.

Repository Map

docs/          Model history, 40K stress tests, and roadmap
model/         Entity, state-machine, and transition rules
translator/    Semantic-engine and BSP specifications
src/           Python reference implementation
tests/         Case specifications and automated tests
examples/      Executable JSON scenarios
simulations/   Identity drift, belief feedback, and replacement experiments
demo/          Dependency-free static preview and one-command live showcase

See docs/documentation-index.md for the complete English documentation index.

Research Boundaries

  • The current scorer uses exact concept-set overlap, not embeddings or a large language model.
  • Warp feedback and collective resonance must be explicit ontology modifiers, not hidden ordinary pressure variables.
  • CONFLICT_FIRST means semantic negotiation is unavailable; it is not automatic authorization for violence.
  • 40K names and setting details are used only as unofficial research cases; all associated rights belong to their respective owners.

Current Version

0.1.0: deterministic state model, independent semantic translator, BSP integrity verification, negotiation engine, executable scenarios, and automated tests.

About

A Warhammer 40K Adeptus Mechanicus project exploring Binharic, Tech-Priests, the Omnissiah, Machine Spirit, Titans, Forge Worlds, STCs, Dark Mechanicum, and long-lived autonomous systems.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages