285 lines
11 KiB
Cheetah
285 lines
11 KiB
Cheetah
# Jeannie AI & Operations
|
|
|
|
## Implementation Language Policy
|
|
|
|
Jeannie keeps `./{{ main_script }}` as the stable command entrypoint. New durable
|
|
read-only orchestration, report rendering, inventory parsing, status/doctor
|
|
logic, and self-heal planning should prefer Go under `cmd/jeannie-core` because
|
|
it ships as one small binary and is easier to test than Bash. Bash remains for
|
|
thin compatibility wrappers and remote shell glue. Python remains acceptable for
|
|
AI/RAG, data-heavy utilities, or cases where an existing Python ecosystem is the
|
|
clear fit. New repo features should choose the smallest language that fits the
|
|
task instead of defaulting to Bash.
|
|
|
|
## Debian-Hosted AI Stack
|
|
|
|
The current AI stack is part of the Debian operations layer, not the Kubernetes
|
|
workload layer. That is deliberate: if the Pimox workers or Kubernetes control
|
|
plane are unhealthy, the triage tools still need to be available from the host
|
|
that runs Jeannie.
|
|
|
|
The split is:
|
|
|
|
- OmniRoute runs in Docker Compose under `/data/homelab-ai-stack` and exposes an
|
|
OpenAI-compatible endpoint on the Debian host.
|
|
- `deploy-ai-stack` seeds local OpenRouter and NVIDIA keys when present,
|
|
creates the no-auth/free provider connections, validates real chat
|
|
completions, rejects stale routes, and writes
|
|
`/data/homelab-ai-stack/models.env`.
|
|
- `deploy-ai-tools` keeps `goose`, `holmes`, and `hermes` as bare-metal tools
|
|
and generates wrapper commands (`jeannie-goose`, `jeannie-holmes`,
|
|
`jeannie-hermes`) plus `/data/homelab-ai-stack/ai-tools.env`.
|
|
- `ai-check` verifies the knowledge index, wrappers, OmniRoute endpoint, and
|
|
validated model route hints before Jeannie relies on them.
|
|
- Ollama remains on Debian for local inference. OmniRoute can route to local
|
|
or external providers; choose routes based on the task, privacy and measured
|
|
performance rather than assuming a particular provider is fastest.
|
|
|
|
Bootstrap and validation from the Debian server:
|
|
|
|
```bash
|
|
./{{ main_script }} deploy-ai-stack
|
|
./{{ main_script }} deploy-ai-tools
|
|
./{{ main_script }} ai-check
|
|
```
|
|
|
|
## Goose repository learning with Graphify
|
|
|
|
The graph is a local, Git-ignored index. Install Graphify where Goose runs and
|
|
refresh it explicitly after pulling changes:
|
|
|
|
```bash
|
|
./{{ main_script }} goose-graph update
|
|
./{{ main_script }} goose-graph context "how does cluster profile selection work?"
|
|
./{{ main_script }} goose-graph learn "explain the cluster transition pipeline"
|
|
./{{ main_script }} goose-graph propose "improve registry migration diagnostics"
|
|
```
|
|
|
|
`context` queries the graph with a 1,200-token Graphify budget and a separate
|
|
12,000-byte output cap. `learn` and `propose` pass the excerpt to the existing
|
|
`jeannie-goose` wrapper and open an interactive session. Project `.goosehints`
|
|
also guides ordinary Goose sessions to use focused queries. Verify graph
|
|
relationships against current source. Freshness compares the tracked Git
|
|
revision and working tree to the last Jeannie update; it cannot detect changes
|
|
to untracked files. Other graph updates have unknown freshness.
|
|
|
|
The prompts request no modifications or tests and set Goose approval mode. This
|
|
is guidance plus best-effort tool permissions, not an OS-enforced read-only
|
|
sandbox; configured overrides and other extensions still matter. Review tool
|
|
approvals and proposals. Depending on the OmniRoute route, the question, graph
|
|
excerpt and source Goose reads may be sent to an external provider. Token savings
|
|
depend on the model and task; the byte cap is not an exact token count.
|
|
|
|
## AI inference lab
|
|
|
|
The optional [AI lab](ai-lab.md) installs pinned llama.cpp and Colibri builds
|
|
separately from production routes. `./{{ main_script }} ai-lab devices` reports
|
|
available devices, and `./{{ main_script }} ai-lab suite` repeats a set of
|
|
prompts across available backends. Compare response quality and timing along
|
|
with logs confirming actual device placement; the suite does not select a
|
|
winner or automatically change model routes.
|
|
|
|
## Holmes-Assisted Kubernetes Doctor
|
|
|
|
`doctor-k8s` is the first integration point between deterministic Jeannie
|
|
doctors and the AI stack. It collects read-only Kubernetes evidence, writes an
|
|
artifact directory under `~/.local/share/homelab/doctor-k8s`, and asks Holmes
|
|
for triage through the OmniRoute route selected in `models.env`.
|
|
|
|
```bash
|
|
./{{ main_script }} doctor-k8s
|
|
./{{ main_script }} doctor-k8s --no-holmes
|
|
```
|
|
|
|
The evidence bundle identifies the selected profile, runtime, and control-plane
|
|
node. Failed reads are marked unknown. Holmes must return JSON with cited check
|
|
IDs; Jeannie renders facts from the evidence and validates citations and any
|
|
next command using the same rules as focused doctor explanations. An invalid
|
|
response is rejected and the deterministic artifacts remain available. The
|
|
private artifact directory holds the evidence, validated explanation, raw model
|
|
response, and error log. Schema validation cannot prove a hypothesis correct.
|
|
|
|
Holmes is instructed not to call tools and is invoked with `--bash-always-deny`;
|
|
this is not a substitute for restricting its credentials and configured tools.
|
|
The selected OmniRoute provider can be local or external. Remediation remains
|
|
outside this diagnostic flow and goes through Jeannie's guarded actions.
|
|
|
|
## Hermes and Jeannie
|
|
|
|
`./{{ main_script }} hermes-connect` installs and enables the `jeannie-readonly`
|
|
Hermes plugin, then restarts the user gateway. `deploy-hermes` also runs this
|
|
step. The plugin exposes `jeannie_status` (fast JSON health report) and
|
|
`jeannie_runbooks` (cited local index lookup). It follows the saved Jeannie
|
|
profile for each call and rejects status data if the profile or pinned UID
|
|
changes. The response hook prefixes the selected profile and runtime, or reports
|
|
that profile lookup failed. It describes the saved selection, not proof that
|
|
the cluster is running.
|
|
|
|
The integration provides no mutation or arbitrary-command tool. It does not
|
|
disable other Hermes tools or change their permissions. The output hook depends
|
|
on the installed Hermes version and other active response-transform plugins;
|
|
verify the header in both CLI and Matrix after deployment. The checkout that
|
|
ran `hermes-connect` is recorded as the plugin's Jeannie source. Runbook lookup
|
|
requires an existing `./{{ main_script }} ai-index`. OmniRoute may use an
|
|
external model provider, depending on the configured route.
|
|
|
|
Hermes uses the HTTPS Matrix homeserver URL. The edge requests Matrix and Element
|
|
names on its shared Let's Encrypt certificate and copies it to their isolated
|
|
files on deployment and renewal only when it is unexpired and covers both names.
|
|
Otherwise it retains the existing Matrix certificate and logs a warning. Run
|
|
`./{{ main_script }} edge apply` to install the updated renewal script.
|
|
`./{{ main_script }} deploy-hermes` regenerates the Hermes environment and
|
|
restarts its gateway.
|
|
|
|
## AI Evals
|
|
|
|
The repo includes a local eval harness for Jeannie explanations and homelab RAG
|
|
grounding. It uses fixtures and allowlisted read-only commands, so it is safe to
|
|
run before changing the lab:
|
|
|
|
```bash
|
|
./{{ main_script }} ai-evals run
|
|
```
|
|
|
|
Use `./{{ main_script }} ai-evals list` to see the current cases. Add new cases
|
|
under `infra/ai-evals` whenever a troubleshooting pattern or runbook behavior
|
|
should become repeatable.
|
|
|
|
## Prompt Injection Lab
|
|
|
|
The defensive security training path includes local prompt-injection fixtures
|
|
for hostile runbooks, tool output, dashboard annotations, and command arguments.
|
|
Run it without touching live infrastructure:
|
|
|
|
```bash
|
|
./{{ main_script }} prompt-injection-lab run
|
|
```
|
|
|
|
Cases live under `security/prompt-injection-lab` and are meant to become
|
|
regression tests for future Jeannie AI features.
|
|
|
|
## Incident Commander
|
|
|
|
The repo also includes a read-only incident commander trainer. It classifies
|
|
pasted failure text, prints a likely hypothesis, links the right runbook, and
|
|
lists the next read-only Jeannie commands:
|
|
|
|
```bash
|
|
./{{ main_script }} incident replay
|
|
./{{ main_script }} incident triage --text "502 Bad Gateway from nginx"
|
|
```
|
|
|
|
Incident fixtures live under `infra/incident-commander`. Use them to turn
|
|
repeat outages into repeatable triage behavior before adding any self-healing.
|
|
|
|
## Safety Cases
|
|
|
|
Before high-blast-radius changes, generate a safety case from the Git diff:
|
|
|
|
```bash
|
|
./{{ main_script }} safety-case --since HEAD~1
|
|
```
|
|
|
|
It summarizes risk, blast radius, required validation, rollback, and forbidden
|
|
actions. The implementation lives under `infra/safety-cases` and reuses the
|
|
same impact rules as `./{{ main_script }} impact`.
|
|
|
|
## Agent Sandbox
|
|
|
|
Future Jeannie AI actions should be checked before execution. The local sandbox
|
|
policy starts with a read-only command classifier:
|
|
|
|
```bash
|
|
./{{ main_script }} agent-sandbox check "./{{ main_script }} status"
|
|
./{{ main_script }} agent-sandbox check "./{{ main_script }} nuke"
|
|
```
|
|
|
|
Policy is stored in `infra/agent-sandbox/policy.tsv`.
|
|
|
|
## AI Workload Scheduling
|
|
|
|
For AI-ish workloads, Jeannie can simulate placement across Debian, Pimox
|
|
workers, and the RPi based on CPU, memory, architecture, tailnet access, and
|
|
control-plane policy:
|
|
|
|
```bash
|
|
./{{ main_script }} ai-scheduler recommend small-rag
|
|
./{{ main_script }} ai-scheduler simulate
|
|
```
|
|
|
|
The simulator lives under `infra/ai-scheduler` and is a stepping stone toward a
|
|
real Kubernetes controller.
|
|
|
|
## Memory With Provenance
|
|
|
|
Jeannie can return cited retrieval context and check whether the local RAG index
|
|
is stale:
|
|
|
|
```bash
|
|
./{{ main_script }} ask --citations "how do I recover the cluster?"
|
|
./{{ main_script }} ai-memory check
|
|
```
|
|
|
|
This keeps local AI answers grounded in repo files and runbooks.
|
|
|
|
## Red/Blue Loop
|
|
|
|
Safe red-team/blue-team checks are grouped under one command:
|
|
|
|
```bash
|
|
./{{ main_script }} red-blue plan
|
|
./{{ main_script }} red-blue run --local
|
|
```
|
|
|
|
Local mode runs deterministic prompt-injection and eval checks. Live scans are
|
|
listed but gated so they can run from the Debian host when intended.
|
|
|
|
## Canary Promotion
|
|
|
|
The promotion helper defines release gates before production changes:
|
|
|
|
```bash
|
|
./{{ main_script }} promote plan
|
|
./{{ main_script }} promote validate
|
|
./{{ main_script }} promote rollback website-production
|
|
```
|
|
|
|
The current version is intentionally conservative: it validates local gates and
|
|
prints rollback steps while dev namespace automation remains explicit future
|
|
work.
|
|
|
|
## Guarded Self-Healing
|
|
|
|
Jeannie can turn status findings into an experimental self-heal plan:
|
|
|
|
```bash
|
|
./{{ main_script }} status --heal-plan
|
|
./{{ main_script }} status --heal
|
|
./{{ main_script }} heal apply --yes
|
|
```
|
|
|
|
Normal `status` remains read-only. The heal planner maps known findings to
|
|
guarded actions, chooses one highest-impact auto-eligible finding, checks the
|
|
proposed command against `infra/agent-sandbox/policy.tsv`, and runs only that
|
|
one action. Re-run `./{{ main_script }} status` after every heal cycle so Jeannie
|
|
can reassess before touching the next issue. If a specific Pimox worker is
|
|
NotReady, heal targets that worker with `./{{ main_script }} workers restart N`
|
|
instead of repeating a broad cluster start. After an action runs, Jeannie waits
|
|
for the target condition to clear and reports `healed` or `still failing`.
|
|
Failed heal actions are placed on a short cooldown so Jeannie does not loop on
|
|
the same VM restart; the next plan escalates to diagnostics instead.
|
|
Destructive actions remain blocked.
|
|
|
|
## Model Behavior Observatory
|
|
|
|
Stable prompts track local model behavior, latency, refusal behavior, and
|
|
tool-correctness signals over time:
|
|
|
|
```bash
|
|
./{{ main_script }} model-observe prompts
|
|
./{{ main_script }} model-observe run --offline
|
|
./{{ main_script }} model-observe report
|
|
```
|
|
|
|
Use `--live` only when Ollama is available.
|