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

Function recordEpisode

src/context/episodic-memory.ts:46–55  ·  view source on GitHub ↗
(projectRoot: string, rec: Omit<Episode, 'ts'>)

Source from the content-addressed store, hash-verified

44
45/** Append one episode after an objectively-successful task. Best-effort. */
46export async function recordEpisode(projectRoot: string, rec: Omit<Episode, 'ts'>): Promise<void> {
47 try {
48 if (!rec.prompt.trim()) return;
49 const full = episodesPath(projectRoot);
50 await fs.mkdir(path.dirname(full), { recursive: true });
51 await fs.appendFile(full, JSON.stringify({ ts: new Date().toISOString(), ...rec }) + '\n', 'utf-8');
52 } catch (e: any) {
53 logger.debug('Episode not recorded', { err: e?.message });
54 }
55}
56
57/** Read this project's episodes (most recent `limit`). */
58export async function readEpisodes(projectRoot: string, limit = 500): Promise<Episode[]> {

Callers 1

runSandboxedMethod · 0.85

Calls 2

episodesPathFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected