feat(m14): AI assistant — explain diagnostics, opt-in (Ollama or Claude) — 0.27.0

New optional module (D24): explains the collected findings in plain language,
contacted ONLY on an explicit user action (never automatic).

- core/ai.py: provider chosen explicitly (no default) — ollama (local) or claude
  (Anthropic Messages API via stdlib urllib; key in keyring). Grounded prompt;
  HTTP error parsing; one-shot (no thinking/caching — snappy).
- core/ai_knowledge.py: curated reference KB (Xid/SMART/Proton/tunables),
  exact keyword/code match ("RAG-lite", no embeddings) injected into the prompt —
  lifts local models, sharpens Claude. No fine-tuning.
- config: ai_provider/ai_model/ai_endpoint + keyring-backed AI key (generalized
  the token keyring helpers).
- GUI: Settings → AI assistant (provider radios, model/endpoint/key, Save/Test);
  "Explain with AI" button on the diagnostic dialog (consent prompt for cloud).
- CLI: `rigdoctor ai status|test|explain`.
- Docs: D24, SPEC/MODULES/ROADMAP (Phase 7); tests for providers/grounding/parse.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 13:19:11 +02:00
parent 2fe03269e4
commit 2ff4056d89
14 changed files with 703 additions and 41 deletions
+13
View File
@@ -5,6 +5,19 @@ All notable changes to RigDoctor are recorded here. Format follows
(`MAJOR.MINOR.PATCH`, pre-1.0). `__version__` and `pyproject.toml` must match the git
release tag (so the auto-updater, D18, can compare versions).
## [0.27.0] - 2026-05-22
### Added
- **AI assistant (M14, D24)** — optional, **strictly opt-in, never automatic**. Explains your
diagnostics in plain language only when you press **"Explain with AI"** on the diagnostic
dialog (or run `rigdoctor ai explain`). You choose a provider explicitly (no default):
**Ollama** (local, private, no key) or **Claude** (Anthropic; key stored in the keyring, with
a consent prompt before any data is sent). Configure in **Settings → AI assistant**.
- Answers are **grounded**: RigDoctor passes the actual findings plus matched reference facts
from a curated knowledge base (`core/ai_knowledge.py` — exact keyword/code match, no
embeddings, stdlib only), so even a small local model gets the domain facts it needs. Stdlib
`urllib` only — no new core dependency. Output is advisory (D9).
- CLI: `rigdoctor ai status|test|explain`.
## [0.26.1] - 2026-05-22
### Fixed
- **Setup wizard contrast.** The **radio buttons** (Recording trigger) were unstyled, so the