feat: finalize package presence branch and docs alignment

This commit is contained in:
2026-05-11 20:38:16 +02:00
parent fab1f3afbf
commit 013410999a
4 changed files with 33 additions and 16 deletions

View File

@@ -10,7 +10,20 @@ ______________________________________________________________________
### Added ### Added
- Nothing yet. - Tier 3 core session memory implementation:
- new `src/tai/session_store.py` persistent ChromaDB store
- `--session-memory` option on `tai run`
- prior-session retrieval injected into analysis/follow-up prompts
- final response indexing at session end
- Planner enhancements for broader service detection:
- generic service candidate extraction from free text
- package presence probes in plans (`rpm -q` and `dpkg-query -W`)
- SSH read-only allowlist expanded to permit package presence commands (`rpm`, `dpkg-query`)
- Session memory tests in `tests/test_session_store.py`
### Changed
- Documentation alignment updates in README and ROADMAP to reflect implemented session memory and package-presence capabilities.
______________________________________________________________________ ______________________________________________________________________

View File

@@ -191,9 +191,8 @@ pytest tests/test_plan.py tests/test_ai.py tests/test_cli.py
## Known Limits ## Known Limits
- Service-specific presence checks currently apply to recognized service/subsystem names. - Deep service-specific probes (known binary/config/package aliases) are richer for recognized services than generic service names.
- Package-manager-level presence checks are not yet in the default read-only command allowlist. - Session memory is available via `--session-memory`, but dedicated history UX commands (`tai history`, `/history`) are not implemented yet.
- Tier 3 persistent session memory is not implemented yet.
## Changelog and Roadmap ## Changelog and Roadmap

View File

@@ -143,7 +143,7 @@ ______________________________________________________________________
| Hybrid retrieval | Semantic only, BM25 only, hybrid | Hybrid (BM25 keyword + cosine semantic) for best recall | ⬜ Pending | | Hybrid retrieval | Semantic only, BM25 only, hybrid | Hybrid (BM25 keyword + cosine semantic) for best recall | ⬜ Pending |
| Reranking | None, cross-encoder (`ms-marco-MiniLM`), LLM-as-judge | Cross-encoder rerank pass before prompt injection | ⬜ Pending | | Reranking | None, cross-encoder (`ms-marco-MiniLM`), LLM-as-judge | Cross-encoder rerank pass before prompt injection | ⬜ Pending |
| Runbook format | Markdown, YAML, JSON | Markdown (human-editable, version-controllable) | ✅ Implemented | | Runbook format | Markdown, YAML, JSON | Markdown (human-editable, version-controllable) | ✅ Implemented |
| Session index storage | Local `~/.tai/`, configurable path | `~/.tai/sessions/` with ChromaDB collection | ⬜ Pending | | Session index storage | Local `~/.tai/`, configurable path | `~/.tai/sessions/` with ChromaDB collection | ✅ Implemented (core) |
______________________________________________________________________ ______________________________________________________________________
@@ -229,28 +229,30 @@ ______________________________________________________________________
### Tier 3 — Session Memory Index (institutional learning) ### Tier 3 — Session Memory Index (institutional learning)
Status: ⬜ Pending Status: ✅ Implemented (core retrieval/indexing) / ⬜ UX commands pending
**Problem:** Every session starts from zero. Repeat incidents on the same host or **Problem:** Every session starts from zero. Repeat incidents on the same host or
same issue type get no benefit from past work. same issue type get no benefit from past work.
**Approach:** **Implemented now:**
- On session end, embed the session summary (issue + root cause + actions) and upsert into a persistent ChromaDB collection (`~/.tai/sessions/`) - On session end, embed the session summary (issue + root cause + actions) and upsert into a persistent ChromaDB collection (`~/.tai/sessions/`)
- On session start, query for similar past sessions by issue text + hostname - On session start, query for similar past sessions by issue text + hostname
- Inject top-2 past sessions as `## Prior Sessions` context - Inject top-2 past sessions as `## Prior Sessions` context
- Optionally: `/history` command in interactive mode to surface past sessions explicitly
**Pending UX layer:**
- `/history` command in interactive mode to surface past sessions explicitly
**New module:** `src/tai/session_store.py` **New module:** `src/tai/session_store.py`
- `SessionStore`: wraps ChromaDB collection at `~/.tai/sessions/` - `SessionStore`: wraps ChromaDB collection at `~/.tai/sessions/`
- `index_session(session_log_path)` — embed and store completed session - `index_session(host, issue, summary, ai)` — embed and store completed session
- `query_similar(issue, host, top_k) -> list[PastSession]` - `query(question, host, ai, top_k) -> list[PastSession]`
**Changes to existing code:** **Changes to existing code:**
- `session_log.py`: add `summarise() -> str` method (issue + final AI response) - `cli.py`: query `SessionStore` during analysis turns and index final responses at session end
- `cli.py`: query `SessionStore` at session start, index at session end
**Companion features buildable at same time:** **Companion features buildable at same time:**
@@ -308,14 +310,14 @@ ______________________________________________________________________
| Date | Decision | Outcome | | Date | Decision | Outcome |
|------|----------|---------| |------|----------|---------|
| 2026-05-04 | Implementation language | Python — with single distributable binary via Nuitka | | 2026-05-04 | Implementation language | Python — with single distributable binary via Nuitka |
| — | AI inference backend | vLLM (provisional) | | 2026-05-04 | AI backend API | OpenAI-compatible API endpoint (local Ollama by default) |
| | Default model | `gemma4:a4b` (provisional) | | 2026-05-04 | Default model | `gemma3:4b` |
| 2026-05-04 | SSH auth methods | Keypair only (ed25519/RSA); auto-accept new hosts; reject on key change (MITM) | | 2026-05-04 | SSH auth methods | Keypair only (ed25519/RSA); auto-accept new hosts; reject on key change (MITM) |
| 2026-05-04 | Bastion host support | `--jump-host` flag via SSH native ProxyJump | | 2026-05-04 | Bastion host support | `--jump-host` flag via SSH native ProxyJump |
| 2026-05-04 | SSH config behavior | Use `~/.ssh/config` by default; allow override via `--ignore-ssh-config` | | 2026-05-04 | SSH config behavior | Use `~/.ssh/config` by default; allow override via `--ignore-ssh-config` |
| 2026-05-04 | CLI vs interactive mode | Interactive: REPL for v0.1, `textual` TUI for v0.2+ | | 2026-05-04 | CLI vs interactive mode | Interactive: REPL for v0.1, `textual` TUI for v0.2+ |
| 2026-05-04 | RAG embedding model | `nomic-embed-text` via Ollama (local, air-gapped safe) — ⬜ pending confirmation | | 2026-05-04 | RAG embedding model | `nomic-embed-text` via Ollama (local, air-gapped safe) |
| 2026-05-04 | RAG vector store (Tier 1) | In-memory numpy cosine similarity — zero deps, session-scoped | | 2026-05-04 | RAG vector store (Tier 1) | In-memory numpy cosine similarity — zero deps, session-scoped |
| 2026-05-04 | RAG vector store (Tier 2/3) | `chromadb` embedded mode (default) or `qdrant` self-hosted — ⬜ pending confirmation | | 2026-05-04 | RAG vector store (Tier 2/3) | `chromadb` embedded mode (default) or `qdrant` self-hosted |
| 2026-05-04 | RAG chunking unit | Command-boundary splitting — each collected command = one or more chunks | | 2026-05-04 | RAG chunking unit | Command-boundary splitting — each collected command = one or more chunks |
| 2026-05-04 | Runbook format | Markdown with YAML frontmatter, version-controlled in `runbooks/` directory | | 2026-05-04 | Runbook format | Markdown with YAML frontmatter, version-controlled in `runbooks/` directory |

View File

@@ -7,6 +7,8 @@ disabled, so tai wires ChromaDB to this no-op client instead.
from __future__ import annotations from __future__ import annotations
from typing import override
from chromadb.config import System from chromadb.config import System
from chromadb.telemetry.product import ProductTelemetryClient, ProductTelemetryEvent from chromadb.telemetry.product import ProductTelemetryClient, ProductTelemetryEvent
@@ -17,6 +19,7 @@ class NoOpProductTelemetryClient(ProductTelemetryClient):
def __init__(self, system: System): def __init__(self, system: System):
super().__init__(system) super().__init__(system)
@override
def capture(self, event: ProductTelemetryEvent) -> None: def capture(self, event: ProductTelemetryEvent) -> None:
del event del event
return None return None