MCPcopy Create free account
hub / github.com/Noumena-Network/code / getTeamContextAttachment

Function getTeamContextAttachment

src/utils/attachments.ts:3782–3812  ·  view source on GitHub ↗

* Get team context attachment for teammates in a swarm. * Only injected on the first turn to provide team coordination instructions.

(messages: Message[])

Source from the content-addressed store, hash-verified

3780 * Only injected on the first turn to provide team coordination instructions.
3781 */
3782function getTeamContextAttachment(messages: Message[]): Attachment[] {
3783 const teamName = getTeamName()
3784 const agentId = getAgentId()
3785 const agentName = getAgentName()
3786
3787 // Only inject for teammates (not team lead or non-team sessions)
3788 if (!teamName || !agentId) {
3789 return []
3790 }
3791
3792 // Only inject on first turn - check if there are no assistant messages yet
3793 const hasAssistantMessage = messages.some(m => m.type === 'assistant')
3794 if (hasAssistantMessage) {
3795 return []
3796 }
3797
3798 const configDir = getClaudeConfigHomeDir()
3799 const teamConfigPath = `${configDir}/teams/${teamName}/config.json`
3800 const taskListPath = `${configDir}/tasks/${teamName}/`
3801
3802 return [
3803 {
3804 type: 'team_context',
3805 agentId,
3806 agentName: agentName || agentId,
3807 teamName,
3808 teamConfigPath,
3809 taskListPath,
3810 },
3811 ]
3812}
3813
3814function getTokenUsageAttachment(
3815 messages: Message[],

Callers 1

getAttachmentsFunction · 0.85

Calls 3

getTeamNameFunction · 0.85
getAgentIdFunction · 0.85
getAgentNameFunction · 0.85

Tested by

no test coverage detected