8 of 101 min

How the bot gathers and updates people's profiles

One of the rarest mechanisms in this project has to do not with replies but with how the system gradually assembles a person’s profile.

A profile here doesn’t look like a form filled in once. It’s an updatable model of presence: it’s refined as communication goes on and isn’t rebuilt for every line.

The key node looks like this:

if n >= PROFILE_UPDATE_EVERY:
    c.execute("UPDATE ann_profile_counters SET since_last_update=0 WHERE user_id=?", (int(user_id),))
    queue_profile_update(int(user_id))

• PROFILE_UPDATE_EVERY Sets the update threshold. The profile isn’t touched after every new message.

• since_last_update The counter shows how much new material has accumulated since the last update.

• queue_profile_update(int(user_id)) Rebuilding the profile is moved out separately. This means the system first accumulates observations and then updates the profile as a task of its own.

So the logic here isn’t reactive but cumulative: first a body of new lines is gathered, then the system decides the person can now be described more precisely.

The profile itself is stored separately:

CREATE TABLE IF NOT EXISTS ann_profiles(...)

And the grounds for it are in one more layer:

CREATE TABLE IF NOT EXISTS ann_profile_evidence(...)

• ann_profiles Stores the current description of a person inside the system.

• ann_profile_evidence Stores what this description is based on at all.

This is an important point. The project doesn’t just “form an impression” of a user. It also stores the traces this impression grew from.

So the bot works not with a one-off image of its interlocutor but with a long-refined idea of a person.

That’s what makes the profile in this project not decorative personalisation but a separate operational layer of the system.

How the bot gathers and updates people's profiles: illustration 1
Series contents
  1. How the idea of a book gave rise to a space for memory, conversation and recirculation
  2. What this project is really made of
  3. Memory, profile and context: what the bot rests on
  4. The logic by which the bot answers people
  5. How I made a system that doesn't let content vanish
  6. How the project's philosophy is sewn into the code
  7. Why this project lives not only in text
  8. How the bot gathers and updates people's profiles
  9. How I protect the project from chaos, duplicates and chance
  10. Why I wrote this code not for the sake of automation