feat(onboarding): add env-fingerprint command for agent-driven setup - #19
Merged
Conversation
Introduces the first deliverable of the LLM-driven onboarding path
(Path B): a single, idempotent command that emits a structured
snapshot of the user's local LLM CLI environment.
Designed to be consumed by an agent (Claude Code / Codex / Gemini)
that is automating an llm-relay install on the user's behalf. The
agent reads the JSON output and decides which install/configure
steps to take, rather than scraping the human-friendly `init`
output.
llm-relay env-fingerprint [--format json|yaml] [--no-doctor]
[--ports 8080,8083]
Output sections (schema_version "1"):
- llm_relay: package version + on-disk paths
- clis: per-CLI install/version/auth/config_dir (registry-keyed,
so unknown ids never appear and missing CLIs are explicit)
- ports: free/in_use per probed TCP port
- filesystem: home, claude_home, projects_dir, session count,
knowledge dir presence
- env: relevant env vars; API keys redacted to set/empty/None
so the output can be safely pasted into a bug report
- doctor (optional): summary + per-check status from run_doctor
The module is a pure collector that composes existing probes
(setup_init._detect_clis, orch.discovery.discover_all,
recover.doctor.run_doctor, detect.scanner) so it does not duplicate
detection logic and stays in sync with what the relay actually does.
Each sub-probe is wrapped in a safe-call so a single failure
produces an `_error` marker on its section without crashing the
whole snapshot -- partial data is more useful to an agent than no
data.
Tests cover: schema shape, doctor toggle, port selection, CLI
registry coverage, API-key redaction, sub-probe failure isolation,
ISO timestamp with timezone, schema contract.
This is foundational for the upcoming ONBOARDING playbook + verify
primitives that complete Path B.
Adds the env-fingerprint entry to CHANGELOG.md so the structured- snapshot command is documented alongside the other Unreleased changes. No code change.
This was referenced May 20, 2026
cnighswonger
pushed a commit
to cnighswonger/llm-relay
that referenced
this pull request
Jun 1, 2026
Third and final slice of Path B (LLM-driven onboarding). With env-fingerprint (PR ArkNill#19) describing state and verify (PR ArkNill#20) asserting expectations, this document sequences them into an end-to-end install flow an agent can follow without scraping human-friendly output. Audience: AI coding agents (Claude Code / Codex / Gemini) running an llm-relay setup on a user's behalf. The document is explicit that it is NOT a human tutorial -- humans should use README.md and `llm-relay init` directly. Structure: Phase 0 — Probe (env-fingerprint) Phase 1 — Install or upgrade the package (with extras decision table) Phase 2 — Initialize local state (llm-relay init) Phase 3 — Per-CLI integration (claude-code / openai-codex / gemini-cli) Phase 4 — Optional: start the server (Linux/macOS vs Windows service) Phase 5 — Final acceptance (verify all) Each phase ends with a `verify` call, and the playbook spells out how to respond to pass / warn / fail outcomes. Permission protocol: The playbook never assumes consent for system-modifying actions. Five explicit markers gate any operation that touches outside of read-only probes: [PERMISSION: install-package] pip install [PERMISSION: write-config] llm-relay init (writes ~/.llm-relay/, edits ~/.claude/settings.json) [PERMISSION: edit-claude-settings] direct settings.json edit (last resort) [PERMISSION: fix-permissions] chmod / chown on home dir files [PERMISSION: install-service] Windows background service registration "When to stop and ask" section enumerates ambiguous states (no CLI installed, verify fail with no remediation, multiple Python interpreters, etc.) where the agent must defer to the user instead of improvising. "What not to do" section pins down the agent's scope: do not modify session transcripts, do not install LLM CLIs on the user's behalf, do not auto-edit shell rc files, do not retry a failing remediation more than once. README updated with an "Agent-driven setup" section linking to the playbook and showing the four entry-point commands. CHANGELOG documents the playbook under Unreleased ### Added. Schema contract: both env-fingerprint and verify use schema_version "1"; the playbook calls out that an agent should fall back to the in-tree playbook for whatever release it has installed if the schema version differs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First deliverable of the LLM-driven onboarding path (Path B): a single,
idempotent command that emits a structured snapshot of the user's local LLM
CLI environment, designed to be consumed by an agent automating an
llm-relay install on the user's behalf.
Background
Onboarding has two paths:
llm-relay initwalks the userthrough setup interactively. Already exists.
Gemini) reads a playbook + structured probes, and configures the user's
environment itself. The agent needs structured, parseable input to make
decisions -- not human-friendly text.
env-fingerprintis the first piece of Path B. Subsequent pieces(ONBOARDING playbook,
llm-relay verify {install,config,integration})will land in follow-up PRs.
Output
Sections (schema_version "1"):
llm_relayclisportsfilesystemenvdoctor(optional)run_doctorDesign notes
setup_init._detect_clis,orch.discovery.discover_all,recover.doctor.run_doctor,detect.scanner). No duplicate detection logic.produces an
_errormarker on its section without crashing the wholesnapshot. Partial data is more useful to an agent than no data.
repeatedly.
SCHEMA_VERSION = "1". Adding new fields does notrequire a bump; agents should ignore unknown fields. Breaking changes bump
the version.
Test coverage
tests/test_env_fingerprint.py(17 tests):missing)
Full suite: 546 pass (529 baseline + 17 new). Ruff clean.
Smoke test
What's next (separate PRs)
docs/AGENT_SETUP.mdor similar) — structuredguideline that agents follow, with branch conditions and step/verify
pairs.
llm-relay verify {install,config,integration}— idempotent verificationprimitives that both Path A and Path B share.