# LEDGER_WRITE -- RAM Search Ledger Write Payload Template

**Owner / render authority:** Epistemic Output Layer (S4).
**Writers:** Multi-Corpus Retrieval Router (S1), Source Integrity Screen (S2), Multi-Method Orchestrator (S3), Fitness Adjudicator (S7), Adversarial Pass Engine (S8).
**Readers:** Warrant & Saturation Governor (S6) consumes marginal-yield / saturation signals.

**Canonical location:** `_public/templates/LEDGER_WRITE.md` (this file). Any skill-local copy (e.g., `fitness-adjudicator/templates/LEDGER_WRITE.md`) is a synced mirror for local Read resolution; schema deltas are made here and mirrored out.

**Schema authority:** `phase-5-system-architecture/CROSS_CUTTING_ARTIFACTS.md` section 2. This template renders a write-contract match to that schema.

---

## Four record kinds

The RAM Search Ledger has exactly FOUR record_kind values. Fitness Adjudicator most commonly emits `every-accepted`, `every-rejected`, and (for blocked or skipped scorings) `every-skipped`.

### 2.1 every-query

Fitness Adjudicator does NOT emit `every-query` -- that is S1's responsibility. S7 emits query-class writes only when a fitness-followup query is dispatched (e.g., pulling a citation to verify an identification strategy). In that case:

```json
{
  "record_kind": "every-query",
  "query_id": "uuid",
  "run_id": "string",
  "claim_id": "string",
  "writer": "S7",
  "pass": "fitness-followup",
  "query_text": "verbatim",
  "corpus_target": "english-peer | non-english | practitioner | indigenous | retraction-watch | crossref | ai-contam",
  "timestamp_utc": "ISO-8601",
  "rationale": "discipline-specific, non-boilerplate, names the dimension being resolved"
}
```

### 2.2 every-accepted (Fitness Adjudicator primary write)

Emitted whenever a source passes fitness threshold for a claim.

```json
{
  "record_kind": "every-accepted",
  "source_id": "string",
  "query_id": "string -- back-ref to the S1 query that retrieved this source",
  "fitness_verdict_ref": "fitness_record_id -- back-ref to FITNESS_OUTPUT record",
  "integrity_verdict_ref": "S2 integrity_verdict id",
  "admiralty_input": "A-F / 1-6 pair",
  "claim_id": "string",
  "timestamp_utc": "ISO-8601"
}
```

### 2.3 every-rejected (Fitness Adjudicator primary write)

Emitted whenever a source is below fitness threshold OR a disqualifier fires.

```json
{
  "record_kind": "every-rejected",
  "source_id": "string",
  "query_id": "string",
  "rejection_reason": "fitness-below-threshold | disqualifier-hit",
  "reviewer_flag": "string or null (set when fragile-rubric keystone concerns apply)",
  "timestamp_utc": "ISO-8601"
}
```

**Note:** `rejection_reason` values `retracted`, `fabricated-citation`, `ai-contaminated`, `pub-bias`, `translation-fidelity-fail`, `care-gate-refused` are S2 / S1 responsibilities. Fitness Adjudicator rejection reasons are `fitness-below-threshold` or `disqualifier-hit` only.

### 2.4 every-skipped

Emitted when a scoring run is skipped (e.g., BLOCKED at Step 1 for missing claim_type; avenue not pursued for resource reasons).

```json
{
  "record_kind": "every-skipped",
  "avenue": "string -- e.g., 'fitness-scoring on claim X' or 'D5 discipline-prior lookup'",
  "skip_reason": "BLOCKED: missing <field> | resource-budget | upstream-deferral",
  "claim_id": "string",
  "writer": "S7",
  "timestamp_utc": "ISO-8601"
}
```

---

## Write protocol

1. Obtain the Search Ledger write handle published by the Epistemic Output Layer at run open.
2. Construct the record object matching the schema above.
3. Perform atomic append to `state/ram/ram-search-ledger/<run-id>/ledger.jsonl`.
4. On write failure: the calling skill HALTS -- no silent ledger miss. Record a classified-refusal incident to the orchestrator alarm channel.

## Contract

- EVERY fitness decision writes to the Ledger. Accepted, rejected, disqualified-at-floor, BLOCKED-on-missing-input -- all log.
- Rationale fields must be discipline-specific and non-boilerplate (S6 saturation computation relies on rationale distinctness).
- Writer field MUST equal "S7" for Fitness Adjudicator writes. Misattribution is a contract breach.
- Timestamps are ISO-8601 UTC.

## What this template is NOT

- NOT the Surprise Register write path. Those go via `SURPRISE_WRITE.md`.
- NOT a license to write Evaluator ledger entries. Evaluator Search Ledger (`state/evaluator/evaluator-search-ledger/`) is a distinct path with distinct record_kinds (`audit-query`, `audit-finding`, `audit-null`, `audit-refusal`, `reopen-event`); RAM has ZERO authority there.
- NOT a renderable artifact. Output Layer (S4) renders the ledger; writers never render.
