Documentation index · Configuration reference · Operations
This guide runs ThinkMate from a local checkout. For containers, use the Docker instructions.
| Component | Requirement |
|---|---|
| Python | 3.14; .python-version pins 3.14.8 for development and Docker. |
| uv and Git | Install uv and Git. |
| Telegram | A bot account and token issued by BotFather. |
| MongoDB | A reachable database, local or hosted; this repository does not start one for you. |
| LLM | A reachable OpenAI-compatible endpoint, its credential if required, and a supported model ID. |
Run commands from the repository root. Use one polling process per Telegram bot token.
git clone https://github.com/TechShreyash/ThinkMate.git
cd ThinkMate
uv python install
uv sync --lockeduv uses the project's Python pin and lockfile. Docker installs runtime packages from the same uv.lock; requirements.txt is a generated locked export that also includes the test packages. You do not need to activate a virtual environment when using uv run. See uv's project guide for the environment/lockfile workflow.
For development and tests, include the optional extra:
uv sync --locked --extra devIf the pinned Python download fails, check uv's version and whether that Python release is available for your platform. Do not silently replace the project's pin while diagnosing setup.
Open BotFather, send /newbot, choose a display name and a username ending in bot, and save the token. Keep it out of commits, screenshots, and shared logs.
Create the local configuration:
cp .env.example .envOn PowerShell:
Copy-Item .env.example .envSet TELEGRAM_BOT_TOKEN in .env. The application loads .env from the repository root; environment variables already set in the process take precedence. See app/config.py.
Edit these settings, replacing the placeholders:
TELEGRAM_BOT_TOKEN=replace-with-botfather-token
MONGODB_URI=mongodb://localhost:27017
MONGODB_DB=thinkmate_db
LLM_BASE_URL=http://localhost:1234/v1
LLM_API_KEY=replace-with-your-provider-key-or-local-placeholder
LLM_CHAT_MODEL=replace-with-a-chat-model-your-server-serves
LLM_EXTRACTION_MODEL=
LLM_CHAT_FALLBACK_MODEL=
LLM_EXTRACTION_FALLBACK_MODEL=
LLM_CHAT_REASONING_EFFORT=
LLM_EXTRACTION_REASONING_EFFORT=
LLM_CHAT_FALLBACK_REASONING_EFFORT=
LLM_EXTRACTION_FALLBACK_REASONING_EFFORT=
LLM_STRUCTURED_MODE=json_object
ADMIN_USER_IDS=replace-with-your-numeric-telegram-user-id- MongoDB must be running and accessible from the bot process. For a hosted database, configure authentication, network access, and TLS as required by that service.
- Use exact model IDs exposed by your endpoint.
LLM_CHAT_MODELserves replies and check-ins;LLM_EXTRACTION_MODELserves extraction, compression, and consolidation. Blank extraction model uses the resolved chat model; blank chat model uses the legacyLLM_MODEL(defaultgpt-4o). The template'sgpt-4o-miniextraction model is an example override. Models used for structured calls must support those requests. - Set
LLM_CHAT_FALLBACK_MODELandLLM_EXTRACTION_FALLBACK_MODELif you want each path to try another model after primary failure. Blank disables fallback; a fallback identical to its primary is skipped. All models share the configured endpoint and credential. - Set reasoning separately with
LLM_CHAT_REASONING_EFFORT,LLM_EXTRACTION_REASONING_EFFORT,LLM_CHAT_FALLBACK_REASONING_EFFORT, andLLM_EXTRACTION_FALLBACK_REASONING_EFFORT. Accepted values arenone,minimal,low,medium,high,xhigh, andmax, with whitespace/case normalized. Blank omits the request field and uses the provider default; explicitnonesends that value. Check support for each model/provider; reasoning does not inherit between these four settings. LLM_BASE_URLis the API base, usually including/v1, not the complete/chat/completionsURL. Local LM Studio commonly useshttp://localhost:1234/v1; Ollama's documented compatible base ishttp://localhost:11434/v1. Check the endpoint's actual configuration.json_objectis the default structured mode. An endpoint exposing a compatible URL is not proof that its model supports every request field; inspect LLM integration when choosing or troubleshooting a provider.ADMIN_USER_IDSis a comma-separated list of numeric Telegram user IDs. Blank means any private-chat user can access health/metrics. Invalid entries are ignored, so verify the value carefully.
Ollama's compatibility reference describes its supported endpoint and JSON mode. A local LLM avoids sending prompts to a hosted inference provider, but Telegram remains part of the communication path.
The copied template enables consolidation and proactive check-ins. For a first test, you can disable proactive outreach:
PROACTIVE_INTERVAL_SECS=0Users can also use /checkins off. Proactive quiet hours are UTC, with defaults of 16:00–02:00 UTC, corresponding to 21:30–07:30 in India.
If you configure LOGS_CHANNEL_ID, grant the bot permission to send messages and documents there. Operational forwarding can include extracted memory updates and reset backups; choose recipients accordingly. Leave FORWARD_DIAGNOSTICS=False unless you need routing traces. See observability.
All environment configuration is read at import/startup. Restart after changing .env or command settings. Editing the persona file is the exception; see persona customization.
uv run --locked main.pyStartup pings MongoDB, initializes audit indexes, restores persisted metrics, prepares schedulers and command menus, and begins Telegram long polling. A MongoDB failure stops startup. A persona path problem logs a warning and uses fallback behavior rather than failing startup.
Verify progressively:
- Open your bot's private chat and send
/start. This checks Telegram delivery and profile initialization; the welcome message is static. - Send a short ordinary text message. Wait for batching and model generation, and confirm a conversational reply.
- Send a memorable detail, then continue chatting. Extraction runs only after its buffer threshold and enough older entries are available; memory need not appear after the first message.
- Use
/profilein the private chat to inspect memory. Use/healthfrom your configured operator account to check MongoDB readiness; it does not probe the LLM endpoint.
Use Ctrl+C to stop. See operations for the shutdown limits.
Add the bot to a test group and begin with an explicit @username mention or reply to its message. For ordinary group chatter and ambient participation, the bot must actually receive those messages. Telegram privacy mode limits visibility; use BotFather's /setprivacy if full group visibility is intended. Telegram documents that a privacy-mode change requires re-adding the bot, and group admin bots receive all messages. See Telegram privacy mode.
Read group behavior before enabling shared use: prompts include the current speaker's personal profile, and personal commands are not all restricted to private chats.
If something fails, use the troubleshooting table. The full configuration reference covers tuning after the initial conversation works.