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_retrospective_pipeline.py
View on GitHub"""Failing contracts for the pipeline-close retrospective gate (issue #547)."""
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 control_plane.adapters import FilesystemAdapter, SqlitePersistenceAdapter
from control_plane.registry import TransitionRegistry
from control_plane.state_machine import ALLOWED_TRANSITIONS, CANONICAL_STATES
from control_plane.wrappers.record_retrospective import record_retrospective
from agent_control import ControlPlane
from control_plane.constants import (
STATE_INTAKE, STATE_INTERVIEW, STATE_VERIFY_EXIT, STATE_RETROSPECTIVE, STATE_DONE,
)
def test_retrospective_is_a_first_class_completion_state():
registry = TransitionRegistry.load_default()
assert STATE_RETROSPECTIVE in CANONICAL_STATES
assert STATE_RETROSPECTIVE in ALLOWED_TRANSITIONS[STATE_VERIFY_EXIT]
assert STATE_INTERVIEW in ALLOWED_TRANSITIONS[STATE_INTAKE]
assert STATE_DONE in ALLOWED_TRANSITIONS[STATE_VERIFY_EXIT]
assert STATE_DONE in ALLOWED_TRANSITIONS[STATE_INTAKE]
assert registry.get_template(STATE_VERIFY_EXIT, STATE_RETROSPECTIVE) is not None
assert registry.get_template(STATE_INTERVIEW, STATE_RETROSPECTIVE) is not None
assert registry.get_template(STATE_RETROSPECTIVE, STATE_DONE) is not None
def test_retrospective_tables_are_created(tmp_path):
db_path = tmp_path / "control_plane.db"
adapter = SqlitePersistenceAdapter(db_path, FilesystemAdapter())
adapter.ensure_schema()
conn = sqlite3.connect(str(db_path))
try:
tables = {
row[0]
for row in conn.execute(
"SELECT name FROM sqlite_master WHERE type='table'"
)
}
assert "retrospective_entries" in tables
assert "retrospective_follow_ups" in tables
finally:
conn.close()
def test_retrospective_entry_is_unique_per_task(tmp_path):
db_path = tmp_path / "control_plane.db"
adapter = SqlitePersistenceAdapter(db_path, FilesystemAdapter())
adapter.ensure_schema()
conn = sqlite3.connect(str(db_path))
try:
conn.execute(
"INSERT INTO tasks (task_id, title, state, runtime_tool) VALUES (?, ?, ?, ?)",
("task-547", "Reflection", STATE_INTAKE, "codex"),
)
conn.execute(
"""
INSERT INTO retrospective_entries
(task_id, decision, completion_mode, actor, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?)
""",
("task-547", "opt_in", "draft", "human", 1.0, 1.0),
)
with pytest.raises(sqlite3.IntegrityError):
conn.execute(
"""
INSERT INTO retrospective_entries
(task_id, decision, completion_mode, actor, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?)
""",
("task-547", "skip", "skipped", "human", 2.0, 2.0),
)
finally:
conn.close()
def test_retrospective_capture_wrapper_records_agent_completion(tmp_path):
cp = ControlPlane(db_path=tmp_path / "control_plane.db")
cp.create_task("task-547-wrapper", "Reflection", "codex")
cp.transition("task-547-wrapper", STATE_INTERVIEW, "human", "Begin the interview")
from control_plane.coordinator import TransitionCoordinator
interview_answers = iter([
"Task is effectively complete/trivial -- this is a planned early close, not a failure",
"FORCE_RETROSPECTIVE",
"YES",
])
TransitionCoordinator(
control_plane=cp,
input_fn=lambda prompt: next(interview_answers),
).coordinate_transition(
task_id="task-547-wrapper",
to_state=STATE_RETROSPECTIVE,
actor="human",
reason="Enter retrospective",
interactive=True,
)
result = record_retrospective(
"task-547-wrapper",
{
"decision": "opt_in",
"completion_mode": "completed",
"actor": "agent",
"outcome": "completed",
"strengths": "none",
"friction": "none",
"learning": "none",
"improvement": "none",
"follow_up": "none",
},
[],
control_plane=cp,
)
assert result["action_identity"] == "retrospective_capture"
assert cp._persistence.has_complete_retrospective("task-547-wrapper") is True
def test_confirmed_issue_follow_up_blocks_done_until_deduped_and_created(tmp_path):
cp = ControlPlane(db_path=tmp_path / "control_plane.db")
cp.create_task("task-547-issue", "Reflection", "codex")
entry = {"decision": "opt_in", "completion_mode": "completed", "actor": "human"}
cp.save_retrospective(
"task-547-issue",
entry,
[{"kind": "issue", "description": "Follow-up", "status": "confirmed"}],
)
assert cp._persistence.has_complete_retrospective("task-547-issue") is False
cp.save_retrospective(
"task-547-issue",
entry,
[{
"kind": "issue",
"description": "Follow-up",
"status": "created",
"duplicate_checked": True,
"issue_url": "https://github.com/example/repo/issues/1",
}],
)
assert cp._persistence.has_complete_retrospective("task-547-issue") is True
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: 472k | 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 |