Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Agent Keep ๐Ÿ 

Keep your CLI agents alive. 24/7. From your phone.

GitHub Platforms Channel

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡็‰ˆ


What is this?

Not another IM bridge. This is a persistent agent gateway.

Most "IM to AI" projects work like this:

User message โ†’ Start a process โ†’ Send prompt โ†’ Get response โ†’ Kill process

Agent Keep works differently:

Agent lives in tmux โ†’ 24/7 online โ†’ Phone sends message โ†’ 
Agent does real work (files, terminal, browser, desktop) โ†’ 
Responds with results โ†’ Context stays alive

The difference is fundamental:

Typical IM Bridge Agent Keep
Agent starts fresh every request Agent lives in tmux/ConPTY 24/7
Bridge manages conversation history Agent manages its own session naturally
Limited to API-accessible tools Full CLI, terminal, browser, desktop access
Timeout on long tasks Always-on, no timeout
One agent at a time 3+ agents running simultaneously
No Windows support โœ… Windows desktop API direct-connect

The 4 Bridges

Each bridge is a standalone, pip-installable package. Pick the agents you use.

Repository Layout

This repository now contains real bridge source code under packages/:

  • packages/claude-code-qq-bridge/
  • packages/codex-qq-bridge/
  • packages/agy-qq-bridge/

The top-level repo is the umbrella monorepo. Each bridge package keeps its own Python package metadata, entrypoints, and docs.

claude-code-qq-bridge โ€” The most mature bridge.

  • โœ… Approval buttons via QQ card messages
  • โœ… Session state monitoring (waitingFor detection)
  • โœ… JSONL incremental log reading (no ANSI garbage)
  • โœ… Auto-restart on crash, single-session keep-alive

codex-qq-bridge โ€” Simple, clean, multi-turn.

  • โœ… Multi-turn conversation with session continuation
  • โœ… Adaptive JSONL file binding
  • โœ… No approval interception (Codex handles it natively)

agy-qq-bridge โ€” Async log monitoring for Google Antigravity.

  • โœ… Fully async, no busy locks
  • โœ… Multi-part response support (one input โ†’ many replies)
  • โœ… Adaptive session file binding on /new

antigravity-qq-bridge-win โ€” Windows desktop remote AI workstation.

  • โœ… Direct API connection to language_server.exe (no PTY/ConPTY needed)
  • โœ… Dynamic process discovery (auto-detect port + CSRF token)
  • โœ… Model auto-sync from desktop GUI (settings.json)
  • โœ… Session persistence (conversation_id survives restarts)
  • โœ… UTF-8 forced output (no GBK crash on emoji)

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Your Phone                        โ”‚
โ”‚              (QQ / WeChat / Telegram / etc.)       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                       โ”‚
           โ–ผ                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          Agent Gateway (Bridge Layer)              โ”‚
โ”‚                                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚  โ”‚  Channel: QQ โ”‚    โ”‚ Channel: ... โ”‚  โ† Adapter   โ”‚
โ”‚  โ”‚  (reference) โ”‚    โ”‚ (next)       โ”‚   pattern    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚         โ”‚                   โ”‚                       โ”‚
โ”‚         โ–ผ                   โ–ผ                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
โ”‚  โ”‚         Runtime Layer                   โ”‚        โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚        โ”‚
โ”‚  โ”‚  โ”‚ tmux โ”‚ โ”‚ConPTYโ”‚ โ”‚ JSONLโ”‚ โ”‚Sessionโ”‚  โ”‚        โ”‚
โ”‚  โ”‚  โ”‚      โ”‚ โ”‚      โ”‚ โ”‚ Log  โ”‚ โ”‚State  โ”‚  โ”‚        โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ”‚        โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚        โ”‚        โ”‚        โ”‚
         โ–ผ        โ–ผ        โ–ผ        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Claude Code  โ”‚  Codex  โ”‚  AGY  โ”‚  AGY (Win)    โ”‚
โ”‚   (24/7 alive)  โ”‚ (24/7)  โ”‚ (24/7) โ”‚  (24/7)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚         โ”‚        โ”‚        โ”‚
         โ–ผ         โ–ผ        โ–ผ        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Computer Environment                      โ”‚
โ”‚  (Files, Terminal, Browser, Desktop Automation)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Design Principle: Channel Abstraction

Each bridge is a channel adapter + agent adapter:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        Bridge                โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ Channel   โ”‚ โ”‚ Agent   โ”‚  โ”‚
โ”‚  โ”‚ Adapter   โ”‚ โ”‚ Adapter โ”‚  โ”‚
โ”‚  โ”‚           โ”‚ โ”‚         โ”‚  โ”‚
โ”‚  โ”‚ โ€ข QQ WS   โ”‚ โ”‚ โ€ข tmux  โ”‚  โ”‚
โ”‚  โ”‚ โ€ข WeChat  โ”‚ โ”‚ โ€ข ConPTYโ”‚  โ”‚
โ”‚  โ”‚ โ€ข Telegramโ”‚ โ”‚ โ€ข PTY   โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Discord โ”‚ โ”‚         โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

QQ is the reference implementation. Switching to WeChat, Telegram, or Discord means changing the channel adapter only โ€” the agent runtime, session management, and output capture stay the same.


Why this matters

For individuals

You're running Claude Code / Codex / AGY on your server. You SSH in, type commands, wait. Can't check on long tasks from your phone. Context gets lost when you disconnect.

With Agent Keep:

  • Open QQ โ†’ Type "ๅธฎๆˆ‘ๆฃ€ๆŸฅๆœๅŠกๅ™จ" โ†’ Done โ†’ Reply comes back
  • Long-running task? Send a message anytime, it replies when ready
  • New session? /new resets, bridge auto-reconnects

For teams

  • Multiple agents running simultaneously on the same machine
  • Each agent has its own persistent session, never cross-contaminated
  • Windows machine acts as a remote AI workstation (browser, desktop, file ops)

For developers

  • Full CLI tool access โ€” not limited by API sandboxing
  • Agents can install packages, edit files, run scripts, control browsers
  • True persistent sessions mean no context window rebuilding

Quick Start

# Clone the monorepo
git clone https://github.com/zz327455573/agent-keep.git
cd agent-keep

# Pick any bridge package, install with pip:
pip install ./packages/claude-code-qq-bridge

# Or install another bridge package:
pip install ./packages/codex-qq-bridge
pip install ./packages/agy-qq-bridge

# Initialize (only asks for QQ Bot credentials)
claude-code-qq-bridge --init

# Run
claude-code-qq-bridge

Detailed instructions in each bridge's README.


Comparison: Agent Keep vs. Other Approaches

vs. "IM Bridge" (resume/replay pattern)

Most bridges start a new CLI process for each message, feed it the conversation history, and kill it after. This means:

  • Every request reloads the full context (slow, expensive)
  • Agent has no persistent state
  • No ongoing tool access

vs. API-based solutions (OpenAI API, etc.)

API-based agents are sandboxed โ€” they can't touch your files, run local scripts, or control your browser.

vs. SSH + tmux (manual)

Agent Keep is SSH + tmux, but automated. You don't need to SSH in, attach to a session, type commands, and watch output. The bridge handles all of that.


Roadmap

  • WeChat / Enterprise WeChat channel adapter
  • Telegram channel adapter
  • Feishu / Lark channel adapter
  • Discord channel adapter
  • Unified CLI: agent-keep start claude
  • Web dashboard: view all agents, session logs
  • Multi-user support
  • Docker deployment

Philosophy

CLI agents are the most capable AI tools we have. They run on our machines, have access to everything, and can do real work. The only thing missing is persistence โ€” they're stuck in a terminal, tied to an SSH session.

Agent Keep fixes that. It gives your agents a permanent home where they live, work, and wait for your instructions. From anywhere. From your phone.


License

MIT. Each bridge is independently licensed under MIT.


Made by @zz327455573 โ€” ็ซนๅฑฑๆ–‡่พพ้—จ็ช— / ไธชไบบAI Agentๅœจ็บฟๅŒ–

About

Keep your CLI agents alive. 24/7. From your phone. Persistent Agent Gateway for Claude Code, Codex, AGY (Linux + Windows).

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages