Skip to content

adf context --files: route modules from the file's own path tokens #442

Done

Description

@stackbilt-admin

Problem

Agents think in files ("I'm about to edit X"), but routing only works on task words. filePathToKeywords (adf-context.ts:26-48) maps only generic extensions and directory names (tsx, api, auth, ...) and never uses the path's own tokens. charter adf context --files packages/adf/src/manifest.ts resolves only core.adf, state.adf.

In the review, 2 of 4 natural phrasings of "change how ADF modules are selected" also missed adf-dev.adf, so a file seed is the more reliable signal, for every agent and vendor.

Proposed

Split the path into tokens (packages/adf/src/manifest.ts → adf, manifest, ...), drop generic segments (packages, src, lib, index, extensions), and feed the rest to the existing trigger matcher alongside the current signals.

Simulated with today's --keywords (review, pinned 5412100):

File Routed module
packages/adf/src/manifest.ts adf-dev.adf
packages/cli/src/commands/adf-migrate.ts adf-dev.adf
packages/cli/src/commands/validate.ts governance.adf
packages/blast/src/index.ts analysis.adf
serve.ts, context-refresh.ts, ci.yml Defaults only (no module covers them, which is correct)

Acceptance

  • adf context --files packages/adf/src/manifest.ts --format json resolves adf-dev.adf.
  • JSON reports which token matched which trigger (reuse triggerMatches), so the agent can see the reason.
  • A guard test shows generic path segments don't trigger modules in a fixture repo with common trigger words.

Risk

Over-triggering in other repos. Keep the stop-list conservative and always report the matches.

Works on its own. Part of #437.

Activity

  1. added
    enhancement
    area:adf
    type:feature
    priority:p1
    epic:preflight
    on Nov 28, 2026
  2. added a commit that references this issue on Nov 28, 2026
    99c2397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:adfenhancementepic:preflightpriority:p1type:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions