feat: hibernation_score + activation_condition columns (#196 storage half) - #282
Merged
Merged
Conversation
…#196) Storage half of the v2.0 hibernation lifecycle ratified in docs/substrate_decision.md. Both columns nullable; `None` means the belief is active. activation_condition is JSON-encoded TEXT (predicate language locked in at ratification ask #4). Behavior — when to set hibernation_score, the predicate evaluator, sweeper integration — is intentionally deferred to a follow-up issue. This commit is round-trip only: schema, idempotent ALTER for legacy DBs, Belief dataclass fields, insert_belief/_row_to_belief plumbing, and tests covering default-NULL, round-trip, get_belief_by_content_hash, and legacy-DB migration idempotency.
This was referenced Apr 29, 2026
robotrocketscience
added a commit
that referenced
this pull request
Apr 29, 2026
## Summary Spec memo for the v2.0 #196 behavior half. Storage half (PR #282) added the columns; this memo proposes the rules that consume them. **Doc-only — no code change. Posted for ratification.** Three open questions resolved: 1. **Trigger.** Candidate A: conjunction of *unlocked + retrieved-and-cold (30d) + demotion_pressure ≥ 1 + posterior_mean < 0.6*. The conjunction is what keeps it safe — old-and-quiet beliefs (probably true, just off-topic) don't hibernate; new beliefs (α=β=1.0, posterior 0.5) don't hibernate (no last_retrieved_at); user-flagged-wrong beliefs go through deletion, not hibernation. 2. **Predicate grammar.** Closed three-clause JSON object: \`keywords_any\` (substring match), \`source_kind\` (equality), \`after_ts\` (ISO-8601). Implicit AND, no nesting, no expressions. Widening is additive; narrowing later would break beliefs in the wild. 3. **Sweeper.** New \`aelfrice.hibernation\` module. \`score_pass\` invoked from \`aelf doctor --hibernate\` (opt-in in v2.0); \`wake_pass\` runs automatically on \`UserPromptSubmit\` before the L0/L1/L2.5 search so woken beliefs are eligible same-turn. Hibernated beliefs filter out of L1/L2.5 retrieval; locked beliefs cannot hibernate. ## Decision asks (four) Bottom of the memo. Trigger conjunction shape, grammar closure, sweeper placement, retrieval-filter semantics. ## What ships if ratified Three follow-up PRs: 1. \`aelfrice.hibernation\` module (pure functions + pytest coverage). 2. Doctor flag + retrieval filter + hook \`wake_pass\` invocation. 3. \`LIMITATIONS.md\` / \`PHILOSOPHY.md\` / README updates. ## Test plan - [x] Memo cross-references substrate_decision.md and PR #282 - [x] No code change; nothing to test - [ ] Ratification or override comment from maintainer Refs #196
yoshi280
pushed a commit
that referenced
this pull request
May 15, 2026
The hibernation_lifecycle memo describes a trigger / predicate-grammar / sweeper design that has never been implemented. Storage half (#196 / PR #282 — hibernation_score + activation_condition columns) sits unused on github/main; no scorer populates the score column, no list_hibernated / hibernate_eligible function exists, and the original trigger spec keyed off demotion_pressure which was removed by #814 / PR #820. Operator decision on #825 (option A): rewrite the doc to current reality rather than implement the eligibility surface (option B) or delete the file (option C). Changes: - Rewrite Status section with an UNIMPLEMENTED banner that names the empty src/ surface and points at the column-only state. - Replace the SQL block in Candidate A with a paragraph noting that the original demotion_pressure-based trigger no longer applies and no replacement signal has been chosen. - Update the Decision ask to mark ratification as deferred until an implementation pass is scheduled. - Drop the TODO(#825) marker that PR #824 left behind; this commit IS the disposition. Net effect: the memo no longer claims any behavior that exists in src/; remaining references to demotion_pressure are historical context explaining why each section is unimplemented, not claims about current behavior. Closes #825.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #196 — does not close it. Substrate decision is ratified (Option B); issue stays open until hibernation behavior also ships.
This PR is the storage half only.
What lands
beliefs.hibernation_score REAL(nullable) andbeliefs.activation_condition TEXT(nullable, JSON-encoded when set), perdocs/substrate_decision.mdratification asks ci: history-scan should see all branches #3 (hibernation: yes) and feat: add Belief/Edge dataclasses and config module #4 (predicate language: JSON).ALTER TABLE … ADD COLUMNfor both, inserted into the existing_MIGRATIONStuple. Legacy DBs gain the columns on next open; existing rows returnNULL.Belief.hibernation_score: float | None = NoneandBelief.activation_condition: str | None = None. Defaults preserve every existing call site.insert_beliefwrites the new fields._row_to_beliefreads them.get_beliefandget_belief_by_content_hashboth surface them (verified by test).What does NOT land
hibernation_score, what wakes a belief, the predicate evaluator. That's a follow-up issue. The columns are nullable precisely so this PR doesn't pin behavior down.Tests
tests/test_hibernation_columns.py(5 tests):hibernation_score=0.42, JSON activation_condition)get_belief_by_content_hashreturns the new fieldsMemoryStoreopen; second open is idempotent; legacy rows return NULLFull suite: 1833 passed, 8 skipped.
Why this size
Per Kulili session triage (2026-04-29): the substrate_decision.md ratification recommended hibernation but didn't spec the behavior. Splitting the column add (mechanical) from the behavior (queen-scoped) lets downstream issues — #195 (already merged scalar
uncertainty_score), wonder/reason ports — depend on the column shape without waiting for the behavior debate to close.