Skip to content

fix: theme path leakage for binary assets in get_context #305

@CalebisGross

Description

@CalebisGross

Problem

get_context themes include full relative paths for binary assets like docs/images/mnemonic.png, docs/images/favicon-96x96.png, docs/images/apple-touch-icon.png. Code file paths decompose into useful semantic segments (retrieval, agent, mcp), but image/binary paths pass through as-is.

Also seeing bare segments like bytes and bin which aren't meaningful concepts.

Expected

Themes should only contain semantic concepts, not file paths or meaningless segments.

Fix

In internal/concepts/extract.go FromPath:

  • Strip file extensions before extracting segments
  • Skip segments that are common binary asset directories (images, icons, fonts)
  • Skip segments that match binary file extensions (.png, .ico, .svg, etc.)
  • Add a stopword list for low-value segments (bytes, bin, tmp, dist, node_modules)

Found during

v0.29.1 stress testing — themes returned: [bytes bin docs/images/mnemonic.png ui documentation docs/images/apple-touch-icon.png docs/images/favicon-96x96.png docs/images/favicon.ico]

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