Logo von Subgraph Access Control

Subgraph Access Control

Community
AnthonyAlcaraz
subgraph-access-control

Scope what each agent persona can see in a knowledge graph. Generates Neo4j fine-grained GRANT/DENY policy (traverse on node labels + relationship types, read on properties) per persona role, enforces security transparency (out-of-scope nodes are invisible, not access-denied), handles PII via the UUID-separation pattern with GDPR soft/hard erasure, and turns the Chapter-7 execution graph into a compliance artifact via governance metadata. Use for graph-backed agents where one unscoped query could traverse from a public catalog to employee records. NOT for relational row/table permissions, NOT for network/IAM policy, NOT for prompt-level guardrails (this governs graph reach).

Übersicht

HerausgeberAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill-Namesubgraph-access-control
Sterne
29
Forks
9
Mitgelieferte Dateien
2
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 2

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von AnthonyAlcaraz auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Subgraph Access Control in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/subgraph-access-control
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/optimization/subgraph-access-control .claude/skills/subgraph-access-control
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Subgraph Access Control in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Subgraph Access Control automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Subgraph Access Control nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Subgraph Access Control

Overview

An agent with unrestricted access to your knowledge graph is a liability. The dense relationships that make agentic reasoning powerful also mean a single unscoped query can traverse from a public product catalog to internal cost data to employee records. In a graph, everything is reachable from everything else.

Graph databases have mature access-control primitives. Neo4j Enterprise supports privileges at the node-label, relationship-type, and property level: you GRANT traverse rights on specific labels, DENY read access to specific properties, and combine them into role-based policies. A critical design feature is security transparency — when a role lacks permission to see a node, the node is invisible, not access-denied. The agent cannot distinguish data that does not exist from data it is not allowed to see, which blocks an autonomous agent from probing access boundaries as part of its reasoning.

This skill covers the three governance concerns from the chapter: subgraph-level access control (a role per persona, bound at connection time), PII and retention (Rehmer's Privacy-by-Architecture UUID separation with GDPR soft/hard erasure), and the execution graph as a compliance artifact (KG.GOV governance metadata that answers auditor questions as a graph query).

When to Use

  • A graph-backed agent serves multiple personas (SRE, finance) who need different views of the same graph.
  • You must prove which role accessed which data for a compliance review.
  • The graph holds PII and you need GDPR Article 17 erasure that does not cascade across densely connected relationships.
  • You are testing that an access policy does not accidentally starve the agent's reasoning (the "governance blocks the agent" pitfall).

Phrases that should invoke this skill: "who can see what in the graph", "subgraph access control", "role-based graph permissions", "GDPR delete from the graph", "PII in the knowledge graph", "compliance audit of agent decisions".

When NOT to Use

  • Relational row/table permissions. This is graph-native (labels, relationship types, properties). Use SQL GRANT for tables.
  • Network / cloud IAM. IAM scopes API calls; this scopes graph traversal. They compose (the execution-graph access_role ties back to the IAM role) but are different layers.
  • Prompt-level guardrails. A jailbreak-resistant system prompt is not access control; this enforces reach at the database, below the model.
  • Single-persona agents. If every query runs as one role, a static connection policy suffices; you do not need per-persona generation.

Process

StepInputActionOutputVerification
1Persona role namelib.generate_policy(role)Neo4j GRANT/DENY CypherContains GRANT TRAVERSE + DENY on cost/employee
2Role + label (+ property)lib.can_traverse / lib.can_readBooleanFalse traverse => invisible, not denied
3Role + agent query labelslib.audit_access(role, labels)reachable / invisible / masked + functionally_completeComplete only if every needed label is reachable
4(design)lib.privacy_by_architecture()UUID / Identity-Store splitGraph stores only uuid + relationships
5UUID + modelib.gdpr_erase(uuid, mode)soft (mask+orphan) or hard (DETACH DELETE)Hard emits DETACH DELETE; soft preserves aggregates
6Decision factslib.governance_metadata(...)Execution-graph governance recordCarries model_id/version + access_role + pii_accessed
7Governance recordslib.audit_query(records, pii_accessed=True)Filtered compliance answerReturns exactly the PII-accessing decisions

Rationalizations

Agent rationalizationDocumented rebuttal
"Return access-denied so the agent knows to stop."Access-denied leaks the existence of the data. Security transparency makes the node invisible so the agent cannot distinguish "absent" from "forbidden" and cannot probe the boundary (Ch8).
"One admin role is simpler than a role per persona."One role means the agent acting for an SRE can also read finance cost data and employee PII — exactly the cross-domain traversal the chapter opens with. Bind a role per persona at connection time.
"Just delete the user node for GDPR."In a densely connected graph a raw delete cascades into relationships you need to keep. The UUID-separation pattern lets you mask the identity mapping (real-time, single-row) and clean the graph asynchronously (Ch8).
"Governance is an external overlay we add later."KG.GOV makes governance a first-class citizen of the graph: the execution graph already captures data_sources_accessed and access_role, so the audit answer is a graph query, not a log-parsing project (Example 8-6).
"Lock the policy down as tight as possible."Over-restriction starves reasoning: if the SRE role cannot reach Library nodes, dependency analysis breaks. Test the policy against the agent's real query patterns first (audit_access; Ch8 pitfall).

Red Flags

  • Policy returns access-denied instead of invisibility. Security transparency is broken; the boundary is now probeable.
  • The SRE role can read cost_per_hour or traverse Employee. Cross-domain leakage — the exact failure the chapter opens with.
  • GDPR "delete" leaves the identity mapping intact. Erasure is not honoured; soft delete must mask the mapping, hard delete must DETACH DELETE.
  • audit_access reports functionally_complete for a role missing a required label. The completeness check is wrong; dependency reasoning will silently break in production.
  • Governance record omits model_id/version. In a selective-intelligence fleet you cannot attribute a decision to a model. CLI --help exits non-zero is the same class of failure at the harness seam.

Non-Negotiable Verification

Before deploying a policy built on this skill:

  1. Run the benchmark battery.

    python cli.py benchmark

    Confirms SRE cannot read cost, finance cannot traverse Library, Employee is invisible to every role, soft/hard erasure behave correctly, and the audit query filters PII-accessing decisions.

  2. Read a generated policy.

    python cli.py policy sre_oncall

    Confirm it GRANTs traversal on infra labels and DENYs read on cost properties and traversal on Employee/Compensation.

  3. Run the pitfall test against a real investigation.

    python cli.py audit sre_oncall --labels Service,Library,Metric

    Confirm functionally_complete is true — the SRE dependency workflow is not starved by the policy.

  4. Domain test in the notebook. Run notebooks/ch8-optimization.ipynb; confirm the governance section generates both roles, proves the SRE cannot see cost data, and attaches a governance record to the execution graph.

Security Posture

  • This IS the security control. The skill emits policy and answers access questions; the actual enforcement is Neo4j Enterprise applying the emitted GRANT/DENY at query time. Generating a policy is not enforcing it — apply it to the database.
  • Security transparency by construction. can_traverse returning False models invisibility; do not "helpfully" surface a denied-node hint to the agent, which would re-open the boundary-probing surface.
  • PII stays out of the graph. Under Privacy-by-Architecture the graph holds only UUIDs; never write name/email/PII onto graph nodes. If PII appears on a node, the erasure guarantees break.
  • Governance metadata is append-only. Compliance records must be immutable; do not mutate a governance record after the decision it describes.

Composition

  • Ties into model-routing-selector / cost-performance-scorer (Ch8): the governance record's model_id/model_version attribute each decision to the model that produced it in a selective-intelligence fleet.
  • Extends the Chapter-7 execution graph: governance metadata is added to the existing execution-graph nodes, so the compliance artifact needs no new store.
  • Composes with cloud IAM at the access_role seam — the graph role maps to the IAM role the agent connects under.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien), Chapter 8 — Optimization, "Data Governance and Access Control". Key references:

  • Neo4j Enterprise fine-grained access control (Example 8-5, Example 8-15)
  • Security transparency (invisible-not-denied) design principle
  • Mohamed et al. survey of property-graph access control (RBAC/ABAC/hybrid; plan a policy abstraction layer across engines)
  • Rehmer "Privacy by Architecture" (UUID separation, Identity Store join key)
  • GDPR Article 17 soft/hard erasure
  • KG.GOV governance framework + Example 8-6 governance metadata

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Subgraph Access Control?

Scope what each agent persona can see in a knowledge graph. Generates Neo4j fine-grained GRANT/DENY policy (traverse on node labels + relationship types, read on properties) per persona role, enforces security transparency (out-of-scope nodes are invisible, not access-denied), handles PII via the UUID-separation pattern with GDPR soft/hard erasure, and turns the Chapter-7 execution graph into a compliance artifact via governance metadata. Use for graph-backed agents where one unscoped query could traverse from a public catalog to employee records. NOT for relational row/table permissions, N...

Warum Subgraph Access Control in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Subgraph Access Control besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Subgraph Access Control in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/subgraph-access-control ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Subgraph Access Control nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Subgraph Access Control verwenden?

So viele Sie möchten. In TypingMind können Sie Subgraph Access Control mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Subgraph Access Control kostenlos?

Ja. Der Skill wird von AnthonyAlcaraz auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇