Fixes#104849
Converted `get_skill_commands()` from a single-slot cache (keyed by
`(platform, home)` tuple checked at call time) to a multi-slot dict
`_skill_commands_by_key = {(platform, home): {commands}}` that memoizes
each distinct identity once and serves it forever. The old single-slot
design thrashed in the Desktop `hermes serve` backend because the
platform/home identity flapped between requests (`HERMES_SESSION_PLATFORM`
set to `""` vs. resolved to `None`, profile home overrides) so every
`commands.catalog` poll (~3x/5s) re-scanned the entire skills dir.
Also normalized empty-string to `None` in `_resolve_skill_commands_platform()`
so both spellings share one cache slot (#104849 root cause), and replaced
direct `scan_skill_commands()` calls in `tui_gateway/methods_tools.py`
(two sites: `_catalog_skills`, `_dispatch_skill`) with `get_skill_commands()`
so they benefit from the cache instead of bypassing it.
- `tests/agent/test_skill_commands.py`: 30 tests green (updated monkeypatch
fixtures from `_skill_commands*` globals to `_skill_commands_by_key`).
- New regression test `test_skill_cache_thrash_104849.py`: verifies that
platform flapping (`""` ⇄ `None`) hits the same cache slot (scan once),
and that distinct `(platform, home)` identities each get their own slot
(preserves #14536 / #88023 isolation fixes).
- `test_skill_commands_reload.py`, `test_skill_invocation_description.py`,
`test_prompt_cache_boundary.py`: green.
- `ruff check` on all modified files: clean.
Tested locally: after this patch the collision warning (skill `plan` vs.
core `/plan`) that repeated ~3x/5s while the Desktop window was focused
stopped entirely (zero scans mid-session), matching the issue reporter's
verification.