Files
hermes-agent/website/docs/developer-guide/config-backend.md
Teknium bbe207c593 refactor(config): ship the seam with the file backend only
The seam had a selector and reserved members that nothing in this PR
uses: HERMES_CONFIG_BACKEND accepted only `file` (every other value
exited), the .env override existed only to decide when to refuse,
UserLayer.locks/provenance and ConfigBackend.locked() were always empty,
and the supports_file_tooling()/require_file_tooling() checks at ten
file-copy sites were always true. All of it is for the remote backend
(#122509), so it lands there with the code that makes it real.

get_config_backend() now returns the file backend. The env var, its
docs row, the dotenv override, ConfigBackendUnavailable and the
file-tooling gates are gone, with the tests that covered them. The
explicit-file routing test now proves a non-config.yaml path never
consults the backend.

probe_config_readable() calls a probe_readable() protocol method
instead of an isinstance(FileBackend) check, and version_token()
documents how it treats an int-led version.
2026-10-25 18:54:09 -07:00

2.0 KiB

sidebar_position, title, description
sidebar_position title description
12 Config Backend Seam Where a profile's user config.yaml is read and written: the ConfigBackend seam, its file backend, and the CI lints that keep every caller on it

Config Backend Seam

Every read, stat, existence check and write of a profile's user config.yaml goes through hermes_cli/config_backend.py. get_config_backend() returns the backend for every home; today that is FileBackend, the local config.yaml with exactly the primitives Hermes used before the seam (stat signature, fast_safe_load, the ruamel round-trip writers). A backend that does not store the layer as a local file implements the same ConfigBackend protocol, and every caller already reaches it.

Helpers

Helper Use
read_config_doc(path) Parsed user layer (raises like open + fast_safe_load)
read_config_doc_readonly(path) Signature-cached read; never mutate the result
config_version(path) Cache signature (the file's stat tuple)
config_exists(path) Whether the layer exists
probe_config_readable(path) Raise OSError while the layer cannot be read (no parse)
write_config_document(path, doc) / write_config_key(path, key, value) Writes; callers normally use atomic_config_write / atomic_config_replace

Only <home>/config.yaml is a user layer. Any other file passed to these helpers (an import source, a fixture) is read and written where it is. Caches keyed on config_version miss whenever the backend's layer changes. The managed scope (/etc/hermes) stays an overlay on top of whatever user layer the backend returns.

Lints

  • scripts/check_config_yaml_writers.py rejects a direct YAML dump of a config path.
  • scripts/check_config_yaml_readers.py rejects a direct open / read_text / stat / exists / YAML load of a config path. A true false positive (another product's config file, or a tool that copies or edits the local file itself: config edit, backups, profile clone) carries # config-reader: ok — <why> on the line.