Fubar Folio Protect yourself and those you love with knowledge

Ollama with the manuals

Search and ask the manuals offline with the shipped Ollama kit.

How to use the Fubar Folio manuals with Ollama

This guide assumes you have already installed Ollama and pulled nomic-embed-text (and qwen2.5:7b if you want answers, not just search). See 02-install-ollama.html. Everything here runs on your computer. There is no API key.

A Fubar Folio product from White Hat IT Services, by Trevor Kimball. Questions: hello@fubarfolio.com


1. Unpack the AI-text pack

The tools are in the AI-text archive, not in the EPUB pack.

Current file name: fubarfolio-manuals-ai-text-2026-11-23.tar.gz (1,892,789,420 bytes, about 1.76 GiB). Unpacking it creates a folder named fubarfolio-manuals-ai-text-2026-11-23/ (about 3.3 GB). That folder is the library root used in every command below.

macOS / Linux

mkdir -p ~/FubarFolio
tar -xzf fubarfolio-manuals-ai-text-2026-11-23.tar.gz -C ~/FubarFolio
cd ~/FubarFolio/fubarfolio-manuals-ai-text-2026-11-23

Windows (PowerShell)

New-Item -ItemType Directory -Force -Path $env:USERPROFILE\FubarFolio | Out-Null
tar -xzf .\fubarfolio-manuals-ai-text-2026-11-23.tar.gz -C $env:USERPROFILE\FubarFolio
cd $env:USERPROFILE\FubarFolio\fubarfolio-manuals-ai-text-2026-11-23

Optional: if you have SHA256SUMS, check the archive first (sha256sum -c, shasum -a 256 -c, or Get-FileHash). Then, from the library root:

python3 verify_manifest.py
[sketch — not a screenshot]

fubarfolio-manuals-ai-text-2026-11-23/          <-- library root
  README.md
  requirements.txt
  schema.json
  verify_manifest.py
  manifest.json
  data/include/          487 JSONL manuals
  data/flagged/          231 JSONL manuals
  indexes/ollama/        search + ask scripts and the nomic index
  indexes/claude/        keyword index used by hybrid search
  indexes/openai/        (not used in this guide)
  indexes/d2q/           OpenAI search v3 question index (not used in this guide)
  figures/
  reports/

2. Python and dependencies

Python 3.9 or newer is required.

  • Keyword-only search uses only the Python standard library.
  • Hybrid or vector search needs numpy (numpy>=1.26 in requirements.txt).

From the library root:

macOS / Linux

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Windows

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

sentence-transformers appears in requirements.txt only as a comment. You need it only if you pass --rerank (off by default; it did not improve results in testing).


3. What each file is for

All of these are under indexes/ollama/ unless noted.

File Role
manual_search.py Main search. Default is hybrid (keyword + vector).
ask_manuals.py Retrieves the top passages, then asks a local chat model to answer only from them. Default model: qwen2.5:7b.
ollama_search.py Simple vector-only search.
ollama_embed.py Builds an index for a different local model, or does a deliberate rebuild. Do not run this just to search.
nomic-embed-text.f32.npy + nomic-embed-text.index.json Shipped embeddings: 74,053 vectors, 768 dimensions, already complete.
glossary.json 8,504 acronyms, used to expand queries (on by default).
manuals.json Metadata for filters (number, title, series, service, edition date).
indexes/claude/index/chunks.sqlite Keyword (FTS5) index that hybrid search uses.
flowchart LR
  Q[Your question] --> MS[manual_search.py]
  MS --> KW[chunks.sqlite keyword]
  MS --> VEC[nomic-embed-text vectors]
  MS --> GL[glossary.json]
  KW --> H[Hybrid results]
  VEC --> H
  GL --> H
  H --> ASK[ask_manuals.py + qwen2.5:7b]
  ASK --> A[Answer with manual and page citations]

Hybrid search, vector search and asking questions all need Ollama running, with nomic-embed-text already pulled. If the models are already on the machine, you do not need the ollama CLI on your PATH. The scripts talk to the daemon at OLLAMA_HOST (default http://127.0.0.1:11434).


4. Search the manuals

Run these from the library root (the folder that contains README.md and indexes/).

Default hybrid search:

python3 indexes/ollama/manual_search.py "9-line medical evacuation request"

Keyword only (no Ollama, no numpy required):

python3 indexes/ollama/manual_search.py --mode keyword --service usmc --after 2015 "CASEVAC"

Simple vector-only search:

python3 indexes/ollama/ollama_search.py "casualty evacuation 9-line"

You can also cd indexes/ollama and call python3 manual_search.py "...". The scripts find the index relative to their own folder.

manual_search.py flags (from the script itself):

Flag Default Meaning
query (required) Your search text
-k 8 How many hits to print
--mode hybrid hybrid, keyword, or vector
--model nomic-embed-text Which local embedding index to use
--service Filter: army, usmc, joint, air-force, navy, or dod (comma-separated for more than one)
--series e.g. ATP,FM
--manual e.g. "FM 3-21.8"
--after Edition date >= YYYY, YYYY-MM, or YYYY-MM-DD
--before Edition date <= the same date forms
--no-glossary off Skip acronym expansion
--rerank off Optional local cross-encoder (needs pip install sentence-transformers). If you pass --rerank with no name, it uses BAAI/bge-reranker-base.
--json off Machine-readable output

ollama_search.py takes only:

ollama_search.py "query" [k]

k defaults to 5. There are no other flags.

[sketch — not a screenshot]

$ python3 indexes/ollama/manual_search.py "9-line medical evacuation request"
Q: 9-line medical evacuation request
 1. ATP 4-02.2 p..  ...  [manual-id#chunk]
    (short snippet from the passage)
 2. ...

5. Ask a question and get a cited answer

Pull the default chat model once, if you have not already:

ollama pull qwen2.5:7b

Then, from the library root:

python3 indexes/ollama/ask_manuals.py "What goes in line 3 of a 9-line MEDEVAC?"

The script retrieves the top 5 passages (hybrid search, glossary on) and asks qwen2.5:7b to answer only from those passages, citing [MANUAL p.PAGES]. If the passages do not contain the answer, the model is instructed to reply exactly: The retrieved passages don't answer this.

ask_manuals.py flags:

Flag Default Meaning
question (required) Your question
--model qwen2.5:7b (or ASK_MODEL) Local Ollama chat model
-k 5 How many passages to retrieve
--mode hybrid Same three modes as manual_search.py
--service --series --manual --after --before Same filters as manual_search.py
--rerank off Same optional reranker
--json off Full record (answer, sources, timings)

Example with a filter:

python3 indexes/ollama/ask_manuals.py --service army --series ATP "What goes in line 3 of a 9-line MEDEVAC?"

6. Environment variables the scripts honor

Variable Used by Default
OLLAMA_HOST search, ask, embed http://127.0.0.1:11434
ASK_MODEL ask_manuals.py qwen2.5:7b
MANUALS_FTS manual_search.py indexes/claude/index/chunks.sqlite
MANUALS_EMB_DIR manual_search.py the indexes/ollama folder
MANUALS_META manual_search.py indexes/ollama/manuals.json
MANUALS_GLOSSARY manual_search.py indexes/ollama/glossary.json
OLLAMA_EMBED_MODEL ollama_embed.py only nomic-embed-text
OLLAMA_WORKERS ollama_embed.py only 1

You can ignore these if you keep the shipped folder layout and run Ollama locally on the default port.


7. Do not rebuild the shipped index

The nomic-embed-text index is already complete (74,053 vectors). ollama_embed.py is only for building an index with a different local model, or for a deliberate rebuild.

# These are not "search" commands. A full nomic rebuild takes many hours.
python3 indexes/ollama/ollama_embed.py --model some-other-model
python3 indexes/ollama/ollama_embed.py --model nomic-embed-text --force
python3 indexes/ollama/ollama_embed.py --model nomic-embed-text --limit 1

Without --force, the script refuses to overwrite the shipped nomic-embed-text files. --limit runs a smoke test that writes to a temporary directory and deletes it when finished.


Sources

  • Pack files read for this guide: README.md, indexes/ollama/README.md, requirements.txt, manual_search.py, ask_manuals.py, ollama_search.py, ollama_embed.py, verify_manifest.py
  • Ollama default host and model pages: https://docs.ollama.com/windows , https://ollama.com/library/nomic-embed-text , https://ollama.com/library/qwen2.5:7b