Skip to content

Enable create_discourse_relation by default - #8

Open
mattakamatsu wants to merge 1 commit into
mainfrom
relation-write-on-by-default
Open

Enable create_discourse_relation by default#8
mattakamatsu wants to merge 1 commit into
mainfrom
relation-write-on-by-default

Conversation

@mattakamatsu

Copy link
Copy Markdown
Contributor

create_discourse_relation has been built, merged (#4) and shipped in dist/ since July — but gated behind DG_MCP_RELATION_WRITE, which nobody had set. ADR-018 point 2 chose that default because the tool writes directly with no user-visible approval step.

The gate turned out to have the opposite effect from the one intended. Auditing dg-team's relation schema this week surfaced two duplicate relation definitions (Issue addresses Hypothesis, Project addresses Journey) and 124 orphaned stored records. Cleaning that up meant raw delete_block calls through the generic Roam MCP — a path with none of the validation ADR-018 specifies: no type-pair check, no refusal on ambiguous labels, no idempotency, no dry_run. A safety gate that pushes work onto an unsafer path isn't a safety gate.

What changes

  • ENABLE_RELATION_WRITE becomes !envOff(...), matching the canvas tools' posture from Canvas tools on by default #7. Opt out with DG_MCP_RELATION_WRITE=0/false/off/no.
  • ADR-018 gets a dated amendment rather than a silent contradiction — decision point 2 is struck through and the reasoning recorded.
  • README / ARCHITECTURE / src/relations/README.md updated.

What does not change

The analysis surface stays read-only, and ADR-018 points 3–7 are unconditional: one block per call, always under roam/js/discourse-graph/relations, refuse rather than guess, idempotent, one direction only, dry_run available. Blast radius of a misfire is one block on a config page, undone by deleting one block.

Known gap, recorded in the amendment

There is still no tool to delete a stored relation (deleteStoredRelation in relations/write.ts is an internal rollback helper) and none to repoint a record's hasSchema. Those two are the prerequisite for recovering dg-team's 124 orphaned records — 87 Flow → Function and 31 Result → Hypothesis edges that exist in the data but are invisible to the plugin. Filed separately.

npm run build clean, npm test 28/28.

🤖 Generated with Claude Code

The tool shipped disabled (ADR-018 point 2) on the grounds that a direct
write with no approval step warranted an explicit opt-in. In practice the
gate pushed work onto a more dangerous path: an agent auditing dg-team's
relation schema had to clean up duplicate relation definitions through raw
block deletes on the generic Roam MCP, which has none of the validation
this tool performs — no type-pair check, no ambiguity refusal, no
idempotency, no dry_run.

Flip the default to on (opt out with DG_MCP_RELATION_WRITE=0), matching the
canvas tools' posture from #7. The safety properties in ADR-018 points 3-7
are unconditional and unchanged, and the analysis surface stays read-only.

ADR-018 gets a dated amendment rather than a silent contradiction, and it
records what is still missing: no tool deletes a stored relation, and none
repoints a record's hasSchema, so cleanup still falls back to raw block
edits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant