client-lifecycle-state-restoration
Registry Trigger
Use when
- Client behavior must survive or intentionally reset across visibility changes, backgrounding, process termination, relaunch, crash, upgrade, logout, or account switch.
Do not use when
- No lifecycle or restoration decision.
- Only offline-sync policy.
- One platform API without a shared state rule.
Skill Role
Define cross-client lifecycle states, snapshot authority, restoration eligibility, duplicate initialization, stale asynchronous completion, cancellation, and identity reset. A shared state rule means a shared cross-client restoration contract, not a platform callback. Exclude platform APIs, generic state-store selection, offline synchronization, packaging, and release workflow.
High-Value Rules
- Model lifecycle states by allowed effects. Distinguish visible, obscured, background-capable, suspended, terminated, and relaunched states according to the repository's actual runtime contract.
- Classify restorable state before serialization. Preserve only user continuity that is safe to reconstruct while durable business truth remains with its authoritative owner.
- Make initialization repeat-safe. Give launch, activation, and restoration work explicit ownership so duplicate entry cannot register handlers or commit effects twice.
- Bind snapshots to identity and compatibility. Reject or migrate snapshots when account, session, schema, application version, or required source data no longer matches.
- Require lifecycle generation for asynchronous completion. Cancel disposable work and prevent stale results from mutating a newer screen, session, or account.
- Restore intent without replaying effects. Reconstruct navigation, drafts, and selections while reconciling consequential operations through their authoritative status.
- Define reset behavior for destructive transitions. Specify what survives crash or upgrade and what must clear on logout, account switch, corruption, or incompatible restoration.
Anti-Patterns
- Treat an in-memory resume, process recreation, and cold launch as the same path.
- Restore captured credentials, permissions, server responses, or completed commands as current truth.
- Use one global startup flag while multiple scenes, windows, activations, or tests can initialize independently.
Stop Conditions
Stop when snapshot ownership, restored identity, schema compatibility, or effect status is unknown. Escalate platform callback semantics to the applicable Domain Skill and route offline reconciliation to offline-sync-conflict-resolution.
Output Contract
- lifecycle-restoration decision with state model snapshot contents and version initialization identity stale-work handling reset policy observable interruption evidence proof limits and residual owners
Targeted References
| Path |
Type |
Load when |
Do not load when |
Required by |
Required output |
| restoration boundaries |
targeted |
Termination snapshot eligibility restoration compatibility or duplicate activation remains unresolved |
Established repository state ownership already determines restoration and reset behavior |
analysis-agent, task-agent, review-agent |
selected-approach, proof-limit |
1---
2name: client-lifecycle-state-restoration
3description: "`analysis-agent`/`task-agent`/`review-agent`: use for installed-client lifecycle, termination, restoration, or identity-reset decisions; skip static UI and platform-API-only work."
4metadata:
5 source: https://skillmd.com/skills/machenjie/client-lifecycle-state-restoration
6---
7
8# client-lifecycle-state-restoration
9
10## Registry Trigger
11
12**Use when**
13
14- Client behavior must survive or intentionally reset across visibility changes, backgrounding, process termination, relaunch, crash, upgrade, logout, or account switch.
15
16**Do not use when**
17
18- No lifecycle or restoration decision.
19- Only offline-sync policy.
20- One platform API without a shared state rule.
21
22## Skill Role
23
24Define cross-client lifecycle states, snapshot authority, restoration eligibility, duplicate initialization, stale asynchronous completion, cancellation, and identity reset. A shared state rule means a shared cross-client restoration contract, not a platform callback. Exclude platform APIs, generic state-store selection, offline synchronization, packaging, and release workflow.
25
26## High-Value Rules
27
28- **Model lifecycle states by allowed effects.** Distinguish visible, obscured, background-capable, suspended, terminated, and relaunched states according to the repository's actual runtime contract.
29- **Classify restorable state before serialization.** Preserve only user continuity that is safe to reconstruct while durable business truth remains with its authoritative owner.
30- **Make initialization repeat-safe.** Give launch, activation, and restoration work explicit ownership so duplicate entry cannot register handlers or commit effects twice.
31- **Bind snapshots to identity and compatibility.** Reject or migrate snapshots when account, session, schema, application version, or required source data no longer matches.
32- **Require lifecycle generation for asynchronous completion.** Cancel disposable work and prevent stale results from mutating a newer screen, session, or account.
33- **Restore intent without replaying effects.** Reconstruct navigation, drafts, and selections while reconciling consequential operations through their authoritative status.
34- **Define reset behavior for destructive transitions.** Specify what survives crash or upgrade and what must clear on logout, account switch, corruption, or incompatible restoration.
35
36## Anti-Patterns
37
38- Treat an in-memory resume, process recreation, and cold launch as the same path.
39- Restore captured credentials, permissions, server responses, or completed commands as current truth.
40- Use one global startup flag while multiple scenes, windows, activations, or tests can initialize independently.
41
42## Stop Conditions
43
44Stop when snapshot ownership, restored identity, schema compatibility, or effect status is unknown. Escalate platform callback semantics to the applicable Domain Skill and route offline reconciliation to `offline-sync-conflict-resolution`.
45
46## Output Contract
47
48- lifecycle-restoration decision with state model snapshot contents and version initialization identity stale-work handling reset policy observable interruption evidence proof limits and residual owners
49
50## Targeted References
51
52| Path | Type | Load when | Do not load when | Required by | Required output |
53|---|---|---|---|---|---|
54| [restoration boundaries](references/restoration-boundaries.md) | targeted | Termination snapshot eligibility restoration compatibility or duplicate activation remains unresolved | Established repository state ownership already determines restoration and reset behavior | analysis-agent, task-agent, review-agent | selected-approach, proof-limit |