feat(coding-agents): add configurable tool allowlist - #3474
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a configurable toolAllowlist to the coding-agents integration so the exposed hindsight_* tool surface (MCP + native plugin adapters) and injected tool guidance can be reduced (including a recall-only mode), and introduces a bounded hindsight_recall tool backed by a new HindsightClient.recall() helper.
Changes:
- Introduce
toolAllowlistconfig resolution (default: full nine-tool surface) and apply it to MCP + native plugin tool registration. - Add
HindsightClient.recall()and thehindsight_recall(query, max_tokens?)tool with an enforced 1–2048 token bound. - Update hook/session-start context injection to omit guidance (and skip page discovery) for tools that are not exposed.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/hindsight-docs/references/sdks/integrations/coding-agents.md | Mirror docs: document toolAllowlist in the integration reference table. |
| hindsight-integrations/coding-agents/src/mcp-server.ts | Pass toolAllowlist into tool-spec construction for MCP exposure. |
| hindsight-integrations/coding-agents/src/mcp-server.test.ts | Update MCP surface expectations to nine tools and add allowlist filtering test. |
| hindsight-integrations/coding-agents/src/core/session-start.ts | Skip knowledge-page discovery when page tools are not enabled; pass allowlist into guidance injection. |
| hindsight-integrations/coding-agents/src/core/session-start.test.ts | Add recall-only-mode assertions (no page discovery; only recall guidance). |
| hindsight-integrations/coding-agents/src/core/runtime.ts | Apply toolAllowlist to native plugin adapter tool specs. |
| hindsight-integrations/coding-agents/src/core/runtime.test.ts | Add test that native plugin adapters respect toolAllowlist. |
| hindsight-integrations/coding-agents/src/core/knowledge-tools.ts | Add hindsight_recall tool and filter returned tool specs by allowlist. |
| hindsight-integrations/coding-agents/src/core/knowledge-tools.test.ts | Expand expected tool set, add allowlist filter test, and validate hindsight_recall behavior and error path. |
| hindsight-integrations/coding-agents/src/core/knowledge-injection.ts | Split guidance by tool, omit guidance/roster/correction text when tools are not exposed, and support allowlist-based injection. |
| hindsight-integrations/coding-agents/src/core/knowledge-injection.test.ts | Add tests for recall-only, empty allowlist, and partial allowlists. |
| hindsight-integrations/coding-agents/src/core/hook.ts | Gate page-roster refresh fetches by whether page tools are enabled; pass allowlist into roster refresh injection. |
| hindsight-integrations/coding-agents/src/core/hook.test.ts | Add recall-only-mode assertion that no reflect/page calls occur (when autoReflect is disabled). |
| hindsight-integrations/coding-agents/src/core/hindsight.ts | Add HindsightClient.recall() with a bounded maxTokens and portable request shape. |
| hindsight-integrations/coding-agents/src/core/hindsight.test.ts | Add coverage for recall() request shape, defaulting, and range validation. |
| hindsight-integrations/coding-agents/src/core/config.ts | Define allowed tool suffixes and resolve toolAllowlist (default all; invalid input fails closed). |
| hindsight-integrations/coding-agents/src/core/config.test.ts | Add tests for default allowlist, dedupe, unknown-name dropping, and fail-closed cases. |
| hindsight-integrations/coding-agents/README.md | Document toolAllowlist in the integration README table. |
| hindsight-docs/docs-integrations/coding-agents.md | Mirror docs: document toolAllowlist in the published integration docs table. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
145b0cc to
324579b
Compare
|
Closing after real-use validation showed that this mixed a useful recall concept with deployment-specific client policy. Tool authorization and output ceilings belong at the server or credential boundary; our uinaf relay already enforces both. We are removing the allowlist and hard-coded 2,048-token ceiling from the fork rather than asking upstream to adopt them. |
Withdrawn
This combined a generic recall tool with deployment-specific client policy: tool filtering and a hard-coded 2,048-token ceiling. Real-use validation showed those boundaries belong to the server or credential layer, so the change was reverted from the fork and the PR was closed.
A generic recall tool can be reconsidered separately without an allowlist or private gateway limits.