Skip to content

feat(people): bots are their own entity, apart from people (store version 75) - #3356

Open
leemour wants to merge 3 commits into
mainfrom
feat/bot-entity
Open

leemour wants to merge 3 commits into
mainfrom
feat/bot-entity

Conversation

@leemour

@leemour leemour commented Nov 25, 2026

Copy link
Copy Markdown
Member

Task

The owner ruled that bots are their own entity, never a person (contact-kinds plan, #3323, step 3 in full). #3339 (store version 74) added sender_bots, but each bot still sat on a person row. This makes a bot its own row, holding its own identities.

Why

A bot anchored on a person still counted as a person: it held identity_links, could get ties, tasks and merge proposals, and needed a bot flag on people rows. Now an identity belongs to exactly one person or one bot.

What

  • Store version 75 (reserved in docs(coordination): reserve store version 75 for bots as their own entity #3355): new table sender_bot_identities (identity → bot). The upgrade moves each version 74 bot's identities off its person row and logs every move in sender_bot_moves. The emptied person row stays with kind merged, hidden like a merge's emptied person, so a move back gives its uid back. sender_bots.person_id goes negative.
  • minCompatible stays 73. Triggers keep a 1.0 build apart: a bot's identity never gets a person link, the person its ingest makes goes again, a re-keyed link onto a bot's identity moves to the bot, a bot holding identities is not deleted, a hidden person's kind stays merged. A bot a 1.0 build sorts later is settled on the next writable list. Checked against the published cli-core 1.0.0 itself (sync, people.list, scanMatches({ full: true }), purge): no identity held twice, no empty person visible, no bot lost.
  • API (experimental): people.listBots({ query, organization, limit, offset }), people.showBot(ref) with every move. moveToBot / moveToPerson take sender-bot:<id>, person:<uid> or an identity; a whole history moves and is logged; the owner's choice wins over the rules. SENDER_BOT_PREFIX exported.
  • people.list: bots are gone from it, its counts, similar and ties. Rows lose bot; no compatibility kind: automated row for bots. People marked only by an automated name or a bulk mailbox stay automated.
  • Rules from feat(people): sender bots apart from people (store version 74) #3339 and the domain-organizations rule (feat(people): organizations from mail domains #3347) now make bots and put them under their organization. A re-key keeps one holder; an account purge removes the person rows its bots emptied.
  • GLOSSARY bot row, ARCHITECTURE, schema docs.

Ref is sender-bot:<id>, not bot:<id>: bot: and *_type = 'bot' already mean AI agents. The owner decides whether to rename the agents' ref in a major.

Testing

  • pnpm typecheck, pnpm lint, pnpm docs:check, pnpm schema:check; full vitest suite: 988 files, 13,676 tests pass.
  • New src/store/version-75.test.ts (upgrade from 74 plus 1.0 writes) and rewritten src/store/sender-bots.test.ts (rules, owner moves both ways, re-key on either side, purge, search).
  • Benchmark on 20,000 synthetic program senders + 20,000 humans (load 12–18): first list 2.4–6.0 s, about 1 s of it under the write lock; upgrade from 74 with 20,000 bots 0.3–3.2 s; warm pages of people and bots under 60 ms. Full page and script: WireCatLabs/cli-testing performance/people/bots.

Not done here: memo bots list/move commands and the Desktop Bots view (until then bots vanish from the Automated tab once a store migrates), a bot sender's ref in mail fields, mention, tracker and author resolution for bot identities.

🤖 Generated with Claude Code

leemour and others added 3 commits November 25, 2026 12:41
…sion 75)

A sender bot now holds its identities itself, in sender_bot_identities:
an identity belongs to one person or one bot, never both, and its
messages and mail keep pointing at the identity. A bot has a name,
identities and an optional organization, no ties, no tasks, no merge
review, and never appears in people.list, its counts, similar or ties.

- Store version 75: the upgrade moves each version 74 bot's identities
  off its person row and logs the move. The row stays, kind 'merged',
  hidden as a merge's emptied person is, so a move back gives its uid
  back. sender_bots.person_id goes negative: a 1.0 build reads a bot as
  its person row, and this names none.
- minCompatible stays 73. Triggers keep a 1.0 build apart: a bot's
  identity gets no link to a person, the person its ingest made goes
  again, a bot holding identities is not deleted, and a hidden person's
  kind stays 'merged'. A bot such a build sorts after the upgrade is
  settled by the next kept list.
- Rules: a person whose kind is automated by a program's signal moves
  to a new bot, as before; a rule's bot goes back to the people its
  identities came from once the owner writes to it. The domain rule
  puts the new bots under their organization.
- API: people.listBots (query, organization, paging) and showBot (with
  every move). moveToBot and moveToPerson take sender-bot:<id>,
  person:<uid> or an identity; a person ref a bot emptied names the bot.
- people.list rows lose `bot`; KindSignal loses `owner-choice`.

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

- A re-key onto an identity a bot holds no longer gives it a link too:
  a trigger takes the moved link off and logs the move, and a bot whose
  identity is re-keyed onto a person's takes the one that stays.
- An account purge removes the person rows its bots emptied, as it
  removes a purged identity's person.
- A bot a 1.0 build sorts onto a person row is settled on the next
  writable list even when every stored kind is current: that build keeps
  the kinds it worked out, so nothing else brought the bot here.

Checked against cli-core 1.0.0 itself: it syncs, lists, scans and purges
a version 75 store without an identity held twice, an empty person left
visible or a bot lost.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leemour added a commit to WireCatLabs/cli-testing that referenced this pull request Nov 25, 2026
…#410)

Benchmark for cli-core store version 75 (WireCatLabs/cli-core#3356):
with 20,000 synthetic program senders, the first people list holds the
write lock for about 1 s, the upgrade from version 74 takes 0.3–3.2 s,
warm pages stay under 60 ms. Synthetic data only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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