Teknium
5127567d5d
perf(ttft): cache skills prompt with shared skill_utils module (salvage #3366) (#3421)
Two-layer caching for build_skills_system_prompt():
1. In-process LRU (OrderedDict, max 8) — same-process: 546ms → <1ms
2. Disk snapshot (.skills_prompt_snapshot.json) — cold start: 297ms → 103ms
Key improvements over original PR #3366:
- Extract shared logic into agent/skill_utils.py (parse_frontmatter,
skill_matches_platform, get_disabled_skill_names, extract_skill_conditions,
extract_skill_description, iter_skill_index_files)
- tools/skills_tool.py delegates to shared module — zero code duplication
- Proper LRU eviction via OrderedDict.move_to_end + popitem(last=False)
- Cache invalidation on all skill mutation paths:
- skill_manage tool (in-conversation writes)
- hermes skills install (CLI hub)
- hermes skills uninstall (CLI hub)
- Automatic via mtime/size manifest on cold start
prompt_builder.py no longer imports tools.skills_tool (avoids pulling
in the entire tool registry chain at prompt build time).
6301 tests pass, 0 failures.
Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
2026-03-27 10:54:02 -07:00
..
2026-03-21 15:54:10 -07:00
2026-03-27 10:54:02 -07:00
2026-03-27 08:02:58 -07:00
2026-03-27 06:07:28 -07:00
2026-03-26 16:29:38 -07:00
2026-03-21 09:34:00 -07:00
2026-03-24 07:30:25 -07:00
2026-03-24 19:44:02 -07:00
2026-03-27 10:54:02 -07:00
2026-03-17 02:02:33 -07:00
2026-03-17 02:53:33 -07:00
2026-03-17 01:50:59 -07:00
2026-03-17 04:24:27 -07:00
2026-03-26 19:24:03 -07:00
2026-03-26 19:21:34 -07:00
2026-03-19 17:47:05 -07:00
2026-03-27 09:45:25 -07:00
2026-03-17 04:46:15 -07:00
2026-03-25 15:00:33 -07:00
2026-03-21 09:42:07 -07:00
2026-03-26 17:58:40 -07:00
2026-03-17 02:53:33 -07:00
2026-03-15 19:03:34 -07:00
2026-03-20 04:35:17 -07:00
2026-03-17 02:05:26 -07:00
2026-03-23 06:20:19 -07:00
2026-03-20 06:04:33 -07:00
2026-03-26 17:33:11 -07:00
2026-03-17 02:05:26 -07:00
2026-03-18 15:22:51 -07:00
2026-03-26 18:10:50 -07:00
2026-03-23 16:02:06 -07:00
2026-03-24 12:50:24 -07:00
2026-03-23 06:40:05 -07:00
2026-03-22 05:58:26 -07:00
2026-03-25 17:31:56 -07:00
2026-03-15 21:59:53 -07:00
2026-03-26 14:34:31 -07:00
2026-03-18 02:42:58 -07:00
2026-03-26 14:35:31 -07:00
2026-03-17 03:44:44 -07:00
2026-03-17 02:53:33 -07:00
2026-03-17 02:53:33 -07:00
2026-03-24 08:19:23 -07:00
2026-03-19 21:24:53 +01:00
2026-03-17 23:40:22 -07:00
2026-03-20 15:41:06 -04:00
2026-03-16 06:35:46 -07:00
2026-03-21 09:47:33 -07:00
2026-03-22 05:58:26 -07:00
2026-03-26 13:49:43 -07:00
2026-03-17 02:53:33 -07:00
2026-03-17 02:53:33 -07:00
2026-03-27 09:57:50 -07:00
2026-03-19 10:34:44 -07:00
2026-03-27 07:49:44 -07:00
2026-03-24 06:41:11 -07:00
2026-03-25 18:22:21 -07:00
2026-03-19 15:16:35 +01:00
2026-03-25 12:46:04 -07:00
2026-03-16 23:48:14 -07:00
2026-03-21 09:41:17 -07:00