Skip to content

Verify middleware boundary enforcement in agent tools #72

@alexey-pelykh

Description

@alexey-pelykh

Summary

Verify that after gutting pi-embedded agent tools (#66), Docker sandbox (#68), and bash/exec tools (#70), the middleware boundary is correctly enforced in src/agents/tools/. This is a verification + cleanup task — confirm no stray references, no stray files, and pnpm build passes.

Verification Criteria

1. Zero references to deleted tool files in KEEP/MODIFY code

Search surviving code for imports from deleted tool modules. These should all return empty:

# Web tools (deleted in #66)
grep -r "from.*web-fetch\|from.*web-search\|from.*web-shared\|from.*web-tools" src/ --include="*.ts" \
  | grep -v node_modules | grep -v pi-embedded-runner

# Browser/image/TTS tools (deleted in #66)
grep -r "from.*browser-tool\|from.*image-tool\|from.*tts-tool" src/ --include="*.ts" \
  | grep -v node_modules | grep -v pi-embedded-runner

# Sandbox (deleted in #68)
grep -r "from.*sandbox" src/ --include="*.ts" \
  | grep -v node_modules | grep -v pi-embedded-runner

# Bash/exec tools (deleted in #70)
grep -r "from.*bash-tools\|from.*exec-approvals\|from.*exec-safe-bin\|from.*exec-host\|from.*pty-dsr\|from.*pty-keys" src/ --include="*.ts" \
  | grep -v node_modules | grep -v pi-embedded-runner

Note: pi-embedded-runner/ is excluded because those files will be deleted in a separate task.

2. Only RemoteClaw-specific tools remain in src/agents/tools/

Expected ~29 KEEP tools organized as:

  • Session tools (~11): sessions-spawn, sessions-send, sessions-list, sessions-history, sessions-access, sessions-resolution, sessions-announce, sessions-helpers, session-status
  • Channel action tools (~10): discord-actions (guild, messaging, moderation, presence), slack-actions, telegram-actions, whatsapp-actions
  • Gateway + scheduling (~4): gateway-tool, gateway, cron-tool, agents-list
  • Core messaging (~2): message-tool, subagents-tool
  • Infrastructure (~1): common

Plus ~3 DEFER tools (no consumer in v0.1.0, kept for future):

  • nodes-tool.ts, nodes-utils.ts, canvas-tool.ts

3. No stray tool files outside KEEP list

Check for any tool files that should have been deleted in previous gutting tasks but were missed:

# List all .ts files in src/agents/tools/ and verify each is expected
ls src/agents/tools/*.ts | grep -v test | sort

Known edge case: agent-step.ts — provides nested agent execution via gateway RPC (chat.history, agent.wait). Despite being classified as GUT in the fork disposition, it has NO pi-embedded coupling and is consumed by KEEP code:

  • sessions-send-tool.a2a.ts — uses runAgentStep() and readLatestAssistantReply()
  • subagent-announce.ts — uses readLatestAssistantReply()
  • subagent-followup.ts — uses readLatestAssistantReply()

Decision needed: Reclassify agent-step.ts to KEEP (it's pure gateway infrastructure, not pi-embedded-dependent) or create pre-work to refactor its callers before deletion.

4. Memory tool classification

memory-tool.ts is present as DEFER (memory search for sessions). Confirm it has no pi-embedded coupling and is safe to keep as DEFER.

5. Build passes

pnpm build

Must complete with zero errors and no TypeScript compilation failures.

Scope

This is primarily a verification task — no files should need to be deleted unless strays are found. Expected actions:

  • Run grep searches and confirm clean results
  • Audit tool file listing against KEEP list
  • Resolve agent-step.ts classification edge case
  • Confirm pnpm build passes
  • Document any findings

If stray imports or files are found, clean them up as part of this task.

Why

This is a gate between the individual gutting tasks (skills, tools, sandbox, bash/exec) and the final pi-embedded engine deletion. Verifying the boundary now catches any strays before the much larger engine deletion task depends on a clean starting state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions