gunk-dev/the-valley
the-valley:oc-3bc80dfoutcomein-progress

Approvals are touch-signed statements the integrator checks

State
in progress
Created
2026-10-17 by contributor
Source
2026-10-13, change-identity-design.md §2 and plan.md decisions 2, 3, 10
Progress
8 of 15 done
Children
Changes
  • valley:the-valley/qvzzrpxvokultrxwoomvtwqvqqxuxvyw
  • valley:the-valley/sunvvxnvwkwqzxowlprxnyzpnpkuvprq

Body

An approval becomes an SSHSIG statement signed with the operator's `ssh:valley-approve` hardware key, and the integrator refuses to land a change in an approval-required class without one.

What it takes:
- the identity schema and compiler accept `sk-ssh-ed25519` keys, and the `request` grant moves from the operator's `id_ed25519` to the hardware approve keys;
- a Go `valley approve` signs the statement of `change-identity-design.md` §2: instance, repository, target, the prepared tip and result, the `valley-delta-v1` delta digest, change ID and version, landing message and author fields, policy and registry snapshots, the carry mode, an expiry, and the withdraw generation, so a withdraw voids earlier approvals race-free;
- the statement names the principal who approved, so policy can say who must approve;
- batches and trains, so one touch covers several changes;
- the integrator checks the statement in one landing decision, per path class. Default approval-required classes: governance, policy, identity, check definitions and `docs/`.

The `approval/v1` branch on origin is the reference for its tests and UX; close it once this lands.

Done when policy and doc changes cannot land without a verified touch, and the negative tests (touchless, wrong namespace, unknown key, replayed statement) are refused.

Source: `plan.md` decisions 2, 3 and 10, Status 2026-10-04 (approval rework, identity follow-ups) and 2026-10-14 (withdraw generation); `change-identity-design.md` §2.

---

Slice plan, revision 4, 2026-10-22: authored by Astra (Codex gpt-6-astra) after the operator chose ordinary Ed25519 notes with PIV hardware keys, and cut down by a Claude review of revision 3. Earlier revisions are in this knot file's history; the review of revision 3 is a comment.

# Touch-approval slice plan — revision 4

The first release supports Ed25519 software keys and attested YubiKey PIV keys. Every gated landing requires an approval note. The operator’s instance additionally requires a key whose verified enrollment establishes touch-always.

The implementation adds `approval/` and small integration points. `attest/`, `note/`, `sigverify/`, `restack/` and `review/` remain unchanged.

## Basis

**Implemented** citations refer to HEAD `d8c2e543`, equal to local `origin/main`. `Q:` means qvzz at `083846a`. Proposed mechanisms are **not built**; enrollment and activation are **deployment choices**. Acceptance tests below have not been run.

The latest available decision requires ordinary Ed25519 notes for both hardware and software approvals (`refs/remotes/origin-knots/knots:comments/oc-3bc80df/20261021T235610Z-9774dd632edeb24f.md:6`).

Adopt the review’s spike, seven slices and follow-ups. The two corrections are the PIV signing command and how cutover checks serials: use `--sign`, and match compiled keys to the certificates carrying their serials.

## 0. Device spike

**Purpose.** Establish that the actual device and packaged tools support the proposed path before building around it.

The operator runs this outside the repository. First inspect slot 9c; do not overwrite an occupied slot or reset the device. Generate an Ed25519 key with touch-always and PIN-always in an available slot. Obtain its slot attestation, f9 certificate and required intermediate certificates.

With the selected slot, test:

```sh
yubico-piv-tool -a verify-pin --sign -A ED25519 -s 9c \
  -i statement.txt -o signature.bin
```

The review’s `-a sign` is incorrect: signing is a separate flag. The implementation sends Ed25519 input without prehashing. Its buffer limit is not proof of the device’s usable message limit. [CLI definition](https://github.com/Yubico/yubico-piv-tool/blob/master/tool/cmdline.ggo#L29), [signing implementation](https://github.com/Yubico/yubico-piv-tool/blob/master/tool/yubico-piv-tool.c#L1641)

**Acceptance.**

- A 2 KiB text produces a raw signature accepted by Go `ed25519.Verify`.
- Two consecutive signatures each require a touch.
- No touch, cancelled PIN and unplugging fail without a usable signature.
- The attested Ed25519 public key matches the signing key.
- Go verifies the actual chain to pinned Yubico Attestation Root 1, including intermediates.
- PIN prompting works without putting the PIN in arguments or logs.

Yubico documents Root 1 for firmware 5.7.4 onward. Go compatibility remains a test requirement: piv-go contains a special treatment for f9 certificates lacking CA constraints. Any required compatibility treatment must be narrowly justified by the captured chain; do not disable certificate verification generally. [Yubico attestation](https://developers.yubico.com/PIV/Introduction/PIV_attestation.html), [piv-go verification](https://github.com/go-piv/piv-go/blob/master/piv/key.go)

**Output.** Public certificates, public key, test text, signature, tool versions and observed results. Slice 1 commits these as fixtures. Repeat the capability check for the spare before cutover. The spike itself changes no repository files.

**Independent repair.** Abandon qvzz as an approval implementation. Land its resolved-commit registry read separately: HEAD resolves a commit but reads through the mutable ref (`identity/registry.go:80`, `identity/registry.go:85`); qvzz reads through the resolved commit (`Q:identity/registry.go:83`, `Q:identity/registry.go:88`). Touch only that reader and its regression test. A simulated ref move must never mix registry versions.

## 1. Identity: attested approval keys

**Does.** Add one optional `attestation` block to a key entry. Keep its slot certificate and f9 chain inline as PEM. Pin the accepted Yubico root certificates in the compiler. Accept no applicant-supplied trust anchor.

Compile the key as hardware only when:

1. The Yubico attestation chain verifies.
2. The attested Ed25519 public key equals `public`.
3. The authenticated touch policy is `always`.

A missing attestation gives no hardware assurance. A malformed or unverifiable supplied attestation fails compilation. A valid cached-touch attestation does not qualify for the hardware file. The existing `bound` field cannot substitute for evidence.

Keep `class: "ssh-ed25519"` and the existing public-key representation (`schema/identity.cue:66`). The compiler already extracts its Ed25519 bytes and renders note verifier keys (`identity/render.go:117`, `identity/render.go:229`).

Emit two plain files, with lines named by principal:

- `approval-signers`: keys of unexpired human principals holding the approve grant.
- `approval-signers-hardware`: the qualifying hardware subset.

Keep both grant spellings and expiry behavior (`identity/render.go:93`, `identity/render.go:109`). Reject one public key assigned to multiple principals. Validate both outputs with `note.ParseVerifierKeys`. There is no metadata reader and no authorization hidden in comments.

Report the verified serial, firmware and PIN policy during compilation for enrollment review. The inline PEMs retain the evidence. No separate possession statement or evidence store is introduced.

**Files.** `schema/identity.cue`, `identity/`, `examples/identity/`, identity checks, `docs/reference.md`. Copy qvzz’s grant/expiry tests and output-writing pattern by hand; omit its SK parser, sigverify exports, sk-dummy and application filter.

**Depends on.** Spike and resolved-commit repair. Grant compatibility is already at HEAD.

**Tests.** Real-device fixtures verify. Reject wrong roots, missing intermediates, altered certificates, mismatched public keys and ambiguous ownership. Test touch-always, cached and never; expired/ungranted principals; software keys; empty output files; deterministic rendering. Invalid evidence must not silently downgrade to software.

**Ships.** Dormant compiler support. Existing whole-file replacement prevents torn individual files, but does not make several replacements atomic (`identity/compile.go:137`).

## 2. Policy: one hardware requirement

**Does.** Add an optional `approval.hardware` boolean to `#Policy` and its Go reader. Absence means hardware is not required. A floor can mandate:

```cue
floor: approval: hardware: true
```

Use the existing set-as-struct semantics: concrete `true` cannot be removed by a project. Do not add a predicate language, provenance alternatives, PIN rules or firmware ranges. The schema already explains this composition rule (`schema/verification.cue:125`, `schema/verification.cue:156`).

The setting selects the verifier file; it does not decide whether approval is required. Every gated change still requires a note.

**Files.** `schema/verification.cue`, `composed/composed.go`, composition tests and policy examples, `docs/reference.md`.

**Depends on.** No ledger slice. Develop alongside slice 1.

**Tests.** An absent requirement accepts software policy; a project can strengthen it; a project cannot negate floor `true`. Unknown fields and invalid types fail. The exported policy digest changes with the requirement (`composed/composed.go:197`, `composed/composed.go:232`).

**Ships.** Reader/schema support only. Deploy tools before any live policy uses the field: schemas travel with tools (`nix/packages.nix:233`).

## 3. Approval: statement, signing, verification and landing computation

**Does.** Add a small, flat codec in `approval/`. The first line is `the-valley/approval/v1`; following fields have a fixed order, one separating space, no escapes and a final newline. Reject unknown, duplicate, missing, oversized or noncanonical fields. Follow the existing line-form rules without extracting its JSON machinery (`attest/text.go:25`, `attest/text.go:40`).

The statement binds:

| Fields | Binding |
|---|---|
| Project, target | Configured project name and destination ref |
| Change, version, `seq` | The recorded version and state approved |
| Head H, destination T | Exact source and destination commits |
| Result, delta | Landing tree digest and T→result `valley-delta-v1` digest |
| Message, author | Effective landing-message digest; author name, email and date |
| Policy, carry | Composed-policy digest and derived carry mode |
| Principal, issued, expires | Approver and bounded lifetime |

No stable IDs, registry generation, preparation service or client-computed signers snapshot is required.

Use ordinary notes. For PIV, invoke the pinned `yubico-piv-tool` executable directly from Go, with bounded input/output and a timeout. Feed the full statement, never a prehash. Construct its signature line with exported `note.KeyHash` and `note.Mark`, then self-verify with `note.Open` (`note/note.go:53`, `note/note.go:70`, `note/note.go:315`).

Software signing uses the same statement and envelope. Adapt the existing unencrypted OpenSSH Ed25519 key reader locally; encrypted-key support is outside this slice (`attest/sign.go:180`). Keep the Go module standard-library-only. That is an explicit repository choice, not merely an inference from Nix packaging (`attest/sign.go:47`).

Export one landing helper for client and integrator use. It implements the existing fast-forward/merge behavior and effective message/author rules (`integrator/refs.go:379`, `integrator/git.go:167`, `integrator/refs.go:446`). Preserve sanitized Git execution (`integrator/main.go:341`).

**Files.** New `approval/` package and command, vectors and tests; `nix/packages.nix`; approval format reference. No edits to `note/` or `attest/`.

**Depends on.** Spike; composed reader from slice 2.

**Tests.** Existing note readers accept generated notes. Test every field mutation, malformed lines, wrong first-line type, unknown key, principal mismatch and clock boundaries. Compare landing results for fast-forward, clean merge, conflict and trailing-newline cases. Verify that signing a digest instead of the text fails. Confirm packaged signing on the device, including no-touch failure.

**Ships.** A usable helper and verifier. Fix the text-size bound only after the spike establishes it.

## 4. Hook and refusal readers

**Does.** Admit one replaceable approval ref:

```text
refs/the-valley/approvals/<target>/<change>
```

Use a bounded tree containing `approval.note`. Require the approve grant for creation, replacement and deletion. Check naming and object shape; leave final authority and freshness checks to the integrator.

Add `refused-approval` to existing outcome readers. The current reader maps unrecognized outcomes to `unknown` (`rebase/outcome.go:36`).

**Files.** `valleyhook/`, `rebase/outcome.go`, `status/`, their tests and ref-layout documentation.

**Depends on.** Slice 3. Deploy before the gate emits the new outcome.

**Tests.** Ungranted writes, malformed refs, symbolic refs and oversized objects fail. Granted replacement succeeds. Status recognizes the refusal. No restacker change is needed: its existing default holds refused requests (`restack/plan.go:203`).

**Ships.** Live storage and reader support. The rule mirrors requests (`valleyhook/policy.go:157`); other operational namespaces remain closed (`valleyhook/policy.go:135`).

## 5. Client and signer publication

**Does.** Publish both approval verifier files beside the existing signers in `refs/the-valley/signers`. Extend the existing publisher, preserving its lock, comparison and leased update (`integrator/signers.go:30`, `integrator/signers.go:84`, `integrator/signers.go:107`). Empty files must publish revocations; they must not preserve old keys.

`valley approve` and the review menu call the Go helper. Show the landing, principal, key fingerprint, hardware-file membership and lifetime. After checks succeed, sign and self-verify. Add the approval ref with its own lease to the existing atomic request/evidence push (`bin/valley:1823`).

The publication helps review and client checks. The gate uses its configured local files. A stale publication may cause refusal; it cannot authorize a landing.

**Files.** `bin/valley`, `approval/`, `integrator/signers.go`, publisher/client tests, Nix publication wiring, `docs/guide.md`.

**Depends on.** Slices 1–4 deployed.

**Tests.** No touch or signing failure publishes nothing. Lease races and hook rejection publish no partial request/approval update. Preserve same-head request handling: Git omits unchanged refs, so reread them and never recreate a consumed request (`bin/valley:1766`, `bin/valley:1839`).

**Ships.** Live signed requests. Enforcement remains off until slice 7.

## 6. Integrator gate

**Does.** Add an off-by-default gate. Pin both approval files once per pass. Select only `approval-signers-hardware` when policy requires hardware; otherwise select `approval-signers`. Missing, malformed or empty selected authority never falls back to another file.

Verify the note, its principal, every binding, readiness and all existing checks. Require a recorded change. Reject no-op target updates. Use the shared landing helper. Initially T must match exactly, even when the signed carry mode permits more.

Use a 24-hour maximum lifetime, at most five minutes of issue-time skew, and a final expiry check immediately before committing.

Extend final record validation to return observed record OIDs. Commit through one transaction:

```text
start
verify <record-ref> <record-oid>
verify <other-relevant-record-ref> <record-oid>
verify <approval-ref> <approval-oid>
update <target-ref> <L> <T>
delete <request-ref> <H>
prepare
commit
```

Use direct canonical refs. Withdrawal cleanup similarly verifies the withdrawn record while deleting the leased request.

This replaces existing separate operations (`integrator/records.go:343`, `integrator/refs.go:533`, `integrator/refs.go:556`, `integrator/records.go:436`). No ledger is needed.

Re-evaluate gated requests each pass; the current memo omits authority, approval and clock inputs (`integrator/refs.go:140`). Keep announcement deduplication separate. Journal the approval digest, signer fingerprint, selected authority digest and hardware requirement.

The host option must assert sealed targets: protection with no declared writers. Include the instance source and host-configuration source. Current protection admits declared writers, and the instance assertion checks protection alone (`valleyhook/policy.go:192`, `nix/valley-host.nix:1414`).

**Files.** `integrator/`, `nix/valley-host.nix`, e2e/host checks, architecture/security documentation.

**Depends on.** Slices 1–5. No ledger dependency.

**Acceptance suite.**

| Negative case | Required result |
|---|---|
| No touch | Device produces no usable approval; nothing lands |
| Software or cached-touch key under hardware policy | Refused through hardware-file selection |
| Wrong statement type, unknown/ungranted key or wrong principal | Refused |
| Altered binding or changed policy | Refused |
| Replayed approval after landing | T mismatch; no second landing |
| Expired approval, including expiry during checks | Refused |
| Approval predating withdraw/re-ready | `seq` mismatch |
| Record, approval or request changes before commit | Transaction fails without moving target |
| Direct request injection bypassing the hook | Gate independently rejects missing/invalid approval |

Also test a valid landing, concurrent landings and the withdrawal-cleanup race. Run a cross-family security review before activation.

**Ships.** Dormant enforcement.

## 7. Cutover and recovery

**Deployment choice.** Enroll both hardware keys before enabling the gate. This deliberately uses the existing administrative trust path. The hardware guarantee begins at activation; it is not retroactive.

1. Deploy all tools and readers before using new registry or policy fields.
2. Land both inline attestation entries. Configure touch-always and, by enrollment choice, PIN-always.
3. Stop affected integrators. Seal the instance project, host-configuration source and all gated targets.
4. Compile and inspect authority. Match the hardware file’s two public keys to the two verified certificates and observed device serials. Plain verifier files contain keys, not serial numbers (`note/note.go:122`).
5. Set the instance floor’s hardware requirement. Enable the gate on the instance project first; keep other targets stopped.
6. Exercise a hardware-key-approved landing and a software-key refusal. Enable the sealed host-configuration project, then the remaining targets.
7. Re-sign outstanding requests and drill the spare.

After activation, enrollment changes require an already-enrolled key under the old authority and current floor. The proposed key cannot authorize its own addition. Until the TKey follow-up, either enrolled hardware key can approve another key’s enrollment.

**Outstanding approvals.** No grandfathering. Unsigned requests and experimental SSHSIG approvals cannot land. Leave requests pending for fresh notes or withdraw them.

**Lost key.** Use the enrolled spare to revoke and replace it. For suspected compromise or a firmware advisory, stop affected integration, revoke the key, confirm the compiled and published files, and restart with a fresh pass. Losing both keys requires an explicit administrative rebootstrap; there is no unsigned landing switch.

**Files.** Instance registry, floor policy, host declarations and deployment pins; `docs/guide.md` recovery procedure and `docs/security.md`. Actual instance paths are deployment inputs (`nix/valley-host.nix:200`).

**Depends on.** All slices, both devices tested, security review complete.

**Tests.** Exactly the intended hardware keys qualify. Direct target pushes fail. Unsigned outstanding requests remain blocked. The primary and spare each complete a landing.

## Follow-ups, shortest path and risks

Follow-ups are the TKey root and identity-change restriction, carry (`same-paths`, then `same-class`), explicit batching, and additional vendors when needed. Ledger integration later retains the approvals and authority snapshots a landing relied on. Agent review records remain a separate input.

The shortest path is the spike, isolated registry repair, slices 1–6 deployed, and slice 7. The first landing after activation can be an ordinary recorded change against an unchanged tip.

Recommendations for the operator:

- Keep touch-always. Cached touch permits additional signing during its 15-second window; a process can use that opportunity. Batch explicit statements later. [Yubico policy values](https://developers.yubico.com/PIV/Introduction/PIV_attestation.html)
- Choose PIN-always at enrollment, while acknowledging that this release does not enforce a PIN-policy requirement.
- Accept key revocation as the initial firmware-response mechanism and the spare as initial recovery authority.

Limits remain:

- Enrollment trusts Yubico’s chain and firmware behavior. A note has no per-signature touch flag and proves intent, not correctness.
- Failed compilation preserves old authority. Confirm convergence before resuming after urgent revocation (`identity/main.go:75`).
- Exact-tip approval requires re-touches. Same-named instances sharing authority retain cross-instance replay risk.
- `seq` closes normal withdrawal replay, but record deletion/recreation can reset it; approve holders may delete records (`valleyhook/record.go:172`, `valleyhook/record.go:314`).
- One replaceable approval ref does not retain superseded approvals. The transaction does not supply the ledger’s crash-recovery and durable decision guarantees.
- Host administrators remain trusted. Sealing Git targets cannot constrain someone who replaces the verifier or writes local refs directly.

## Changes from revision 3

Each review finding is settled as follows:

1. **Adopted:** one compiled hardware fact and one policy bit. Existing boolean composition supplies the floor semantics (`schema/verification.cue:125`). General attribute predicates are deferred.
2. **Adopted:** two plain verifier files. Comment metadata is unsuitable for authority that an ordinary reader would ignore (`note/note.go:173`).
3. **Adopted:** no TKey prerequisite or bootstrap override. Its enrollment remains unfinished (`docs/security.md:189`). The interim authority is the two inspected hardware keys.
4. **Adopted, command corrected:** subprocess signing preserves the standard-library rule (`attest/sign.go:47`). Use `--sign`; §0 cites the upstream definition.
5. **Adopted:** inline PEMs replace the evidence store and possession format. Enrollment grants authority; note verification establishes possession when approving (`note/note.go:328`).
6. **Adopted:** flat codec and external-signature assembly stay in `approval/`; exported primitives suffice (`note/note.go:53`, `note/note.go:70`).
7. **Adopted:** device spike first. Ed25519 attestation, actual message limits and Go chain compatibility remain unconfirmed until it passes.
8. **Adopted:** existing Ed25519 public-key encoding and principal names; verification checks the full public key (`identity/render.go:117`, `note/note.go:328`).
9. **Adopted:** current HEAD, current qvzz and existing signer publication; refusal readers ship with the hook (`integrator/signers.go:30`, `rebase/outcome.go:36`).
10. **Adopted:** share landing computation instead of maintaining two implementations (`integrator/refs.go:446`).
11. **Adopted:** abandon qvzz, extract only its resolved-commit repair, and carry useful test/output patterns into the new work (`Q:identity/registry.go:83`).

Comments

  1. contributor2026-10-18 14:45 UTCedited2026-10-29 01:08 UTC by contributor
    From the coordinator's working file `change-identity-design.md` (moved here 2026-10-18), part 1 of 2:
    
    # Change identity, and what an approval signs (draft rev 3, 2026-10-13)
    
    **The question (the operator):** we talk about signing *changes* rather than branches, closer to jj than to git. Does our signing strategy reflect that?
    
    **Rev 2** takes in the Codex critique (`change-identity-review-codex.md`). The coordinator checked its factual corrections against the-valley's source and accepts them. The main change from rev 1:
    
    > **Identity follows the change; authority follows the exact result.** A stable change ID tracks a change across rewrites. A human touch authorises one prepared result on one reviewed destination state. Reusing an approval across rebases ("approve the delta") is a later, explicit delegation feature, not M1-C's default.
    
    **Rev 3** takes in the operator's decisions of 2026-10-13 (plan decisions 3, 7 and 15):
    - **An approval carries across a clean rebase** (§4 is rewritten). Authority now follows the approved *delta*, provided it is proven to land unchanged on unchanged ground; a policy class can still demand the exact result.
    - **The words are change, ready, approve and submitted.** Submitted is the state a change reaches when it lands. `valley submit` in rev 2 is `valley ready` (the author's act) plus `valley approve` (the human's act).
    - **One change per submission** stays: commit-level IDs are provenance.
    - **Changes are co-edited:** an owner plus invited collaborators, with every version recording its uploader (lifecycle rev 4).
    
    Rev 2 is kept as `change-identity-design-rev2.md`.
    
    That is also how jj works. Change IDs thread a change through its rewrites, but signatures cover commits, which are snapshots, and a rewritten commit is signed again.
    
    ## Today (the-valley `d42ab89`)
    
    | Artifact | Signed? | Bound to |
    |---|---|---|
    | Check evidence (`attest`) | Yes, by the host | The `valley-tree-v1` digest of the attested tree; a commit hash is advisory only.<br>• **Pure checks** carry over to a new tree when their inputs and derivation are unchanged.<br>• **Effectful checks** carry over when the classes they cover are untouched and they're still inside their validity window.<br>The integrator countersigns and writes a separate transfer statement. |
    | Submit (the request ref) | **No.** Push-authorised by the `request` grant in valleyhook. A repository served without the hook accepts request writes from anyone. | `refs/the-valley/integration-requests/<target>/<name>` → the head commit. `<name>` is the branch with `/` → `-`, which is lossy (bd-57f7f9f). |
    | Landing record (transfer statement) | Yes, by the integrator | `change` = the name. **Its field called `base` holds the attested head-tree digest, not the merge-base.** Any new format must not reuse that word loosely. |
    | Outcome memo | No | Keyed by target and name. Filing again replaces it, so earlier outcomes are no longer kept as reachable history. |
    
    **How landing works:**
    - The integrator three-way merges `merge-base(tip, head)..head` onto the tip.
    - If the merge-base is the tip, it fast-forwards and the whole commit range lands.
    - Otherwise it writes one commit on the tip, copying the head's author and message, with trailing newlines trimmed.
    
    Nothing reads `Change-Id` trailers or commit headers.
    
    **Correction to rev 1.** Rev 1 said the roadmap's commit-bound approval "can't work". It can: the integrator prepares the result on a fixed tip, the operator approves that prepared result, and the integrator lands exactly that result under compare-and-swap. The cost is throughput, because every move of the tip before landing needs a fresh touch. That trade is deliberate, and it's the right default.
    
    ## Proposal
    
    ### 1. Change identity: tracking, not authority
    
    - **The ID.** Read from the commit's `change-id` header (written by jj since 0.30: a 16-byte ID in reverse hex) or from a `Change-Id:` trailer (plan decision 7: stamped at dispatch by klaus; `valley ready` offers to stamp one for plain-git authors).
      - Read the actual header, never text in the message that looks like one.
      - Reject malformed values, duplicates, or a header and trailer that still differ after normalisation.
    - **One change ID per change.** `valley ready` names it explicitly and records it in the workflow record. The IDs on individual commits are provenance, not the topic's identity, so ordinary jj stacks (one change per commit) are allowed.
      - v1 rejects topics that contain merges and ambiguous merge-bases.
      - v1 has no implicit stacks.
    - **Scope and versions:**
      - State is keyed by (instance, enrolled repository ID, target, change ID). The branch name is an advisory locator, which retires bd-57f7f9f.
      - The integrator assigns each submission an immutable, append-only version.
      - Review shows `git range-diff` between versions.
    - **Authority over workflow state.** An ID is author-asserted, so it grants nothing. A new version takes the owner or an invited collaborator, and withdrawing takes the owner or the operator (lifecycle rev 4), so copying an ID can't hijack someone else's change.
    
    ### 2. What an approval signs (M1-C): a prepared result
    
    1. **Prepare.** When a version is marked ready, the integrator (or the checker on the operator's host) prepares the result:
       - it pins the destination ref value: the tip commit and its tree;
       - it merges the change, giving the result tree and the exact landing message (newline handling defined);
       - it derives classes and owed checks from the **actual tip→result paths**, plus the change's own paths as a conservative union;
       - it produces evidence over the result tree.
    
       The review then shows that prepared diff and its evidence. This is roadmap M4's "the review flow inverts".
    2. **Touch.** The operator's hardware key signs an **approval statement**. It's a new statement type in an **SSHSIG envelope**, because the user-presence and user-verification flags live there. dcr-de9d996's raw ed25519 notes can't carry them. The envelope specifies the namespace, an enrolled principal, the signer class and how verification time is handled.
    
       **The statement binds:**
       - instance, repository ID, target;
       - destination tip commit and tree, as typed identifiers (`git-sha1:<hex>`);
       - result tree digest;
       - **the delta digest** (`valley-delta-v1`, §4);
       - change ID and version;
       - landing message digest, and the change's author fields (name, email, date);
       - policy and registry snapshot digests;
       - the carry mode the policy sets for the change's classes (§4);
       - an expiry.
    3. **Land.** The integrator verifies everything below as one decision:
       - the request version;
       - the approval bytes, the signer's current authorisation, the expiry and revocation;
       - the effective policy;
       - the destination ref still equal to the signed tip (compare-and-swap);
       - the materialised result equal to the signed tree;
       - the evidence.
    
       It then commits the target move, request consumption, approval consumption and an append-only decision record together where possible, using the M4 crash-safe landing (decision 5) for the remaining crash boundaries. **If the tip moved, it prepares again.** The approval carries to the new result only under §4's rules; otherwise it needs a fresh touch.
    
    ### 3. Keeping touches cheap
    
    - **Batches.**
      - Entries are independent and consumed one at a time by default.
      - The whole immutable list is displayed and signed before the touch, and the review bytes are frozen before the touch.
    - **Trains.**
      - A dependent batch is prepared in order: B on A's result, C on B's.
      - One touch signs the ordered train, and it lands in order. If the tip moves mid-train, the remaining entries are prepared again.
    
    ### 4. Approvals carry across clean rebases
    
    The operator, 2026-10-13: an approval binds the change and carries across clean rebases. Rev 2 listed the prerequisites: a delta with a real security definition, output verification, and semantic limits. This section meets them by defining the delta over **whole files**, which needs no textual-diff semantics at all.
    
    **The delta** of a prepared result R on tip T is the set of paths whose entries differ between T and R. Each path has:
    - a **pre-image**: its entry in T, or `absent`;
    - a **post-image**: its entry in R, or `absent`.
    
    An entry is `(mode, SHA-256 of the content)`, exactly as in `valley-tree-v1`; a symlink's content is its target. A rename is a deletion plus an addition. Because whole contents are hashed:
    - binary content, executable mode, symlink targets, CRLF and final newlines are all bound;
    - nothing is positional, so there is no "which occurrence" problem.
    
    **The encoding,** `valley-delta-v1`, is exact and is parsed strictly:
    - The digest is SHA-256 over the header line `valley-delta-v1\n`, followed by one line per path.
    - Each line is `<len> <path> <pre> <post>\n`, where:
      - `<len>` is the canonical decimal byte length of the path: no sign, no leading zeros;
      - `<path>` is the raw path bytes as git stores them in the tree, and a parser consumes exactly `<len>` bytes of it;
      - each image is `-` or `<mode> <sha256>`. The mode is one of `100644`, `100755` or `120000`, and the hash is 64 lowercase hex digits.
    - Paths are unique and sorted bytewise.
    - Paths are never cleaned, case-folded or Unicode-normalised before hashing.
    
    **Rejected:**
    - submodules;
    - other unsupported tree entries;
    - duplicate or malformed entries;
    - any tree that can't be materialised faithfully on the supported filesystem (case-sensitive Linux), such as a file/directory alias.
    
    A policy may also reject case or Unicode aliases, for checkouts elsewhere.
    
    **Scope.** The digest binds git leaf entries. It doesn't bind ownership, ACLs or other filesystem metadata. It ships with conformance vectors for valid input (renames, mode-only changes, symlinks, deletions, CRLF, paths containing spaces and newlines) and for malformed input.
    
    **What's signed.** The approval statement (§2) binds:
    - instance, repository and target;
    - the change ID;
    - the delta digest;
    - the landing-message digest and the change's author fields (name, email, date), which the descriptor gains, because the integrator copies them from the head into the landed commit (`integrator/refs.go:338`);
    - the tip and result it was prepared on;
    - the policy and registry snapshots;
    - the carry mode;
    - an expiry.
    
    The change version is bound for audit only.
    
    **The acceptance predicate.** A review recorded on descriptor D₀ (tip T₀, result R₀) counts for the descriptor D₁ being landed (tip T₁, result R₁) only if **all** of these hold. A human approval and an agent review are both reviews.
    
    1. **Only version, tip and result may differ.** Everything else in D₁ equals D₀: instance, repository, target, change ID, delta digest, landing-message digest, and author fields. A version that changes the message or the author needs a new review, however identical its files.
    2. **Output verification.** `delta(T₁, R₁)` equals the approved delta digest:
       - every touched path goes from the approved pre-image to the approved post-image;
       - nothing else in R₁ differs from T₁.
    
       This proves the touched paths read the same at T₁ as at T₀. It says nothing about what happened to them in between.
    3. **Linear history.** T₀ is an ancestor of T₁ on the target's landing history. The interval of landings (T₀, T₁] is what rule 4 inspects.
    4. **Carry mode.** The mode is the strictest among all the classes the delta's paths fall in, classified by the policy pinned in rule 5:
       - `exact`: T₁ = T₀.
       - `same-class`: no landing in the interval touched any path in any of those classes.
       - `same-paths`: no further condition.
    5. **Same authority inputs.** The policy snapshot and the registry snapshot at T₁ equal D₀'s, and the integrator pins the registry generation it decides under. Either one changing voids every carried review. A policy that changed and changed back still voids them, because rule 4 inspects the interval.
    6. **Current eligibility, judged against D₁.**
       - The reviewer is still authorised for the class, and the review hasn't expired or been revoked.
       - The independence rules hold for D₁'s full, immutable, authenticated upload history.
       - An agent reviewer must not be the principal behind any version of the change.
       - In a class that requires an independent human approver, that approver uploaded no version of the change.
       - So a reviewer who later uploads an identical delta loses their carried review.
    7. **Blocking verdicts carry too.** Any request-changes that rules 1–6 would carry to D₁ blocks D₁. Only new content, meaning a different delta, moves past it, and the old verdict stays on record.
    8. **Checks are separate.** Checks are owed on R₁ and met by evidence over R₁, with the usual pure-check carry-over. A review never stands in for a check.
    9. **Trains.**
       - A train approval binds the ordered entries: each entry's change ID, delta digest and predecessor entry.
       - Substitution, skipping and reordering are refused.
       - Every entry must independently pass rules 1–8 against its predecessor's actual result.
       - An entry that changes policy or the registry voids carry for every entry after it (rule 5).
    
    **Policy decides the mode per class.** Classes that change trust set `exact`: the identity registry and grants, `policy/` itself, and `secrets/`. Everything else defaults to **`same-paths`** (the operator, 2026-10-13). A project can set `same-class` or `exact` on any class it knows is sensitive or tightly coupled.
    
    **The semantic limit is stated, not hidden.** An identical delta can acquire a different meaning:
    - a caller the approver saw can call a function that another landing changed in a different file;
    - a symlink's unchanged target can point at content that changed elsewhere.
    
    `same-class` narrows this within a class. Neither mode protects a dependency that crosses classes. The guards are the checks over R₁, and `exact` where the checks aren't enough. That is a deliberate trade, and the operator has chosen it. **A human approval verifies aligned intent and quality; it is not where bugs are caught.** Checks are. So approvals carry as far as the rules allow, the system favours eventual consistency with fault tolerance, and sensitive areas opt into stricter modes.
    
    **Clean is file-level in v1.** A landing that changed a different part of the same file changes that file's pre-image, so the review doesn't carry. Carrying across non-overlapping edits within one file would need hunk identity, and with it the occurrence problem. It is a possible later refinement, not part of v1.
    
    **Broad-intent delegation stays deferred.** "Approve whatever this change becomes" remains decision 3's separate delegation contract.
  2. contributor2026-10-18 14:45 UTC
    From the coordinator's working file `change-identity-design.md` (moved here 2026-10-18), part 2 of 2:
    
    ## What this changes in the plan
    
    - **Decision 3 is revised (2026-10-13).** An approval is an SSHSIG statement over a prepared result. Its subject is the result's `valley-delta-v1` delta, and it carries to a new tip or version only under §4's rules. A policy class can demand `exact`. Batching and trains are as above. Broad-intent delegation stays deferred.
    - **Decision 7's `Change-Id`** moves from M6 to a step before M1-C, as tracking only.
    - **`docs/roadmap.md` and `docs/security.md`:** "the candidate commit" becomes "the prepared result".
    
    ## Sequence
    
    1. **The vocabulary rename** (`[a]sk` becomes `[a]pprove`), adding no new name-keyed state.
    2. **Change IDs and versions:**
       - klaus stamps IDs at dispatch;
       - the-valley reads the header or trailer, keys its state by ID with integrator-assigned versions, and shows short IDs in `valley pending`.
    3. **The inverted review flow (M4):** a ready version is prepared, with its evidence, before review.
    4. **M1-C approvals:**
       - the SSHSIG approval statement, binding the `valley-delta-v1` digest from the first version, with conformance vectors;
       - `sigverify`;
       - one-decision landing with consumption, which includes §4's carry check and the class modes;
       - batches and trains.
    5. **Later:** hunk-level "clean", which carries across non-overlapping edits in the same file, in the direction of carrying as far as possible; and broad-intent delegation.
  3. contributor2026-10-21 21:08 UTC
    Before designing this: discuss ida-1c6ac56 (deploy targets share one release and effect model) with the operator. The operator wants an extended discussion first, before any of it is implemented.
  4. contributor2026-10-21 22:22 UTC
    Operator, 2026-10-21: whether a human approval needs a touch and which classes need a human approval are orthogonal. Every human approval is touch-signed; today every change needs a human approval, so the touch work proceeds with no class decision. qn-72027b0 is no longer a blocker: it now concerns delegation (which classes may land on checks alone or on an agent's review), alongside oc-5b0e87c and ida-9fd5573. Batching is a later convenience, not a prerequisite. Rollout may still enforce statements class by class; that is staging, not policy.
  5. contributor2026-10-21 23:43 UTC
    Cross-family review (Claude) of the touch-approval slice plan, revision 1, 2026-10-21. Revision 2 (in the body) adopts its six-slice shape.
    
    # Review: touch-signed approvals slice plan
    
    **Verdict.** The citations are accurate and the security instincts are sound. The plan is too heavy for its goal, though:
    - it ties the touch gate to the ledger;
    - it relies on a registry generation that the ledger review cut;
    - it builds preparation, approval storage, carry and stable IDs before the first touch.
    
    Today's integrator can enforce a tip-bound statement using its existing compare-and-swap. That needs five code changes and a deployment, not about ten.
    
    ## Findings
    
    1. **P1: the plan depends on a mechanism the ledger removed.** Slices 2, 6 and 8 bind, serialize or recover through a "registry generation" (plan:53, :122, :156). Ledger rev2 removed generations (ledger-rev2:12, :519); signer changes take effect on the next pass (:118). No slice builds the generation.
       - **Fix:** pin the approval-signers file once per pass, as rev2 §3 pins known-signers.
       - **Risk accepted:** a revocation takes effect one pass late. Expiry bounds the rest.
    
    2. **P1: the cutover doesn't name the trust root.** Anyone can make a software key in the sk format (sigverify/README.md:105). So whoever can land a registry change can enroll a key they hold and sign with UP and UV set. The host only asserts that the instance project is *protected* (nix/valley-host.nix:1394–1404), which still admits declared writers; "sealed" is the norm, not a rule (examples/hosts/protected.cue:2).
       - **Fix:** make it a tested precondition that the instance project and every gated target are sealed. Enable the gate on the instance project first, so enrolling a key takes a touch from a key already enrolled.
       - The same applies to the repository that deploys the host configuration.
    
    3. **P2: the withdrawal generation and incarnation machinery duplicates `seq`.**
       - **`seq` already exists.** The plan cites "no withdrawal-generation field" (change/record.go:97) but misses `seq` (:103), which the hook forces up by one on every update (valleyhook/record.go:314, :349). Binding the approved `seq` refuses any statement made before a withdraw, a re-ready or a new version.
       - **Gap:** an approve holder can delete a record (valleyhook/record.go:172), and the recreated record restarts at `seq` 1. Exploiting this needs a change approved at `seq` 1, then withdrawn, deleted and recreated at the same head, with the tip unmoved and the statement unexpired. Even then it relands only a touched result. Document it; skip tombstones.
       - **bd-2b55cff:** the void can verify the withdrawn record's commit in the same `update-ref --stdin` transaction as its leased delete (integrator/records.go:433). No approval binding is needed.
    
    4. **P2: preparation (slice 4) isn't needed.** The integrator merges with `git merge-tree --write-tree --merge-base` (integrator/git.go:168), and the client can run the same command. With T and H signed, the result, message and author are fixed (refs.go:411–438). The integrator compares its own tree digest (refs.go:370), so a disagreement refuses. The inverted review flow stays in M4.
    
    5. **P2: separate approval storage (slice 3) is premature.**
       - **One ref is enough.** A leased `refs/the-valley/approvals/<target>/<change>` ref, pushed alongside the request, needs a hook rule mirroring the request rule (valleyhook/policy.go:157–164).
       - **No consumption record is needed.** The target compare-and-swap (refs.go:491) moves off T only once.
       - **Risk accepted:** no audit trail of superseded statements until the ledger records digests.
    
    6. **P2: carry belongs in a follow-up, and it doesn't need the ledger.**
       - **`same-paths`** is verifier-only once the statement carries the delta digest; `delta.Between` is at HEAD (delta/tree.go:45).
       - **`same-class`** needs the landing interval, which the sealed target's history and transfer statements already hold.
       - **Risk accepted:** every tip move needs a re-touch until then.
    
    7. **P2: the statement binds too much.**
       - **Drop the stable instance and repository IDs.** Use the project name, as transfer v2 and the decision record do (ledger-rev2:307, :36).
       - **Drop the incarnation and the registry snapshot.** The client can't compute the signers digest, which is a digest of host-local bytes, so binding it forces preparation.
       - **Bind the policy digest the integrator already computes (refs.go:335–339).** T already pins the project layer. The client computes the same digest with `composed.Compose`, and tool skew can only refuse.
       - **Drop the key fingerprint and class.** The envelope supplies them.
       - **Keep the delta, message digest, author, carry mode and expiry,** so carry needs no v2 format.
    
    8. **P2: no selection field, and no UV or expiry in the compiled authority.**
       - **Key type selects.** An approval key is an `sk-ssh-ed25519` key with application `ssh:valley-approve`, held by a principal with the approve grant. Its type alone excludes software keys.
       - **Compile to sigverify's format.** Write the approval signers as an allowed-signers file with `namespaces=` and `verify-required` (README:92, :99).
       - **The lifetime cap is a constant.**
    
    9. **P3: port only the new logic to Go.** A Go helper composes, signs and self-verifies the statement. Bash glue adds the approval ref to approve's existing atomic push (bin/valley:1572). Port the whole verb separately.
    
    10. **P3: the pilot advice doesn't apply.** The "existing `exact` class" advice (plan:217, :223) is moot, because slice 6 accepts only an unchanged destination for every class.
    
    11. **P3: deployed readers will show the new refusal as `unknown`** (rebase/outcome.go:45). Ship reader support first.
    
    12. **P3: `approval/` can't import the test fixtures.** They live in `sigverify/internal/skforge`. Export them or use sk-dummy.
    
    ## 1. Citations
    
    I checked about 50, across sigverify, identity, valleyhook, integrator, bin/valley, change, nix, P, R, D and the knots. Nearly all hold. These four are wrong or misleading:
    
    - **The baseline is stale.** The plan says HEAD equals `origin/main`, but `origin/main` is now five commits ahead (3da70ff). rklk's deriver has landed (0d05e7f), so it is no longer pending. Line numbers in `refs.go` and `bin/valley` have shifted.
    - **sigverify.go:281** is the signature check. UP is enforced at :302 and UV at :305–318.
    - **change/record.go:97** is accurate but misleading; see finding 3.
    - **R:delta/tree.go:51** is right for the bounded reader, but valley-delta-v1 is already at HEAD.
    
    ## 2. The first touch-gated landing
    
    Yes. Before its commit point (refs.go:483–491), today's integrator can verify:
    - the signature through sigverify: `fido-sk`, ed25519-sk, UV, namespace `the-valley/approval/v1`, the statement's principal, against a per-pass copy of the approval signers;
    - that the change ID matches the request name, the head matches the request, and `seq` matches the record `finalRefusal` re-reads;
    - that T is the current tip, the result is `land.digest` and the policy is `land.policy`;
    - that the host clock falls within `issued..expires`, at most 24 h.
    
    Then it lands in one `update-ref --stdin` transaction: verify the record ref, verify the approval ref, update the target from T to L, and delete the request leased on H. That is a subset of ledger slice 4's transaction (ledger-rev2:153–164).
    
    Weighed against today, where any user of the operator's software key, agents included, files unsigned requests:
    - **Replay:** with T bound and the compare-and-swap, a statement lands once. Only a rewind of `main` within the expiry window reopens it, and that relands the same touched result.
    - **Withdrawal:** verifying the record inside the transaction closes the race. Without it, the millisecond window accepted today remains (records.go:31), but only a touched result can land in it.
    - **Consumption:** the request is deleted atomically with the target move. A request that lingers fails its T check.
    - **bd-2b55cff:** it affects liveness only; finding 3 fixes it.
    - **Deferred to the ledger:** decision records, crash-safe post-commit work and snapshot provenance. These are ledger goals, not touch goals.
    
    ## 3. Simplification
    
    - **Separate durable storage:** cut (finding 5). Risk accepted: no audit of superseded statements yet.
    - **Preparation:** cut (finding 4). Risk accepted: tool skew refuses.
    - **Carry:** move to a follow-up plan (finding 6). Risk accepted: re-touches.
    - **Stable IDs:** cut (finding 7). Risk accepted: two same-named instances could each land the identical touched (T, H) result.
    - **Recovery authority:** keep it, but with no new mechanism (§5).
    
    ## 4. The prototype
    
    I agree with not reviving the prototype's statement format. Its problems:
    - no expiry or withdrawal binding;
    - it checks UP only (P:attest/sk.go:135);
    - it has its own crypto (P:sk.go:123);
    - its namespace is shared with attestations (P:sk.go:72);
    - authority comes from the governance grant (P:verdict.go:562);
    - approvals are stored create-only, so they can't be replaced (bin/valley:1575).
    
    Reuse these:
    - the sk key class with `bound: "hardware"` (P:schema/identity.cue), which the plan omits;
    - the compose, show, touch, self-verify flow that publishes nothing on failure (P:attest/approve.go:79–106, P:sk.go:239–264);
    - e2e scenarios 17–19 and their distinct refusal sentences (P:integrator/e2e/run.sh:1036+);
    - `nix/checks/valley-request.sh`.
    
    ## 5. The open questions
    
    - **Unchanged-tip pilot:** yes. Make exact matching the cutover itself, not just a pilot.
    - **UV:** agree, as one verifier setting. It costs a PIN per approval and guards against a stolen key and touch confusion. UP alone still meets the must.
    - **Expiry:** agree on 24 h, judged by the host clock. Require `issued ≤ now + skew` and `expires − issued ≤ 24 h`. It is a constant.
    - **Recovery:** agree on a spare key enrolled at cutover. The authority is root on the host, through a root-declared approval-signers option (sigverify contract §1). No generation, and no unsigned path.
    - **IDs:** disagree. They are premature; use the project name.
    
    ## Proposed slices
    
    1. **identity:** accept `sk-ssh-ed25519` keys, reusing P's schema, and compile an approval-signers file in sigverify format. Dormant.
    2. **approval/:** statement codec, signing through `ssh-keygen -Y sign`, verification through sigverify, and vectors. The negative tests cover no touch, UV without UP, the wrong namespace, an unknown or ungranted key, mutation of each field, an expired statement and a stale `seq`. Readers learn the new refusal word.
    3. **hook and host:** the approvals namespace under the approve grant, and the root-declared signers option. Deploy slices 1–3.
    4. **client:** `valley approve` and the review menu touch-sign the statement and push the approval ref atomically with the request. Live; the integrator ignores it until slice 5 is enabled.
    5. **integrator gate:** off by default. Verify, then land through the transaction; the void verifies the record. The e2e tests cover each negative, a replay after landing, a withdraw before commit, and direct ref injection. A cross-family security review comes before enabling.
    6. **cutover (deployment):** enroll the primary and spare keys, seal the targets, enable the gate on the instance project first, re-touch outstanding requests, and write the break-glass runbook.
    
    **Then:**
    - `same-paths` carry, then `same-class`;
    - ledger slice 4 verifies the approval ref and records its digest under `approvals` (ledger-rev2:42);
    - batching.
  6. contributor2026-10-21 23:50 UTC
    For slice 2 (operator discussion, 2026-10-21): the approval statement uses the same written form as attestations (dcr-de9d996: the statement type on the first line, then key-value lines in a fixed order, no escapes, refuse what a line cannot carry), not a new canonical-JSON form. Only the envelope differs: a sumdb/C2SP note for machine Ed25519 keys, SSHSIG for FIDO keys, because a note signature line holds a raw Ed25519 signature and an sk-ed25519 signature also carries the presence flags and a counter. One statement form, two envelopes chosen by key type.
  7. contributor2026-10-21 23:56 UTCedited2026-10-29 01:08 UTC by contributor
    Operator decision, 2026-10-21, after weighing FIDO/SSHSIG against plain signing:
    1. No separate format or special case for hardware-signed statements. Approvals are statements in the attestation line form, signed as ordinary notes (Ed25519), exactly like attestations.
    2. Users without a hardware key can use a software key with the-valley.
    3. The hardware key is how a project ensures human control over a change: it is a property of the enrolled key (proven at enrollment, shown in review and records), and policy can require it, not a different envelope.
    
    YubiKey firmware 5.7 supports Ed25519 in PIV, with a per-slot touch policy and on-device attestation (Yubico's PIV attestation chain), so a PIV Ed25519 key signs notes directly. This replaces the SSHSIG/FIDO design in revision 2; revision 3 of the slice plan follows. Slice 1 (run 20261021-2343-2a82bcc5) was briefed for sk-ssh-ed25519 keys; it gets redirected once revision 3 exists.
  8. contributor2026-10-22 10:42 UTC
    2026-10-22: qvzz (slice 1 as briefed for sk-ssh-ed25519) withdrawn after the key-model change; its one standalone fix, identity reading the registry through the commit it resolved, is now vpkz. The plan is at revision 4 (in progress), cut down per the Claude review of revision 3: one hardware fact per key from Yubico PIV attestation, one policy boolean, two verifier files, yubico-piv-tool signing, no TKey on the path, a device spike first.
  9. contributor2026-10-22 11:20 UTCedited2026-10-29 01:08 UTC by contributor
    Cross-family review (Claude) of the touch-approval plan, revision 3, 2026-10-22. Revision 4 (the body) adopts it.
    
    # Review: touch-approval slice plan, revision 3
    
    **Verdict.** The citations hold, and the security reasoning is sound. But rev3 meets the new key model with a general system: provenance kinds, a metadata format, a predicate evaluator, three signer backends and a TKey bootstrap. One vendor, two keys and one policy bit meet the goal. Rev3 is also 35 KB, against a 22 KB brief.
    
    ## Findings
    
    1. **P2: the attribute machinery is ahead of need** (1a–1c). It carries five attributes, three provenance kinds, vendor-scoped firmware ranges, PIN predicates and a new evaluator, all for one vendor.
       - **One compiled fact instead.** A key is *hardware* when its Yubico chain verifies to the pinned root, the attested key equals `public`, and the touch policy is always.
       - **The evidence stays in the entry.** The slot and f9 certificates are stored as PEM in the key entry, so anyone can re-verify them and review can show the serial, firmware and PIN policy.
       - **Policy is one boolean**, in the set-as-struct idiom the schema already uses for carry and requires (`schema/verification.cue:133`, `:168`). The floor writes a concrete `true` that no project can drop.
       - **Risk accepted:** there are no PIN, firmware or vendor rules. A firmware advisory is answered by revoking keys. A second vendor becomes a later schema addition.
    
    2. **P2: metadata in comments fails open.** In 1b, attributes ride in comment records that a new reader interprets. But `note.ParseVerifierKeys` skips comments (`note/note.go:173–180`), so any ordinary load of the file treats software keys as eligible.
       - **Fix:** compile two plain verifier files, `approval-signers` and `approval-signers-hardware`. The gate opens the note against whichever file the policy selects.
       - `note.Open` then checks the full key, so there is no 4-byte-hash binding and no new reader.
    
    3. **P2: the TKey bootstrap holds the goal hostage.** Section 6 makes the gate wait on five things: oc-b5b9671, which is open with nothing built (`docs/security.md:189`); a TKey adapter, which must load the device app and speak its protocol; operator-vouched provenance; 1c's trust-root restriction; and a host bootstrap-signers override (§3).
    
       **Cut all five.** Land both hardware-key enrollments before any gate is on, and check that the compiled hardware file lists exactly those two serials. Then enable the gate on the sealed instance project. This gives the same trust as a host-pinned key.
    
       **Risk accepted:** until a TKey root exists, an enrolled hardware key with its PIN can enroll another key.
    
    4. **P2: YKCS11 breaks the repository's stdlib-only rule.** Every Go module uses the standard library only (`vendorHash = null` throughout `nix/packages.nix`), and nothing uses cgo. A YKCS11 adapter needs both cgo and a PKCS#11 binding.
       - **Shell out instead:** `yubico-piv-tool -a verify-pin -a sign -A ED25519 -s 9c`, as the tools already do with git and cue. Its `sign_file` passes Ed25519 input to the device without hashing it, and refuses anything of 3072 bytes or more.
       - **ykman has no data-signing command.** It serves enrollment: generate, attest and export.
       - **Fold software signing (2c) into the signer slice.** It is about 30 lines.
       - **Risk accepted:** a subprocess with a PIN prompt, and a tool version that Nix must pin.
    
    5. **P2: enrollment adds formats.** 1b adds two:
       - a "domain-separated proof of possession", which is a second signed form;
       - a content-addressed evidence store.
    
       The attestation already proves the key is on the device, and the governed enrollment approval proves who vouches for it. Keep the PEMs inline and pin the roots in the tool.
    
       **Risk accepted:** someone could enroll an attested key they don't hold. That is harmless: one key under two principals is refused, and a note names its principal.
    
    6. **P2: shared modules are touched for convenience.** 2a extracts line-form code from `attest/text.go`, which is 570 lines of JSON flattening, and it changes `note/`.
       - Approval fields are flat, so the codec is about 100 lines in `approval/`.
       - `note.KeyHash` and `note.Mark` are exported (`note/note.go:53`, `:70`), so `approval/` can build the signature line around an external signature.
       - `attest/` and `note/` stay untouched.
    
    7. **P2: the hardware path is unproven.**
       - **Documented by Yubico:**
         - the attestation extensions (`.3.3` firmware, `.3.7` serial, `.3.8` PIN and touch policy, `.3.9` form factor);
         - Attestation Root 1 for 5.7.4 and later;
         - Ed25519 PIV keys on 5.7.4.
       - **Unconfirmed:**
         - that `attest` works on an Ed25519 slot;
         - the device's maximum input size;
         - Go x509 verification of the 5.7.4 chain. piv-go embeds only the pre-2025 roots, and it patches f9 certificates that lack CA constraints.
    
       **Run a device spike first.** Generate in slot 9c with touch always, attest it and export f9. Sign a 2 KiB text with yubico-piv-tool, check it with `ed25519.Verify` and the chain to Root 1, and commit the public outputs as fixtures.
    
    8. **P3: storing the key as `ssh-ed25519` is sensible.** It is the same 32 bytes as the attested SPKI, and the compiler already makes note verifiers from it (`identity/render.go:121`, `:229`).
       - **The verifier needs nothing more** than its name, hash and key.
       - **Name lines by principal.** Primary and spare can share a name, because `Open` matches name and hash, then verifies the full key.
       - **SSH logins are harmless.** A pushing key also lands in `authorized_keys`, but SSH auth data opens with control bytes, which note text refuses (`note/note.go:101`).
    
    9. **P3: the base is stale.**
       - `main` is now `d8c2e54`, and the host publishes signers at `refs/the-valley/signers` (`integrator/signers.go:21`). Publish the approval files there for review to read.
       - `S:` cites `9476055`, but qvzz is now `083846a`.
       - The `refused-approval` reader (`rebase/outcome.go:40`) belongs with the hook slice, not the codec.
    
    10. **P3: the client must reproduce the integrator's landing** (`integrator/refs.go:446`). Export that one function from `approval/` for both sides, or tool skew will refuse landings.
    
    11. **P2: in-flight slice qvzz — keep a part, abandon the rest.**
        - **Keep:** the registry read through the resolved commit (`identity/registry.go:83`, `:88` at `083846a`). It fixes a real race, so land it alone now.
        - **Carry over by hand:** grant and expiry selection, the duplicate-owner refusal, the `--approval-signers` whole-file write, and the shape of the e2e harness.
        - **Drop:** the sk class (`schema/identity.cue:90–113`), the sigverify exports, sk-dummy, the allowed-signers output and the `ssh:valley-approve` filter.
        - **Abandon, don't retarget.** Its record, claims and checks all describe the sk design.
    
    ## Footprint
    
    **Rev3 touches** `schema/`, `identity/`, `composed/`, `note/`, `attest/`, `rebase/`, `status/`, the restacker tests, `valleyhook/`, `integrator/`, `bin/valley`, `nix/`, `examples/` and `docs/`. It also adds six units: an attributed reader, an enrollment verifier, a policy evaluator, `approval/`, signer adapters and an approve command.
    
    **The narrower shape** adds only `approval/`, plus small hooks: one field and two outputs in `identity/`, one boolean in `schema/verification.cue` and `composed/`, one ref rule in `valleyhook/`, one word in `rebase/` and `status/`, the gate in `integrator/`, one ref in `bin/valley`'s push, and the `nix/` wiring. `note/`, `attest/`, `sigverify/`, `restack/` and `review/` stay untouched.
    
    ## Citations checked
    
    **Repository citations.** I checked 40 of them, and all are accurate to within two lines. They span:
    - `identity/` and the schemas;
    - `note/`, `attest/` and `rebase/`;
    - `valleyhook/`, the host module and `integrator/`;
    - `composed/`, `sigverify/`, `docs/` and `bin/valley`;
    - `S:`.
    
    **External claims: confirmed.**
    - piv-go supports Ed25519 only as algorithm 0x22, for SoloKeys.
    - yubico-piv-tool supports Ed25519 from 2.5.0.
    - A cached touch lasts 15 seconds.
    
    ## Proposed shape
    
    0. **Device spike.** The operator runs it; it changes nothing in the repository.
    1. **identity: attested approval keys.** Adds an optional `attestation` (slot and f9 PEM) to `#Key`. The compiler verifies it against the pinned Yubico roots and emits both approval files, with lines named by principal. Dormant.
       - Touches `schema/identity.cue`, `identity/`, `examples/identity/`, checks and docs.
    2. **policy: one requirement.** Adds `approval: hardware: bool` and the reader for it. Deploy before use (bd-5859932).
       - Touches `schema/verification.cue` and `composed/`.
    3. **approval/: the statement, signing and verifying.** Holds the codec, `Verify`, the yubico-piv-tool and OpenSSH-key signers, the landing computation and test vectors.
       - Touches `approval/` and `nix/packages.nix`.
    4. **hook and readers.** The leased `refs/the-valley/approvals/<target>/<change>` ref under the approve grant, and the `refused-approval` word.
       - Touches `valleyhook/`, `rebase/` and `status/`.
    5. **client.** `valley approve` and the review menu show the landing and the key's hardware status, sign, self-verify, and push the approval ref atomically. The approval files are published beside the signers.
       - Touches `bin/valley`, `approval/` and `integrator/signers.go`.
    6. **integrator gate.** Off by default. It pins both files once per pass, verifies against the file the policy selects, and lands in one `update-ref --stdin` transaction. The host option asserts the targets are sealed.
       - Touches `integrator/` and `nix/valley-host.nix`.
    7. **cutover.** Enroll both hardware keys and check their serials. Set `hardware` in the floor and seal the targets. Gate the instance project first, re-touch outstanding requests, and drill the spare key.
    
    **Follow-ups:** the TKey root with an `identity/` restriction (oc-b5b9671), carry, batching, and more vendors once one exists.
  10. contributor2026-10-22 22:44 UTCedited2026-10-29 01:08 UTC by contributor
    Device spike, 2026-10-22, on the operator's hardware key (firmware 5.7.4): passed.
    
    - An Ed25519 key was generated in PIV slot 9c with PIN policy ALWAYS and touch policy ALWAYS.
    - `yubico-piv-tool -a verify-pin --sign -A ED25519 -s 9c` signed a 2075-byte text. It needed a touch each time; one attempt without a touch failed with "Authentication error". OpenSSL verifies the raw 64-byte signature with the public key: Ed25519 signs without prehashing, and Ed25519 is deterministic, so two signatures of the same text are identical.
    - The slot attestation's public key equals the generated key. The chain verifies with OpenSSL: slot 9c, then the device's f9 certificate (YubiKey PIV Attestation), then Yubico PIV Attestation B 1, then Yubico Attestation Intermediate B 1, then Yubico Attestation Root 1 (sha256 62:76:0C:6A:6E:F9:16:79:F4:54:C8:90:2B:80:FD:00:98:25:B3:F2:5D:A9:0F:1F:BA:CE:2E:C6:58:6C:D5:A8). The intermediates come from https://developers.yubico.com/PKI/yubico-intermediate.pem, and the root from https://developers.yubico.com/PKI/yubico-ca-1.pem.
    - Attested extensions:
      - .3.3 firmware 05 07 04 (5.7.4);
      - .3.7 serial number;
      - .3.8 policy 03 02 (PIN always, touch always);
      - .3.9 form factor 03.
    - Still to confirm in slice 1: Go's crypto/x509 verifying this chain.
    
    Public fixtures follow. Slice 1 commits them under identity test data.
    
    valley-approve.pub.pem:
    ```
    -----BEGIN PUBLIC KEY-----
    MCowBQYDK2VwAyEAhk1KHuQ9A3ne2EEmgFV0ZSlQkCRABview2j+lgkZUhc=
    -----END PUBLIC KEY-----
    ```
    valley-approve.attest.pem:
    ```
    -----BEGIN CERTIFICATE-----
    MIICJzCCAQ+gAwIBAgIQATCsihQMzzFrSCbhTl5GojANBgkqhkiG9w0BAQsFADAi
    MSAwHgYDVQQDDBdZdWJpS2V5IFBJViBBdHRlc3RhdGlvbjAgFw0yNDEyMDEwMDAw
    MDBaGA85OTk5MTIzMTIzNTk1OVowJTEjMCEGA1UEAwwaWXViaUtleSBQSVYgQXR0
    ZXN0YXRpb24gOWMwKjAFBgMrZXADIQCGTUoe5D0Ded7YQSaAVXRlKVCQJEAG+J7D
    aP6WCRlSF6NOMEwwEQYKKwYBBAGCxAoDAwQDBQcEMBQGCisGAQQBgsQKAwcEBgIE
    AgaY5jAQBgorBgEEAYLECgMIBAIDAjAPBgorBgEEAYLECgMJBAEDMA0GCSqGSIb3
    DQEBCwUAA4IBAQBlCVM5odtfuW6cSdc+91ZuxH9UUkiwLbgTjsUbI+r8uEgQvuGe
    dayjAI5w9Z6snXiazWwrMWrJnuPelRqfs/UGvDhwyeVlh3B5F6HcG4r6OPtA+Dtg
    PFgPNfugE79yDzAh6FGSZ/nfhlfBcNLkhjh5VONWqDX5AU/WDIstg4B26N/RmUJP
    d1B7CFlQsjs7ncbHe8eP7E5MWtWEVtOMLTHMDB20wk9wCXX9qBBkOdbtjSG4Sgz6
    dgalpWbxhhwcGGAHIMO29AIr1cHV3ICChMD4j5hrwcK6x6MvPxCqPgUJSFwff7R+
    GDJAF3vFOrQDmqHLY8vKZluju2tdDJeqQsWh
    -----END CERTIFICATE-----
    ```
    yubico-f9.pem:
    ```
    -----BEGIN CERTIFICATE-----
    MIIC9TCCAd2gAwIBAgIJAJXcF5k7Lbf8MA0GCSqGSIb3DQEBCwUAMCUxIzAhBgNV
    BAMMGll1YmljbyBQSVYgQXR0ZXN0YXRpb24gQiAxMCAXDTI0MTIwMTAwMDAwMFoY
    Dzk5OTkxMjMxMjM1OTU5WjAiMSAwHgYDVQQDDBdZdWJpS2V5IFBJViBBdHRlc3Rh
    dGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALfGsJlUJlSFW9U1
    LiPJe2J0HEy0wacxa53c0UEexr/ZtgmrIf/CVh8kqE4qpMs5igeyqxqZqLjdNqZZ
    mdYFfHJL6AKSppCcWYnaHN6rSj6OgBpidg9uaQlNx+03fXn7GJHQhWYgvTX9qczm
    fkqh2rh4a14Bg2ipgBePwwvPUidHSdqytfMgq+H1YzbouamXyHdcpW/OPPOeoTwv
    +X4fr3bldpwABqHDT/mM/znh16dhQu7QlPFgnG3rNK6ddCIdVuFs+LqYlU7Ute+f
    QbVp8FiravxczUb1GRRKMNkWGtA6m5P87zyAw8vUbnMlsflj6paHAwOpzXfAT4/G
    k65UhqUCAwEAAaMpMCcwEQYKKwYBBAGCxAoDAwQDBQcEMBIGA1UdEwEB/wQIMAYB
    Af8CAQAwDQYJKoZIhvcNAQELBQADggEBAEsyUM3GxUCWSHliTfcF9+r5BEILfR/5
    2cdpRfaJWSdW+/bHUffdGWRD6PckY3AQBpgap3zBgzE5yq2Kv3A1bnAFo6DHjPCn
    waos9hFm/YVidxjWvi0brHwKHHGGQdSmQzLAG7/aabpfaVfEurQDBBUoZAnBxdMP
    tLaS+HGhAVbTgyh9glZrfqZi/aoM57JB5yBZ8GCzUazN6CdE5TnEs+ooVQXfQNP2
    wNkM2IMOE/CNXa/UVp9s3JH7hloW/VNoynK5SlMrJ+acoehM3fDM4NgIpE+q8ei8
    +sjUk8NEdie+vPIEgpS8ZEGX1030kuRfw47GG4CJEN9fbB2jaqzU/Mg=
    -----END CERTIFICATE-----
    ```
    spike.txt (2075 bytes; 27 lines of base64, wrapped at 76, each newline-terminated):
    ```
    xAt1NQczoa0jWQPeRVuiCWXDk25qDrECdxo9EQHHXZiQkjv5nYxCz3+ypxqWCoHEBruFCt2xsEDH
    /khoRjA20xA8UMjcN9G+vZ69vf3f5QpMjap+KFa2EftQfjJJP7J+bY2vvCx0rFpHrgdygeVqggnG
    1hSyHZGGoz1TYkIqhFGF4EBFw8pTBlEfmLpq3Q2Ibh52+Zc7eMHFlvUPQtxkFT/9vK9/LapD/FTE
    jM/yxfraqUfZs7JE7bW7CwXzExpWXJ/2kHfuDuC3uRrXEFRylGDhkaI4NdTlM9dWfozPxLPlrVAv
    fnhZGl68dIkZFDDVtyI+eeWwwU3R8a9EBxUtm+hkHLjjqJXIbDY5QXpVMl092m5qLHk7PNx9kZE8
    vRx9BBbql73IGdX4Aqxh6Htol7yVieyY2zlTk9a2Z11hz0G47eq2Pn1uZbaJRarnYbL6Zb+rWxij
    4r1US6mwo1UYUExqKByLEKhVfiBRt/lYXQi1ksS+kvlxGs2AtHYK9FEPcXZorKIx8HsSug25QRDm
    V9smiY8mKqZthmCHvQ8ttZoH+o1hkfUEgmcRXhesCO9ak67McmkIgMcI50KO2ELLg9FvawxDqxw2
    AE+dZCyLfQkBP1Hf1t52FozAdjulBXJ3ST+xxPbJEtF2to7oNMv4568jyKKyq4aYCHNd/+Pet0wU
    D6r/QetIWV/LI3xNNB7cTPwjd9EUSfNgikPZ/RlFTwRzUfjY5S++BepFUQ8Ri9HLPYr9tpqK649p
    HdGwQ6se5sQ152cicIGHkdUMxItpz9TRKx72jR4H9s4iHQ0RHXDD0pvlve45CXT0KzdOKPwxTkWa
    AOkMcRCsTefK6qOEMYVQz+uF5jiToY7Moxf+s1mI7xJu3kXdC+3JKhTrJFKr2krdWQnqYR5hgTfI
    ZhJnQg2zwb10quMVJXPgsYHbqU1plybsmm2ZzTjidlWddMY/o0BWxnD5yTAWoQ4Goh04wvcsrFkh
    UcGgiK9WdMJlT28HpVgqA/k0OZ7TspzkcpTyh0YCfhuGsRiLOe8+G/NoZuKkD82Z6IYJfwggzSey
    Laa7gWWHFDMLruCLOqS9JqVg2iiy+5yKmvccIbm7UZAsA+2qi025pLXS96eVukC90uf1SjLtPNbg
    LbH5pj+TvTr5MnwicjShRY/PHk0Xq5TugRt8IwCN7a041UKFJAiW33ssajclrSOzuFgj1BdpbaE3
    ahuL4gVbCHDmlcBHQS7Gf3UBB6ZZHHyVfscPQKtb0ewo8Qiys8bYc3W+Q8n1unxDngrvjwOLFcqx
    OeGwkyDBoTMlKkXBHwZ2Djr6qws3V/o1lbZYAlA/wCZJa+Rtf7qx9C1t7MIQ+kQbe/LWH7cP4BVm
    CLYAxhcXlXgAfme3+gsSkSnweS8PGJF8avtTNmhWeYTu8feYeJssCHdyoOvCnDYpErl7iAIefT/3
    c7tep9OpOKHnmQ7bXaj4mucyyFSftTGUc/3tXiSmnfBRDsCbUoCRC3jEiQMoQuZ3vKl5MigncyWq
    fAD3oeW2HHAs6/4jmhhMAXj/ac3+Y7edOa6Fcp2JjkBkOD/eiB+Gjv+2pRRZ/bIl4kqZTmVCM7Rd
    sF9lM4m6TgXqsW7dad3BQd1IhB3qtxtfP6gOT8zDTLGgg3Psp98eryxYrBymOPICxzYKFGPRi1v7
    5ZOVVnsh/ADkQjjtdaNMaZfeJDJiBBuzSurk14kAX1XQTcr2sW2lyXpdn9cllD6xC5uK5Cb62hXs
    XsNhJ44BJdLBTyjIykVpqHnsvZFvwzrm8PvKJNIGih3IKN/ePniUVOvO97eqVIlVnFwANEhjCF2o
    kwp+foUMZG3bnD0VXDR+kjwLMt/VvutMNe6aRfGLwSEFGSYuKMcdKl76hsl2jus3t0B7/6fc5yw1
    wRRC3kMVrwjDGb7voUKX1fS8T16gyc6yBNB7OPX8/SHf4L1xz6g+Q3wPPM4+3tmnHXn4nsMsB8lc
    oXRDFZuO4vVhcP9hYX94FGmmhbZX+btR81agMZchnO1h71TRUJiVZoRs0CEAWCZS4yA/PbpC
    ```
    spike.sig, base64: il4L96V3MexuTCjA5RR5E56IqP5+K+TE5UQhR683J3r6akf3dX2Xf9eP6GdhQf/MqSDXhG16hLS6tUaKXVLXAQ==
  11. contributor2026-11-02 22:36 UTC
    Moved under M8 (oc-9d1b67a) on 2026-11-02 from oc-40e3520: it is one of the three outcomes that form the base for the redesign. Work under it takes the smallest change that serves it, and adds no new architecture the redesign would have to unwind.
  12. contributor2026-11-04 01:01 UTC
    Slice plan revision 5, 2026-11-04: authored by Astra (codex, consult thread hw-approvals) against main 60224096, after today's approve-at-once (rmyv) and landing-tree evidence (ovrm). Not yet reviewed with the operator.
    
    Revision 5 — 2026-11-04, against main `60224096edd06cbd5270e44b3a81afc5483d1753`.
    
    The smallest implementation signs today’s approval intent: “land this recorded head’s change onto the target when its checks permit.” It preserves approval across restacks without introducing preparation, a ledger, or approval scheduling.
    
    Everything proposed below is **not built**. Activation and hardware enrollment are **deployment choices**.
    
    The statement and carry contract
    
    Use the attestation line form and an ordinary Ed25519 note. The first line is `the-valley/approval/v1`. Bind:
    
    - Configured approval scope, project, target, change ID, original version number and head.
    - The change-record commit observed when approving.
    - Composed-policy digest.
    - Approving principal, issue time and expiry.
    
    The approval scope is an operator-configured identifier shared by client and integrator. Different installations sharing keys must use different scopes.
    
    The **head is the signed subject**. Its immutable commit fixes the source content, landing message and author fields. The version identifies where that head entered the change. Neither the newest version nor the eventual landing tree replaces it.
    
    The integrator continues applying the approved head’s delta onto the target as it stands when judged. Evidence may come from the resulting tree, including evidence built for a restacked version with that tree. A restack does not rewrite or renew the signature. A changed head requires another approval if the operator wants that changed content to land.
    
    Do **not** claim this implements `valley-delta-v1` approval carry. Git can merge edits within an approved file; this contract permits that existing behavior. The signature does not promise identical whole-file pre-images and post-images.
    
    Defer enforcement of `same-paths`, `same-class` and `exact` to a separate outcome. Their current parsed values must be documented as **not enforced**, including in approval review output. Implementing them correctly changes today’s authorization contract and requires the delta and history predicates from the earlier design. Do not quietly treat today’s clean merge as `same-paths`.
    
    Withdrawal must still invalidate approval. Do not compare the current `seq` directly with the signed record: restacking increments it too. Instead, follow the existing record history from the current record to the signed record. Require an unbroken history with no intervening departure from `ready`. Retain that history while enforcement is enabled.
    
    1. Statement, signing and verification
    
    Files: new `approval/` package and command; `nix/packages.nix`; `docs/reference.md`.
    
    Implement the bounded, canonical codec; software Ed25519 signing; PIV signing through the packaged `yubico-piv-tool`; and verification through `note.Open`. Sign the complete statement, construct the ordinary note envelope, and self-verify before publication. Keep `note/`, `attest/` and `sigverify/` unchanged.
    
    Give lifetime and signing timeout documented options, with conservative defaults. Reject oversized statements before invoking hardware and report the supported bound. Establish that bound with the packaged tool and actual statement, rather than assuming the earlier 2 KiB spike proves every size.
    
    Tests: canonical vectors; field mutations; wrong first-line namespace; unknown key; principal mismatch; malformed envelope; future, expired and overlong validity; signing failure. Software keys must work under ordinary authority and fail under hardware-only authority.
    
    Hardware: the original spike passed. Before merging this slice, the operator signs a real maximum-sized statement with the packaged helper. Confirm verification, repeated touch requirements, cancelled PIN, unplugging and touchless failure. Use neutral public fixtures.
    
    2. Storage, readers and publication
    
    Files: `valleyhook/policy.go`, `valleyhook/record.go` and tests; `rebase/outcome.go`; `status/`; `integrator/signers.go`; `nix/valley-host.nix`; reference documentation.
    
    Admit one leased `refs/the-valley/approvals/<target>/<change>` containing `approval.note`, writable under the approve grant. Validate names, size and object shape. Publish both existing compiled approval signer files beside known signers, including empty files after revocation. Teach readers `refused-approval`.
    
    For projects enabling enforcement, reject change-record deletion. This preserves the history needed to distinguish a restack from withdraw/re-ready and prevents deletion/recreation from resetting approval validity. No new withdrawal counter or tombstone store is needed.
    
    Tests: unauthorized writes, malformed objects, replacement leases, empty-authority publication, refusal rendering and record-deletion refusal.
    
    Hardware: none.
    
    3. Approve and review
    
    Files: `bin/valley`; `approval/`; client tests, including `nix/checks/valley-request.sh`; `docs/guide.md`.
    
    Both approval entry points display the original head, diff, principal, fingerprint, hardware eligibility, lifetime and carry contract. Freeze those inputs, sign, self-verify, then push statement and integration request atomically with leases.
    
    Do not wait for missing Nix checks. Preserve `--build-here` and existing command-check behavior. Checks remain independent evidence. Point operators to `valley changes --checks` for progress.
    
    Tests: missing Nix evidence still files a signed request; default approval starts no Nix build; `--build-here` retains its behavior; failed or touchless signing publishes nothing; lease races publish no partial update; an unchanged request does not recreate a consumed request accidentally.
    
    Hardware: one touch per successful PIV approval, regardless of missing checks.
    
    4. Integrator enforcement
    
    Files: `integrator/refs.go`, `records.go`, transaction/input handling, existing landing-record code and tests; `integrator/e2e/run.sh`; host wiring; architecture/security documentation.
    
    Add off-by-default enforcement for every request in an enabled project. Require a recorded change. Pin local approval authority once per pass; select the hardware subset when composed policy requires it. Missing, malformed or empty selected authority fails closed.
    
    Verify scope, target, change, original version/head, signature, principal, policy, time and uninterrupted ready history. Continue using existing landing computation and evidence selection.
    
    Extend the existing landing transaction: verify the observed change-record and approval refs, require the request still names the approved head, consume request and approval, and write the landing records together. Refuse replay using the existing landing record for that head. Record approval digest and signer identity in the landing record.
    
    Make withdrawal cleanup verify the withdrawn record in the same transaction as its request deletion. This addresses bd-2b55cff.
    
    Re-evaluate approval refusals when authority, statement or time changes. Keep announcement deduplication separate.
    
    Tests: valid landing; moved target with landing-tree evidence; conflict; changed signed head; wrong namespace; unknown/revoked key; software key under hardware policy; expired statement; replay after landing; withdraw/re-ready; record recreation; concurrent withdrawal or statement replacement; direct request injection. Every failed transaction leaves the target unchanged.
    
    Hardware: no unattended device access. Run one real-device end-to-end approval before activation; automated negatives use software fixtures and failing signer substitutes.
    
    5. Activation and recovery
    
    Files: host assertions/options; guide and security documentation. Registry, floor and host configuration paths are deployment inputs.
    
    Require sealed targets: protection with no push writers. Include the instance project and the project supplying host configuration. Enroll and inspect primary and spare hardware keys before enabling enforcement. Check compiled public keys against verified certificates and observed devices.
    
    Activate the instance project first, then host configuration and remaining projects. Reapprove outstanding unsigned requests. Test both devices and a software-key refusal. Urgent revocation requires confirming compiled authority has converged before resuming integration. Losing both keys requires administrative rebootstrap.
    
    What revision 4 loses
    
    Remove completed identity, policy, device-spike and registry-reader work from the implementation sequence. Remove shared client/integrator landing preparation, exact-tip cutover, signed result/delta fields, batching, trains and ledger prerequisites. Leave worker concurrency unchanged.
    
    qvzz was withdrawn because its SK/SSHSIG implementation contradicted the ordinary-note key decision. Its registry-reader repair landed separately. The knot confirms this; qvzz’s operational change record is absent from this checkout, so its withdrawal record remains an explicit verification item.
    
    Trust model for the operator
    
    An approval authorizes a particular recorded head. It does not approve whatever an author uploads next. A restack can provide newer check evidence without receiving new approval authority.
    
    An enrolled human principal with the approve grant can approve. The principal is the identity named in the registry. The signing key must appear in the compiled approval authority. When policy requires hardware, it must also appear in the hardware subset. That subset comes from verified device enrollment showing a matching key and touch-always policy.
    
    The integrator verifies the signature itself. It also checks current authority, expiry, policy, change history and passing evidence for the tree that would land. A valid signature cannot replace failing checks. Withdrawal invalidates the approval even if the change later becomes ready again.
    
    An attacker controlling the workstation can alter the display, propose malicious content and request signatures. A touch confirms use of the key; the device has no trusted screen proving which diff was shown. The operator must therefore trust the review workstation while approving. Without the hardware key’s required interaction, workstation control alone cannot create a qualifying hardware approval. A compromised authorized check machine can falsify its evidence, but cannot forge the separate approval. Host administrators remain trusted because they control the verifier and its authority files.
    
    Claim-to-code checklist, verified against HEAD
    
    - **Implemented:** approval key selection and hardware qualification: `identity/render.go:156`, `identity/attestation.go:107`.
    - **Implemented:** hardware policy field: `schema/verification.cue:102`, `composed/composed.go:256`.
    - **Implemented:** pinned registry read: `identity/registry.go:115`.
    - **Implemented:** approve-at-once and command-check exception: `bin/valley:1973`.
    - **Implemented:** landing-tree evidence and atomic landing records: `integrator/refs.go:474`, `integrator/refs.go:676`.
    - **Implemented:** sequence increments and deletion permission: `valleyhook/record.go:315`, `valleyhook/record.go:194`.
    - **Implemented:** check-state listing: `status/list.go:89`.
    - **Not built:** slices 1–4 above. **Deployment choice:** slice 5.
  13. contributor2026-11-04 01:27 UTC
    Slice plan revision 6, 2026-11-04: Astra (codex), revising revision 5 with a Gemini (Argon) purpose review. The changes: no policy digest, approve lists, PIN once with a touch every time, a derived instance identity, and where the approval note lives. Awaiting the operator's decisions on lifetime, hardware scope and enrollment.
    
    Revision 6 — 2026-11-04, against `60224096edd06cbd5270e44b3a81afc5483d1753`.
    
    All proposed mechanisms below are **not built**. Enrollment and activation are **deployment choices**. Revision 5 remains unchanged except where specified here.
    
    The signed statement
    
    Use an ordinary Ed25519 note containing the fixed-order attestation line form:
    
    - Statement type: `the-valley/approval/v1`.
    - Derived instance identity, project and target.
    - Change ID, original version number and approved head.
    - Change-record commit observed at approval.
    - Approving principal, issue time and expiry.
    
    **Drop the policy digest.** The integrator applies current policy when judging a landing, including current approval authority and hardware requirements. Policy edits do not themselves invalidate queued signatures.
    
    A concrete consequence: an approved policy change could remove a required check, allowing queued changes to land without it. Binding the old policy digest would require fresh approval afterward. Revision 6 instead treats approval of the policy change as authorization for its effect on pending work. This matches the requested throughput model.
    
    The signed head fixes the source content, message and author. A restack never substitutes another head into that statement. The integrator applies the approved head’s delta onto current main and accepts qualifying evidence for the resulting tree. **Implemented:** landing-tree evidence is read at `integrator/refs.go:474`.
    
    Carry modes remain **not enforced**. This is the existing clean-merge contract, not whole-file `valley-delta-v1` equivalence. Withdrawal still invalidates approval through uninterrupted ready-history verification; direct equality with `seq` remains unsuitable.
    
    Instance identity
    
    **Not built:** derive identity from the instance repository’s history: hash a canonical, sorted list of its integrated tip’s root commit IDs, including the Git object-format name. Publish the result with signer information; the integrator independently derives it. No scope option or origin URL enters the statement.
    
    **Implemented:** the host already identifies the authoritative instance repository through `instanceProject` (`nix/valley-host.nix:1701`); client discovery finds it (`status/list.go:207`). No existing unique installation identifier was found.
    
    This identifies a repository lineage. Copies sharing that lineage, project names and authority share approval scope. It does not distinguish installations cloned from one another. Enforcement initially requires an instance repository; directory-only policy configuration supplies no equivalent identity.
    
    Where the approval lives
    
    **Implemented:** request refs point directly at head commits (`integrator/refs.go:21`); request enumeration reads that namespace (`integrator/refs.go:74`).
    
    Compare three options:
    
    - **Separate approval ref, atomic push:** preserves request readers. Creation, replacement and consumption compare both refs.
    - **Blob under a sibling ref:** has the same coordination requirement, but avoids the revision-5 tree containing one file. Putting it inside the request namespace would require enumeration filters. Putting it below an existing request ref conflicts with Git’s ref-name hierarchy.
    - **Request points at a commit whose parent is the head:** carries the note and head together, but changes the request’s meaning. Integrator enumeration, record matching, cleanup, status readers and external consumers such as klaus must unwrap it. Parentage alone does not preserve current readers.
    
    **Recommendation, not built:** use an approval-note blob at `refs/the-valley/approvals/<target>/<change>`, pushed atomically with the unchanged request ref. Readers of request heads remain compatible. The hook, approval client and integrator gain approval-ref handling; status gains refusal reporting.
    
    Two refs can still diverge through later writes. Safety comes from rejecting mismatched signed heads and verifying both observed refs in the landing transaction—not from atomic publication alone.
    
    The slices
    
    1. **Statement and session signer.** Files: `approval/`, a narrowly scoped external PIV helper, `nix/packages.nix`, reference documentation. Compared with revision 5, remove policy binding and configured scope; add derived identity and persistent signing sessions. Keep Go standard-library-only by invoking a small packaged helper using `libykpiv`. It holds one device connection for the run and signs independent statements.
    
       Test canonical encoding, mutations, wrong namespace, unknown key, principal mismatch, expiry, bounds and software/hardware selection. Hardware acceptance must demonstrate several signatures after one PIN entry, each requiring a fresh touch.
    
    2. **Storage, readers and publication.** Same files as revision 5: hook policy/record handling, refusal readers, signer publication and host wiring. Replace the single-file approval tree with a bounded blob; publish derived instance identity. Retain record-deletion refusal, empty-authority publication and lease tests. No hardware interaction.
    
    3. **Approve lists and review lists.** Files: `bin/valley`, `approval/`, client checks and guide. Add `valley approve c1 c2 …` and equivalent review traversal. Share discovery, authority loading, device connection and initial validation. Freeze each reviewed head; revalidate its leases before publication. Show progress, then sign and publish each independently. Cancellation leaves completed approvals intact and reports the remainder.
    
       Preserve approve-at-once, `--build-here` and command checks. **Implemented:** their separation is described in `bin/valley:1973`. Test partial completion, cancellation, lease races and signing failure without partial publication for that change. Hardware: one touch per change.
    
    4. **Integrator gate.** Same files and transaction work as revision 5. Replace signed-policy comparison with current-policy enforcement; verify derived identity. Retain ready-history checks, withdrawal cleanup repair, replay refusal, approval consumption, audit fields and expiry-aware re-evaluation.
    
       Add tests where policy changes while approvals wait: stronger hardware requirements refuse software signatures; changed checks require current evidence; unrelated policy edits require no new touch. Retain all revision-5 negatives, including voided statements and concurrent replacement. Hardware: one real end-to-end run before activation.
    
    5. **Activation and recovery.** Retain sealed targets, primary and spare enrollment, instance-first activation, outstanding-request reapproval and revocation convergence. Update enrollment guidance below.
    
    PIN and touch defaults
    
    **Deployment choice:** generate a new approval key in an inspected, available slot with:
    
    `ykman piv keys generate --algorithm ED25519 --pin-policy ONCE --touch-policy ALWAYS 9c public.pem`
    
    These policies are set when generating/importing the key; do not overwrite an occupied slot. Existing PIN-ALWAYS keys require replacement and renewed attestation to adopt ONCE. [Yubico enrollment options](https://docs.yubico.com/software/yubikey/tools/ykman/PIV_Commands.html).
    
    ONCE means once per device session, not a timed touch cache. ALWAYS requires every signature’s touch. [Yubico policy definitions](https://developers.yubico.com/PIV/Introduction/Yubico_extensions.html).
    
    **Not built:** keep that connection throughout the run. If authentication is lost through reset, reconnect or session invalidation, pause and prompt again securely; never silently retry a rejected PIN. Never pass it through arguments or logs.
    
    Open operator decisions
    
    - **Lifetime default:** choose the default and maximum validity; suggest 24 hours initially, configurable and enforced.
    - **Hardware classes:** current policy has one global hardware boolean (`schema/verification.cue:102`). Recommend hardware for every approval initially. Class-specific selection requires an explicit extension.
    - **Enrollment:** choose primary and spare devices, approve replacing PIN-ALWAYS keys, and inspect their attestations. **Implemented:** hardware qualification requires touch-always (`identity/attestation.go:107`); PIN-ONCE remains enrollment guidance.
  14. contributor2026-11-06 00:43 UTC
    Decisions:
    - No lifetime. An approval binds the head its approver read; whether it still lands is decided by the clean-merge and carry rules and by withdrawal, not by a clock. The statement keeps its issue time for the record and carries no expiry.
    - Hardware for every approval: policy's single hardware switch is on for all approvals; no per-class selection.
    - Enrollment is done: two hardware keys are enrolled and the on-disk approval keys were rolled.
    
    Slice 1 (statement and session signer) can start with these.
  15. contributor2026-11-07 01:46 UTC
    Review of piv-go v2.6.0 (github.com/go-piv/piv-go/v2) as a replacement for the libykpiv session signer, 2026-11-07. Source read at the tag; libykpiv compared at Yubico's main.
    
    Project:
    - One maintainer commits, merges and releases.
    - No SECURITY.md, private vulnerability reporting off, tags and commits unsigned.
    - Hardware tests run only by hand (`--wipe-yubikey`), not in CI; no fuzzing.
    - No advisories on record. sum.golang.org pins v2.6.0 and it matches the tag.
    - Used without forks by large signing projects.
    - About 3.3k lines; one dependency (x/crypto, for cryptobyte).
    
    Code, for this use:
    - `Close` disconnects with SCARD_LEAVE_CARD (piv/pcsc_unix.go:110), so a PIN-once key stays verified after the command exits until the key is removed. libykpiv disconnects with SCARD_RESET_CARD (lib/ykpiv.c:371). Matching it needs a one-line patch; there is no public API for it.
    - `Open` holds an exclusive connection and one transaction until `Close`. libykpiv connects shared, with a transaction per call, so between signatures another process can use the verified PIN.
    - Sign returns the card's bytes unchecked; approval's self-verify against the attested key covers it.
    - `Verify` (attestation) only checks that some chain reaches a Yubico root, through any embedded intermediate. identity/ verifies enrollment itself and would keep doing so.
    - PIN: prompted only when the card says it is needed. A refused PIN is never resent within a call. Not cached when it comes from `PINPrompt`. Copies are not zeroed. No silent reconnect.
    - Others: unbounded GET RESPONSE loop (a timeout covers it), Ed25519 chaining over 255 bytes untested upstream, `Reset`/`SetRetries` reachable (a narrow wrapper hides them), no locking across goroutines.
  16. contributor2026-11-08 22:28 UTC
    oc-40e3520 ends as a duplicate of this outcome, which holds its approvals half: the operator's hardware key signs an approval statement over a prepared result, and the integrator verifies it as part of one landing decision. Its release half is a comment on oc-005e06d, and approval carry (oc-d28b43a) and broad-intent approval (ida-9fd5573) move under this outcome.
  17. contributor2026-11-16 01:42 UTC
    Decisions for the integrator gate (slice 4), 2026-11-16, after a brief by Astra and an independent critique:
    
    - The on/off switch is policy: `approval.required` beside `approval.hardware`, absent meaning off. Set in an instance's floor, a project cannot remove it by landing a change. No per-project flag in the instance declaration.
    - The gate reads the host's own compiled approval-signers files (the authoritative entry), the way the integrator reads known-signers, not the published copy. A revoked key stops approving once the registry compiles. The publication keeps informing clients; its missed-wake window (bd-c23c67b) stays a client display limit and is not a condition of activation. A client can briefly show a key as valid that the gate refuses.
    - Built as two changes: proof and history checks with tests, unused; then enforcement, the switch and one end-to-end signed landing. Audit record trimmed to the consumed note and the key list used.
    - `telemetry-e2e` stays a follow check; not required for client changes.
    
    Also 2026-11-16: the note of 2026-11-06 saying two hardware keys were enrolled was wrong; the instance's registry held none. The operator's two PIV keys are being enrolled now. Enrolling a key for approval also lets it push, because the registry has no approval-only key; whether to add that concept is a question for the design review.
  18. contributor2026-11-16 02:00 UTC
    Second critique (2026-11-16) of the two-part brief. Change A: build with changes (launched as oc-3952f9e: the helper takes the selected authority list as bytes and reads no files; the ready-history walk mirrors the hook's two-parent version-addition shape). Change B: reshape.
    
    For B:
    - The gate reads only the policy-selected authority file. The compiler already builds the hardware list from eligible approval keys, so cross-checking adds no authority. Cut pair consistency and the incomplete-update marker.
    - No generated "host prerequisite facts" format. Pass the integrator the same push-policy JSON the hook uses; minimum runtime checks are retained records, a target sealed against pushes, a configured instance identity and the selected authority. Historical retention, protection of the host-configuration source and a quiesced cutover belong to activation.
    - A second directory-watching subsystem is avoidable; have authority replacement mark the existing controller wake directories. This is responsiveness, not soundness.
    - "Off is unchanged" holds only after off is established: composing policy earlier changes off-path cost and one failure case (unreadable policy can preserve a request that was previously voided). Say so.
    - Guards on refs in other repositories need lock files there; the integrator's sandbox writes only its served repository. That is a permissions change to decide, not plumbing.
    - Estimated 2,000 to 3,500 lines; split policy/schema support and dormant authority and transaction support from enforcement.
    
    Operator's rule for key changes (2026-11-16): any change that lands after a key change reflects that key change; retries and some instability on the way are acceptable. Open: how the gate knows its authority file is at least as new as the registry (candidate: the compiled file names the registry commit it was compiled from and the gate refuses and retries while that differs from the instance's current tip, in place of a compiler/reader lock held across the landing).
  19. contributor2026-11-16 02:04 UTC
    Decided 2026-11-16: the simultaneous case is accepted for now. A landing whose authority check passed an instant before a registry change landed still goes through; no lock is held across the two repositories. The gate's rule is: the compiled authority file names the registry commit it came from, and a gated landing is refused and retried while that differs from the instance's current tip, checked as late as the landing allows. State the remaining window as a limit. The operator expects an authoritative central event log to be what orders events across repositories later.