MCPcopy Create free account
hub / github.com/codeaashu/claude-code / formatRecentMessages

Function formatRecentMessages

src/utils/hooks/skillImprovement.ts:39–56  ·  view source on GitHub ↗
(messages: Message[])

Source from the content-addressed store, hash-verified

37}
38
39function formatRecentMessages(messages: Message[]): string {
40 return messages
41 .filter(m => m.type === 'user' || m.type === 'assistant')
42 .map(m => {
43 const role = m.type === 'user' ? 'User' : 'Assistant'
44 const content = m.message.content
45 if (typeof content === 'string')
46 return `${role}: ${content.slice(0, 500)}`
47 const text = content
48 .filter(
49 (b): b is Extract<typeof b, { type: 'text' }> => b.type === 'text',
50 )
51 .map(b => b.text)
52 .join('\n')
53 return `${role}: ${text.slice(0, 500)}`
54 })
55 .join('\n\n')
56}
57
58function findProjectSkill() {
59 const skills = getInvokedSkillsForAgent(null)

Callers 1

buildMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected