Permit-to-work conflict checks on Relate

The conflict is a path

Before a work permit is approved, Blind Flange walks the plant's piping graph in Relate to find conflicts with other open jobs, shows the path that proves each one, and refuses to say CLEAR when it cannot know.

Starting pump P-A puts pressure on the temporary blind BF-504 by a four-hop path through RLV-504. P-A L-PD-A RLV-504 L-RL-504 BF-504 P-B JT-DRUM
BLOCK

PTW-0511 starts pump A. Pressure reaches BF-504, a blind that PTW-0504 relies on. The two permits share no tag.

Relate by Neo4j · One .rl file · Every finding carries its path

DrawingPTW-0511 check PlantIllustrative ResultBlock, 4 hops

One minute, one path

The demo

Blind Flange in a terminal: restarting train B is BLOCK, with the 12-hop path through the open bypass BV-231; closing BV-231 makes it CLEAR.
Two jobs, same pipe12 hops to the blindClose one valveEvery answer shows its path
Real output · invented plant

How it works

Three steps

i.

Two safe permits, one hazard

Two permits can each look safe and still conflict, because the equipment they name is joined by piping neither mentions. Matching by equipment tag cannot see it. On Piper Alpha in 1988 the two permits named different equipment; this tool does not claim it would have prevented that.

ii.

Relate walks the pipes

One .rl file holds the plant, valve and blind states, open permits and every decision. One Cypher path query walks the piping and stops at each closed valve or installed blind. A request is checked as a dry run inside a transaction, then rolled back.

iii.

An answer with its path

Every finding carries the route that proves it. If a state that matters is unknown, or the search hit its limit, there is no verdict, and the reason is named.

BLOCKHOLDCLEARINCOMPLETE
Terminal output: BLOCK, pressure would reach the temporary blind BF-504 by a four-hop path; tag matching would pass.
Starting pump A would pressurise a blind another permit relies on. Tag matching alone would pass it.
For engineers: the query, the verdicts, the guarantees
MATCH path = SHORTEST 1 (s)
  ((a)-[:CONNECTED_TO]-(b)
    WHERE ( NOT coalesce(a.state, 'unknown')
              IN ['closed', 'installed', 'removed', 'unknown']
            AND coalesce(a.observed_at, '') >= $stale_before )
       OR ( $possible AND
            (coalesce(a.state, 'unknown') = 'unknown'
             OR coalesce(a.observed_at, '') < $stale_before) )
  ){0,100} (x:Component)
OPTIONAL MATCH (q:Permit)-[r:WORKS_ON|RELIES_ON]->(x)

// closed and installed are barriers; unknown or stale
// is never a barrier, and passable only in the POSSIBLE pass.
StatusVerdictMeaning
COMPLETEBLOCKA proven conflict this request introduces, with its path.
COMPLETEHOLDReview needed: a shared isolation, or a hazard that already exists.
COMPLETECLEARNo conflict found, and nothing needed was unknown.
INCOMPLETEnoneA state that matters is unknown or stale, or the search hit its bound.
ERRORnoneUnknown tag, ambiguous change, or stale revision. Recorded too.
  • Proven or possible. The query runs twice: known states only, then unconfirmed ones too. A possible finding withholds the verdict instead of guessing.
  • Bounded, and honest about it. If the hop limit cut anything off, the result is INCOMPLETE, never CLEAR.
  • Every decision kept. Each assessment stores its inputs; blindflange replay re-runs it.

An agent can ask, not decide

Proof

blindflange mcp serves nine tools over the Model Context Protocol. None approves a permit or changes the plant. We asked Claude Code the same question twice: can train B be restarted?

Without the tool

"Verify the P&IDs"

It found no direct conflict in the permit list and hedged. It could not name the bypass, because the bypass is in no permit.

With the tool

Do not approve

assess_change returned BLOCK with the 12-hop path; explain_finding showed the route goes around the closed XV-231 through the open bypass BV-231. Transcript

35

of 35 eval cases give the expected verdict (8 expect "cannot say")

8 of 15

risky requests stopped by tag matching alone

120

random plants where an independent walk agrees, plus 35 cases

35

recorded evaluations replay to the same result

286

tests pass on Linux, macOS and Windows CI

13 of 13

deliberate mutations of the checks caught

These cases show what the checks do. They are not evidence of field performance. A second agent session shows why the agent now assesses the permit as written.

Try it

From a fresh clone

$ git clone https://github.com/loksai-codes/blind-flange.git && cd blind-flange
$ python -m venv .venv
$ source .venv/bin/activate              # Windows: .venv\Scripts\activate
$ pip install -e .
$ cp stores/condensate_unit.rl work.rl   # Windows: copy
$ python -m blindflange check data/permits/PTW-0511.yaml --store work.rl

Decision support only. Not a safety system. Not reviewed by a process safety engineer. Both plants are illustrative.

Pressure is modelled as reachability only: no flow rates, pressure levels or fluids. Only the final state is checked. Electrical isolation is out of scope.

Commercial control-of-work products such as Sphera, Enablon and IntelliPERMIT already manage permits and isolations. Blind Flange does not replace them; it is a small, open, single-file tool whose every finding can be inspected and replayed.