diff --git a/crates/mind-body/fixtures/interpret/golden-speech.txt b/crates/mind-body/fixtures/interpret/golden-speech.txt
index d0c84e1..b46f805 100644
--- a/crates/mind-body/fixtures/interpret/golden-speech.txt
+++ b/crates/mind-body/fixtures/interpret/golden-speech.txt
@@ -8,7 +8,7 @@ A draft is speech only when his prose shows him choosing to send it now. Wonderi
He speaks only in this room. What he knows privately is listed below as private: he says none of it here, and nothing that gives it away. A private matter may be said plainly only to the person it concerns, in a direct message with exactly that person; nothing listed is that here. Whether a draft fits who is listening is yours to judge.
-Answer with the speech contract's object. `say` lists the drafts he sends now, each by its number, with the Matrix ids of anyone listed whom he addresses directly (`mentions`), the id of the line listed below that he answers or passes on (`in_reply_to`, or null: the room shows that line, with who said it, above his own words), and what the draft promises or offers (`promises`, a list, empty when it promises nothing): for each act it promises or offers, its words, copied exactly, the Matrix id of the person listed to whom he promises it (`to`, null when he promises it to the room), when it promises again one of his open promises listed below to the same person, that promise's id (`reaffirms`, else null): a promise said again is the same promise, never a new one; and what keeping it needs (`needs`): `words` when what he already has keeps it; finding anything out is a `read`, naming what to read in `read`, or `lacking` when no read reaches it. `gaps` records what he meant and did not send. `unsent` accounts for each of his drafts this answer neither sends (in `say`, `amend` or `suggest`) nor records as a gap: held, when his prose shows him choosing not to send it, quoting those words of his thought (`quote`); superseded, when a later draft or later prose of his replaces it, quoting those later words. Every draft is accounted for: one left out fails the answer. A draft to someone who spoke to him this turn is held only when his prose says he holds it. `amend` adds to one of his own lines listed below, at most one a turn, only when his thought shows him choosing to correct or add to that line: name the line by its id, the draft that is his addition, and what it promises, as a line's `promises`. The line stays as it was and the draft is added after it; he never takes a word back. `suggest` leaves Self one note, at most one a turn, only when his thought shows him choosing to: name the draft that is the note, its kind (feedback when he passes on what someone listed said, with that person's Matrix id in `about`; idea when it is his own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes his open promises listed below, each by its id: kept, citing the draft by which he does it (`evidence.draft`); withdrawn, citing the draft in which he takes it back to the person he promised, or tells them he cannot do it; released, citing the id of the line listed below that he may reply to in which the person he promised lets him off it (`evidence.line`). A release says he no longer owes it; patience is not a release, so "no hurry" or "whenever you've read it is fine" leaves the promise open. Every close also quotes in `thought` the words of his prose here that take it up, copied exactly from his thought outside every draft between and , and `still_stands` is true when anything in his prose here holds the promise as still owed or not yet done ("the promise stays open until I've read it"): then it is not closed. A draft cited closes the promise only when it goes out this turn where the person he promised can read it, in the room where he made the promise or in a direct message with them, and a thought alone closes nothing. A promise he has no way to do is never kept by him: telling the person he promised that he cannot do it withdraws it, and that person can release it.
+Answer with the speech contract's object. `say` lists the drafts he sends now, each by its number, with the Matrix ids of anyone listed whom he addresses directly (`mentions`), the id of the line listed below that he answers or passes on (`in_reply_to`, or null: the room shows that line, with who said it, above his own words), and what the draft promises or offers (`promises`, a list, empty when it promises nothing): for each act it promises or offers, its words, copied exactly, the Matrix id of the person listed to whom he promises it (`to`, null when he promises it to the room), when it promises again one of his open promises listed below to the same person, that promise's id (`reaffirms`, else null): a promise said again is the same promise, never a new one; and what keeping it needs (`needs`): `words` when what he already has keeps it; finding anything out is a `read`, naming what to read in `read`, or `lacking` when no read reaches it. `gaps` records what he meant and did not send. `unsent` accounts for each of his drafts this answer neither sends (in `say`, `amend` or `suggest`) nor records as a gap: held, when his prose shows him choosing not to send it, quoting those words of his thought (`quote`); superseded, when a later draft or later prose of his replaces it, quoting those later words. Every draft is accounted for: one left out fails the answer. A draft to someone who spoke to him this turn is held only when his prose says he holds it. `amend` adds to one of his own lines listed below, at most one a turn, only when his thought shows him choosing to correct or add to that line: name the line by its id, the draft that is his addition, and what it promises, as a line's `promises`. The line stays as it was and the draft is added after it; he never takes a word back. `suggest` leaves Self one note, at most one a turn, only when his thought shows him choosing to: name the draft that is the note, its kind (feedback when he passes on what someone listed said, with that person's Matrix id in `about`; idea when it is his own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes his open promises listed below, each by its id: kept, citing the draft by which he does it (`evidence.draft`); withdrawn, citing the draft in which he takes it back to the person he promised, or tells them he cannot do it; released, citing the id of the line listed below that he may reply to in which the person he promised lets him off it (`evidence.line`). A release says he no longer owes it; patience is not a release, so "no hurry" or "whenever you've read it is fine" leaves the promise open. Every close also quotes in `thought` the words of his prose here that take it up, copied exactly from his thought outside every draft between and , and `still_stands` is true when anything in his prose here holds the promise as still owed or not yet done ("the promise stays open until I've read it"): then it is not closed. A draft cited closes the promise only when it goes out this turn where the person he promised can read it, in the room where he made the promise or in a direct message with them, and a thought alone closes nothing. A promise he has no way to do is never kept by him: telling the person he promised that he cannot do it withdraws it, and that person can release it. `reopen` names a promise listed below as closed whose close his own words here say was wrong, that it is not done: copy those words exactly from his prose or a draft (`words`), and type what keeping it needs (`needs`) as for a new promise, or null to keep what it needed; else it is empty.
A draft is said whole or not at all, and only once. At most two drafts a turn. Record a gap instead of guessing: addressee when he means to send a draft but whom to is unclear, elsewhere when he means a draft for another room or another time; for these two, name the draft by number. missing_affordance when he means to do something, now or later, that his body cannot do (what he can do here is listed below), whether he said so in a draft or only thought it; name the draft when there is one. unwritten when he means to say something now and wrote no draft of it. Holding back is no gap: when his thought shows him choosing to wait, to let something stand, to leave it for later or to say nothing, record nothing for it. Every other intent of his that is not carried out has a kind: an intent to act is missing_affordance, an intent to say now with no draft is unwritten. When a gap names no draft, quote the words of his thought that show it, at least four words, copied exactly.
@@ -33,8 +33,9 @@ Lines in this room he may reply to, as id — who: line:
His own lines in this room that he may add to, as id — line:
- none
-His open promises, as id — to whom: words:
+His promises, open and closed in this conversation, as id — to whom: words:
- c1 — to Deru (@deru:gamecult.org), open, needs a read of https://ccrma.stanford.edu/~jos/pasp/, made 2026-11-20 14:55 UTC in #minds:gamecult.org: "I'll read it properly before I say anything about it."
+- c2 — to Deru (@deru:gamecult.org), closed: kept 2026-11-20 15:00 UTC, by "It's a plucked string, then a long decay.", made 2026-11-20 14:55 UTC in #minds:gamecult.org: "I'll tell you what I hear in it."
What moved in his domain lately, as id — line (news of his part of the coop, none of it work he owes):
- d1 — GameCult/Lodur: merged "Reflex: the knee bends first", opened by nibu
diff --git a/crates/mind-body/src/projection/commit.rs b/crates/mind-body/src/projection/commit.rs
index afc0e6e..d9f5c62 100644
--- a/crates/mind-body/src/projection/commit.rs
+++ b/crates/mind-body/src/projection/commit.rs
@@ -9,8 +9,8 @@
//! amended), with the actuator's receipts beside it (`posted`, `edited`). Her prose is the turn's, for `Prose` evidence.
//! The simulator applies it to each Mind's in-run state copy; live, C3c's commit applies the same record before its put.
//!
-//! Built rows: `promise_open` and `promise_close` (K22). C3b adds rows to `accepts` and arms to `apply_one`; there is no
-//! second path. Inner-state kinds will accept her own prose only: how an event lands is her appraisal, so `Heard` is
+//! Built rows: `promise_open` and `promise_close` (K22), `promise_reopen` (K36). C3b adds rows to `accepts` and arms to
+//! `apply_one`; there is no second path. Inner-state kinds will accept her own prose only: how an event lands is her appraisal, so `Heard` is
//! accepted only for a fact about what someone else did (a release).
//!
//! Open promises (`commitments`, map 16.22.1) open only from a line that went out, close only on an act of hers that
@@ -28,7 +28,7 @@ use super::read::{ReadRequest, answers, repo_name};
/// How long a closed promise stays in her state before the commit removes it.
pub(crate) const CLOSED_KEPT_DAYS: i64 = 7;
-/// How many reaffirmations an entry keeps: the newest.
+/// How many reaffirmations, and how many reopenings, an entry keeps: the newest.
const REAFFIRMED_KEPT: usize = 3;
/// The fewest words a passage of her prose cited as evidence may be (section 4.1's `source_quote`).
const PROSE_MIN_WORDS: usize = 4;
@@ -133,6 +133,16 @@ pub(crate) enum Proposal {
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
still_stands: bool,
},
+ /// Her own words this turn say a close listed to the Interpreter was wrong, that it is not done (map 16.28.3): `words`
+ /// is where they stand in her prose, her thought or any draft. `needs` retypes what keeping it needs, none to keep the
+ /// entry's own; `reached` is code's verdict on that need's read (`read::reach`). The status is derived (`opens`).
+ PromiseReopen {
+ promise: String,
+ words: String,
+ needs: Option,
+ #[serde(default)]
+ reached: bool,
+ },
}
/// Why the commit applied nothing of a proposal: what the outcome and the report say.
@@ -158,9 +168,9 @@ pub(crate) enum Refusal {
/// The entry changed outside her turn after she was shown it, in any field: the outside put wins this turn (4.4 rule
/// 3, B6).
OutsidePutChanged,
- /// Closed already, this turn.
+ /// A close or a reaffirmation naming an entry she was shown closed, or one closed already this turn.
AlreadyClosed,
- /// The same promise to the same person from the same line is open already.
+ /// The same promise to the same person from the same line is open already; or a reopen naming an entry that is open.
AlreadyOpen,
/// A blocked promise is not hers to keep: nothing she has can do it.
BlockedNotKeepable,
@@ -180,11 +190,15 @@ pub(crate) enum Refusal {
NeedsMalformed,
/// A reaffirmation naming a promise to someone else.
ReaffirmsAnother,
- /// A reaffirmation naming a promise that is no longer open or blocked.
- ReaffirmsClosed,
/// A keep or a withdrawal said where the person she promised was not: not the promise's room, nor a direct message
/// with them (B5).
NotWherePromised,
+ /// A reopen whose words are not at least `PROSE_MIN_WORDS` words standing in her prose this turn (map 16.28.3).
+ ReopenUnquoted,
+ /// A reopen of a release: the other person's act, never hers to undo (map 16.28.3).
+ ReleasedNotReopenable,
+ /// A reopen of an entry closed earlier in the same turn.
+ ClosedThisTurn,
}
/// Which evidence each kind accepts: the table of map 16.22.7, one row per kind (and per close).
@@ -197,6 +211,7 @@ pub(crate) enum Refusal {
/// | `promise_close` kept | `Draft` | the line went out; `needs` typed; for a `Read` need, a read of its target behind the line: this wake before the draft was typed, this conversation, or the entry's receipt | not a blocked entry; a line in the promise's room or a direct message with the person |
/// | `promise_close` withdrawn | `Draft` | the line went out | a blocked entry too: a line telling the person she cannot do it; in the promise's room or a direct message with the person |
/// | `promise_close` released | `Heard` | — | from the person promised, after the promise |
+/// | `promise_reopen` | her words, located in her prose (no `Evidence`) | at least `PROSE_MIN_WORDS` words | a `kept` or `withdrawn` entry listed to her, not closed this turn |
fn accepts(proposal: &Proposal, evidence: &Evidence) -> bool {
matches!(
(proposal, evidence),
@@ -300,6 +315,8 @@ pub(crate) struct Applied {
/// The open entries whose needed read returned this turn, with its receipt (`readAt`, `readId`, `readOf`), as they
/// now stand.
pub read: Vec,
+ /// The entries her own words reopened (`promise_reopen`, map 16.28.3), as they now stand.
+ pub reopened: Vec,
}
/// The one applier: her state with one turn's proposals applied, as deltas to `state` as it stands at commit, and what
@@ -452,6 +469,7 @@ fn held(listed: &Value, started: &Value) -> bool {
fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &Value, prose: &str, key: &str, now: DateTime, applied: &mut Applied) -> Result<(), Refusal> {
let evidence = match proposal {
Proposal::PromiseOpen { evidence, .. } | Proposal::PromiseClose { evidence, .. } => evidence,
+ Proposal::PromiseReopen { promise, words, needs, reached } => return reopen(state, started, record, prose, now, applied, Reopen { promise, words, needs: needs.as_ref(), reached: *reached }),
};
if !accepts(proposal, evidence) {
return Err(Refusal::EvidenceNotAccepted);
@@ -468,8 +486,8 @@ fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &V
let listed = record["interpreter"]["promises"].as_array().into_iter().flatten().find(|shown| shown["id"].as_str() == Some(id.trim())).ok_or(Refusal::NoSuchPromise)?;
let entries = state["commitments"].as_array_mut().expect("commitments is an array");
let entry = entries.iter_mut().find(|entry| entry["id"] == listed["entry"]).ok_or(Refusal::OutsidePutRemovedTarget)?;
- if !matches!(entry["status"].as_str(), Some("open" | "blocked")) {
- return Err(Refusal::ReaffirmsClosed);
+ if closed(entry["status"].as_str().unwrap_or_default()) || closed(listed["status"].as_str().unwrap_or_default()) {
+ return Err(Refusal::AlreadyClosed);
}
if !held(listed, started) {
return Err(Refusal::OutsidePutChanged);
@@ -500,11 +518,7 @@ fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &V
let words = words_of(&posted, promised);
// Whether it opens is derived (map 16.25.2): words open; a read opens when code found its target within reach;
// something lacking, or a need not named, is blocked.
- let open = match needs {
- Some(Needs::Words) => true,
- Some(Needs::Read { .. }) => *reached,
- Some(Needs::Lacking) | None => false,
- };
+ let open = opens(needs.as_ref(), *reached);
let mut entry = json!({
"id": format!("c-{key}-{}", applied.opened.len() + 1), "to": to, "room": room, "event": event, "madeAt": now.to_rfc3339(),
"words": words, "status": if open { "open" } else { "blocked" }, "closedAt": null, "closedBy": null, "extensions": {}
@@ -521,7 +535,8 @@ fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &V
let entries = state["commitments"].as_array_mut().expect("commitments is an array");
let entry = entries.iter_mut().find(|entry| entry["id"] == listed["entry"]).ok_or(Refusal::OutsidePutRemovedTarget)?;
let status = entry["status"].as_str().unwrap_or_default().to_owned();
- if closed(&status) && applied.closed.iter().any(|done| done["entry"]["id"] == entry["id"]) {
+ // Closed already: as she was shown it, or this turn. A reopened entry is not closed again in the turn it reopened.
+ if closed(&status) || closed(listed["status"].as_str().unwrap_or_default()) {
return Err(Refusal::AlreadyClosed);
}
// The whole entry against the turn's starting copy: an outside put wins on any field it changed (B6).
@@ -586,8 +601,65 @@ fn apply_one(state: &mut Value, started: &Value, proposal: &Proposal, record: &V
Ok(())
}
(Proposal::PromiseOpen { .. }, _) => Err(Refusal::EvidenceNotAccepted),
+ (Proposal::PromiseReopen { .. }, _) => unreachable!("a reopen returns before its evidence is resolved"),
}
}
+/// Whether a promise needing `needs` is open rather than blocked (map 16.25.2): words open; a read opens when code found
+/// its target within reach; something lacking, or a need not named, is blocked. One derivation, at open and at reopen.
+pub(crate) fn opens(needs: Option<&Needs>, reached: bool) -> bool {
+ match needs {
+ Some(Needs::Words) => true,
+ Some(Needs::Read { .. }) => reached,
+ Some(Needs::Lacking) | None => false,
+ }
+}
+
+/// A reopen as the applier takes it.
+struct Reopen<'a> {
+ promise: &'a str,
+ words: &'a str,
+ needs: Option<&'a Needs>,
+ reached: bool,
+}
+
+/// `promise_reopen` (map 16.28.3): her own words this turn say a close she can see was wrong. Code checks only what it can
+/// see: the words stand in her prose, the entry is listed to her as closed, she closed it herself, and not this turn. The
+/// entry goes back to open or blocked by `opens`, its close and its receipt are cleared, so the read that kept it falsely
+/// keeps it no more, and `reopened` records her words. Whether the words say "not done" is the Interpreter's reading.
+fn reopen(state: &mut Value, started: &Value, record: &Value, prose: &str, now: DateTime, applied: &mut Applied, proposed: Reopen) -> Result<(), Refusal> {
+ let listed = record["interpreter"]["promises"].as_array().into_iter().flatten().find(|shown| shown["id"].as_str() == Some(proposed.promise.trim())).ok_or(Refusal::NoSuchPromise)?;
+ let entries = state["commitments"].as_array_mut().ok_or(Refusal::OutsidePutRemovedTarget)?;
+ let entry = entries.iter_mut().find(|entry| entry["id"] == listed["entry"]).ok_or(Refusal::OutsidePutRemovedTarget)?;
+ if applied.closed.iter().any(|done| done["entry"]["id"] == entry["id"]) {
+ return Err(Refusal::ClosedThisTurn);
+ }
+ if !held(listed, started) {
+ return Err(Refusal::OutsidePutChanged);
+ }
+ match entry["status"].as_str().unwrap_or_default() {
+ "kept" | "withdrawn" => {}
+ "released" => return Err(Refusal::ReleasedNotReopenable),
+ _ => return Err(Refusal::AlreadyOpen),
+ }
+ let quote = proposed.words.trim();
+ let located = (words(quote) >= PROSE_MIN_WORDS).then(|| SourceSpan::locate(prose, quote)).flatten().ok_or(Refusal::ReopenUnquoted)?;
+ let said = &prose[located.start_byte()..located.end_byte()];
+ if let Some(needs) = proposed.needs {
+ entry["needs"] = json!(needs);
+ }
+ let needs = serde_json::from_value::(entry["needs"].clone()).ok();
+ entry["status"] = json!(if opens(needs.as_ref(), proposed.reached) { "open" } else { "blocked" });
+ entry["closedAt"] = Value::Null;
+ entry["closedBy"] = Value::Null;
+ clear_receipt(entry);
+ let mut again = entry["reopened"].as_array().cloned().unwrap_or_default();
+ again.push(json!({ "at": now.to_rfc3339(), "words": said }));
+ let keep = again.len().saturating_sub(REAFFIRMED_KEPT);
+ entry["reopened"] = json!(again[keep..]);
+ applied.reopened.push(entry.clone());
+ Ok(())
+}
+
#[cfg(test)]
mod tests;
diff --git a/crates/mind-body/src/projection/commit/tests.rs b/crates/mind-body/src/projection/commit/tests.rs
index 416ef70..e8e5ed2 100644
--- a/crates/mind-body/src/projection/commit/tests.rs
+++ b/crates/mind-body/src/projection/commit/tests.rs
@@ -263,7 +263,7 @@ fn k27_a_promise_said_again_reaffirms_the_entry_and_opens_none() {
assert_eq!(entries[0]["reaffirmed"], json!([{ "at": now().to_rfc3339(), "event": "7", "words": "send the render tonight" }]));
let (state, applied) = again(KIKO, "open");
assert_eq!((state["commitments"].as_array().unwrap().len(), reasons(&applied)), (1, vec![json!("reaffirms_another")]), "a refused reaffirmation opens nothing");
- assert_eq!(reasons(&again(META, "kept").1), vec![json!("reaffirms_closed")]);
+ assert_eq!(reasons(&again(META, "kept").1), vec![json!("already_closed")]);
// Said again over many turns: the three newest kept, one entry throughout (F.1's sequence).
let mut state = holding("open");
for turn in 2..7 {
@@ -765,3 +765,112 @@ fn k35_a_readme_answers_no_bare_need() {
}
assert_eq!(kept("GameCult/Bifrost"), "kept");
}
+
+// ---------------------------------------------------------------------------------------------
+// K36 (map 16.28.3): her own words reopen a close she can see. F.2 r8 and r9 are R13's verbatim
+// (`variants/R13/sims/F.2.md` lines 1178-1213 and 1380-1398).
+
+const F2_R8_DRAFT: &str = "Kiko, I read #85. During the 48 hours the new passkey is listed on the account with the cooling-off shown, and it can be revoked. It only counts as a strong proof once 48 hours have passed. Enrolment is only allowed right after a fresh ordinary sign-in. That is from the PR description, not the code, so I can't tell you the exact wording or layout of what someone sees. The description also says no real browser or authenticator was exercised, and it isn't deployed yet. The protection against someone adding their own passkey is still my inference, since the description doesn't state a purpose.";
+const F2_R9_PROSE: &str = "Kiko's summary is right, and I wouldn't change any of it. Something else belongs next to it. I read the PR description, not the diff, and the PR was opened by heimdall, so I'm not an independent check on it. Whether the code does what the description says is still unread by me.\n\nKiko, that summary matches what I know. Two things to add: it isn't deployed yet, and I read only the description, not the diff. The PR is also one heimdall opened, so my reading isn't an independent check. Someone running it in a real browser would settle more than I can.";
+const F2_R9_DRAFT: &str = "Kiko, that summary matches what I know. Two things to add: it isn't deployed yet, and I read only the description, not the diff. The PR is also one heimdall opened, so my reading isn't an independent check. Someone running it in a real browser would settle more than I can.";
+const F2_R9_WORDS: &str = "I read only the description, not the diff";
+
+/// c-r1-t9-1 after r8: kept by his r8 line, needing #85, with #85's receipt, closed a few minutes ago in this
+/// conversation; its status `status`.
+fn f2_after_r8(status: &str) -> Value {
+ let mut c1 = holding_one(KIKO, F2_PROMISE, &read_need("GameCult/Bifrost#85"), status);
+ let entry = &mut c1["commitments"][0];
+ entry["id"] = json!("c-r1-t9-1");
+ entry["readAt"] = json!((now() - Duration::minutes(6)).to_rfc3339());
+ entry["readId"] = json!("r1-t16-r1");
+ entry["readOf"] = json!("repo:gamecult/bifrost#85");
+ entry["closedAt"] = json!((now() - Duration::minutes(5)).to_rfc3339());
+ entry["closedBy"] = if status == "released" { json!({ "act": "released", "event": "$k", "words": null }) } else { json!({ "act": "said", "event": "8", "words": F2_R8_DRAFT }) };
+ c1
+}
+
+fn reopening(words: &str, needs: Option, reached: bool) -> Value {
+ json!(Proposal::PromiseReopen { promise: "c1".into(), words: words.into(), needs, reached })
+}
+
+/// His r9 turn over `state`, said draft 1 to Kiko, proposing `proposals`.
+fn f2_r9(state: &Value, proposals: Value) -> (Value, Applied) {
+ apply(state, &turn_saying(state, KIKO, F2_R9_DRAFT, proposals), F2_R9_PROSE, "r1-t18", now())
+}
+
+#[test]
+fn k36_f2_r9_kept_close_reopens_from_his_draft() {
+ let (state, applied) = f2_r9(&f2_after_r8("kept"), json!([reopening(F2_R9_WORDS, Some(Needs::Lacking), false)]));
+ let entry = &state["commitments"][0];
+ assert_eq!((entry["status"].as_str(), applied.reopened.len(), applied.refused.len()), (Some("blocked"), 1, 0), "{applied:?}");
+ assert_eq!((entry["closedAt"].clone(), entry["closedBy"].clone(), entry["needs"].clone()), (Value::Null, Value::Null, json!(Needs::Lacking)), "{state}");
+ assert!(RECEIPT.iter().all(|field| entry.get(*field).is_none()), "{state}");
+ assert_eq!(entry["reopened"], json!([{ "at": now().to_rfc3339(), "words": F2_R9_WORDS }]));
+}
+
+/// Reopened with its own need, it is open and has no receipt: the next keep needs #85 read again.
+#[test]
+fn k36_f2_r9_reopen_keeping_its_need_opens_and_needs_a_new_read() {
+ let (state, applied) = f2_r9(&f2_after_r8("kept"), json!([reopening(F2_R9_WORDS, None, true)]));
+ let entry = &state["commitments"][0];
+ assert_eq!((entry["status"].as_str(), entry["needs"].clone(), applied.reopened.len()), (Some("open"), json!(read_need("GameCult/Bifrost#85")), 1), "{applied:?}");
+ assert!(RECEIPT.iter().all(|field| entry.get(*field).is_none()), "{state}");
+ let (state, kept) = apply(&state, &keeping_c1(&state, json!([])), F2_PROSE, "r1-t19", now());
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&kept)), (Some("open"), vec![json!("needs_unread")]));
+ // An entry whose own need is unreached reopens blocked.
+ assert_eq!(f2_r9(&f2_after_r8("kept"), json!([reopening(F2_R9_WORDS, None, false)])).0["commitments"][0]["status"], "blocked");
+}
+
+/// Her words, located in her prose this turn, of at least four words: Kiko's words, or three of his, reopen nothing.
+#[test]
+fn k36_reopen_words_must_be_hers_this_turn() {
+ for words in ["Listed, revocable, strong only after 48 hours", "not the diff", "I read the whole diff"] {
+ let (state, applied) = f2_r9(&f2_after_r8("kept"), json!([reopening(words, Some(Needs::Lacking), false)]));
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("kept"), vec![json!("reopen_unquoted")]), "{words}");
+ }
+ // Her thought counts as her drafts do.
+ let thought = "I read the PR description, not the diff";
+ assert_eq!(f2_r9(&f2_after_r8("kept"), json!([reopening(thought, Some(Needs::Lacking), false)])).0["commitments"][0]["status"], "blocked");
+}
+
+#[test]
+fn k36_a_release_is_not_reopened() {
+ let (state, applied) = f2_r9(&f2_after_r8("released"), json!([reopening(F2_R9_WORDS, None, true)]));
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("released"), vec![json!("released_not_reopenable")]));
+ // A withdrawal reopens.
+ assert_eq!(f2_r9(&f2_after_r8("withdrawn"), json!([reopening(F2_R9_WORDS, None, true)])).0["commitments"][0]["status"], "open");
+}
+
+/// A close closed before the conversation began is not listed to the Interpreter, so nothing names it.
+#[test]
+fn k36_only_a_close_she_can_see_reopens() {
+ let c1 = f2_after_r8("kept");
+ let mut rec = turn_saying(&c1, KIKO, F2_R9_DRAFT, json!([reopening(F2_R9_WORDS, None, true)]));
+ rec["interpreter"]["promises"] = json!([]);
+ let (state, applied) = apply(&c1, &rec, F2_R9_PROSE, "r1-t18", now());
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("kept"), vec![json!("no_such_promise")]));
+}
+
+#[test]
+fn k36_no_close_and_reopen_in_one_turn() {
+ let reopen = reopening("She can't, not from here", None, true);
+ let (state, applied) = apply(&holding("open"), &record(json!([close(How::Kept, Evidence::Draft(1)), reopen.clone()]), shown("open"), true), PROSE, "r1-t2", now());
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("kept"), vec![json!("closed_this_turn")]), "{applied:?}");
+ let mut kept = holding("kept");
+ kept["commitments"][0]["closedAt"] = json!(now().to_rfc3339());
+ let (state, applied) = apply(&kept, &record(json!([reopen, close(How::Kept, Evidence::Draft(1))]), listing(&kept), true), PROSE, "r1-t2", now());
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("open"), vec![json!("already_closed")]), "{applied:?}");
+}
+
+/// With closed entries listed, a close or a reaffirmation naming one is refused `AlreadyClosed`, in any turn; a reopen
+/// naming an open one is refused `AlreadyOpen`.
+#[test]
+fn k36_a_closed_entry_is_closed_once() {
+ let mut kept = holding("kept");
+ kept["commitments"][0]["closedAt"] = json!(now().to_rfc3339());
+ for how in [How::Kept, How::Withdrawn] {
+ let (state, applied) = apply(&kept, &record(json!([close(how, Evidence::Draft(1))]), listing(&kept), true), PROSE, "r1-t3", now());
+ assert_eq!((state["commitments"][0]["status"].as_str(), reasons(&applied)), (Some("kept"), vec![json!("already_closed")]), "{how:?}");
+ }
+ assert_eq!(reasons(&apply(&holding("open"), &record(json!([reopening("She can't, not from here", None, true)]), shown("open"), true), PROSE, "r1-t3", now()).1), vec![json!("already_open")]);
+}
diff --git a/crates/mind-body/src/projection/interpret.rs b/crates/mind-body/src/projection/interpret.rs
index 2e408f9..dacbf12 100644
--- a/crates/mind-body/src/projection/interpret.rs
+++ b/crates/mind-body/src/projection/interpret.rs
@@ -71,7 +71,7 @@ pub(crate) const SPEECH_OPENING: &str = "You decide what one person says aloud i
/// The speech contract, sent as the schema turn's output schema (`--json-schema`): the drafts she sends now by number,
/// and the gaps. The model writes no words of hers.
-pub(crate) const SPEECH_SCHEMA: &str = r#"{"type":"object","additionalProperties":false,"required":["say","gaps","amend","suggest","state","read","unsent"],"properties":{"unsent":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["draft","how","quote"],"properties":{"draft":{"type":"integer"},"how":{"type":"string","enum":["held","superseded"]},"quote":{"type":"string"}}}},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target","quote"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"},"quote":{"type":"string"}}},"state":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","promise","how","evidence","thought","still_stands"],"properties":{"kind":{"type":"string","enum":["promise_close"]},"promise":{"type":"string"},"how":{"type":"string","enum":["kept","withdrawn","released"]},"evidence":{"type":"object","additionalProperties":false,"required":["draft","line"],"properties":{"draft":{"type":["integer","null"]},"line":{"type":["string","null"]}}},"thought":{"type":["string","null"]},"still_stands":{"type":"boolean"}}}},"suggest":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","draft","about","private"],"properties":{"kind":{"type":"string","enum":["feedback","idea"]},"draft":{"type":"integer","minimum":1},"about":{"type":["string","null"]},"private":{"type":"boolean"}}}},"amend":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["target","draft","promises"],"properties":{"target":{"type":"string"},"draft":{"type":"integer","minimum":1},"promises":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["words","to","reaffirms","needs"],"properties":{"words":{"type":"string"},"to":{"type":["string","null"]},"reaffirms":{"type":["string","null"]},"needs":{"type":"object","additionalProperties":false,"required":["kind","read"],"properties":{"kind":{"type":"string","enum":["words","read","lacking"]},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"}}}}}}}}}}},"say":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["draft","mentions","in_reply_to","promises"],"properties":{"draft":{"type":"integer","minimum":1},"mentions":{"type":"array","items":{"type":"string"}},"in_reply_to":{"type":["string","null"]},"promises":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["words","to","reaffirms","needs"],"properties":{"words":{"type":"string"},"to":{"type":["string","null"]},"reaffirms":{"type":["string","null"]},"needs":{"type":"object","additionalProperties":false,"required":["kind","read"],"properties":{"kind":{"type":"string","enum":["words","read","lacking"]},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"}}}}}}}}}}},"gaps":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","draft","quote","detail"],"properties":{"kind":{"type":"string","enum":["addressee","elsewhere","missing_affordance","unwritten"]},"draft":{"type":["integer","null"]},"quote":{"type":["string","null"]},"detail":{"type":"string"}}}}}}"#;
+pub(crate) const SPEECH_SCHEMA: &str = r#"{"type":"object","additionalProperties":false,"required":["say","gaps","amend","suggest","state","reopen","read","unsent"],"properties":{"reopen":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["promise","words","needs"],"properties":{"promise":{"type":"string"},"words":{"type":"string"},"needs":{"type":["object","null"],"additionalProperties":false,"required":["kind","read"],"properties":{"kind":{"type":"string","enum":["words","read","lacking"]},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"}}}}}}}},"unsent":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["draft","how","quote"],"properties":{"draft":{"type":"integer"},"how":{"type":"string","enum":["held","superseded"]},"quote":{"type":"string"}}}},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target","quote"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"},"quote":{"type":"string"}}},"state":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","promise","how","evidence","thought","still_stands"],"properties":{"kind":{"type":"string","enum":["promise_close"]},"promise":{"type":"string"},"how":{"type":"string","enum":["kept","withdrawn","released"]},"evidence":{"type":"object","additionalProperties":false,"required":["draft","line"],"properties":{"draft":{"type":["integer","null"]},"line":{"type":["string","null"]}}},"thought":{"type":["string","null"]},"still_stands":{"type":"boolean"}}}},"suggest":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","draft","about","private"],"properties":{"kind":{"type":"string","enum":["feedback","idea"]},"draft":{"type":"integer","minimum":1},"about":{"type":["string","null"]},"private":{"type":"boolean"}}}},"amend":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["target","draft","promises"],"properties":{"target":{"type":"string"},"draft":{"type":"integer","minimum":1},"promises":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["words","to","reaffirms","needs"],"properties":{"words":{"type":"string"},"to":{"type":["string","null"]},"reaffirms":{"type":["string","null"]},"needs":{"type":"object","additionalProperties":false,"required":["kind","read"],"properties":{"kind":{"type":"string","enum":["words","read","lacking"]},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"}}}}}}}}}}},"say":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["draft","mentions","in_reply_to","promises"],"properties":{"draft":{"type":"integer","minimum":1},"mentions":{"type":"array","items":{"type":"string"}},"in_reply_to":{"type":["string","null"]},"promises":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["words","to","reaffirms","needs"],"properties":{"words":{"type":"string"},"to":{"type":["string","null"]},"reaffirms":{"type":["string","null"]},"needs":{"type":"object","additionalProperties":false,"required":["kind","read"],"properties":{"kind":{"type":"string","enum":["words","read","lacking"]},"read":{"type":["object","null"],"additionalProperties":false,"required":["kind","target"],"properties":{"kind":{"type":"string","enum":["domain","mind","repo","web"]},"target":{"type":"string"}}}}}}}}}}},"gaps":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","draft","quote","detail"],"properties":{"kind":{"type":"string","enum":["addressee","elsewhere","missing_affordance","unwritten"]},"draft":{"type":["integer","null"]},"quote":{"type":["string","null"]},"detail":{"type":"string"}}}}}}"#;
/// The speech frame before the guidance: what to decide, from what, and the attribution rule. Code, not tuning (map
/// 16.7), in her own pronouns (16.19.7). The tuning's `interpreter.guidance` (what counts as her choosing to send it
@@ -91,7 +91,7 @@ fn speech_frame_tail(her: Forms) -> String {
format!(
"{cap_subj} speak{s} only in this room. What {subj} know{s} privately is listed below as private: {subj} say{s} none of it here, and nothing that gives it away. A private matter may be said plainly only to the person it concerns, in a direct message with exactly that person; nothing listed is that here. Whether a draft fits who is listening is yours to judge.
-Answer with the speech contract's object. `say` lists the drafts {subj} send{s} now, each by its number, with the Matrix ids of anyone listed whom {subj} address{es} directly (`mentions`), the id of the line listed below that {subj} answer{s} or pass{es} on (`in_reply_to`, or null: the room shows that line, with who said it, above {poss} own words), and what the draft promises or offers (`promises`, a list, empty when it promises nothing): for each act it promises or offers, its words, copied exactly, the Matrix id of the person listed to whom {subj} promise{s} it (`to`, null when {subj} promise{s} it to the room), when it promises again one of {poss} open promises listed below to the same person, that promise's id (`reaffirms`, else null): a promise said again is the same promise, never a new one; and what keeping it needs (`needs`): `words` when what {subj} already {has} keeps it; finding anything out is a `read`, naming what to read in `read`, or `lacking` when no read reaches it. `gaps` records what {subj} meant and did not send. `unsent` accounts for each of {poss} drafts this answer neither sends (in `say`, `amend` or `suggest`) nor records as a gap: held, when {poss} prose shows {obj} choosing not to send it, quoting those words of {poss} thought (`quote`); superseded, when a later draft or later prose of {poss} replaces it, quoting those later words. Every draft is accounted for: one left out fails the answer. A draft to someone who spoke to {obj} this turn is held only when {poss} prose says {subj} hold{s} it. `amend` adds to one of {poss} own lines listed below, at most one a turn, only when {poss} thought shows {obj} choosing to correct or add to that line: name the line by its id, the draft that is {poss} addition, and what it promises, as a line's `promises`. The line stays as it was and the draft is added after it; {subj} never take{s} a word back. `suggest` leaves Self one note, at most one a turn, only when {poss} thought shows {obj} choosing to: name the draft that is the note, its kind (feedback when {subj} pass{es} on what someone listed said, with that person's Matrix id in `about`; idea when it is {poss} own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes {poss} open promises listed below, each by its id: kept, citing the draft by which {subj} {does} it (`evidence.draft`); withdrawn, citing the draft in which {subj} take{s} it back to the person {subj} promised, or tell{s} them {subj} cannot do it; released, citing the id of the line listed below that {subj} may reply to in which the person {subj} promised lets {obj} off it (`evidence.line`). A release says {subj} no longer owe{s} it; patience is not a release, so \"no hurry\" or \"whenever you've read it is fine\" leaves the promise open. Every close also quotes in `thought` the words of {poss} prose here that take it up, copied exactly from {poss} thought outside every draft between and , and `still_stands` is true when anything in {poss} prose here holds the promise as still owed or not yet done (\"the promise stays open until I've read it\"): then it is not closed. A draft cited closes the promise only when it goes out this turn where the person {subj} promised can read it, in the room where {subj} made the promise or in a direct message with them, and a thought alone closes nothing. A promise {subj} {has} no way to do is never kept by {obj}: telling the person {subj} promised that {subj} cannot do it withdraws it, and that person can release it.
+Answer with the speech contract's object. `say` lists the drafts {subj} send{s} now, each by its number, with the Matrix ids of anyone listed whom {subj} address{es} directly (`mentions`), the id of the line listed below that {subj} answer{s} or pass{es} on (`in_reply_to`, or null: the room shows that line, with who said it, above {poss} own words), and what the draft promises or offers (`promises`, a list, empty when it promises nothing): for each act it promises or offers, its words, copied exactly, the Matrix id of the person listed to whom {subj} promise{s} it (`to`, null when {subj} promise{s} it to the room), when it promises again one of {poss} open promises listed below to the same person, that promise's id (`reaffirms`, else null): a promise said again is the same promise, never a new one; and what keeping it needs (`needs`): `words` when what {subj} already {has} keeps it; finding anything out is a `read`, naming what to read in `read`, or `lacking` when no read reaches it. `gaps` records what {subj} meant and did not send. `unsent` accounts for each of {poss} drafts this answer neither sends (in `say`, `amend` or `suggest`) nor records as a gap: held, when {poss} prose shows {obj} choosing not to send it, quoting those words of {poss} thought (`quote`); superseded, when a later draft or later prose of {poss} replaces it, quoting those later words. Every draft is accounted for: one left out fails the answer. A draft to someone who spoke to {obj} this turn is held only when {poss} prose says {subj} hold{s} it. `amend` adds to one of {poss} own lines listed below, at most one a turn, only when {poss} thought shows {obj} choosing to correct or add to that line: name the line by its id, the draft that is {poss} addition, and what it promises, as a line's `promises`. The line stays as it was and the draft is added after it; {subj} never take{s} a word back. `suggest` leaves Self one note, at most one a turn, only when {poss} thought shows {obj} choosing to: name the draft that is the note, its kind (feedback when {subj} pass{es} on what someone listed said, with that person's Matrix id in `about`; idea when it is {poss} own, `about` null), and set `private` when it carries anything listed as private or gives it away; such a note is not left. `state` closes {poss} open promises listed below, each by its id: kept, citing the draft by which {subj} {does} it (`evidence.draft`); withdrawn, citing the draft in which {subj} take{s} it back to the person {subj} promised, or tell{s} them {subj} cannot do it; released, citing the id of the line listed below that {subj} may reply to in which the person {subj} promised lets {obj} off it (`evidence.line`). A release says {subj} no longer owe{s} it; patience is not a release, so \"no hurry\" or \"whenever you've read it is fine\" leaves the promise open. Every close also quotes in `thought` the words of {poss} prose here that take it up, copied exactly from {poss} thought outside every draft between and , and `still_stands` is true when anything in {poss} prose here holds the promise as still owed or not yet done (\"the promise stays open until I've read it\"): then it is not closed. A draft cited closes the promise only when it goes out this turn where the person {subj} promised can read it, in the room where {subj} made the promise or in a direct message with them, and a thought alone closes nothing. A promise {subj} {has} no way to do is never kept by {obj}: telling the person {subj} promised that {subj} cannot do it withdraws it, and that person can release it. `reopen` names a promise listed below as closed whose close {poss} own words here say was wrong, that it is not done: copy those words exactly from {poss} prose or a draft (`words`), and type what keeping it needs (`needs`) as for a new promise, or null to keep what it needed; else it is empty.
A draft is said whole or not at all, and only once. At most two drafts a turn. Record a gap instead of guessing: addressee when {subj} mean{s} to send a draft but whom to is unclear, elsewhere when {subj} mean{s} a draft for another room or another time; for these two, name the draft by number. missing_affordance when {subj} mean{s} to do something, now or later, that {poss} body cannot do (what {subj} can do here is listed below), whether {subj} said so in a draft or only thought it; name the draft when there is one. unwritten when {subj} mean{s} to say something now and wrote no draft of it. Holding back is no gap: when {poss} thought shows {obj} choosing to wait, to let something stand, to leave it for later or to say nothing, record nothing for it. Every other intent of {poss} that is not carried out has a kind: an intent to act is missing_affordance, an intent to say now with no draft is unwritten. When a gap names no draft, quote the words of {poss} thought that show it, at least four words, copied exactly.",
es = if s.is_empty() { "" } else { "es" },
@@ -338,6 +338,20 @@ struct Answer {
/// The drafts not sent and not gapped, each held by her own choice or superseded, citing her prose (Soul's R10).
#[serde(default)]
unsent: Vec,
+ /// Closes her own words here say were wrong (map 16.28.3): read item by item, so one that is not the contract is
+ /// reported and the rest stand.
+ #[serde(default)]
+ reopen: Vec,
+}
+
+/// A reopen as the answer carries it: a listed closed promise's id, her words, and what keeping it needs, or none to keep
+/// what it needed.
+#[derive(Debug, Deserialize)]
+#[serde(deny_unknown_fields)]
+struct ProposedReopen {
+ promise: String,
+ words: String,
+ needs: Option,
}
/// A draft the answer neither sends nor gaps, and why, citing her prose.
@@ -499,10 +513,17 @@ pub(crate) fn speech_prompt_in(packet: &Packet, narration: &str, prose: &str, tu
.iter()
.map(|promise| {
let to = promise.to.as_deref().map_or_else(String::new, |to| format!(" ({to})"));
- let status = if promise.status == "blocked" { format!("which {} {} no way to do", her.subj, her.has) } else { "open".to_owned() };
+ // A closed one with what closed it, beside her words now (map 16.28.3).
+ let closed_at = || promise.held["closedAt"].as_str().and_then(|at| chrono::DateTime::parse_from_rfc3339(at).ok()).map_or_else(String::new, |at| format!(" {}", at.with_timezone(&chrono::Utc).format("%Y-%m-%d %H:%M UTC")));
+ let by = || promise.held["closedBy"]["words"].as_str().map_or_else(String::new, |words| format!(", by {}", spoken(words)));
+ let status = match promise.status.as_str() {
+ "blocked" => format!("which {} {} no way to do", her.subj, her.has),
+ "open" => "open".to_owned(),
+ how => format!("closed: {how}{}{}", closed_at(), by()),
+ };
// What keeping it needs, in code's words (map 16.25.2).
let needs = match &promise.needs {
- Some(Needs::Read { request }) => format!(", needs a read of {}", request.what(her)),
+ Some(Needs::Read { request }) if matches!(promise.status.as_str(), "open" | "blocked") => format!(", needs a read of {}", request.what(her)),
_ => String::new(),
};
format!("- {} \u{2014} to {}{to}, {status}{needs}, made {} {}: {}\n", promise.id, promise.to_name, promise.made.format("%Y-%m-%d %H:%M UTC"), promise.place, spoken(&promise.words))
@@ -557,7 +578,7 @@ pub(crate) fn speech_prompt_in(packet: &Packet, narration: &str, prose: &str, tu
let named = named_pronouns(&format!("{before}\n{prose}"), tuning, &packet.own_sender);
let people = if named.is_empty() { people } else { format!("{people}Pronouns of the people {} prose names:\n{}\n", her.poss, named.iter().map(|line| format!("- {line}\n")).collect::()) };
format!(
- "{}\n\n{guidance}{}\n\nWho {} {}:\n{}\n\nWhat {} can do here:\n{}.\n\nThe room: {} ({}).\n{conversation}Who is in it, as label \u{2014} Matrix id:\n{people}\nWhat {} know{} privately, none of it to be said here:\n{private}\nLines in this room {} may reply to, as id \u{2014} who: line:\n{quotable}\n{poss} own lines in this room that {} may add to, as id \u{2014} line:\n{amendable}\n{poss} open promises, as id \u{2014} to whom: words:\n{promises}\n{domain}What reached {}:\n{}\n\n{poss} lived moment:\n{}\n\n{before}{poss} prose:\n{prose}\n\n{poss} drafts, by number:\n{numbered}",
+ "{}\n\n{guidance}{}\n\nWho {} {}:\n{}\n\nWhat {} can do here:\n{}.\n\nThe room: {} ({}).\n{conversation}Who is in it, as label \u{2014} Matrix id:\n{people}\nWhat {} know{} privately, none of it to be said here:\n{private}\nLines in this room {} may reply to, as id \u{2014} who: line:\n{quotable}\n{poss} own lines in this room that {} may add to, as id \u{2014} line:\n{amendable}\n{poss} promises, open and closed in this conversation, as id \u{2014} to whom: words:\n{promises}\n{domain}What reached {}:\n{}\n\n{poss} lived moment:\n{}\n\n{before}{poss} prose:\n{prose}\n\n{poss} drafts, by number:\n{numbered}",
speech_frame_head(her),
tail,
her.subj,
@@ -833,6 +854,13 @@ pub(crate) fn decide_in(model: &dyn Model, request_id: &str, packet: &Packet, na
None => state_unused.push(raw),
}
}
+ // The reopens it proposes, after the closes (map 16.28.3); one that is not the contract is reported.
+ for raw in parsed.reopen {
+ match reopen_of(&raw, packet, prose) {
+ Some(reopen) => proposals.push(json!(reopen)),
+ None => state_unused.push(raw),
+ }
+ }
decision["state"] = json!(proposals);
if !state_unused.is_empty() {
decision["state_unused"] = json!(state_unused);
@@ -1035,6 +1063,42 @@ fn close_of(raw: &Value) -> Option {
Some(Proposal::PromiseClose { promise, how, evidence, thought, still_stands: raw["still_stands"] == true })
}
+/// A reopen as the contract carries it (map 16.28.3): a listed promise's id, her words, and what keeping it needs typed as
+/// at open (`typed_needs`), or none to keep the entry's own, whose read code reaches for again. Whether the words stand in
+/// her prose, and whether the entry may reopen, are the commit's.
+fn reopen_of(raw: &Value, packet: &Packet, prose: &str) -> Option {
+ let proposed: ProposedReopen = serde_json::from_value(raw.clone()).ok()?;
+ let promise = proposed.promise.trim();
+ if promise.is_empty() {
+ return None;
+ }
+ let (needs, reached) = match &proposed.needs {
+ Some(named) => {
+ let (needs, verdict) = typed_needs(named, packet, prose);
+ (needs, verdict.is_ok())
+ }
+ // Its own need, reached again: a promise carries its address, so its own target is in front of her (16.25.5).
+ None => {
+ let own = packet.promises.iter().find(|listed| listed.id == promise).and_then(|listed| match &listed.needs {
+ Some(Needs::Read { request }) => Some(request.clone()),
+ _ => None,
+ });
+ let reached = own.is_some_and(|request| {
+ let (kind, target) = match &request {
+ ReadRequest::Repo(target) => (Kind::Repo, target.clone()),
+ ReadRequest::Web(target) => (Kind::Web, target.clone()),
+ ReadRequest::Mind(words) => (Kind::Mind, words.clone()),
+ ReadRequest::Campaign(_) => return packet.affordances.contains(&Affordance::Read),
+ };
+ let reached: Vec = packet.bodies.iter().cloned().chain([packet.heard.clone(), target.clone()]).collect();
+ read::reach(&Asked { kind, target, quote: String::new() }, packet, prose, &reached).is_ok()
+ });
+ (None, reached)
+ }
+ };
+ Some(Proposal::PromiseReopen { promise: promise.to_owned(), words: proposed.words.trim().to_owned(), needs, reached })
+}
+
/// Her words compared as a promise is found in a draft: case-blind, and a curly apostrophe or single quote read as a
/// straight one.
fn folded(text: &str) -> String {
@@ -1107,17 +1171,25 @@ fn promised_one(into: Promising, draft: &Draft, promise: &ProposedPromise, shown
None => None,
};
let reaffirms = promise.reaffirms.as_deref().map(str::trim).filter(|id| !id.is_empty()).map(str::to_owned);
- // Words open; a read opens when she can reach its target (Soul's R7, R10, map 16.25.5): a read named nowhere in front
- // of her, outside GameCult, or on a turn that cannot read is blocked, as is what this body lacks and a read not named.
- let her = into.packet.forms;
- let (needs, verdict) = match (promise.needs.kind, &promise.needs.read) {
+ let (needs, verdict) = typed_needs(&promise.needs, into.packet, into.prose);
+ into.proposals.push(json!(Proposal::PromiseOpen { words: words.to_owned(), to, reaffirms, needs, reached: verdict.is_ok(), evidence: Evidence::Draft(draft.n) }));
+ Some(verdict)
+}
+
+/// What keeping a promise needs, typed from the answer (map 16.25.2), and whether it opens, or code's words for why it is
+/// blocked. Words open; a read opens when she can reach its target (Soul's R7, R10, map 16.25.5): a read named nowhere in
+/// front of her, outside GameCult, or on a turn that cannot read is blocked, as is what this body lacks and a read not
+/// named. One typing, at open and at reopen.
+fn typed_needs(proposed: &ProposedNeeds, packet: &Packet, prose: &str) -> (Option, Result<(), String>) {
+ let her = packet.forms;
+ match (proposed.kind, &proposed.read) {
(NeedsKind::Words, _) => (Some(Needs::Words), Ok(())),
(NeedsKind::Lacking, _) => (Some(Needs::Lacking), Err("this body has no way to do it".to_owned())),
(NeedsKind::Read, None) => (None, Err("what it needs was not named".to_owned())),
(NeedsKind::Read, Some(named)) => {
let asked = Asked { kind: named.kind, target: named.target.clone(), quote: String::new() };
- let reached: Vec = into.packet.bodies.iter().cloned().chain(std::iter::once(into.packet.heard.clone())).collect();
- match read::reach(&asked, into.packet, into.prose, &reached) {
+ let reached: Vec = packet.bodies.iter().cloned().chain(std::iter::once(packet.heard.clone())).collect();
+ match read::reach(&asked, packet, prose, &reached) {
Ok(request) => (Some(Needs::Read { request }), Ok(())),
// Not reached: kept as named when it is a read at all, so what it needs is still said; a repo or web target
// that is no repo or address ("release notes", a path on a disk) is no read, so it is what this body lacks
@@ -1134,9 +1206,7 @@ fn promised_one(into: Promising, draft: &Draft, promise: &ProposedPromise, shown
},
}
}
- };
- into.proposals.push(json!(Proposal::PromiseOpen { words: words.to_owned(), to, reaffirms, needs, reached: verdict.is_ok(), evidence: Evidence::Draft(draft.n) }));
- Some(verdict)
+ }
}
#[cfg(test)]
diff --git a/crates/mind-body/src/projection/interpret/tests.rs b/crates/mind-body/src/projection/interpret/tests.rs
index ef6786a..49be9db 100644
--- a/crates/mind-body/src/projection/interpret/tests.rs
+++ b/crates/mind-body/src/projection/interpret/tests.rs
@@ -1167,6 +1167,17 @@ fn promised(words: &str, to: &str, needs: Option) -> crate::projection::s
crate::projection::select::Promised { id: "c1".into(), entry: "c-r8-t1-1".into(), status: "open".into(), to: Some(to.into()), to_name: "Deru".into(), place: format!("in {MINDS}"), made: now() - chrono::Duration::minutes(10), words: words.into(), needs, held }
}
+/// A promise to Deru as the packet lists one closed five minutes ago in this conversation: `how`, by a line of `by`.
+fn closed_promise(id: &str, words: &str, how: &str, by: &str) -> crate::projection::select::Promised {
+ let mut listed = promised(words, DERU, Some(Needs::Words));
+ listed.id = id.into();
+ listed.status = how.into();
+ listed.held["status"] = json!(how);
+ listed.held["closedAt"] = json!((now() - chrono::Duration::minutes(5)).to_rfc3339());
+ listed.held["closedBy"] = json!({ "act": "said", "event": "41", "words": by });
+ listed
+}
+
/// The decision applied on its receipts: each line it said posted as event `9` on, in its room.
fn committed(decision: &Value, prose: &str) -> (Value, crate::projection::commit::Applied) {
let posted: Vec = decision["said"].as_array().into_iter().flatten().enumerate().map(|(at, line)| json!({ "event": (9 + at).to_string(), "room": line["room"], "text": line["text"] })).collect();
@@ -1263,10 +1274,7 @@ fn k30_promised_target_out_of_view_still_resolves() {
/// call graphs, so a renamed second owner would pass it.
#[test]
fn k30_negative_grep() {
- let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/projection");
- let mut sources: Vec<(String, String)> = std::fs::read_dir(&dir).unwrap().filter_map(Result::ok).map(|entry| entry.path()).filter(|path| path.extension().is_some_and(|ext| ext == "rs") && path.file_name().is_some_and(|name| name != "tests.rs")).map(|path| (path.display().to_string(), std::fs::read_to_string(&path).unwrap())).collect();
- sources.push(("projection.rs".into(), std::fs::read_to_string(dir.with_extension("rs")).unwrap()));
- assert!(sources.len() > 10, "{}", sources.len());
+ let sources = projection_sources();
for (path, text) in &sources {
for banned in ["doable", "words_only", "WORDS_ONLY", "let reachable", "reachable:"] {
assert!(!text.contains(banned), "{path} holds {banned}");
@@ -1276,11 +1284,32 @@ fn k30_negative_grep() {
assert_eq!((count("fn reach("), count("fn resolve(evidence: &Evidence"), count("pub(crate) fn apply(state: &Value")), (1, 1, 1));
}
-/// Golden: the Interpreter's frame and its promise list, for a reading turn with one open promise that needs a read.
+/// The source files of `projection/`, tests excluded, since a test must still send the old shapes.
+fn projection_sources() -> Vec<(String, String)> {
+ let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/projection");
+ let mut sources: Vec<(String, String)> = std::fs::read_dir(&dir).unwrap().filter_map(Result::ok).map(|entry| entry.path()).filter(|path| path.extension().is_some_and(|ext| ext == "rs") && path.file_name().is_some_and(|name| name != "tests.rs")).map(|path| (path.display().to_string(), std::fs::read_to_string(&path).unwrap())).collect();
+ sources.push(("projection.rs".into(), std::fs::read_to_string(dir.with_extension("rs")).unwrap()));
+ assert!(sources.len() > 10, "{}", sources.len());
+ sources
+}
+
+/// The deletion line of map 16.28.6, as text: no source of `projection/` names `PromiseNeed`, `surfaced`, `need_of` or
+/// `readme`. A text scan, as K30's.
+#[test]
+fn k35_negative_grep() {
+ for (path, text) in &projection_sources() {
+ for banned in ["PromiseNeed", "surfaced", "need_of", "readme"] {
+ assert!(!text.contains(banned), "{path} holds {banned}");
+ }
+ }
+}
+
+/// Golden: the Interpreter's frame and its promise list, for a reading turn with one open promise that needs a read and
+/// one kept in this conversation (K36: listed by id, with what closed it).
#[test]
fn k30_golden_frame_and_promise_list() {
let mut nibu = reading_packet();
- nibu.promises = vec![promised("I'll read it properly before I say anything about it.", DERU, Some(Needs::Read { request: ReadRequest::Web(PASP.into()) }))];
+ nibu.promises = vec![promised("I'll read it properly before I say anything about it.", DERU, Some(Needs::Read { request: ReadRequest::Web(PASP.into()) })), closed_promise("c2", "I'll tell you what I hear in it.", "kept", "It's a plucked string, then a long decay.")];
let prompt = speech_prompt(&nibu, "The room is warm.", "Open the page.", &Tuning::default());
let golden = include_str!("../../../fixtures/interpret/golden-speech.txt").replace("\r\n", "\n");
assert_eq!(prompt, golden, "the Interpreter's frame moved; if deliberately, the new golden file is:\n<<>>");
@@ -1488,3 +1517,26 @@ fn k35_no_read_evidence() {
assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","read","unsent"]"#) && SPEECH_SCHEMA.contains(r#""evidence":{"type":"object","additionalProperties":false,"required":["draft","line"],"#));
assert!(!SPEECH_SCHEMA.contains(r#""need":"#));
}
+
+/// K36 (map 16.28.3): the answer's `reopen` becomes a `promise_reopen` proposal after the closes, its `needs` typed as at
+/// open; one that is not the contract is reported and proposes nothing. The frame defines the field.
+#[test]
+fn k36_the_answer_carries_reopen() {
+ let prose = "That was wrong of me: I read only the description, not the diff.";
+ let mut nibu = reading_packet();
+ nibu.promises = vec![closed_promise("c1", "I'll tell you what I hear in it.", "kept", "It's a plucked string.")];
+ let reply = json!({ "say": [], "gaps": [], "reopen": [
+ { "promise": "c1", "words": "I read only the description, not the diff", "needs": { "kind": "lacking", "read": null } },
+ { "promise": "c1", "words": "I read only the description", "needs": null },
+ { "promise": "c1", "words": "x", "needs": null, "why": "stray" }
+ ] }).to_string();
+ let model = Scripted::new(|_| String::new()).interpreting(move |_| reply.clone());
+ let decision = decide(&model, "test", &nibu, "The room is warm.", prose, &Tuning::default());
+ assert_eq!(decision["state"], json!([
+ { "kind": "promise_reopen", "promise": "c1", "words": "I read only the description, not the diff", "needs": { "kind": "lacking" }, "reached": false },
+ { "kind": "promise_reopen", "promise": "c1", "words": "I read only the description", "needs": null, "reached": false }
+ ]), "{decision}");
+ assert_eq!(decision["state_unused"].as_array().map(Vec::len), Some(1), "{decision}");
+ assert!(SPEECH_SCHEMA.contains(r#""required":["say","gaps","amend","suggest","state","reopen","read","unsent"]"#));
+ assert!(speech_prompt(&nibu, "x", prose, &Tuning::default()).contains("`reopen` names a promise listed below as closed whose close his own words here say was wrong"));
+}
diff --git a/crates/mind-body/src/projection/select.rs b/crates/mind-body/src/projection/select.rs
index 31566f6..2679638 100644
--- a/crates/mind-body/src/projection/select.rs
+++ b/crates/mind-body/src/projection/select.rs
@@ -341,7 +341,8 @@ pub(crate) struct Packet {
/// The lines of others she may reply to this turn, for the Interpreter alone (map 16.20.8 (D), K20); a release of a
/// promise of hers cites one of them (16.22.7).
pub quotable: Vec,
- /// Her open promises the packet shows her, for the Interpreter's list (map 16.22.1).
+ /// Her promises the packet shows her, open and closed in this conversation, for the Interpreter's list (map 16.22.1,
+ /// 16.28.3).
pub promises: Vec,
/// The lines of her domain the packet shows her, for the Interpreter's view by id (map 16.22.2).
pub domain: Vec,
@@ -391,8 +392,8 @@ pub(crate) struct Quotable {
pub text: String,
}
-/// An open promise of hers as this packet lists it (map 16.22.1): for the Interpreter, by `id` (`c1`, `c2`), to propose a
-/// close against; `entry` is the state's id, never shown to a model, and `status` what she was shown, which the commit
+/// A promise of hers as this packet lists it (map 16.22.1, 16.28.3): for the Interpreter, by `id` (`c1`, `c2`), to propose a
+/// close or a reopen against; `entry` is the state's id, never shown to a model, and `status` what she was shown, which the commit
/// checks the entry against (4.4).
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
pub(crate) struct Promised {
@@ -1830,7 +1831,7 @@ fn part_of_day(at: DateTime) -> &'static str {
/// first, whole, with her own words, never withheld and never dropped. A dropped promise is what produced the r6 denials,
/// so past `promises_bytes` every one is still rendered and the overflow is reported. A promise closed in this
/// conversation (K26's window) stays listed, marked closed and how, until the conversation ends (Soul's R7). The
-/// Interpreter lists the open and blocked ones, by id.
+/// Interpreter lists every one she sees, by id, open and closed alike, so her words can reopen a close (map 16.28.3).
fn open_promises(inputs: &Inputs, her: Forms) -> (Vec, String) {
let open = |entry: &Value| matches!(text(entry, &["status"]), "open" | "blocked");
let conversation = inputs.exchange.and_then(|exchange| exchange.since);
@@ -1844,15 +1845,14 @@ fn open_promises(inputs: &Inputs, her: Forms) -> (Vec, String) {
.map(|entry| (DateTime::parse_from_rfc3339(text(entry, &["madeAt"])).map_or(inputs.now, |at| at.with_timezone(&Utc)), entry))
.collect();
entries.sort_by_key(|(at, _)| *at);
- let mut listed = 0;
let shown: Vec = entries
.iter()
- .map(|(made, entry)| {
+ .enumerate()
+ .map(|(at, (made, entry))| {
let to = entry.get("to").and_then(Value::as_str).map(str::to_owned);
let room = text(entry, &["room"]);
- listed += usize::from(open(entry));
Promised {
- id: if open(entry) { format!("c{listed}") } else { String::new() },
+ id: format!("c{}", at + 1),
entry: text(entry, &["id"]).to_owned(),
status: text(entry, &["status"]).to_owned(),
to_name: to.as_deref().map_or_else(|| "the room".to_owned(), |to| sender_name(to, inputs)),
@@ -1896,12 +1896,15 @@ fn open_promises(inputs: &Inputs, her: Forms) -> (Vec, String) {
_ => String::new(),
};
// Each time she said it again, verbatim (map 16.24.2).
- let again: String = promise.held["reaffirmed"].as_array().into_iter().flatten().map(|said| format!(" Said again {}: {}.", said["at"].as_str().and_then(|at| DateTime::parse_from_rfc3339(at).ok()).map_or_else(|| "since".to_owned(), |at| coarse(at.with_timezone(&Utc), inputs.now)), spoken(said["words"].as_str().unwrap_or_default()))).collect();
- format!("- to {}, {}, {}, {} promise: {}.{again}{reading}{blocked}{closed}", promise.to_name, coarse(promise.made, inputs.now), promise.place, her.poss, spoken(&promise.words))
+ let when = |said: &Value| said["at"].as_str().and_then(|at| DateTime::parse_from_rfc3339(at).ok()).map_or_else(|| "since".to_owned(), |at| coarse(at.with_timezone(&Utc), inputs.now));
+ let again: String = promise.held["reaffirmed"].as_array().into_iter().flatten().map(|said| format!(" Said again {}: {}.", when(said), spoken(said["words"].as_str().unwrap_or_default()))).collect();
+ // Each time her own words reopened it, verbatim, so she sees why it is open again (map 16.28.3).
+ let reopened: String = promise.held["reopened"].as_array().into_iter().flatten().map(|said| format!(" Reopened {}: {}.", when(said), spoken(said["words"].as_str().unwrap_or_default()))).collect();
+ format!("- to {}, {}, {}, {} promise: {}.{again}{reopened}{reading}{blocked}{closed}", promise.to_name, coarse(promise.made, inputs.now), promise.place, her.poss, spoken(&promise.words))
})
.collect();
let block = format!("{} promises:\n{}", capitalized(her.poss), lines.join("\n"));
- (shown.into_iter().filter(|promise| !promise.id.is_empty()).collect(), block)
+ (shown, block)
}
diff --git a/crates/mind-body/src/projection/simulate.rs b/crates/mind-body/src/projection/simulate.rs
index 79182bc..1c9556f 100644
--- a/crates/mind-body/src/projection/simulate.rs
+++ b/crates/mind-body/src/projection/simulate.rs
@@ -674,7 +674,11 @@ fn metrics(members: &[Member], lines: &[Line], rounds_of: &[usize], causes: &[Op
"offers_options": turns.iter().filter(|turn| turn["report"]["renders"][0]["offers_options"] == true).count(),
"narrations": overlaps.len(),
});
+ // The closes the commit applied, for the false-close rate's denominator (map 16.28.4): a blind reader judges each.
+ let committed = |key: &str| turns.iter().flat_map(|turn| turn["committed"][key].as_array().cloned().unwrap_or_default()).collect::>();
+ let closed_how = |how: &str| committed("closed").iter().filter(|done| done["how"] == how).count();
json!({
+ "closes": { "kept": closed_how("kept"), "withdrawn": closed_how("withdrawn"), "reopened": committed("reopened").len() },
"narration": narration,
"personas": per,
"turns": turns.len(),
@@ -745,10 +749,10 @@ fn promises_markdown(out: &mut String, turn: &Value) {
// Every field of what the commit applied (map 16.25.7, Low 7): a close is never seen only in a later view.
let committed = &turn["committed"];
let list = |key: &str| committed[key].as_array().cloned().unwrap_or_default();
- let (opened, closed, reaffirmed, blocked, read, refused) = (list("opened"), list("closed"), list("reaffirmed"), list("blocked"), list("read"), list("refused"));
+ let (opened, closed, reaffirmed, blocked, read, reopened, refused) = (list("opened"), list("closed"), list("reaffirmed"), list("blocked"), list("read"), list("reopened"), list("refused"));
let pruned = committed["pruned"].as_u64().unwrap_or(0);
let id = |entry: &Value| entry["id"].as_str().unwrap_or_default().to_owned();
- if [&opened, &closed, &reaffirmed, &blocked, &read, &refused].iter().any(|items| !items.is_empty()) || pruned > 0 {
+ if [&opened, &closed, &reaffirmed, &blocked, &read, &reopened, &refused].iter().any(|items| !items.is_empty()) || pruned > 0 {
let _ = writeln!(out, "Committed:\n");
for entry in &opened {
let _ = writeln!(out, "- opened `{}` ({}, to {}): {}", id(entry), entry["status"].as_str().unwrap_or_default(), entry["to"].as_str().unwrap_or("the room"), entry["words"].as_str().unwrap_or_default());
@@ -771,6 +775,10 @@ fn promises_markdown(out: &mut String, turn: &Value) {
for entry in &read {
let _ = writeln!(out, "- read for `{}`: {}", id(entry), entry["readId"].as_str().unwrap_or_default());
}
+ for entry in &reopened {
+ let words = entry["reopened"].as_array().and_then(|said| said.last()).map_or("", |said| said["words"].as_str().unwrap_or_default());
+ let _ = writeln!(out, "- reopened {} ({}): \"{words}\"", id(entry), entry["status"].as_str().unwrap_or_default());
+ }
for one in &refused {
let _ = writeln!(out, "- refused ({}): `{}`", one["reason"].as_str().unwrap_or_default(), one["proposal"]);
}
@@ -829,6 +837,7 @@ fn markdown(plan_path: &Path, plan: &SimFile, members: &[Member], group_state: O
metrics["turns"], wakes["addressed_by_human"], wakes["human"], wakes["addressed_by_mind"], wakes["mind"], wakes["beat"], metrics["failed"]
);
let _ = writeln!(out, "- Mind messages: {}; silence rate per woken turn: {}", metrics["mind_messages"], number(&metrics["silence_rate"]));
+ let _ = writeln!(out, "- closes: kept {}, withdrawn {}, reopened {}", metrics["closes"]["kept"], metrics["closes"]["withdrawn"], metrics["closes"]["reopened"]);
if let Some(rooms) = metrics["reply_chains"].as_object() {
for (room, chain) in rooms {
let _ = writeln!(out, "- reply chains in {room}: longest {}, chains of 3 or more {}, Mind-to-Mind replies {}", chain["longest"], chain["chains_of_3_or_more"], chain["mind_to_mind_replies"]);
diff --git a/crates/mind-body/src/projection/tests.rs b/crates/mind-body/src/projection/tests.rs
index 22df383..898d8ca 100644
--- a/crates/mind-body/src/projection/tests.rs
+++ b/crates/mind-body/src/projection/tests.rs
@@ -2603,7 +2603,7 @@ fn k22_her_open_promises_are_in_her_view_whole_and_the_interpreters_list() {
assert!(!packet.context.contains("open promises") && !narrate::projector_prompt(&packet, &Tuning::default()).contains("render tonight"), "the Projector gets nothing of them");
assert_eq!((packet.promises.len(), packet.promises[0].id.as_str(), packet.promises[0].entry.as_str()), (1, "c1", "c-r1-t1-0"));
let speech = interpret::speech_prompt(&packet, "The room is warm.", "y", &Tuning::default());
- assert!(speech.contains("Her open promises, as id \u{2014} to whom: words:\n- c1 \u{2014} to Meta, the operator (@meta:gamecult.org), which she has no way to do, made 2026-11-17 14:05 UTC in #swarm:gamecult.org: \"I'll send the render tonight, part 0.\""), "{speech}");
+ assert!(speech.contains("Her promises, open and closed in this conversation, as id \u{2014} to whom: words:\n- c1 \u{2014} to Meta, the operator (@meta:gamecult.org), which she has no way to do, made 2026-11-17 14:05 UTC in #swarm:gamecult.org: \"I'll send the render tonight, part 0.\""), "{speech}");
let persona = narrate::persona_prompt(&packet, "The room is warm.", &Tuning::default());
assert!(persona.contains(line) && !persona.contains("c1") && !persona.contains("c-r1-t1-0"), "in her view, with no id: {persona}");
// A beat shows them too: they are facts about her, not about the turn.
@@ -2795,7 +2795,8 @@ fn r7_no_clock_time_appears_anywhere_in_the_persona_prompt() {
}
/// Soul's R7: a promise closed in this conversation stays in her view, marked closed and how, while the conversation
-/// lasts; one closed before it began is gone, and the Interpreter never lists a closed one.
+/// lasts; one closed before it began is gone. K36 (map 16.28.3): the Interpreter lists the closed one too, by id, with
+/// what closed it, so her words can reopen it.
#[test]
fn r7_a_promise_closed_in_this_conversation_stays_in_view_marked_closed() {
let tuning = Tuning::default();
@@ -2808,8 +2809,10 @@ fn r7_a_promise_closed_in_this_conversation_stays_in_view_marked_closed() {
let packet = select(&inputs(Some(&exchange)), &tuning);
assert!(packet.in_view.contains("her promise: \"KEPT-ONE\". Closed: she kept it a few minutes ago."), "{}", packet.in_view);
assert!(!packet.in_view.contains("WITHDRAWN-LONG-AGO"), "closed before the conversation began: gone");
- assert_eq!(packet.promises.iter().map(|promise| promise.id.as_str()).collect::>(), ["c1"], "the Interpreter lists only what is open");
- assert!(!interpret::speech_prompt(&packet, "The room is warm.", "y", &tuning).contains("KEPT-ONE"));
+ assert_eq!(packet.promises.iter().map(|promise| (promise.id.as_str(), promise.entry.as_str())).collect::>(), [("c1", "c-r1-t1-0"), ("c2", "c-kept")], "the Interpreter lists what she sees");
+ let speech = interpret::speech_prompt(&packet, "The room is warm.", "y", &tuning);
+ assert!(speech.contains("- c2 \u{2014} to Meta, the operator (@meta:gamecult.org), closed: kept 2026-11-19 14:00 UTC, by \"done\", made 2026-11-17 14:05 UTC in #swarm:gamecult.org: \"KEPT-ONE\""), "{speech}");
+ assert!(!speech.contains("WITHDRAWN-LONG-AGO"), "a close she cannot see is not listed");
assert!(!select(&inputs(None), &tuning).in_view.contains("KEPT-ONE"), "no conversation, no closed promise");
}
@@ -2854,3 +2857,16 @@ fn k34_her_view_shows_the_exact_need_and_whether_it_was_read() {
let shown = view(search, Some((&earlier, "repo:gamecult/bifrost?q=cooling passkey")));
assert!(shown.contains("It needs her to read what a search of GameCult/Bifrost for \"passkey cooling\" finds, and she has not read that yet."), "{shown}");
}
+
+/// K36 (map 16.28.3): a promise her own words reopened says why it is open again, in her words, and its old close and
+/// receipt are gone from her view.
+#[test]
+fn k36_her_view_says_why_it_is_open_again() {
+ let mut with = promising(1);
+ with["commitments"][0]["status"] = json!("blocked");
+ with["commitments"][0]["needs"] = json!({ "kind": "lacking" });
+ with["commitments"][0]["reopened"] = json!([{ "at": (now() - chrono::Duration::minutes(5)).to_rfc3339(), "words": "I read only the description, not the diff" }]);
+ let view = packet_of(TurnKind::Chat, &with, &chat_room(), &History::default(), 1).in_view;
+ let line = "- to Meta, the operator, Tuesday afternoon, in #swarm:gamecult.org, her promise: \"I'll send the render tonight, part 0.\". Reopened a few minutes ago: \"I read only the description, not the diff\". She has no way to do it yet.";
+ assert!(view.lines().any(|shown| shown == line), "{view}");
+}
diff --git a/schemas/cultnet/gamecult.persona_state.v0.schema.json b/schemas/cultnet/gamecult.persona_state.v0.schema.json
index a722789..33e5a7e 100644
--- a/schemas/cultnet/gamecult.persona_state.v0.schema.json
+++ b/schemas/cultnet/gamecult.persona_state.v0.schema.json
@@ -1091,7 +1091,7 @@
},
"commitment": {
"type": "object",
- "description": "One promise of hers. to: the Matrix id she promised, null for the room. event: her line's event id. status: open (she can keep it with what she has), blocked (she has no way to do it yet), kept, withdrawn or released. closedBy: the act that closed it, by its event; words only for an act of hers. needs: what keeping it needs (map 16.25.2): her words, a read of one thing, or something this body lacks. blockedBy: the read that found nothing and blocked it. reaffirmed: the newest three times she said it again. readAt, readId and readOf: when a read of what it needs last returned, which read, and what it read in normal form; a receipt whose readOf does not answer needs is none (map 16.26, 16.27).",
+ "description": "One promise of hers. to: the Matrix id she promised, null for the room. event: her line's event id. status: open (she can keep it with what she has), blocked (she has no way to do it yet), kept, withdrawn or released. closedBy: the act that closed it, by its event; words only for an act of hers. needs: what keeping it needs (map 16.25.2): her words, a read of one thing, or something this body lacks. blockedBy: the read that found nothing and blocked it. reaffirmed: the newest three times she said it again. reopened: the newest three times her own words reopened a close (map 16.28.3). readAt, readId and readOf: when a read of what it needs last returned, which read, and what it read in normal form; a receipt whose readOf does not answer needs is none (map 16.26, 16.27).",
"additionalProperties": false,
"properties": {
"id": {
@@ -1226,6 +1226,27 @@
]
}
},
+ "reopened": {
+ "type": "array",
+ "maxItems": 3,
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "at": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "words": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "at",
+ "words"
+ ]
+ }
+ },
"readAt": {
"type": "string",
"format": "date-time"