MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / suggestSkillFromSession

Function suggestSkillFromSession

src/skills/learning/skill-suggest.ts:114–128  ·  view source on GitHub ↗
(input: SkillSuggestionInput)

Source from the content-addressed store, hash-verified

112}
113
114export function suggestSkillFromSession(input: SkillSuggestionInput): SkillSuggestion {
115 const area = commonArea(input.changedFiles);
116 const n = input.changedFiles.length;
117 const multiFile = n >= 2 && n <= 12; // focused multi-file = a pattern, not a one-off or a sprawl
118 const focused = input.cohesion >= 0.6; // concentrated in one module / connected cluster
119 const verb = taskVerb(input.prompt);
120 const score = (multiFile ? 0.4 : 0) + (focused ? 0.3 : 0) + (verb ? 0.3 : 0);
121 // A skill is a cross-file pattern: multi-file is a hard gate (a one-file edit is never a skill).
122 const worth = multiFile && score >= 0.6;
123 const symbolsBit = input.touchedSymbols?.length ? ` touching ${input.touchedSymbols.slice(0, 3).join(', ')}` : '';
124 const reason = worth
125 ? `A focused ${verb ?? 'change'} across ${n} file(s) in ${area || 'one area'}${symbolsBit} (cohesion ${input.cohesion.toFixed(2)}) — a repeatable pattern worth capturing as a skill.`
126 : `Not a clear reusable pattern (${n} file(s), cohesion ${input.cohesion.toFixed(2)}${verb ? '' : ', no clear task verb'}).`;
127 return { worth, score, reason, proposedName: proposeSkillName(input.prompt), area };
128}

Callers 3

executeMethod · 0.85
runSandboxedMethod · 0.85

Calls 3

commonAreaFunction · 0.85
taskVerbFunction · 0.85
proposeSkillNameFunction · 0.85

Tested by

no test coverage detected