Skip to content

[enhancement] Add custom tool override capability for domain-specific operations #30

@github-actions

Description

@github-actions

Background

The Copilot SDK v0.1.30 (released March 3, 2026) adds support for overriding built-in tools like grep, edit_file, or read_file, implemented by Steve Sanderson in commit f843c80.

This feature allows applications to customize how Copilot agents interact with files and code, enabling domain-specific optimizations and constraints.

Proposal

Leverage tool overriding to implement Planeteer-specific file operation constraints and workspace scoping:

  1. Override edit_file tool to:

    • Enforce that agents only edit files within the current working directory
    • Prevent accidental modification of system files or directories outside the project
    • Add pre/post-edit validation hooks (e.g., syntax checking, formatting)
    • Log all file modifications for audit trail in the Execute screen
  2. Override read_file tool to:

    • Implement intelligent file size limits (warn/truncate for files >100KB)
    • Cache frequently-read files to reduce redundant operations
    • Track which files each task has accessed for dependency inference
  3. Override grep tool to:

    • Scope searches to project-relevant directories (exclude node_modules, .git, etc.)
    • Add search result caching for repeated queries
    • Provide more context lines by default for better agent understanding
  4. Configuration in Settings - Add .planeteer/config.json to allow users to enable/disable overrides or customize behavior

Benefit

  • Safety: Prevent agents from accidentally modifying files outside the project workspace
  • Performance: Caching and scoping reduce redundant operations and improve execution speed
  • Observability: Better logging and tracking of tool usage during execution
  • Customization: Users can tailor tool behavior to their project requirements

Acceptance Criteria

  • src/services/copilot.ts registers custom tool overrides with overridesBuiltInTool: true flag
  • edit_file override validates paths are within process.cwd() before executing
  • read_file override implements size limits and caching logic
  • grep override excludes common ignore patterns (node_modules, .git, etc.)
  • Settings file .planeteer/config.json allows enabling/disabling overrides
  • Execute screen displays tool usage statistics (reads, edits, greps per task)
  • Tests in src/services/copilot.test.ts verify override behavior
  • Documentation in README explains tool overrides and configuration options

AI generated by Weekly Enhancement Suggestions

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions