mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-03 22:12:01 +09:00
Under an agent the Bash tool cwd is sticky, and MCP servers and hooks inherit it, so process.cwd() is often a subdirectory of the project. Memory, autopilot, neural and metrics state keyed to it was written under the subdirectory and never read again: loadState() returned defaults and the learning state silently started over. - Extract the #2877 daemon marker walk (nearest Ruflo marker, `.git` hard stop, start dir when nothing matches, read-only) into cli/src/services/project-root.ts; resolveDaemonProjectRoot and isRufloProject delegate to it unchanged. - getProjectRoot()/anchorToProjectRoot() add the home/filesystem-root guard cli-core already applies, so a ~/.claude/settings.json claudeFlow key never makes $HOME the project. - getMemoryRoot(), `memory backup` and `memory distill` resolve memory against the project root. - autopilot-state resolves its state, log, swarm-tasks and checklist paths against the project root per call (exported constants stay relative). - neural checkpoints/patterns, `.claude-flow/memory` patterns, LoRA weights, EWC fisher and swarm-activity metrics use the project root. - cli-core: export isRufloProject/resolveProjectRoot from mcp-tools/types; getProjectCwd() keeps CLAUDE_FLOW_CWD precedence, else walks up from process.cwd(), falling back to process.cwd() when no marker is found or the walk lands on home / a filesystem root. Bump cli-core to 3.7.7. The CLI pins cli-core 3.7.6, which lacks these exports, so the CLI carries a copy of the walk; a parity test pins both copies together. Fixes #2633 Co-Authored-By: RuFlo <ruv@ruv.net>