feat: inject project schema into the analysis prompt so custom page types get recommended#496
Merged
nashsu merged 1 commit intoJun 28, 2026
Conversation
Stage 1 (analysis) only ever extracted Key Entities / Key Concepts —
it never received the project schema, so custom page types defined by a
template (goal, habit, reflection, journal, finding, decision, …) were
invisible to it. Generation already gets the schema, but with the
analysis blind to those types, source content that maps to them was
rarely recommended and almost never routed to the right folder.
Pass `schema` into buildAnalysisPrompt and:
- include the schema as context ("map source content to schema-defined
types when it fits"), and
- extend the Recommendations section to call out schema types beyond
entity/concept when the source genuinely contains matching content —
with an explicit guard not to invent goals/habits/journal entries that
aren't actually in the source.
The schema is already loaded in autoIngestImpl (used by generation) and
already counted in the stable-context budget, so this is just wiring it
to the call site. Tests added for schema injection, omission, and the
no-invention guard.
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
Stage 1 (analysis) only ever extracts Key Entities / Key Concepts. It never receives the project
schema, so custom page types a template defines —goal,habit,reflection,journal(Personal Growth),finding,decision,meeting, etc. — are invisible to it.Stage 2 (generation) does get the schema, but since analysis is blind to those types, source content that maps to them is rarely recommended and almost never routed to the right folder. In practice a non-default template's extra folders stay empty and the user has to fill them by hand even when a source document actually contains that material.
Fix
Pass
schemaintobuildAnalysisPromptand use it two ways:The schema is already loaded in
autoIngestImpl(generation uses it) and already counted in the stable-context budget, so this is just wiring it to the existing call site — no new I/O, no budget change.Notes
validateWikiPageRouting), so recommended custom-typed pages pass through cleanly.Tests
Added cases for schema injection, omission when no schema is provided, and the no-invention guard.