Skip to content

MCP getProjectContext drops on-demand rules when the task ends with punctuation #438

Done

Description

@stackbilt-admin

Problem

The same task gives different rules over MCP and the CLI. MCP getProjectContext splits the task on whitespace only (serve.ts:157, task.toLowerCase().split(/\s+/)). The CLI normalizes punctuation through tokenizeTask (flags.ts:55). An ordinary sentence ending in "." makes ADF. fail to match the ADF trigger, so the specialist module is silently missing over MCP.

An agent that gets a governance answer missing a binding rule, with no signal that anything is missing, learns not to trust Charter.

Reproduction (pinned 5412100, built source)

charter serve over stdio, then call getProjectContext twice:

  • {"task":"Change module selection for ADF."}: 5,508 chars; no "ADF package has zero runtime dependencies"
  • {"task":"Change module selection for ADF"}: 7,100 chars; rule present

CLI charter adf bundle --task "Change module selection for ADF." --format json resolves adf-dev.adf in both cases.

Expected

One shared tokenizer for every transport (CLI, MCP, and any future adapter). The same task resolves the same modules everywhere.

Acceptance

  • Unit or integration test: the task with and without a trailing period resolves identical resolvedModules via CLI and MCP.
  • Other MCP tools that accept a task use the same tokenizer.

Starting points

  • serve.ts getProjectContext handler: replace the inline split with tokenizeTask.

Works on its own. Part of #437 (preflight needs answers that match across transports).

Activity

  1. added
    bug
    area:adf
    priority:p0
    epic:preflight
    on Nov 28, 2026
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:adfbugepic:preflightpriority:p0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions