Logo Subgraph Access Control

Subgraph Access Control

Cộng đồng
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).

Tổng quan

Nhà phát hànhAnthonyAlcaraz
Kho mãagentic-graph-rag-skills
Tên kỹ năngsubgraph-access-control
Sao
29
Bản fork
9
Tệp đi kèm
2
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được AnthonyAlcaraz công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Subgraph Access Control trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/subgraph-access-control
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Subgraph Access Control trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Subgraph Access Control ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Subgraph Access Control với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Subgraph Access Control làm được gì?

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...

Vì sao nên dùng Subgraph Access Control trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Subgraph Access Control là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Subgraph Access Control trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/optimization/subgraph-access-control. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Subgraph Access Control?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Subgraph Access Control với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Subgraph Access Control với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Subgraph Access Control có miễn phí không?

Có. Kỹ năng này được AnthonyAlcaraz phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇