Add custom tool override capability for domain-specific operations#33
Draft
Add custom tool override capability for domain-specific operations#33
Conversation
Co-authored-by: colindembovsky <1932561+colindembovsky@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance SDK with custom tool override capability
Add custom tool override capability for domain-specific operations
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leverages the Copilot SDK's
SessionHooksAPI (onPreToolUse/onPostToolUse) to enforce workspace safety, reduce redundant I/O, and expose per-task tool usage stats during execution.New:
src/services/tool-overrides.tsToolOverrideConfig— loaded from / saved to.planeteer/config.json; masterenabledswitch plus per-tool togglescreateSessionHooks(config, onToolUse?)— buildsSessionHookswith:edit_file/str_replace_editor: denies writes to paths outsideprocess.cwd()read_file: serves in-memory cache on repeated reads (denies the tool call, injects cached content into the denial reason); warns agent when file exceeds configurable size limit (default 100 KB)grep: injects deduplicatedexclude_dirs(node_modules,.git,dist, etc.) into modified args and provides--exclude-dirhint as additional contextToolUsageStats(reads,edits,greps) +createEmptyStats()src/services/copilot.tsToolOverrideConfigand attaches hooks on everycreateSession()callonToolUse?: (toolName: string) => voidtoStreamCallbacksandsendPromptSyncoptionssrc/services/executor.tsonToolUse?: (taskId, toolName) => voidadded toExecutionCallbacks, threaded through init and regular task executionsrc/screens/execute.tsxRecord<string, ToolUsageStats>per task; renders inline 📖/✏️/🔍 counters next to each task rowConfiguration example (
.planeteer/config.json){ "enabled": true, "editFile": { "enabled": true }, "readFile": { "enabled": true, "maxSizeKb": 100 }, "grep": { "enabled": true, "excludePatterns": ["node_modules", ".git", "dist", ".planeteer"] } }Tests
14 new tests in
src/services/copilot.test.tscovering path validation (allow/deny/disabled), grep deduplication, cache serving,onToolUsecallback, and config loading.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.