Overview
Give your AI assistant context by attaching documents to your messages. Off Grid supports text files, code, PDFs, data files, and more. The AI reads the document and includes it in the conversation context when generating responses.Supported Formats
Off Grid can read and extract text from:Text Files
.txt— Plain text.md— Markdown.log— Log files
Code Files
- JavaScript/TypeScript:
.js,.jsx,.ts,.tsx - Python:
.py - Java/Kotlin:
.java,.kt - C/C++:
.c,.cpp,.h - Swift:
.swift - Go:
.go - Rust:
.rs - Ruby:
.rb - PHP:
.php - SQL:
.sql - Shell:
.sh
Data Files
.csv— Comma-separated values.json— JSON data.xml— XML documents.yaml/.yml— YAML configuration.toml— TOML configuration.ini/.cfg/.conf— Config files.html— HTML documents
PDF Documents
.pdf— Native text extraction (see below)
All formats are read as text. Binary files (images, videos, executables) are not supported as attachments. For images, use the camera/photo library feature with vision models instead.
How to Use
Attaching a Document
- Open a conversation
- Tap the paperclip icon in the chat input
- Select a file from your device using the native file picker
- The document appears as a badge in the input area
- Type your question about the document
- Send
Multiple Attachments
You can attach multiple documents to a single message:- Tap the paperclip again to add more files
- Each document appears as a separate badge
- All documents are included in the AI’s context
Viewing Attachments
Tap any document badge (in your input or in a sent message) to open it:- iOS: Opens in QuickLook (native preview)
- Android: Opens with
Intent.ACTION_VIEW(your device’s default viewer)
Removing Attachments
Before sending:- Tap the x on any document badge to remove it
- Removed documents are not included in the message
PDF Text Extraction
Off Grid uses native modules to extract text from PDF documents:iOS: PDFKit
- Uses Apple’s
PDFKitframework (built-in) - Extracts text page-by-page with page separators
- Handles most standard PDFs
Android: PdfRenderer
- Uses Android’s native
PdfRendererAPI (Kotlin) - Extracts text page-by-page with page separators
- Handles most standard PDFs
Limitations
- Image-based PDFs: Text extraction only works on PDFs with selectable text. Scanned documents (images) won’t extract text.
- Password-protected PDFs: Not supported (will fail gracefully)
- Corrupted PDFs: May fail to extract text
If a PDF doesn’t extract text properly, try converting it to a text file first (copy/paste the text into a
.txt file and attach that instead).File Size Limits
To prevent context window overload and memory issues:- Max file size: 5MB per file
- Max text content: 50,000 characters per file
- Files larger than 5MB are rejected
- Text content longer than 50K characters is truncated with a note
Persistent Storage
Attached documents are copied to persistent app storage to ensure they survive temp file cleanup:Storage Location
Why Persistent?
On Android, the document picker returnscontent:// URIs that point to temporary files. These can be deleted by the system at any time. Off Grid copies them to a persistent location so you can:
- View attachments later (even if the original file is deleted)
- Export conversations with attachments intact
- Re-open documents from old messages
Cleanup
Attachments are not automatically deleted. If you want to free up space:- Delete conversations containing large attachments
- Or manually delete files from
{DocumentDirectory}/attachments/(requires file manager access)
Use Cases
Code Review
Scenario: You want feedback on a Python script.- Attach
script.py - Ask: “Review this code and suggest improvements”
- The AI reads the code and provides feedback
Data Analysis
Scenario: You have a CSV file with sales data.- Attach
sales_2024.csv - Ask: “What are the top 3 products by revenue?”
- The AI parses the CSV and answers your question
Document Q&A
Scenario: You have a PDF contract and need to find specific clauses.- Attach
contract.pdf - Ask: “What is the termination policy?”
- The AI extracts text from the PDF and finds the relevant section
Configuration Help
Scenario: You’re debugging a YAML config file.- Attach
config.yaml - Ask: “Why isn’t my database connection working?”
- The AI reads the config and spots the issue
Log Analysis
Scenario: Your app crashed and you have a log file.- Attach
crash.log - Ask: “What caused this crash?”
- The AI analyzes the stack trace and suggests fixes
Tips
Getting the Best Results
- Attach only relevant files — Don’t attach entire codebases, just the file(s) related to your question
- Ask specific questions — “Find the bug in line 47” vs. “Review this code”
- Use small files — Under 10K characters works best
- Combine with text — Explain what you’re looking for in your message
- Try PDFs carefully — Ensure the PDF has selectable text, not just images
Optimizing Context Usage
Attachments consume context window space. To maximize available context:- Increase context length (Settings → Model Settings → Context Length)
- Attach fewer files per message
- Truncate large files manually before attaching (copy relevant sections to a new file)
- Clear conversation history periodically (start a new chat)
Troubleshooting
File picker won’t open:- Check storage permissions (Android: Settings → Apps → Off Grid → Permissions → Storage)
- Ensure you have a file manager app installed
- Ensure the PDF has selectable text (not a scanned image)
- Try opening the PDF in another app to verify it’s not corrupted
- Convert the PDF to text manually (copy/paste into a
.txtfile)
- Files over 5MB are rejected
- Try compressing the file or extracting only the relevant section
- Ensure you asked a specific question about the document
- Check that the document was attached (badge should appear in the input area)
- Try rephrasing: “According to the attached file, what is…”
- The original file may have been moved or deleted
- Check if the file still exists in device storage
- Re-attach the document if needed
Technical Details
Content URI Resolution (Android)
Android’s document picker returnscontent:// URIs that RNFS can’t read directly. Off Grid resolves these by:
- Copying the file to a temp cache path
- Reading the temp file
- Copying to persistent storage
- Cleaning up the temp file
Text Truncation
When content exceeds 50,000 characters:Document Viewer Integration
Off Grid uses@react-native-documents/viewer for cross-platform document opening:
- iOS:
QuickLookframework (supports PDF, text, images, Office docs, etc.) - Android:
Intent.ACTION_VIEW(opens with the system’s default app for that file type)
Privacy
All document processing happens 100% on-device:- Your files never leave your device
- No cloud uploads
- No data collection
- Works completely offline (after model download)