feat(llm): improve integration prompt to always suggest placements#35
Merged
feat(llm): improve integration prompt to always suggest placements#35
Conversation
Enhanced the Phase 3 integration prompt to ensure the LLM always provides at least one suggestion, and preferably multiple (2-3) suggestions when there are valid alternatives. Changes to System Prompt: 1. Added explicit requirement to ALWAYS output at least one decision 2. Set preference for 2-3 decisions when multiple valid placements exist 3. Removed hard confidence threshold - if all candidates < 0.30, still output the best match with its actual confidence score 4. Reorganized prompt structure with reasoning-first format (matching classification prompt pattern) 5. Added detailed reasoning guidelines with 4-step decision framework 6. Changed system prompt role from 'JSON-only integration planner' to 'knowledge organization expert specializing in Logseq integration'. This leads with expertise/capability rather than constraints, creating a stronger professional identity that may improve LLM performance. Changes to User Prompt (Examples): 1. Replaced "no output" examples with positive examples showing: - Best match even with weak semantic fit (confidence 0.55) - Multiple suggestions for ambiguous content (3 suggestions) 2. Expanded examples from 5 to 7 with richer reasoning chains 3. Added "CRITICAL REMINDERS" section reinforcing key requirements 4. Structured with <examples> and <task> tags for better attention Expected Benefits: - User always gets at least one placement suggestion to consider - Multiple options shown when knowledge could fit in several places - More transparent reasoning helps user understand LLM decisions - Consistent with classification prompt's chain-of-thought approach - Better handling of edge cases (new topics, weak matches) Assisted-by: Claude Code
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
=======================================
Coverage 84.59% 84.59%
=======================================
Files 48 48
Lines 5084 5084
=======================================
Hits 4301 4301
Misses 783 783 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Enhanced the Phase 3 integration prompt to ensure the LLM always provides at least one suggestion, and preferably multiple (2-3) suggestions when there are valid alternatives.
Changes to System Prompt:
Changes to User Prompt (Examples):
Expected Benefits:
Assisted-by: Claude Code