Skip to content

feat: inject project schema into the analysis prompt so custom page types get recommended#496

Merged
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:feat/analysis-schema-injection
Jun 28, 2026
Merged

feat: inject project schema into the analysis prompt so custom page types get recommended#496
nashsu merged 1 commit into
nashsu:mainfrom
AndrewDongminYoo:feat/analysis-schema-injection

Conversation

@AndrewDongminYoo

Copy link
Copy Markdown
Contributor

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 schema into buildAnalysisPrompt and use it two ways:

  • Include the schema as analysis context ("map source content to schema-defined types when it fits").
  • Extend the Recommendations section to call out schema types beyond entity/concept when the source genuinely contains matching content — with an explicit guard against inventing goals/habits/journal entries that aren't in the source.

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

  • Personal-growth/journal-style types are still primarily user-authored living documents; this only helps when a source does contain such content (e.g. a "2026 goals" note), so it stops those cases from being silently dropped into generic entity/concept pages.
  • Routing already accepts schema-defined types (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.

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.
@nashsu nashsu merged commit 0f87ff9 into nashsu:main Jun 28, 2026
3 checks passed
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