← Documentation indexdocs/superpowers/plans/2026-10-11-v3-issue-235.md

V3 Issue #235 Typed Tool Results Implementation Plan

For agentic workers: Execute this plan task by task with test-first changes and a whole-branch independent review before delivery.

Goal: Complete R024, R025 and R031: tool outcomes and stable failures are machine-readable, while legacy text output is a presentation-only view.

Architecture: Add immutable ToolError/ToolResult contracts and a single renderer. Bind typed executors in each workspace registry while preserving text-facing built-in methods and mappings. Make the runtime consume ToolResult for receipts, observers, learning and MCP status; preserve existing authorization, scope and evidence gates.

Tech Stack: Python 3.12–3.13; stdlib dataclasses/JSON; current unittest suite; no new dependencies or paid provider calls.

Spec: GitHub issue #235 and the supplied OpenKyrozen V3 architecture proposal (R024, R025, R031); only #235 is in scope.

Global Constraints

Review Focus


Task 1: Result and error contracts

Files: openkyrozen/tools/models.py, openkyrozen/tools/__init__.py, tests/test_tool_results.py.

Task 2: Typed registry bindings and tool producers

Files: openkyrozen/tools/manifest.py, tool adapter modules, openkyrozen/agent/runtime.py, openkyrozen/agent/delegation_runtime.py, openkyrozen/memory/retrieval.py, tests/test_tool_registry.py, tests/test_tools.py.

Task 3: Runtime and surface status propagation

Files: openkyrozen/agent/executor.py, openkyrozen/agent/planner.py, openkyrozen/agent/subagent_runtime.py, openkyrozen/learning/failures.py, openkyrozen/interfaces/mcp/server.py, CLI/Web render boundaries, relevant tests.

Task 4: Integration, docs and delivery

Files: docs/extensions.md, generated/API docs as needed, focused and integration tests.

Assumptions and defaults

Built-in string contracts remain available to current direct callers; internal registry execution is typed. Unknown custom/dynamic return types fail closed after one call. retriable defaults false, with no automatic retry in this issue. Tool success, child-task success and verified acceptance remain three separate states.

Interface and compatibility

ToolResult exposes data, text, optional ToolError, metadata and derived success; ToolError exposes stable code, message, retriable and metadata. Existing built-in string methods and AVAILABLE_TOOLS calls continue through rendering wrappers. Custom/dynamic string-returning callables must migrate to ToolResult. Existing receipt/client text fields remain compatible; machine status comes from the typed result.