You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0c30c93
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CLAUDE.md
+26-15Lines changed: 26 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,15 +46,20 @@ by whoever knows something new. A machine is three plain Python things.
46
46
|`fire(id, step, entity=)`| the same, on the entity already in hand instead of `load(id)` (`brief` takes it too) |
47
47
|`fire(id, step, answer=)`| decides a `Decide` in the model's place; no model call, the prompt doesn't run |
48
48
|`brief(id, step)`| the `Brief` a `Decide` would give the model: instructions, prompt, choices, schema, tools |
49
-
|`advance()`| per unfinished entity, tries the steps out of its state in list order and stops at the first that doesn't return `None`: at most one move per entity per call |
49
+
|`progress(id)`| moves one entity until it rests: each round tries the steps out of its state in list order on the entity loaded afresh, and commits its move; it stops when no step moves it, or after a move back to a state this call already left |
50
+
|`progress_all()`| per unfinished entity, tries the steps out of its state in list order and stops at the first that doesn't return `None`: at most one move per entity per call, each entity locked and committed on its own |
`in_state`, `all_current`, `history`), plus the `Move` and `Current` dataclasses.
123
-
-`backends/locmem/`: in memory, for tests.
129
+
-`backends/locmem/`: in memory, for tests; `lock` is a per-entity `RLock`.
124
130
-`backends/django/`: a Django app (`INSTALLED_APPS = ["agentic_fsm.backends.django"]`, label
125
131
`agentic_fsm`) with two models, `LogEntry` (append-only) and `CurrentState` (one row per
126
-
entity, with a `version`), and their migration. It's the only place Django is imported.
132
+
entity), and their migrations. `lock` is `transaction.atomic()` around a `select_for_update`
133
+
of the entity's current-state row; SQLite ignores the row lock. It's the only place Django is
134
+
imported.
135
+
136
+
Every backend keeps the same two things and the same rule: `move`, called inside `lock`,
137
+
rewrites the entity's current-state row and appends its log row, and both commit when the lock
138
+
is released.
127
139
128
-
Every backend keeps the same two things and the same rule: a move rewrites the entity's
129
-
current-state row and appends its log row in one transaction, and only if the entity's version is
130
-
still the one read before the step ran. A move that finds another version is logged as refused.
140
+
`0002_only_real_moves` deleted the refused log rows and dropped `applied`, `reason` and
141
+
`version`. An app whose migration writes those columns through the historical models declares `run_before = [("agentic_fsm", "0002_only_real_moves")]`.
0 commit comments