OMK storage layout v2
Scope: the canonical project and machine storage contract. Paths are generated by
src/storage/layout.ts; product modules must not assemble.omkroots themselves. This layout changes storage only and does not change report schemas, scoring, prompts, statistics, or length debiasing.
Principles
- Top-level names follow user-visible product domains:
eval,doctor, andobserve. - One durable measurement record owns one self-contained directory.
report.jsonis authoritative; rebuildable views live inderived/. - Lifecycle is visible in the path. Durable evidence, observations, governance, backups, and rebuildable
statedo not share a flat namespace. - Project-bound evidence defaults to
<project>/.omk. Machine tools, caches, tunnels, materialized trees, and cross-project indexes exist only under globalstate/. - Identity comes from report IDs and content digests, never from an absolute path. Moving a record does not change its report JSON or digest.
Project layout
.omk/
├── .gitignore
├── eval/
│ └── <record-id>/
│ ├── manifest.json
│ ├── report.json
│ └── derived/
│ ├── graph.json
│ └── card.md
├── doctor/
│ └── <record-id>/
│ ├── manifest.json
│ ├── report.json
│ └── derived/
│ ├── graph.json
│ └── card.md
├── observe/
│ ├── health/
│ │ └── <record-id>/
│ │ ├── manifest.json
│ │ └── report.json
│ ├── inbox/
│ │ ├── reports/
│ │ ├── captures/
│ │ └── review-state.json
│ ├── drafts/
│ └── archive/
│ └── source-records/
├── backups/
│ └── doctor-fix/
└── state/
├── jobs/
├── locks/
└── tmp/<record-id> is the collision-safe filesystem identity of one report bundle. A manifest carries the public report/run identity. Evaluation Core bundles also retain their sealed plan and execution/evaluation/analysis documents beside report.json; those documents remain part of the authenticated bundle.
The directory-skill authoring convention <skill>/.omk/eval-samples.{json,yaml} is intentionally unchanged.
Machine layout
OMK_HOME defaults to ~/.oh-my-knowledge and relocates this whole tree:
~/.oh-my-knowledge/
├── eval/
├── doctor/
├── observe/
├── backups/
└── state/
├── cache/
├── tools/
├── tunnels/
├── trees/
├── isolated-cwd/
│ └── resolved-inputs/
│ └── content/
├── artifact-index/
├── jobs/
├── locks/
└── tmp/
└── resource-leases/Project and machine durable data use the same domains. Machine-specific material never belongs in project .omk. Resolver-owned input copies live under state/isolated-cwd/resolved-inputs/; run-scoped resource copies and overlays live under state/tmp/resource-leases/ and are removed when their lease closes. Original Codex, Claude, and DSH traces stay at their source; OMK reads them rather than copying them into a project by default.
Lifecycle and Git policy
| Path | Meaning | Deleted by default? | Project Git policy |
|---|---|---|---|
eval/ | A/B evidence and release decisions | No | ignored |
doctor/ | skill health reports | No | ignored |
observe/health/ | health aggregated from real traces | No | ignored |
observe/inbox/ | candidate observations and human review state | No | ignored; may be sensitive |
observe/drafts/ | sample drafts derived from observations | No | ignored |
observe/archive/ | immutable source-record sidecars referenced by inbox reports | No | ignored; may be sensitive |
backups/ | recovery copies made before automatic edits | No | ignored |
state/ | jobs, locks, temporary files, and global rebuildable caches | Yes | ignored |
omk init writes an internal .omk/.gitignore that ignores eval/, doctor/, observe/, backups/, and state/, while leaving .gitignore trackable.
Compatibility boundary
File locks recover only an old owner proven to have exited on the local host. Empty or malformed owner metadata can belong to a live process paused immediately after exclusive creation; OMK preserves it and reports contention. Remove an unknown-owner orphan manually only after establishing that no writer remains.
Exclusive JSON publication requires same-directory hard-link support; replacement requires atomic rename. Filesystems without these capabilities (including some removable or network filesystems) fail explicitly and remove staging files. OMK does not fall back to publishing partial bytes. This capability boundary has not been tested on physical exFAT or NAS devices.
The v2 project-runtime tree is the only supported .omk layout. OMK neither reads old .omk roots nor provides a migration command for that tree, and never moves or deletes its old data automatically. Existing old .omk data remains untouched but invisible to v2 readers; users may back it up or remove it explicitly. Evaluation Core bundles use manifest v2 and report.json only. The explicitly selected knowledge workspace below has its own current versioned contracts.
Explicit knowledge workspace
The workspace is explicitly selected through settings or --workspace, separately from project .omk. Current formats are:
| Path | Current contract |
|---|---|
sources/<snapshot-id>.json | knowledge-source-snapshot Schema 3 / knowledge-window-v3: immutable selected material, neutral coordinates/provenance, or content-free deletion marker; Source3 |
items/<identity-digest>.json | knowledge-item-history Schema 3: immutable canonical body revisions, inline evidence, bodyDigest, maintenance and receipts |
associations/<identity-digest>.json | knowledge-association-history Schema 2: exact body/catalog refs, segment/entity links, optional typed relations, pending projections and independent review ledger |
reviews/<identity-digest>.json | knowledge-review-history Schema 1: exact-body content review, per-segment association coverage, task use feedback and independent receipts; contract |
knowledge-relations/<relation-id>.json | knowledge-relation-history Schema 1: exact cross-knowledge supplement/conflict opinions, reviews, withdrawal and receipts; contract |
source-ledgers/<identity-digest>.json | knowledge-source-ledger-history Schema 1: source inventory analyses and native-original references; contract |
source-coverage/<identity-digest>.json | knowledge-source-coverage-history Schema 1: exact-ledger/body coverage analyses, actual decisions, revocations and receipts; contract |
entities/<analysis-id>.json | entity-analysis-history Schema 2: window entities, mentions and immutable revisions |
generation-journals/<run-id>.json | knowledge-generation-journal Schema 9, workflow knowledge-body-first/v9: source/request/profile/wire/producer identities, native references and fixed publication intents |
generation-journals/outcomes/<run-id>/<invocation-id>.json | Immutable complete native ledger, writing draft, body, coverage or association outcome, separately bound to its request and digest |
library/<object-id>.json | Existing knowledge-library-object-history Schema 1, explicitly confirmed cross-window organization |
entity-links/<review-id>.json | Existing entity-link-invocation-history Schema 1, independent cross-window suggestion/decision/application journal |
Sources, tags and carrier versions keep their own contracts. An entity catalog or projection is never a prerequisite for reading a stored body. A projection binds {knowledgeId, revisionId, bodyDigest}; changing/rebuilding/reviewing it does not revise body or inherit its retain decision. Damaged/stale/rejected projections are explicit.
Current workflow9/journal9 records writing input1, followed by ordinary body input5 or long-history Codex windows. It completes after body publication. Separate review_sources runs use manifest/input2, ledger input1 and coverage input2. rebuild_associations uses association stage v1 with explicit complete sources and exact bodyRefs. Schema1 source histories separate model opinions from actual decisions; optional source review does not grant admission to pending associations.
Prepare records the complete current request without a model call. Generate sends only the initial draft. Confirm the ordinary body or each window separately. Optional source review and association requests use separate runs. Drafts and individual window outputs are archived. The ordinary body stage or the host after all windows succeed publishes pending bodies. Each dispatch is claimed once, with complete returned originals archived before admission. writingDraftRef binds the exact same-run draft. Resume attaches original evidence and replays fixed writes without a model; claimed outcomes without originals remain unknown and are never redispatched. Completion does not prove content, association, source fidelity or factual quality.
BREAKING-SCHEMA/API/COMPARABILITY: current body readers reject typed knowledge Schema 2, and current journal recovery rejects run5. Old extraction-runs/ inventory is disclosed as unsupported; original files remain untouched. Explicit migration to a separate new workspace preserves all original bytes under migration/<migrationId>/original/<relative-path>.base64, with original-byte digests, a fixed plan.json, exact revision/segment mappings and complete.json. Supported source/entity records are copied; mechanically rendered new bodies are pending, never implicitly retained. Library/carrier/existing cross-window refs are archived, not retargeted. The old directory and matching old binary provide rollback; no permanent dual canonical reader or invented migration CLI is provided.
The explicit migrate-associations operation migrates association Schema 1 with separate roots and a stable --operation-id. Body, retention, source, entity and native-result bytes are preserved. Original association histories/receipts are archived; fresh projections are pending with revision mappings. Old journal 1 keeps its unsupported identity; auto-extraction/ is archived only, without inherited permission. Completed replay verifies bytes and durability; later deletion or modification rejects replay without resurrecting data.
Automatic extraction uses permission/state/ledger Schema 3 and conversation-phase-invocations/v3, with a fresh source-aware preview and consent. Same-record tool events appear in the selected material; old grants are not inherited. auto-extraction/<thread-hash>.json holds mutable status; immutable permission-<id>.json, schedule-<permission-id>-<run-id>.json, phase-<permission-id>-<invocation-id>.json and outcome-<permission-id>-<invocation-id>.json bind consent, scheduled source windows, each paid phase reservation and observed cooldown facts. Body and association each consume a call; refused/expired quota before association leaves the body saved. Old-schema or old-workflow permission is unsupported; migrate to a separate workspace before fresh approval without upgrading authorization in place. Reads/recovery do not dispatch.
Source3 additionally replaces old source DTOs and journal2 through explicit independent-copy migration. migrate-sources preserves old originals and the supplied matching build archive, maps fresh pending references and archives old permissions/reviews without inheriting them. Older typed-body or association formats first use their separate migration adapters; Source3 migration accepts the supported body3/association2 plus Source2 input, not every historical format. Normal writes refuse old source/journal formats; incomplete migration targets cannot open normally.
All writes share .knowledge-write.lock and the applicable CAS/idempotent receipts. Contention reports knowledge_workspace_busy; only proven exited local lock owners are recovered, and storage-directory symlinks are rejected. The adjustable retrieval default of 65536 UTF-8 bytes counts the whole response plus newline; it is not a storage, body, model-context or spending cap. Actual producer and store capacities remain separate explicit checks. Runtime identities come from the generated contract reference. Historical typed evidence retains its original identities and conclusions in matching archived versions. Workspace records may contain private source and output content.
migrate-workflow copies only healthy active sources3/items3/entities2/associations2/reviews1/tags, preserving all bytes, history, identities and existing opinions; old reviews/retention are not source-coverage approval. Old generation-journals (including outcomes), source-ledgers, source-coverage, auto-extraction, existing migration data and old marker are archive-only, alongside the matching build. Library/carriers/entity-links are outside this slice: refuse and retain the old directory. The completion marker identifies knowledge-workflow-to9; incomplete targets refuse normal admission/writes. Exact-plan steps/receipts resume, but completed edited/deleted output is never overwritten or resurrected. Migration never re-enables automatic scheduling.
Why these names
There is no top-level runs: it suggests disposable execution state, while evaluation and doctor records are durable evidence. There is no top-level measurements: it obscures the CLI domain users already know. There is no top-level observations: health reports and reviewable observations are sibling pipelines under the shared observe product domain. derived is used instead of projections because the directory holds rebuildable materializations owned by one authoritative report, not a distinct product domain.