Instructions for any agent (human or model) working in this repository. Read this file, then
README.md, then docs/metrics.md before writing code.
A cross-platform host telemetry collector: one static binary per machine, installed as a boot service by one command, emitting one schema (OpenTelemetry semantic conventions) over OTLP, cheap enough to run on every laptop and server you own, and queryable by an AI without a UI.
The contract in README.md is the deliverable. Code exists to satisfy it.
- Never hand-write a metric name. Names, units and attribute keys come from
internal/schema(generated from the pinned semconv model). If a needed name is missing, add an ADR indocs/decisions/first, then regenerate. - Units are UCUM (
s,By,1,Hz,Cel,rpm,{cpu}, …). Utilization is a 0–1 fraction, never a percent. - Normalize at the edge. Nothing outside the contract may reach storage. No "raw name plus a view".
- Budgets are tests, not intentions: ≤1% of one core, ≤80 MB RSS, ≤256 MB WAL, ≤30 ms total collect. A change that breaks a budget is a failing build.
- Platform code is sealed behind
Source. No OS conditionals in the pipeline, no per-OS config files. - Reuse boring infrastructure.
prometheus/tsdb/wlogfor the buffer, stdlib for everything else. Do not write a ring buffer, a retry framework or an HTTP client wrapper. - No UI, no alerting, no TSDB, no LLM tracing. Those are explicitly out of scope; adding them is a rejected PR.
The Makefile, go.mod and cmd/host-telemetry/main.go do not exist yet — creating them with
working targets is the first task of M0. Targets are fixed by this contract:
make generate # regenerate schema constants from the vendored semconv model
make test # unit + golden tests over testdata/{linux,darwin,windows}
make budget # overhead benchmark (CPU/RSS/collect duration)
make lint
make run # foreground collector, /metrics on :9101Module path: github.com/SentimentalK/host-telemetry.
- Golden tests are the safety net: raw platform fixtures in
testdata/<os>/always produce the same series set. Adding a source means adding a fixture, not only code. - Every new source needs:
Name(),Interval(), at least one fixture, one golden row per metric, and a partial-failure case. - Commit style: conventional commits (
feat:,fix:,docs:,chore:). One logical change per commit. Do not bundle a schema change with a refactor.
make testandmake budgetpass locally and in CI.- The behaviour is exercised end-to-end on the real platform that the milestone targets: agent
started by the installed service (not by
go run), data visible in a sink,system.uptimeproves the boot path. - Failure paths demonstrated once: sink down (WAL absorbs and replays), clock jump (no negative
rates),
kill -9(no history rewrite). README.mdanddocs/metrics.mdupdated in the same commit when behaviour changes.
| Change | Location |
|---|---|
| new platform | internal/source/<os>/ + testdata/<os>/ + deploy/<os> |
| new metric | ADR (if not in semconv) → internal/schema → docs/metrics.md → source |
| new workload attribution source | internal/workload/<tool>/, optional, off unless configured |
| transport / batching | internal/otlp/ |
| buffer | internal/wal/ (thin wrapper only) |