-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
`mgw:ask` gathers project context (milestone, issues, active state, recent git diff) but it does NOT read the MGW command definitions or fetch live GitHub state. The classification agent has no awareness of what commands exist or how they work, and no PR context.
This means `mgw:ask` cannot accurately classify questions like:
- "Does mgw:ask have feature X?"
- "Does mgw:run handle edge case Y?"
- "Is there a command that does Z?"
It also misses live PR context and relies entirely on `.mgw/project.json` for milestone data — if that file is absent or stale, milestone context is empty.
What mgw:ask DOES gather (confirmed in commands/ask.md)
- `.mgw/project.json` — milestone + issue list with titles, stages, labels, scopes
- `.mgw/active/*.json` — active issue pipeline state
- `git diff HEAD --stat` — recent uncommitted changes (stat only)
- `gh issue view` bodies — full GitHub issue bodies for current milestone issues
What mgw:ask does NOT gather (gaps)
| Missing | Impact |
|---|---|
| `commands/*.md` front matter | Cannot answer questions about MGW capabilities |
| Open PRs via `gh pr list` | No PR context for classification |
| Live milestones via GitHub API | Falls back to stale/missing project.json |
Proposed Fix
Add a new step `load_capability_context` to `ask.md` (between `load_project_context` and `load_active_state`):
- Extract `name:` and `description:` from each `commands/*.md` front matter → `$COMMAND_SURFACE`
- Fetch open PRs via `gh pr list --json number,title,headRefName` → `$PR_CONTEXT`
- Fetch live milestones via `gh api repos/{owner}/{repo}/milestones` → `$MILESTONE_LIST`
Inject all three into a `<mgw_capabilities>` block in the agent prompt.
No new files required. The front matter fields (`name:`, `description:`) are consistently structured across all command files — clean extraction targets with minimal token cost.
Acceptance Criteria
- `mgw:ask` agent prompt includes a compact command capability index (name + description from each `commands/*.md`)
- `mgw:ask` fetches open PRs and includes them in agent context
- `mgw:ask` fetches live GitHub milestones as a fallback when project.json is absent
- Classification agent can accurately answer capability questions about MGW commands
- No regression on existing classification behavior (issue/active-state context unchanged)