Skip to content

refactor(cli): one tool roster for every face #420

Closed

Description

@ajianaz

Problem

Three builders register the session's tools — build_registry (CLI run/resume/chat/mission), build_server_registry (tole mcp, MCP-over-HTTP) and session_host::open_session (tole serve, ACP, MCP session tools). Each re-encodes the same per-tool rules, and they have drifted:

  • Plan mode means three things: register then retain_read_only, skip registration, or register then filter at the caller.
  • delete_file: registered unconditionally on the CLI, only if interactive on server sessions.
  • Server sessions lack sibling tracking, the handoff tool, verify_package and the cora MCP / cora_search fallback rule.
  • binary_available and detect_github_repo exist twice with different rules (the session-host probe accepts non-executable files).
  • Todo registration is copied five times.

Fixes have had to land per face (#254/#298, #294/#297, #380/#383).

Proposal

A tool_roster module in tole-cli: build(approver, Roster) where Roster carries what differs per face (workspace, shell dir, plan mode, child-agent options, MCP servers, plan emitter). The three Destructive enforcement layers stay: the roster registers delete_file only behind an interactive approver, and the registry and AllowlistApprover keep refusing it on their own.

Plan (small PRs)

  1. Add the module; move build_registry and build_server_registry onto it; one binary_available.
  2. Move session_host::open_session onto it (server faces gain sibling tracking, handoff, verify_package, the cora fallback rule, the strict binary probe).
  3. One todo registration helper for the five call sites.

Second item of the 2026-10-26 architecture review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementharness

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions