ruvnet/ruflo · error

[ruflo init] Existing CLAUDE.md backed up to ${path.basename

Error message

[ruflo init] Existing CLAUDE.md backed up to ${path.basename(backupPath)} before overwrite

What it means

Data-protection notice in the ruflo init executor: force mode is overwriting an existing CLAUDE.md, so the file is first copied to a .pre-ruflo backup (timestamped if one exists) to preserve curated project context. Informational; the overwrite proceeds.

Source

Thrown at v3/@claude-flow/cli/src/init/executor.ts:2217

  options: InitOptions,
  result: InitResult
): Promise<void> {
  const claudeMdPath = path.join(targetDir, 'CLAUDE.md');

  if (fs.existsSync(claudeMdPath) && !options.force) {
    result.skipped.push('CLAUDE.md');
  } else {
    // #2208: if overwriting an existing CLAUDE.md (force mode), back it up first so
    // users don't silently lose curated project context.
    if (fs.existsSync(claudeMdPath)) {
      const backupBase = `${claudeMdPath}.pre-ruflo`;
      // Don't clobber an existing backup — append a timestamp if one already exists.
      const backupPath = fs.existsSync(backupBase)
        ? `${backupBase}.${Date.now()}`
        : backupBase;
      fs.copyFileSync(claudeMdPath, backupPath);
      result.created.files.push(path.basename(backupPath));
      console.warn(`[ruflo init] Existing CLAUDE.md backed up to ${path.basename(backupPath)} before overwrite`);
    }
    // Determine template: explicit option > infer from components > 'standard'
    const inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;
    const content = generateClaudeMd(options, inferredTemplate);

    fs.writeFileSync(claudeMdPath, content, 'utf-8');
    result.created.files.push('CLAUDE.md');
  }

  // Also write/append global ~/.claude/CLAUDE.md so ruflo tools are used automatically (#1497).
  // Opt-out via --no-global / options.skipGlobalClaudeMd (#1744 — keeps global rules file pristine
  // for users who don't want a per-machine pointer block).
  const homeDir = process.env.HOME || process.env.USERPROFILE || '';
  if (homeDir && !options.skipGlobalClaudeMd) {
    const globalClaudeDir = path.join(homeDir, '.claude');
    const globalClaudeMd = path.join(globalClaudeDir, 'CLAUDE.md');
    const rufloBlock = [
      '',

View on GitHub (pinned to 5234333c34)

Solutions

  1. No action needed; the previous CLAUDE.md was backed up. Restore from the named backup if the overwrite was unwanted.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/init/executor.ts:2186 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@5234333c34 (2026-08-18). Data as JSON: /api/errors/7380d4e6a510c9e8. Report an issue: GitHub.