AI System

PageSpace treats AI not as an isolated chatbot, but as contextual intelligence embedded within the workspace hierarchy. AI conversations are pages, they inherit context from their location, and they participate in the same collaborative, permission-based ecosystem as documents, folders, and channels.

Architecture

Pages as AI Containers

AI conversations are AI_CHAT page types β€” first-class citizens in the PageSpace ecosystem:

πŸ“ Project Alpha/
β”œβ”€β”€ πŸ“„ Requirements.md
β”œβ”€β”€ πŸ“ Research/
β”‚   β”œβ”€β”€ πŸ€– Research Assistant    ← AI_CHAT page
β”‚   └── πŸ“„ Market Analysis.md
└── πŸ€– Project Planning AI      ← AI_CHAT page

This means:

  • AI conversations inherit permissions from their drive
  • AI can reference and understand sibling documents
  • AI conversations appear in search, mentions, and navigation
  • Multiple AI contexts can exist at different hierarchy levels

Database-First Message Persistence

Every message is immediately persisted to PostgreSQL as an individual row:

chat_messages:
  id        | pageId   | userId | role      | content          | toolCalls | agentRole
  msg-1     | page-123 | user-1 | user      | "Analyze this"   | NULL      | PARTNER
  msg-2     | page-123 | NULL   | assistant | "Here's my..."   | [{...}]   | PARTNER
  msg-3     | page-123 | user-2 | user      | "Also check..."  | NULL      | PARTNER

This enables:

  • Multi-user collaboration β€” multiple people chat with the same AI
  • Real-time sync β€” all participants see messages as they arrive
  • Message attribution β€” clear record of who said what
  • Cross-conversation search β€” find information across all AI interactions
  • Tool call persistence β€” tool calls and results stored for context and debugging
  • Message versioning β€” support for editing and regeneration via isActive flag

Contextual Intelligence

AI conversations understand their position in the workspace hierarchy:

πŸ“ Marketing Campaign/
β”œβ”€β”€ πŸ“„ Brand Guidelines
β”œβ”€β”€ πŸ“„ Target Audience
└── πŸ€– Campaign AI          ← Sees Brand Guidelines and Target Audience

Context flows upward: an AI can reference parent and sibling pages (with permission). Context is limited by the user's access permissions β€” AI can only see what you can see.

Multi-Provider Support

PageSpace supports 7 AI providers with a unified interface via the Vercel AI SDK:

ProviderKey ModelsKey Required
PageSpaceFree models via OpenRouterNo
OpenRouter200+ models including Claude, GPT, GeminiUser's key
Google AIGemini 2.5 Pro, Gemini FlashUser's key
OpenAIGPT-5, GPT-4.1, o3User's key
AnthropicClaude 4.1 Opus, Claude SonnetUser's key
xAIGrok 4User's key
OllamaAny local modelSelf-hosted

API keys are stored encrypted per-provider. You can set different providers per drive or per individual AI page.

Tool Calling

AI agents have access to 13+ workspace automation tools organized into 6 categories:

CategoryToolsCapability
Core Page Opslist_drives, list_pages, read_page, create_page, rename_page, move_pageNavigate and manage workspace
Content Editingreplace_linesPrecise line-based document editing
Trash Opstrash, restoreSoft delete and recovery
Searchregex_search, glob_search, multi_drive_searchPattern and cross-workspace search
Task Managementupdate_taskCreate and update tasks on task lists
Agent Managementlist_agents, multi_drive_list_agents, ask_agent, update_agent_configAgent discovery and collaboration

Tools are filtered by agent role and can be customized per page. See Tool Calling for details.

Agent Roles

Three built-in agent roles with different capabilities:

RoleReadWriteDeleteUse Case
PARTNERYesYesYesCollaborative AI partner with full capabilities
PLANNERYesNoNoStrategic planning β€” read-only analysis
WRITERYesYesYesExecution-focused β€” minimal conversation, maximum output

Each role gets a different system prompt and filtered set of tools. You can further customize by setting enabledTools on individual AI pages.

Real-Time Collaboration

AI messages are broadcast to all conversation participants via Socket.IO:

  • User A sends a message β†’ saved to database β†’ broadcast to all users
  • AI responds β†’ response streamed to all users in real-time
  • User B can continue the conversation immediately
  • Tool calls and results are visible to all participants

Model Capability Detection

PageSpace automatically detects model capabilities:

  • Vision: Whether a model can process images (checked via static maps and pattern matching)
  • Tool calling: Whether a model supports function calling (checked via OpenRouter API for OpenRouter models, pattern-based for others)

If a model doesn't support tools, PageSpace falls back to text-only mode and suggests tool-capable alternatives.

Learn More

  • Providers & Models β€” Detailed provider configuration and model list
  • Tool Calling β€” Complete tool reference with parameters and examples
  • Agents β€” Custom agents, system prompts, and agent-to-agent communication

Search

Search docs, blog posts, and more.