Skip to content

feat: list_concerns() discovery tool — browse before you query - #3

Merged
Koed00 merged 7 commits into
mainfrom
feature/list-concerns
Jun 19, 2026
Merged

Koed00 merged 7 commits into
mainfrom
feature/list-concerns

Conversation

@Koed00

@Koed00 Koed00 commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a 4th MCP tool, list_concerns() (no arguments), to lore-mcp. Scans all configured repos and returns candidate decision-topic strings (feature directory names, ADR titles, decision heading text) an agent can browse before guessing a resolve_concern keyword.

  • New pure functions collectConcernCandidates/extractFirstHeadingText in src/core/concern-matcher.ts, reusing existing heading-detection machinery (no new dependency).
  • New ListConcernsResponse type + formatListConcernsResponse formatter in src/core/format-response.ts.
  • New list_concerns handler in src/shell/server.ts, reusing resolve_concern's exact per-repo probe/skip pattern.
  • Dedup is exact-string-match across all repos combined; result capped at 200 entries (repo-config order) with a truncation warning if exceeded.
  • list_concerns() never returns an error shape — an empty concerns: [] is a valid success response when no configured repo has nWave structure.
  • README updated: new tool documented in "## MCP Tools", and the "Using LoreMCP while architecting" workflow revised to call list_concerns() first, closing the "known gap" that section previously flagged.

Why

Originated from a DIVERGE backlog item (#4, scored 3.35/5) surfaced while dogfooding resolve_concern for the heading-anchored-snippets feature: resolve_concern only helps if the agent already knows which keyword to ask about. This closes that gap directly.

What a reviewer should know

  • This tool didn't exist at all before (unlike prior features extending an existing tool), so DISTILL required a different RED-scaffolding approach: a NOT_IMPLEMENTED stub tool registration (rather than a production-module stub), confirmed via peer review as the correct Mandate 7 interpretation for a brand-new MCP tool — it proves the driving port is wired without yet implementing behavior.
  • A README bug was caught and fixed during the post-merge gate, not after: the new tool's example output used camelCase (searchedRepos) when the actual wire format is snake_case (searched_repos, via the existing toSnakeCaseKeys conversion) — caught by checking a live tool call, not just trusting the written example. Also fixed stale "three tools" / test-count language elsewhere in the README.
  • The per-feature mutation gate dipped below 80% on the modified file (concern-matcher.ts fell to 78.78% after this feature's new code, even though the project-wide average still passed at 83.23%) — closed by adding 33 real tests, no production code changes. Final: concern-matcher.ts 81.67%, format-response.ts 100%, project-wide 88.02%.
  • Full nWave wave trace (DIVERGE → DISCUSS → DESIGN → DISTILL → DELIVER) is under docs/feature/list-concerns/. Evolution summary: docs/evolution/list-concerns-evolution.md.

Test plan

  • 442/442 tests passing (npm test)
  • npm run build (tsc strict) clean
  • npm run check:arch (dependency-cruiser core/shell boundary) clean
  • Mutation testing: concern-matcher.ts 81.67%, format-response.ts 100%, project-wide 88.02% (threshold 80%)
  • Live dogfood: list_concerns() against this repo's own docs returns 96 candidates including all 4 feature dirs + real ADR titles (KPI-LC-1); chaining a result into resolve_concern() finds the exact source ADR end-to-end (KPI-LC-5)
  • DES integrity verification: 2/2 roadmap steps with complete TDD traces

Ilan Steemers and others added 7 commits June 19, 2026 15:05
DIVERGE round backlog item #4 ("list_concerns() discovery tool") promoted
to a scoped feature: a 4th MCP tool that lets an agent browse candidate
decision topics across all configured repos before guessing a
resolve_concern keyword, closing the gap documented in README's "Using
LoreMCP while architecting" section.

DISCUSS, DESIGN, and DISTILL waves completed and peer-reviewed (both
approved). Registered a NOT_IMPLEMENTED stub for list_concerns in
server.ts so acceptance tests fail with clean AssertionErrors rather
than MCP protocol-level crashes -- confirmed RED, not BROKEN.
The crafter's list_concerns doc used searchedRepos (camelCase) but the
actual wire format is searched_repos (snake_case, via toSnakeCaseKeys) --
verified against a live tool call. Also fixed the intro blurb (still
said "three MCP tools") and the test count (still said 369, now 417).
…>=80%

concern-matcher.ts was at 78.78% and format-response.ts had dropped to
82.95% after the list-concerns feature added collectConcernCandidates,
extractFirstHeadingText, and formatListConcernsResponse. Add targeted
unit tests pinning boundary conditions (off-by-one comparisons, regex
anchors, optional chaining, trim/join precision) that the new survivor
report identified, without touching production code or existing
assertions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Koed00
Koed00 merged commit c3f9b30 into main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant