Skip to content

Polopopy/fieldbook

Repository files navigation

Fieldbook

A pocket AI tool for anyone working in the field: technicians, emergency responders, and engineers in classified or offline environments. Fieldbook runs entirely on-device, delivering expert-level guidance without an internet connection and without exposing sensitive information to external services.

Why Fieldbook

Most AI tools require a cloud connection, creating two problems for field workers: no access in remote or classified environments, and the risk of leaking sensitive operational data. Fieldbook solves both. All inference happens on the device's Neural Engine. No data ever leaves the hardware it runs on.

Features

Identify

Point the camera at any piece of hardware and Fieldbook identifies it instantly. Select from the model's top guesses or enter your own label, then launch a focused AI conversation tailored to what you need in that moment.

Chat

A full conversational AI assistant running locally on-device. Supports streaming responses, markdown rendering, and Qwen3's extended reasoning, visible live as the model thinks through complex problems.

Privacy by Design

No API calls are made during conversation or identification. The only network activity is a one-time model download on first launch. After that, Fieldbook works anywhere: underground, offshore, or in a Faraday cage.


Requirements

Requirement Version
Xcode 15.0+
iOS deployment target 16.0+
Test device iPhone (recommended: iPhone 15 Pro or later)
Apple Developer Account Required for device installation
Python 3.9+ (for embedding regeneration only)

Getting Started

1. Clone and open

git clone <repo-url>
cd apps/Qwen3Chat/iOS
open Fieldbook.xcodeproj

2. Add Swift packages

In Xcode: File → Add Package Dependencies

Package URL Version
ZeticMLange https://github.com/zetic-ai/ZeticMLangeiOS.git 1.5.9 (up to next major)
MarkdownUI https://github.com/gonzalezreal/swift-markdown-ui 2.0.0 (up to next major)

3. Configure API keys

Copy the example secrets file and fill in your ZETIC keys:

cp Secrets.xcconfig.example Secrets.xcconfig

Edit Secrets.xcconfig:

ZETIC_LLM_KEY = your_llm_key_here
ZETIC_CLIP_KEY = your_clip_key_here

Then wire the xcconfig into Xcode:

  1. Project → Info → Configurations: set both Debug and Release to Secrets
  2. Target → Info → Custom iOS Target Properties: add:
    • ZeticLLMKey$(ZETIC_LLM_KEY)
    • ZeticCLIPKey$(ZETIC_CLIP_KEY)

Keys are available from the ZETIC dashboard or your team lead. Never commit Secrets.xcconfig. It is gitignored.

4. Add camera permission

Target → Info → Custom iOS Target Properties:

  • Privacy - Camera Usage DescriptionUsed to identify hardware and equipment

5. Build and run

Select your device as the run destination and press ⌘R.

On first launch, both models download and cache locally. Subsequent launches load from cache instantly.


Standalone Installation

  1. Product → Destination: select your iPhone
  2. Product → Archive
  3. In Organizer: Distribute App → Direct Distribution

With a free Apple Developer account, the app runs for 7 days before requiring reinstallation. With a paid account ($99/year), there is no expiry.

To trust the app on device: Settings → General → VPN & Device Management → [your Apple ID] → Trust


Extending the Label Set

Classification labels are defined in generate_embeddings.py. To add or modify hardware categories, edit the LABELS list and regenerate embeddings.

Setup

pip install torch open_clip_torch numpy
pip install git+https://github.com/apple/ml-mobileclip.git

Download mobileclip2_s4.pt from HuggingFace (apple/MobileCLIP2-S4) and place it alongside the script.

Run

python generate_embeddings.py

Replace clip_text_embeddings.json in the Xcode project with the newly generated file.


Project Structure

Fieldbook/
├── FieldbookApp.swift           # App entry point, environment objects, orientation lock
├── Assets.xcassets/
└── View/
    ├── Config.swift             # Reads API keys from bundle (never hardcoded)
    ├── LLMService.swift         # On-device LLM inference and streaming
    ├── ChatSessionManager.swift # Conversation history and prompt construction
    ├── MobileCLIPService.swift  # Image classification pipeline
    ├── ChatView.swift           # Chat UI with markdown and live thinking display
    ├── IdentifyView.swift       # Camera capture and identification flow
    └── SettingsView.swift       # Appearance, privacy info, data management

generate_embeddings.py           # Offline script that generates text embeddings from labels
clip_text_embeddings.json        # Pre-computed embeddings (committed; regenerate if labels change)
Secrets.xcconfig                 # API keys (gitignored, never commit)
Secrets.xcconfig.example         # Template for new developers
ZeticMLange_iOS_Reference.md     # ZETIC SDK usage reference

Models

Model Purpose Source
Qwen/Qwen3-4B On-device LLM for conversational AI ZETIC Melange
Steve/MobileCLIP2-image Image encoder for zero-shot hardware classification ZETIC Melange

Both models are downloaded via the ZETIC SDK on first launch and cached locally for all subsequent use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors