git:20260430.75bc023 to git:20260924.55c2c93
20 added, 13 removed. Audit A to A.
---
date: 2026-04-29
package: cli/internal/types/quest
status: active (atomic-write utilities only)
---
# cli/internal/types/quest/
## Ownership
Tiny utility package: atomic file-write helpers used wherever cli/internal/* needs durable file writes.
- ## Public surface
-
- - `AtomicWriteFile(path string, data []byte) error` โ atomic write with default temp-file perms
- - `AtomicWriteYAML(path string, v any) error` โ wraps AtomicWriteFile after YAML marshal
- - `AtomicWriteFileWithPerm(path string, data []byte, perm os.FileMode) error` โ perm-aware variant (added 2026-04-29 by bead agentops-3ga.1)
+ ## Read for the change
- All three: temp file + write + fsync + atomic rename. Survives mid-write SIGKILL.
+ For write semantics or permissions, read [atomic.go](atomic.go), then the
+ canonical implementation in [storage/atomicfile.go](../../storage/atomicfile.go).
+ These wrappers delegate the temp-file, write, fsync, and atomic-rename algorithm
+ to storage; keep a single implementation. `AtomicWriteYAML` marshals before
+ delegating. `AtomicWriteFile` uses `0o600`; callers needing another mode use
+ `AtomicWriteFileWithPerm`.
+ Preserve atomic replacement: concurrent readers must see complete old or new
+ bytes, never a partial write.
## Non-obvious
- - The package name "quest" is historical. Originally hosted Olympus domain types (Quest, Bead, Learning, etc.); those were deleted on 2026-04-29 (bead agentops-3ga.2) after investigation confirmed zero real consumers. Atomic helpers stay because they're the canonical dedup target for bead agentops-3ga.4.
+ - The package name "quest" is historical; Olympus domain types were removed
+ on 2026-04-29 (bead `agentops-3ga.2`). Keep the surviving utility API compatible.
- Do not put domain types here. This is utility-only.
## Consumers
- After the agentops-3ga.4 dedup, the following packages will import these helpers:
- - `cli/internal/overnight/` (4 sites: checkpoint, reduce, measure, commit)
- - `cli/internal/openclaw/snapshot.go` (1 site, 0o600 security-sensitive)
+ Search imports of `internal/types/quest` before changing a signature.
+ [OpenClaw snapshots](../../openclaw/snapshot.go) use the permission-aware wrapper
+ for both versioned and latest snapshots; preserve their `0o600` permissions.
- ## See also
- - `~/.agents/olympus-history-index.md` for the full extraction history
- - `agentops-3ga.4` for the dedup work
+ ## Completion
+
+ Run `go test ./internal/types/quest ./internal/storage` from `cli/` and the
+ root contract's required checks. Inspect [atomic_fault_test.go](atomic_fault_test.go)
+ for the exact evidence: simulated faults and concurrent-reader checks do not
+ establish observed recovery from a real SIGKILL or power loss.