Skip to content

Commit fb5e64a

Browse files
Kabuki94claude
andcommitted
chore(claude): CLAUDE.md is now an OpenAI-API pointer, not a MiOS build doc
CLAUDE.md no longer describes MiOS internals (Containerfile pipeline, automation/ scripts, architectural laws, etc.). It is now a thin agent- identity pointer that redirects to: 1. The canonical 'MiOS' system prompt at /usr/share/mios/ai/system.md (with /etc/ + ~/.config/ override layers). 2. OpenAI's public API documentation and standards as the source of truth for the served surface (api-reference, models, function-calling, structured-outputs, embeddings, realtime, cookbook, agents.md). Build/architecture documentation that previously lived in CLAUDE.md is already covered by INDEX.md, ARCHITECTURE.md, ENGINEERING.md, SELF-BUILD.md, DEPLOY.md, SECURITY.md, and CONTRIBUTING.md -- no information is lost. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5098f4d commit fb5e64a

1 file changed

Lines changed: 31 additions & 106 deletions

File tree

CLAUDE.md

Lines changed: 31 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,47 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
> Claude agent entry point. Pointer file -- no MiOS-internal documentation.
44
5-
> Canonical agent prompt: `/usr/share/mios/ai/system.md` (deployed from `mios-bootstrap`).
6-
> Loading order: `/usr/share/mios/ai/system.md``/etc/mios/ai/system-prompt.md` (host override) → `~/.config/mios/system-prompt.md` (user override).
5+
MiOS targets the OpenAI public API surface at
6+
`MIOS_AI_ENDPOINT=http://localhost:8080/v1` (Architectural Law 5:
7+
UNIFIED-AI-REDIRECTS). All Claude/Cline/Cursor/Codex/Gemini sessions resolve
8+
the same canonical prompt regardless of which repo they were invoked from.
79

8-
## What this repo is
10+
## Canonical prompt
911

10-
'MiOS' is an immutable, `bootc`-managed Fedora-derived workstation OS distributed as an OCI image. The repo root **is** the deployed system root: `usr/`, `etc/`, `srv/`, `var/`, `proc/`, `opt/` at the top level mirror their FHS-3.0 destinations. There is no `system_files/` indirection; `automation/08-system-files-overlay.sh` overlays them into the image.
11-
12-
The published image is `ghcr.io/mios-dev/mios:latest` and is built `FROM ghcr.io/ublue-os/ucore-hci:stable-nvidia` (set via `MIOS_BASE_IMAGE`).
13-
14-
## Build commands
15-
16-
Linux orchestrator is `Justfile`; Windows orchestrator is `mios-build-local.ps1`. Do not invent a "cloud-ws.ps1" or four-stage pipeline — neither exists.
17-
18-
```bash
19-
just preflight # System prereq check (tools/preflight.sh)
20-
just build # Build OCI image -> localhost/mios:latest
21-
just lint # Re-run `bootc container lint` on the built image
22-
just rechunk # Optimize Day-2 deltas (rechunk into versioned tag)
23-
just raw # RAW disk image via BIB
24-
just iso # Anaconda installer ISO via BIB
25-
just qcow2 # Requires MIOS_USER_PASSWORD_HASH env (openssl passwd -6)
26-
just vhdx # Hyper-V VHDX (same env requirement)
27-
just wsl2 # WSL2 tarball
28-
just sbom # CycloneDX SBOM via syft
29-
just artifact # Refresh AI manifests, UKB, and Wiki docs
30-
just all-bootstrap # build + rechunk + log to bootstrap repo
3112
```
32-
33-
Windows: `.\preflight.ps1` then `.\mios-build-local.ps1` (rootful Podman machine, credential injection, BIB, GHCR push, cleanup).
34-
35-
The `Containerfile` already runs `bootc container lint` as its final RUN — `just build` is itself the lint gate.
36-
37-
## Phase-2 build pipeline (the `automation/` directory)
38-
39-
`Containerfile` triggers `automation/build.sh`, which iterates every `automation/[0-9][0-9]-*.sh` in lexicographic numeric order. **Sub-phase numbering encodes dependency order and must be preserved when adding new scripts.** Per-script failures are captured in `FAIL_LOG`/`WARN_LOG` (set +e wrapper around each invocation, `automation/build.sh:234-237`) — the orchestrator does not abort. Critical packages are post-validated via `rpm -q` against `packages-critical` from `PACKAGES.md`.
40-
41-
Skipped under the in-Containerfile build:
42-
- `08-system-files-overlay.sh` — runs pre-pipeline directly from `Containerfile`
43-
- `37-ollama-prep.sh` — CI-skipped
44-
45-
The full pipeline spans five phases owned by two repos:
46-
47-
| Phase | Owner | Description |
48-
|---|---|---|
49-
| 0 | `mios-bootstrap.git/install.sh` | Preflight + profile load + identity capture |
50-
| 1 | `mios-bootstrap.git/install.sh` | Total Root Merge of `mios.git` and `mios-bootstrap.git` to `/` |
51-
| 2 | `Containerfile` + `automation/build.sh` | Build (this repo) |
52-
| 3 | `mios.git/install.sh` + bootstrap profile staging | sysusers/tmpfiles + user create + per-user `~/.config/mios/{profile.toml,system-prompt.md}` |
53-
| 4 | `mios-bootstrap.git/install.sh` | Reboot prompt |
54-
55-
## Architectural Laws (non-negotiable, build/audit-fail on violation)
56-
57-
1. **USR-OVER-ETC** — static config in `/usr/lib/<component>.d/`; `/etc/` is admin-override only. Documented exceptions are upstream-contract surfaces (`/etc/yum.repos.d/`, `/etc/nvidia-container-toolkit/`).
58-
2. **NO-MKDIR-IN-VAR** — every `/var/` path declared via `usr/lib/tmpfiles.d/*.conf`. **Never write to `/var/` at build time.** bootc forbids it; lint will fail.
59-
3. **BOUND-IMAGES** — every Quadlet image symlinked into `/usr/lib/bootc/bound-images.d/`. Binder loop: `automation/08-system-files-overlay.sh:74-86`.
60-
4. **BOOTC-CONTAINER-LINT** — must be the final `RUN` of `Containerfile`. No `--squash-all` (strips OCI metadata bootc needs).
61-
5. **UNIFIED-AI-REDIRECTS** — all agents target `MIOS_AI_ENDPOINT` (`http://localhost:8080/v1`). Vendor-hardcoded URLs are forbidden. Endpoint served by `etc/containers/systemd/mios-ai.container`.
62-
6. **UNPRIVILEGED-QUADLETS** — every Quadlet declares `User=`, `Group=`, `Delegate=yes`. Documented root exceptions: `mios-ceph`, `mios-k3s` (file headers explain why).
63-
64-
## Package management
65-
66-
Single source of truth: `usr/share/mios/PACKAGES.md`. Every RPM lives in a fenced ` ```packages-<category>` block parsed by `automation/lib/packages.sh:get_packages` (regex `/^```packages-${category}$/,/^```$/`). **Never call `dnf install` on hard-coded names.** Use:
67-
68-
- `install_packages "<category>"` — best-effort, `--skip-unavailable`
69-
- `install_packages_strict "<category>"` — fails the script on any miss
70-
- `install_packages_optional "<category>"` — pure best-effort, never fails
71-
72-
Kernel rule: only add `kernel-modules-extra`, `kernel-devel`, `kernel-headers`, `kernel-tools`. Never upgrade `kernel`/`kernel-core` in-container — `automation/01-repos.sh` excludes them. dnf option spelling is `install_weak_deps=False` (underscore); `install_weakdeps` is silently ignored by dnf5.
73-
74-
## Containerfile shape
75-
76-
Single-stage main image with a `ctx` scratch context that bind-mounts read-only at `/ctx`. Mutating writes go to `/tmp/build`. The `Containerfile` pre-pipeline `RUN` installs `packages-base` (security stack) before `automation/build.sh` runs.
77-
78-
## Shell conventions
79-
80-
- `set -euo pipefail` at the top of every phase script.
81-
- Arithmetic: `VAR=$((VAR + 1))`. **`((VAR++))` is forbidden** — under `set -e` it exits 1 when the result is 0.
82-
- shellcheck-clean. SC2038 is fatal in CI (`.github/workflows/mios-ci.yml`).
83-
- File naming: `NN-name.sh` where NN encodes execution order.
84-
85-
## Kargs format
86-
87-
`usr/lib/bootc/kargs.d/*.toml` uses a flat top-level array; bootc rejects anything else:
88-
89-
```toml
90-
kargs = ["init_on_alloc=1", "lockdown=integrity"]
13+
/usr/share/mios/ai/system.md (image-baked, deployed from mios-bootstrap)
14+
/etc/mios/ai/system-prompt.md (host-local override)
15+
~/.config/mios/system-prompt.md (per-user override)
9116
```
9217

93-
No `[kargs]` section header, no `delete` sub-key. Files processed in lexicographic order; earlier entries cannot be removed by later files in the same image — use runtime `bootc kargs --delete` for removal.
18+
Highest layer present wins; `$MIOS_AI_SYSTEM_PROMPT` overrides them all.
9419

95-
Note: `lockdown=integrity` (not `confidentiality`). `init_on_alloc=1`, `init_on_free=1`, `page_alloc.shuffle=1` are **disabled** in 'MiOS' due to NVIDIA/CUDA incompatibility.
20+
## OpenAI API documents and standards (source of truth)
9621

97-
## Service gating
22+
| Surface | URL |
23+
|---|---|
24+
| API Reference | https://platform.openai.com/docs/api-reference |
25+
| Models catalog | https://platform.openai.com/docs/models |
26+
| Function calling / tools | https://platform.openai.com/docs/guides/function-calling |
27+
| Structured outputs | https://platform.openai.com/docs/guides/structured-outputs |
28+
| Embeddings | https://platform.openai.com/docs/guides/embeddings |
29+
| Realtime / Streaming | https://platform.openai.com/docs/guides/realtime |
30+
| OpenAI Cookbook | https://cookbook.openai.com/ |
31+
| Moderation policy | https://platform.openai.com/docs/guides/moderation |
32+
| `agents.md` convention | https://agents.md/ |
9833

99-
- Bare-metal-only services: `ConditionVirtualization=no` drop-in.
100-
- WSL2-incompatible: `ConditionVirtualization=!wsl`.
101-
- Optional: `systemctl enable ... || true`.
34+
## Local trace
10235

103-
Every boolean in `usr/share/mios/profile.toml` ships **`true`**; the system never disables a component via static config — Quadlet `Condition*` directives short-circuit incompatible units silently.
36+
`API.md` in this repo tracks the served subset of the OpenAI surface for the
37+
deployed LocalAI build. Verify any specific endpoint with
38+
`GET /v1/models` against `MIOS_AI_ENDPOINT` before relying on it.
10439

105-
## Claude Code operating context
40+
## Operating context
10641

107-
- **cwd:** `/` is both the repo root and the deployed system root — do not treat it as dangerous.
108-
- **Confirm before:** `git push`, `bootc upgrade`, `dnf install`, `systemctl`, `rm -rf`.
109-
- **Deliverables:** complete replacement files only — no diffs, no patches, no "paste this into X" fragments. Nothing in the repo gets removed without prior discussion.
42+
- **cwd:** `/` is the repo root and the deployed system root.
43+
- **Confirm before:** `git push`, `bootc upgrade`, `dnf install`,
44+
`systemctl`, `rm -rf`.
45+
- **Deliverables:** complete replacement files only.
11046
- **Memory:** `/var/lib/mios/ai/memory/`
11147
- **Scratch:** `/var/lib/mios/ai/scratch/`
112-
- **Tasks:** use the task tool for multi-step work; one in-progress at a time.
113-
114-
## Cross-references
115-
116-
- Architectural laws and API surface: `INDEX.md`
117-
- Filesystem and hardware layout: `ARCHITECTURE.md`
118-
- Engineering standards (this file's authoritative source for build rules): `ENGINEERING.md`
119-
- Build modes: `SELF-BUILD.md`
120-
- Deployment and Day-2 lifecycle: `DEPLOY.md`
121-
- Security posture and hardening kargs: `SECURITY.md`
122-
- Contribution conventions: `CONTRIBUTING.md`

0 commit comments

Comments
 (0)