Skip to content

feat(scroll): P6.4 agent observer + cold-region LRU - #67

Merged
github-actions[bot] merged 2 commits into
mainfrom
p6.4-agent-observer
Jul 27, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
p6.4-agent-observer

Conversation

@cordialApple

Copy link
Copy Markdown
Owner

what

P6.4: the PURE observer + cold-region LRU for the native attention-anchored agent — SELECTION only (which cold region to reorganize next). No I/O, no server, no edit, no driver. P6.5 wire the driver over HeadlessPeer + auth; P6.6 provenance + milestone e2e → P6 CLOSE.

how

  • src/agent/coldScheduler.ts — pure LRU. selectNext(state, cold): never-worked first, then least-recently-worked, tie-break by document order; seeded from cold[0] so a non-empty cold NEVER return null (even under non-finite timestamps). markWorked(state, id, now, present): record + prune absent ids (bounded map over a long session). monotonic-now precondition documented.
  • src/agent/observer.ts — observe({ order, remotes, prevTracked, lru, now, awarenessKnown, pinned?, config? }): fold grace (trackCameras), derive the cold set (coldBlocks — the SAME predicate the authority enforce), select (selectNext). Fail closed: awareness unknown → cold empty → null target. Return { targetId, cold, tracked } (tracked a ReadonlyMap the driver thread into the next tick). The agent-side BELT to the authority's commit-time SUSPENDERS (P6.3: commit-time spatial ProposalGuard — enforce the guard at the room authority #62).
  • src/agent/spatialGuard.ts — export resolveGraceMs (single grace source so the observer's trackCameras fold and guardedBlocks read ONE formula, never diverge).

test

coldScheduler.test.ts (9), observer.test.ts (6 + 1 skip), observer.pbt.test.ts. The safety PBT recompute the guarded set INDEPENDENTLY from raw inputs (non-laundering, mirror the authority's liveCameras, NEVER from observe's own tracked), so a resolution or config/pinned-forwarding bug surface as a mismatch instead of holding by algebra. Teeth mutation-verified (mutate → vitest → revert): fold cameras→[], config→undefined, pinned→undefined all go RED. Full suite 240 pass / 3 skip; tsc 0. Adjudicator PASS-WITH-CARRYFORWARD (re-ran the mutations itself).

carry-forward → P6.5 (#66)

The agent fold cameras via the laundered RemoteCamera.anchor (→ order[0] for a vanished block), so a reader whose block was hard-deleted with no redirect is UNDER-guarded agent-side (the authority's non-laundering liveCameras handle it right). LATENT: unwired (no driver), authority reject the doomed proposal at commit. Pinned by a skipped observer test (fail-closed on a laundered camera) that FAIL if un-skipped. #66 also carries ObserverState bundling (F-06) + awarenessKnown producer (F-07). #63 (P6.3) server pins stay gating.

Closes #65

🤖 Generated with Claude Code

https://claude.ai/code/session_01X7WHDHurYHVibsjwvevzFr

@cordialApple cordialApple added the automerge auto-merge when CI green label Jul 27, 2026
@github-actions
github-actions Bot enabled auto-merge (squash) July 27, 2026 16:20
@github-actions
github-actions Bot merged commit 4701127 into main Jul 27, 2026
4 checks passed
@cordialApple
cordialApple deleted the p6.4-agent-observer branch July 27, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge auto-merge when CI green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P6.4: agent observer + cold-region LRU scheduler (pure selection core)

1 participant