explaingit

pearthink123/revive-companion

Analysis updated 2026-06-24

13PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

Python library that decides when an AI companion should proactively message a user, combining a Poisson timing model, information gain, and Bayesian state inference.

Mindmap

mindmap
  root((revive-companion))
    Inputs
      User signals
      YAML config
    Outputs
      Send decision
      Suggested prompt
      Decision log
    Use Cases
      AI companion timing
      Bot proactive messages
      Quiet hours scheduling
    Tech Stack
      Python
      Streamlit
      YAML
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add human-feeling proactive messaging to a Telegram, Discord, or Slack companion bot

USE CASE 2

Replace fixed-interval cron pings in a chatbot with a probability-driven schedule

USE CASE 3

Run the Streamlit dashboard to inspect the longing curve and decision log over time

USE CASE 4

Wire revive-companion into an OpenAI, Anthropic, or Ollama client to drive outgoing messages

What is it built with?

PythonStreamlitYAML

How does it compare?

pearthink123/revive-companion1lystore/awaekactashui/sjtu-ppt-template-skill
Stars131313
LanguagePythonPythonPython
Setup difficultymoderatemoderatemoderate
Complexity3/52/52/5
Audiencedevelopervibe coderresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Practical use needs an LLM provider key and a chat platform adapter wired to record_send and record_reply.

In plain English

revive-companion is a Python library that decides when an AI companion should send a message to its user. Most chatbots either follow a fixed schedule, like "ping every two hours", or send something at random, which the author argues feels either rigid or pointless. This library replaces that logic with a probability engine designed to make the timing of outgoing messages feel more like the way a person thinks about a friend during the day. It works in three pieces. The first piece, based on a Poisson process, sets the moments at which the AI even considers reaching out, so the spacing between attempts looks naturally varied rather than clockwork. The second piece, drawn from information theory, asks whether sending a message right now would actually add anything new, and skips it if not. The third piece, Bayesian inference, tries to guess what the user is probably doing right now from the available signals, and looks up a utility number for that state. Chatting with someone else, busy, or sleeping all lead to staying quiet. Idle online or seemingly needing care lead to reaching out. The README spells out the core math. Each check computes a hit probability, 1 minus e raised to the power of negative lambda times t, where lambda is a longing rate. When a check does not fire, the rate creeps up, when the engine decides to send, it resets. Over a quiet night, the probability climbs from about 7 percent to 95 percent across the early hours. Using it is meant to be small. The main entry point is a class called PoissonLove. Each tick returns whether a message should be sent and a suggested prompt, the app calls record_send after sending and record_reply when the user replies. Adapters are included for OpenAI, Anthropic, and any HTTP backend such as Ollama, and the README shows the same pattern wired into Telegram, Discord, Slack, or WeChat bots. The package ships with a YAML config file, a Streamlit dashboard that plots the longing curve and decision log, demo scripts, and 124 tests. The README also has a long section about consent and safety, with built-in quiet hours, an anti-spam cooldown of at least one hour between messages, and explicit advice that users should opt in and be able to turn the feature off at any time.

Copy-paste prompts

Prompt 1
Show me a minimal Python example using PoissonLove from revive-companion with an OpenAI adapter
Prompt 2
Explain how the longing rate lambda grows over time and resets on send
Prompt 3
Walk me through wiring revive-companion into a Telegram bot with quiet hours and a one-hour cooldown
Prompt 4
How does revive-companion infer user state with Bayesian inference and pick a utility value
Prompt 5
Generate a YAML config for revive-companion that disables messages between 10pm and 8am

Frequently asked questions

What is revive-companion?

Python library that decides when an AI companion should proactively message a user, combining a Poisson timing model, information gain, and Bayesian state inference.

What language is revive-companion written in?

Mainly Python. The stack also includes Python, Streamlit, YAML.

How hard is revive-companion to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is revive-companion for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.