=== Archivist AI ===
Contributors: tituszmagyar
Tags: ai, search, chat, archive, semantic search
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI chat search for your article archive. Visitors ask questions, get source-backed answers — no login required.

== Description ==

Archivist AI turns your WordPress article archive into a conversational search engine. A floating chat bubble lets visitors ask natural-language questions — "What's been written about food retail trends since January?" — and get AI answers grounded in your own published articles, with links back to the sources.

**For your readers:**

* Anonymous — no account, no login, no signup wall
* Multi-turn chat with follow-up questions
* Every answer cites the original articles

**For you:**

* Five-minute setup: paste one OpenAI API key, click Index, done
* Embeddings stored in your own WordPress database — no external vector database, no extra services
* Cost estimate shown *before* indexing starts
* Daily spending cap and per-visitor rate limiting built in
* You pay OpenAI directly at list price — no markup, no middleman
* Only published, public posts are ever indexed

The free version indexes your 100 most recent posts. Pro unlocks your entire archive, plus the usage/cost dashboard, smart answer caching, and subscriber-only mode.

== External services ==

This plugin connects to the OpenAI API (api.openai.com) to provide its core functionality. It is not usable without it.

**What is sent and when:**

* When you index your content (manually from the admin, or automatically when a post is published/updated), the text of your **published, public posts** is sent to OpenAI to generate embeddings.
* When a visitor asks a question in the chat, the **question text** (and the recent turns of that conversation) is sent to OpenAI to interpret the question and generate an answer based on your indexed articles.
* No personal data about visitors (names, emails, IP addresses, accounts) is sent to OpenAI. Drafts, private posts, and password-protected posts are never sent.

The site owner provides their own OpenAI API key and is billed by OpenAI directly. This service is provided by OpenAI: [Terms of Use](https://openai.com/policies/terms-of-use/), [Privacy Policy](https://openai.com/policies/privacy-policy/), [API data usage policy](https://openai.com/policies/api-data-usage-policies/).

This plugin also uses the Freemius SDK for licensing and (strictly opt-in) usage tracking. No data is sent to Freemius unless the site administrator explicitly opts in: [Freemius Privacy Policy](https://freemius.com/privacy/), [Terms](https://freemius.com/terms/).

== Installation ==

1. Upload the plugin and activate it.
2. Go to Archivist AI in the admin menu and paste your OpenAI API key.
3. Choose which post types to index and click "Estimate cost & index all posts".
4. The chat bubble appears on your site once indexing completes.

== Frequently Asked Questions ==

= Do my visitors need an account? =

No. Visitors chat anonymously. Rate limiting works per IP/session, never by forcing login.

= What does it cost to run? =

You pay OpenAI directly on your own API key. Indexing a typical archive costs well under $1; ongoing chat costs are roughly $1–3 per 1,000 chat turns with the default model. The plugin shows an estimate before indexing, tracks all spend, and lets you set a daily cap.

= Does it need an external vector database? =

No. Embeddings are stored in a custom table in your WordPress MySQL database.

= Can drafts or private posts leak into answers? =

No. Only published, public, non-password-protected posts are indexed, and post status is re-checked at answer time.

== Changelog ==

= 0.5.0 =
* Pro plan via Freemius: unlimited archive indexing, usage/cost dashboard, smart answer caching, subscriber-only mode.
* Subscriber-only mode: restrict the chat to logged-in users.

= 0.3.0 =
* Inline placement: [archivist_ai] shortcode and Gutenberg block.
* Action Scheduler used for background indexing when available.

= 0.2.0 =
* Streamed answers: responses now appear word by word.
* Query caching for repeated questions.

= 0.1.0 =
* Initial release: floating chat bubble, multi-turn conversations, source-backed answers, date-aware search, background indexing with cost estimate, daily spending cap, per-IP rate limiting, usage tracking.
