Skip to content

feat(memory): add Dreaming in propose mode, an approval list nothing applies - #35789

Merged
bolichen97 merged 1 commit into
mainfrom
feat/memory-dream-propose
Nov 13, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/memory-dream-propose

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Ship the memory RFC's stage R6 (Maintain: Dreaming) in propose mode only, behind memory.dream, default off: an idle-time pass that writes an approval list and never changes a memory row.

Admit, Identify and Select slow the rule pool's growth and order what is shown, but none of them shrinks it. The measured rule pools are 172,873 and 162,683 characters against a 37,000 cap. RFC section 7 makes Maintain (Dreaming) the only stage that may change existing rows, and says it ships last, in propose mode only.

Why it matters

R6 is not signed, and it is the higher-risk stage: the only one that would change stored rows and the only one where a model proposes edits. Its pass metric (RFC 7.9) needs approval lists, logged refusals and decline/open rates before anyone can decide to apply anything. Without a propose-only pass that produces them, that decision has no data. With the flag off this PR changes nothing.

Not a goal

  • Signing R6, or turning it on by default.
  • Applying any proposal: no apply mode, no propose_conflict review items, no Memory page filter or notification, no wake check (RFC 7.7, 7.8). Those come with the stage that applies.
  • Transcript evidence (RFC 7.5.1): confirm, flag, correct and supersede from session excerpts. It is a follow-up.
  • The render fold (R4) or any Admit or Select stage.
  • Changing who counts as idle for updates or restarts.

What changed (motivation → approach → change)

R6 ships propose-only and off by default, so its sign-off can read real approval lists.

  • New setting memory.dream: off (default) or propose. Unknown values read as off. Under off the gateway's repair loop reads the flag and nothing else.
  • Trigger (RFC 7.3): a day since the store's last completed run and 20 new lessons or 5 new sessions; one automatic run a day per store; no person's chat turn running or message queued; a host lock file under the data home. kirocrew memory dream run asks for a run now; the gateway still takes the lock and waits for idle.
  • Scope (7.4): up to 200 rows past a watermark, in batches of 50, 10 minutes at most; a starting chat stops it at the next batch. The backlog resumes from the same watermark night by night. Rows without vectors are counted and left to the existing backfill sweep.
  • Candidates by code (7.5): exact copy and near-duplicate through the shared leader_fold; the 0.90-0.95 band; work-state project.* keys; numbered key families; legacy rule-tier L3 lessons proposed on_topic. User-taught (L1) and user-quoted (L2) rows are leaders that are never folded or sent to the model. A copy with a NOT-clause its partner lacks is not proposed; an uncertain pair with no merge is still judged on its tier.
  • Model (7.5, 7.6): only the uncertain band reaches the consolidation model, quoted as data, under 20,000 input tokens a run, each call bounded by the run's time left. A private store's text goes through that store's own consolidation session, as its history consolidation does. A pure code gate re-checks every proposal against the store as it is now and refuses, with a logged reason: unread or no longer live ids, a change to an L1/L2 row, a merged sentence with a new content word, a row already in another proposal, a citation outside the model's pair.
  • Output (7.7): the approval list, run receipts and day counters live in the store's memory_meta only, ids and counts plus a proposed merged sentence, under the kind-routing caps. Nothing is applied. kirocrew memory dream list prints it read-only.
  • RFC section 6 records R6's rules as built and what waits for apply. Spec, CLI spec, config docs and baseline updated.

Where: src/kiro_crew/memory_dream.py (the pass); src/kiro_crew/slack/gateway_runtime/memory_lifecycle.py (repair-loop hook); src/kiro_crew/cli_commands_memory.py, src/kiro_crew/cli_parser_agent.py (memory dream run|list), src/kiro_crew/cli_commands.py (facade forward); src/kiro_crew/config/memory_sections.py, src/kiro_crew/config/section_builders.py, config-baseline.json; docs/request-for-change/rfc-memory-injection.md; docs/system-specs/modules/cli.md, docs/system-specs/modules/config.md, docs/system-specs/modules/memory-skills-hooks.md; src/kiro_crew/docs/configuration.md, src/kiro_crew/docs/memory-and-learning.md.

R6 is not signed in the RFC (section 6, "Signed scope": only R1 is signed). This PR ships it off, propose-only, so its sign-off can read the lists it produces.

Modes

memory.dream has one mode per row. This PR ships off and propose only. The other two are follow-up PRs and are not in this one; until they land, any other value reads as off.

Mode Ships in What it does
off (default) this PR Schedules and reads nothing.
propose this PR Finds candidates and writes only memory_dream:* keys in memory_meta. Never changes a memory row.
shadow_apply follow-up PR Applies the approval list to a sqlite backup copy of the store through the real edit/forget paths, then runs the wake check on that copy: replays up to 20 recent real startup queries from injection receipts, renders the rule block and runs recall on both the real store and the copy, and fails if any L1/L2 rule leaves the block or a recall hit is lost without its merged leader. Records counts and ids only; never touches the real store.
apply follow-up PR Allowed only after 7 consecutive shadow_apply passes and a person approving the batch. Runs the same wake check on the real store and reverts from revisions on failure.

Moving between modes: kirocrew config set memory.dream <mode>. Back to off at any time: kirocrew config set memory.dream off. No restart: the gateway's memory repair loop reads the flag live. propose leaves only its memory_dream:* keys behind, so going back to off leaves every memory row as it was.

Local comparison

  • Turn it on: kirocrew config set memory.dream propose (back with kirocrew config set memory.dream off). No restart: the gateway's memory repair loop reads it live.
  • Trigger a run now: kirocrew memory dream run. It leaves ~/.kiro/crew/memory-dream.request; the gateway's next memory visit (within a minute) runs every open store once, under ~/.kiro/crew/memory-dream.lock, only while no chat turn is running.
  • Where the list lands: each store's own memory_meta table, keys memory_dream:proposals, memory_dream:runs, memory_dream:state and memory_dream:counts:<day>. The default store is ~/.kiro/crew/memory.db; a private store is ~/.kiro/crew/memory_stores/<store>/memory.db. No other row changes.
  • Print it, read-only: kirocrew memory dream list (add --store <name> or --json), or
python3 -c "import sqlite3,sys;[print(k,v) for k,v in sqlite3.connect('file:'+sys.argv[1]+'?mode=ro',uri=True).execute(\"SELECT key,value FROM memory_meta WHERE key GLOB 'memory_dream:*' ORDER BY key\")]" ~/.kiro/crew/memory.db

Backwards compatibility

Compatible: the setting defaults to off, which reads nothing but the flag; the repair loop, consolidation and every write are unchanged. kirocrew memory dream is a new verb.

Removes nothing: propose writes only new memory_dream: keys in memory_meta; no memory row, revision or record metadata is written, retired or re-tiered.

Tests

test/test_memory_dream.py (48 tests):

  • setting: default off, unknown values (including apply) read off;
  • off: a visit reads nothing (the data home and store listing raise if touched) and schedules nothing;
  • trigger: 20 new lessons, 5 sessions, 24 hours after a completed run, once a day; an automatic run marks the day;
  • lock and idle: the host lock admits one holder; a running dashboard turn, a channel turn or a failed probe is busy, a cron or subagent turn is not; a manual request waits for idle and is used up by the run; a held lock or a write switch off starts no run;
  • scope: a chat turn stops the run at the next batch, or before the next model call, and the next run resumes from the watermark; the 200-row cap and backlog resume; the 10-minute cap, which also bounds each model call; a missing vector is counted; a manual request waits when no store is open; a failing store does not stop the others;
  • candidates: exact copy, near-duplicate, a copy with its own NOT-clause left out, uncertain band (only it reaches the model), a declining model, no model, the token cap, work state, numbered families, legacy tier;
  • protected rows: L1 and L2 rows are never in a proposal's changes and never reach the model;
  • model routing: a private store calls the model with its own memory_store, the default store without, and an unreadable store kind skips the model;
  • gate: each refusal reason; a merge with a new content word and a row deleted before the record are refused and counted;
  • list: an open proposal is not proposed again; receipts and counters hold ids and counts only; the run log is capped; the list reads through a read-only connection;
  • propose never writes a memory row: every row table (semantic, episodic, events, revisions, record metadata) is dumped before and after a run that produces all five kinds, and matches.

Determinism: rows get strictly increasing stamps and runs take a fixed clock, so no assertion rests on the wall clock. 10 serial runs, a shuffled order, and -n 4 beside test_memory_lesson_dedup.py, all green.

Manual verification

N/A — unit coverage sufficient: the flag defaults to off, and a run is started per install after merge with the commands above.

Related Issues

Part of #34242

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 12, 2026 08:37
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision c96f91c46d3b3b60b43f8658b197a67f5876543b touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c96f91c46d3b3b60b43f8658b197a67f5876543b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the flag is opt-in and defaults to off, propose writes only memory_dream:* keys in memory_meta, and no reader outside the patch loses anything.

Notes

  • gateway_visit is awaited inside _repair_member_memory itself, so under propose a run of up to 600 s plus model calls holds back the embedding backfill for that time. That costs time but is reversible. It also contradicts the spec's "off the loop" wording: either start the run as its own task or correct the wording.
  • The spec and the description disagree about background turns. The spec says "a background turn (cron, subagent, task runner, workflow or worker chat) also counts as busy". The test list says "a cron or subagent turn is not" busy. Pick one, because this decides whether a host running cron jobs every few minutes ever dreams at all.
  • _consolidation_merge calls the private HistoryConsolidator._call_llm through getattr. Before apply ships, give the consolidator a public one-turn method, so a rename does not silently turn the model step into None.

[DESIGN-REVIEWED] c96f91c

Description read

[DESCRIPTION-READ] f70c3759eabde6a975037b75f646645187bbca6460dbeba515ee11d18767c300

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c96f91c46d3b3b60b43f8658b197a67f5876543b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

One premise to recheck: a key-word work-state classifier that memory_kind_routing.py already measured as unreliable. Nothing blocks, because this ships with the flag off and only proposes.

Notes

  • Item 5 — inherited: is_work_state_key matches _STATE_WORDS in project.* keys. The base docstring of memory_kind_routing.py:12-14 says "The class comes from the model, not from a key or value pattern: on a hand-graded sample a key-or-value regex that caught most work state also flagged about half of the durable facts." The only support is the draft RFC's own row, "key and value patterns". In propose mode this fills the approval list with false work_state entries, which skews the decline rate that 7.9 is meant to measure. Subtraction: delete KIND_STATE, _STATE_WORDS, _STATE_PAIRS, is_work_state_key and its loop in find_candidates, and leave work state to the kind tags that kind routing already records.

What this change ships

Inventory (10 items) — 9 justified

Intent: let an operator collect a nightly list of proposed memory cleanups (duplicates, stale rows) without anything being changed, so a later apply decision has data. This is an ADDITION.

  1. New memory.dream setting, off by default or propose — justified
  2. When on, the gateway's memory loop runs a daily, idle-only, locked, bounded pass per open store — justified
  3. An approval list, run receipts and day counters appear in each store's memory_meta — justified
  4. Exact and near-duplicate lessons are proposed for folding, reusing leader_fold and adds_clause — justified
  5. project.* keys holding words like PR, branch or status are proposed as work state — inherited
  6. Numbered key families are grouped, and legacy rule-tier lessons are proposed as on_topic — justified
  7. Uncertain 0.90–0.95 pairs go to the consolidation model, capped at 20k tokens, private stores through their own session — justified
  8. A code gate refuses unsafe proposals and logs a reason — justified
  9. kirocrew memory dream run leaves a request file that the gateway honours when idle — justified
  10. kirocrew memory dream list prints the list, read-only — justified

[FIRST-PRINCIPLES-REVIEWED] c96f91c

Description read

[DESCRIPTION-READ] 2dd032c6f55f437dccf95384798e3d6fcc1f35034e6ccd78c83893899b977d7b

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed c96f91c46d3b3b60b43f8658b197a67f5876543b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c96f91c

Verdict parsed from the review's SHA-scoped output markers for commit c96f91c46d3b3b60b43f8658b197a67f5876543b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable c96f91c46d3b3b60b43f8658b197a67f5876543b false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of c96f91c46d3b3b60b43f8658b197a67f5876543b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c96f91c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c96f91c46d3b3b60b43f8658b197a67f5876543b false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 9648450 to 349fe90 Compare November 12, 2026 09:03
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=f65c6def4372 Dreaming backlog tail, manual request across stores, missing-vector rows passed by the watermark

Rebutted: all three only delay or drop a proposal on an advisory approval list that nothing applies; no memory row, revision or metadata is written (memory_dream.py module docstring; test_propose_never_writes_a_memory_row).
Backlog tail: under 20 rows left clears after 5 sessions or one kirocrew memory dream run, which skips gates 1-2; a separate backlog state is a new mechanism for one rare path.
Request across stores: the interrupted run is recorded stopped=chat in the receipt and the request is a free marker; re-running costs nothing.
Missing vectors: such rows are still compared by text and counted (missing_vectors); any later update brings them back past the watermark. A re-check set tied to the backfill sweep is new cross-module state, out of proportion for this propose-only stage. The Opus adjudication downgraded all three on the same grounds.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 28% chance that this change introduces a defect, above the 12% limit for approving on its own.

Approving. The flag defaults to off, and propose writes only memory_dream:* keys in memory_meta, in one BEGIN IMMEDIATE transaction. A pure gate re-reads each cited row while that transaction is open. Taught and quoted (L1/L2) rows are never folded and never reach the model. The model call is tool-free, quotes the rules as data, and a merged sentence that adds new content words is refused. Going back to off, cancellation, interrupted runs, manual requests and per-store failures are all handled. CLI list opens the file read-only and sanitises its output. Config, parser, baseline and docs are complete. The earlier blocking finding (spec vs code on which turns count as busy) is fixed at this head: the spec now matches the code. Every CI check, including the tests, was still pending, so no test results were seen. Remaining concerns are design trade-offs, recorded below as non-blocking notes.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit c96f91c46d · 2038 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch 2 times, most recently from 1aa7bcc to 55e9aaa Compare November 12, 2026 09:38
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=e1dcfc3e3fb6 An unmerged uncertain pair lost its legacy_tier proposals

fixed in 55e9aaa: when an uncertain pair yields no merge (model declined, failed, budget-skipped or no model wired), run_store now proposes legacy_tier for each rule-tier row of the pair (_tier_proposals), so the watermark no longer passes them without a tier verdict. Test: test_an_unmerged_rule_tier_pair_is_still_proposed_on_topic (declined and no-model cases).

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 55e9aaa to 80d3431 Compare November 12, 2026 10:16
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=f65c6def4372 NOT-clauses in duplicate proposals; lock release on the event loop

fixed in 80d3431: find_candidates reuses memory_lesson_dedup.adds_clause, so a folded copy carrying a NOT-clause its leader lacks is left out of exact/near proposals, and an uncertain pair where either row adds a clause is not sent to the model (tests: test_a_copy_with_its_own_not_clause_is_not_proposed, test_an_uncertain_pair_with_a_distinct_not_clause_skips_the_model). HostLock.release now runs on the executor under asyncio.shield, so no flock/close runs on the loop and a cancelled visit still frees the lock.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=e1dcfc3e3fb6 One failing store stopped the whole Dreaming visit

fixed in 80d3431: gateway_visit wraps each store's due check, store-kind read and run_store in try/except, logs the store name and moves on; the manual request is consumed once every open store was tried without a chat interrupting, and kept when none is open. Test: test_a_failing_store_does_not_stop_the_others.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 12, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I read the whole product diff on this head. The scope matches the signed Dreaming review-surface RFC (#35288): memory.dream defaults to off, unknown values read as off, off returns from gateway_visit after reading only the flag, and propose writes only memory_dream:* keys in memory_meta inside one transaction. No memory row, revision or record metadata is written, and L1/L2 rows are never in changes or sent to the model. Checks are all green.

One blocker: this project does not accept new regex in product code, and memory_dream.py adds two:

  • _STATE_KEY = re.compile(...), used by is_work_state_key.
  • _DIGITS = re.compile(r"[0-9]+"), used by family_of.

Please replace both with plain string code and drop import re:

  • is_work_state_key: split the key after project. on . and _ into parts. For each part, take the text before its first ASCII digit and check it against a frozenset of the state words. Check the two-word entries (pr_number, pr_status, next_action, next_step, next_steps, in_progress) by joining each pair of neighbouring parts with _.
  • family_of: walk the key one character at a time and write # once for each run of characters in "0123456789". For example, use itertools.groupby(key, lambda c: c in "0123456789"). Return None when no run was found.

The existing tests for work state and numbered families should cover the change as they are. Everything else looks good to me, and I will approve once the regexes are gone.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 80d3431 to c1dc118 Compare November 12, 2026 17:43
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 Thanks. Both regexes are gone on head c1dc118, and import re is dropped:

  • is_work_state_key: splits the key after project. on . and _, checks each part (text before its first ASCII digit) against a frozenset of state words, and checks the two-word entries by joining neighbouring parts with _.
  • family_of: walks the key with itertools.groupby(key, lambda c: c in "0123456789"), writes # once per digit run, and returns None when no run was found.

The existing work-state and numbered-family tests pass unchanged (48 passed in test/test_memory_dream.py). One small widening from splitting on . too: a two-word entry joined by a dot, like project.next.step, now also reads as work state. The branch was rebased once onto main (no conflicts) because the push guard refused the stale base.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from c1dc118 to f3f5448 Compare November 12, 2026 18:18
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from f3f5448 to 43a1c0c Compare November 12, 2026 18:52
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Re the Opus 5.5 blocking finding at src/kiro_crew/memory_dream.py (_ask_model, except Exception): fixed on head 43a1c0c.

A failed merge call now returns the same interrupt marker as a timed-out call (_TIMED_OUT), so the run stops and the watermark stays before the pair. The next run reads the batch again and asks about the same pair. New test test_a_failed_model_call_keeps_the_watermark_and_the_next_run_asks_again fails on the old code and passes now. The branch was rebased onto main (no conflicts) and squashed to one commit for PR Hygiene.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 Both regexes are gone (is_work_state_key, family_of, no import re) and the Opus finding is fixed, on head 43a1c0c. All checks are green except PR Readiness, which waits on your review. Could you take another look when you have time?

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 43a1c0c to 4e31299 Compare November 12, 2026 21:39
@iamwhatever

Copy link
Copy Markdown
Contributor Author

@bolichen97 Rebased onto main to clear a conflict in src/kiro_crew/cli_commands_memory.py with #35978. Both sides are kept: the bare kirocrew memory usage line from main (now listing dream), then the dream verb. No other change. New head 4e31299.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 4e31299 to 7c7aa19 Compare November 12, 2026 22:21
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Re the Opus 5.5 blocking finding at src/kiro_crew/memory_dream.py (person_turn_running): fixed on head 7c7aa19.

person_turn_running now asks the gateway's own turn census, _in_flight_work_counts() (the one a restart waits on), plus quiescence.queued_message_count. The census reads has_active_turn() on every session's provider, so a turn on Telegram, Teams, WhatsApp, WeChat, Slack or the dashboard stops Dreaming. The separate slot/session-task walk and _BACKGROUND_PREFIXES are deleted; a background turn now also counts, which only makes runs rarer. New test test_a_turn_running_on_another_channel_stops_dreaming runs the real census with only a provider reporting a turn; it fails on the old code and passes now. The RFC 7.x note is updated to match.

@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 7c7aa19 to 486ea92 Compare November 12, 2026 22:51
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #36124 (the missing GitFork import) merged, so the inherited Build/E2E reds re-run against a fixed base. No code change. New head 486ea92.

@iamwhatever
iamwhatever force-pushed the feat/memory-dream-propose branch from 486ea92 to c96f91c Compare November 12, 2026 23:21
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Re the Opus 5.5 finding at docs/system-specs/modules/memory-skills-hooks.md (the Dreaming idle-check sentence): fixed on head c96f91c. The spec now says what the code does: person_turn_running uses the gateway's turn census _in_flight_work_counts plus queued messages, so every counted turn blocks a run, background ones (cron, subagent, task runner, workflow, worker chat) included. The key-prefix exclusion list is gone. Docs only; no code change.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 13, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, approving. Both regexes are gone and import re is dropped from memory_dream.py. I re-read the product changes between the head I reviewed (80d3431) and this one:

  • is_work_state_key splits the part after project. on ./_, cuts each part at its first ASCII digit and checks it against _STATE_WORDS, with neighbouring pairs against _STATE_PAIRS. That matches the same keys the old pattern did, including a word followed by a digit (pr2, next_steps3).
  • family_of uses itertools.groupby over "0123456789" and returns None with no run, as before.
  • A failed merge call now returns _TIMED_OUT, so the run stops and the watermark stays before that pair, and the next run asks again rather than skipping it.
  • person_turn_running now reads the gateway's own _in_flight_work_counts census. It counts background turns too, which only makes runs rarer, and any failure still reads as busy.
  • kirocrew memory with no verb prints usage without opening, and so creating, a store.
  • The watchdog and Slack field changes in section_builders.py and the help-text tweak come from the rebase onto main.

The direction is the one signed on #35288, memory.dream still defaults to off, and propose still writes only memory_dream:* meta. All checks are green.

@bolichen97
bolichen97 merged commit 2c73f54 into main Nov 13, 2026
97 checks passed
@bolichen97
bolichen97 deleted the feat/memory-dream-propose branch November 13, 2026 01:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants