Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    News Module
    Member Blogs
    Public Profile Pages
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    News Module
    Member Blogs
    Public Profile Pages
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    News Module
    Member Blogs
    Public Profile Pages
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    1. Docs
    2. /Features
    3. /Admin Wiki

    Updated Jul 20, 20265 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    1. Docs
    2. /Features
    3. /Admin Wiki

    Updated Jul 20, 20265 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    1. Docs
    2. /Features
    3. /Admin Wiki

    Updated Jul 20, 20265 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    Admin Wiki

    Use Founder / Developer tabs in the docs sidebar to filter this page. Admin Wiki is a compounding project knowledge base (Markdown + [[wikilinks]]) — not the filesystem /docs MDX library and not TipTap news HTML.

    Ring clones store operational knowledge in a Postgres vault: tenant-wide pages plus optional project-order spaces. Humans edit at /admin/wiki and on Order Lab desks; agents search and mutate through ring-mcp using the same WikiKernel.

    LayerWhere
    UI/admin/wiki · buyer /my-orders/[id] · integrator /my-jobs/[id]
    NavAdmin supermenu Content & Blog → Wiki · right rail title + actions
    Kernelfeatures/wiki/** (wiki-service.ts, ACL, wikilinks, search)
    Collectionswiki_pages, wiki_links, wiki_events
    Migrationdata/migrations/040_wiki_pages.sql
    HTTP/api/wiki, /api/wiki/[id]
    MCP/api/mcp/v1/wiki* · tools ring-wiki-*

    Why this matters for your clone

    Chat and tickets forget. A wiki compiles what your clone knows about a settler project: brand decisions, deploy notes, integrator handoffs — with links that stay current.

    Admin console

    Wiki appears in the Admin supermenu under Content & Blog, and in the right rail beside the editor.

    Owner Project Lab

    Each paid project order can open a project vault on buyer and integrator desks.

    CRM project orders

    Jump from Wiki actions to /admin/crm/orders when a page belongs to a ringization job.

    Ring MCP

    Implementation

    WikiKernel owns ACL, link graph, search envelope, and events. Adapters are thin: Admin UI, desk panel, HTTP, MCP.

    Domain

    • vaultKey: TypeScript union tenant | po:{projectOrderId} — a page field, not an env var and not a ring-config key.
    • Body SSOT: bodyMarkdown (not TipTap news HTML) — Admin UI edits via TipTap rich preview with Source Markdown toggle; save still persists Markdown.
    • Wikilink parser: ignores fenced + inline code (docs examples do not create graph edges).
    • Lint: ring-wiki-lint / Lint vault; Create stubs auto-creates draft concept pages for real missing_page issues.
    • Graph SSOT: wiki_links edges (local | tenant_ref)
    • Catalog: derived list/search — no maintained _index.md
    • Ops log: wiki_events append-only
    • Special page: tenant _schema (agent constitution) seeded on first open; legacy example-link body is one-shot repaired on ensure
    • Tree: folder tree absorbed from file-registry-viewer (buildTree / expand / folder counts / ranked quick search)
    VaultKey is not an env var

    VaultKey is only a TypeScript type in features/wiki/types.ts. Do not add VAULT_KEY to .env or ring-config.json. A 'use server' file must not re-export types or sync helpers — Next treats every export as a server action and type re-exports become runtime ReferenceError: VaultKey is not defined. Keep actions in as async functions only; import types from .

    Related documentation

    Admin console

    Next-step: Admin console nav SSOT — Wiki lives under Content & Blog and in the right rail.

    Owner Project Lab

    Same-workflow: project vaults open on buyer My Projects and integrator Order Lab desks; CRM orders desk is a rail action.

    Ring MCP Server

    Depends-on: ring-wiki-* tools ride the same MCP service token as news/entity tools.

    News Module

    See-also: TipTap news HTML is a different CMS — do not store wiki bodies there.

    Admin Wiki

    Use Founder / Developer tabs in the docs sidebar to filter this page. Admin Wiki is a compounding project knowledge base (Markdown + [[wikilinks]]) — not the filesystem /docs MDX library and not TipTap news HTML.

    Ring clones store operational knowledge in a Postgres vault: tenant-wide pages plus optional project-order spaces. Humans edit at /admin/wiki and on Order Lab desks; agents search and mutate through ring-mcp using the same WikiKernel.

    LayerWhere
    UI/admin/wiki · buyer /my-orders/[id] · integrator /my-jobs/[id]
    NavAdmin supermenu Content & Blog → Wiki · right rail title + actions
    Kernelfeatures/wiki/** (wiki-service.ts, ACL, wikilinks, search)
    Collectionswiki_pages, wiki_links, wiki_events
    Migrationdata/migrations/040_wiki_pages.sql
    HTTP/api/wiki, /api/wiki/[id]
    MCP/api/mcp/v1/wiki* · tools ring-wiki-*

    Why this matters for your clone

    Chat and tickets forget. A wiki compiles what your clone knows about a settler project: brand decisions, deploy notes, integrator handoffs — with links that stay current.

    Admin console

    Wiki appears in the Admin supermenu under Content & Blog, and in the right rail beside the editor.

    Owner Project Lab

    Each paid project order can open a project vault on buyer and integrator desks.

    CRM project orders

    Jump from Wiki actions to /admin/crm/orders when a page belongs to a ringization job.

    Ring MCP

    Implementation

    WikiKernel owns ACL, link graph, search envelope, and events. Adapters are thin: Admin UI, desk panel, HTTP, MCP.

    Domain

    • vaultKey: TypeScript union tenant | po:{projectOrderId} — a page field, not an env var and not a ring-config key.
    • Body SSOT: bodyMarkdown (not TipTap news HTML) — Admin UI edits via TipTap rich preview with Source Markdown toggle; save still persists Markdown.
    • Wikilink parser: ignores fenced + inline code (docs examples do not create graph edges).
    • Lint: ring-wiki-lint / Lint vault; Create stubs auto-creates draft concept pages for real missing_page issues.
    • Graph SSOT: wiki_links edges (local | tenant_ref)
    • Catalog: derived list/search — no maintained _index.md
    • Ops log: wiki_events append-only
    • Special page: tenant _schema (agent constitution) seeded on first open; legacy example-link body is one-shot repaired on ensure
    • Tree: folder tree absorbed from file-registry-viewer (buildTree / expand / folder counts / ranked quick search)
    VaultKey is not an env var

    VaultKey is only a TypeScript type in features/wiki/types.ts. Do not add VAULT_KEY to .env or ring-config.json. A 'use server' file must not re-export types or sync helpers — Next treats every export as a server action and type re-exports become runtime ReferenceError: VaultKey is not defined. Keep actions in as async functions only; import types from .

    Related documentation

    Admin console

    Next-step: Admin console nav SSOT — Wiki lives under Content & Blog and in the right rail.

    Owner Project Lab

    Same-workflow: project vaults open on buyer My Projects and integrator Order Lab desks; CRM orders desk is a rail action.

    Ring MCP Server

    Depends-on: ring-wiki-* tools ride the same MCP service token as news/entity tools.

    News Module

    See-also: TipTap news HTML is a different CMS — do not store wiki bodies there.

    Admin Wiki

    Use Founder / Developer tabs in the docs sidebar to filter this page. Admin Wiki is a compounding project knowledge base (Markdown + [[wikilinks]]) — not the filesystem /docs MDX library and not TipTap news HTML.

    Ring clones store operational knowledge in a Postgres vault: tenant-wide pages plus optional project-order spaces. Humans edit at /admin/wiki and on Order Lab desks; agents search and mutate through ring-mcp using the same WikiKernel.

    LayerWhere
    UI/admin/wiki · buyer /my-orders/[id] · integrator /my-jobs/[id]
    NavAdmin supermenu Content & Blog → Wiki · right rail title + actions
    Kernelfeatures/wiki/** (wiki-service.ts, ACL, wikilinks, search)
    Collectionswiki_pages, wiki_links, wiki_events
    Migrationdata/migrations/040_wiki_pages.sql
    HTTP/api/wiki, /api/wiki/[id]
    MCP/api/mcp/v1/wiki* · tools ring-wiki-*

    Why this matters for your clone

    Chat and tickets forget. A wiki compiles what your clone knows about a settler project: brand decisions, deploy notes, integrator handoffs — with links that stay current.

    Admin console

    Wiki appears in the Admin supermenu under Content & Blog, and in the right rail beside the editor.

    Owner Project Lab

    Each paid project order can open a project vault on buyer and integrator desks.

    CRM project orders

    Jump from Wiki actions to /admin/crm/orders when a page belongs to a ringization job.

    Ring MCP

    Implementation

    WikiKernel owns ACL, link graph, search envelope, and events. Adapters are thin: Admin UI, desk panel, HTTP, MCP.

    Domain

    • vaultKey: TypeScript union tenant | po:{projectOrderId} — a page field, not an env var and not a ring-config key.
    • Body SSOT: bodyMarkdown (not TipTap news HTML) — Admin UI edits via TipTap rich preview with Source Markdown toggle; save still persists Markdown.
    • Wikilink parser: ignores fenced + inline code (docs examples do not create graph edges).
    • Lint: ring-wiki-lint / Lint vault; Create stubs auto-creates draft concept pages for real missing_page issues.
    • Graph SSOT: wiki_links edges (local | tenant_ref)
    • Catalog: derived list/search — no maintained _index.md
    • Ops log: wiki_events append-only
    • Special page: tenant _schema (agent constitution) seeded on first open; legacy example-link body is one-shot repaired on ensure
    • Tree: folder tree absorbed from file-registry-viewer (buildTree / expand / folder counts / ranked quick search)
    VaultKey is not an env var

    VaultKey is only a TypeScript type in features/wiki/types.ts. Do not add VAULT_KEY to .env or ring-config.json. A 'use server' file must not re-export types or sync helpers — Next treats every export as a server action and type re-exports become runtime ReferenceError: VaultKey is not defined. Keep actions in as async functions only; import types from .

    Related documentation

    Admin console

    Next-step: Admin console nav SSOT — Wiki lives under Content & Blog and in the right rail.

    Owner Project Lab

    Same-workflow: project vaults open on buyer My Projects and integrator Order Lab desks; CRM orders desk is a rail action.

    Ring MCP Server

    Depends-on: ring-wiki-* tools ride the same MCP service token as news/entity tools.

    News Module

    See-also: TipTap news HTML is a different CMS — do not store wiki bodies there.

    Agents self-build and query the vault without opening the UI.

    Typical scenarios

    1. Platform playbook — Admins keep tenant pages for “how we ringize”, payment rails, and support macros.
    2. Per-order brain — Buyer and integrator share a po:{orderId} vault for that clone’s decisions (no secrets — those stay in Order Lab #secrets).
    3. Agent ingest — ring-mcp creates/updates concept pages, appends ops events, and lints dead [[wikilinks]].
    4. Cross-vault cite — From a project page, link platform concepts with [[@Payments]] or [[tenant:Payments]].

    Operator checklist

    • Open /admin/wiki as platform admin; confirm _schema seeded (title lives in the right rail).
    • Use rail Actions: CRM project orders, News, CRM tasks, Wiki docs.
    • Create a folder path (e.g. concepts) by setting path on new pages — folders are path prefixes, not empty docs.
    • Use [[Page]] for same-vault links; use [[@Title]] to cite tenant knowledge from a project vault.
    • On /my-orders/[id] or /my-jobs/[id], use Project Wiki for that order only.
    • Never paste Firebase keys or RingBase tokens into wiki bodies.

    Who can write what

    ActorTenant vaultProject vault
    Admin / BuyerFull read/writeFull (own orders)
    IntegratorRead + append-onlyFull (assigned orders)
    Agent (ring-mcp)Read onlyFull
    app/_actions/wiki.ts
    @/features/wiki/types

    Wikilinks

    FormResolve
    [[slug]] / [[Title]] / [[path/slug]] / [[Page|display]]Same vault
    [[@Payments]] / [[tenant:Payments]]Tenant vault

    Module map

    ConcernPath
    Types / ACL / parser / searchfeatures/wiki/types.ts, acl.ts, wikilink-parser.ts, search-score.ts
    Servicefeatures/wiki/wiki-service.ts
    Actor resolve (buyer/integrator)features/wiki/resolve-wiki-actor.ts
    Admin workspacefeatures/wiki/components/wiki-workspace.tsx
    Desk panelfeatures/wiki/components/wiki-desk-panel.tsx
    Server actionsapp/_actions/wiki.ts (async exports only)
    Right railadmin-nav-config rail section wiki + admin-rail.tsx
    MCP routesapp/api/mcp/v1/wiki/**
    BackendSelectorwiki_pages, wiki_links, wiki_events

    ring-mcp tools

    ToolRole
    ring-wiki-searchLegiox-shaped matches[] (lexical)
    ring-wiki-list / getCatalog + backlinks
    ring-wiki-create / update / deleteCRUD (confirm on delete); agent tenant create/write denied
    ring-wiki-lintOrphans / dead links
    ring-wiki-eventsList or append ops log
    1. 1

      Apply migration

      bash
      
      psql "$DATABASE_URL" -f data/migrations/040_wiki_pages.sql

      Also present in data/schema.sql for fresh installs. No wiki-specific env vars are required beyond the existing Postgres DATABASE_URL / MCP service token.

    2. 2

      Call WikiService from adapters only

      typescript
      
      import * as WikiService from '@/features/wiki/wiki-service'
      import { resolveWikiActor } from '@/features/wiki/resolve-wiki-actor'
      import type { VaultKey } from '@/features/wiki/types'
      
      const actor = await resolveWikiActor({
        userId: session.user.id,
        role: session.user.role,
        orderId, // when scoping a project vault
      })
      await WikiService.ensureTenantSchema(actor)
      const vault: VaultKey = 'tenant'
      const pages = await WikiService.listPages(actor, vault)

      MCP handlers set isAgent: true so tenant write rules apply even if the service token role is superadmin.

    3. 3

      Append vs replace

      typescript
      
      await WikiService.updatePage(actor, pageId, {
        bodyMarkdown: '## Note\nIntegrator addendum…',
        mode: 'append', // required for integrator on tenant
      })
    Secrets boundary

    Wiki must not store Order Lab env secrets. Link operators to #secrets / project-config panels instead (features/crm/orders/*).

    Data Model

    Deep-dive: JSONB collection pattern (`id` + `data`) used by wiki_pages and siblings.

    Agents self-build and query the vault without opening the UI.

    Typical scenarios

    1. Platform playbook — Admins keep tenant pages for “how we ringize”, payment rails, and support macros.
    2. Per-order brain — Buyer and integrator share a po:{orderId} vault for that clone’s decisions (no secrets — those stay in Order Lab #secrets).
    3. Agent ingest — ring-mcp creates/updates concept pages, appends ops events, and lints dead [[wikilinks]].
    4. Cross-vault cite — From a project page, link platform concepts with [[@Payments]] or [[tenant:Payments]].

    Operator checklist

    • Open /admin/wiki as platform admin; confirm _schema seeded (title lives in the right rail).
    • Use rail Actions: CRM project orders, News, CRM tasks, Wiki docs.
    • Create a folder path (e.g. concepts) by setting path on new pages — folders are path prefixes, not empty docs.
    • Use [[Page]] for same-vault links; use [[@Title]] to cite tenant knowledge from a project vault.
    • On /my-orders/[id] or /my-jobs/[id], use Project Wiki for that order only.
    • Never paste Firebase keys or RingBase tokens into wiki bodies.

    Who can write what

    ActorTenant vaultProject vault
    Admin / BuyerFull read/writeFull (own orders)
    IntegratorRead + append-onlyFull (assigned orders)
    Agent (ring-mcp)Read onlyFull
    app/_actions/wiki.ts
    @/features/wiki/types

    Wikilinks

    FormResolve
    [[slug]] / [[Title]] / [[path/slug]] / [[Page|display]]Same vault
    [[@Payments]] / [[tenant:Payments]]Tenant vault

    Module map

    ConcernPath
    Types / ACL / parser / searchfeatures/wiki/types.ts, acl.ts, wikilink-parser.ts, search-score.ts
    Servicefeatures/wiki/wiki-service.ts
    Actor resolve (buyer/integrator)features/wiki/resolve-wiki-actor.ts
    Admin workspacefeatures/wiki/components/wiki-workspace.tsx
    Desk panelfeatures/wiki/components/wiki-desk-panel.tsx
    Server actionsapp/_actions/wiki.ts (async exports only)
    Right railadmin-nav-config rail section wiki + admin-rail.tsx
    MCP routesapp/api/mcp/v1/wiki/**
    BackendSelectorwiki_pages, wiki_links, wiki_events

    ring-mcp tools

    ToolRole
    ring-wiki-searchLegiox-shaped matches[] (lexical)
    ring-wiki-list / getCatalog + backlinks
    ring-wiki-create / update / deleteCRUD (confirm on delete); agent tenant create/write denied
    ring-wiki-lintOrphans / dead links
    ring-wiki-eventsList or append ops log
    1. 1

      Apply migration

      bash
      
      psql "$DATABASE_URL" -f data/migrations/040_wiki_pages.sql

      Also present in data/schema.sql for fresh installs. No wiki-specific env vars are required beyond the existing Postgres DATABASE_URL / MCP service token.

    2. 2

      Call WikiService from adapters only

      typescript
      
      import * as WikiService from '@/features/wiki/wiki-service'
      import { resolveWikiActor } from '@/features/wiki/resolve-wiki-actor'
      import type { VaultKey } from '@/features/wiki/types'
      
      const actor = await resolveWikiActor({
        userId: session.user.id,
        role: session.user.role,
        orderId, // when scoping a project vault
      })
      await WikiService.ensureTenantSchema(actor)
      const vault: VaultKey = 'tenant'
      const pages = await WikiService.listPages(actor, vault)

      MCP handlers set isAgent: true so tenant write rules apply even if the service token role is superadmin.

    3. 3

      Append vs replace

      typescript
      
      await WikiService.updatePage(actor, pageId, {
        bodyMarkdown: '## Note\nIntegrator addendum…',
        mode: 'append', // required for integrator on tenant
      })
    Secrets boundary

    Wiki must not store Order Lab env secrets. Link operators to #secrets / project-config panels instead (features/crm/orders/*).

    Data Model

    Deep-dive: JSONB collection pattern (`id` + `data`) used by wiki_pages and siblings.

    Agents self-build and query the vault without opening the UI.

    Typical scenarios

    1. Platform playbook — Admins keep tenant pages for “how we ringize”, payment rails, and support macros.
    2. Per-order brain — Buyer and integrator share a po:{orderId} vault for that clone’s decisions (no secrets — those stay in Order Lab #secrets).
    3. Agent ingest — ring-mcp creates/updates concept pages, appends ops events, and lints dead [[wikilinks]].
    4. Cross-vault cite — From a project page, link platform concepts with [[@Payments]] or [[tenant:Payments]].

    Operator checklist

    • Open /admin/wiki as platform admin; confirm _schema seeded (title lives in the right rail).
    • Use rail Actions: CRM project orders, News, CRM tasks, Wiki docs.
    • Create a folder path (e.g. concepts) by setting path on new pages — folders are path prefixes, not empty docs.
    • Use [[Page]] for same-vault links; use [[@Title]] to cite tenant knowledge from a project vault.
    • On /my-orders/[id] or /my-jobs/[id], use Project Wiki for that order only.
    • Never paste Firebase keys or RingBase tokens into wiki bodies.

    Who can write what

    ActorTenant vaultProject vault
    Admin / BuyerFull read/writeFull (own orders)
    IntegratorRead + append-onlyFull (assigned orders)
    Agent (ring-mcp)Read onlyFull
    app/_actions/wiki.ts
    @/features/wiki/types

    Wikilinks

    FormResolve
    [[slug]] / [[Title]] / [[path/slug]] / [[Page|display]]Same vault
    [[@Payments]] / [[tenant:Payments]]Tenant vault

    Module map

    ConcernPath
    Types / ACL / parser / searchfeatures/wiki/types.ts, acl.ts, wikilink-parser.ts, search-score.ts
    Servicefeatures/wiki/wiki-service.ts
    Actor resolve (buyer/integrator)features/wiki/resolve-wiki-actor.ts
    Admin workspacefeatures/wiki/components/wiki-workspace.tsx
    Desk panelfeatures/wiki/components/wiki-desk-panel.tsx
    Server actionsapp/_actions/wiki.ts (async exports only)
    Right railadmin-nav-config rail section wiki + admin-rail.tsx
    MCP routesapp/api/mcp/v1/wiki/**
    BackendSelectorwiki_pages, wiki_links, wiki_events

    ring-mcp tools

    ToolRole
    ring-wiki-searchLegiox-shaped matches[] (lexical)
    ring-wiki-list / getCatalog + backlinks
    ring-wiki-create / update / deleteCRUD (confirm on delete); agent tenant create/write denied
    ring-wiki-lintOrphans / dead links
    ring-wiki-eventsList or append ops log
    1. 1

      Apply migration

      bash
      
      psql "$DATABASE_URL" -f data/migrations/040_wiki_pages.sql

      Also present in data/schema.sql for fresh installs. No wiki-specific env vars are required beyond the existing Postgres DATABASE_URL / MCP service token.

    2. 2

      Call WikiService from adapters only

      typescript
      
      import * as WikiService from '@/features/wiki/wiki-service'
      import { resolveWikiActor } from '@/features/wiki/resolve-wiki-actor'
      import type { VaultKey } from '@/features/wiki/types'
      
      const actor = await resolveWikiActor({
        userId: session.user.id,
        role: session.user.role,
        orderId, // when scoping a project vault
      })
      await WikiService.ensureTenantSchema(actor)
      const vault: VaultKey = 'tenant'
      const pages = await WikiService.listPages(actor, vault)

      MCP handlers set isAgent: true so tenant write rules apply even if the service token role is superadmin.

    3. 3

      Append vs replace

      typescript
      
      await WikiService.updatePage(actor, pageId, {
        bodyMarkdown: '## Note\nIntegrator addendum…',
        mode: 'append', // required for integrator on tenant
      })
    Secrets boundary

    Wiki must not store Order Lab env secrets. Link operators to #secrets / project-config panels instead (features/crm/orders/*).

    Data Model

    Deep-dive: JSONB collection pattern (`id` + `data`) used by wiki_pages and siblings.