richfrem/agent-plugins-skills / plugins/agent-agentic-os/.apm/skills/running-control-plane
running-control-plane
FlaggedCRITICAL INTAKE GATEWAY: use at the start of any non-trivial engineering task, feature, refactor, multi-file bugfix, work package or new idea, including requests to explore, brainstorm, build, fix or change something, before planning or code changes. Enforces read-only discovery, 1-3 structured questions with defaults, control-plane registration and the immutable four-pillar TASK_SPEC.md. Also runs the rest of the control plane: health ("run health check", "check os metrics", "system monitor", event bus, locks, memory, "is my signing identity ready" status check), transition simulation ("dry run transition", "simulate transition", "check edge X -> Y"), worktree selection, and gating on/off ("disable the control plane", "turn off the push guard", "stop gating my commits"). Not for project setup or key creation (use setting-up-agentic-os) or improving skills (use improving-skills-in-lab).
tests/test_control_plane_worktree_sharing.py
View on GitHub"""
test_control_plane_worktree_sharing.py — Contract Test for Cross-Worktree DB Sharing
======================================================================================
Purpose:
Verifies ControlPlane's auto-discovery (db_path=None) resolves the SAME
context/control_plane.db whether invoked from the main checkout or from a git
worktree of the same repo — previously each worktree got an independent, empty
DB (since the discovery walk found the worktree's own local `.git` file and
treated it as a separate repo boundary), disconnecting task state registered in
the main checkout from work done inside the worktree.
Key Input Dependencies:
- plugins/agent-agentic-os/skills/running-control-plane/scripts/agent_control.py (copied into a throwaway repo)
- plugins/agent-agentic-os/scripts/control_plane/ (copied alongside — agent_control.py
depends on it since issue-524's hexagonal decomposition, ports.py/adapters.py)
- git CLI (init, worktree add)
"""
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
SCRIPTS_DIR = Path(__file__).resolve().parent.parent / "scripts"
if str(SCRIPTS_DIR) not in sys.path:
sys.path.insert(0, str(SCRIPTS_DIR))
from control_plane.constants import (
STATE_INTAKE,
)
REPO_ROOT = Path(__file__).resolve().parents[5]
SKILL_DIR = Path(__file__).resolve().parent.parent
AGENT_CONTROL_SRC = SKILL_DIR / "scripts" / "agent_control.py"
CONTROL_PLANE_PKG_SRC = SKILL_DIR / "scripts" / "control_plane"
@pytest.fixture
def repo_with_worktree(tmp_path):
"""Creates a throwaway git repo with agent_control.py copied in, plus a real
git worktree checked out from it — mimicking a consumer repo's layout."""
main_repo = tmp_path / "main_repo"
main_repo.mkdir()
subprocess.run(["git", "init"], cwd=main_repo, check=True, capture_output=True)
subprocess.run(["git", "config", "user.name", "Test User"], cwd=main_repo, check=True)
subprocess.run(["git", "config", "user.email", "test@example.com"], cwd=main_repo, check=True)
scripts_dir = main_repo / "plugins" / "agent-agentic-os" / "scripts"
scripts_dir.mkdir(parents=True)
shutil.copy(AGENT_CONTROL_SRC, scripts_dir / "agent_control.py")
shutil.copytree(CONTROL_PLANE_PKG_SRC, scripts_dir / "control_plane")
subprocess.run(["git", "add", "."], cwd=main_repo, check=True, capture_output=True)
subprocess.run(["git", "commit", "-m", "Initial commit"], cwd=main_repo, check=True, capture_output=True)
worktree_dir = tmp_path / "worktree_copy"
subprocess.run(
["git", "worktree", "add", str(worktree_dir), "-b", "feat/test-branch"],
cwd=main_repo, check=True, capture_output=True
)
return main_repo, worktree_dir
_HUMAN_CONFIRMED_GATED_COMMANDS = frozenset({
"init", "coordinate-transition", "transition", "lock-verifiers", "record-receipt",
"update-worktree", "log-prior-art", "record-plan-mode-entry", "record-socratic-intake",
"record-human-approval", "record-review-skip", "record-critic-review",
"record-recovery-approval",
})
def _run_cli(cwd: Path, *args: str):
"""Invokes the copied agent_control.py CLI as a subprocess with cwd set to the given repo/worktree.
Auto-injects --human-confirmed for gated subcommands (DEBT-20260913-NO-HUMAN-CONFIRM-BLANKET-GATE) --
this test suite exercises the CLI as a black box, not real human interaction, so a
fixed test marker is appropriate here (unlike production code, which must never fabricate this)."""
script = cwd / "plugins" / "agent-agentic-os" / "scripts" / "agent_control.py"
call_args = list(args)
if call_args and call_args[0] in _HUMAN_CONFIRMED_GATED_COMMANDS and "--human-confirmed" not in call_args:
call_args += ["--human-confirmed", "HUMAN-CONFIRMED: test fixture"]
return subprocess.run(
[sys.executable, str(script), *call_args],
cwd=str(cwd), capture_output=True, text=True
)
def test_worktree_shares_control_plane_db_with_main_checkout(repo_with_worktree):
"""A task registered from the main checkout must be visible from the worktree."""
main_repo, worktree_dir = repo_with_worktree
res_init = _run_cli(main_repo, "init", "--task-id", "shared-task-001", "--title", "Shared Task", "--runtime", "claude")
assert res_init.returncode == 0, res_init.stderr
res_status = _run_cli(worktree_dir, "status", "--task-id", "shared-task-001")
assert res_status.returncode == 0, res_status.stderr
assert "shared-task-001" in res_status.stdout
assert f'"state": "{STATE_INTAKE}"' in res_status.stdout
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Unverified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |