On this page
Record structure before you need to restore it๏
Prerequisites: checkpoint entry points and configuration ownership. Crystallizer records structural information and source custody. A checkpoint is not a serialization of your live application objects or their arbitrary mutable state.
Setup order is part of the example๏
For the recorded dynamic-world examples, activate custody and research first,
finalize the SpellbookConfiguration, configure dynamic frame posture, and then
bind and conjure. This makes recording available when the structural events occur.
Activating a recorder afterward does not imply it observed earlier bindings.
Profiles, checkpoints, and research sets๏
Name |
Partitions or identifies |
|---|---|
Persistence profile |
The content window receiving recorded emissions |
Checkpoint ID |
A particular checkpoint in ledger creation order |
Research set |
An independent body of declared version history and residency |
Aetheric frame |
A live runtime world |
Switching the active profile moves a pointer. It does not copy the previous
profile's content, and list_checkpoint_ids() remains a process-wide ledger read.
The profile lesson compares explicit and active-profile descriptions and exercises
clear versus delete.
Know where the source came from๏
Synthetic modules carry recorded source and can be imported without a file. File-backed source can be retained or read from the recorded path, depending on policy. The source-view lesson reports kind, origin, availability, and drift rather than treating all source text as the same evidence.
Continue to restore, external storage, or recorded source and diffs according to the next operation you need.
The workflow in code๏
These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.
1def main() -> None:
2 crystallizer = md.Crystallizer()
3
4 # RECORDING IS OPT-IN, and asking a configured-but-inactive
5 # crystallizer about profiles REFUSES rather than answering emptily.
6 try:
7 crystallizer.list_profile_names()
8 raise AssertionError("expected a refusal before activation")
9 except RuntimeError as inactive:
10 print("profiles before activation ->", str(inactive)[:88])
11 print(" a world that quietly recorded nothing would be worse")
12 print(" than one that refused")
13
14 crystallizer.activate(
15 md.CrystallizerConfigurationBuilder().with_defaults().activate(),
16 )
17
18 # THE ONE YOU HAVE ALREADY BEEN USING HAS A NAME.
19 assert crystallizer.active_profile_name == "default"
20 assert "default" in crystallizer.list_profile_names()
21 print()
22 print("active profile:", crystallizer.active_profile_name)
23 print(" every earlier lesson recorded here without naming it")
24
25 # A WORLD WORTH RECORDING.
26 spellbook_configuration = (
27 md.SpellbookConfiguration(FRAME).with_defaults().finalize()
28 )
29 book = md.Spellbook(aetheric_frame=FRAME,
30 configuration=spellbook_configuration)
31 book.configure_aether_frame(
32 system_state="dynamic",
33 disposal=None,
34 disposal_method_names=None,
35 rift_enabled=True,
36 ai_native=True,
37 )
38 book.bind(spell=Ledger, existence="unique", permissions="create",
39 binding_name="profile-ledger")
40 book.conjure(name="profile-root")
41
42 on_default = crystallizer.create_checkpoint()
43 print()
44 print("sealed a checkpoint on 'default':", on_default[:14], "...")
45
46 # A SECOND WORLD OF RECORD, BY NAME. No object is handed back.
47 crystallizer.create_profile("staging")
48 assert crystallizer.active_profile_name == "staging", (
49 "create_profile activates by default"
50 )
51 assert set(crystallizer.list_profile_names()) >= {"default", "staging"}
52 print()
53 print("create_profile('staging') -> active is now:",
54 crystallizer.active_profile_name)
55 print(" it returned None. The NAME is the handle; the profile object")
56 print(" never escapes the depths, so there is nothing to alias or")
57 print(" accidentally keep alive")
58
59 # AND HERE IS THE LINE PEOPLE GET WRONG, INCLUDING THE AUTHOR OF THIS
60 # LESSON ON THE FIRST TRY. A profile decides what a checkpoint
61 # CONTAINS. It does not give you a private ledger.
62 on_staging = crystallizer.create_checkpoint()
63 everything = crystallizer.list_checkpoint_ids()
64 assert on_staging in everything
65 assert on_default in everything, (
66 "list_checkpoint_ids returns ALL ids - the ledger is process-wide"
67 )
68 print("sealed a checkpoint on 'staging':", on_staging[:14], "...")
69 print()
70 print("list_checkpoint_ids() ->", len(everything), "ids, and BOTH are")
71 print(" here. Its contract says `all checkpoint ids in exact ledger")
72 print(" creation order` - one ledger for the process. Switching")
73 print(" profiles does not hand you a private one.")
74 print(" What the profile partitions is the CONTENT: create_checkpoint")
75 print(" snapshots ONE profile's twin window and advances THAT")
76 print(" profile's journal mark. Same shelf, different boxes.")
77
78 # SWITCHING MOVES A POINTER AND NOTHING ELSE - including not moving
79 # the ledger, which is why both ids are still listed below.
80 crystallizer.set_active_profile("default")
81 assert crystallizer.active_profile_name == "default"
82 after_switch = crystallizer.list_checkpoint_ids()
83 assert set(after_switch) == set(everything), (
84 "the switch moves a pointer; it does not copy, migrate or hide"
85 )
86 print()
87 print("set_active_profile('default') -> the ledger is unchanged:",
88 set(after_switch) == set(everything))
89 print(" `moves the pointer only - no data is copied or migrated`")
90 print(" cuts both ways: nothing follows you, and nothing is taken")
91
92 # YOU CAN ALSO NAME THE PROFILE EXPLICITLY rather than switching to
93 # it - the argument is there so a caller never has to move the
94 # pointer just to seal somewhere.
95 targeted = crystallizer.create_checkpoint(profile_name="staging")
96 assert crystallizer.active_profile_name == "default", (
97 "checkpointing another profile must not move the active pointer"
98 )
99 print()
100 print("create_checkpoint(profile_name='staging') ->", targeted[:14],
101 "... and the active profile is still",
102 crystallizer.active_profile_name)
103
104 # DESCRIBE READS THE ACTIVE ONE WHEN YOU NAME NOTHING - and this is
105 # where the CONTENT partition is visible, since the ledger read is
106 # not. `describe_profile` reports per-level twin counts and the
107 # emission sequence for ONE profile.
108 active_view = crystallizer.describe_profile()
109 default_view = crystallizer.describe_profile("default")
110 staging_view = crystallizer.describe_profile("staging")
111 assert isinstance(active_view, dict)
112 assert active_view == default_view, (
113 "None must resolve to the ACTIVE profile, which is 'default' here"
114 )
115 print()
116 print("describe_profile() -> the ACTIVE one (keys:",
117 "%s)" % sorted(active_view)[:4])
118 print("describe_profile('staging') -> that one (keys:",
119 "%s)" % sorted(staging_view)[:4])
120 print(" None means ACTIVE, not `all profiles` - proven by the two")
121 print(" reads above being equal while 'default' is active")
122 print(" and THIS is where the partition shows: per-profile twin")
123 print(" counts and emission sequence, not the shared ledger")
124
125 # CLEAR EMPTIES AND KEEPS. DELETE REMOVES.
126 crystallizer.clear_profile("staging")
127 assert "staging" in crystallizer.list_profile_names(), (
128 "clear is the NON-destructive reset - the profile survives"
129 )
130 print()
131 print("clear_profile('staging') -> still listed:",
132 "staging" in crystallizer.list_profile_names())
133
134 crystallizer.delete_profile("staging")
135 assert "staging" not in crystallizer.list_profile_names()
136 print("delete_profile('staging') -> still listed:",
137 "staging" in crystallizer.list_profile_names())
138 print(" two verbs because emptying a world and removing it are")
139 print(" different intentions, and one of them is recoverable")
140
141 # AND THE DEFAULT IS NEVER DELETABLE.
142 try:
143 crystallizer.delete_profile("default")
144 raise AssertionError("expected a refusal: default is guaranteed")
145 except ValueError as refusal:
146 print()
147 print("delete_profile('default') refused -", str(refusal)[:80])
148 print(" the same shape of law as the default research lane that")
149 print(" never archives: every system needs one thing that cannot")
150 print(" be removed, or its own fallbacks have nowhere to fall")
151
152 print()
153 print("one process, several records, and you addressed them by name")
Runnable examples๏
Several worlds of record in one process โ Expert 34
Two knobs and a terminator per rung โ Expert 06
What a synthetic module actually is โ Expert 33