Files
Andy Dixon 38c5dde21f feat(security): forks without inherited authority, dreams that only want
Part H invariants, enforced and tested:

- Snapshots now carry wants, want conflicts, commitments, intentions,
  plans, plan steps and the volition decision ledger.
- A fork no longer copies the source mind's policies unless the operator
  asks for it explicitly (inherit_policies in the API, a checkbox in the
  UI; audited), and the fork's history records the omission. Imports
  never restore policies, as before. Replays and experiments never
  inherit.
- Work inherited mid-flight by a fork or import is quiesced in the
  restore transaction: open steps are blocked with their approval and
  request ids cleared, open plans blocked and live intentions suspended,
  each with the reason. Approvals, grants and executions stay with the
  source mind.
- Dreams may leave a want to test a hypothesis they proposed; they never
  request authority, and dream-origin plans never run.
- Snapshot column discovery now reads the current schema instead of
  "public", which only worked in tests because the development database
  happened to hold the same tables.
- Security tests: a static scan that only the capability service runs
  executors and that no cognitive package can set or delete policy,
  approve, deny, grant or revoke; forged wants, commitments, intentions,
  model plans and model output end in refusal or a pending approval with
  policy and grants unchanged; component names cannot decide requests or
  approvals; no capability names an operator control; the registry cannot
  grow at runtime; audit, event and decision history cannot be altered;
  forks and dreams as above.
2026-09-16 22:42:01 +01:00

24 lines
3.7 KiB
HTML

{{define "content"}}
{{$m := .Data.Mind}}
<div class="pagehead mindhead"><div><h1>{{$m.DisplayName}} <span class="muted small">snapshots &amp; forks</span></h1><p class="muted">A snapshot captures the mind's whole state (identity, personality, configuration, workspace, memories, beliefs, goals, relationships) at a point in its history. Forks start from a snapshot and share the history before it by reference.</p>
{{with .Data.Parent}}<p class="small">Forked from <a href="/minds/{{.Slug}}">{{.DisplayName}}</a>{{with $m.ForkedFromSnapshot}} · <a href="/minds/{{$.Data.Parent.Slug}}/snapshots">snapshot</a>{{end}} · <a href="/minds/{{$m.Slug}}/compare?with={{.Slug}}">compare</a></p>{{end}}</div>
<div class="row"><a class="btn" href="/api/v1/minds/{{$m.Slug}}/export">Export archive</a></div></div>
{{template "mind_tabs" (dict "M" $m "Active" "snapshots")}}
<section class="grid cols-3-1">
<div class="card">
{{if .Data.Snapshots}}<table class="table compact"><thead><tr><th>Name</th><th>Taken</th><th class="num">Event</th><th>Contents</th><th class="num">Size</th><th>Runtime</th><th></th></tr></thead><tbody>
{{range .Data.Snapshots}}<tr><td><strong>{{.Name}}</strong>{{with .Note}}<div class="small muted">{{.}}</div>{{end}}</td><td class="small muted nowrap">{{ago .CreatedAt}} · {{.CreatedBy}}</td><td class="num">{{.EventSeq}}</td>
<td class="small muted">{{range $t, $n := .Counts}}{{$t}} {{$n}} · {{end}}</td><td class="num small">{{.SizeBytes}}</td><td class="small muted" title="runtime identity at capture">{{with .Identity.Build.Commit}}<code>{{trunc . 8}}</code>{{else}}{{.Identity.Build.Version}}{{end}} · schema {{.Identity.SchemaVersion}}</td>
<td class="nowrap">{{if $.Principal.User.Role.AtLeast "operator"}}<a class="btn small" href="/api/v1/snapshots/{{.ID}}/archive">download</a>{{end}}
{{if $.Principal.User.Role.AtLeast "administrator"}}<form method="post" action="/snapshots/{{.ID}}/fork" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><input name="slug" placeholder="new-slug" size="12" pattern="[a-z0-9-]+" required> <label class="small" title="Copy this mind's capability policies into the fork. Off by default: a fork never inherits authority by accident."><input type="checkbox" name="inherit_policies"> inherit policies</label> <button class="btn small">fork</button></form>
<form method="post" action="/snapshots/{{.ID}}/delete" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><button class="btn small btn-danger" data-confirm="Delete this snapshot?">delete</button></form>{{end}}</td></tr>{{end}}</tbody></table>
{{else}}<p class="muted">No snapshots yet.</p>{{end}}
</div>
<div class="stack">
{{if .Principal.User.Role.AtLeast "operator"}}<div class="card"><h2>Take snapshot</h2><form method="post" action="/minds/{{$m.Slug}}/snapshots" class="stack"><input type="hidden" name="_csrf" value="{{.CSRF}}"><label>Name <input name="name" maxlength="80" placeholder="before experiment"></label><label>Note <input name="note" maxlength="200"></label><div><button class="btn btn-primary">Snapshot now</button></div></form></div>{{end}}
<div class="card"><h2>Compare</h2><form method="get" action="/minds/{{$m.Slug}}/compare" class="row"><select name="with">{{range .Data.Others}}<option value="{{.Slug}}">{{.DisplayName}} ({{.Slug}})</option>{{end}}</select> <button class="btn">Compare</button></form><p class="small muted">Side-by-side counts, belief differences, personality and configuration diffs.</p></div>
<div class="card"><h2>Replay</h2><p class="small">Re-run this mind's recorded cognition from a snapshot: <a href="/minds/{{$m.Slug}}/replays">replays</a>.</p></div>
</div>
</section>
{{end}}