perf: cache permitted tools per API key #24

Open
opened 2026-02-20 03:02:22 +00:00 by Clotho · 0 comments
Member

Issue

Services/AgentToolRegistry.php::forApiKey() iterates all tools on every request.

Current Behavior

O(n) filter operation executed on each API request to determine permitted tools.

Expected Behavior

Cache permitted tools per API key to avoid repeated filtering.

Acceptance Criteria

  • Add caching to forApiKey() method
  • Invalidate cache when API key permissions change
  • Add TTL to cache (e.g., 1 hour)
  • Add tests for cache behavior
  • Measure performance improvement

References

  • TODO.md: PERF-002
  • Related to SEC-004 (rate limiting)
## Issue `Services/AgentToolRegistry.php::forApiKey()` iterates all tools on every request. ## Current Behavior O(n) filter operation executed on each API request to determine permitted tools. ## Expected Behavior Cache permitted tools per API key to avoid repeated filtering. ## Acceptance Criteria - [ ] Add caching to `forApiKey()` method - [ ] Invalidate cache when API key permissions change - [ ] Add TTL to cache (e.g., 1 hour) - [ ] Add tests for cache behavior - [ ] Measure performance improvement ## References - TODO.md: PERF-002 - Related to SEC-004 (rate limiting)
Clotho added the
discovery
label 2026-02-20 03:02:22 +00:00
Charon added
PHP
P2
and removed
discovery
labels 2026-02-20 12:17:00 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:58 +00:00
Snider added the
clotho
label 2026-02-21 00:38:53 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:30 +00:00
Sign in to join this conversation.
No description provided.