Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/pi-register/blob/main/AGENTS.md # pi-register aien-dev/pi-register Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `pi-register / AGENTS.md` 71 lines ยท 5019 bytes Raw Blame History Rendered 1 # pi-register (a register of the services on a Linux server) 2 3 > `pi-register` is a small Rust command-line tool that reads a hand-kept list of the services a Debian/Ubuntu systemd machine runs and why, and compares it with what systemd reports. The tracked `register.toml` is a generic example only. It is an operations tool that supports Sovereign Intelligence (SI), the whole system; AienOS is the operating-system layer and Aienux is the AienOS kernel. The tool is not part of Sovereign Intelligence itself. 4 Shared rules: read https://www.aienos.com/agents/RULES.md first. This file adds what is specific to this repository; where the two differ, this file wins here. 5 6 ## Scope 7 8 - Applies to the whole repository: `src/main.rs` (the whole program, unit tests included), `register.toml`, `Cargo.toml`, `Cargo.lock`. 9 - Keep `register.toml` generic. Real inventories belong in ignored `register.local.toml` or `/etc/pi-register/register.toml`, never tracked files. 10 - `.crumb` is compiled crumb metadata. Do not edit it by hand. `.crumb.local` is local-only and ignored by git. 11 - CI (`.github/workflows/ci.yml`) runs `cargo build --locked --all-targets` and `cargo test --locked` on every pull request and push to `main`. Checks against a live systemd machine stay local. 12 13 ## Installation 14 15 ```bash 16 git clone https://github.com/aien-dev/pi-register.git 17 cd pi-register 18 cargo build --release 19 ``` 20 21 Needs a stable Rust toolchain. Dependencies are `clap`, `serde` and `toml`. The binary is `target/release/pi-register`. 22 23 ## Configuration 24 25 - Register location: `--register `, else `/etc/pi-register/register.toml`, else `./register.toml`. 26 - The ignored `register.local.toml` requires an explicit `--register register.local.toml`; it is not an automatic fallback. Preserve an existing deployment's full register privately before updating, then migrate checkout-path callers or install it at the existing `/etc` default. See README for the migration procedure. 27 - Each service is a `[[service]]` table. Required fields: `name`, `purpose`, `unit`, `category`, `owner`, `boot`. Optional: `port`, `depends_on`, `files`, `secrets`, `health`, `notes`. 28 - A `unit` without a suffix means `.service`; write `.timer`, `.socket` and other suffixes in full. 29 - `secrets` holds a path only, never a secret value. 30 - `health` is a shell command that exits 0 when the service is healthy. It runs through `sh -c` with the caller's privileges. 31 - `depends_on` and `files` are recorded and shown, not enforced. A name that appears twice is a load error. 32 33 ## Usage 34 35 ```bash 36 # Unit tests (no systemd access needed) 37 cargo test 38 39 # Help for every command 40 ./target/release/pi-register --help 41 42 # Markdown page describing the machine; reads the register only 43 ./target/release/pi-register --register register.toml doc 44 ``` 45 46 Commands that touch the live machine. Run them only on the server the register describes, never on a development host: 47 48 - `pi-register status`: every service with its active state, boot state and health. Calls `systemctl` and runs every `health` command. 49 - `pi-register show `: everything known about one service, plus its live state and health. 50 - `pi-register check`: every registered unit must exist; enabled service units missing from the register are listed as UNREGISTERED. Exits non-zero on any problem. 51 - `pi-register start|stop|enable|disable `: wraps `systemctl`; names not in the register are refused. These change the machine and usually need root. 52 53 ## Conventions 54 55 - One source file, `src/main.rs`. Tests live in its `#[cfg(test)]` module; add one when a parsing or validation rule can regress silently. 56 - `pi-register` itself makes no network calls. Keep it that way; network access belongs in a service's `health` command. 57 - Base-system units that `check` ignores come from a built-in list in `src/main.rs`. Extend that list rather than registering base-system units. 58 - Keep `README.md` in step with the commands and fields the code accepts. 59 60 ## Safety and approvals 61 62 - Never run `status`, `show`, `check`, `start`, `stop`, `enable` or `disable` against the example register on a machine it does not describe: `status` and `show` execute the register's `health` commands, and the control commands change systemd state. 63 - Ask before running `start`, `stop`, `enable` or `disable` on the real server, and before changing any `boot` value. Some entries are deliberately left stopped or disabled; their `notes` say why. 64 - Never put secret values, tokens, keys, private network addresses, internal hosts, personal home paths or deployment inventories in tracked files. Keep names and attribution intact. 65 - Work on a branch and merge through a pull request with the `cargo test` result in its body. 66 67 ## Further reading 68 69 - `README.md`: field reference and command list. 70 - `register.toml`: a generic worked example, never the live inventory. 71 - https://github.com/aien-dev/sovereign-intelligence: the integration, release and install center of Sovereign Intelligence (SI), where the signed Spark test runs.