DOCUMENTATION

AI in BlnkSpace

Last updated June 2026
Editor
All plans

BlnkSpace has a fully integrated AI layer that can read, write, restructure, and extend your documents. It works through three surfaces — a persistent chat panel, a floating inline prompt on any block, and quick AI actions in the selection toolbar — all powered by your own API key with no usage markup.

AI features are in active development. The AI panel, inline prompt, agents, and memory system are all functional but rough around the edges. You will encounter bugs — incomplete tool calls, occasional content duplication, plan approval flows that don't advance, agents that stall mid-run, and memory entries that don't always inject correctly. If something breaks, the version history restore flow is your safety net. Report issues and the behaviour will improve over time.

How it works

All AI features in BlnkSpace run through your own provider API key. You paste it once in Settings, it's encrypted with AES-256 and stored server-side, and from that point every AI request is billed directly to your provider account — BlnkSpace never sees the key again and never adds a usage markup.

The AI has full read access to your document at all times — every block, its type, content, and metadata are serialized and sent as context. When the AI makes edits, it calls structured tools that modify your document in real time through the same block event system used by the editor. You see changes appear live, word by word.

Three AI surfaces

SurfaceHow to openBest for
AI PanelSparkles icon in the top toolbar, or ⌘⇧AConversations, multi-block edits, document restructuring, agents, memory.
Inline promptClick ✦ on any block, or type / → AI, or press Space on an empty blockQuick rewrites, continuations, and insertions scoped to one block.
Selection toolbarSelect text or multiple blocksImprove writing, make shorter, expand, fix grammar, simplify, make formal.

AI Panel

The AI Panel is a persistent sidebar that gives the AI full context of your document and the ability to make any kind of edit. It supports multi-turn conversations, persistent memory, document attachments, and a complete history of past conversations.

AI Panel — conversation with tool calls
Restructure this page into three sections: Problem, Solution, and Next Steps.
Planning 4 edits…
⚙ propose_plan⚙ bulk_edit⚙ insert_block ×3
Done. I've reorganised the document into Problem, Solution, and Next Steps sections with H2 headings. The existing content has been redistributed accordingly.

Conversations

Each document maintains its own conversation history. You can start a new conversation at any time from the panel header — the previous conversation is saved and accessible from the History view. Conversations are stored server-side and persist across sessions. Each one is auto-titled from your first message and can be renamed or deleted.

History icon
Opens the conversation history sidebar showing all past conversations for this document, newest first, with timestamps.
New chat
Starts a fresh conversation. The previous conversation is saved automatically.
Rename
Hover any conversation in the history list — a pencil icon appears. Click to rename inline.
Delete
Hover any conversation — a trash icon appears. Deletion is permanent and confirmed via toast.

Document attachments

You can attach up to 3 other documents from your workspace to the conversation. The AI receives the full block content of attached documents alongside the current one, letting you ask questions across documents, copy structure from one to another, or compare content. Attachments are shown as chips above the input and can be removed at any time.

Memory

The AI can remember facts about a document across conversations. When it learns something relevant — a preference, a project constraint, a recurring pattern — it stores it as a key-value memory entry scoped to that document and user. Memories are injected into the system prompt at the start of every new conversation, so the AI picks up context without you having to re-explain it.

Memory is per-document and per-user. Collaborators on the same document have separate memory stores. Memories can be up to 2,000 characters per entry and are readable from the panel's Memory section.

AI tools (what the AI can do)

The AI communicates with your document through a structured set of tools. Every visible edit is the result of a tool call — there is no hidden mutation path. Tool calls appear as labeled chips in the AI's response so you can see exactly what it did.

Block editing tools

ToolDescription
insert_blockInserts one or more blocks after a specified block ID. Supports all insertable block types including headings, lists, callouts, code, toggles, sections, hero, and carousel shells.
update_blockReplaces the content of a single existing block. Does not affect metadata or block type.
update_block_metadataPatches the metadata of a block (image alt text, embed URL, font settings, section background, etc.). Array fields like heroElements and slides are merged by element ID rather than replaced wholesale.
delete_blockDeletes a block by ID.
change_block_typeConverts an existing block to a different type (e.g. paragraph → callout, heading1 → heading2).
bulk_editBatches multiple update, delete, insert, and change_type operations into a single tool call. Always preferred over sequential single-block calls when touching 2+ blocks.
replace_rangeReplaces a contiguous range of blocks (from startId to endId) with a new set of blocks.
replace_all_blocksAtomically replaces the entire document. Only used for version restoration — not for normal edits.
update_hero_assetEdits hero block content: elements, background, colors, text effects. Hero blocks are asset-backed and require this tool — not update_block_metadata.
update_carousel_assetEdits carousel block slides, background, and styling. Same asset-backed pattern as hero.

Utility tools

ToolDescription
propose_planBefore making large or destructive changes, the AI presents a plan — a summary, a list of steps, and an estimated edit count. You must approve before any editing tools are called.
create_documentCreates a new document in the workspace with a given title. Can optionally navigate to it after creation.
get_version_historyReturns the last 10 saved versions of the document with timestamps and full block data. Used before restore operations.
rememberStores a key-value fact about the document in persistent memory. The AI uses this proactively when it learns something worth retaining across sessions.
web_searchAvailable natively for Claude and Gemini models. Lets the AI look up current information and incorporate it into your document. Not available for OpenAI models.
The AI is instructed to always use bulk_edit when touching more than one block, and to call propose_plan before any change that would require 3 or more tool calls after batching. This keeps edits fast and gives you a checkpoint before large restructuring operations.

Plan approval

When the AI determines that an operation is large enough to warrant a checkpoint, it calls propose_plan before executing any edits. This shows you a structured plan card in the chat with a summary, a numbered list of steps, an estimated edit count, and a risk level per step. You can approve to proceed or cancel to abandon the plan.

Summary
One-line description of the overall operation.
Steps
Each step has an action label, a fuller description, and an optional risk level (low / medium / high). High-risk steps are highlighted.
Estimated edits
The approximate number of block-level changes the plan will make.
Approve & run
Confirms the plan. The AI proceeds immediately with all tool calls.
Cancel
Abandons the plan. The AI does nothing and the conversation continues.
If a plan includes high-risk steps, a warning note appears in the plan card. A version snapshot is saved automatically before execution so you can restore if needed via Get version history → Restore.

Inline AI prompt

The inline prompt is a floating popup that appears directly on a block. It is scoped to that block — the AI receives the block's current content plus a serialization of surrounding blocks for context, and the result is streamed back as a pending diff on the block itself.

✦ sparkle icon
Appears on hover on the left margin of any block. Click to open the inline prompt for that block.
/ → AI
Type / on an empty block and select AI from the slash command menu.
Space on empty block
Pressing Space on a completely empty block opens the inline prompt.
Selection toolbar → AI
Select text in any block — the selection toolbar's AI panel opens with quick-action chips and a custom prompt field.

Quick actions

Four preset quick actions are available as chips in the inline prompt. Each one sends a pre-written prompt with the block's current content substituted in:

Continue writing
Appends a natural continuation of the block's content. Matches the existing tone and avoids repetition.
Expand this
Rewrites the block into a fuller, more detailed version while preserving the meaning and tone.
Make it shorter
Condenses the block into a more concise version, keeping the key ideas.
Improve writing
Rewrites the block with better clarity, grammar, and flow.

Diff review

After the AI generates a response, the result is shown as a pending diff on the block — the original content is struck through and the new content appears alongside it. You can accept to replace the block content, or reject to discard the change and restore the original. The diff is non-destructive until you explicitly accept.

Selection toolbar AI

The floating selection toolbar that appears when you select text or multiple blocks has an AI button that opens a mini panel with quick-action chips and a custom prompt input. This is optimised for quick text transformations.

Six quick actions are available: Improve writing, Make shorter, Expand, Fix grammar, Simplify, and Make formal. Each sends the selected text to the inline AI stream and replaces it with the result. A custom prompt field lets you type any instruction.

Version history and restore

The AI can retrieve the last 10 saved versions of a document and restore any of them. If you ask the AI to undo a change it made, or if you want to go back to an earlier state, the recommended flow is:

1
Ask the AI to show version history

Say "Show me the version history" or "Undo that last change." The AI calls get_version_history and lists the available versions with timestamps.

2
Choose a version

Tell the AI which version you want — by number, description, or approximate time. The AI selects it.

3
Restore

The AI calls replace_all_blocks with the selected version's block array. Your document is atomically restored to that exact state.

Version history is stored server-side on a save cycle. The AI never reconstructs deleted content from memory — it always fetches the actual saved block data. If you need finer-grained undo, use the editor's built-in undo (⌘Z) which operates on the in-memory Yjs document.

AI providers and models

BlnkSpace supports three AI providers. You connect one at a time — switching providers in Settings takes effect immediately for all subsequent AI requests.

Supported providers
◆ Claude (Anthropic)
⬡ OpenAI
✦ Google Gemini
ProviderModelsNotes
ClaudeSonnet 4 (recommended), Opus 4.5 (most capable), Haiku 4.5 (fastest)Native web search available. Keys begin with sk-ant-.
OpenAIGPT-4o (recommended), GPT-4o Mini (fastest), o3-mini (reasoning)Web search not available — switch to Claude or Gemini for search. Keys begin with sk-.
GeminiGemini 2.0 Flash (recommended), Flash Lite (fastest), 2.5 Pro (most capable)Native web search available.
Claude Sonnet 4 is the recommended default for most use cases — it balances capability, speed, and cost well for document editing tasks. Use Haiku 4.5 or GPT-4o Mini for high-volume lighter tasks. Opus 4.5 or Gemini 2.5 Pro for complex multi-step restructuring.

Setting up your API key

1
Get your API key

Go to your provider's console — Anthropic, OpenAI, or Google AI Studio — and create a new API key.

2
Open Settings → AI

In BlnkSpace, click your avatar → Settings → AI tab. Select your provider and model from the tabs and dropdown.

3
Paste your key

Paste the key into the API key field and click Save. The key is validated for correct format before saving.

4
Start using AI

Open any document and click the Sparkles icon in the toolbar. The AI panel is now active.

Your key is encrypted with AES-256 using envelope encryption (a per-user data encryption key wrapped by a KMS master key) before being stored. It is never logged, never returned to the client, and never shared. Usage is billed at the standard rate directly by your provider.

Key management

Replace key
Paste a new key into the key field and save. The old key is immediately overwritten and the cache is invalidated.
Switch provider
Click a different provider tab. If a key is already saved, the provider and model are updated immediately without re-entering the key.
Switch model
Change the model dropdown at any time. Takes effect on the next AI request.
Remove key
Click the trash icon next to the masked key. All AI features are gated until a new key is added.

Agents

Agents are persistent AI tasks that run automatically — on a schedule, in response to a trigger, or as a multi-step sequence requiring approvals. They are configured in the AI Panel's Agents tab and operate on the same document context and tool set as the chat AI.

Agent typeDescription
ScheduledRuns a task on a cron schedule — every N minutes, hourly, daily at a specific UTC hour, or weekly on a specific day. Useful for recurring content updates, summaries, or maintenance tasks.
TriggeredFires when a specific condition is met in the document or a connected database (e.g. a status column changes). Lets you automate reactions to document events.
Multi-stepA sequential list of steps, each with an action description and an optional approval gate. Steps run one at a time; if a step requires approval, the agent pauses and waits for you to approve or skip before proceeding.
AutonomousWatches the document continuously and applies a set of rules automatically. The most flexible but most powerful agent type — use rules to describe the agent's behaviour and boundaries precisely.

Agent lifecycle

idle
Agent is enabled but not currently running. Scheduled agents show their next run time.
planning
Agent is reading the document and forming a plan.
awaiting_approval
A multi-step agent has reached an approval gate and is waiting for you to approve or skip the step.
running
Agent is actively executing tool calls.
done
The current run completed successfully.
failed
The run encountered an error. The last error message is shown in the agent card.
paused
Agent has been manually disabled. It will not run until re-enabled.
Agents make real changes to your document. Always review the agent's task description carefully before enabling it, and use multi-step agents with approval gates for any operation that modifies significant amounts of content.

Known limitations

The following are known rough edges as of the current build. They are being actively worked on and will improve over time.

AI Panel

Plan approval stalls
Occasionally after you approve a plan, the AI does not proceed to execute the tool calls. If this happens, send a follow-up message like "Go ahead" to nudge it.
Tool call visibility
Tool call chips in the message history are not always accurate — they may show a tool name but not the full arguments or outcome. This is a display issue and does not affect the actual edits made.
Conversation loading
Switching between conversations in the history view sometimes requires a refresh to load the full message thread correctly.
Attachment context limits
Very large attached documents may be silently truncated when sent as context. If the AI seems to miss content from an attached doc, try attaching a shorter version.
Memory injection timing
Memories written in a conversation are not available in the same conversation — they are injected into the system prompt on the next conversation start.

Inline prompt

Diff display on complex blocks
The pending diff view works reliably on paragraph and heading blocks. On callout, code, and toggle blocks the diff rendering is inconsistent — the accept/reject buttons may still work correctly even if the visual diff looks wrong.
Empty block trigger
The Space-to-open shortcut on empty blocks occasionally fires unintentionally when typing quickly. Press Escape to dismiss.
Stream interruption
If you navigate away from the block while a stream is in progress, the partial content may be orphaned in the block. Use ⌘Z to undo if the result is garbled.

Agents

Scheduled agents
Scheduled agents depend on a server-side cron sweep. Timing may drift by several minutes from the configured schedule depending on server load.
Multi-step approval gates
The approval gate UI for multi-step agents is functional but the step status indicators dont always update in real time — refresh the agents panel if a step appears stuck.
Run logs
Agent run logs are stored but the display in the panel is minimal. Detailed per-step output is not yet exposed in the UI.
Triggered agents
Trigger-type agents are partially implemented. The trigger configuration UI is present but not all trigger types fire reliably in production.
Autonomous agents
Autonomous agents are the most experimental type. The watch interval and rule evaluation are functional in basic cases but may behave unexpectedly on documents with complex block structures.

Provider behaviour

Tool call reliability varies by model
Smaller and faster models (Haiku 4.5, GPT-4o Mini, Flash Lite) sometimes skip required tool calls or fail to batch correctly. Stick to the recommended models for complex editing tasks.
OpenAI tool formatting
OpenAI models occasionally produce slightly malformed block content in bulk_edit operations — extra whitespace, missing closing tags. The content is usable but may need a quick manual cleanup.
Key caching
After deleting or replacing an API key, there is a up to 60-second window where the old key may still be served from the server-side cache before the new key takes effect.
The fastest recovery from any AI-caused document corruption is to ask the AI: "Show me the version history" and restore to the version before the bad edit. This always works regardless of what the AI did — replace_all_blocksis a hard reset to a known-good saved state.