Skip to content

Bug: trajectory-end does not update stats counters #186

@sparkling

Description

@sparkling

Summary

The hooks trajectory-end command pushes completed trajectories to data.trajectories[] but never increments data.stats.total_trajectories. The hooks stats command reads the stale counter and reports 0 trajectories even when the array has entries.

Root Cause

In bin/cli.js, the trajectory-end action (line ~4124) does:

intel.data.trajectories.push(traj);
delete trajectories[latestTrajId];
intel.save();

But never syncs: intel.data.stats.total_trajectories = intel.data.trajectories.length

Compare with learn() (line ~2910) which correctly does:

this.data.stats.total_trajectories = this.data.trajectories.length;

Fix

Defect RV-003 in claude-flow-patch.

Add intel.data.stats.total_trajectories = intel.data.trajectories.length; before intel.save() in the trajectory-end handler. Also sync total_patterns and total_memories for consistency.

Files Affected

  • bin/cli.js (ruvector package)

Affected Versions

ruvector bundled with @claude-flow/cli 3.1.0-alpha.41 through current

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions