feat(skills): enhance skills system with matching and evaluation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
27
backend/app/agents/skills/policy.py
Normal file
27
backend/app/agents/skills/policy.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.agents.schemas.skills import SkillInjectionMode, SkillShortlistEntry
|
||||
|
||||
MAX_SUMMARY_CHARS = 120
|
||||
|
||||
|
||||
def choose_injection_mode(score: float, summary_available: bool) -> SkillInjectionMode:
|
||||
if score >= 0.75 and summary_available:
|
||||
return "summary"
|
||||
return "metadata_only"
|
||||
|
||||
|
||||
def render_skill_shortlist_context(entries: list[SkillShortlistEntry]) -> str:
|
||||
if not entries:
|
||||
return ""
|
||||
|
||||
lines = ["[Task-Scoped Skills]"]
|
||||
for entry in entries[:3]:
|
||||
detail = entry.summary or "Relevant to the current request."
|
||||
detail = detail[:MAX_SUMMARY_CHARS]
|
||||
lines.append(f"- {entry.skill_name} | mode={entry.injection_mode} | score={entry.score:.2f}")
|
||||
lines.append(f" {detail}")
|
||||
if entry.matched_terms:
|
||||
lines.append(f" matched_terms={', '.join(entry.matched_terms[:6])}")
|
||||
|
||||
return "\n".join(lines)
|
||||
Reference in New Issue
Block a user