feat(v4): Phase 7 Task 3 -- background decay and the window's adaptive pass in each node's heartbeat cycle (#189)

In v3's order (vm_heartbeat_run_cycle): the tick; background decay -- 64 words a cycle from a cursor down
the dictionary (v3's vm_tick_apply_background_decay), so a word not called cools; the window's adaptive
pass on its diversity (v3's rolling_window_run_adaptive_pass: halve to 256, double to 4096). Test first:
test_mesh_boot.c, 62 checks (70 with pipelining and the cache on). Inference, L8 and the snapshot next.
Not pushed (held to the end of Phase 7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 22:20:22 +00:00
parent 5c79bddbbb
commit 7c33b99ebe
4 changed files with 104 additions and 6 deletions
+7
View File
@@ -100,6 +100,10 @@ typedef struct {
#define V4_MESH_WINDOW 4096u /* v3's ROLLING_WINDOW_SIZE */
#define V4_MESH_WINDOW_WARM 1024u /* executions before the window is warm, as v3 */
#define V4_MESH_ADAPTIVE_CHECK 512u /* v3's ADAPTIVE_CHECK_FREQUENCY: executions between diversity checks */
#define V4_MESH_WINDOW_MIN 256u /* v3's ADAPTIVE_MIN_WINDOW_SIZE */
#define V4_MESH_SHRINK_RATE 50u /* v3's ADAPTIVE_SHRINK_RATE, percent */
#define V4_MESH_GROWTH_THRESHOLD 5u /* v3's ADAPTIVE_GROWTH_THRESHOLD, percent */
#define V4_MESH_DECAY_BATCH 64u /* v3's HEARTBEAT_DECAY_BATCH: words decayed in the background a cycle */
#define V4_MESH_CHECK_FREQUENCY 256u /* v3's HEARTBEAT_CHECK_FREQUENCY: word calls a heartbeat cycle */
typedef struct {
uint64_t tick; /* the node's heartbeat cycles (v3's tick_count): by execution, as v3 */
@@ -116,6 +120,9 @@ typedef struct {
uint32_t adaptive_check_accumulator;
uint8_t is_warm;
uint8_t adaptive_pending; /* the heartbeat should check the window's diversity */
uint64_t last_pattern_diversity, diversity_checks;
v4_cell decay_cursor; /* background decay: the next word's xt, down the dictionary; 0: from LATEST */
uint64_t decay_cycles;
/* pipelining (Loop #4): the word called before, L8's gate, and the node's counts */
uint32_t prev_id; /* V4_MESH_NO_WORD: none yet */
uint8_t l4_pipelining;