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

Function recordTrajectory

src/agent/trajectory.ts:61–78  ·  view source on GitHub ↗
(
  projectRoot: string,
  rec: Omit<TrajectoryRecord, 'ts' | 'project'>,
)

Source from the content-addressed store, hash-verified

59 * swallowed — recording must never break a task that already succeeded.
60 */
61export async function recordTrajectory(
62 projectRoot: string,
63 rec: Omit<TrajectoryRecord, 'ts' | 'project'>,
64): Promise<void> {
65 try {
66 const full = trajectoryPath(projectRoot);
67 await fs.mkdir(path.dirname(full), { recursive: true });
68 const line = JSON.stringify({
69 ts: new Date().toISOString(),
70 project: projectRoot,
71 ...rec,
72 });
73 await fs.appendFile(full, line + '\n', 'utf-8');
74 logger.info('Trajectory recorded', { file: full, files: rec.filesChanged.length });
75 } catch (e: any) {
76 logger.debug('Trajectory record failed (ignored)', { err: e?.message });
77 }
78}
79
80/** Count trajectories recorded for a project (for the /flywheel status command). */
81export async function countTrajectories(projectRoot: string): Promise<number> {

Callers 2

runSandboxedMethod · 0.85

Calls 3

trajectoryPathFunction · 0.85
infoMethod · 0.80
debugMethod · 0.80

Tested by

no test coverage detected