control-metalayer-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Control Metalayer Loop

控制系统元层循环

Use this skill to initialize or upgrade a repository into a control-loop driven agentic development system.
使用本技能可将代码仓库初始化或升级为基于控制循环的智能Agent开发系统。

What To Load

需加载的参考内容

  • references/control-primitives.md
    for the control model and minimal control law.
  • references/rules-and-commands.md
    for policy/rules and command governance.
  • references/topology-growth.md
    for repository topology and scale path.
  • references/wizard-cli.md
    for command usage.
  • 参考
    references/control-primitives.md
    获取控制模型与最小控制法则。
  • 参考
    references/rules-and-commands.md
    获取策略/规则与命令治理相关内容。
  • 参考
    references/topology-growth.md
    了解仓库拓扑结构与扩展路径。
  • 参考
    references/wizard-cli.md
    掌握命令使用方法。

Primary Entry Point

主入口

Use the Typer wizard:
bash
python3 scripts/control_wizard.py init <repo-path> --profile governed
Profiles:
  • baseline
    : minimal harness and command surface.
  • governed
    : baseline + policy/commands/topology + control loop + metrics + git hooks.
  • autonomous
    : governed + recovery/nightly controls + web and CLI E2E primitives.
使用Typer向导:
bash
python3 scripts/control_wizard.py init <repo-path> --profile governed
配置文件(Profiles):
  • baseline
    :最小化工具集与命令接口。
  • governed
    :包含baseline内容 + 策略/命令/拓扑结构 + 控制循环 + 指标 + Git钩子。
  • autonomous
    :包含governed内容 + 恢复/夜间控制 + Web与CLI端到端原语。

Workflow

工作流程

  1. Baseline current repo workflows and constraints.
  2. Initialize baseline metalayer artifacts.
  3. Add control primitives and governance rules.
  4. Audit and close gaps.
  5. Iterate based on run outcomes and metric drift.
  1. 梳理当前仓库的工作流程与约束条件。
  2. 初始化基础元层工件。
  3. 添加控制原语与治理规则。
  4. 审计并填补漏洞。
  5. 根据运行结果与指标偏差进行迭代优化。

Step 1: Baseline

步骤1:梳理基线

  • Identify canonical test/lint/typecheck/build commands.
  • Identify high-risk actions requiring policy gates.
  • Identify required observability IDs for agent runs.
  • 确定标准的测试/代码检查/类型校验/构建命令。
  • 识别需要策略门控的高风险操作。
  • 确定Agent运行所需的可观测性ID。

Step 2: Initialize Metalayer

步骤2:初始化元层

Run:
bash
python3 scripts/control_wizard.py init <repo-path> --profile baseline
This creates stable operational interfaces:
  • AGENTS.md
    ,
    PLANS.md
    ,
    METALAYER.md
  • Makefile.control
    and
    scripts/control/*
  • docs/control/ARCHITECTURE.md
    and
    docs/control/OBSERVABILITY.md
  • CI workflow for control checks
运行以下命令:
bash
python3 scripts/control_wizard.py init <repo-path> --profile baseline
此命令将创建稳定的操作接口:
  • AGENTS.md
    PLANS.md
    METALAYER.md
  • Makefile.control
    scripts/control/*
  • docs/control/ARCHITECTURE.md
    docs/control/OBSERVABILITY.md
  • 用于控制检查的CI工作流程

Step 3: Add Control Primitives

步骤3:添加控制原语

Run:
bash
python3 scripts/control_wizard.py init <repo-path> --profile governed
This adds the core control plane:
  • .control/policy.yaml
  • .control/commands.yaml
  • .control/topology.yaml
  • docs/control/CONTROL_LOOP.md
  • evals/control-metrics.yaml
For a fully self-sustaining loop:
bash
python3 scripts/control_wizard.py init <repo-path> --profile autonomous
Adds:
  • scripts/control/install_hooks.sh
    +
    .githooks/*
  • scripts/control/recover.sh
  • scripts/control/web_e2e.sh
  • scripts/control/cli_e2e.sh
  • .github/workflows/web-e2e.yml
  • .github/workflows/cli-e2e.yml
  • tests/e2e/web/*
    +
    playwright.config.ts
  • tests/e2e/cli/smoke.sh
  • .control/state.json
  • .github/workflows/control-nightly.yml
运行以下命令:
bash
python3 scripts/control_wizard.py init <repo-path> --profile governed
此命令将添加核心控制平面:
  • .control/policy.yaml
  • .control/commands.yaml
  • .control/topology.yaml
  • docs/control/CONTROL_LOOP.md
  • evals/control-metrics.yaml
若要搭建完全自维持的循环系统,运行:
bash
python3 scripts/control_wizard.py init <repo-path> --profile autonomous
该命令将额外添加:
  • scripts/control/install_hooks.sh
    +
    .githooks/*
  • scripts/control/recover.sh
  • scripts/control/web_e2e.sh
  • scripts/control/cli_e2e.sh
  • .github/workflows/web-e2e.yml
  • .github/workflows/cli-e2e.yml
  • tests/e2e/web/*
    +
    playwright.config.ts
  • tests/e2e/cli/smoke.sh
  • .control/state.json
  • .github/workflows/control-nightly.yml

Step 4: Validate

步骤4:验证

Run:
bash
python3 scripts/control_wizard.py audit <repo-path>
python3 scripts/control_wizard.py audit <repo-path> --strict
Treat audit failures as blocking until corrected.
运行以下命令:
bash
python3 scripts/control_wizard.py audit <repo-path>
python3 scripts/control_wizard.py audit <repo-path> --strict
审计未通过的问题需优先修复,否则将阻塞后续操作。

Step 5: Operate And Grow

步骤5:运行与扩展

  • Keep command names stable (
    smoke
    ,
    check
    ,
    test
    ,
    recover
    ).
  • Keep E2E command names stable (
    web-e2e
    ,
    cli-e2e
    ).
  • Keep policy and command catalog synchronized with actual behavior.
  • Track control metrics and adjust setpoints deliberately.
  • Prune stale rules/scripts/docs to prevent entropy growth.
  • 保持命令名称稳定(如
    smoke
    check
    test
    recover
    )。
  • 保持端到端(E2E)命令名称稳定(如
    web-e2e
    cli-e2e
    )。
  • 确保策略与命令目录与实际行为同步。
  • 跟踪控制指标,并针对性调整设定值。
  • 清理过时的规则/脚本/文档,防止熵增。

Adaptation Rules

适配规则

  • Do not overwrite existing project conventions without explicit reason.
  • Prefer wrappers and policy files over ad-hoc command execution.
  • Make every major behavior observable and auditable.
  • Keep human escalation rules explicit and easy to trigger.
  • 若无明确理由,请勿覆盖现有项目约定。
  • 优先使用包装器与策略文件,而非临时命令执行。
  • 确保所有主要行为可观测、可审计。
  • 明确人工介入规则,并使其易于触发。