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_p01_intake_persistence.py
View on GitHub"""P01 persistence contracts for scoped premium consent and source-assisted answers."""
import sqlite3
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 agent_control import ControlPlane
from control_plane.adapters import CURRENT_SCHEMA_VERSION
from control_plane.ports import PersistenceInvariantViolation
from interview_helpers import stage_interview_answers, REASON_INTERVIEW_COMPLETE
from control_plane.constants import (
STATE_INTERVIEW, STATE_DRAFT_PLAN,
)
def _control_plane_with_task(tmp_path):
control_plane = ControlPlane(db_path=tmp_path / "control_plane.db")
control_plane.create_task("p01-task", "P01 persistence", "codex")
return control_plane
def test_v9_migration_persists_scoped_consent_and_candidate_provenance(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
db_path = control_plane.db_path
conn = sqlite3.connect(str(db_path))
try:
conn.execute("UPDATE schema_version SET version = 8")
conn.commit()
finally:
conn.close()
control_plane.init_db()
control_plane.record_premium_consent(
task_id="p01-task",
stage="interview",
round_id="round-1",
model_id="premium-model",
actor="human",
)
candidate_id = control_plane.record_source_assisted_answer_candidate(
task_id="p01-task",
stage="interview",
round_id="round-1",
question_id="scope",
answer="P01 only",
source_path="docs/brief.md",
)
conn = sqlite3.connect(str(db_path))
try:
assert conn.execute("SELECT version FROM schema_version").fetchone()[0] == CURRENT_SCHEMA_VERSION
assert conn.execute(
"SELECT stage, round_id, model_id, actor FROM premium_consents"
).fetchone() == ("interview", "round-1", "premium-model", "human")
assert conn.execute(
"SELECT question_id, answer, source_path, confirmation_status "
"FROM source_assisted_answer_candidates WHERE candidate_id = ?",
(candidate_id,),
).fetchone() == ("scope", "P01 only", "docs/brief.md", "pending")
finally:
conn.close()
def test_premium_consent_is_denied_outside_its_exact_stage_and_round(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
control_plane.record_premium_consent(
task_id="p01-task",
stage="interview",
round_id="round-1",
model_id="premium-model",
actor="human",
)
control_plane.require_premium_consent("p01-task", "interview", "round-1", "premium-model")
with pytest.raises(PersistenceInvariantViolation, match="stage='plan', round_id='round-1'"):
control_plane.require_premium_consent("p01-task", "plan", "round-1", "premium-model")
with pytest.raises(PersistenceInvariantViolation, match="stage='interview', round_id='round-2'"):
control_plane.require_premium_consent("p01-task", "interview", "round-2", "premium-model")
def test_unconfirmed_source_candidate_blocks_interview_exit_until_human_confirmed(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
candidate_id = control_plane.record_source_assisted_answer_candidate(
task_id="p01-task",
stage="interview",
round_id="round-1",
question_id="scope",
answer="P01 only",
source_path="docs/brief.md",
)
with pytest.raises(PersistenceInvariantViolation, match="unconfirmed source-assisted answer candidate"):
control_plane.assert_interview_exit_ready("p01-task", "interview", "round-1")
control_plane.confirm_source_assisted_answer_candidate(candidate_id, actor="human")
control_plane.assert_interview_exit_ready("p01-task", "interview", "round-1")
def test_transition_blocks_pending_source_candidate_on_interview_exit(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
control_plane.transition("p01-task", STATE_INTERVIEW, "human", "start interview")
stage_interview_answers(control_plane, "p01-task")
candidate_id = control_plane.record_source_assisted_answer_candidate(
"p01-task", "interview", "round-1", "scope", "P01 only", "docs/brief.md"
)
with pytest.raises(PersistenceInvariantViolation, match="unconfirmed source-assisted"):
control_plane.transition("p01-task", STATE_DRAFT_PLAN, "agent", REASON_INTERVIEW_COMPLETE)
assert control_plane.get_task("p01-task")["state"] == STATE_INTERVIEW
control_plane.confirm_source_assisted_answer_candidate(candidate_id, actor="human")
control_plane.transition("p01-task", STATE_DRAFT_PLAN, "agent", REASON_INTERVIEW_COMPLETE)
assert control_plane.get_task("p01-task")["state"] == STATE_DRAFT_PLAN
def test_coordinate_transition_blocks_pending_source_candidate_on_interview_exit(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
control_plane.transition("p01-task", STATE_INTERVIEW, "human", "start interview")
stage_interview_answers(control_plane, "p01-task")
candidate_id = control_plane.record_source_assisted_answer_candidate(
"p01-task", "interview", "round-7", "scope", "P01 only", "docs/brief.md"
)
from control_plane.coordinator import TransitionCoordinator as _TC
with pytest.raises(PersistenceInvariantViolation, match="unconfirmed source-assisted"):
_TC(control_plane, input_fn=lambda p: "YES").coordinate_transition(
"p01-task", STATE_DRAFT_PLAN, "agent", REASON_INTERVIEW_COMPLETE, interactive=True,
)
assert control_plane.get_task("p01-task")["state"] == STATE_INTERVIEW
control_plane.confirm_source_assisted_answer_candidate(candidate_id, actor="human")
_TC(control_plane, input_fn=lambda p: "YES").coordinate_transition(
"p01-task", STATE_DRAFT_PLAN, "agent", REASON_INTERVIEW_COMPLETE, interactive=True,
)
assert control_plane.get_task("p01-task")["state"] == STATE_DRAFT_PLAN
def test_source_candidate_requires_authorized_source_and_human_confirmation(tmp_path):
control_plane = _control_plane_with_task(tmp_path)
with pytest.raises(PersistenceInvariantViolation, match="authorized source"):
control_plane.record_source_assisted_answer_candidate(
"p01-task", "interview", "round-1", "scope", "P01 only", "docs/brief.md",
source_authorized=False,
)
candidate_id = control_plane.record_source_assisted_answer_candidate(
"p01-task", "interview", "round-1", "scope", "P01 only", "docs/brief.md"
)
with pytest.raises(PersistenceInvariantViolation, match="actor='human'"):
control_plane.confirm_source_assisted_answer_candidate(candidate_id, actor="agent")
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 | Verified | 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 |