MCPcopy Index your code
hub / github.com/MatterAIOrg/OrbCode / loadMemoryFiles

Function loadMemoryFiles

src/memory/loader.ts:126–147  ·  view source on GitHub ↗
(cwd = process.cwd())

Source from the content-addressed store, hash-verified

124 * (and thus get more weight from the model).
125 */
126export function loadMemoryFiles(cwd = process.cwd()): MemoryFile[] {
127 const processed = new Set<string>()
128 const files: MemoryFile[] = []
129
130 // 1. User memory (~/.orbcode/AGENTS.md)
131 files.push(...loadWithIncludes(path.join(getConfigDir(), "AGENTS.md"), "user", processed, 0))
132
133 // 2. Project memory (AGENTS.md + .orb/AGENTS.md), root -> cwd. The legacy
134 // .orbcode/AGENTS.md location is still read for backward compatibility.
135 for (const dir of ancestorDirs(cwd).reverse()) {
136 files.push(...loadWithIncludes(path.join(dir, "AGENTS.md"), "project", processed, 0))
137 files.push(...loadWithIncludes(path.join(dir, ".orb", "AGENTS.md"), "project", processed, 0))
138 files.push(...loadWithIncludes(path.join(dir, ".orbcode", "AGENTS.md"), "project", processed, 0))
139 }
140
141 // 3. Local memory (AGENTS.local.md), root -> cwd — highest precedence
142 for (const dir of ancestorDirs(cwd).reverse()) {
143 files.push(...loadWithIncludes(path.join(dir, "AGENTS.local.md"), "local", processed, 0))
144 }
145
146 return files
147}
148
149/** Render the memory files into a single system-prompt section. */
150export function renderMemorySection(files: MemoryFile[]): string {

Callers 1

constructorMethod · 0.85

Calls 3

loadWithIncludesFunction · 0.85
getConfigDirFunction · 0.85
ancestorDirsFunction · 0.70

Tested by

no test coverage detected