# Design Notes

> Design notes on the decisions, trade-offs, and implementation boundaries behind PIG.

---

LLMS index: [llms.txt](/llms.txt)

---

Design notes explain the decisions and proposals behind PIG. Each note gives its date, status,
scope, alternatives, and supporting evidence. Proposals describe directions under discussion;
implemented and released records explain work that has reached those stages.

For command syntax and usage, use the [PIG documentation](/docs/). For changes in each version,
use the [release notes](/release/).

---

Section pages:

- [From Human-Friendly to Agent-Native: PIG's CLI Contract](/design/agent-native-cli/): How PIG separates terminal text, structured results, execution plans, and environment context.
- [Compile, Validate, Then Commit: The Native sty conf Pipeline](/design/native-sty-conf/): Why pig sty conf treats Inventory generation as a bounded compiler pipeline with path safety, structural mutations, secret discipline, and atomic output.
- [The 70% Tuner: Defining the Boundary of pig pg tune](/design/pg-tune/): How pig pg tune calculates initial PostgreSQL parameters from hardware and workload inputs.
- [Why PIG Keeps the Cobra Command Layer Flat](/design/flat-cobra-command-layer/): The source-layout decision that keeps one top-level command in one cmd file and moves concrete behavior into cli and internal packages.
- [One Grammar for Dangerous Work: PIG's Operations CLI Safety Contract](/design/ops-cli-safety/): How PIG separates primitives from orchestrators, makes destructive intent explicit, and prevents aliases or structured output from changing operational meaning.
- [Edit the Declaration, Preserve the Document: Lossless Pigsty Inventory](/design/lossless-inventory/): Why pig inventory separates YAML semantics from source bytes so scoped edits can preserve comments, ordering, anchors, and formatting.
- [Use the CMDB Pigsty Already Has](/design/existing-cmdb-boundary/): Why PIG retired a new revision-store design and became a thin, guarded adapter to Pigsty's existing PostgreSQL CMDB.
- [A Bounded Grafana Client Instead of Dashboard Shell Scripts](/design/native-grafana-management/): How pig sty grafana manages dashboards and preferences through a native HTTP client.
- [Let Patronictl Speak for Itself](/design/patronictl-passthrough/): Why pig pt stopped mirroring Patronictl's command tree and became a transparent launcher with only a few PIG-owned local helpers.
- [PIG 2.0 Product Direction](/design/pig-2-product-direction/): The proposed PIG 2.0 boundary: a stable Pigsty onboarding front door, verifiable Catalog client, and thin orchestrator that keeps deployment explicit.
- [Catalog v2 Proposal: Immutable Typed Snapshots](/design/catalog-v2-snapshots/): A proposed verifiable Catalog model with typed targets, content-addressed snapshots, explicit activation, project pins, and offline import.
- [Bootstrapping a Pigsty Controller as a Recoverable Transaction](/design/native-sty-boot/): Why pig sty boot resolves sources before elevation, separates hard failures from finishing warnings, and restores repositories after failed setup.
- [Why PIG Builds Debug Packages by Default](/design/debug-packages-by-default/): The build-policy decision that makes RPM debuginfo/debugsource and DEB dbgsym output opt-out rather than opt-in.
- [Install the Pigsty Repository Key Automatically](/design/automatic-pigsty-repo-key/): Prepare the Pigsty key best-effort, reuse existing files, and fall back with a warning unless repository metadata explicitly names a key.
- [One-command Xray Clients and Servers](/design/xray-client-server/): One-command VLESS, REALITY, and Vision client/server setup, stable server credentials, and verified proxy connectivity.
- [Require Explicit Kernel Aliases for Protected Package Removal](/design/protected-package-removal/): A removal boundary based on the resolved package and the user's original operand, while retaining independent language-package removal.
- [One Catalog Entry Count for the Website and CLI](/design/catalog-entry-count/): Count every catalog record consistently across the website, extension lists, availability summaries, and catalog refresh results.
- [Target PostgreSQL Versions for Category Aliases](/design/category-alias-target-version/): Use the requested PostgreSQL major when dynamic category aliases select extension packages.
