# Focused Jeannie doctor Use the same inventory areas as `status`, selecting one at a time: ```sh ./jeannie doctor oci ./jeannie doctor rpi ./jeannie doctor opi5 ./jeannie doctor debian ./jeannie doctor cluster ``` The doctor reuses the selected area's status checks and adds focused diagnostics for the OCI edge, RPi, Debian, and cluster. It does not offer an all-area mode. Each device view checks OS kernel, uptime/load, available memory, root filesystem usage and systemd state as well as its services. Orange Pi also reports its selected K3s checks. Remote OS checks use inventory SSH access. Existing `doctor-edge`, `doctor-gitea`, `doctor-rpi`, `doctor-cluster`, and `doctor-k8s` remain available for their specialized investigations. To investigate one item, copy its full check name from status, or provide an Argo CD application name or Compose project/service: ```sh ./jeannie doctor cluster gitea-runner --details ./jeannie doctor gitea-runner ./jeannie doctor homelab-gitea/gitea ./jeannie doctor debian --item homelab-gitea/gitea --details ./jeannie remote doctor rpi --item homelab-rpi-services/pihole --ai ``` Matching is exact and case-insensitive. A short Compose service name is accepted only when unambiguous. Jeannie collects the area's snapshots before selecting the item; it reports an error if the name cannot be resolved. For a selected Compose container it reads state, restart count, exit code and health; for an Argo CD application it reads health, operation and unhealthy resource status and deployment replica counts. An item without a scope is looked up in Argo CD and the inventoried Compose hosts. If any source is unavailable, or a name is ambiguous, specify its scope explicitly. It does not fetch container environment variables or Kubernetes Secret contents. Remote Compose checks require noninteractive SSH and sudo. Use `--ai` to request an evidence-validated Holmes explanation, or `--no-local-rca` to disable it. AI is enabled by default for a selected item, and is off by default for a whole host or cluster scope. It does not perform repairs. `--json` returns structured evidence without AI output. These are read-only checks; any suggested remediation should be reviewed separately. For a selected Kubernetes application, Doctor also reads up to five pods selected by each deployment's simple match-label selector and the latest pod events. For each selected pod it identifies the controller, up to three PVCs, and their bound PV names and local or host paths without reading application secrets. For a container in CrashLoopBackOff with a previous restart, it also requests bounded previous-container logs, and reports when those logs are unavailable. For a pod on the configured native K3s control-plane node, it also attempts a read-only SSH query of `/data` and the pod's mount identities. This helps identify old pod bind mounts after the underlying storage is remounted. Missing SSH or mount evidence does not establish that storage is healthy. It extracts status, wait reasons, and bounded event messages without dumping pod specs. Unsupported selectors or failed reads are reported as unknown. When AI is enabled, focused Doctor invokes Holmes with the selected profile and this evidence, forbids Bash execution with `--bash-always-deny`, instructs Holmes not to call tools, and validates the citations and read-only command against the collected report. A single fenced JSON response is accepted; invalid JSON is retried once, with both responses preserved. A syntactically valid answer that fails evidence validation is rejected without retry. Failed or rejected Holmes answers leave the deterministic evidence available. Private evidence and logs are stored under the Doctor K8s artifact directory. Other Holmes toolsets and credentials must still be restricted independently; logs and event messages may contain sensitive details. Redaction is best effort, not a guarantee, and the configured OmniRoute model can be external. The dedicated Gitea runner text report remains deterministic and does not invoke Holmes. To let Holmes investigate and attempt to repair a Kubernetes application, use `./jeannie doctor cluster n8n --fix` on the Debian CLI. This checks the pinned cluster context, records a change journal entry, enables Holmes tools and automatically allows Bash commands. **Holmes has the Debian user's host-level permissions**, including any passwordless sudo access; this is not a sandbox or an application-scoped permission boundary. Its actions can change the cluster or host. Repair mode uses Holmes's interactive path on a pseudo-terminal and ends the session after Holmes saves its first response. Holmes is asked for a diagnosis, an evidence-based five whys analysis, the repair, validation and recommendations, marking unsupported causes as unknown. Doctor saves its output, errors and a report in a private artifact directory, then independently checks the selected application's Argo CD health and sync. A failed or unavailable check returns a failure; Healthy and Synced does not establish end-to-end health or confirm the root cause. This mode is unavailable through the remote API and does not accept JSON output. The repair invocation uses Holmes fast mode to skip TodoWrite planning and requests investigation tools directly; the model may still fail to call tools. The focused Kubernetes repair prompt includes the repository's `infra/ai-stack/holmes-skills/k3s-stale-volume/SKILL.md` procedure. It describes the evidence needed before considering a normal pod recreation after a storage reconnect. This is guidance for Holmes, not enforcement of its actions; its host-level Bash permissions remain unchanged. Detailed evidence and the skill are passed as a Holmes context file so mount paths containing brackets are not interpreted as terminal markup. If Holmes records no tool calls, Doctor marks the investigation incomplete even when the model prints what looks like a tool request as ordinary text. A tool call record alone does not prove that a repair was made or succeeded. When a completed response records exactly zero tool calls, Doctor retries once with the same evidence and retains both conversations. Failed, timed-out, or unreadable conversations are not retried because actions may have occurred. After a completed tool session, independent identity and application checks wait up to 90 seconds for Healthy/Synced, allowing a recreated pod to start. `LAB_HOLMES_VALIDATION_TIMEOUT_SECONDS` overrides the wait. Failed or incomplete sessions receive an immediate independent check. Unknown evidence remains unknown, and an unhealthy application remains a failed repair. For n8n, a completed tool session must also pass the container's `/healthz/readiness` HTTP check. A failed readiness request keeps the repair unsuccessful even if Argo CD reports Healthy. The final report renders paired commands and actual tool outputs rather than the interactive terminal display. Model narrative and five-whys hypotheses remain private and unverified; they cannot override recorded actions or the independent validation result. Repair mode defaults to 30 model steps, a 900-second timeout and a 2048 MiB per-tool memory limit; `LAB_HOLMES_REPAIR_MAX_STEPS`, `LAB_HOLMES_REPAIR_TIMEOUT_SECONDS` and `LAB_HOLMES_REPAIR_TOOL_MEMORY_MB` override these limits. These are limits, not a guarantee that Holmes will complete or that every tool can run within them. Repair mode defaults to `ollama_chat/qwen2.5-coder:7b` for both investigation and summarization. `LAB_HOLMES_MODEL` and `LAB_HOLMES_FAST_MODEL` can override the selection. Read-only AI explanations retain their existing model routing. When the selected model uses `ollama_chat/...`, repair mode starts a temporary loopback proxy that translates a single JSON tool request, optionally in one Markdown JSON fence, into an OpenAI-style tool call only if the requested name and arguments pass the tool's supplied JSON Schema. Other responses are passed through. It uses the Holmes pipx Python environment for `jsonschema`; override that interpreter with `LAB_HOLMES_ADAPTER_PYTHON`. The proxy buffers model output before streaming it to Holmes. Doctor exposes only the Bash tool to the local model, to reduce tool-selection errors; Bash still has host-level access. This compatibility layer does not establish that a model's proposed actions are correct; repair mode still allows host-level Bash commands. For local repair, a private temporary config disables the other installed toolsets in Holmes itself. The persistent Holmes config is unchanged. The session enables the file context, introduction, permission error guidance and system additions, leaving out unused planning prompts. This keeps Holmes's own context accounting close to what the local model receives. The local AI context removes duplicate command listings and deduplicates facts; the complete original rows remain in `source-evidence.tsv` for auditing. The local agent uses a compact system prompt while preserving the supplied task, evidence and tool history. Separate summarization requests retain their own instructions. Native Ollama calls use an 8,192-token context, temperature zero, seed 42 and a 1,024-token output limit. Holmes receives the same context and output budgets so its history management matches the local model. JSON-schema decoding uses the actual tool's argument schema: the first response requests a tool call; subsequent responses may call a tool or produce a report. Calls still pass the adapter's schema validation before Holmes receives them. For Holmes's strict Bash schema, a missing or null required-but-nullable `timeout` becomes the documented 30-second default. Other missing required arguments are not filled. This handles optional-field differences without inventing commands. If the initial model answer is prose and no tool has run, the adapter makes one additional request with a shorter prompt. It forwards the reply only if it is one schema-valid Bash call containing a single read-only `kubectl get` command. It does not invent a call from the prose or force a tool after tool history exists. Subsequent Holmes actions retain the permissions described above. If a final response only copies or summarizes a Kubernetes resource after a tool call, without a full diagnosis, mitigation and validation, the adapter asks once for the next read-only PVC or PV check using names in the evidence. It handles a plain-text request for an unavailable tool the same way, and asks for the PV after an already-completed PVC check. Only a schema-valid, single `kubectl get` call is forwarded, and a named PVC or PV must match the corresponding name in the collected mapping. If the model repeats an identical Bash command anywhere in the history, the adapter asks it once to continue using the previous result. If it repeats again, Doctor stops the investigation and reports it as incomplete rather than rerunning it. For a crashing controller-managed pod with a local PV, Doctor can include a conditional recovery candidate when its read-only bind references a different device from the current read-write `/data` mount. The collector checks the pod, PVC/PV binding identities and backing path before suggesting normal pod recreation. It executes nothing. Holmes must recheck the pod UID, controller and backing-directory accessibility, then choose the action and verify the new pod and mount. A suggested command or accepted deletion is not reported as recovery. The candidate includes concrete read-only verification commands for these prerequisites. Evidence labels display executable commands rather than prose that the model could mistake for a command. Local repair artifacts include `holmes-tool-trace.jsonl`, with requested calls and preceding tool results, written with owner-only permissions. This preserves partial investigation evidence when a timeout prevents Holmes from saving its completed conversation. Token counts, timings and stop reasons remain in the separate `ollama-metrics.jsonl`, without model content. For native K3s on the Orange Pi, `doctor opi5` collects the K3s service state, data and runtime mount identities, USB ext4 candidates and recent storage errors. If it detects a stale read-only mount whose device disappeared, it offers `./jeannie doctor opi5 --repair-k3s`. That explicit local CLI action checks the selected profile, pinned cluster identity, exclusive runtime and operation locks, and requires failed or inactive K3s and one unmounted USB ext4 partition. Before stopping private K3s workloads, it mounts the candidate read-only with journal replay disabled and checks its K3s CA against the pinned identity. It then unmounts the stale mounts without force, remounts the SSD, verifies the CA and bind mount, starts K3s, and checks the live cluster identity. It does not format a disk, run filesystem repair, or recreate the cluster. If any mount is busy or a check fails, recovery stops; the report identifies the last failure and further investigation is needed. A healthy K3s API does not prove application health. Remote recovery remains disabled unless the Jeannie API is deployed with `JEANNIE_REMOTE_K3S_REPAIR=true`. When enabled, the API accepts only the explicit `doctor opi5 --repair-k3s` recovery path. The host-side storage, mount, pinned-CA and cluster-identity guards remain authoritative, and any failed guard stops the recovery. The Gitea runner has a specific diagnosis: it compares the live Argo CD revision and Deployment with the committed zero-replica configuration, then checks the Debian runner service. If the installed host service is inactive, the report proposes a specific start command and asks before executing it in an interactive terminal. A noninteractive or remote invocation never applies that mitigation; it prints the command for a human to review. A running systemd service alone does not prove runner registration or job execution. The deterministic runner report does not request an AI explanation. The [repository retrieval experiment](doctor-retrieval-lab.md) compares frozen 7B decisions in the AI lab. It is available through the Jeannie API and does not change production Doctor or execute model-proposed fixes.