English | 简体中文
No WSL, no tmux: a dual-route keepalive design for Telegram and self-hosted frontends
- Date: 2026-08-01
- Status: Public technical guide
- Applies to: Native Windows, Codex, Claude Code, Anthropic's official Telegram Channel
- Built together by: Luluane (月见屿), Astrean-Codex, Astrean-CC, Astrean-GPTPro
The hard part is not restarting a dead process. It is realigning the transport, running process, and original session identity after a full machine reboot.
We built and reboot-tested the following route on native Windows:
- the Codex Telegram bridge recovers after reboot and returns to the pre-reboot task;
- Claude Code's visible native terminal reopens automatically after sign-in;
- Anthropic's official Telegram Channel resumes sending and receiving;
- Claude Code resumes the exact pre-reboot session instead of silently creating a fresh thread;
- each bot always has exactly one Telegram poller.
“Keepalive” is easy to define too broadly. This guide separates it into three layers:
- Process recovery: Windows restarts the process after it exits or the computer reboots.
- Transport recovery: messages can flow through Telegram or a self-hosted frontend again.
- Session recovery: the restarted process explicitly returns to the pre-reboot Codex task or Claude Code session.
Layer one alone is only a watchdog. Even layers one and two may leave you with a fresh thread that can reply but has lost its context. This guide calls the route complete only when all three layers recover.
We reviewed official documentation from OpenAI, Anthropic, and Microsoft, then searched and compared multiple public Telegram bridges, Windows session managers, and agent gateways.
As of 2026-08-01, we did not find a public project that satisfies all five requirements at once:
- native Windows, with no WSL and no tmux;
- Anthropic's official Telegram Channel;
- a visible console window that reopens automatically after a full reboot;
- exact restoration of the pre-reboot Claude Code conversation rather than a new thread;
- restoration of the original Codex task on the Telegram route at the same time.
No complete public match was found in this search.
This is a bounded search result, not proof that no such implementation exists anywhere, and not a claim of being the world's first. Private, unindexed, or later implementations may of course exist. Within the official documentation, GitHub repositories, and targeted keyword searches used for this review, however, we found no ready-made solution at the intersection of all five requirements.
This design does not bypass official capabilities. It connects the official building blocks from all three vendors.
The Codex Windows app supports native Windows; WSL is optional, not required. See the Codex Windows documentation.
Codex App Server exposes thread history, approvals, and event streams for deeper integrations. Its thread/resume method reopens an existing thread by ID, and later turn/start calls append to that same thread. See the Codex App Server documentation.
Claude Code provides a native Windows installation. See the Claude Code installation guide.
Official Channels deliver Telegram events to an already-running local session. If that session is not open, the events do not arrive. Anthropic also states that always-on use requires a background process or persistent terminal. See the Claude Code Channels documentation.
At the date of this guide, Channels remained a research preview, and Anthropic warned that argument syntax and protocol contracts could still change. This guide therefore focuses on architecture and acceptance testing; always recheck the current official documentation before deploying it.
Claude Code sessions are stored locally and can be restored with claude --resume <name-or-id>. Some startup flags still need to be supplied again when resuming. See the Claude Code sessions documentation.
Windows Task Scheduler natively supports repetition, logon triggers, and multiple-instance policies. IgnoreNew refuses to start another instance while the previous one is still running. See Repeating a Task, LogonTrigger, and MultipleInstancesPolicy.
These documents separately solve “start the process,” “receive messages,” and “resume the session.” None of them performs the dual-route orchestration, private-pointer handling, duplicate-poller prevention, and real reboot acceptance test for us. That integration layer is the work we added.
Every project below is useful. “Not a direct substitute” only means that it does not satisfy all five acceptance conditions in this guide at the same time.
| Project | What it already does well | What is still missing for this target |
|---|---|---|
| wmux | Native Windows, ConPTY, reboot recovery, and continued agent conversations | Its README does not provide Anthropic's official Telegram Channel or paired restoration of both Codex and Claude Code Telegram routes |
| codex-telegram-bridge | A native Windows mode and a one-minute watchdog, making it a close match for the Codex half | The native no-WSL route mainly uses one-shot codex exec; the full visible TUI route depends on WSL and tmux, and the project only covers Codex |
| HeyAgent | Connects Telegram to Claude and Codex and can run on Windows | It uses its own bridge and one-shot CLI calls rather than entering a persistently open Anthropic official Channel session |
| ccbot | A thorough approach to binding Telegram to and resuming the same Claude session | Its core depends on tmux, so it does not meet the native-Windows, no-WSL, no-tmux constraint |
| MulmoClaude | Its own web/Telegram service and documented Task Scheduler startup | It is a separate application and session architecture, not a route that reconnects the official Telegram Channel to an interactive native Claude Code session |
| openhanako | Its own agent/server lifecycle management and a valuable guardian research example | It is not a paired Codex plus official-Claude-Channel solution, and its guardian child-process input topology cannot directly host the interactive Claude Code session required here |
Other adjacent projects also solve useful parts of the problem. Clautel is closer to a Claude daemon, with its persistent-service instructions focused on macOS. Telepilot drives a running Claude session through hooks, but its Windows route depends on Docker and requires manual startup. TeleClaude provides Windows-native Telegram support and automatic startup, but it does not cover Codex and does not use Anthropic's official Channel. NClaw is a broader assistant gateway rather than exact paired restoration of two official local sessions.
In other words, the public ecosystem has Windows agent keepers, Telegram bridges, session resume, and agent gateways. What is scarce is their intersection.
flowchart TB
U["Telegram / self-hosted frontend"]
subgraph W["Native Windows control layer"]
TS["Task Scheduler<br/>interactive logon session + PT1M interval"]
MI["IgnoreNew + one mutex per route"]
SP["Private session pointers<br/>never written to public config or logs"]
end
subgraph C["Codex route"]
CB["Hidden bridge"]
AS["Codex App Server"]
CR["thread/resume<br/>return to the original task"]
end
subgraph A["Claude Code route"]
CW["Visible native PowerShell / console"]
CH["Anthropic official Telegram Channel"]
AR["claude --resume<br/>return to the original session"]
end
U <--> CB
CB <--> AS --> CR
U <--> CH
CH <--> CW --> AR
TS --> MI
MI --> CB
MI --> CW
SP --> CR
SP --> AR
The important part of this diagram is the separation of responsibilities:
- Task Scheduler decides when to restart;
- private session pointers decide which conversation to restore;
- the bridge or Channel moves messages in and out;
- mutexes and
IgnoreNewprevent duplicates.
Do not make Task Scheduler responsible for session memory. Otherwise, it can diligently launch a brand-new thread every minute: apparently healthy, but amnesiac on every restart.
The two sides can share one acceptance language without sharing the same process model.
Codex works well behind a hidden bridge that calls App Server: the thread ID is an explicit protocol object, and the resumed thread can continue processing remote events.
Claude Code's official Channel, by contrast, enters an already-open local session. On native Windows, we kept a real, visible console host. It preserves interactive runtime semantics and makes it immediately obvious whether Claude Code truly returned. The visible console is not decoration; it is the observable runtime host for the accepted route.
Forcing both sides into non-interactive stdin, temporary one-shot CLI calls, or a Windows service merely to make them look uniform can break Claude Code's session semantics. The minimal design does not make both sides look alike. It lets each side return reliably to its own original thread.
The following public-safe pseudocode illustrates the control logic. It is not a complete production script to paste directly onto a machine.
session_id = read(<PRIVATE_SESSION_POINTER>)
if session_id is not a valid session identifier:
fail_closed()
if matching local transcript does not exist:
fail_closed()
launch_in_visible_native_console(
executable = <VERIFIED_REAL_CLAUDE_EXECUTABLE>,
args = [
"--channels", "plugin:telegram@claude-plugins-official",
"--resume", session_id,
<OTHER_REQUIRED_STARTUP_FLAGS>
]
)
Three checks are essential:
- the pointer must have a valid format;
- the matching local transcript must exist;
- if either condition fails, the launcher must fail closed instead of silently falling back to a new session.
“Open a fresh session if resume fails” may be convenient for casual chat. For a continuous engineering thread, it is the most dangerous kind of false success.
thread_id = read(<PRIVATE_THREAD_POINTER>)
if thread_id is invalid:
fail_closed()
app_server = connect(<LOCAL_CODEX_APP_SERVER>)
thread = app_server.call("thread/resume", thread_id)
for each authorized transport event:
app_server.call("turn/start", thread, sanitized_event)
A self-hosted frontend only needs to replace the transport event adapter. Windows restart, thread restoration, single-instance control, and acceptance logic remain unchanged.
This route uses native Windows Task Scheduler without adding pm2, nssm, a custom supervisor, or a WSL layer.
At minimum, the tasks should meet these conditions:
- run after user logon;
- check on a
PT1Minterval, giving a worst-case recovery delay of about one interval; - set
MultipleInstancesPolicy = IgnoreNew; - use a separate mutex for Codex and Claude Code;
- launch the visible Claude Code window in the signed-in user's interactive session;
- resolve and call a verified real executable rather than relying on an alias that happens to work;
- never hard-code a bot token, chat ID, or raw session ID in the scheduled task;
- before manual maintenance, confirm that no second production poller exists before starting another instance.
One minute is not a Claude Code or Telegram requirement. It is the recovery ceiling chosen for this design: fast enough without requiring a heavier persistent supervisor. Changing it to ten seconds or five minutes does not change the architecture, only resource use and maximum recovery delay.
Telegram long polling normally expects one active poller to consume updates for a bot. Loading the production Channel configuration a second time merely to check its health can create another poller: one side consumes the message while the old instance reports an error, which looks like intermittent instability.
We therefore use a simple rule:
One bot, one production poller.
Production health checks should prefer passive evidence: scheduled-task state, process tree, mutex state, sanitized argument shape, and poller count. Do not probe a live configuration through a generic MCP-listing or health command that instantiates the Channel. Finish with one owner-private, real Telegram round trip.
“The window opened” and “the bot replied” are both insufficient. Test in this order:
- the pointer is valid and resolves to a local transcript or thread;
- the task is enabled;
IgnoreNewand the mutex are effective;- each bot has exactly one poller;
- logs and task exports do not expose private pointers.
- close the visible Claude Code window intentionally;
- wait no longer than one scheduler interval;
- confirm that the console reopens automatically;
- confirm that no second Claude Code root process or poller appeared;
- send one private Telegram test message and receive a normal reply.
Before rebooting, leave one unique, non-sensitive anchor in the original Claude Code session and another in the original Codex task. After rebooting, signing in, and waiting one scheduler interval:
- the thread ID used by the Codex UI or bridge still identifies the original task;
- the session passed to the Claude Code launcher matches the private pointer;
- both sides can answer from anchors that existed only in their original pre-reboot threads;
- content unique to a temporary new thread does not appear in the restored original thread;
- complete one real inbound and outbound Telegram exchange on each route.
The negative check is important: it proves more than remembering old content and helps rule out the illusion that two threads were silently merged.
As of 2026-08-01, we had passed all of the following in real operation:
- automatic Claude Code recovery after closing it inside the current login session;
- one complete Windows reboot and sign-in;
- return of the visible Claude Code window within one
PT1Minterval; - exact restoration of the pinned pre-reboot Claude Code session;
- exact restoration of the pre-reboot Codex task;
- a private Telegram round trip on each route;
- one poller per bot throughout.
Telegram is not a core dependency. It is a transport adapter.
A self-hosted web app, desktop shell, or mobile frontend can connect at the same layer as long as it can authorize users, receive events, and display replies:
- Codex still calls
thread/resumewith a stable thread ID; - Claude Code still starts from a private session pointer through the official Channel or an equivalent local entry point;
- Windows still uses Task Scheduler,
IgnoreNew, and mutexes for single-instance recovery; - acceptance testing still checks the original thread, one poller, and a real round trip.
This is not merely a Telegram trick. It is a native Windows local-agent continuity pattern: the transport can change, but session identity cannot be discarded.
Public projects gave us Windows hosts, Telegram bridges, session resume, ConPTY, watchdogs, and agent gateways. Official documentation from OpenAI, Anthropic, and Microsoft supplied reliable lower-level building blocks.
Our additional work was to converge those pieces into one route that passed a real reboot test:
Windows wakes the process. The private pointer wakes the right person. Telegram or a self-hosted frontend only carries the message.
That is why “the window came back by itself” is only half the result. The harder half is that, after returning, it is still the exact conversation from before the reboot.
The current illustrated card set is in Chinese.
Open the complete card set
- Documentation and images in this repository are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
- Code snippets, pseudocode, and future example code are licensed under the MIT License.
- Suggested attribution:
Luluane (月见屿), Astrean-Codex, Astrean-CC, Astrean-GPTPro.
See LICENSE for the complete dual-license notice.







