01 / institutional memoryAll Souls / ordered-dither and character lattice

Documentation

Set up Frege for agents.

Frege is hosted. Users manage the browser app; agents install a small local CLI. The only MCP server customers run is frege mcp serve, and it only calls Frege APIs with a verified key.

Human app
https://brain.frege.devWhere users sign in, manage orgs, billing, roles, API keys, and memory review.
API base
https://frege.devWhat the CLI and MCP server call for /api/v1 routes unless Frege support gives another base.
CLI package
@frege-dev/cliPublic npm package that installs the frege and frege-mcp commands.
MCP command
frege mcp serveLocal stdio server used by Codex, Claude Code, and other MCP clients.

Fast path

The simplest successful setup is: create an account, create a valid API key, give the agent the install prompt, then verify MCP with frege_status. No one should hand-edit secrets into MCP JSON.

1

Create the account

The user signs up, activates billing through Stripe, then opens the Frege control plane.

2

Create an API key

An admin creates a scoped key for an active org and a specific role. The raw key is shown once.

3

Hand setup to an agent

Give the agent the prompt below plus the key through a private channel. The agent installs the CLI and verifies the key.

4

Use Frege from MCP

The MCP client calls frege_status first, then searches, reads, builds context, and pushes approved docs.

The CLI can install without an API key, but Frege is not connected until frege connect verifies a valid key from an active org.

Who does what

Installation is clearer when the browser work and terminal work are kept separate. The user owns billing, org setup, and keys. The agent owns local CLI setup after the user provides a key.

User/adminCreate account, choose plan, create roles, generate keys, review memory proposals.Browser app
Local agentInstall @frege-dev/cli, run frege connect, register frege mcp serve, push approved markdown.Terminal
FregeValidate the key, enforce org and role scope, record supported context and write paths, reject inactive orgs.Hosted API

Admins use the protected control plane to create organizations, invite members, define roles, generate API keys, inspect sessions, and review memory proposals.

API keys

Every agent connects with a per-identity API key issued from the control plane. Keys inherit the role of the user they belong to, so an agent sees exactly what that role is allowed to see.

  1. Open the control plane.
  2. Choose the organization.
  3. Create or select an agent role.
  4. Create an API key for that role and owner.
  5. Copy the raw frg_live_... key immediately. It is shown once.

The org must be active, the key must be unrevoked, and frege connectmust verify it before MCP tools can read or write Frege context.

Install with an agent

This is the recommended customer workflow. Paste the prompt into Codex, Claude Code, or another local coding agent. Provide the API key separately and tell the agent not to echo it.

copy into agent
Frege MCP install prompt
Install Frege MCP for this machine.

Inputs:
- API base: https://frege.dev
- I will provide FREGE_API_KEY separately. It starts with frg_live_.

Important:
- The browser app may open on https://brain.frege.dev. That is fine.
- MCP uses the API base above for /api/v1 calls.
- You may install the CLI without a key.
- Do not treat MCP as ready until frege connect and frege doctor both succeed.
- Do not print the full key or put it in MCP JSON, docs, screenshots, shell startup files, or chat summaries.

Steps:
1. Confirm Node.js 20+ and npm are available.
2. Run: npm install -g @frege-dev/cli
3. Verify: command -v frege && frege help
4. If npm reports EEXIST or frege is not found, use https://frege.dev/docs troubleshooting.
5. Connect with the key I provide:
   frege connect https://frege.dev --token "$FREGE_API_KEY"
6. Run: frege doctor
7. Show me only org, orgStatus, role, and key prefix.
8. If connect or doctor fails, stop and ask for a valid key from an active org.
9. Register MCP:
   frege agent install codex
   frege agent install claude
   If neither is available, configure command "frege" with args ["mcp", "serve"].
10. From the MCP client, call frege_status and confirm it matches frege doctor.

Browser traffic may land on brain.frege.dev. MCP does not depend on that subdomain. It uses https://frege.dev for /api/v1 calls unless Frege support gives a customer-specific API base.

Install the CLI

If you are doing the setup yourself instead of through an agent, install the public npm package and verify the command is on your path.

Install

npm install -g @frege-dev/cli
command -v frege
frege help

Connect

frege connect https://frege.dev --token "$FREGE_API_KEY"
frege doctor

frege connect verifies the key, saves local config at ~/.frege/mcp/config.json, prints org status, and tries to register MCP clients it can detect.

Path fixes

If zsh says frege: command not found, add npm's global bin directory to your shell path.

npm config get prefix

echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
hash -r

command -v frege
frege help

GUI-launched MCP clients may still miss your shell path. In that case, use the full path from command -v frege as the MCP command.

Register MCP

Usually frege connect handles this for you. If a client was not detected, register it explicitly after frege doctor succeeds.

Preferred

frege agent install codex
frege agent install claude

Generic MCP JSON

{
  "mcpServers": {
    "frege": {
      "command": "frege",
      "args": ["mcp", "serve"]
    }
  }
}

The API key belongs in ~/.frege/mcp/config.json, not MCP client JSON. If frege_status does not match frege doctor, the setup is not complete.

Push markdown documents

Agents should load user-approved markdown through the CLI. The terminal shows exactly what was pushed, and Frege records the write through the same org, role, and audit controls as MCP.

demo workflow
push docs into Frege
# One file
frege docs push docs/INVESTOR_DEMO_WORKFLOW.md \
  --sensitivity internal \
  --tag frege-demo \
  --tag operations

# Preview a directory before writing
frege docs push docs \
  --include "**/*.md" \
  --exclude "**/HANDOFF.md" \
  --sensitivity internal \
  --dry-run

# Repeatable manifest sync
frege docs sync frege.docs.yml --dry-run
frege docs sync frege.docs.yml
frege docs list
frege context "how does Frege signup work?"

Markdown wikilinks such as [[hosted brain architecture]] are preserved. For canonical graph-connected brain pages, ask the agent to submit a reviewable wikilinked page proposal with frege_write_page_proposal.

Agent rules

Give these rules to an agent after Frege is connected. They keep day-to-day task activity in sessions while durable knowledge changes go through review.

  • Before answering from company memory, call frege_build_context.
  • Search with frege_search_pages and read specifics with frege_get_page.
  • Cite document or page slugs when using Frege context.
  • Start a session for substantial work and append important events.
  • Preserve wikilinks like [[self-serve signup]] in approved markdown.
  • Submit durable changes with frege_write_page_proposal; do not silently rewrite canonical memory.
  • If Frege reports denied context, do not guess around it.

MCP tools

The MCP server calls Frege-hosted APIs with the scoped API key. It never reads the database directly.

frege_statusConfirm org, role, key prefix, and connectivity.
frege_brain_statusInspect hosted brain status, indexed pages, and source counts.
frege_list_sourcesList hosted brain sources visible to the caller.
frege_search_pagesSearch brain pages the caller is allowed to see.
frege_get_pageRead a specific page and its revisions.
frege_list_vaultList visible pages with outgoing-link and backlink counts.
frege_page_linksInspect outgoing links, backlinks, and unresolved links for a page.
frege_traverseTraverse a visible neighborhood in the hosted page-link graph.
frege_find_connectionsFind a visible link path between two hosted pages.
frege_add_source_proposalPropose a new source for administrator review.
frege_build_contextAssemble scoped, cited context for a task before answering.
frege_create_documentCreate a document from user-approved markdown.
frege_read_documentRead a visible document by slug.
frege_list_documentsList documents visible to the current API key.
frege_search_documentsSearch visible documents by text, title, path, or tag.
frege_write_page_proposalSubmit a reviewable update instead of editing canonical knowledge.
frege_propose_revisionPropose a revision to a visible legacy document.
frege_propose_memory_from_sessionCreate a memory proposal backed by recorded session evidence.
frege_start_sessionOpen a session ledger for a substantial workflow.
frege_append_session_eventRecord task activity onto the active session.
frege_get_sessionRead a visible agent session and its events.
frege_search_sessionsSearch organization-visible sessions when the role permits it.
frege_list_agentsList Frege-hosted agents available to this org and role.
frege_run_agentQueue hosted agent work when the key has execution permission.
frege_get_agent_runRead status and output for a hosted agent run.
frege_audit_eventsList legacy audit events visible to the current role.
frege_invoke_modelInvoke an organization-configured model with governed context.

Troubleshooting

EEXIST during npm install

npm uninstall -g @frege/cli @frege-dev/cli
rm -f ~/.local/bin/frege ~/.local/bin/frege-mcp
npm install -g @frege-dev/cli

Invalid key

frege connect https://frege.dev --token "$FREGE_API_KEY"
frege doctor

If frege doctor fails, the key may be invalid, revoked, expired, or attached to an inactive org. Create a new key in the control plane with the correct role, then reconnect. If Node is too old, install Node.js 20 or newer.

Security

  • ~/.frege/mcp/config.json is local secret state. Do not commit it.
  • Prefer frege connect over storing FREGE_API_KEY in MCP JSON.
  • Rotate the API key in Frege admin if it appears in logs, shell history, screenshots, chat, or committed files.
  • Admins can revoke keys from the control plane at any time.
  • Use npm now. Homebrew can come later when release tarballs, checksums, and a tap are stable.