plexus.cli.procedure.tactus_adapters.score_editor_toolset module

Score Editor Toolset for Feedback Alignment Optimizer

Provides a virtual in-memory YAML file editing interface for the code_editor agent. Implements the standard str_replace_editor text editor tool protocol so Claude models can make targeted, precise edits to score configuration YAML.

Key tools exposed: - str_replace_editor: Standard Claude text editor tool (view/str_replace/insert/undo_edit) - submit_score_version: State-transition tool that validates and creates a new ScoreVersion - score_editor_setup: MCP tool called from Lua to initialize the virtual file - score_editor_get_result: MCP tool called from Lua to retrieve the created version ID - score_editor_get_content: MCP tool called from Lua to read current virtual file content

class plexus.cli.procedure.tactus_adapters.score_editor_toolset.ScoreEditorToolset(mcp_client=None)

Bases: object

Manages a virtual in-memory YAML file for code_editor agent sessions.

Lifecycle per iteration:
  1. Lua calls score_editor_setup(yaml_content, scorecard, score, iteration, hypothesis)

  2. code_editor agent calls str_replace_editor to view and edit the file

  3. code_editor agent calls submit_score_version() when edits are complete

  4. Lua calls score_editor_get_result() to retrieve the new version ID

__init__(mcp_client=None)
get_content(arguments: dict) dict

Return the current virtual file content for Lua to build system messages.

get_result(arguments: dict) dict

Return the version ID created by the last submit_score_version call.

classmethod register_on_transport(transport, mcp_client=None) ScoreEditorToolset

Create a ScoreEditorToolset instance and register all four tools on the InProcessMCPTransport so they are available via call_plexus_tool() from Lua and via the agent toolset registry after mcp_adapter.load_tools().

Call this BEFORE mcp_adapter.load_tools() in procedure_executor.py.

setup(arguments: dict) dict

Set up the score editor for a new iteration.

Accepts optional yaml_content parameter. When provided by Lua (which already has the YAML from plexus_score_pull + File.read), content is loaded directly without any async API call — bypassing nested event loop issues in the Tactus agent context. When yaml_content is omitted, falls back to _load_content_from_api().

str_replace_editor(arguments: dict) str

Standard Claude text editor tool — virtual in-memory implementation.

Commands: view, str_replace, insert, undo_edit, create Path: must be one of the virtual editor files.

On the first view command, automatically loads the current champion score YAML from the Plexus API (avoids passing large content through LLM args).

async submit_score_version(arguments: dict) dict

Validate and submit the current virtual file as a new score version.

The score must be modified via str_replace_editor before calling this. Rejects if the content is unchanged from the original to prevent accidentally submitting an unmodified or stale score version.