Implementation:AMAP ML SkillClaw aggregate sessions by skill
| Knowledge Sources | |
|---|---|
| Domains | Data_Aggregation, Skill_Evolution |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for grouping session recordings by the skills they reference, provided by the SkillClaw evolve server package.
Description
The aggregate_sessions_by_skill function takes a list of summarized sessions and groups them by the skills each session references. If a session references multiple skills, it appears in each skill's group. Sessions referencing no skill go into a `NO_SKILL_KEY` group, which is used for creating entirely new skills. This is a pure function with no side effects, using only `collections.defaultdict`.
Usage
Import and use when you need to:
- Group session evidence by skill for targeted evolution
- Identify sessions that could lead to new skill creation
- Prepare inputs for the evolve_skill_from_sessions pipeline
Code Reference
Source Location
- Repository: SkillClaw
- File: `evolve_server/pipeline/aggregation.py:L16-46`
Signature
def aggregate_sessions_by_skill(
sessions: list[dict],
) -> dict[str, list[dict]]:
"""Group sessions by skill.
Each session must have _skills_referenced (a set of skill names)
attached by the summarization stage.
- If a session references skill X, it goes into skill X's group.
- If a session references both A and B, it appears in both groups.
- If no skill is referenced, it goes into NO_SKILL_KEY.
"""
Import
from evolve_server.pipeline.aggregation import aggregate_sessions_by_skill
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| sessions | list[dict] | Yes | Summarized sessions with _skills_referenced sets |
Outputs
| Name | Type | Description |
|---|---|---|
| Returns | dict[str, list[dict]] | skill_name -> list of sessions; NO_SKILL_KEY for unreferenced |
Usage Examples
Aggregate Sessions
from evolve_server.pipeline.aggregation import aggregate_sessions_by_skill
# Sessions must be summarized (have _skills_referenced)
groups = aggregate_sessions_by_skill(sessions)
for skill_name, skill_sessions in groups.items():
if skill_name == "__no_skill__":
print(f"No-skill group: {len(skill_sessions)} sessions")
# These sessions could lead to new skill creation
else:
print(f"Skill '{skill_name}': {len(skill_sessions)} sessions")
# These sessions will be used to evolve the existing skill