feat: strengthen ontology-edit guidance to reuse types over inventing#1466
Merged
Conversation
Make ontology inspection a hard prerequisite before any schema write and add a reuse-first decision procedure so the agent matches concepts to existing types by meaning (synonyms, plurals, broader/narrower terms) rather than creating near-duplicate node/edge types out of thin air. Reinforced in both the graph system prompt and the create tool descriptions.
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.
What
Follow-up to #1465. Tightens the ontology-editing guidance so the agent reuses existing types instead of inventing new ones out of thin air, and makes inspecting the current ontology a hard prerequisite before any schema write.
Changes
agent.ts— injectedONTOLOGY_EDIT_GUIDANCE:get_ontology, withgraph_searchas a fallback to see how a concept is already modeled).Podcast→Episode,Individual→Person,Org→Organization) → extend an existing type (add attribute/edge) → only create as a last resort, inheriting from the closest existing parent and justifying why.toolsJarvis.ts—ontology_create_type/ontology_create_edgedescriptions:Autonomy note
Deliberately does not tell the agent to ask the user before creating a type — this keeps autonomous use viable. Callers can still prompt for confirmation if they want it. The separate destructive-op confirmation guardrail (delete type/edge, rename attribute) is unchanged.
Testing
tsc --noEmitclean