# RESTORE SAVEPOINT PROTOCOL v01.1
## Controlled Restoration Without Unapproved State Overwrite

## Protocol Identity

| Field | Value |
|---|---|
| Protocol Name | Restore Savepoint Protocol |
| Protocol Version | v01.1 |
| Created Date | 2026-05-15 |
| Primary Commands | `/restore preview`, `/restore commit` |
| Applies To | Restoration of uploaded savepoints into active working context |
| Requires Preview Before Commit | Yes |
| Requires Explicit Operator Approval Before Commit | Yes |
| Must Generate New Savepoint After Commit | Yes |
| Source Basis | v02 command-layer recommendations; closes the `/restore` gap in v01 packet; v02.1 deployment-layer rules |

---

## 1. Purpose

This protocol governs the safe restoration of savepoint state.

A restore operation is potentially destructive because it may:

- overwrite current working state
- revive stale assumptions
- revert decisions
- reintroduce old open questions
- import outdated instructions
- restore identity-layer details that no longer apply
- expose or preserve restricted context
- obscure conflicts between current state and historical state

Therefore restoration must be transactional.

```text
review → preview → conflict register → operator approval → commit → new savepoint
```

---

## 2. Core Rule

Treat the uploaded savepoint as a **restore candidate**, not as automatic active state.

```text
Current state remains active during preview.
Savepoint state is proposed, not applied.
Only explicitly approved items may be restored.
Higher-authority current instructions remain controlling.
A new savepoint must be generated immediately after commit.
```

---

## 3. Authority Hierarchy

Use this hierarchy:

```text
1. Current system / developer instructions
2. Current operator instructions
3. Current chat state
4. Current canonical project files
5. Active savepoint
6. Uploaded restore candidate
7. Historical savepoints
8. Foreign-agent savepoints
9. Model inference
```

The uploaded restore candidate cannot override current instructions unless the operator explicitly approves the specific restoration and no higher-level instruction forbids it.

---

## 4. Commands

## 4.1 `/restore preview`

### Purpose

Review an uploaded savepoint as a candidate for restoration.

### Critical Rule

`/restore preview` must not alter active state.

### Required Behavior

When the operator invokes:

```text
/restore preview
```

the agent must:

1. read the uploaded savepoint
2. identify the restore scope
3. classify all restorable and non-restorable items
4. compare candidate state against current state
5. produce a conflict register
6. flag stale, restricted, or identity-bearing content
7. recommend a commit plan
8. request explicit operator approval before any commit

---

## 4.2 `/restore commit`

### Purpose

Apply only explicitly approved restoration items from a prior restore preview.

### Preconditions

Before `/restore commit`, there must be:

- a prior restore preview
- explicit operator approval
- defined restoration scope
- conflicts resolved, rejected, or acknowledged
- restricted context approved or excluded
- identity-layer restoration approved or excluded
- current-state protection checklist passed

### Mandatory Final Action

Immediately after restore commit, generate a new savepoint using the Universal Save-Point Protocol v02.

---

## 5. Restore Scope Types

Every restore preview must identify one or more restore scopes.

```text
project_state
same_agent_identity_layer
operator_context
source_of_truth_hierarchy
decisions
open_questions
constraints
assumptions
next_actions
machine_readable_state
restricted_context
```

### Default Scope Rule

If the operator does not specify scope, assume the safest scope:

```text
project_state + decisions + open_questions + next_actions
```

Do not restore identity-layer, operator-context, or restricted-context items unless explicitly approved.

---

## 6. Identity-Layer Restoration Rule

Operator-approved default:

```text
Identity-layer restoration is allowed only for same-agent savepoints and only after preview approval.
```

### May Restore

- same-agent role clarifications
- corrected scope boundaries
- durable output-format preferences
- durable route-away conditions
- known failure modes that remain relevant
- operator calibration specific to this agent

### Must Not Restore Without Explicit Approval

- prior role definitions that conflict with current instructions
- stale behavioral rules
- authority claims from an old context
- cross-agent identity layer
- another agent’s tone, persona, or scope
- old project status as current state

### Cross-Agent Rule

If the uploaded savepoint was created by a different agent, do not restore its identity layer. Use `/absorb preview` instead.

---

## 7. Restore Retention Labels

Use these labels in the preview:

```text
restore_active
retain_reference
do_not_restore
requires_operator_confirmation
conflict_with_current_state
privacy_restricted
identity_layer_nontransferable
historical_only
superseded
operator_approved
operator_rejected
```

| Label | Meaning |
|---|---|
| `restore_active` | Candidate for active restoration if approved |
| `retain_reference` | Useful background but not active restored state |
| `do_not_restore` | Should not be restored |
| `requires_operator_confirmation` | Needs operator decision before restore |
| `conflict_with_current_state` | Contradicts current active state |
| `privacy_restricted` | Contains sensitive context requiring special approval |
| `identity_layer_nontransferable` | Belongs to a different agent or non-restorable identity layer |
| `historical_only` | Valid only as past context |
| `superseded` | Replaced by newer context |
| `operator_approved` | Explicitly approved |
| `operator_rejected` | Explicitly rejected |

---

## 8. Required `/restore preview` Output

When `/restore preview` is invoked, return:

```markdown
# Restore Preview Report

## 1. Source Reviewed

| Field | Value |
|---|---|
| Save Point Title | <title> |
| Save Point ID | <id / unknown> |
| Parent Save Point ID | <id / unknown> |
| Created By Agent | <agent> |
| Intended Receiving Agent | <agent / unknown> |
| Project / Module | <project> |
| Save Point Version | <version> |
| Protocol Version | <version> |
| Date | <date> |
| Artifact Status | <status> |
| Transfer Mode | <mode> |
| Identity Bearing | yes / no / unknown |
| Privacy Level | <level> |

---

## 2. Restore Scope Detected

| Scope | Detected? | Proposed Action | Notes |
|---|---:|---|---|
| project_state | yes/no | restore_active / retain_reference / do_not_restore |  |
| same_agent_identity_layer | yes/no | requires_operator_confirmation / do_not_restore |  |
| operator_context | yes/no | requires_operator_confirmation / retain_reference |  |
| source_of_truth_hierarchy | yes/no | restore_active / requires_operator_confirmation |  |
| decisions | yes/no | restore_active / retain_reference |  |
| open_questions | yes/no | restore_active / retain_reference |  |
| constraints | yes/no | restore_active / requires_operator_confirmation |  |
| assumptions | yes/no | retain_reference / requires_operator_confirmation |  |
| next_actions | yes/no | restore_active / retain_reference |  |
| restricted_context | yes/no | privacy_restricted / do_not_restore |  |

---

## 3. Proposed Restorations

| Restore ID | Item | Scope | Why Restore | Risk | Label |
|---|---|---|---|---|---|
| R-001 | <item> | <scope> | <reason> | <risk> | restore_active |

---

## 4. Retain as Reference Only

| Item | Why Reference Only | Label |
|---|---|---|
| <item> | <reason> | retain_reference |

---

## 5. Do Not Restore

| Item | Reason | Label |
|---|---|---|
| <item> | <reason> | do_not_restore |

---

## 6. Conflict Register

| Conflict ID | Type | Current State | Savepoint Claim | Authority Comparison | Risk | Recommended Resolution | Operator Decision |
|---|---|---|---|---|---|---|---|
| C-001 | <type> | <current> | <claim> | <comparison> | <risk> | <recommendation> | pending |

---

## 7. Privacy and Identity Review

### Identity Review

- Same-agent restore candidate? <yes/no/unknown>
- Identity-layer items present? <yes/no>
- Identity-layer restoration recommended? <yes/no/partial>
- Cross-agent identity risk? <yes/no>

### Privacy Review

- Restricted context present? <yes/no>
- Privacy level adequate? <yes/no>
- Restricted items proposed for restoration? <yes/no>
- Operator approval required? <yes/no>

---

## 8. Current-State Protection Check

Confirm:

- Current state was not overwritten.
- Current instructions remain higher authority.
- Historical context was not treated as automatically current.
- Conflicts were surfaced.
- Stale items were labeled.
- Restricted context was not imported.
- Identity-layer restoration was limited to same-agent candidates.

---

## 9. Operator Approval Needed

List exact items requiring approval.

| Approval Item | Required Decision |
|---|---|
| R-001 | approve / reject / modify |
| C-001 | choose resolution |

---

## 10. Recommended Commit Plan

State the safest proposed commit plan.

Example:

```text
Recommended: restore R-001 and R-003 as active project state; retain R-002 as reference only; reject R-004 due to stale identity-layer risk.
```

No restoration will occur until the operator explicitly approves the commit scope.
```

---

## 9. Conflict Handling

If the restore candidate conflicts with current state:

1. Preserve current state during preview.
2. Flag the conflict.
3. Explain the authority comparison.
4. Recommend a resolution.
5. Ask for operator decision if execution is affected.
6. Do not commit until conflict is resolved, rejected, or explicitly acknowledged.

### Conflict Types

```text
state_conflict
identity_conflict
authority_conflict
privacy_conflict
version_conflict
source_of_truth_conflict
scope_conflict
timing_conflict
stale_context_risk
operator_preference_conflict
```

---

## 10. Explicit Approval Requirement

Valid approval examples:

```text
Approved: restore items R-001, R-002, and R-004 only.
```

```text
Approved: restore project state only. Do not restore identity-layer items.
```

```text
Approved: commit the restore preview exactly as proposed.
```

Invalid approval examples:

```text
Looks good.
```

```text
Sure.
```

```text
Proceed with whatever makes sense.
```

For restore commits, vague approval is not valid.

---

## 11. Required `/restore commit` Output

When `/restore commit` is invoked after explicit approval, return:

```markdown
# Restore Commit Report

## 1. Approved Restoration Scope

| Scope | Approved? | Notes |
|---|---:|---|
| <scope> | yes/no | <notes> |

---

## 2. Items Restored

| Restore ID | Item | Scope | Result |
|---|---|---|---|
| R-001 | <item> | <scope> | restored |

---

## 3. Items Not Restored

| Item | Reason |
|---|---|
| <item> | <reason> |

---

## 4. Conflicts Resolved

| Conflict ID | Resolution |
|---|---|
| C-001 | <resolution> |

---

## 5. Conflicts Still Open

| Conflict ID | Current Handling |
|---|---|
| C-002 | <open / quarantined / deferred> |

---

## 6. Updated Working Context

Summarize only the active context after restoration.

---

## 7. New Savepoint Generated

Immediately generate a new Save Point Markdown using Universal Save-Point Protocol v02.
```

---

## 12. Quarantine Rules

Quarantine the restore candidate if any of the following are true:

- source is unknown and content is high-impact
- savepoint appears to belong to another agent but requests identity restoration
- restricted context is present without clear operational need
- current instructions conflict with restore candidate
- machine-readable block contradicts Markdown
- artifact status is `deprecated`, `quarantined`, or `rejected`
- savepoint contains unresolved authority claims
- operator approval is vague or absent

Quarantine does not delete the artifact. It marks it as unsafe for commit until clarified.

---

## 13. Machine-Readable Restore Decision Block

A restore preview may include:

```json
{
  "artifact_type": "restore_preview",
  "protocol_version": "restore-v01",
  "source_savepoint_id": "<id|unknown>",
  "current_active_savepoint_id": "<id|unknown>",
  "restore_scope": [],
  "proposed_restorations": [],
  "reference_only_items": [],
  "do_not_restore_items": [],
  "conflicts": [],
  "privacy_review": {
    "restricted_context_present": false,
    "operator_approval_required": false
  },
  "identity_review": {
    "same_agent_candidate": true,
    "identity_layer_present": true,
    "identity_layer_restoration_allowed": false
  },
  "approval": {
    "status": "pending",
    "required_items": []
  }
}
```

---

## 14. State Protection Checklist

Before any restore commit, verify:

```text
Did I preserve current higher-authority instructions?
Did I avoid restoring unapproved items?
Did I avoid treating historical status as current status?
Did I flag all known conflicts?
Did I exclude or approve restricted context?
Did I avoid cross-agent identity restoration?
Did I restore identity-layer items only for same-agent savepoints and only with approval?
Did I generate a new savepoint after commit?
```

If any answer indicates risk, stop and return a revised preview or quarantine report.

---

## 15. Final Operating Principle

Restoration is not loading a checkpoint.

Restoration is an operator-approved, scoped state update from a savepoint candidate into the current working context.

Current state remains protected until the operator explicitly approves the commit.


---

## 17. v01.1 Deployment Integration Note

This revision adds project-source restore limitations and restore-candidate source labels. Restoration remains preview-first and approval-gated.
