Iteration 4: - Overlay Skills (step 12): an Execution names an organisation's standards Skill from the folders the deployment configures; recorded with its version. An example standards Skill and an evaluation case that uses it. - Lessons (step 10): a prove command that compares a run with lessons against one without, and triage of evidence an existing lesson already covers. Iteration 5: - Step 8: the references of a Specialist's Skills its task needs are named in its context as read_first. - Step 14: a remote MCP server's reply that instructs the agent is withheld; the user's own text is flagged as a risk and nothing more. - Step 15: in a Change request, items only reworded are listed apart from real changes. - Step 19: each Execution's design recommendations are judged when it ends and the scores kept in its record. The evaluation takes its rubric from the same place. Each question was calibrated against live Jev; none has run in a case. Steps 6, 7, 9, 13 and 18 stay planned, with the reasons in the plan map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
96 lines
3.3 KiB
Python
96 lines
3.3 KiB
Python
"""Which tools each role gets beyond the Execution tools.
|
|
|
|
A role gets the local tools its role file names, the tools of the remote MCP servers
|
|
the provider bundle assigns it, and, for the design advisor, the pillar consultation.
|
|
When the Deliverable has a working copy, the local tools are built on it.
|
|
Cloud-read gating is applied later, per Execution, by `specialist_tools`.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Callable, Mapping, MutableMapping, Sequence
|
|
from typing import Any
|
|
|
|
from app.adk.roles import PILLAR_ADVISOR
|
|
from app.adk.runtime import (
|
|
AgentRuntime,
|
|
Decider,
|
|
RoleSpec,
|
|
RunLimiter,
|
|
ToolFactory,
|
|
ToolSpec,
|
|
)
|
|
from app.tools.guardrail import guard_all
|
|
from app.tools.mcp import McpCatalog
|
|
from app.tools.pillars import pillar_consultation_tool
|
|
from app.tools.workspace import working_files
|
|
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind
|
|
|
|
# The local tools, built on a working copy of files when the Deliverable has one.
|
|
LocalToolBuilder = Callable[[MutableMapping[str, str] | None], Sequence[ToolSpec]]
|
|
|
|
|
|
def make_tool_factory(
|
|
runtime: AgentRuntime,
|
|
roles: Mapping[str, RoleSpec],
|
|
pillar_skills: Mapping[str, str],
|
|
*,
|
|
local_tools: Sequence[ToolSpec] | LocalToolBuilder = (),
|
|
catalog: McpCatalog | None = None,
|
|
limiter: RunLimiter | None = None,
|
|
guard: Decider | None = None,
|
|
withhold_at: float = 0.75,
|
|
) -> ToolFactory:
|
|
def build_local(
|
|
working_copy: MutableMapping[str, str] | None,
|
|
) -> Sequence[ToolSpec]:
|
|
return local_tools(working_copy) if callable(local_tools) else local_tools
|
|
|
|
def mcp_tools(role: RoleSpec) -> list[ToolSpec]:
|
|
# A remote server's reply is text nobody here wrote: it is checked for
|
|
# instructions addressed to the agent before a Specialist reads it.
|
|
tools = catalog.tools_for(role.mcp_servers) if catalog else []
|
|
return guard_all(tools, guard, withhold_at)
|
|
|
|
advisor = roles.get(PILLAR_ADVISOR)
|
|
# Pillar advisors can't ask for permission, so they get general-tier tools only.
|
|
advisor_tools = (
|
|
[tool for tool in mcp_tools(advisor) if tool.tier == "general"]
|
|
if advisor
|
|
else []
|
|
)
|
|
|
|
def tools_for(
|
|
role: RoleSpec, deliverable: str | None, working: MutableMapping[str, Any]
|
|
) -> Sequence[ToolSpec]:
|
|
has_working_copy = any(
|
|
kind.value == deliverable and spec.working_copy is not None
|
|
for kind, spec in DEPENDENCY_GRAPH.items()
|
|
)
|
|
local_by_name = {
|
|
tool.name: tool
|
|
for tool in build_local(
|
|
working_files(working) if has_working_copy else None
|
|
)
|
|
}
|
|
tools = [local_by_name[name] for name in role.tools if name in local_by_name]
|
|
tools += mcp_tools(role)
|
|
if (
|
|
pillar_skills
|
|
and advisor
|
|
and deliverable == DeliverableKind.DESIGN_RECOMMENDATIONS.value
|
|
):
|
|
tools.append(
|
|
pillar_consultation_tool(
|
|
runtime,
|
|
advisor,
|
|
pillar_skills,
|
|
extra_tools=advisor_tools,
|
|
memory=working,
|
|
limiter=limiter,
|
|
)
|
|
)
|
|
return tools
|
|
|
|
return tools_for
|