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

Function readFailures

src/skills/learning/failures.ts:131–140  ·  view source on GitHub ↗
(limit = 2000)

Source from the content-addressed store, hash-verified

129
130/** Read the failure log (most recent `limit` events, to bound memory). */
131export async function readFailures(limit = 2000): Promise<FailureEvent[]> {
132 try {
133 const raw = await fs.readFile(failuresPath(), 'utf-8');
134 const lines = raw.split('\n').filter(l => l.trim());
135 const slice = lines.slice(-limit);
136 return slice.map(l => { try { return JSON.parse(l) as FailureEvent; } catch { return null; } }).filter(Boolean) as FailureEvent[];
137 } catch {
138 return [];
139 }
140}
141
142/** Convenience: read → detect → build the injectable block. Used by the agent loop. */
143export async function loadLessonsBlock(opts: DetectOpts & { topK?: number } = { ...DEFAULT_DETECT }): Promise<string> {

Callers 2

buildSkillCommandFunction · 0.85
loadLessonsBlockFunction · 0.85

Calls 1

failuresPathFunction · 0.85

Tested by

no test coverage detected