> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peanutsapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Offline Mode

> Log entries without internet - they sync automatically when you're back online

## Overview

Peanuts works offline! When you lose connectivity, your entries are safely stored on your device and sync automatically when you reconnect.

<Info>
  Offline mode requires [installing Peanuts as a PWA](/getting-started/pwa-installation) for the best experience.
</Info>

## How It Works

<Steps>
  <Step title="Log as normal">
    Add entries via text, voice, or any input method while offline.
  </Step>

  <Step title="Entries are queued">
    Peanuts stores pending entries securely on your device using IndexedDB.
  </Step>

  <Step title="Auto-sync on reconnect">
    When internet returns, entries sync automatically in the background.
  </Step>

  <Step title="Confirmation">
    You'll see a toast notification: "Synced X offline entries"
  </Step>
</Steps>

## Offline Capabilities

### What Works Offline

<CardGroup cols={2}>
  <Card title="Instant Logs" icon="bolt">
    Simple entries using local pattern matching (0 credits)
  </Card>

  <Card title="View Data" icon="eye">
    Access recently cached Helpers and entries
  </Card>

  <Card title="Queue Entries" icon="clock">
    Store entries to sync later
  </Card>

  <Card title="Navigate" icon="compass">
    Browse the app interface normally
  </Card>
</CardGroup>

### What Requires Connection

<CardGroup cols={2}>
  <Card title="AI Features" icon="brain">
    Ask Peanuts, complex routing, Smart Scan
  </Card>

  <Card title="Voice Transcription" icon="microphone">
    Speech-to-text requires cloud processing
  </Card>

  <Card title="New Helper Creation" icon="plus-circle">
    AI-generated Helpers need connectivity
  </Card>

  <Card title="Real-time Sync" icon="arrows-rotate">
    Live collaboration updates
  </Card>
</CardGroup>

## Pending Entries

When you have unsynced entries, you'll see:

* **Badge count** showing number of pending entries
* **Pending indicator** in the app header
* **Queue icon** to view pending entries

### Viewing Pending Entries

1. Tap the pending indicator or badge
2. See a list of all queued entries
3. Entries show their destination Helper
4. Status shows "Pending sync"

<Warning>
  Pending entries can be viewed but not edited. Once synced, they become normal entries.
</Warning>

## Manual Sync

To force a sync attempt:

1. Pull down to refresh on any screen
2. Or go to **Settings → Sync → Sync Now**

This is useful if:

* Automatic sync seems delayed
* You want to confirm sync status
* You're about to close the app

## Sync Behavior

### Automatic Sync

* Triggers when connectivity is restored
* Runs in the background
* Shows toast when complete
* Retries failed entries automatically

### Conflict Resolution

If the same entry was modified both offline and online:

* Most recent change wins
* Conflicts are rare in practice
* No data is lost—older version is archived

## Offline Duration

Peanuts stores offline entries indefinitely until synced. However:

* Very old cached data may be cleared by the browser
* For long offline periods, sync before clearing app data
* The app preserves your queue across restarts

## Best Practices

<AccordionGroup>
  <Accordion title="Check sync before closing">
    If you have pending entries, wait for sync to complete before closing Peanuts.
  </Accordion>

  <Accordion title="Use Instant Logs offline">
    Simple pattern-matched entries work fully offline. Complex inputs queue for later processing.
  </Accordion>

  <Accordion title="Install as PWA">
    Installing Peanuts provides better offline support than using the browser.
  </Accordion>

  <Accordion title="Sync periodically">
    Don't let too many entries queue up. Sync when you have connection.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Entries not syncing">
    1. Check internet connection
    2. Try manual sync (pull to refresh)
    3. Restart the app
    4. Check if you're logged in
  </Accordion>

  <Accordion title="Missing pending entries">
    1. Check the pending queue
    2. Entries may have already synced
    3. Check the target Helper for synced entries
  </Accordion>

  <Accordion title="Sync errors">
    1. Some entries may fail validation
    2. Check the error message
    3. The entry remains in queue for retry
    4. Contact support if issues persist
  </Accordion>
</AccordionGroup>

## Technical Details

For developers and curious users:

* **Storage**: IndexedDB for reliable local storage
* **Queue**: FIFO (first-in-first-out) processing
* **Retry**: Exponential backoff for failed syncs
* **Cache**: Service Worker caches app assets

## Related

<CardGroup cols={2}>
  <Card title="Install as App" icon="download" href="/getting-started/pwa-installation">
    Get the best offline experience
  </Card>

  <Card title="Instant Logs" icon="bolt" href="/features/instant-logs">
    Zero-credit logging that works offline
  </Card>
</CardGroup>
