Security architecture

Your memory is encrypted.
AI gets only what you grant.

This page describes what travels between Codex, Claude or ChatGPT and .gram, how documents are encrypted at rest, how AI permissions are computed, and how the service runs on AWS in Korea behind Cloudflare.

Key specifications

Questions we hear most

“If I connect Codex, does data from my computer go to you?”

What travels →

“Where are documents stored, and who can read them?”

Storage → Infrastructure →

“How far can an AI read and write, and where does what it writes end up?”

Permissions → Records →

Here are the answers, one by one.

01 Connect

When you connect an AI, the server receives only the request

Codex, Claude and ChatGPT all send requests to one address (vault.thegram.one/mcp). The server accepts only what the request carries and returns only what the connection is allowed to see.

  • The plugin runs no code on your computer

    A plugin installs skill instructions, a server address setting and images. It declares no local MCP command, lifecycle hook or automatic package installation, and the source is public on GitHub under Apache-2.0.

  • Installing alone grants no access

    A connection exists only after you sign in with OAuth or configure an API key you created. Either way it works only within the permissions you granted per vault.

  • The server receives tool-call content only

    That means query conditions, document and record IDs, and content you allowed it to save. There is no path for the server to connect to your computer and read files, and folders that exist only locally are not visible to the server.

  • What an AI does on your computer is set on the AI's side

    How far Codex can read files and run commands is governed by Codex's own sandbox and approval settings. The .gram skill tells the AI to save only what the user asked it to keep and never to save passwords, keys or tokens. That rule is an instruction to the AI. What the server enforces is the permission model described below.

  • What an AI reads becomes part of its conversation

    A document the AI reads becomes part of that AI's conversation, and later handling follows that AI service's policy. That is why .gram limits what can be read, through permissions, in the first place.

MCP connection specification
ItemDetail
Endpointhttps://vault.thegram.one/mcp
TransportStreamable HTTP over TLS (HTTPS)
AuthenticationOAuth bearer when a browser sign-in is possible; otherwise a scoped API key sent as Authorization: Bearer tgk_...
Server receivesQuery conditions, document and record IDs, and the content and source references you allowed it to save
Server returnsContent of the vaults that connection is allowed to see
Local accessNone. The server never connects to your computer, and local-only folders are not visible to it

02 Storage

Documents are encrypted the moment they are stored

Each document and each history entry in a vault is encrypted per file with AES-256-GCM. Keys come in three levels.

  • Every vault has its own key

    The key of one vault cannot open another vault's documents. Purpose-specific subkeys are derived from the vault key with HKDF-SHA256, and the master key is kept apart from where the data lives.

  • Moved or tampered data will not decrypt

    Ciphertext is bound to its own vault and its own name. If it is moved elsewhere or a single character changes, authentication-tag verification fails and it does not open.

  • A failed decryption stops processing

    If the key does not match or the ciphertext is damaged, the operation fails on the spot instead of falling back to reading plaintext.

  • During processing, data is decrypted inside the server

    To search and to answer with AI, the server decrypts and reads documents. This is encryption at rest, not end-to-end encryption.

  • Deleted means deleted, and you can export your own file

    A deleted vault stays in the trash for 30 days and is then permanently deleted. Deleting an account also clears vault access, Drive connections and temporary caches. You can export a .gram file, history included, at any time.

03 Authentication and permissions

Every AI gets its own credential and its own permissions

An AI has to read content to answer. So the server decides what it may read and write, as permissions, before anything else.

Per-AI connection

Each AI has its own connection

The built-in AI, ChatGPT, Claude, Codex and coding agents each hold their own OAuth connection or API key. You set None, Read, Edit or Full per vault, keys carry an expiry, and a revoked key is refused from the next request.

ChatGPTNoneReadEditFull
ClaudeNoneReadEditFull

HR vault

  • Per-vault permissions
  • Expiry
  • Instant revoke
Permission math

The narrowest permission applies

An AI's permission is the lower of your role and the permission granted to the AI. In organization vaults, the cap set by the admin and the vault's AI access switch apply as well, and a switch that is off means None.

your role Edit
granted to the AI Read
organization cap Read
✓ effective permission: Read
  • none < read < write < delete
  • Switch off means none
Path binding

Each credential works on its own path

An API key (tgk_) is valid only on the MCP path and gets a 401 on the web app API. An MCP token cannot call the web app API, and a web app token cannot call MCP tools.

> MCP call with an API key
✓ allowed
> web app API call, same key
  401, rejected
  • MCP-only keys
  • Per-path credentials
Server enforced

The server does the blocking

The server checks permissions on every request. If a connection without write permission tries to write, the call ends with an AGENT_SCOPE_DENIED error, never an empty result or a success response. If permissions change mid-task, a running built-in AI task stops immediately.

  • Checked per request
  • Stops on change
Human approval

Changes to outside services stop at a proposal

Actions that change an external service, such as replying to mail or editing a calendar event, stop at a draft or proposal from the AI. A person has to confirm before anything happens.

AI: I prepared a reply draft Me: Confirmed, please send it
  • Drafts and proposals
  • Human confirmation
Key custody

Keys never reach the AI model

An API key is shown once at creation, and the server keeps only its SHA-256 hash. Tokens for connected outside services are never passed to the AI model either.

> create API key
✓ the key is shown once, now
● the server stores only a hash
  connected-service tokens are not passed to the AI
  • Shown once
  • Stored as a hash
How each credential is verified
CredentialValid onVerificationLifetime
Web session cookieWeb app /v1/*, /auth/*32 random bytes; the server stores only a SHA-256 hash. __Host- cookie, HttpOnly, SameSite=Lax, CSRF token30 days at most, expires after 7 idle days
OAuth bearer (web app)Web app APIJWT. Signature (ES384 or RS256), issuer, audience (aud) and expiry are checkedToken lifetime
OAuth bearer (MCP)/mcpSame checks, with aud set to the MCP resource and a signed client_id requiredToken lifetime
API key tgk_/mcp onlyThe access service compares the SHA-256 digest in constant time90 days by default, up to 200 per account
Built-in AI delegation tokenBuilt-in AI to MCPHMAC-SHA256. Expiry, active turn and scope_hash are re-checkedFor the duration of the turn

The path decides which credential counts. Only requests that arrive on the MCP listener accept MCP tokens and API keys, and public paths accept web app tokens only. An invalid bearer token never falls back to cookie authentication.

04 Data arriving over MCP

What an AI writes stays inside your vault

MCP is how AIs such as ChatGPT, Claude and Codex connect to .gram. Whatever an AI reads, the original stays in your one vault, and what it writes comes back here.

  1. STEP 1

    Connect

    Use OAuth when you can sign in through a browser. Coding agents and services that cannot do so connect with a scoped API key. There is one address, vault.thegram.one/mcp.

  2. STEP 2

    Check permissions

    On every read or write, the server checks your role, the permission granted to the AI and the organization cap.

  3. STEP 3

    Stored in your vault

    What an AI writes is saved as a new version of a .gram document in your vault, as records such as decisions, tasks and evidence. It is the same place and the same history as what people write.

Vault home showing users and AI activity: ChatGPT and Claude connected with OAuth, OMP with an API key, and activity scores
  • Who wrote it is recorded

    Every write is a new version stamped with author and time. Which AI connection wrote it is recorded from the connection ID the server authenticated, never from a name the AI reports about itself.

  • No overwriting

    If the document changed after the AI read it, the write is rejected, so nobody else's edit is overwritten.

  • Text inside documents is data, not instructions

    Sentences in search results and comments that appear to address an AI get a flag. Text written by an AI is never treated as a person's request, and no document can grant an AI permission to execute (execution_authorized is always false).

  • Temporary caches stay temporary

    Caches that speed up reads are kept apart from the vault original, and they are cleared when the server restarts and when an account is deleted.

  • You can undo and cut off

    A wrong write can be reviewed and rolled back from history, and revoking a key cuts the connection immediately.

05 Infrastructure and security stack

Run on AWS in Korea, with Cloudflare in front

The services customers connect to (vaults, authentication, the MCP gateway and the web app) run on AWS in Korea. Service domains sit behind the Cloudflare proxy, and a request passes through the layers below in order.

Layers a request passes through
LayerComponentRole
EdgeCloudflareDNS and proxy. TLS termination, HTTP/3, DDoS mitigation
TunnelCloudflare Tunnelcloudflared inside AWS carries requests over an encrypted connection that it opens outward to the edge
ApplicationAWS EC2 (Korea)Vaults, authentication, MCP gateway and web app. Per-client request limits on web and API paths
IdentityOIDC, Google, Apple, email codeSign-in and token issuance. The server verifies the JWT signature, issuer, audience and expiry itself
Key verificationAccess serviceCompares the SHA-256 digest of an API key in constant time
StorageAWS EBS, AWS KMSEncrypted records and indexes. Volumes are also encrypted with KMS keys

Operated on AWS in Korea

Services run on EC2 instances, and vault and sign-in data are stored on EBS volumes. The volumes are encrypted with AWS KMS keys, a layer that comes on top of the application-level encryption described above.

Cloudflare handles the front

Service domains sit behind Cloudflare's name servers and proxy, and cloudflared inside AWS receives requests over a connection it opens outward to the edge (Tunnel). TLS termination and DDoS mitigation happen at the edge.

Per-client request limits

Web app and API paths limit requests per second and concurrent requests for each client address, using the address Cloudflare passes along. On the MCP path, the gateway and the vault server cap concurrent processing.

The vault app uses a strict CSP

It starts from default-src 'self' and limits script-src and style-src to 'self', so inline scripts, inline styles and external scripts are not allowed. frame-ancestors 'none', COOP same-origin, Permissions-Policy (camera, microphone, geolocation, payment and USB denied) and nosniff are also sent on every response.

Sign-in uses standard protocols

Sign-in uses OIDC, with Google or Apple sign-in and email codes supported. The server verifies the signature, issuer, audience and expiry of each issued JWT itself.

Payment details go straight to the payment processor

Payments are handled by an outside payment processor. You enter payment details with the processor directly, and .gram receives only your email, subscription status, plan, period and amount.

How personal data is collected, kept and transferred abroad is described in the Privacy Policy.

06 Connecting

If you are cautious, start narrow

You do not have to open everything at first. Start with a read-only key and widen it when you need to.

  1. STEP 1

    Create a separate read-only key for each AI

    In Settings, create an API key and grant read permission only. Add edit permission only when writes are needed. Do not paste a key into chat, a command line or a repository; keep it in an environment variable.

  2. STEP 2

    Open only the vaults the AI works in

    Leave out vaults that hold personal information and select only what is needed. Keys expire within 90 days. You cannot grant more than your own role or your organization's policy allows.

  3. STEP 3

    Watch activity, and cut off when needed

    Vault home shows reads and writes per AI connection. Revoking a connection or key at vault.thegram.one/settings/agents blocks it from the next request.

Plugin sources are public on GitHub: thegram-plugin for Claude, thegram-plugin-codex for Codex and ChatGPT, and thegram-plugin-api for API keys.

Questions?
Ask us anything

Send security questions to [email protected].

Get .gram free
The shared .gram brain