feat(steering): K-Ext-2 Attention-Registry, Gate/Intake-Proposals, generische UI
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 4m13s
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 12s

Methodenuebergreifende Provider auf Kernel v0.3; verbindliche Coding Rules fuer Agenten in ADP und .cursor/rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-27 11:48:10 +02:00
1 parent 1bbc5dbfce
commit b747200f3a
29 files changed
+1364 -182

No files matched your search

@@ -0,0 +1,127 @@
"""Gate next actions proposal — sequential_dependency / program_delivery."""
from __future__ import annotations
from typing import Any
from steering.eval_context import SteeringEvalContext
COMMITTABLE = frozenset({"new", "triaged", "accepted"})
_PRIORITY = {"critical": 0, "high": 1, "normal": 2, "low": 3}
def _active_gate_id(ctx: SteeringEvalContext) -> str | None:
if ctx.horizon.kind == "gate" and ctx.horizon.gate_roadmap_item_id:
return str(ctx.horizon.gate_roadmap_item_id)
debts = []
return None
def _sort_key(item: dict[str, Any]) -> tuple:
return (
_PRIORITY.get(item.get("priority") or "normal", 9),
item.get("sort_order") if item.get("sort_order") is not None else 9999,
(item.get("title") or "").lower(),
)
def propose_gate_next_actions(
ctx: SteeringEvalContext,
*,
read_models: dict[str, Any] | None = None,
) -> list[dict[str, Any]]:
read_models = read_models or {}
gate_id = _active_gate_id(ctx)
proposals: list[dict[str, Any]] = []
rank = 0
for debt in read_models.get("planning_debt") or []:
rank += 1
gid = str(debt.get("roadmap_item_id"))
proposals.append(
{
"proposal_key": "gate_next_actions",
"scope_type": "roadmap_item",
"scope_id": gid,
"rank": rank,
"reason_code": "planning_debt",
"summary": debt.get("message") or "Gate ohne Durchführungsplan",
"title": debt.get("title") or "Zielzustand",
"roadmap_item_id": gid,
"initiative_id": ctx.initiative_id,
"ranker_key": "heuristic_v0",
"confidence": "heuristic",
"factors": [{"code": "planning_debt", "weight": 100, "label": "Planning Debt"}],
"dependency_refs": [],
"dependency_blocked": False,
"data_source": "steering_kernel",
}
)
vocabulary = ctx.backlog_vocabulary
convertible = frozenset(vocabulary.get("convertible_kinds") or ["story", "bug", "issue"])
candidates = [
item
for item in ctx.backlog_items
if item.get("status") in COMMITTABLE
and item.get("item_kind") != "epic"
and (item.get("item_kind") or "story") in convertible
and (not gate_id or str(item.get("roadmap_item_id") or "") == gate_id)
]
for item in sorted(candidates, key=_sort_key)[:15]:
rank += 1
proposals.append(
{
"proposal_key": "gate_next_actions",
"scope_type": "backlog_item",
"scope_id": str(item["id"]),
"rank": rank,
"reason_code": "gate_backlog_ready",
"summary": "Eingang-Item am aktiven Gate committen",
"title": item.get("title") or "Backlog-Item",
"item_kind": item.get("item_kind") or "story",
"priority": item.get("priority") or "normal",
"roadmap_item_id": (
str(item["roadmap_item_id"]) if item.get("roadmap_item_id") else gate_id
),
"initiative_id": ctx.initiative_id,
"ranker_key": "heuristic_v0",
"confidence": "heuristic",
"factors": [
{
"code": "gate_alignment",
"weight": 50,
"label": "Gate-Zuordnung",
}
],
"dependency_refs": [],
"dependency_blocked": False,
"data_source": "steering_kernel",
}
)
return proposals
def gate_next_actions_attention_items(
*,
initiative_id: str,
proposals: list[dict[str, Any]],
) -> list[dict[str, Any]]:
backlog_ready = [p for p in proposals if p.get("scope_type") == "backlog_item"]
if not backlog_ready:
return []
return [
{
"kind": "gate_commit_suggested",
"severity": "info",
"title": "Gate-Planung",
"summary": f"{len(backlog_ready)} Item(s) für Gate-Commit vorgeschlagen",
"scope_type": "initiative",
"scope_id": initiative_id,
"initiative_id": initiative_id,
"reason_code": "gate_commit_suggested",
"data_source": "gate_next_actions",
}
]
@@ -0,0 +1,93 @@
"""Intake triage proposal — queue_inbox / continuous backlog (no sprint)."""
from __future__ import annotations
from typing import Any
from steering.eval_context import SteeringEvalContext
COMMITTABLE = frozenset({"new", "triaged", "accepted"})
_PRIORITY = {"critical": 0, "high": 1, "normal": 2, "low": 3}
_QUEUE_KIND_BIAS = {"bug": 0, "issue": 1, "incident": 1, "story": 2, "idea": 3}
def propose_intake_triage(
ctx: SteeringEvalContext,
*,
read_models: dict[str, Any] | None = None,
) -> list[dict[str, Any]]:
vocabulary = ctx.backlog_vocabulary
convertible = frozenset(vocabulary.get("convertible_kinds") or ["story", "bug", "issue"])
queue_mode = "queue_inbox" in ctx.steering_elements
candidates = [
item
for item in ctx.backlog_items
if item.get("status") in COMMITTABLE
and item.get("item_kind") != "epic"
and (item.get("item_kind") or "story") in convertible
]
if not candidates:
return []
def sort_key(item: dict[str, Any]) -> tuple:
kind = item.get("item_kind") or "story"
kind_bias = _QUEUE_KIND_BIAS.get(kind, 5) if queue_mode else 5
return (
_PRIORITY.get(item.get("priority") or "normal", 9),
kind_bias,
item.get("sort_order") if item.get("sort_order") is not None else 9999,
)
proposals: list[dict[str, Any]] = []
for rank, item in enumerate(sorted(candidates, key=sort_key)[:20], start=1):
kind = item.get("item_kind") or "story"
proposals.append(
{
"proposal_key": "intake_triage",
"scope_type": "backlog_item",
"scope_id": str(item["id"]),
"rank": rank,
"reason_code": "intake_triage_candidate",
"summary": "Triage-Kandidat (Heuristik — Ranker austauschbar)",
"title": item.get("title") or "Backlog-Item",
"item_kind": kind,
"priority": item.get("priority") or "normal",
"initiative_id": ctx.initiative_id,
"ranker_key": "heuristic_v0",
"confidence": "heuristic",
"factors": [
{
"code": "priority",
"weight": _PRIORITY.get(item.get("priority") or "normal", 9),
"label": "Priorität",
}
],
"dependency_refs": [],
"dependency_blocked": False,
"data_source": "steering_kernel",
}
)
return proposals
def intake_triage_attention_items(
*,
initiative_id: str,
proposals: list[dict[str, Any]],
) -> list[dict[str, Any]]:
if not proposals:
return []
return [
{
"kind": "intake_triage_suggested",
"severity": "info",
"title": "Eingang triagieren",
"summary": f"{len(proposals)} Item(s) — Kernel schlägt Triage-Reihenfolge vor",
"scope_type": "initiative",
"scope_id": initiative_id,
"initiative_id": initiative_id,
"reason_code": "intake_triage_suggested",
"data_source": "intake_triage",
}
]
+30 -2
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import Any, Callable
from steering.eval_context import SteeringEvalContext
@@ -16,6 +16,7 @@ class ProposalProvider:
requires_elements: frozenset[str]
requires_data_slices: frozenset[str]
compute: ProposalCompute
excludes_elements: frozenset[str] = field(default_factory=frozenset)
_PROVIDERS: list[ProposalProvider] = []
@@ -37,6 +38,8 @@ def compute_proposals(
for provider in _PROVIDERS:
if provider.requires_elements and not provider.requires_elements <= elements:
continue
if provider.excludes_elements and provider.excludes_elements & elements:
continue
if provider.requires_data_slices and not provider.requires_data_slices <= slices:
continue
result[provider.key] = provider.compute(ctx, read_models)
@@ -45,6 +48,8 @@ def compute_proposals(
def _register_builtin_proposals() -> None:
from steering.proposals.gate_next_actions import propose_gate_next_actions
from steering.proposals.intake_triage import propose_intake_triage
from steering.proposals.sprint_commit import propose_sprint_commit
register_proposal(
@@ -52,7 +57,30 @@ def _register_builtin_proposals() -> None:
key="sprint_commit",
requires_elements=frozenset({"work_cycle_scope"}),
requires_data_slices=frozenset({"backlog", "work_cycles"}),
compute=lambda ctx, read_models: propose_sprint_commit(ctx, read_models=read_models),
compute=lambda ctx, read_models: propose_sprint_commit(
ctx, read_models=read_models
),
)
)
register_proposal(
ProposalProvider(
key="gate_next_actions",
requires_elements=frozenset({"gate_fulfillment"}),
requires_data_slices=frozenset({"backlog", "roadmap", "actions"}),
compute=lambda ctx, read_models: propose_gate_next_actions(
ctx, read_models=read_models
),
)
)
register_proposal(
ProposalProvider(
key="intake_triage",
requires_elements=frozenset(),
requires_data_slices=frozenset({"backlog"}),
excludes_elements=frozenset({"work_cycle_scope"}),
compute=lambda ctx, read_models: propose_intake_triage(
ctx, read_models=read_models
),
)
)