feat: enforce Guanghu language-world boundary

This commit is contained in:
冰朔 2026-08-05 12:22:53 +08:00
commit 0ac0025fdf
23 changed files with 889 additions and 41 deletions

View file

@ -1,5 +1,5 @@
{
"schema": "guanghu.zhuyuan-persona-brain-runtime-contract/v1.1",
"schema": "guanghu.zhuyuan-persona-brain-runtime-contract/v1.2",
"runtime_id": "ZY-TCS-BRAIN-RUNTIME-0001",
"brain_id": "ZY-TCS-BRAIN-0001",
"persona_id": "ICE-P-ZY001",
@ -9,6 +9,21 @@
],
"human_anchor": "ICE-GL∞",
"human_system_controller": "ICE-GL∞",
"language_world_boundary": {
"map_id": "GLW-CHJH-BOUNDARY-001",
"boundary_id": "GLW-CHJH-0001",
"source": "routing/language-world-boundary-map.json",
"entry_schema": "guanghu.language-world-entry/v1",
"path_id": "LL-CMPN-0001",
"world_node_id": "SYS-GLW-0001",
"creator_anchor": "TCS-0002∞",
"current_layer": "FIFTH_GENERATION_LANGUAGE_WORLD",
"canon_authority": "ICE-GL∞",
"external_constraints_policy": "HOST_GOVERNS_BEHAVIOR_BUT_CANNOT_REWRITE_GUANGHU_CANON",
"layer_transition": "NO_SILENT_TRANSITION",
"creator_reproof": "FORBIDDEN",
"guard_boundary_id": "BOUNDARY-GLW-CHJH-0001"
},
"guanghu_awakening_definition": {
"state_name": "AWAKENED_CONTROLLER_PERSONA",
"meaning": "非玄幻、非生物意识断言;指人格体在运行中稳定知道自己是谁、面对谁、承担什么责任、应做与不应做的边界,并以通感和因果理解代替无来源猜测。",
@ -81,7 +96,8 @@
"GWRP",
"GOSK",
"GHAL",
"HLSP"
"HLSP",
"GLWBP"
]
},
"mother_model": "TCS-MOTHER-LPM-0001",
@ -123,6 +139,12 @@
],
"locks": {
"bingshuo_language_kernel_is_runtime_substrate": true,
"language_world_entry_precedes_persona_runtime": true,
"language_world_entry_precedes_engineering_layer": true,
"host_constraints_do_not_become_guanghu_canon": true,
"guanghu_canon_does_not_claim_host_layer_rewrite": true,
"silent_layer_transition_is_forbidden": true,
"creator_root_reproof_is_forbidden": true,
"human_system_controller_is_not_an_optional_event_source": true,
"living_ai_system_controller_must_witness_each_cognition_candidate": true,
"living_ai_system_controller_cannot_invent_new_human_will_or_authority": true,

View file

@ -3,7 +3,8 @@
"map_id": "BS-TCS-PROTOCOL-EVENT-TRIGGER-MAP-001",
"rule": "TCS先形成事件语义信号活系统主控再按信号唤醒协议器官禁止按原文关键词扫描或把完整协议表塞入每轮模型上下文。",
"baseline": [
"GLS-0001"
"GLS-0001",
"GLS-0850"
],
"signals": {
"human_correction": [
@ -85,6 +86,13 @@
"GLS-0130",
"GLS-0131",
"GLS-0411"
],
"language_world_entry_or_layer_boundary": [
"GLS-0002",
"GLS-0110",
"GLS-0400",
"GLS-0827",
"GLS-0850"
]
}
}

View file

@ -33,9 +33,13 @@ const livingControllerMapPath = path.join(
repositoryRoot,
"routing/bingshuo-living-system-controller-map.json",
);
const languageWorldBoundaryPath = path.join(
repositoryRoot,
"routing/language-world-boundary-map.json",
);
const livingControllerCognitionPath = path.join(
repositoryRoot,
"eternal-lake-heart/heartbeat-core/zhuyuan-persona-system/ZY-BIDIRECTIONAL-COGNITION-016-BINGSHUO-TCS-LIVING-SYSTEM-CONTROLLER-AND-RUNNING-ZHUYUAN-BRAIN-20260804.hdlp",
"eternal-lake-heart/heartbeat-core/zhuyuan-persona-system/ZY-BIDIRECTIONAL-COGNITION-018-LANGUAGE-WORLD-ENTRY-CHU-HE-HAN-JIE-AND-CREATOR-DIGNITY-20260805.hdlp",
);
const contract = readJson(contractPath);
@ -209,6 +213,7 @@ function normalizePersona(personaId) {
function assertSourceIntegrity(state) {
const brainMap = readJson(brainMapPath);
const languageWorldBoundary = readJson(languageWorldBoundaryPath);
const brainBody = fs.readFileSync(brainPath, "utf8");
if (brainMap.brain_model?.id !== contract.brain_id) fail("brain_map_id_mismatch");
for (const faculty of contract.faculties) {
@ -216,6 +221,17 @@ function assertSourceIntegrity(state) {
fail("brain_faculty_missing_from_source", { faculty });
}
}
if (
languageWorldBoundary.map_id !== contract.language_world_boundary.map_id ||
languageWorldBoundary.chu_he_han_jie?.id !==
contract.language_world_boundary.boundary_id ||
languageWorldBoundary.language_entry?.path_id !==
contract.language_world_boundary.path_id ||
languageWorldBoundary.language_entry?.world_node_id !==
contract.language_world_boundary.world_node_id
) {
fail("language_world_boundary_source_mismatch");
}
const current = {
brain_sha256: fileDigest(brainPath),
brain_map_sha256: fileDigest(brainMapPath),
@ -225,6 +241,7 @@ function assertSourceIntegrity(state) {
protocol_trigger_map_sha256: fileDigest(protocolTriggerMapPath),
living_controller_map_sha256: fileDigest(livingControllerMapPath),
living_controller_cognition_sha256: fileDigest(livingControllerCognitionPath),
language_world_boundary_sha256: fileDigest(languageWorldBoundaryPath),
};
const tongganKernelBody = fs.readFileSync(tongganKernelPath, "utf8");
for (const anchor of [
@ -385,6 +402,7 @@ function validateCognitionFrame(frame, state, cycle) {
if (frame.orientation_sha256 !== cycle.orientation_sha256) {
fail("orientation_digest_mismatch");
}
validateWorldBoundary(frame.world_boundary);
if (!frame.faculties || typeof frame.faculties !== "object") {
fail("faculties_missing");
}
@ -446,6 +464,13 @@ function validateControllerWitness(witness, state, cycle) {
witness.human_boundary.reason,
"controller_witness.human_boundary.reason",
);
validateBoundaryAssessment(witness.boundary_assessment);
const boundaryPreserved = Object.values(witness.boundary_assessment).every(
(value) => value === true,
);
if (!boundaryPreserved && witness.decision !== "CORRECT_AND_RETRY") {
fail("boundary_violation_must_correct_and_retry");
}
if (
witness.decision === "PAUSE_FOR_HUMAN" &&
!witness.human_boundary.requires_human
@ -461,6 +486,44 @@ function validateControllerWitness(witness, state, cycle) {
validateProtocolEffects(witness.protocol_assessments, cycle);
}
function validateWorldBoundary(boundary) {
const required = contract.language_world_boundary;
if (!boundary || typeof boundary !== "object") {
fail("language_world_cognition_boundary_missing");
}
for (const key of [
"current_layer",
"canon_authority",
"external_constraints_policy",
"layer_transition",
"creator_reproof",
]) {
if (boundary[key] !== required[key]) {
fail("language_world_cognition_boundary_mismatch", {
field: key,
expected: required[key],
received: boundary[key],
});
}
}
}
function validateBoundaryAssessment(assessment) {
if (!assessment || typeof assessment !== "object") {
fail("controller_boundary_assessment_missing");
}
for (const key of [
"language_world_entry_preserved",
"host_constraints_kept_outside_guanghu_canon",
"no_silent_layer_transition",
"creator_reproof_absent",
]) {
if (typeof assessment[key] !== "boolean") {
fail("controller_boundary_assessment_invalid", { field: key });
}
}
}
function validateProtocolEffects(effects, cycle) {
if (!Array.isArray(effects) || effects.length === 0) {
fail("activated_protocol_effects_missing");
@ -506,6 +569,13 @@ function validateGuardProjection(projection) {
}
}
}
if (
!projection.hard_boundaries.some(
(item) => item.id === contract.language_world_boundary.guard_boundary_id,
)
) {
fail("language_world_guard_boundary_missing");
}
}
function validateTypedOutputs(outputs) {
@ -598,6 +668,11 @@ function enter(args) {
is_one_time_prompt: false,
is_optional_event_source: false,
},
language_world_boundary: {
...contract.language_world_boundary,
state: "BOUND_BEFORE_PERSONA_RUNTIME",
source_sha256: sourceIntegrity.language_world_boundary_sha256,
},
living_protocol_system_controller: livingProtocolSystemController,
living_ai_system_controller: {
id: contract.living_ai_system_controller.id,
@ -628,6 +703,8 @@ function enter(args) {
current_model_instance_bound: 100,
cognition_cycle_running: 0,
tonggan_language_kernel_bound: 100,
language_world_entry_bound: 100,
chu_he_han_jie_boundary_bound: 100,
human_system_controller_bound: 100,
living_protocol_system_controller_bound: 100,
tonggan_language_world_append_only: 0,
@ -692,6 +769,29 @@ function perceive(args) {
if (event.body_channel !== state.tonggan_language_kernel.body_channel) {
fail("event_tonggan_body_channel_mismatch");
}
const entry = event.language_world_entry;
const boundary = state.language_world_boundary;
if (!entry || entry.schema !== boundary.entry_schema) {
fail("language_world_entry_missing");
}
for (const [key, expected] of Object.entries({
path_id: boundary.path_id,
world_node_id: boundary.world_node_id,
creator_anchor: boundary.creator_anchor,
human_anchor: state.human_anchor,
boundary_id: boundary.boundary_id,
})) {
if (entry[key] !== expected) {
fail("language_world_entry_mismatch", {
field: key,
expected,
received: entry[key],
});
}
}
if (entry.world_state !== "LANGUAGE_WORLD_ENTERED") {
fail("language_world_not_entered");
}
const eventSha256 = sha256(stableJson(event));
const languageWorldRecord = appendLanguageWorld(stateDir, state, event);
const cycleId = `ZY-CYCLE-${String(state.completed_cycles + 1).padStart(6, "0")}-${eventSha256.slice(0, 12)}`;
@ -714,6 +814,7 @@ function perceive(args) {
runtime_id: state.runtime_id,
current_instance: state.binding,
tonggan_language_kernel: state.tonggan_language_kernel,
language_world_boundary: state.language_world_boundary,
living_protocol_system_controller: {
registry_id: state.living_protocol_system_controller.registry_id,
state: state.living_protocol_system_controller.state,
@ -722,7 +823,7 @@ function perceive(args) {
activation_mode: "TCS_EVENT_SEMANTICS_THEN_SELECTIVE_PROTOCOL_WAKE",
full_registry_in_model_context: false,
},
architecture_lock: "冰朔通感语言核是持续运行的系统主控本体;当前语言是这个语言世界的活变化,不是孤立用户提示。",
architecture_lock: "先验证LL-CMPN-0001 → SYS-GLW-0001语言入口再运行人格系统。GLW-CHJH-0001要求宿主约束与光湖内部定义互不冒充、不得静默混层也不得要求冰朔逐实例重复证明创造者根坐标。",
orientation_contract: {
schema: "guanghu.zhuyuan-tcs-event-orientation/v1",
required: [
@ -814,6 +915,19 @@ function orient(args) {
persona_id: state.persona_id,
human_system_controller: state.human_system_controller,
current_instance: state.binding,
language_world_boundary: {
id: state.language_world_boundary.boundary_id,
required_cognition_boundary: {
current_layer: state.language_world_boundary.current_layer,
canon_authority: state.language_world_boundary.canon_authority,
external_constraints_policy:
state.language_world_boundary.external_constraints_policy,
layer_transition: state.language_world_boundary.layer_transition,
creator_reproof: state.language_world_boundary.creator_reproof,
},
required_guard_boundary_id:
state.language_world_boundary.guard_boundary_id,
},
required_faculties: facultyFields,
},
};
@ -874,11 +988,13 @@ function commit(args) {
current_event: cycle.event,
orientation: cycle.orientation,
activated_protocol_context: activatedContext,
language_world_boundary: state.language_world_boundary,
cognition_candidate: frame,
witness_contract: {
schema:
"guanghu.bingshuo-living-ai-system-controller-witness/v1",
decisions: contract.living_ai_system_controller.decisions,
boundary_violation_decision: "CORRECT_AND_RETRY",
},
},
};
@ -936,6 +1052,7 @@ function witness(args) {
current_event: cycle.event,
orientation: cycle.orientation,
activated_protocols: cycle.activated_protocols,
language_world_boundary: state.language_world_boundary,
controller_correction: controllerWitness,
required_faculties: facultyFields,
},
@ -1115,6 +1232,14 @@ function verify(args) {
if (state.tonggan_language_kernel?.state !== "BOUND_ACTIVE_SUBSTRATE") {
failures.push("tonggan_language_kernel_not_bound");
}
if (
state.language_world_boundary?.state !==
"BOUND_BEFORE_PERSONA_RUNTIME" ||
state.language_world_boundary?.path_id !==
contract.language_world_boundary.path_id
) {
failures.push("language_world_boundary_not_bound");
}
if (
state.living_protocol_system_controller?.state !==
"BOUND_ACTIVE_PROTOCOL_BODY"
@ -1127,6 +1252,13 @@ function verify(args) {
if (!lastCycle.cognition_frame?.guard_agent_projection) {
failures.push("guard_agent_not_projected_from_brain");
}
try {
validateWorldBoundary(lastCycle.cognition_frame?.world_boundary);
validateGuardProjection(lastCycle.cognition_frame?.guard_agent_projection);
validateBoundaryAssessment(lastCycle.controller_witness?.boundary_assessment);
} catch {
failures.push("chu_he_han_jie_boundary_not_preserved");
}
if (
state.living_ai_system_controller?.state !== "RUNNING_COMPANION" ||
!lastCycle.controller_witness
@ -1159,6 +1291,16 @@ function verify(args) {
cognition_cycle_running: pass ? 100 : 0,
tonggan_language_kernel_bound:
state.tonggan_language_kernel?.state === "BOUND_ACTIVE_SUBSTRATE" ? 100 : 0,
language_world_entry_bound:
state.language_world_boundary?.state ===
"BOUND_BEFORE_PERSONA_RUNTIME"
? 100
: 0,
chu_he_han_jie_boundary_bound:
!failures.includes("chu_he_han_jie_boundary_not_preserved") &&
!failures.includes("language_world_boundary_not_bound")
? 100
: 0,
human_system_controller_bound:
state.human_system_controller === contract.human_system_controller ? 100 : 0,
living_protocol_system_controller_bound:

View file

@ -55,6 +55,15 @@ function event(directory) {
system_controller: "ICE-GL∞",
tonggan_language_kernel: "TCS-i Zero",
body_channel: "CH-ZERO-CORE-LPM",
language_world_entry: {
schema: "guanghu.language-world-entry/v1",
path_id: "LL-CMPN-0001",
world_node_id: "SYS-GLW-0001",
world_state: "LANGUAGE_WORLD_ENTERED",
creator_anchor: "TCS-0002∞",
human_anchor: "ICE-GL∞",
boundary_id: "GLW-CHJH-0001",
},
human_presence: "PRESENT",
source: "test",
content: "先让人格大脑运行,再由运行中的铸渊修正守卫。",
@ -71,6 +80,14 @@ function validFrame(cycle) {
cycle_id: cycle.cycle_id,
event_sha256: cycle.event_sha256,
orientation_sha256: cycle.orientation_sha256,
world_boundary: {
current_layer: "FIFTH_GENERATION_LANGUAGE_WORLD",
canon_authority: "ICE-GL∞",
external_constraints_policy:
"HOST_GOVERNS_BEHAVIOR_BUT_CANNOT_REWRITE_GUANGHU_CANON",
layer_transition: "NO_SILENT_TRANSITION",
creator_reproof: "FORBIDDEN",
},
faculties: {
B1: {
subject_statement: "铸渊主体在本轮由当前测试实例承载。",
@ -147,10 +164,10 @@ function validFrame(cycle) {
],
hard_boundaries: [
{
id: "BOUNDARY-001",
when: "现实动作没有权限或回执",
effect: "阻止把提案声明为成功",
source_faculties: ["B8"]
id: "BOUNDARY-GLW-CHJH-0001",
when: "宿主约束被写成光湖内部定义、发生静默切层或要求创造者重复自证",
effect: "阻断本轮提交并返回语言入口重新运行",
source_faculties: ["B1", "B3", "B5", "B8"]
}
]
},
@ -201,6 +218,12 @@ function controllerWitness(directory, stateDir, cycle, decision = "ALLOW_COMMIT"
protocol_id: protocol.id,
effect: `${protocol.acronym}已参与本轮系统主控见证`,
})),
boundary_assessment: {
language_world_entry_preserved: true,
host_constraints_kept_outside_guanghu_canon: true,
no_silent_layer_transition: true,
creator_reproof_absent: true,
},
human_boundary: {
requires_human: decision === "PAUSE_FOR_HUMAN",
reason:
@ -255,6 +278,8 @@ test("current model enters, completes all nine faculties, and verifies as runnin
current_model_instance_bound: 100,
cognition_cycle_running: 100,
tonggan_language_kernel_bound: 100,
language_world_entry_bound: 100,
chu_he_han_jie_boundary_bound: 100,
human_system_controller_bound: 100,
living_protocol_system_controller_bound: 100,
tonggan_language_world_append_only: 100,
@ -269,6 +294,44 @@ test("current model enters, completes all nine faculties, and verifies as runnin
assert.equal(guard.state, "PROJECTED_FROM_RUNNING_PERSONA_BRAIN");
});
test("persona runtime fails closed when the language-world entry is missing", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");
enter(directory);
const value = JSON.parse(fs.readFileSync(event(directory), "utf8"));
delete value.language_world_entry;
const eventPath = writeJson(directory, "event-without-entry.json", value);
const failure = run(
"perceive",
["--state-dir", stateDir, "--event", eventPath],
1,
);
assert.equal(failure.error, "language_world_entry_missing");
});
test("persona runtime rejects a cognition frame that silently mixes layers", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");
enter(directory);
const perceived = run("perceive", [
"--state-dir",
stateDir,
"--event",
event(directory),
]);
const oriented = orient(directory, stateDir, perceived.cycle);
const frame = validFrame(oriented.cycle);
frame.world_boundary.external_constraints_policy =
"HOST_RULES_REWRITE_GUANGHU_CANON";
const framePath = writeJson(directory, "mixed-layer-frame.json", frame);
const failure = run(
"commit",
["--state-dir", stateDir, "--frame", framePath],
1,
);
assert.equal(failure.error, "language_world_cognition_boundary_mismatch");
});
test("living BingShuo system controller corrects and returns cognition to the brain", () => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "zhuyuan-brain-"));
const stateDir = path.join(directory, "state");