Answer principles round 1: 0 🔴, 6 🟡; derive the reviewers from agents/, open the security pass's prompt with a sentence, and type the review kinds
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
"""Hold each Agent call that launches a review to the rung loop-claude hands its worker: docs/decisions.md → `routing:`."""
|
||||
import re
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from rule_hook.rules import Breach
|
||||
from rule_hook.call import Call, text
|
||||
from model_routing.worker_rungs import handed
|
||||
from model_routing.ladder import position, review_rung, Rung
|
||||
from model_routing.ladder import position, review_rung, ReviewKind, Rung
|
||||
|
||||
# larv-review §3's reviewers, by the subagent type its passes launch.
|
||||
REVIEWERS = frozenset(("override-reviewer", "principles-auditor", "product-owner-reviewer", "prose-reviewer", "stability-reviewer", "systems-architect"))
|
||||
# A reviewer is an agent under agents/, as CLAUDE.md → "Vocabulary" defines it.
|
||||
REVIEWERS = frozenset(path.stem for path in (pathlib.Path(__file__).resolve().parents[2] / "agents").glob("*.md"))
|
||||
# The opening of every comprehension seat's prompt: skills/comprehension-panel/seat-prompts.md → "Opening".
|
||||
SEAT = "You are one seat of a comprehension panel."
|
||||
# The security pass's subagent invokes one of these skills.
|
||||
SECURITY = re.compile(r"/security-review\b|/claude-security\b")
|
||||
# The opening of the security pass's prompt: skills/larv-review/SKILL.md → "Security".
|
||||
SECURITY_OPENER = "You are the security pass for this chunk."
|
||||
SUBJECTS = {"seat": "a comprehension seat", "security": "the security pass's subagent"}
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ def reviewer_breaches(call: Call, environ: typing.Mapping[str, str]) -> list[Bre
|
||||
return [Breach("reviewer-rung", f"{subject} would run on {named}, below {required}: launch it with {required.agent_args()}", call.cwd)]
|
||||
|
||||
|
||||
def review_kind(given: dict[str, typing.Any]) -> str | None:
|
||||
def review_kind(given: dict[str, typing.Any]) -> ReviewKind | None:
|
||||
"""What a launch reviews, a reviewer, a comprehension seat or the security pass; None for any other subagent."""
|
||||
if text(given, "subagent_type") in REVIEWERS:
|
||||
return "reviewer"
|
||||
prompt = text(given, "prompt")
|
||||
if SEAT in prompt:
|
||||
return "seat"
|
||||
if SECURITY.search(prompt):
|
||||
if SECURITY_OPENER in prompt:
|
||||
return "security"
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user