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

Checkpoint: File edits

rUv27c7c5d6f264
diff --git a/v3/@claude-flow/cli/src/commands/start.ts b/v3/@claude-flow/cli/src/commands/start.ts
index 323e644092..10955ba452 100644
--- a/v3/@claude-flow/cli/src/commands/start.ts
+++ b/v3/@claude-flow/cli/src/commands/start.ts
@@ -216,9 +216,30 @@ const startAction = async (ctx: CommandContext): Promise<CommandResult> => {
output.printInfo('Running in daemon mode. Use "claude-flow stop" to stop.');
// Store PID for daemon management
- // TODO: Implement proper process forking with detached: true
const daemonPidPath = path.join(cwd, '.claude-flow', 'daemon.pid');
fs.writeFileSync(daemonPidPath, String(process.pid));
+
+ // Detach from parent process for true daemon behavior
+ if (process.platform !== 'win32') {
+ // Unix-like systems: create new session
+ try {
+ process.stdin.unref?.();
+ process.stdout.unref?.();
+ process.stderr.unref?.();
+ } catch {
+ // Ignore errors if streams can't be unref'd
+ }
+ }
+
+ // Keep process alive in daemon mode
+ const keepAlive = setInterval(() => {
+ // Heartbeat - check if we should still be running
+ if (!fs.existsSync(daemonPidPath)) {
+ clearInterval(keepAlive);
+ process.exit(0);
+ }
+ }, 5000);
+ keepAlive.unref(); // Don't prevent process from exiting if no other work
}
const result = {