Skip to content

fix(kin): land an L0 lead's shadow notes on the default branch once - #740

Open
Surajsm60720 wants to merge 2 commits into
kinfrom
fix/kin-l0-shadow-landing
Open

Surajsm60720 wants to merge 2 commits into
kinfrom
fix/kin-l0-shadow-landing

Conversation

@Surajsm60720

Copy link
Copy Markdown
Collaborator

Why

How

  • New MemoryWriter.landShadows, run by the memory sync at start-up and every 5 minutes. For each live lead with an anchored shadow branch and no marker, it lands the shadow's changed items on main through the owner commit, which runs the secret scan and rebuilds the index. It leaves out the journal and anything already on main.
  • Conflicts: where main also changed an item since the merge base, main's version stays. The shadow branch is not touched, so it still has its own version, and a recovery notice names the path.
  • Runs once: a kin_memory_heads row (kin/shadow-landed/<agentId>) records the shadow head that was landed. It is written in the same transaction as the new main head, and with no migration. Later shadow writes, from chats the owner didn't place the lead in, stay off main. The only level code involved is the existing shadow branch name.

Tests

  • vp test run src/kin/memory/MemoryWriter.test.ts -t shadow: 6 passed. The two new cases cover three things: shadow notes land on main and in its INDEX.md; a second run changes nothing; and a conflict keeps main's version while a non-conflicting note lands. Both fail on assertions when landShadows does nothing.
  • vp test run on MemoryWriter, Memory, lead/layer and WakeupRunner tests: 189 passed.
  • vp run check:changed: all pass (format, lint, knip, typecheck, 10 test files).

🤖 Generated with Claude Code

Surajsm60720 and others added 2 commits November 23, 2026 07:32
A lead that ran at L0 before leads worked on the default branch kept its
notes on kin/shadow/<agentId>, and nothing landed them, so it started
from an empty index. The memory sync at start-up now lands, once per
live lead, the items its shadow branch changed that the default branch
lacks, through the writer's owner commit (secret scan, index rebuild).
Where both changed an item the default branch's stays and the shadow
branch keeps its own. A kin_memory_heads marker row records the landed
shadow head, so later shadow writes stay off the default branch.

Refs #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
People-change: A lead that ran at L0 before #155 now finds the notes it wrote then in its memory and index; the owner sees them in Memory, and a note that clashed with a newer one on main gets a recovery notice naming the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant