Skip to content

[Feature Reques] AI Suggestions should check app_spec.txt to avoid duplicates #154

@cabana8471-arch

Description

@cabana8471-arch

Feature Request: AI Suggestions should check app_spec.txt to avoid duplicates

Problem

The "AI Suggestions" feature in Kanban Board analyzes the project codebase to generate suggestions, but it does NOT check app_spec.txt to see what features are already documented/implemented.

This means:

  • AI might suggest features that are already in <implemented_features> section
  • AI might suggest features that are already in the Kanban backlog
  • Users waste time reviewing duplicate suggestions

Current Behavior

1. User clicks "Feature Suggestions" (lightbulb icon)
2. Selects "Features" card
3. AI analyzes codebase with Read/Glob/Grep tools
4. AI generates 3-5 suggestions based on code patterns
5. ❌ AI does NOT read app_spec.txt
6. ❌ AI does NOT check existing features in .automaker/features/
7. Suggestions may duplicate already planned/implemented features

Code evidence:

The prompt in generate-suggestions.ts says:

const prompt = `${typePrompts[suggestionType]}

Look at the codebase and provide 3-5 concrete suggestions.
// ... no mention of checking app_spec.txt or existing features
`;

Expected Behavior

Before generating suggestions, AI should:

  1. Read app_spec.txt to understand what's already documented
  2. Check .automaker/features/ directory for existing features
  3. Filter out or deprioritize suggestions that overlap with existing items
  4. Optionally note: "Similar to existing feature: X"

Suggested Implementation

Option A: Add context to prompt (Low effort)

Modify the prompt to include existing features context:

// In generate-suggestions.ts

async function generateSuggestions(projectPath: string, suggestionType: string) {
  // Load existing context
  const appSpecPath = path.join(projectPath, '.automaker', 'app_spec.txt');
  const featuresDir = path.join(projectPath, '.automaker', 'features');

  let existingContext = '';

  // Read app_spec.txt if exists
  if (await fs.pathExists(appSpecPath)) {
    const spec = await fs.readFile(appSpecPath, 'utf-8');
    // Extract implemented_features section
    const implementedMatch = spec.match(/<implemented_features>([\s\S]*?)<\/implemented_features>/);
    if (implementedMatch) {
      existingContext += `\n\nALREADY IMPLEMENTED (from app_spec.txt):\n${implementedMatch[1]}`;
    }
  }

  // Read existing feature titles
  if (await fs.pathExists(featuresDir)) {
    const features = await loadAllFeatures(featuresDir);
    const featureTitles = features.map(f => `- ${f.title} (${f.status})`).join('\n');
    existingContext += `\n\nEXISTING FEATURES IN BACKLOG:\n${featureTitles}`;
  }

  const prompt = `${typePrompts[suggestionType]}

${existingContext}

IMPORTANT: Do NOT suggest features that are already implemented or in the backlog above.
Look at the codebase and provide 3-5 NEW concrete suggestions that don't overlap with existing features.
// ... rest of prompt
`;
}

Option B: Post-filter suggestions (Medium effort)

After AI generates suggestions, filter out duplicates:

function filterDuplicateSuggestions(
  suggestions: Suggestion[],
  existingFeatures: Feature[],
  implementedFeatures: string[]
): Suggestion[] {
  return suggestions.filter(suggestion => {
    const titleLower = suggestion.description.toLowerCase();

    // Check against existing backlog
    const isDuplicateBacklog = existingFeatures.some(f =>
      similarity(f.title.toLowerCase(), titleLower) > 0.7
    );

    // Check against implemented features
    const isDuplicateImplemented = implementedFeatures.some(f =>
      similarity(f.toLowerCase(), titleLower) > 0.7
    );

    return !isDuplicateBacklog && !isDuplicateImplemented;
  });
}

Option C: Add deduplication UI (Low effort, quick win)

Show warning badge on suggestions that might be duplicates:

{suggestion.possibleDuplicate && (
  <Badge variant="warning">
    Similar to: {suggestion.possibleDuplicate}
  </Badge>
)}

Files to Modify

File Changes
apps/server/src/routes/suggestions/generate-suggestions.ts Add context loading and prompt modification
apps/server/src/services/feature-loader.ts Add method to get all feature titles
apps/app/src/components/views/board-view/dialogs/feature-suggestions-dialog.tsx Add duplicate warning UI (optional)

Code References

Current suggestion generation (no spec check):

  • apps/server/src/routes/suggestions/generate-suggestions.ts:18-51

App spec path:

  • apps/server/src/lib/automaker-paths.ts

Feature loader:

  • apps/server/src/services/feature-loader.ts

Acceptance Criteria

  • AI reads app_spec.txt before generating "Features" suggestions
  • AI reads existing features from .automaker/features/ directory
  • Suggestions don't duplicate already implemented features
  • Suggestions don't duplicate features already in backlog
  • (Optional) Similar suggestions show warning indicator
  • Backward compatible - works if app_spec.txt doesn't exist

Impact

  • User Experience: Less time wasted reviewing duplicate suggestions
  • Quality: More valuable, unique suggestions
  • Trust: Users trust AI more when it shows awareness of project state

Labels

enhancement, ai, suggestions, deduplication

Metadata

Metadata

Assignees

Labels

EnhancementImprovements to existing functionality or UI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions