← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / scientific-agent-skills / skills / get-available-resources / references / snapshot_schema.md

Snapshot Schema 1.1

The detector emits one JSON object with sorted keys. Values vary by observation, but field names and meanings are stable for schema 1.1.

Top-level contract

Null means unavailable, not zero and not unlimited. Zero is used only when a source explicitly establishes zero (for example, a named accelerator visibility variable that hides all devices).

CPU

cpu.host:

cpu.process:

cpu.cgroup_v2:

cpu.effective:

The effective value is intentionally not called a physical-core count.

Memory

memory.host preserves system-visible total_bytes and available_bytes.

memory.cgroup_v2 preserves current-cgroup usage and hierarchical effective limits:

memory.effective:

memory.model is unified_cpu_gpu on Apple silicon and system_ram otherwise. Unified GPU memory is not added again as dedicated VRAM.

Disk

None of these values proves that a filesystem or project quota permits a write of the same size.

Accelerators

accelerators.devices contains management-visible or explicitly platform-inferred candidates:

candidate_counts is a query count, not a usable-device count. candidate_upper_bounds conservatively intersects query count with parsed visibility/allocation counts when available. runtime_usable_devices remains null because no framework runtime is loaded.

visibility_environment includes only four allowlisted variable names. Raw values are never emitted.

Scheduler and cgroup

scheduler.fields_read lists allowlisted Slurm names that were present. scheduler.allocation contains parsed bounded values and scopes. scheduler.enforcement remains unknown; variables alone do not prove confinement.

cgroup_v2.scope says only root, non_root, unknown, or not_applicable. The cgroup path is not emitted.

container.detected requires a known marker. A cgroup_limit can appear as evidence without asserting that the process is in a container.

Warnings and provenance

Warnings use:

{
  "code": "STABLE_MACHINE_CODE",
  "component": "cpu",
  "message": "Human-readable, sanitized explanation.",
  "severity": "info"
}

Probe exception text, stderr, paths, hostnames, device UUIDs, and broad environment content are excluded.

Provenance uses:

{
  "component": "cpu.process.affinity_logical",
  "source": "os.sched_getaffinity",
  "status": "ok"
}

Possible status values include ok, unavailable, absent, skipped, not_found, timeout, truncated, error, and parse_error.

Validation and diff

Validate:

python scripts/snapshot_tools.py validate resource-snapshot.json

Diff while ignoring observed_at:

python scripts/snapshot_tools.py diff before.json after.json

Use --include-volatile only when timestamp changes matter. Diff output is bounded to 512 changes.

All helper inputs are regular, non-symlink JSON files no larger than 1 MiB. Output defaults to stdout. Explicit file output is restricted to a .json filename in the current directory, refuses overwrite unless --force is used, and is opened with private permissions.