MCPcopy
hub / github.com/codeaashu/claude-code / getClaudeMds

Function getClaudeMds

src/utils/claudemd.ts:1153–1195  ·  view source on GitHub ↗
(
  memoryFiles: MemoryFileInfo[],
  filter?: (type: MemoryType) => boolean,
)

Source from the content-addressed store, hash-verified

1151}
1152
1153export const getClaudeMds = (
1154 memoryFiles: MemoryFileInfo[],
1155 filter?: (type: MemoryType) => boolean,
1156): string => {
1157 const memories: string[] = []
1158 const skipProjectLevel = getFeatureValue_CACHED_MAY_BE_STALE(
1159 'tengu_paper_halyard',
1160 false,
1161 )
1162
1163 for (const file of memoryFiles) {
1164 if (filter && !filter(file.type)) continue
1165 if (skipProjectLevel && (file.type === 'Project' || file.type === 'Local'))
1166 continue
1167 if (file.content) {
1168 const description =
1169 file.type === 'Project'
1170 ? ' (project instructions, checked into the codebase)'
1171 : file.type === 'Local'
1172 ? " (user's private project instructions, not checked in)"
1173 : feature('TEAMMEM') && file.type === 'TeamMem'
1174 ? ' (shared team memory, synced across the organization)'
1175 : file.type === 'AutoMem'
1176 ? " (user's auto-memory, persists across conversations)"
1177 : " (user's private global instructions for all projects)"
1178
1179 const content = file.content.trim()
1180 if (feature('TEAMMEM') && file.type === 'TeamMem') {
1181 memories.push(
1182 `Contents of ${file.path}${description}:\n\n<team-memory-content source="shared">\n${content}\n</team-memory-content>`,
1183 )
1184 } else {
1185 memories.push(`Contents of ${file.path}${description}:\n\n${content}`)
1186 }
1187 }
1188 }
1189
1190 if (memories.length === 0) {
1191 return ''
1192 }
1193
1194 return `${MEMORY_INSTRUCTION_PROMPT}\n\n${memories.join('\n\n')}`
1195}
1196
1197/**
1198 * Gets managed and user conditional rules that match the target path.

Callers 1

context.tsFile · 0.85

Calls 3

featureFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected