feat: add opt-in ontology write tools for Jarvis graph agent#1465
Merged
Conversation
Register ontology write tools (create/update/delete node & edge types, rename attribute) that POST/PUT/DELETE directly against Jarvis /v2/schema. Gated behind the opt-in toolsConfig.ontology_edit flag so the default posture stays read-only. Injects inspect-before-mutate guidance into the graph system prompt, requiring explicit user confirmation for destructive changes.
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
Adds opt-in ontology write tools to the Jarvis graph agent so it can modify the knowledge-graph schema on the fly, rather than committing ontology changes to code. Changes are posted directly to the graph via the existing Jarvis
/v2/schemaendpoints.Tools registered (gated behind
toolsConfig.ontology_edit)ontology_create_typePOST /v2/schemaontology_update_typePUT /v2/schema/<ref_id>ontology_delete_typeDELETE /v2/schema/<ref_id_or_type>(soft delete)ontology_create_edgePOST /v2/schema/edgeontology_update_edgePUT /v2/schema/edge/<ref_id>ontology_delete_edgeDELETE /v2/schema/edge/<ref_id>ontology_rename_attributePUT /v2/schema/<ref_id>/attributeHow it works
toolsJarvis.ts: newjarvisMutatehelper (POST/PUT/DELETE) mirroringjarvisFetch; surfaces JarviserrorCode/messageback to the agent verbatim. Write tools registered viaregisterOntologyWriteTools, gated by a newontologyEditoption — next to the existinggraph_sub_agentgating.tools.ts:ontology_editadded to theToolNameunion /TOOL_NAMES/DEFAULT_DESCRIPTIONS(a group gate, likegraph_sub_agent); theregisterJarvisToolscall passesontologyEdit.agent.ts:ONTOLOGY_EDIT_GUIDANCEinjected intoGRAPH_SYSTEMonly when the flag is on (same conditional-injection pattern asqs/learn_concepts). Enforces inspect-before-mutate, smallest-change, reserved-name/CHILD_OFprotection, valid type descriptors, and explicit user confirmation for destructive ops.Default posture stays read-only — writes are strictly opt-in.
Usage
{ "repo_url": "https://github.com/stakwork/mikeoss", "prompt": "Add a citationCount int attribute to the Statute node type", "mode": "graph", "toolsConfig": { "ontology_edit": true } }Not included / follow-ups
:Migrationtrail and aren't reproducible across environments. That needs Jarvis-side work (a new endpoint recording a replayable payload, or the agent emitting aBaseMigrationfile).allowDeletesub-flag yet —ontology_edit: trueenables destructive tools too, with confirmation enforced via prompt only. The object form ({ ontology_edit: { allowDelete: false } }) could add a hard guardrail later.Testing
tsc --noEmitcleansrc/__tests__/tools.test.tspasses (21/21)