Skip to content

bug: local mode CriticalFiles always shows "1 relationships" — misleading output #299

@claude

Description

@claude

Problem

In local mode, computeTopFiles in internal/local/local.go produces a CriticalFiles list where every entry has RelationshipCount = 1. This is because the function counts how many domains each file appears in, but files are grouped by top-level directory — so each file appears in exactly one domain.

// internal/local/local.go:275-295
func computeTopFiles(domains []api.Domain, n int) []api.CriticalFile {
    counts := make(map[string]int)
    for _, d := range domains {
        for _, f := range d.KeyFiles {
            counts[f]++  // always 1 — each file is in exactly one domain
        }
    }
    // ... sort by count, but all counts == 1
}

The context bomb template then renders:

## Critical Files
1. cmd/run.go — 1 relationships
2. internal/api/client.go — 1 relationships
3. internal/cache/store.go — 1 relationships

The "1 relationships" is meaningless noise — it provides no signal about which files are actually most important.

Fix

For local mode, use a heuristic to rank files by importance rather than domain co-occurrence. For example:

  • Boost well-known entry-point filenames (main.go, index.*, app.*, server.*, __init__.py)
  • Boost files in the root domain over nested ones
  • Or omit the RelationshipCount display entirely in local mode (hide it when it's 0 or 1)

The cleanest option may be to set RelationshipCount = 0 for local-mode files and adjust the template to skip the count when it is 0.

Location

  • internal/local/local.go, lines 275–296 — computeTopFiles
  • internal/template/render.go, line 51 — renders {{.RelationshipCount}} relationships

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions