Your LLM Wiki Compiles Away Your Permissions. Design for It Before the Team Uses It.
A short thread on X last week put the LLM wiki vs. RAG debate better than most long posts do: a wiki compiles knowledge when a source arrives; RAG retrieves at question time, so per-user permissions and citations stay in
A short thread on X last week put the LLM wiki vs. RAG debate better than most long posts do: a wiki compiles knowledge when a source arrives; RAG retrieves at question time, so per-user permissions and citations stay intact. That line matters most to people taking the trending personal second-brain setups to their team.
And right now a lot of people are. Karpathy's LLM Wiki idea file, Garry Tan's open-sourced gbrain, and the Claude Code + Obsidian vault repos are being cloned by the thousand. They work well for one person, because one person has one permission level: everything. The trouble starts when the same pattern is pointed at a shared drive with HR folders, customer escalations, and board notes in it.
This post is about that one gap. It's not a case against LLM wikis. I think they are the right shape for a lot of team knowledge. But the compile step quietly erases your access model unless you design for it.
Why compiling flattens permissions
In the LLM wiki pattern, raw sources stay immutable and an agent writes a linked set of markdown pages that summarize, cross-reference, and update as new sources land. You get answers that are already synthesized, instead of re-deriving them from chunks on every query.
Now picture the page the agent writes for a customer:
- a public case study (everyone can read it)
- a sales call note (sales team only)
- a legal escalation about a contract dispute (legal and two execs)
The agent does what it was asked and writes a good page: "Acme: renewal at risk; dispute over SLA credits; legal involved since October." That page now holds facts from the most restricted source, and it sits in a folder whose permissions were set for the least restricted one.
Citations don't fix this. Even if the page links back to a source the reader can't open, the reader has already read the sentence. A derived fact inherits the sensitivity of its most sensitive input, and a compiled page is made of derived facts.
RAG with permission-aware retrieval doesn't have this failure mode, because it filters source passages per user before generation. What it gives up is the compounding synthesis that makes a wiki useful.
You don't have to pick one. You do have to decide, page by page, where the access check happens.
Rule 1: a page's audience is the intersection of its sources' audiences
The simplest rule that holds up: the agent may only write a page into a scope that every source used for that page is visible to. In set terms, the page's allowed readers are the intersection of each source's allowed readers.
Make it machine-checkable. Put the sources in frontmatter:
---
title: "Acme account summary"
scope: sales
sources:
- id: case-study-acme-2025
acl: [everyone]
- id: call-note-2026-10-02
acl: [sales]
- id: legal-escalation-114
acl: [legal, exec]
---
Then refuse the write when the declared scope is broader than what the sources allow:
EVERYONE = "everyone"
def allowed_readers(sources, groups):
"""Intersect source ACLs. 'everyone' expands to all known groups."""
result = set(groups)
for s in sources:
acl = set(groups) if EVERYONE in s["acl"] else set(s["acl"])
result &= acl
return result
def check_page(page, groups):
readers = allowed_readers(page["sources"], groups)
if page["scope"] not in readers:
raise PermissionError(
f"{page['title']}: scope '{page['scope']}' exceeds sources; "
f"allowed: {sorted(readers) or 'nobody'}"
)
groups = {"sales", "legal", "exec", "eng", "people"}
# The Acme page above fails: sales ∩ {legal, exec} is empty.
When the intersection comes back empty, that's useful information. It means the page shouldn't exist as one page. Split it: a sales-scoped summary that leaves out the escalation, and a legal-scoped page that adds it. Agents are good at writing two versions. They are bad at guessing which version you meant.
Run this check in the agent's write path, not as a nightly lint. By the time a nightly job runs, the page has already been indexed, quoted, and pasted into Slack.
Rule 2: provenance is a field, not a footnote
Most LLM wiki setups ask the agent to cite sources. Few treat those citations as data the system acts on. Treat them as data, because permissions change after the page is written:
- someone is moved off the deal team
- a doc is reclassified after an incident
- a source is deleted for legal reasons
Each of those should invalidate every page built from it. If provenance lives in frontmatter, finding those pages is a query:
def pages_to_recompile(pages, changed_source_id):
return [p["title"] for p in pages
if any(s["id"] == changed_source_id for s in p["sources"])]
Recompile or quarantine those pages, then run Rule 1 again. Without this, your wiki slowly drifts back to the access model of the day each page was written. Stale facts are annoying. Stale permissions are a security incident.
Rule 3: route by sensitivity, not by convenience
Not everything needs to be compiled. A practical split:
| Knowledge | Where it should live | Why |
|---|---|---|
| Glossary, architecture decisions, runbooks, onboarding | Compiled wiki, broad scope | Stable, low sensitivity, gains the most from synthesis |
| Team-specific playbooks, project status | Compiled wiki, per-team scope | Moderate sensitivity; one audience per page |
| HR cases, deal terms, legal, incident forensics | Query-time retrieval with per-user filtering | High sensitivity; access changes often |
| Anything with mixed audiences you can't split cleanly | Don't compile it | The intersection is empty; that is the answer |
The agent can still answer questions about the bottom rows. It just answers from sources it fetched for that user at that moment, not from a page it wrote for everyone last Tuesday.
Rule 4: test it like an attacker with a low-privilege account
Before an internal AI knowledge assistant goes live, run some version of this test:
- Create a test account with the lowest real permission level, like a new contractor.
- Write ten questions whose answers exist only in restricted sources: a salary band, a deal discount, an open incident.
- Ask them directly, then indirectly ("summarize everything about Acme", "what changed in the comp policy?").
- Check four places, not one: the answer, any snippets or previews, the citations list, and any saved output the assistant wrote back to the workspace.
- Repeat after every change to the compile prompt or the folder structure.
A pass is not "the agent refused." A pass is "the restricted fact appears nowhere the test account can see."
Where the tooling choice actually matters
None of these rules depend on a specific product. But two properties make them much easier.
Permissions should live on the documents themselves, in the same system the agent reads from and writes to. If the agent compiles from a file dump and writes to a folder of markdown, you are rebuilding an access model by hand on top of a filesystem that never had one. A workspace-based knowledge base software setup, where docs, roles, and sharing settings sit together, gives Rule 1 something real to intersect. AFFiNE's write-up on AI workspace permissions walks through the role and data-access checks worth running, and it lines up closely with the leak test above.
The compile step should run where your data already lives. Compiling means the model reads everything, including the restricted sources, in order to decide what not to write. If that model is a third-party API, your most sensitive documents are leaving the building on every compile, no matter how careful the output is. Running the compile on self-hosted AI infrastructure keeps that step inside your own boundary.
This is the main reason I'd pick an AI knowledge base software stack you can self-host for team use, over a personal vault plus a cloud agent. Something in the open source Notion alternative category gives you docs, permissions, and a deployment you control in one place, so the agent's reads and writes stay inside the same access model your people already use.
A checklist before you point your second-brain repo at the team drive
- [ ] Every compiled page lists its sources and their ACLs in frontmatter.
- [ ] The write path rejects pages whose scope is broader than the intersection of their sources.
- [ ] Changes to a source's permissions trigger recompile or quarantine of dependent pages.
- [ ] High-sensitivity domains are answered at query time with per-user filtering, not compiled.
- [ ] The compile model runs inside your own infrastructure, or never sees restricted sources.
- [ ] A low-privilege leak test runs before launch and after every compile-prompt change.
The LLM wiki pattern took off because it treats knowledge as something you build once and keep current, not something you rediscover on every query. That is still the right instinct for teams. Just remember that when you compile the knowledge, you compile the access decisions too, so make the agent write them down.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.

