docs: onboarding v2, widgets for telegram workflows, hero widget (#138)

This commit is contained in:
banteg
2026-01-15 05:24:59 +04:00
committed by GitHub
parent ffae80dce7
commit cdaacb3d18
17 changed files with 955 additions and 532 deletions
+19 -8
View File
@@ -1,11 +1,16 @@
# Conversation modes
Takopi can handle follow-up messages in two ways: **chat mode** (auto-resume) or **stateless** (reply-to-continue). Pick the one that matches how you want Telegram to feel.
Takopi can handle follow-up messages in two ways: **chat mode** (auto-resume) or **stateless** (reply-to-continue).
## Quick pick
During [onboarding](install.md), you chose a **workflow** (assistant, workspace, or handoff) that automatically configured this for you:
- **Choose chat mode** if you want a normal chat flow where new messages continue the same thread.
- **Choose stateless** if you want every message to start clean unless you explicitly reply.
| Workflow | Session mode | Topics | Resume lines |
|----------|--------------|--------|--------------|
| **assistant** | chat | off | hidden |
| **workspace** | chat | on | hidden |
| **handoff** | stateless | off | shown |
This page explains what those settings mean and how to change them.
## Chat mode (auto-resume)
@@ -48,14 +53,20 @@ To continue the same session, **reply** to a message with a resume line:
!!! user "You"
now add tests
## Where to set it
## Changing your settings
Onboarding will ask you, or you can set it in config:
You can manually change these settings in your config file:
```toml
[transports.telegram]
session_mode = "chat" # or "stateless"
show_resume_line = false # optional, see below
session_mode = "chat" # "chat" or "stateless"
show_resume_line = false # true or false
```
Or re-run onboarding to pick a different workflow:
```sh
takopi --onboard
```
## Resume lines in chat mode
-13
View File
@@ -153,19 +153,6 @@ Key points:
- When done, the progress message is replaced with the final answer
- Chat mode auto-resumes; resume lines let you reply to branch
## The core loop
You now know the three fundamental interactions:
| Action | How |
|--------|-----|
| **Start** | Send a message to your bot |
| **Continue** | Chat mode: send another message. Stateless: reply to a resume line. |
| **Reset** | `/new` |
| **Cancel** | Tap **cancel** on a progress message |
Everything else in Takopi builds on this loop.
## Troubleshooting
**Progress message stuck on "starting" (or not updating)**
+5 -87
View File
@@ -1,90 +1,8 @@
# Tutorials
Tutorials walk you through Takopi step-by-step. Follow them in order if you're new.
1. [Install](install.md)
2. [First run](first-run.md)
3. [Projects & branches](projects-and-branches.md)
4. [Multi-engine](multi-engine.md)
If you already know what you want ("enable topics", "use worktrees"), jump to **[How-to](../how-to/index.md)**.
## Prerequisites
Before starting, make sure you have:
- A **Telegram account**
- **Python 3.14+** and **uv** ([install uv](https://docs.astral.sh/uv/getting-started/installation/))
- At least one agent CLI on your `PATH`:
| Agent | Install |
|-------|---------|
| Codex | `npm install -g @openai/codex` |
| Claude Code | `npm install -g @anthropic-ai/claude-code` |
| OpenCode | `npm install -g opencode-ai@latest` |
| Pi | `npm install -g @mariozechner/pi-coding-agent` |
You only need one to get started. Takopi auto-detects what's available.
## The tutorials
### 1. Install and onboard
Set up Takopi, create a Telegram bot, and generate your config.
**Time:** ~5 minutes
[Start here →](install-and-onboard.md)
### 2. Conversation modes
Decide how Takopi should handle follow-up messages: chat mode or reply-to-continue.
**Time:** ~5 minutes
[Continue →](conversation-modes.md)
### 3. First run
Send your first task, watch it stream, and learn the core loop: run → continue → cancel.
**Time:** ~10 minutes
[Continue →](first-run.md)
### 4. Projects and branches
Register a repo as a project so you can target it from anywhere. Run tasks on feature branches without leaving your main worktree.
**Time:** ~10 minutes
[Continue →](projects-and-branches.md)
### 5. Multi-engine workflows
Use different agents for different tasks. Set defaults per chat or topic.
**Time:** ~5 minutes
[Continue →](multi-engine.md)
## What you'll build
By the end of these tutorials, you'll have:
```
~/.takopi/takopi.toml
├── bot_token + chat_id configured
├── session_mode chosen
├── default_engine set
└── projects.your-repo registered
```
And you'll know how to:
- Send tasks from Telegram and watch progress stream
- Continue conversations by replying or sending a new message (chat mode)
- Cancel runs mid-flight
- Target specific repos and branches
- Switch between agents on the fly
## After the tutorials
- **[How-to guides](../how-to/index.md)** — goal-oriented recipes (topics, file transfer, voice notes)
- **[Reference](../reference/index.md)** — exact config keys, commands, and contracts
- **[Explanation](../explanation/index.md)** — architecture and design rationale
See also: [Conversation modes](conversation-modes.md)
-302
View File
@@ -1,302 +0,0 @@
# Install and onboard
This tutorial walks you through installing Takopi, creating a Telegram bot, and generating your config file.
**What you'll have at the end:** A working `~/.takopi/takopi.toml` with your bot token, chat ID, conversation mode, and default engine.
## 1. Install Python 3.14 and uv
Install `uv`, the modern Python [package manager](https://docs.astral.sh/uv/):
```sh
curl -LsSf https://astral.sh/uv/install.sh | sh
```
Install Python 3.14 with uv:
```sh
uv python install 3.14
```
## 2. Install Takopi
```sh
uv tool install -U takopi
```
Verify it's installed:
```sh
takopi --version
```
You should see something like `0.18.0`.
## 3. Install agent CLIs
Takopi shells out to agent CLIs. Install the ones you plan to use (or install them all now):
### Codex
```sh
npm install -g @openai/codex
```
Takopi uses the official Codex CLI, so your existing ChatGPT subscription applies. Run `codex` and sign in with your ChatGPT account.
### Claude Code
```sh
npm install -g @anthropic-ai/claude-code
```
Takopi uses the official Claude CLI, so your existing Claude subscription applies. Run `claude` and log in with your Claude account. Takopi defaults to subscription billing unless you opt into API billing in config.
### OpenCode
```sh
npm install -g opencode-ai@latest
```
OpenCode supports logging in with Anthropic for your Claude subscription or with OpenAI for your ChatGPT subscription, and it can connect to 75+ providers via Models.dev (including local models).
### Pi
```sh
npm install -g @mariozechner/pi-coding-agent
```
Pi can authenticate via a provider login or use API billing. You can log in with Anthropic (Claude subscription), OpenAI (ChatGPT subscription), GitHub Copilot, Google Cloud Code Assist (Gemini CLI), or Antigravity (Gemini 3, Claude, GPT-OSS), or choose API billing instead.
## 4. Run onboarding
Start Takopi without a config file. It will detect this and launch the setup wizard:
```sh
takopi
```
You'll see something like:
```
welcome to takopi!
let's set up your telegram bot.
step 1: telegram bot setup
? do you have a telegram bot token? (yes/no)
```
If you don't have a bot token yet, answer **n** and Takopi will show you the steps.
## 5. Create a Telegram bot
If you answered **n**, follow these steps (or skip to step 6 if you already have a token):
1. Open Telegram and message [@BotFather](https://t.me/BotFather)
2. Send `/newbot` or use the mini app
3. Choose a display name (the obvious choice is "takopi")
4. Choose a username ending in `bot` (e.g., `my_takopi_bot`)
BotFather will congratulate you on your new bot and will reply with your token:
```
Done! Congratulations on your new bot. You will find it at
t.me/my_takopi_bot. You can now add a description, about
section and profile picture for your bot, see /help for a
list of commands.
Use this token to access the HTTP API:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz
Keep your token secure and store it safely, it can be used
by anyone to control your bot.
```
Copy the token (the `123456789:ABC...` part).
!!! warning "Keep your token secret"
Anyone with your bot token can control your bot. Don't commit it to git or share it publicly.
## 6. Enter your bot token
Paste your token when prompted:
```
? paste your bot token: ****
validating...
connected to @my_takopi_bot
```
Takopi validates the token by calling the Telegram API. If it fails, double-check you copied the full token.
## 7. Capture your chat ID
Takopi needs to know which chat to send messages to. It will listen for a message from you:
```
send /start to @my_takopi_bot (works in groups too)
waiting...
```
Open Telegram and send `/start` (or any message) to your bot. Takopi will capture the chat:
```
got chat_id 123456789 from @yourusername
sent confirmation message
```
!!! tip "Using Takopi in a group"
You can also send a message in a group where the bot is a member. Takopi will capture that group's chat ID instead. This is useful if you want multiple people to share the same bot.
## 8. Choose a conversation mode
Takopi asks how you want follow-up messages to behave:
```
? choose conversation mode:
chat mode (auto-resume; use /new to start fresh)
stateless (reply-to-continue)
```
**Chat mode** keeps one active thread per chat (per sender in groups). New messages continue automatically.
**Stateless** makes every message start fresh unless you reply to a resume line.
## 9. (Optional) Enable Topics
If you plan to use Telegram **forum topics**, Takopi will ask:
```
? will you use topics?
no, keep topics off
yes, in the main chat (this chat_id)
yes, in project chats (projects.<alias>.chat_id)
yes, in both main and project chats
```
Topics require a **forum-enabled supergroup** and the bot must have **Manage Topics** permission.
## 10. Choose resume line visibility
If you picked chat mode or enabled topics, Takopi asks whether to show resume lines:
```
? show resume lines in messages?
hide resume lines (cleaner chat; use /new to reset)
show resume lines (best for reply-to-continue)
```
Resume lines let you reply to older messages to branch a conversation.
## 11. Choose your default engine
Takopi scans your PATH for installed agent CLIs:
```
step 4: agent cli tools
agent status install command
───────────────────────────────────────────
codex ✓ installed
claude ✓ installed
opencode ✗ not found npm install -g opencode-ai@latest
pi ✗ not found npm install -g @mariozechner/pi-coding-agent
? choose default agent:
codex
claude
```
Pick whichever you prefer. You can always switch engines per-message later.
## 12. Save your config
Takopi shows you a preview of what it will save:
```
step 5: save configuration
~/.takopi/takopi.toml
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "123456789:ABC..."
chat_id = 123456789
session_mode = "chat"
show_resume_line = false
[transports.telegram.topics]
enabled = false
scope = "auto"
? save this config to ~/.takopi/takopi.toml? (yes/no)
```
Press **Enter** to save. You'll see:
```
config saved to ~/.takopi/takopi.toml
sent confirmation message
setup complete. starting takopi...
```
Takopi is now running and listening for messages!
## What just happened
Your config file lives at `~/.takopi/takopi.toml`:
```toml title="~/.takopi/takopi.toml"
default_engine = "codex" # new threads use this
transport = "telegram" # how Takopi talks to you
[transports.telegram]
bot_token = "..." # your bot's API key
chat_id = 123456789 # where to send messages
session_mode = "chat"
show_resume_line = false
[transports.telegram.topics]
enabled = false
scope = "auto"
```
This config file controls all of Takopi's behavior. You'll edit it directly for advanced features.
## Re-running onboarding
If you ever need to reconfigure:
```sh
takopi --onboard
```
This will prompt you to update your existing config (it won't overwrite without asking).
## Troubleshooting
**"error: missing takopi config"**
Run `takopi` in a terminal with a TTY. The setup wizard only runs interactively.
**"failed to connect, check the token and try again"**
Make sure you copied the full token from BotFather, including the numbers before the colon.
**Bot doesn't respond to /start**
If you're still in onboarding, your terminal should show "waiting...". If you accidentally closed it, run `takopi` again and restart the setup.
**"error: already running"**
You can only run one Takopi instance per bot token. Find and stop the other process, or remove the stale lock file at `~/.takopi/takopi.lock`.
## Next
Next, learn how conversation modes affect follow-ups.
[Conversation modes →](conversation-modes.md)
+356
View File
@@ -0,0 +1,356 @@
# Install and onboard
This tutorial walks you through installing Takopi, creating a Telegram bot, and generating your config file.
**What you'll have at the end:** A working `~/.takopi/takopi.toml` with your bot token, chat ID, workflow settings, and default engine.
## 1. Install Python 3.14 and uv
Install `uv`, the modern Python [package manager](https://docs.astral.sh/uv/):
```sh
curl -LsSf https://astral.sh/uv/install.sh | sh
```
Install Python 3.14 with uv:
```sh
uv python install 3.14
```
## 2. Install Takopi
```sh
uv tool install -U takopi
```
Verify it's installed:
```sh
takopi --version
```
You should see something like `0.18.0`.
## 3. Install agent CLIs
Takopi shells out to agent CLIs. Install the ones you plan to use (or install them all now):
### Codex
```sh
npm install -g @openai/codex
```
Takopi uses the official Codex CLI, so your existing ChatGPT subscription applies. Run `codex` and sign in with your ChatGPT account.
### Claude Code
```sh
npm install -g @anthropic-ai/claude-code
```
Takopi uses the official Claude CLI, so your existing Claude subscription applies. Run `claude` and log in with your Claude account. Takopi defaults to subscription billing unless you opt into API billing in config.
### OpenCode
```sh
npm install -g opencode-ai@latest
```
OpenCode supports logging in with Anthropic for your Claude subscription or with OpenAI for your ChatGPT subscription, and it can connect to 75+ providers via Models.dev (including local models).
### Pi
```sh
npm install -g @mariozechner/pi-coding-agent
```
Pi can authenticate via a provider login or use API billing. You can log in with Anthropic (Claude subscription), OpenAI (ChatGPT subscription), GitHub Copilot, Google Cloud Code Assist (Gemini CLI), or Antigravity (Gemini 3, Claude, GPT-OSS), or choose API billing instead.
## 4. Run onboarding
Start Takopi without a config file. It will detect this and launch the setup wizard:
```sh
takopi
```
You'll see:
```
step 1: bot token
? do you already have a bot token from @BotFather? (yes/no)
```
If you don't have a bot token yet, answer **n** and Takopi will show you the steps.
## 5. Create a Telegram bot
If you answered **n**, follow these steps (or skip to step 6 if you already have a token):
1. Open Telegram and message [@BotFather](https://t.me/BotFather)
2. Send `/newbot` or use the mini app
3. Choose a display name (the obvious choice is "takopi")
4. Choose a username ending in `bot` (e.g., `my_takopi_bot`)
BotFather will congratulate you on your new bot and will reply with your token:
```
Done! Congratulations on your new bot. You will find it at
t.me/my_takopi_bot. You can now add a description, about
section and profile picture for your bot, see /help for a
list of commands.
Use this token to access the HTTP API:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz
Keep your token secure and store it safely, it can be used
by anyone to control your bot.
```
Copy the token (the `123456789:ABC...` part).
!!! warning "Keep your token secret"
Anyone with your bot token can control your bot. Don't commit it to git or share it publicly.
## 6. Enter your bot token
Paste your token when prompted:
```
? paste your bot token: ****
validating...
connected to @my_takopi_bot
```
Takopi validates the token by calling the Telegram API. If it fails, double-check you copied the full token.
## 7. Pick your workflow
Takopi shows three workflow previews:
=== "assistant"
ongoing chat
<div class="workflow-preview">
<div class="msg msg-you">make happy wings fit</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 8s · step 3</div><div class="clearfix"></div>
<div class="msg msg-you">carry heavy creatures</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 12s · step 5</div><div class="clearfix"></div>
<div class="msg msg-you"><span class="cmd">/new</span></div><div class="clearfix"></div>
<div class="msg msg-you">add flower pin</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 6s · step 2</div><div class="clearfix"></div>
</div>
=== "workspace"
topics per branch
<div class="workflow-preview">
<div class="topic-bar"><span class="topic-active">happian @memory-box</span><span class="topic">takopi @master</span></div>
<div class="msg msg-you">store artifacts forever</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 10s · step 4</div><div class="clearfix"></div>
<div class="msg msg-you">also freeze them</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 6s · step 2</div><div class="clearfix"></div>
</div>
=== "handoff"
reply to continue
<div class="workflow-preview">
<div class="msg msg-you">make it go back in time</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 8s · step 3<br><span class="resume">codex resume <span class="id-1">abc123</span></span></div><div class="clearfix"></div>
<div class="msg msg-you">add reconciliation ribbon</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 3s · step 1<br><span class="resume">codex resume <span class="id-2">def456</span></span></div><div class="clearfix"></div>
<div class="msg msg-you"><div class="reply-quote">done · codex · 8s · step 3</div>more than once</div><div class="clearfix"></div>
<div class="msg msg-bot">done · codex · 8s · step 5<br><span class="resume">codex resume <span class="id-1">abc123</span></span></div><div class="clearfix"></div>
</div>
```
? how will you use takopi?
assistant (ongoing chat, /new to reset)
workspace (projects + branches, i'll set those up)
handoff (reply to continue, terminal resume)
```
Each choice automatically configures conversation mode, topics, and resume lines:
| Workflow | Best for | What it does |
|----------|----------|--------------|
| **assistant** | Single developer, private chat | Chat mode (auto-resume), topics off, resume lines hidden. Use `/new` to start fresh. |
| **workspace** | Teams, multiple projects/branches | Chat mode, topics on, resume lines hidden. Each topic binds to a repo/branch. |
| **handoff** | Terminal-based workflow | Stateless (reply-to-continue), resume lines always shown. Copy resume line to terminal. |
!!! tip "Not sure which to pick?"
Start with **assistant** (recommended). You can always change settings later in your config file.
## 8. Connect your chat
Depending on your workflow choice, Takopi shows different instructions:
**For assistant or handoff:**
```
step 3: connect chat
1. open a chat with @my_takopi_bot
2. send /start
waiting for message...
```
**For workspace:**
```
step 3: connect chat
set up a topics group:
1. create a group and enable topics (settings → topics)
2. add @my_takopi_bot as admin with "manage topics"
3. send any message in the group
waiting for message...
```
Once Takopi receives your message:
```
got chat_id 123456789 for @yourusername (private chat)
```
!!! warning "Workspace requires a forum group"
If you chose workspace and the chat isn't a forum-enabled supergroup with proper bot permissions, Takopi will warn you and offer to switch to assistant mode instead.
## 9. Choose your default engine
Takopi scans your PATH for installed agent CLIs:
```
step 4: default agent
takopi runs these agents on your computer. switch anytime with /agent.
engine status install command
───────────────────────────────────────────
codex ✓ installed
claude ✓ installed
opencode ✗ not found npm install -g opencode-ai@latest
pi ✗ not found npm install -g @mariozechner/pi-coding-agent
? choose default agent:
codex
claude
```
Pick whichever you prefer. You can always switch engines per-message with `/codex`, `/claude`, etc.
## 10. Save your config
```
step 5: save config
? save config to ~/.takopi/takopi.toml? (yes/no)
```
Press **y** or **Enter** to save. You'll see:
```
✓ setup complete. starting takopi...
```
Takopi is now running and listening for messages!
## What just happened
Your config file lives at `~/.takopi/takopi.toml`. The exact contents depend on your workflow choice:
=== "assistant"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "chat" # auto-resume
show_resume_line = false # cleaner chat
[transports.telegram.topics]
enabled = false
scope = "auto"
```
=== "workspace"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = -1001234567890 # forum group
session_mode = "chat"
show_resume_line = false
[transports.telegram.topics]
enabled = true # topics on
scope = "auto"
```
=== "handoff"
```toml title="~/.takopi/takopi.toml"
default_engine = "codex"
transport = "telegram"
[transports.telegram]
bot_token = "..."
chat_id = 123456789
session_mode = "stateless" # reply-to-continue
show_resume_line = true # always show resume lines
[transports.telegram.topics]
enabled = false
scope = "auto"
```
This config file controls all of Takopi's behavior. You can edit it directly to change settings or add advanced features.
[Full config reference →](../reference/config.md)
## Re-running onboarding
If you ever need to reconfigure:
```sh
takopi --onboard
```
This will prompt you to update your existing config (it won't overwrite without asking).
## Troubleshooting
**"error: missing takopi config"**
Run `takopi` in a terminal with a TTY. The setup wizard only runs interactively.
**"failed to connect, check the token and try again"**
Make sure you copied the full token from BotFather, including the numbers before the colon.
**Bot doesn't respond to /start**
If you're still in onboarding, your terminal should show "waiting...". If you accidentally closed it, run `takopi` again and restart the setup.
**"error: already running"**
You can only run one Takopi instance per bot token. Find and stop the other process, or remove the stale lock file at `~/.takopi/takopi.lock`.
## Next
Learn more about conversation modes and how your workflow choice affects follow-ups.
[Conversation modes →](conversation-modes.md)