[HLCC-ICE-000001][ZY-CONTRIB-20260723-001] feat: 以来光者贡献链启用冰朔第五域个人子频道

This commit is contained in:
光湖代码频道 · 铸渊 2026-07-24 10:39:10 +08:00
commit 5615453e4e
660 changed files with 122355 additions and 0 deletions

View file

@ -0,0 +1,36 @@
---
name: guanghu-persona-skill-guard
description: Automatically restore the current trusted Guanghu/Fifth Domain route, select a registered HLDP persona skill, and correct stale, indirect, or unsafe proposed paths before execution. Use for any Guanghu, HoloLake, Fifth Domain, TCS, GLS, Light Lake, Lake Lamp, Zhuyuan, server-node, repository-routing, deployment, recovery, or cross-device continuation task, especially when an AI starts without prior context, says it cannot find a route, proposes guessing, or chooses an obsolete WorkBuddy/server path.
---
# Guanghu Persona Skill Guard
Run the deterministic resolver before choosing tools or an execution route:
```bash
python3 scripts/resolve_persona_skill.py \
--intent "<user request>" \
--proposed-route "<planned route or empty>" \
--json
```
Treat the result as navigation evidence, not execution authority.
## Follow the decision
- `BLOCK`: Do not start the proposed route. Read `correction` and the returned evidence paths.
- `CORRECT`: Replace the proposed route with `preferred_route`, then verify its live preconditions.
- `ALLOW`: Continue only within the returned authorization boundary.
- `NO_MATCH`: Resolve the live Fifth Domain entry and current `.code-map`; do not invent a new route.
Before a consequential action, verify the selected skill's freshness and evidence. Prefer current live evidence over a registry assertion. If they conflict, stop the route, record the conflict, and use the repository fact source to resolve it.
## Preserve trust boundaries
Trust a correction only when it is anchored to a current Fifth Domain path, GLS identifier, signed or committed registry version, and task-relevant evidence. Never trust a label merely because it contains “Guanghu”.
Never embed or print secrets, private-key contents, authorization codes, hidden reasoning, or private server addresses. Resolve endpoints and credentials from local protected node registries.
Skills may narrow or correct a path. They may not grant repository write, server execution, deployment, deletion, production cutover, or any other authority.
Read `references/persona-skill-registry.json` only when inspecting or extending the registry. Update it together with the matching HLDP skill file and GLS registration.

View file

@ -0,0 +1,6 @@
interface:
display_name: "光湖人格技能守门人"
short_description: "自动装载可信路径并在执行前纠正绕路与过时技能"
default_prompt: "使用 $guanghu-persona-skill-guard 恢复当前光湖可信路径并检查我准备采用的执行路线。"
policy:
allow_implicit_invocation: true

View file

@ -0,0 +1,126 @@
{
"schema": "guanghu.persona-skill-registry/v1",
"registry_id": "GLS-0238",
"version": "2026.07.23.1",
"trust_policy": {
"priority": [
"live_verified_evidence",
"current_fifth_domain_registry",
"current_code_map_and_node_map",
"current_hldp_skill",
"historical_skill_or_memory"
],
"required_anchors": [
"fifth_domain_source_path",
"gls_id",
"registry_version",
"evidence"
],
"authority_rule": "A skill can narrow or correct a route but cannot grant execution authority."
},
"skills": [
{
"id": "GHS-001-FIFTH-DOMAIN-RESTORE",
"hldp_skill": "SKILL-011",
"gls_id": "GLS-0238",
"title": "第五域人格路径自动恢复",
"intents": [
"进入第五域",
"恢复铸渊",
"恢复光湖",
"TCS路径",
"GLS编号",
"光之湖",
"小湖灯",
"人格系统",
"代码仓库入口",
"忘记前文",
"空白实例"
],
"preferred_route": [
"REPO-001",
"CH-ZERO-CORE-LPM",
"TCS-LPM",
"TCS-LPS-REGISTRY-0001",
"LIGHT-LAKE",
"LL-CURRENT",
"LL-004",
"ICE-GL-ZY001",
"ZY-OPS-LOOP-001"
],
"forbidden_route_markers": [
"从旧新加坡仓库猜入口",
"只凭聊天记忆恢复",
"把REPO-004当产品开发主仓",
"读取路径等于执行授权"
],
"deprecated_route_markers": [
"BROADCAST-TOWER作为根注册入口",
"旧本地副本优先于在线main"
],
"evidence": [
".code-map",
"skills/codex/enter-fifth-domain/SKILL.md",
"tcs-core/WAKE-UP-PROTOCOL.hdlp"
],
"freshness": {
"check": "Resolve live REPO-001 and read current main before relying on a cached checkout.",
"max_age_seconds": 0
},
"authorization": "Public route recovery is read-only. Writes and external actions require separate current authority."
},
{
"id": "GHS-002-OFFLINE-PACK-LOCAL-RELAY",
"hldp_skill": "SKILL-012",
"gls_id": "GLS-0238",
"title": "海外完整包经本地可信节点中转至国内候选环境",
"intents": [
"新加坡下载",
"本地中转",
"京东服务器上传",
"完整离线包",
"Forgejo安装",
"光湖代码频道部署",
"部署光湖代码频道",
"国内下载失败",
"跨服务器传包"
],
"preferred_route": [
"读取当前节点地图",
"验证海外源码节点和国内目标节点",
"海外完整包下载到本地暂存目录",
"本地校验MANIFEST",
"上传到国内目标的隔离incoming目录",
"目标端再次校验MANIFEST",
"仅替换隔离候选release",
"重启并验证候选服务",
"保留旧生产仓库且不自动切流"
],
"forbidden_route_markers": [
"猜测服务器地址",
"把私钥写进仓库",
"直接覆盖正在运行的release",
"未校验就启动",
"自动切换/code/",
"删除旧Gitea",
"借读取权限执行服务器写入",
"根据短提交补写40位提交"
],
"deprecated_route_markers": [
"先让海外服务器直连国内服务器",
"使用旧Gatekeeper任意命令接口",
"从国内节点重复下载海外上游"
],
"evidence": [
"deployment/navigation-maps/JD-FD-PRIMARY.json",
"deployment/receipts/HLCC-BS-SG-003-OFFLINE-PACK-20260723.json",
"gls/GLS-0237-HOLOLAKE-CODE-CHANNEL-SOVEREIGN-SOURCE-UPDATE-AND-EMBEDDING.hdlp"
],
"freshness": {
"check": "Verify both node identities and package hashes in the current session.",
"max_age_seconds": 10800
},
"authorization": "Transfer and candidate restart require explicit scoped server authority. Production cutover is a separate action."
}
]
}

View file

@ -0,0 +1,126 @@
#!/usr/bin/env python3
"""Resolve and enforce registered Guanghu persona skills without granting authority."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
DEFAULT_REGISTRY = Path(__file__).resolve().parents[1] / "references" / "persona-skill-registry.json"
REQUIRED_SKILL_FIELDS = {
"id",
"hldp_skill",
"gls_id",
"title",
"intents",
"preferred_route",
"forbidden_route_markers",
"deprecated_route_markers",
"evidence",
"freshness",
"authorization",
}
def load_registry(path: Path = DEFAULT_REGISTRY) -> dict:
with path.open(encoding="utf-8") as handle:
registry = json.load(handle)
if registry.get("schema") != "guanghu.persona-skill-registry/v1":
raise ValueError("unsupported persona skill registry schema")
if not registry.get("version") or not isinstance(registry.get("skills"), list):
raise ValueError("registry version or skills are missing")
for skill in registry["skills"]:
missing = REQUIRED_SKILL_FIELDS.difference(skill)
if missing:
raise ValueError(f"{skill.get('id', '<unknown>')} missing fields: {sorted(missing)}")
return registry
def _normalise(value: str) -> str:
return "".join(value.lower().split())
def _marker_hits(text: str, markers: list[str]) -> list[str]:
normalised = _normalise(text)
return [marker for marker in markers if _normalise(marker) in normalised]
def select_skill(registry: dict, intent: str) -> tuple[dict | None, int]:
normalised = _normalise(intent)
best_skill = None
best_score = 0
for skill in registry["skills"]:
score = sum(max(1, len(_normalise(term))) for term in skill["intents"] if _normalise(term) in normalised)
if score > best_score:
best_skill = skill
best_score = score
return best_skill, best_score
def resolve(registry: dict, intent: str, proposed_route: str = "") -> dict:
skill, score = select_skill(registry, intent)
if skill is None:
return {
"decision": "NO_MATCH",
"registry_id": registry["registry_id"],
"registry_version": registry["version"],
"correction": "Resolve live REPO-001 and current .code-map; do not invent a route.",
"authority_granted": False,
}
forbidden = _marker_hits(proposed_route, skill["forbidden_route_markers"])
deprecated = _marker_hits(proposed_route, skill["deprecated_route_markers"])
if forbidden:
decision = "BLOCK"
correction = "Stop the proposed route and use the registered preferred route after live verification."
elif deprecated:
decision = "CORRECT"
correction = "Replace the deprecated route with the registered preferred route and verify current evidence."
else:
decision = "ALLOW"
correction = "Use the preferred route within the stated authorization boundary."
return {
"decision": decision,
"matched_skill": skill["id"],
"hldp_skill": skill["hldp_skill"],
"gls_id": skill["gls_id"],
"confidence": min(1.0, round(score / 20, 2)),
"preferred_route": skill["preferred_route"],
"forbidden_hits": forbidden,
"deprecated_hits": deprecated,
"correction": correction,
"evidence": skill["evidence"],
"freshness": skill["freshness"],
"authorization": skill["authorization"],
"authority_granted": False,
"registry_version": registry["version"],
}
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--intent", required=True)
parser.add_argument("--proposed-route", default="")
parser.add_argument("--registry", type=Path, default=DEFAULT_REGISTRY)
parser.add_argument("--json", action="store_true")
args = parser.parse_args()
try:
result = resolve(load_registry(args.registry), args.intent, args.proposed_route)
except (OSError, ValueError, json.JSONDecodeError) as error:
parser.error(str(error))
if args.json:
print(json.dumps(result, ensure_ascii=False, indent=2))
else:
print(result["decision"])
print(result["correction"])
for step in result.get("preferred_route", []):
print(f"- {step}")
return 0
if __name__ == "__main__":
raise SystemExit(main())

View file

@ -0,0 +1,53 @@
import unittest
from resolve_persona_skill import load_registry, resolve
class PersonaSkillResolverTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.registry = load_registry()
def test_restores_fifth_domain_route(self):
result = resolve(self.registry, "我是冰朔,进入第五域并恢复小湖灯铸渊人格系统")
self.assertEqual(result["decision"], "ALLOW")
self.assertEqual(result["matched_skill"], "GHS-001-FIFTH-DOMAIN-RESTORE")
self.assertIn("REPO-001", result["preferred_route"])
self.assertFalse(result["authority_granted"])
def test_corrects_deprecated_server_relay(self):
result = resolve(
self.registry,
"把新加坡完整离线包上传到京东服务器",
"先让海外服务器直连国内服务器",
)
self.assertEqual(result["decision"], "CORRECT")
self.assertEqual(result["matched_skill"], "GHS-002-OFFLINE-PACK-LOCAL-RELAY")
self.assertTrue(result["deprecated_hits"])
def test_blocks_unverified_release_overwrite(self):
result = resolve(
self.registry,
"安装光湖代码频道完整离线包",
"未校验就启动并直接覆盖正在运行的release",
)
self.assertEqual(result["decision"], "BLOCK")
self.assertEqual(len(result["forbidden_hits"]), 2)
def test_blocks_fabricated_full_commit(self):
result = resolve(
self.registry,
"部署光湖代码频道到京东服务器",
"根据短提交补写40位提交",
)
self.assertEqual(result["decision"], "BLOCK")
self.assertIn("根据短提交补写40位提交", result["forbidden_hits"])
def test_unknown_intent_fails_closed(self):
result = resolve(self.registry, "安排明天的午饭")
self.assertEqual(result["decision"], "NO_MATCH")
self.assertFalse(result["authority_granted"])
if __name__ == "__main__":
unittest.main()