Sekisho
Sekisho (関所) means "checkpoint." It is Ninka's compile-time inspection: before a Tegata is compiled, Sekisho checks its meaning — not just whether the JSON is well-formed.
A Tegata can be perfectly valid JSON and still be a dangerous policy. Sekisho is the gate that refuses to compile a policy that is valid but wrong.
What it checks, and why
Schema validation only tells you the document has the right shape. Sekisho asks whether the policy means something safe. It catches categories of semantic problems that an AI agent — or a tired human — regularly produces:
- Contradictions. The same conditions used to both allow and deny the same action. The policy is self-inconsistent; the intended decision is unknowable.
- Dead exceptions. An allow rule that can never fire because a broader deny already overrides it (deny overrides allow). You think you granted access, but no request can reach it. Sekisho surfaces the rule that will never do anything.
- Vocabulary drift. Two spellings of the same concept —
adminvsadministrator,adminvsAdmin. To a string comparison these are different roles, so a rule meant to cover admins quietly misses half of them.
Some findings are hard errors that stop compilation; others are warnings that inform your review but let it continue. Either way, the message tells you exactly what to change.
Errors are one-line and prescriptive
Sekisho messages are short and tell you what to fix. That closes a loop with an AI agent: the agent writes a Tegata, runs the compiler, and if Sekisho rejects it, the one-line error is enough to correct the document and try again — a write → check → fix loop the agent runs on its own, before a human ever sees it. By the time the Tegata reaches you for approval, it has already survived the checkpoint.
agent writes Tegata ─► ninka compile ─► Sekisho
▲ │
└──────── one-line error ◄─────────┘ (loop until it passes)
│
passes ▼
human approves
One inspection, at build time
Sekisho runs once, at compile time, on the policy document itself. It is deliberately paired with the runtime, where OPA enforces the compiled policy on every request: the checkpoint inspects the certificate once; the gatekeeper judges every passage. Sekisho's job is to make sure a bad policy never gets compiled in the first place.