=== AutoArticle AI by OnlyAIMatters ===
Contributors: onlyaimatters
Tags: ai content generator, autoblogging, auto publish, ai writer, seo
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.5.494
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: autoarticle-ai-onlyaimatters
Domain Path: /languages

Auto-generating SEO-optimized articles using AI with multi-agent pipeline, smart internal linking, and 40+ language support.

== Description ==

AutoArticle AI by OnlyAIMatters creates intelligent content agents that automatically research, write, and publish SEO-optimized articles on your WordPress site.

= Features =

* **Multi-Agent AI Pipeline** — Create multiple autonomous agents, each with independent niches, schedules, and writing styles
* **Smart Internal Linking** — 90-day article memory enables context-aware internal linking between related articles
* **40+ Languages** — Full localization support with automatic language detection
* **Real-Time News Research** — Google Trends + Bing News integration for fresh, trending topics
* **SEO Optimization** — Automatic focus keywords, meta descriptions, schema markup, Open Graph tags
* **Telegram Bot Control** — Run agents remotely with /run, /pause, /resume commands (Pro feature)
* **AI Image Generation** — DALL-E integration for featured images (Pro feature)
* **Content Calendar** — Plan and schedule articles in advance (Pro feature)

= How It Works =

1. **Create an Agent** — Define your niche (IPL, Tech, Cricket, etc.), language, and schedule
2. **Set Schedule** — Choose how often to generate (hourly, daily, weekly)
3. **Auto-Run** — Agents pick fresh topics from RSS feeds or news sources, write articles, publish
4. **Review & Edit** — Approve, edit, or schedule manually before publishing

= Supported AI Models =

Claude Haiku 4.5, GPT-4.1, GPT-4.1 Mini, GPT-5, Perplexity Sonar Pro, Perplexity Sonar, and Gemini 2.5 Flash — all routed via the AutoArticle AI API for simplicity.

= Requirements =

A free AutoArticle AI account at [autoarticleai.com](https://autoarticleai.com) is required. Article generation consumes coins (0.75 coins per article). New accounts receive free starter coins to test the plugin.

== Installation ==

1. Upload the `autoarticle-ai-onlyaimatters` folder to `/wp-content/plugins/`
2. Activate "AutoArticle AI by OnlyAIMatters" in WordPress Plugins menu
3. Visit **AutoArticle AI → Settings** and enter your API key from [autoarticleai.com/dashboard](https://autoarticleai.com/dashboard)
4. Create your first agent at **AutoArticle AI → Agents**
5. Click **Run Now** to generate your first article, or configure a schedule for automatic generation

== Frequently Asked Questions ==

= Does this work with any WordPress theme? =

Yes, the plugin is theme-independent and works with any WordPress theme, including Twenty Twenty-Four, Astra, OceanWP, Divi, and custom themes.

= What AI models are supported? =

Claude Haiku 4.5, GPT-4.1, GPT-4.1 Mini, GPT-5, Perplexity Sonar Pro, Perplexity Sonar, and Gemini 2.5 Flash. All models are routed through the AutoArticle AI API — no separate API keys required.

= Do I need my own API keys? =

No, the plugin connects to your AutoArticle AI account. Just get your API key from autoarticleai.com/dashboard and add it in Settings. Pro users can optionally configure custom model endpoints.

= Can I edit the articles before publishing? =

Yes, you can review and edit all articles before they're published. Agents can be configured to save as Draft, Pending Review, or Publish automatically based on your preference.

= How often can articles be generated? =

You can schedule agents to run every hour, every 6 hours, daily, or weekly. There's no limit on the number of agents you can create.

= Does this work with RankMath or Yoast SEO? =

Yes, the plugin automatically adds focus keywords, meta descriptions, schema markup, Open Graph tags, and Twitter cards that RankMath and Yoast SEO can use. It works with both plugins active or standalone.

= What languages are supported? =

40+ languages including English, Spanish, French, German, Hindi, Portuguese, Japanese, Chinese, Arabic, Italian, Russian, Korean, Dutch, Polish, Turkish, and more.

= Is there a free trial? =

Yes, new accounts receive free starter coins to test the plugin. Each article costs 0.75 coins.

= Where does the plugin get article topics from? =

Agents can source topics from:
1. **RSS feeds** — Your curated RSS feeds (primary source)
2. **Smart News** — Google Trends, Google News, and Bing News (supplemental)
3. **Manual topics** — Enter custom topics via Telegram bot or admin panel
4. **Source URLs** — Provide a URL and the AI will write an inspired article

= How does the internal linking work? =

The plugin maintains a 90-day memory table of all published articles. When generating new articles, it analyzes this memory to find contextually relevant articles and inserts internal links automatically.

= Can I disable all external communication? =

Yes. Add this to your `wp-config.php` to disable all telemetry:

`add_filter( 'aaai_disable_telemetry', '__return_true' );`

Note: This will disable coin balance sync but article generation will continue to work (requires API key).

== Screenshots ==

1. Dashboard overview showing all agents with status indicators and recent articles table
2. Agent creation wizard with model selection, niche configuration, and schedule settings
3. Settings page with API key configuration, site identity, and featured image settings
4. Generated article in WordPress editor with SEO meta box and internal links applied

== Changelog ==

= 2.5.473 =
* **FIX: OnlyAI SEO requests are always drafts** — whatever a filter or setting says, a request from OnlyAI SEO is written with auto-publish, delayed publishing and publish notices off; after it is written any scheduled publish is cancelled and a post that is not a draft is put back to a draft.

= 2.5.472 =
* **NEW: plan and usage for OnlyAI SEO** — the OnlyAI SEO bridge (`aaai_onlyai_seo_status`) now reports the account plan, whether it is paid, and how many articles today's allowance has used, so OnlyAI SEO follows your subscription instead of keeping a daily limit of its own. A known Free plan is refused by `aaai_onlyai_seo_write` (`aaai_no_plan`).

= 2.5.471 =
* **NEW: Refusal-section pruning** — OnlyAI SEO briefs request outlines the facts can't always support; sections that are majority "No confirmed X" disclaimer text are now pruned automatically (minimum 3 sections kept, FAQ never touched). The OnlyAI writer prompt also instructs skipping unsupported outline sections outright.
* **FIX: smashed tables detected** — a paragraph holding ≥4 currency figures with no real table markup ("figuresMonthly figure12-month arithmeticMobile₹149₹1,788…") is flagged TABLE.SMASHED for Heal to rebuild.
* FAQ completion tokens 1200 → 1600 (6 Q&As + a plan table overflowed the old cap, truncating the last questions).

= 2.5.470 =
* **FIX: off-niche external citations** — niche outlets (OpenAI Blog, GSMArena, ESPN Cricinfo, Roadshow…) are no longer injected into off-topic articles via the longest-paragraph fallback (live: "For more detail, see OpenAI Blog" on an Assam entrepreneur net-worth story). General outlets (BBC, Reuters, TechCrunch, Gizmodo…) keep the fallback; niche outlets must have their name present in the article.

= 2.5.469 =
* **NEW: Nested TOC** — H3 subheadings now render as a bulleted sub-list UNDER their parent H2 in the table of contents (was a flat numbered list where H2s and H3s looked like six equal items).
* **FIX: truncated endings escaped the MIDWORD_CUT gate** — the checker skipped any paragraph containing a citation link; it now analyzes tag-stripped text of every paragraph.
* **FIX: glued FAQ pairs split at publish time** — FAQ completion could glue 2+ Q&A pairs into single paragraphs; the splitter now runs in the pipeline, not just the 45-day maintenance sweep.
* **FIX: OnlyAI brief related-search stuffing** — the writer prompt no longer invites verbatim quoting of related search phrases (live: eight unrelated "…net worth" names jammed into one paragraph).

= 2.5.468 =
* **FIX: two PHP notices are back to fixed** — the 2.5.467 build that added the OnlyAI SEO evergreen fix had lost two earlier fixes: the auto-evolve niche tips counter was used before it was set (`Undefined variable $saved`), and writing a log line called `$wpdb->prepare()` without a placeholder ("called incorrectly") on every article. Both are restored. Nothing else changed from that build.
* Version number: the two different builds that both said 2.5.467 (with and without the evergreen fix) are now told apart. 2.5.468 has the evergreen fix AND the two notice fixes.

= 2.5.467 =
* **FIX: Hyper-Accuracy no longer rejects OnlyAI SEO briefs** — it is a news-recency gate and killed evergreen requests ("bhagya kalita net worth" → "This event appears to be old"). Brief-driven articles are marked evergreen (server skips recency gates); 'accurate' brief flag now adds a writer rigor note; the regular fact-check pass still verifies claims.
* **FIX: custom topics never soft-skip for staleness** — owner-decided topics (Telegram orders, OnlyAI SEO briefs) are written even when the recency check says STALE and Sonar found no facts.

= 2.5.476 =
* **FIX: generation numbers kept in keywords and entity tags** — "Redmi Pad 3 Spotted…" now yields keyword "redmi pad 3" (the title's trailing product digit is extended into the keyword) and pinned tag "Redmi Pad 3" (1-2 digit generation markers on multi-word phrases are no longer trimmed as junk; "Day 8"-class tails still are).

= 2.5.475 =
* **FIX: FAQ completion task label** — the targeted FAQ completion was labeled task 'article', routing it through the server's pool override and word-count gates (the v2.5.436 maintenance lesson). Now 'verify' — served as-requested with the intended model. This was producing truncated/corrupted FAQ answers (live: an answer consisting of just an outlet name).
* **FIX: budget-brand body casing** — redmi/realme/tecno/infinix/itel/motorola now auto-cased in body text (live: "the recent redmi Monitor Arm").
* **FIX: leak-class tag junk** — spotted / bottleneck / leaks / sites / multiple / certification no longer become tags.

= 2.5.474 =
* Consistency pass: stale migration log message fixed (said gpt-5.6-luna, the migration target is gpt-6-luna); God Mode enhance fallback defaults now gpt-6-luna; model catalog current everywhere.

= 2.5.477 =
* **FIX: missing FAQs wrapper** — articles whose FAQ was emitted as bare question-H2s (no "FAQs" heading) now get the wrapper inserted automatically: the TOC stops swallowing question headings, and FAQPage JSON-LD can fire. Both completion-appended and writer-generated FAQ blocks are covered.

= 2.5.478 =

= 2.5.496 =
* Script gate (both sides): Latin-script agents never receive or run non-Latin topics (live: mixed Hindi/English headline on the English finance site). Server selection filters candidates by script; plugin backstop rejects mismatches with evergreen fallback.
* Judge-fix adoption: corrected drafts returned as markdown are converted before sanity checks (no more discarding valid fixes).
* Two-sided topic burn: post-lock failures reported to the server; selection skips burned event-hashes for 24h.

= 2.5.494 =
* Writing Engine 2.0: Topic Brief (intent, angle, key questions, success criteria) + Research Dossier (multi-source, confidence tiers) for Hyper-Accuracy agents via /api/v1/brief.
* Brief-mapped outlines (one section per key question, word budgets), assignment-brief writer directives, explainer structure contract.
* Semantic judge grades the draft against the brief (0-10) with one bounded targeted-fix pass.
* Also stacks: 2.5.485-2.5.493 fixes (brand-safety gate + shoot/shot hotfix, failed-topic burn gate, citation-marker scrub, pipe-table leak, tag phrase-adjacency, keyword-jam casing).

= 2.5.482 =
* **NEW: Internal-link guarantee** — articles with ZERO same-site links now get a "Read Next" block appended (2-3 latest same-category posts) before publishing. Kills the recurring "link to at least 2 related posts" OnlyAI flag on match reports and thin-archive niches.
* **FIX: H3 sections counted in THIN_SECTION** — an H3 heading with an empty/under-15-word body (live: a bare "Key Stat" section) is now flagged for Heal like thin H2s.
* **FIX: refusal-section vocabulary extended** — "can't be verified", "doesn't provide/establish", "no official reports" now count toward refusal-section pruning (the "Tactical Shape" disclaimer section class previously slipped under the 50% threshold).

= 2.5.483 =
* **NEW: LISTICLE enforcement** — ranking titles (Most/Best/Top…) now demand actual ranked entries: writer prompt requires 5-10 named entries with numbered <h3> profiles; contract flags vague-prose listicles (LISTICLE.NO_RANKED_ENTRIES) for Heal to restructure. Live: "Most Handsome Men World 2026" never named a single man.
* Also: numbered-steps rule for how-to articles, FAQ de-hedging, keyword corruption root fixes from 2.5.480-2.5.482 all stack.

= 2.5.484 =
* **FIX: POST_FAQ false positives from Read Next** — the internal-link guarantee's "Read Next" block legitimately sits after the FAQ; it no longer triggers the POST_FAQ contract flag (was flagging nearly every article since 2.5.482).
* **FIX: image no-results diagnosis** — keys status now leads the log line (was truncated away); image search queries skip determiners/verbs/hedge-words ("Meta Reportedly Built…" → usable query).
* **FIX: bare-determiner tag pins** — "The google suncatcher…" (lowercase brand broke the entity run) pinned tag "The"; lone determiners/articles are no longer pinned.
* **FIX: OnlyAI agent pick-topic** — the OnlyAI SEO Writer agent gets a real category on creation (pick-topic API requires category; prefetch was erroring every cycle).
* **FIX: generic single-word keyword degrades** — "stuck android" degrading to "stuck" is rejected; the full keyword is kept.

= 2.5.485 =
* **FIX: keyword stopword tails** — the over-long trim (5-word cap) could land on a function word ("relaunched mitsubishi pajero is"); trailing stopwords are now trimmed.
* **FIX: short single-word keyword degrades** — "boy sunderland" degrading to 3-letter "boy" rejected (length floor <4 chars added to the generic-word list).

= 2.5.481 =
* **FIX: garbage focus keywords at the derivation layer** — single past/participle verbs ("Forced") blanked and re-derived from title entities; over-long full-title keywords (OnlyAI writer path — live: the entire title rode as the keyword, colon included) trimmed to the pre-colon segment and capped at 5 words / 60 chars. Same guard applied at the OnlyAI brief entry point.

= 2.5.480 =
* **FIX: generic article-led keywords blanked** — a keyword that degraded to "the card" / "a guide" class is stripped of its leading article; if only generic nouns remain it is blanked and re-derived from title entities. This kills the "A the card" / "the the Card Balance Checker" corruption class at the root.
* **FIX: doubled determiners collapsed** ("the the", "a the") — keyword-injection artifact cleanup across the final HTML.
* **FIX: FAQ answers de-hedged** — "reportedly/apparently" no longer appear inside FAQ answers.
* **NEW: STEP-BY-STEP writer rule** — how-to procedures must be numbered <ol> lists (bold action verb per step), not prose. Wins featured snippets.

= 2.5.479 =
* **NEW: Amazon Deals agent mode** — tick "Amazon Deals Mode" on any agent, add deal keywords (e.g. 55 inch TV, air fryer) and storefronts (com, in…), and each cycle the agent scans live Amazon deals via PA-API SearchItems (min-savings filter), skips deals already covered (ASIN ring + post meta), picks the biggest saving, and writes a full deal article through the normal pipeline: real price, savings %, tagged buy link, deal framing, quality gates, OnlyAI meta. Multi-geo: set several storefronts with per-marketplace partner tags (Settings → Amazon Associates shows the map format).
* Requires PA-API keys (Settings → Amazon Associates) and enough deal inventory for the keywords.

= 2.5.478 =
* **NEW: Amazon Associates PA-API 5.0 integration — the Amazon deal writer is complete.** Amazon blocks server scrapes, so deal/review articles about Amazon products ran blind. Settings → Amazon Associates (PA-API): enter your Access Key, Secret Key, Partner Tag and Marketplace. Any Amazon product URL (Pro Amazon Review mode, Telegram links, deals agents) now fetches REAL live data through the official API — title, brand, features, current price, list price, savings %, buy link with your tag — and feeds it to the writer as verified evidence with deal framing rules. Prices appear once, exactly as reported. Without keys, behavior is unchanged (slug-keyword context).
* Uses AWS SigV4-signed PA-API 5.0 GetItems requests. Requires an Associates account with PA-API access (3 qualified sales in 180 days).

= 2.5.466 =
* **NEW: OnlyAI SEO Writer agent** — a purpose-built agent that the OnlyAI SEO plugin asks for NEW articles (new topics, new sections, a full FAQ). OnlyAI SEO itself only refreshes old posts in small edits; every piece of new writing is done here, through the normal AutoArticle AI pipeline (research, outline, writer, fact check, quality gate, SEO fields, OnlyAI SEO's own keys). The agent is on request only: it is never scheduled, never publishes, and every article it writes is saved as a draft for a person to review.
* **NEW: a small, versioned API for OnlyAI SEO** — `aaai_onlyai_seo_status()` (connected? coins? version) and `aaai_onlyai_seo_write( $brief )`. A brief carries the topic, focus keyword, searches to cover, reader questions, an outline, owner notes and same-site links; it is bounded and cleaned, and it only shapes the writer's instructions. Without an AutoArticle AI key and subscription it answers that the account is not connected and writes nothing.
* **FIX: PHP notices on custom-topic runs** — `aaai_run_agent()` now always defines `$focus_keyword` and no longer unsets `$article` before reading it again, so a run for a topic you give it (OnlyAI SEO, or a manual run) no longer prints "Undefined variable" notices on sites that display errors. No change to what is written.

= 2.5.451 =
* **NEW: OnlyAI SEO archive backfill** — the maintenance sweep now writes OnlyAI's meta keys (title/description/keyword, mirrored from the final RankMath values) and re-scores every previously generated post, one batch at a time. One-time per post, zero LLM cost. Applies to posts carrying `_aaai_agent` even if they predate `_aaai_generated`.

= 2.5.450 =
* **NEW: OnlyAI SEO integration** — generated posts now write `_onlyai_seo_title`, `_onlyai_seo_description`, and `_onlyai_focus_keyword` (mirrored from the final RankMath-computed values, already length-clamped to OnlyAI's scorer windows) and force a re-score so the admin column shows the real number immediately. No-op when OnlyAI SEO isn't active; no duplicate head tags when both SEO plugins run (OnlyAI yields front-end output to RankMath/Yoast).
* **NEW: Inline hero image for OnlyAI** — when OnlyAI SEO is active and the body has no inline image, the featured image is inserted as a keyword-alt `<figure>` right after the lead paragraph so the scorer's Images and Keyword-in-alt checks pass.
* **NEW: Answer-first intro rule** — writer prompt now requires a 30-60 word opening paragraph containing the focus keyword and a plain "X is..." definitional sentence (snippet/AI-answer quotable).
* **FIX:** Heal-on-draft now mirrors the healed title into OnlyAI's meta and re-scores after healing.

= 2.5.425 =
* **NEW:** DESTRUCTION TRIPWIRE — a live article came back at 8,445 tokens but reached the density check at ~22 words (the contract caught it, but the whole downstream spend was burned on a corpse with no diagnosis). Every strip pass now snapshots and restores: if a pass drops the body below 20% of pre-pass length, the pre-pass value is restored and the guilty pass is NAMED in the log (`[TRIPWIRE] <pass> destroyed the article`). Applied to fence-strip, seo-meta-extract, and the metadata-line body-scrub (whose `[\s\S]*?` patterns can swallow the whole body when a HEADLINE: label appears early with no closing tag).
* **FIX:** Evergreen/dedup collision (live: "Malenia, Blade of Miquella" accepted by evergreen fallback → rejected 1s later by the main dedup gate → retry → metadata 422 → cycle lost) — the fallback now mirrors the main gate's used-topics similar_text check before returning, so it only hands back topics the pipeline will admit.
* **FIX:** SYNC circuit infra-aware backoff — 5xx/timeout bursts armed the same 6h lock as auth failures, keeping the circuit open for hours after recovery (verified: credits endpoint returns 200 while circuit stayed armed). Infra-style errors now probe through after 45 min; auth errors keep 6h.

= 2.5.424 =

= 2.5.423 =
* **NEW:** Owner feedback visibility — the Quality Report page now shows a "Recent Owner Feedback" card (verdict, reason, article, sync status) fed by the Pro plugin's Telegram verdicts, so feedback is seen instead of vanishing silently. Pairs with Pro 2.4.95 reason codes.

= 2.5.422 =
* **FIX:** Score-vs-live contradiction gate (Pass 0c) — a definitive final scoreline plus live-blog framing in one headline ("Man City 4-2 Liverpool: European Soccer Live Updates From Sunday" — actually a completed Friday WSL result reframed as live Sunday coverage) is now repaired to match-report framing before any API spend, instead of burning a full fact-check + write cycle on a confused article. Sports-only, cricket scores/versions/dates excluded by digit guards.

= 2.5.421 =
* **NEW:** DPO DATASET CAPTURE — every successful heal now appends a preference pair (broken draft → contract-clean repair, with the exact heal prompt) to `uploads/autoarticle-ai-dpo/YYYY-MM.jsonl` (monthly rotation, 5MB cap, privacy-guarded). The fine-tuning dataset accumulates automatically; train later when the scorecard plateaus.

= 2.5.420 =
* **NEW:** SOURCE-URL BACKSTOP — when every authority extlink is skipped as homepage-only and the body still has zero outbound links, the topic's real source article (always a pathed, placeholder-checked URL) is injected as an in-body "First reported by [Publication]." citation in the intro paragraph and registered so the SEO audit counts it. Ends the "⚠️ No outbound links detected" class.

= 2.5.419 =
* **NEW:** METRICS BRAIN — PV beacon + engagement sync unblock the starved server columns; lesson attribution per write; narrative bandit; site continuity.

= 2.5.418 =
* **FIX:** HTML entities in titles — truncated entities (`&#39` with no semicolon, live JSW article) leaked into the published H1; both the raw body and the resolved title now decode them (semicolon-optional).
* **FIX:** Bare question-word focus keywords — keyword "What" (live Kill Switch article) is rejected and re-derived from the title ("kill switch").
* **FIX:** Tag sanitizer hardening — hashtags stripped ("#nintendo" → "Nintendo"), headline-verb stems added ("Mikel Arteta Admits" / "JSW Inspire Denies" / "Status Effects Deserve" killed), finance/payments brand noise rejected on non-finance topics ("American Express Community" on the Arsenal article), more junk singles (build/hard/switches/behind/teams).

= 2.5.417 =
* **NEW:** QUALITY LOOP — contract scorecard (per-model pass rates, Dashboard widget), niche exemplars (best-article skeletons injected into writer prompts), contract-driven model routing (auto-deweight <60% pass rate). Client brain caching (topic-prefs 6h transients).

= 2.5.416 =
* **FIX:** "HEADLINE: …" leak into article body — the writer echoed the server's topic-response line as a visible paragraph under the H1 (live Zidane article). New metadata-line scrub strips body paragraphs/lines starting with HEADLINE:/TAGS:/SOURCE_URL:/FOCUS_KEYWORD:/EVIDENCE: etc.
* **FIX:** Cross-niche splice remover missed two frames (live Zidane article: "Look at other global projects, like the Brazil Squad India tour…", "…also parallels the aggressive squad rotations seen in the Richarlison Spurs Squad changes…") — connectives widened (look at / like the / parallels / mirrors / seen in) and the overlap guard relaxed from 0 to ≤1 shared token ("squad"-class generic nouns no longer block the drop).
* **FIX:** Robotic keyword closer ("Understanding zidane france fully means…") appended into a FAQ answer after the source credit. The closer now targets the last BODY paragraph before the FAQ heading, skips source-credit/related lines, and uses smart acronym casing ("Zidane France").

= 2.5.415 =
* **NEW:** Topic-rejection retry ladder — 409 "semantically similar" and duplicate-topic rejections hard-failed the run even though a second sampling usually finds a different headline. Topic selection now retries once with a fresh seed (rebuilt SYS_ID fingerprint), then falls through to the evergreen fallback instead of ending the cycle with zero output.
* **NEW:** Cross-agent duplicate gate now falls back to evergreen instead of "skipping cycle" — the rejected response's TAGS/keyword/source-URL/evidence are cleared so the other story's metadata can't leak into the evergreen article.

= 2.5.414 =
* **FIX:** Trailing punctuation in server tags — "Musafir Cafe." carried the sentence period into the tag list. Sanitizer now strips leading/trailing punctuation (internal periods like "St. Moritz" and "+" suffixes like "Disney+" survive).

= 2.5.413 =
* **NEW:** Server TAGS sanitizer — the topic response's TAGS field was merged into post tags raw ("Mi" appeared on 7 live articles; stopwords "Cannot"/"Never"/"Instead"/"Everyone"; scrambled title n-grams "Media Post Motorola"/"Bundesliga Goals Kane"/"Historic Return Waheeda"; "YouTuber GizmoSlipTech" role prefix). Candidates now pass length/junk/verb checks, a scrambled-n-gram test (all-words-in-topic but non-contiguous = reject, real body entities survive), role-prefix strip, brand casing map (ASUS/GrapheneOS/OpenAI/MIVI/T20Is), and accent-insensitive dedup (Atlético = Atletico).
* **(carried from 2.5.412):** keyword-prefix heading fixes, cross-niche splice remover, ALL-CAPS scrub, contract splice detection.

= 2.5.412 =
* **FIX:** "Rtx" keyword-prefix garbage — the H2/H3 keyword enforcer stuffed "Rtx laptop mod:" onto headings whose tokens were already present but not as a contiguous phrase ("RTX 5090 laptop mod breaks…"), and the TOC inherited the prefixes. Enforcer now credits fuzzy token matches and skips injection; injected prefixes use smart acronym casing.
* **FIX:** Density-fallback standfirst no longer prepends "Rtx Laptop Mod:" when the first paragraph already contains every keyword token naturally; casing is acronym-aware ("RTX", was "Rtx").
* **NEW:** Cross-niche splice remover — drops sentences that splice unrelated article titles into connective frames (live RTX article: "raised by A New Kind Model in AI software", "The experience of Chinese AI Hallucination Nearly also reinforces…", "Even EPFO Wage Ceiling Hiked shows why…"). Connective + headline-style Title-Case run + zero topic-token overlap → sentence removed (max 3).
* **FIX:** Writer keyword-prefix headings ("Rtx laptop mod: …") are now stripped from H2/H3 before TOC generation.
* **NEW:** ALL-CAPS common-noun scrub ("for most GAMERS" → "for most gamers") — acronym whitelist protects RTX/NVIDIA/GPU etc.
* **FIX:** Contract COMPARISON_SCAFFOLD detection widened to the new splice frames (both connective orders, with or without links).

= 2.5.411 =
* **FIX:** Live-score freshness fix (v2.5.410) was clobbered — the Sonar fact-check block replaced the "VERIFIED LIVE DATA" block AND reset the freshness flag, re-arming the false "[Sports] Facts may be stale" warning on every fresh match. Facts now MERGE (live block + Sonar response) and freshness survives the reset.
* **FIX:** Meta-instruction topic leak — "Write a comprehensive, well-structured article…" was locked as a topic and burned 3 full cycles (fact-check spend → topic lock → writer call → Hyper-Accuracy 422). Intake guard now extracts the subject after "about/on" for queued/dispatch instructions; server-picked instruction-topics are rejected zero-cost before any spend.
* **FIX:** Focus keyword extracted from the RANKMATH block kept the writer's quote wrappers — the density check searched for the literal `"waheeda rehman"` (with quotes). Quotes/brackets now stripped at extraction (mirrors agent-runner).
* **(carried from 2.5.410, deploy together):** heal cron independence from Maintenance Mode; option-based SYNC circuit-open log gate; live-score freshness; Hyper-Accuracy validated-facts skip on the write call; 429 duplicate-request 30s retry.

= 2.5.410 =
* **NEW:** Heal-on-Draft — cheap contract-driven self-heal for broken drafts within 10 minutes (Triumph-class truncation, topic-prefix leak, thin sections, MIDWORD_CUT). Drafts-only, leaves healed drafts as drafts, 3 heals/run + 12/day, one-and-done, model `alibaba/qwen3.7-flash` on `verify` task (0 coins). Own always-scheduled 10-min cron (independent of Maintenance Mode).
* **FIX:** [SYNC] Circuit open log spam (~60 entries over 5h, same-second pairs) — transient gate raced under concurrent cron/agent processes; option-based timestamp gate now holds.
* **FIX:** Hyper-Accuracy 422 wasted cycles — the server's weaker re-check contradicted the plugin's stricter Perplexity + live-score validation (fresh topics 422'd as "old"); write call now skips server HA when the plugin already validated facts.
* **FIX:** 429 "Duplicate request detected" no longer fails the run — retries once after 30s (the server's own dedup window), for cross-process fingerprint collisions.

= 2.5.292 =
* **FIX:** Post log now shows actual status — quality-gated drafts are labeled "Saved as draft (quality gate)" instead of misleadingly showing "Auto-published"

= 2.5.291 =
* **FIX:** Guaranteed topic bank — entity and concept indices are now decoupled (per-agent offset), ending nonsensical pairings like "Mohamed Salah's defensive line Role" or "Kubernetes cost efficiency Posture"
* **FIX:** Additional keyword stopwords (hallucinations, scandal, controversy, crisis)

= 2.5.290 =
* **FIX:** HEADLINE: prefix leak — when the server wraps its response as `"HEADLINE: ..."` (with a leading quote), the prefix now gets stripped after quote-trimming instead of surviving into the published post title
* **FIX:** Keyword stopword list expanded with 15 more generic nouns (hiring, safety, security, content, study, research, paper, report, analysis, growth, strategy, etc.)

= 2.5.289 =
* **FIX:** Keyword auto-derivation now rejects single generic words (cost, price, platform, audi, etc.) via expanded stopword list + 1.2% density cap — stops junk focus keywords that trigger SEO warnings
* **FIX:** Smashed-keyword scrubber no longer splits single-word brands like "whatsapp" into "Whats App" — only space-recovers keywords with 10+ alpha chars (true smashed compounds)
* **FIX:** Model-metadata topic leak rejected — topics like "google/gemini-2.5-flash-lite Generated Content" are caught and treated as empty (triggers retry/evergreen fallback)
* **FIX:** Keyword injection fallback log no longer false-alarms — only logs failure when no paragraph is genuinely found

= 2.5.288 =
* **FIX:** Writer-model validator allowlist expanded from 6 to 15 models — imported agents with newer models (Sonnet 5, Grok 4.5, Gemini 3.6, etc.) no longer silently reset to gpt-4.1-mini
* **FIX:** 11 cron handlers poison-proofed with try/catch — a crash in style learner, wiki sync, memory prune, lesson decay, daily evolve, SERP analysis, feedback prune, manual-post scan, lesson housekeeping, backup, or recovery can no longer block the rest of the WP-Cron queue
* **FIX:** `aaai_topic_models` filter now applied via `apply_filters` — Pro plugin's topic-model extension (perplexity/sonar-pro) is no longer dead code
* **FIX:** Request-dedup cache fingerprint now includes `task`, `hyper_accuracy`, and `rss_feeds` — calls with different flags no longer collide and return stale cached results
* **FIX:** Topic-model fallback corrected to `gemini-3.5-flash-lite` (was stale `gpt-4.1-nano`)
* **FIX:** Duplicate topic-model entries removed from allowlist

= 2.5.287 =
* **FIX:** Niche gate now FAILS CLOSED — if the domain/quality verdict call errors, the topic is rejected instead of sailing to the writer (stops off-niche stories like politics on a Cricket agent when the gate model hiccups)

= 2.5.286 =
* **FIX:** Punctuation artifact scrub — catches glued comma/period artifacts like "Also,." in the final HTML before publish
* **FIX:** Paragraph splitter — oversized body paragraphs (>55 words) are now broken into shorter, scannable blocks at sentence boundaries
* **FIX:** Guardian catch-up now runs the agent synchronously in-process when the loopback ping fails (hosts blocking server self-requests) — automatic generation continues even with dead WP-Cron + dead loopback
* **FIX:** Cron-queue poison-proofing — account sync, full backup, topic prefetch, scheduled publish, set-images, and article-refresh handlers are crash-safe and self-re-arm; one throwing event can no longer block every other cron
* **FIX:** Post-outage recovery on upgrade — clears the sync circuit breaker, both sync locks, and stale per-agent run locks/mutexes

= 2.5.285 =
* **FIX:** Guardian ping now blocking with failure logging + synchronous in-process fallback so agents fire even when loopback HTTP is blocked
* **FIX:** Cron handlers wrapped in try/catch (account sync, full backup, topic prefetch, scheduled publish, set images, refresh articles)

= 2.5.153 =
* **BREAKING CHANGE:** FAQ generation now OPT-IN (disabled by default). Enable via "Add FAQ Section" checkbox in agent settings.
* **FIX:** Removed "FAQ TOPICS" from outline generation prompt (FAQs no longer forced)
* **FIX:** FAQ completion calls now respect agent setting (no longer run globally)
* **FIX:** Changed default `add_faq_section` from 1 to 0 (opt-in instead of opt-out)

= 2.0.0 =
* **Version alignment:** Unified plugin header, readme Stable tag, and AAAI_VERSION constant to 2.0.0
* **Compatibility:** Tested up to WordPress 6.7
* **Code quality:** Removed disabled/dead code blocks (v2 encryption stubs, disabled sync lock functions)
* **Code quality:** Debug error_log calls now gated behind WP_DEBUG constant

= 1.3.1 =
* **CRITICAL FIX:** Word count now properly enforced - content exceeding 120% of target is rejected
* **CRITICAL FIX:** Reduced max_tokens calculation to prevent excessive content generation (30% reduction)
* **CRITICAL FIX:** Route fallback messages (OpenAI/Anthropic failed) now filtered as diagnostic
* **FIX:** Agents no longer auto-pause due to intermediate route failures

= 1.3.0 =
* **FIX:** Pro tags now hidden in free version — only shown when Pro plugin is active
* **CRITICAL FIX:** Agents no longer auto-pause when adaptive recovery succeeds
* **FIX:** Consecutive failure counter now properly reset after successful recovery
* **IMPROVEMENT:** More precise diagnostic filtering for Writer retry messages

= 1.2.9 =
* **PRICING FIX:** Updated gpt-4.1-mini pricing to 0.3 coins for 400 words (was 2 coins) - 6.67x cheaper!
* **PRICING FIX:** Updated claude-haiku-4-5-20251001 pricing to match server rates
* **FIX:** Dashboard cost estimates now accurately reflect server-side coin deductions
* **IMPROVEMENT:** Server-side pricing updated with word-count tiers for all models

= 1.2.3 =
* **CRITICAL FIX:** Updated sync endpoint from /api/v1/account-sync (doesn't exist) to /api/v1/credits (working endpoint)
* **CRITICAL FIX:** Updated response parsing to handle actual API format: { "coins": 100.50, "pro": true }
* **CRITICAL FIX:** Fixed 0 coin balance issue by using correct API endpoint
* **Improvement:** Added Pro status detection from API response

= 1.2.2 =
* **CRITICAL FIX:** Restored missing aaai_run_account_sync() function that was causing fatal errors
* **CRITICAL FIX:** Reverted API key encryption to v1 (AUTH_KEY-based) - fixes 401 authentication errors
* **CRITICAL FIX:** Disabled v2 encryption functions that were incompatible with existing keys
* **CRITICAL FIX:** Updated sync function to use AAAI_API_VERSION constant (1.3.9)
* **CRITICAL FIX:** Enhanced coin balance parsing with support for multiple API response formats
* **CRITICAL FIX:** Added enhanced logging for debugging coin balance issues
* **Fix:** Removed all disabled helper functions (sync locks, circuit breakers) that were causing syntax errors
* **Fix:** Properly commented out v2 encryption functions to prevent brace mismatches

= 1.2.1 =
* **CRITICAL FIX:** Removed debug log line causing "bad topic returned" error
* **CRITICAL FIX:** Added immediate coin balance sync on plugin activation
* **Improvement:** Enhanced logging for coin balance debugging
* **Improvement:** Better error messages when API returns unexpected response format
* **Fix:** Variables undefined error in topic generation resolved

= 1.2.0 =
* **CRITICAL FIX:** Enhanced coin syncing with plugin-specific encryption (fixes AUTH_KEY dependency issues)
* **NEW:** Exponential backoff retry logic (2s → 4s → 8s delays with jitter)
* **NEW:** Request locking mechanism to prevent concurrent sync operations
* **NEW:** Circuit breaker pattern (pauses sync after 5 consecutive failures)
* **NEW:** User-friendly admin notices for connection status and stale balances
* **NEW:** Enhanced logging with request IDs and timing metrics
* **NEW:** Graceful degradation with offline mode support
* **NEW:** Manual sync buttons with real-time feedback
* **Improvement:** Increased timeout from 20s to 30s for shared hosting compatibility
* **Improvement:** SSL verification can be customized via filter
* **Improvement:** API key migration support for existing installs
* **Improvement:** Connection status tracking with failure counters
* **Security:** All API keys encrypted with plugin-specific key (not AUTH_KEY)
* **Security:** Key rotation mechanism with backup key storage
* **WordPress.org:** Full compliance with no hardcoded credentials

= 1.1.2 =
* New: Performance optimization with deduplication caching (50-70% faster)
* New: Quality gate system with 7-point quality check (80% threshold)
* New: Quality badge column in posts list
* Fix: API connection settings card added
* Fix: Supermemory key saving fixed
* Fix: Hardcoded backup key removed for WordPress.org compliance
* Improvement: Code organization and documentation


= 1.1.1 = Fix: Added API key connection settings card that was missing in 1.1.0
* Fix: Resolved supermemory key saving issue (aggressive sanitization was stripping special characters)
* Fix: Removed hardcoded backup API key for WordPress.org compliance
* Improvement: Performance optimization added (deduplication caching, 50-70% faster)
* Improvement: Quality gate added (7-point quality check before auto-publish)
* Fix: Version bump for proper WordPress upgrade detection (1.1.0 → 1.1.1)

= 1.1.0 =
* New: Multi-agent pipeline with independent schedules and niches
* New: Smart internal linking from 90-day article memory
* New: Telegram bot control (Pro feature)
* New: AI image generation with DALL-E (Pro feature)
* New: Content calendar and scheduling (Pro feature)
* Improvement: Folder structure standardized for WordPress.org compatibility
* Improvement: All external API calls disclosed in readme

= 1.0.0 =
* Initial release of AutoArticle AI by OnlyAIMatters
* Multi-agent AI article pipeline with autonomous topic research, writing, SEO, and publishing
* RankMath integration: focus keywords, meta descriptions, Open Graph, Twitter cards, schema markup
* 40+ language support
* Google Trends and Bing News topic sourcing
* 90-day article memory and smart deduplication
* Publish window scheduling
* Agent wiki — persistent per-agent knowledge base

== Upgrade Notice ==

= 1.0 to 1.1.1 =

Recommended update. Fixes critical API key and supermemory issues. All settings preserved. Verify API key in Settings post-upgrade.

= 1.1.0 to 1.1.1 =

Critical update. Fixes API connection settings, supermemory key saving, adds deduplication caching and quality gate. Verify API key post-upgrade.

== Privacy Policy ==

This plugin communicates with the following external services. Data is only transmitted when you have configured an API key and actively use the relevant features.

= External Services Disclosed =

**1. AutoArticle AI API (autoarticleai.com)**

*Used for:* All AI article generation, topic research, SEO metadata, and license validation.

*Data sent:*
- Article topics and content for AI processing
- License key for account validation
- Domain name for license binding
- Agent configuration (niches, schedules, models)
- Generated article titles and metadata for dashboard storage

*Data stored locally (WordPress database):*
- Article generation logs (wp_options table, 90-day retention)
- Article memory for internal linking (custom table, 365-day retention)
- Agent configurations and settings (until uninstall)
- API license information (encrypted)

*Triggered when:* An agent runs on its schedule, or when "Generate Now" is used manually.

*Required:* Yes — Core functionality requires this service.

*Data retention:* Article logs auto-delete after 90 days. Memory table auto-deletes after 365 days.

*Terms of Service:* https://autoarticleai.com/terms
*Privacy Policy:* https://autoarticleai.com/privacy

---

**2. Anthropic Claude API (api.anthropic.com)**

*Used for:* Claude AI models (Haiku, Sonnet, Opus) for article writing and topic research.

*Data sent:* Article prompts, research queries, and content generation requests.

*Triggered when:* An agent uses a Claude model (GPT-4.1 Haiku is default).

*Required:* Yes — Used via AutoArticle AI API routing.

*Privacy Policy:* https://www.anthropic.com/legal/privacy

---

**3. OpenAI API (api.openai.com)**

*Used for:* GPT models (GPT-4.1, GPT-4.1 Mini, GPT-5) for article writing.

*Data sent:* Article prompts and content generation requests.

*Triggered when:* An agent uses a GPT model.

*Required:* Yes — Used via AutoArticle AI API routing.

*Privacy Policy:* https://openai.com/policies/privacy-policy

---

**4. Perplexity API (api.perplexity.ai)** — *Pro Feature*

*Used for:* Perplexity Sonar models for real-time web research and fact-checking.

*Data sent:* Research queries and fact-checking requests.

*Triggered when:* Pro user selects Perplexity Sonar model.

*Required:* No — Optional for Pro users.

*Privacy Policy:* https://www.perplexity.ai/legal/privacy

---

**5. DALL-E / OpenAI Images (images.dalle.ai)** — *Pro Feature*

*Used for:* AI-generated featured images.

*Data sent:* Image generation prompts based on article topic.

*Triggered when:* Pro user enables AI image generation.

*Required:* No — Optional for Pro users.

*Privacy Policy:* https://openai.com/policies/privacy-policy

---

**6. Telegram Bot API (api.telegram.org)** — *Pro Feature*

*Used for:* Sending publish notifications and accepting slash-commands.

*Data sent:* Article title, URL, word count, and agent name.

*Triggered when:* Pro user configures Telegram Bot token.

*Required:* No — Optional for Pro users.

*Privacy Policy:* https://core.telegram.org/api/privacy

---

**7. Google Trends (trends.google.com)**

*Used for:* Fetching trending topics for article ideas.

*Data sent:* Search queries based on agent niche.

*Triggered when:* Agent has "Smart News" enabled and RSS feeds are empty.

*Required:* No — Falls back to manual RSS feeds if disabled.

*Privacy Policy:* https://policies.google.com/privacy

---

**8. Google News (news.google.com)**

*Used for:* Fetching recent news headlines as article topics.

*Data sent:* Search queries based on agent niche.

*Triggered when:* Agent has "Smart News" enabled and RSS feeds are empty.

*Required:* No — Falls back to manual RSS feeds if disabled.

*Privacy Policy:* https://policies.google.com/privacy

---

**9. Bing News API (api.bing.com)**

*Used for:* Fetching recent news headlines as article topics.

*Data sent:* Search queries based on agent niche.

*Triggered when:* Agent has "Smart News" enabled and RSS feeds are empty.

*Required:* No — Falls back to manual RSS feeds if disabled.

*Privacy Policy:* https://privacy.microsoft.com/en-US/privacystatement

---

**10. Pexels API (api.pexels.com)**

*Used for:* Fetching royalty-free featured images.

*Data sent:* Search keyword derived from article topic.

*Triggered when:* Image fetching enabled and Unsplash image not found.

*Required:* No — Can disable image fetching.

*Terms of Service:* https://www.pexels.com/terms-of-service/

---

= User Rights =

* **Opt-out:** You can disable all external communication by adding `add_filter( 'aaai_disable_telemetry', '__return_true' );` to wp-config.php. This will disable coin sync but article generation will continue (requires API key).
* **Data deletion:** All data is deleted automatically when the plugin is uninstalled. You can also manually delete data via AutoArticle AI → Settings → Delete All Data.
* **Data access:** Article logs and memory are stored in your WordPress database and can be accessed via wp_posts and the custom aaai_memory table.

= Children's Privacy =

This plugin is not directed to children under 13. We do not knowingly collect personal information from children under 13.

= Third-Party Services =

This plugin integrates with third-party services listed above. Each service has its own privacy policy and terms of service. By using this plugin, you agree to comply with the terms of these third-party services.

= Changes to Privacy Policy =

If we make material changes to how we handle data, we will update this readme.txt and notify users via the WordPress admin dashboard.

= Contact =

For privacy-related questions, contact: privacy@autoarticleai.com

For plugin support, visit: https://autoarticleai.com/support
