Skip to content

feat: add cortex answer command + MCP tool with citation integrity - #248

Merged
hurttlocker merged 2 commits into
mainfrom
xmate/answer-mode
Feb 27, 2026
Merged

hurttlocker merged 2 commits into
mainfrom
xmate/answer-mode

Conversation

@hurttlocker

Copy link
Copy Markdown
Owner

Implements #247.

What shipped

  • New package: internal/answer/
    • single-pass answer engine (search -> synthesize -> cite -> done)
    • citation integrity gate (invalid/missing citations => degrade fallback)
    • prompt-injection-like line stripping before synthesis
    • verbose audit logging of stripped content to stderr
    • graceful no-LLM degradation to top search results
  • New CLI command: cortex answer
    • flags: --model, --mode, --limit, --max-sentences, --max-context-chars, --per-result-chars, --json, plus source filters/boosts
  • New MCP tool: cortex_answer
    • mirrors search inputs + model, maxSentences, maxContextChars
    • returns JSON answer/citations/degraded metadata
  • Added tests for answer engine behavior and guards.

Constraints honored

  • Single-pass only, no recursion, no memory writes
  • Degrade-not-fail when LLM is unavailable
  • Citation format and parseability for downstream use

Validation

  • go test ./... passes.

@hurttlocker
hurttlocker merged commit 9a4f1a3 into main Feb 27, 2026
4 checks passed
@hurttlocker hurttlocker mentioned this pull request Feb 27, 2026
6 of 9 tasks
@hurttlocker
hurttlocker deleted the xmate/answer-mode branch March 1, 2026 17:09
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.

2 participants