qi CLAUDE.md

Repository instructions for qi, a local-first macOS command-line tool that searches Markdown and text documents using keyword and vector search and can answer questions with citations.

In plain words
What is it for?
Use it when changing qi, its document index, search, local embedding providers, SQLite database, or question-answering features, and when verifying changes.
Why use it?
It records the project’s build and test commands and explains important design choices such as SQLite storage, embeddings, and content deduplication.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/itsmostafa/qi/claude-md
Clone the repo
git clone --depth 1 https://github.com/itsmostafa/qi
Per session 968 This file is loaded in full into every session.
When invoked 968 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00968 $0.00968
Opus 5 $0.00484 $0.00484
Sonnet 5 $0.00194 $0.00194
Haiku 4.5 $0.00097 $0.00097

Measured 3d ago against content hash 41e23adbdabd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

qi CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

qi — Agent Guidance

This file is the canonical guidance for AI coding agents working in this repo. AGENTS.md is a symlink to it, so Claude Code, Codex, and other agents read the same instructions.

Project Overview

qi is a local-first knowledge search CLI for macOS. It indexes documents (Markdown, plaintext) into a SQLite database and provides BM25 full-text search, vector search (with local embedding providers), and LLM-powered Q&A with citations.

Build

go build .          # Build binary
go test ./...       # Run all tests
go vet ./...        # Lint

Checks

Always run task check before finishing any code change to ensure all checks pass (build, tests, vet).

Key Design Decisions

  • CGo-free SQLite: github.com/ncruces/go-sqlite3 (wasm2go transpiled, no CGo needed)
  • Vector search: Pure Go KNN with cosine distance stored as BLOBs. sqlite-vec was planned but has WASM compatibility issues with the current go-sqlite3 version — revisit when sqlite-vec-go-bindings updates to support newer go-sqlite3.
  • Content-addressable storage: content table keyed by SHA-256 hash; documents references by hash. Enables deduplication and O(1) change detection.
  • Break-point chunker: Scores chunk boundaries by type (heading=100, code fence=80, blank line=20) with distance decay from target size.
  • Graceful degradation: Vector search and generation are optional — BM25 always works.
  • Auto-generated collection names: Collection names are derived from full path segments (e.g. ~/Projects/tools/qitools-qi). The --name flag was removed from index; use the derived slug or configure an alias. Legacy names are normalized on startup.
  • Query relaxation: BM25 search automatically falls back from conjunctive to disjunctive matching for natural-language queries that return zero results.
  • Auto-embed on index: When an embedder is configured, chunks are embedded immediately after indexing without a separate step.
  • Config: Raw gopkg.in/yaml.v3, no viper. ~ expansion + relative path resolution.

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 68 lines · 968 tokens per session scan A 41e23adbdabd

Subscribe to this mod's changes

qi CLAUDE.md is an instructions file published in the GitHub repository itsmostafa/qi (39 stars, last pushed 23d ago), licensed MIT. It adds 968 tokens to every session, about $0.0048 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.