Skip to content

feat(engine): add claim-level span citations in compiler (#450)#817

Merged
manavgup merged 8 commits into
mainfrom
worktree-agent-a419164a
May 25, 2026
Merged

feat(engine): add claim-level span citations in compiler (#450)#817
manavgup merged 8 commits into
mainfrom
worktree-agent-a419164a

Conversation

@manavgup
Copy link
Copy Markdown
Owner

Summary

  • Compiler now injects source spans into the LLM prompt so the model can cite specific span IDs per claim
  • _persist_claims validates returned span IDs against actual spans — hallucinated IDs are dropped with a warning
  • Adds source_span_ids to CompiledClaimDTO for pipeline transport
  • 6 new tests covering prompt generation, DTO handling, and span validation

Test plan

  • 6 new unit tests pass
  • Existing test suite passes
  • CI green
  • Manual test: ingest a URL/PDF, compile, verify claims have span IDs in /wiki/articles/{id}/claims

🤖 Generated with Claude Code

@github-actions github-actions Bot force-pushed the worktree-agent-a419164a branch 2 times, most recently from 96ed49e to ab473bb Compare May 23, 2026 23:15
@github-actions github-actions Bot added the needs-rebase PR has merge conflicts with main label May 23, 2026
@manavgup manavgup force-pushed the worktree-agent-a419164a branch from 8450d72 to 277222d Compare May 25, 2026 15:25
@github-actions github-actions Bot removed the needs-rebase PR has merge conflicts with main label May 25, 2026
@github-actions github-actions Bot force-pushed the worktree-agent-a419164a branch from 277222d to ee47216 Compare May 25, 2026 15:25
manavgup and others added 7 commits May 25, 2026 15:25
)

Wire source spans into the compilation pipeline so each claim can cite
specific SourceSpan IDs. The compiler prompt now includes a Source Spans
section when spans are available, the LLM returns span IDs per claim,
and _persist_claims validates them against actual spans before storage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test_replace_calls_maybe_trigger test creates a Compiler via __new__
(bypassing __init__), so _source_spans was never set. Add the missing
attribute to the test's manual setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nt (#450)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot force-pushed the worktree-agent-a419164a branch from ee47216 to bdba872 Compare May 25, 2026 15:25
@manavgup manavgup merged commit cbded74 into main May 25, 2026
1 check passed
@github-actions github-actions Bot deleted the worktree-agent-a419164a branch May 25, 2026 15:26
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