Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

perf(hooks): restore the in-memory fast path for trajectory lookups

ruv5a45b76c80b3
diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
index 1e608ac6f6..58156b91da 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
@@ -545,6 +545,12 @@ async function persistPendingTrajectory(trajectory: TrajectoryData): Promise<boo
}
async function loadPendingTrajectory(id: string): Promise<TrajectoryData | undefined> {
+ // Fast path: a clean (successfully checkpointed) in-process record was written
+ // by this same call chain (trajectory-start/-step) and cannot yet have been
+ // completed elsewhere in the same synchronous request. Trust it without a
+ // round-trip — ADR-130 Phase 3's <200ms-per-call budget depends on this;
+ // only a cache miss (e.g. after an MCP restart) pays for the disk check.
+ if (!dirtyTrajectories.has(id) && activeTrajectories.has(id)) return activeTrajectories.get(id);
try {
const { getEntry } = await import('../memory/memory-initializer.js');
// A completed record is authoritative even if pending-record cleanup failed