Keep the plan on the player in this world's save.
Build / build (push) Failing after 35s

Goals persist as a player attachment: load on join, write after each change, unload on leave so worlds do not leak. Dying does not wipe the list. Remote dedicated servers stay RAM-only.
This commit is contained in:
Stephen Fasciani
2026-09-08 05:42:05 -04:00
parent f807a9e603
commit 4e57760de6
20 changed files with 402 additions and 24 deletions
+3 -1
View File
@@ -37,7 +37,7 @@ RefreshProgress
missing = required − available
```
Persistence: none in this slice. The list lives in memory.
Persistence: the player in this world's save (ADR-017). Leave the world and the overlay unloads; come back and the goals load.
---
@@ -76,6 +76,8 @@ Do not start EMI. Do not start a planner menu.
[[🔌 Recipe Provider]]
[[💾 Persistence]]
[[📈 Progress Calculation]]
[[🖥️ Experience]]
+7 -3
View File
@@ -100,7 +100,7 @@ First use case: [[▶️ Create Goal]]. In code this slice is one `Planner` faca
Mark Goal Complete is named. It is not in the first slice.
The application layer calls infrastructure through ports (`RecipeProvider`, inventory snapshot). It does not contain domain rules. It loads what the use case needs, asks the domain to decide, and presents the result. Persistence is in-memory for this slice.
The application layer calls infrastructure through ports (`RecipeProvider`, inventory snapshot, `GoalStore`). It does not contain domain rules. It loads what the use case needs, asks the domain to decide, and presents the result. Persistence is the player in this world's save (ADR-017).
Packages: [[📦 Packages]].
@@ -119,7 +119,7 @@ Examples:
- Save data storage
- Inventory scanning
Shipped this slice: `VanillaRecipeProvider` (`RecipeManager`, all types, one level), player-inventory snapshot, HUD overlay, tooltip+key capture. `StubRecipeProvider` is unit tests only. No save adapter yet. EMI/JEI/REI are not dependencies.
Shipped this slice: `VanillaRecipeProvider` (`RecipeManager`, all types, one level), player-inventory snapshot, HUD overlay, tooltip+key capture, player world save. `StubRecipeProvider` is unit tests only. EMI/JEI/REI are not dependencies.
Infrastructure is never the source of domain truth.
@@ -147,7 +147,7 @@ Possible implementations:
- Server Save
- Future Cloud Sync
First slice: in-memory. No save adapter yet.
Shipped: player attachment in this world's save. Survives quit and death. Remote multiplayer stays RAM-only until a server adapter exists. See [[💾 Persistence]] and ADR-017.
---
@@ -215,6 +215,10 @@ See [[🎯 Success Metrics]].
[[🧾 Recipe Resolution]]
[[💾 Persistence]]
[[🔌 Recipe Provider]]
[[🖥️ Experience]]
[[🚶 Day in the Life]]
+49
View File
@@ -0,0 +1,49 @@
# 💾 Persistence
Port used by [[▶️ Create Goal]] (and the sibling quantity / clear paths).
The domain does not know where the plan is stored (ADR-004). Infrastructure answers.
---
## Shape
```text
GoalStore
all() / find / put / remove / clear
```
Play uses `PersistingGoalStore`: RAM plus a write after each change.
`InMemoryGoalStore` remains for unit tests.
---
## Shipped implementation
Player attachment in **this world's save** (ADR-017).
| Event | Result |
|-------|--------|
| Join world | Load this player's goals |
| Create / + / − / Clear | Write the attachment |
| Leave world | Unload RAM. Do not write empty (that would wipe the save) |
| Death | Plan is copied. It is not loot |
Singleplayer and LAN host. Remote dedicated server: RAM-only this slice.
Server save and cloud remain possible later. They do not change `GoalStore`.
---
## Related Documents
[[🏛️ Architecture]]
[[📦 Packages]]
[[📝 Decisions]]
[[▶️ Create Goal]]
[[🎯 Goal]]
+21
View File
@@ -282,6 +282,27 @@ The port remains. The **order** was wrong.
---
### ADR-017 — First persistence is the player in this world
**Date:** 2026-09-08
**Decision:** Active goals persist as a NeoForge player attachment in the current world's save.
- Per player, not one list for the whole world
- Copy on death: dying does not wipe the plan
- Load on join, write after each change, unload RAM on leave so worlds do not leak
- Singleplayer and LAN host. A remote dedicated server has no integrated world save on the client; that session stays RAM-only until a server adapter exists
**Reason:**
The first slice is a prosthetic the player can quit and resume. ADR-004 named world save, server save, and cloud. World save is the one they play.
**Status:** ✅ Accepted
**Refines:** ADR-004. **Supersedes** ADR-013’s “Persistence: in-memory” freeze for this slice.
---
## Related Documents
[[🏛️ Architecture]]
+9 -3
View File
@@ -2,7 +2,7 @@
Java packages for the first slice. Root: `com.sufficient.satistaskory`.
Rule #9: do not add a package until the slice needs it. No `project`, `emi`, or `persistence` until those are in the slice.
Rule #9: do not add a package until the slice needs it. No `project` or `emi` until those are in the slice.
---
@@ -25,7 +25,8 @@ com.sufficient.satistaskory
application/
Planner # create / increment / decrement / clear / snapshot
InMemoryGoalStore
GoalStore # port
InMemoryGoalStore # unit tests; inner store for persist
infrastructure/
recipe/
@@ -33,6 +34,10 @@ com.sufficient.satistaskory
StubRecipeProvider # unit tests only
inventory/
PlayerInventoryAdapter # player inventory → InventoryState
persistence/
GoalPlan # NBT codec
PersistingGoalStore
PlayerGoalPersistence # player attachment in this world
client/
PlayOverlay # Screen 2 HUD (not a Screen)
CaptureHook # tooltip + KeyMapping ADD_GOAL
@@ -50,7 +55,6 @@ Dependencies point inward: `infrastructure` and `application` may import `domain
|---------|-----|
| `Project` | Organizational only; not in the slice |
| Completion strategy | Ready ≠ complete; complete is not in the slice |
| Persistence | In-memory goals. ADR-004 still holds; no save adapter yet |
| Full-screen planner | Not discovered |
The NeoForge template example block/item is gone. Do not put it back.
@@ -65,6 +69,8 @@ The NeoForge template example block/item is gone. Do not put it back.
[[🔌 Recipe Provider]]
[[💾 Persistence]]
[[🎯 Goal]]
[[📝 Decisions]]