Repository navigation
Store agent-made facts with their source text - #714
Merged
Merged
Conversation
jaywyawhare
force-pushed
the
feat/no-key-agent-path
branch
from
December 5, 2026 01:50
e33254c to
aff22d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An agent with no LLM key can extract the facts itself and pass them to
insert.textwith the text, so passages, citations, andreplace_sourcesurvive.Relation evidence that names no
source_idtakes the call's, and the skill and tool descriptions point agents without a key at this path.Implementation details
Door:
one-wayCleanup:
noneDecisions
insert.texttakesfacts. With them nothing is extracted, and the text goes through the same source recording as extraction, so passages, chunk citations, andreplace_sourcebehave as they do for extracted text. I put this oninsert.textrather than adding text toinsert.factsbecauseinsert.textalready owns the provenance options (metadata,chunking,replace_source).insert.factssemantics: instrictschema mode a fact outside the schema is rejected, not dropped as extracted facts are.result.tiershas noextractionentry.source_idkey inherits the call's, ininsert.textandinsert.facts. An explicitsource_id, includingnull, is kept as given.factstogether withinstructionsorpromptsraisesinvalid_argumenton thefactsfield, since those only guide extraction.FactsInput, which isExtractionwith an optional evidencesource_id, forinsert.text'sfactsand forinsert.facts, so callers can omit it without a cast. Python already takes a mapping.insert text --facts FILEand the MCPinsert_texttool getsfacts, in both SDKs. The skill gets a "Without an LLM key" section, and theinsert_textandinsert_factstool descriptions tell an agent with no LLM to extract and pass the facts.Validation
tests/test_insert_with_facts.pyandtypescript/test/insertWithFacts.test.ts(7 tests each) fail on main and pass here. They cover the stored source and its cited passage,source_idinheritance next to an explicit one,replace_sourceretiring what only the older version stated, strict mode, theinstructions/promptsguard, and the CLI and MCP paths. No existing test inserts caller facts with their text.insert_with_facts, checks that both SDKs return the same ids, tiers, evidence, retrieval context, and guard error. The MCP test that pins theinsert_textarguments now includesfacts.scripts/precheck.py --base origin/mainpasses. Ruff, Biome, andtsc --noEmitare clean. Targeted suites pass on Kuzu. The only local failures are the code-parsing conformance cases, which need thecodeextra that is not installed here, and the pipe test that spawns an installed CLI; both fail on main the same way.docs/errors.mdis unchanged.Limits
Caller evidence keeps its quote and is tied to the new source version, but its
chunk_idis not derived from the quote. Retrieval still cites the source at the chunk level. No model is bundled and nothing calls an LLM by default, as the issue scopes.Linked issue
Closes #674
AI Assistance
AI tools helped write and test parts of this. I reviewed and ran every change.
Checklist
/approved.AGENTS.md). No new codes; the guard usesinvalid_argumentwithfield="facts"and the same text in both SDKs.Breaking changes
None.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.