You are creating an implementation plan for the following idea. Refined idea (from…
- User
You are creating an implementation plan for the following idea.
codeRefined idea (from clarification): Add a single new tool, `consult_perspective`, registered in `tool_schemas.py` and wired through `app/services/tools/registry.py`, available only in the main agent's **read phase**.Inputs (Pydantic model): exactly one of
template: PerspectiveTemplate(enum: a small curated set drawn from the frameworks already in the system prompt — e.g.nvc,gottman,ifs_parts,reflective_listener,devils_advocate) orperspective: str(free-form, length-capped). Plus a requiredfocus: strdescribing what the main agent wants the perspective on, and an optionalproposed_response: strfor critique.Behavior: the registry handler builds a small consult-subagent loop using
anthropic.AsyncAnthropicwith model =settings.consult_model(new setting, defaulting tosettings.conversational_model). The subagent is given:- a perspective-specific system prompt (template body or the user-supplied perspective string), plus a fixed preamble enforcing read-only, advisory-only behavior and inherited OOB/privacy rules;
- the same
hot_context_renderedthe main agent saw; - the same
TurnContext(so OOB / protected_owner_ids / partner identities flow through); - a tool surface =
READ_PHASE_TOOLS - {"send_message_part"}(no outbound, no writes, no escalations, no nestedconsult_perspective). The loop is bounded by (a) a smallmax_tokens(e.g. 600), (b) a low max-tool-iteration count (e.g. 3), and (c) the existing text-LLM daily spend cap.
Output: a structured advisory record validated by an output Pydantic model — e.g.
summary: str,key_points: list[str],suggested_moves: list[str],caveats: list[str],confidence: Confidence, plus atemplate_usedecho. Errors (timeout, cap exceeded, validation) return{is_error: true, error: "..."}like other tools, never crash the main turn.Persistence/observability: round-trips through the normal
tool_callsJSON in the assistant transcript like any other tool. Inner subagent tool calls are recorded via tagged with so they are distinguishable in replay. No new database table; no row. - Assistant
{"plan":"I’ll inspect the repository structure and the existing tool registry, schemas, prompts, config, and tests before drafting the implementation plan.","questions":[],"success_criteria":["Plan is grounded in actual repository files and patterns.","Plan includes concrete steps, validation, assumptions, and open questions."],"assumptions":[]}
- Assistant
{"plan":"I found a compact Python service with
tool_schemas.py,app/services/tools/registry.py, read/write tool modules, and agentic loop tests already in place. I’ll read those next to align the plan with current call patterns and test style.","questions":[],"success_criteria":["Identify existing phase-gating and tool-call plumbing.","Identify where settings, prompts, and eval capture should be changed.","Identify relevant tests to extend or mirror."],"assumptions":[]} - Assistant
{"plan":"The agent loop already has reusable
run_phase, spend-cap checks, Anthropic retry/cost helpers, and phase-based registry gating. The consult implementation can reuse those patterns, but it will need a way to pass the current rendered hot context into a tool handler becauseTurnContextcurrently does not carry it.","questions":[],"success_criteria":["Plan accounts for current TurnContext fields and call_tool signature.","Plan avoids adding DB persistence beyond existing bot_turns/tool capture."],"assumptions":["The consult handler can either add fields to TurnContext or pass consult runtime state through an explicit helper called by registry."]} - Assistant
{"plan":"The existing repo has no consult scaffolding yet, so the plan should include a small new service module rather than burying the loop inside
registry.py. I’m checking read-tool privacy paths now so the context-inheritance tests target real behavior instead of only object identity.","questions":[],"success_criteria":["Plan includes concrete privacy/OOB context checks.","Plan names likely files and tests to edit."],"assumptions":[]} - Assistant