fix(memory): land verified question/SQL pairs as executable measures and segments#313
Open
luca-martial wants to merge 3 commits into
Open
fix(memory): land verified question/SQL pairs as executable measures and segments#313luca-martial wants to merge 3 commits into
luca-martial wants to merge 3 commits into
Conversation
The SQL-aggregate signal gated on userMessage.length >= 100, but `ktx ingest --file` sets a fixed boilerplate user message and carries the artifact in the assistant message. SQL-heavy files therefore never force-loaded the SL capture skill and defaulted to wiki capture. External ingest now treats the deliberate submission itself as the substantive signal, so verified SQL fires the SL signal regardless of the boilerplate user message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…es and segments Adds a verified_pairs directive to the external-ingest preamble so analyst-validated question/SQL pairs become executable measures and segments and revise scan-guessed sources in place, points the workflow at sl_capture, and clarifies in the do_not block that deriving a measure from a verified query is derivation from evidence, not fabrication. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The SL index shown to the agent on each re-run listed measures and joins but not segments, so repeat passes could not see which existing sources were thin on segments and re-derived blindly. The index now reports segment counts and names alongside measures, and a source is only flagged for enrichment when measures, segments, and joins are all empty. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Problem
Verified question/SQL pairs ingested through
ktx ingest --filewere being captured as wiki prose instead of executable measures/segments, so the semantic layer stayed whatever the warehouse scan guessed from column names. Even an explicit "define measures and segments" instruction produced zero SL writes on a corpus full of verified SQL.Root cause
Three independent issues on the
--filememory-agent path:detectCaptureSignalsonly fires the SL signal from SQL whenuserMessage.length >= 100. That gate is a reasonable proxy on the chat/research path, butktx ingest --filesetsuserMessageto a fixed boilerplate string and carries the artifact inassistantMessage. So SQL-heavy files never force-loaded the SL capture skill and defaulted to wiki capture.memory_agent_external_ingest.mdframed every artifact as a reference doc and routed rules/definitions to the wiki, with no instruction to encode a verified computation as a measure/segment or to revise a scan-guessed source in place. Thedo_not"don't fabricate" line also read as a brake on encoding a query (a query implies a measure rather than declaring one).Changes (one commit each)
fix(memory): fire SL capture signal for SQL-bearing external ingest— external ingest treats the deliberate submission itself as the substantive signal, so verified SQL fires the SL signal regardless of the boilerplate user message. Research/backfill keep the existing length gate. Adds two regression tests.feat(memory): encode verified question/SQL pairs as executable measures and segments— adds averified_pairsdirective (encode the computation, revise sources in place, verified material is authoritative over a conflicting scan guess), points the workflow atsl_capture, and clarifies that deriving a measure from a verified query is derivation from evidence, not fabrication.fix(memory): surface segments in the SL index for re-run gap targeting— the index now reports segment counts and names alongside measures, so a second pass targets gaps instead of re-deriving blindly; a source is only flagged for enrichment when measures, segments, and joins are all empty.Verification
pnpm --filter @kaelio/ktx run type-check— cleanpnpm --filter @kaelio/ktx exec vitest run test/context/memory/— 50 passed (incl. 2 new signal tests)pnpm run dead-code— clean (Biome + both Knip modes)Notes
🤖 Generated with Claude Code