Auto-create stub cards for unknown Discord users #1

Merged
BarnacleBoy merged 1 commit from auto-card-creation into main 2026-07-08 21:00:48 +00:00
Owner

What

Auto-creation of stub cards for unknown Discord users. When the pre_llm_call hook encounters an unknown user — either as the message sender or an @mention — it creates a minimal placeholder card instead of logging "unknown user."

Why

Cards should "happen automagically" rather than requiring manual creation for every new user encountered. This makes the identity system self-seeding: new users get a stub card on first contact, and descriptive prose can be added later via update_user_card.

Changes

  • New module-level functions: _make_stub_card(), _ensure_card(), _resolve_ids_in_text() (extracted from closure for testability)
  • Hook update: Sender detection + auto-creation + @mention resolution with auto-creation
  • Tests: 11 passing (5 existing coverage + 6 new for auto-creation)
  • docs: README, plugin.yaml (1.1.0), docstring updated

Testing

11 passed in 0.04s
## What Auto-creation of stub cards for unknown Discord users. When the `pre_llm_call` hook encounters an unknown user — either as the message sender or an @mention — it creates a minimal placeholder card instead of logging "unknown user." ## Why Cards should "happen automagically" rather than requiring manual creation for every new user encountered. This makes the identity system self-seeding: new users get a stub card on first contact, and descriptive prose can be added later via `update_user_card`. ## Changes - **New module-level functions:** `_make_stub_card()`, `_ensure_card()`, `_resolve_ids_in_text()` (extracted from closure for testability) - **Hook update:** Sender detection + auto-creation + @mention resolution with auto-creation - **Tests:** 11 passing (5 existing coverage + 6 new for auto-creation) - **docs:** README, plugin.yaml (1.1.0), docstring updated ## Testing ``` 11 passed in 0.04s ```
- Add _make_stub_card() — creates minimal placeholder cards
- Add _ensure_card() — returns existing card or auto-creates one
- Extract _resolve_ids_in_text() to module level for testability
- Update pre_llm_call hook to auto-create for message senders
- Update pre_llm_call hook to auto-create for @mentioned users
- All IDs resolved now show display name (never 'unknown')
- 11 tests passing (5 existing + 6 new)
- Bump version 1.0.0 → 1.1.0
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
KrustyPlanet/discord-user-cards!1
No description provided.