from pathlib import Path AGENT_DOCS = Path("docs/agents") EXPECTED_AGENTS = [ "requirement_agent", "arch_agent", "code_dev_agent", "lint_review_agent", "test_agent", "build_pack_agent", "release_agent", "ops_monitor_agent", ] def test_agent_docs_use_canonical_eight_agents(): combined = "\n".join(path.read_text(encoding="utf-8") for path in AGENT_DOCS.rglob("*.md")) for agent in EXPECTED_AGENTS: assert agent in combined def test_agent_runbook_defines_required_flow_order(): runbook = (AGENT_DOCS / "RUNBOOK.md").read_text(encoding="utf-8") positions = [runbook.index(agent) for agent in EXPECTED_AGENTS] assert positions == sorted(positions) def test_auto_run_protocol_protects_openclaw_self_config_files(): protocol = (AGENT_DOCS / "AUTO-RUN-PROTOCOL.md").read_text(encoding="utf-8") for filename in ["AGENTS.md", "SOUL.md", "MEMORY.md", "USER.md", "TOOLS.md", "META.md"]: assert filename in protocol assert "不得修改 OpenClaw" in protocol