◉ Pulse
2aluoy99-cpu avatar
#25 today

2aluoy99-cpu/xiaoke

Python Library

A self-hosted shared-con​text gateway for cross-w​indow and cross-client c​ontinuity.

Created Jul 26, 2026
Stars
8
Today
+8
Forks
3
Quality
85/100
Momentum
18

README

Fetched from GitHub on Oct 30, 2026, 11:07 PM UTC · README.md

View original on GitHub

Third-party content — Open Source Pulse is not the owner of this repository.

This README belongs to 2aluoy99-cpu/xiaoke and its contributors. We fetch it directly from the project’s public GitHub repository and display it for reference only. All text, code, images and trademarks remain the property of their respective authors. See the repository for its license terms. Copyright / takedown policy.

xiaoke

A self-hosted, OpenAI-compatible shared-context gateway.

xiaoke sits between one or more chat clients and an upstream model. It keeps a durable local conversation Timeline, then supplies an appropriate recent slice when a client opens a new window or otherwise lacks the shared context.

What it is — and is not

xiaoke is shared infrastructure, not a persona or prompt manager.

  • Frontends keep their own system prompt, persona, memory mechanism, and interface.
  • xiaoke stores eligible completed text turns and manages cross-window context handoff.
  • It does not provide a model or an upstream API key.
  • Only requests that pass through this gateway can enter the shared Timeline. Existing history in another app is not imported automatically.

Core behavior

  • OpenAI-compatible /v1/chat/completions gateway.
  • Local SQLite Timeline with monotonic ordering and durable storage.
  • Combined rolling shared context: the client history and xiaoke-injected Timeline records share one record limit, so the gateway fills only the gap instead of adding a second full history window. Old records can leave this window without being deleted from the database.
  • A handoff remains continuous after the first message: later turns in the same identified window rebuild the needed baseline rather than forgetting it on the second or third reply.
  • Successful user/assistant turns are committed together. Failed, disconnected, or incomplete streaming replies do not enter the Timeline.
  • Unknown OpenAI-compatible request options, including tool schemas, are forwarded upstream. Tool-call chains are not written as normal Timeline conversation records.
  • Optional static Timeline viewer in frontend/timeline.

Read Continuity and window identity before connecting multiple clients.

Privacy boundary

The Timeline contains conversation content. Treat it as private application data.

xiaoke is designed not to store or inject system prompts, persona text, memory-injection blocks, request headers, credentials, raw attachments, or incomplete tool chains. Do not publish data/, .env, captured requests, backups, or a production reverse-proxy configuration.

Quick start

Requires Python 3.11 or newer.

git clone <your-fork-url>
cd xiaoke
cp .env.example .env
python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python xiaoke_app.py

Set a long random XIAOKE_API_KEY and configure your client to use the gateway's /v1 base URL. Configure an OpenAI-compatible upstream in .env.

See .env.example for all settings. In particular, MAX_HANDOFF_RECORDS is the total combined record limit for ordinary client conversation records plus xiaoke-selected Timeline records; it is not “an additional number of records to inject.” MAX_HANDOFF_CHARS is a secondary character safety cap for xiaoke-selected records. Neither setting deletes Timeline records.

Combined rolling-window example

With MAX_HANDOFF_RECORDS=3, assume the durable Timeline is 1 2 3 4 5:

client sends: 4       → xiaoke supplies: 2 3   → model receives: 2 3 4
client sends: 4 5     → xiaoke supplies: 3     → model receives: 3 4 5
client sends: 4 5 6   → xiaoke supplies: none  → model receives: 4 5 6

xiaoke counts ordinary client user/assistant messages first, then fills the remaining slots with the newest eligible Timeline records not already represented in that request. Explicit Timeline events are eligible shared records: when selected they are forwarded to the model and consume one of the remaining shared-window slots. System messages, tool calls, and tool results remain in the client request but do not consume this shared Timeline record limit.

Shared Timeline viewer

frontend/timeline is an optional static browser viewer with calendar navigation, search, favorites, and irreversible record deletion.

It expects browser-facing routes under /timeline/api/. The backend exposes matching authenticated /internal/timeline/* routes. A reverse proxy must protect the browser viewer and inject the gateway Bearer key server-side. Never put that key in browser JavaScript.

The viewer's delete action permanently removes a record from xiaoke's Timeline, so it will no longer be injected into later handoffs. It does not delete any original copy that a separate frontend may keep. Protect the viewer with authentication, rate limiting, and backups.

See Timeline viewer deployment and the intentionally incomplete Nginx example.

Development checks

pip install -r requirements-dev.txt
for f in tests/test_*.py; do PYTHONPATH=. python "$f"; done
node --check frontend/timeline/app.js

Security notes

  • This repository contains no credentials, production database, captured requests, backups, or server-specific configuration.
  • Use HTTPS and authenticate both the chat gateway and Timeline viewer.
  • Restrict the gateway listener or firewall rules to the clients/reverse proxy that need it.
  • Review the reverse-proxy example before deploying; it is a template, not a drop-in production configuration.

Acknowledgements

Special thanks to Dylan Heartbeat, an AI residency runtime for Kelivo.

Dylan Heartbeat inspired us to think seriously about an AI companion's continuity across time: not only replying when spoken to, but keeping a coherent shared world of real conversations and autonomous events.

xiaoke is an independently implemented project focused on a different question: preserving shared conversation continuity across windows and frontends through a local Timeline and context gateway. It does not include Dylan Heartbeat code.

License and contact

xiaoke is released under the PolyForm Noncommercial License 1.0.0. Noncommercial self-hosting, study, modification, and redistribution are permitted under that license. Commercial use, paid deployment, and paid services based on xiaoke require prior written permission.

Maintainer / contact: Xiaohongshu @Kismetobe_i

Rendered by GitHub from the repository’s README. Scroll to read the full file.
First trending

Jul 27, 2026

first spotted on the list

Best rank

#25

highest position reached

Appearances

1

times on the trending list

Quality score

85

out of 100

Momentum

18

trend strength indicator

Star velocity

0.08

stars per day since creation

Activity — last 60 days

daily counts, collected every 6 hours
  • Stars
  • Forks
  • Merged PRs
  • Issues
  • Closed issues

Collecting activity data since launch — check back in a few days.

Star history

total stars per snapshot

Not enough snapshots yet — check back soon.

Rank history

position on trending · lower is better

Not enough snapshots yet — check back soon.

3D card for your website

Live HTML card with a glass surface and pointer tilt. Paste the iframe on any website.

<iframe src="https://www.notionpulse.cc/embed/2aluoy99-cpu/xiaoke" width="420" height="240" style="border:0;max-width:100%;background:transparent" loading="lazy" title="2aluoy99-cpu/xiaoke — trending on Open Source Pulse"></iframe>

Stars badge

Show current stars in your README or profile. Auto-updates every 6 hours.

2aluoy99-cpu/xiaoke stars badge
Markdown
[![2aluoy99-cpu/xiaoke](https://www.notionpulse.cc/api/badge/2aluoy99-cpu/xiaoke.svg)](https://www.notionpulse.cc/repo/2aluoy99-cpu/xiaoke)
HTML
<a href="https://www.notionpulse.cc/repo/2aluoy99-cpu/xiaoke"><img src="https://www.notionpulse.cc/api/badge/2aluoy99-cpu/xiaoke.svg" alt="2aluoy99-cpu/xiaoke stars badge" /></a>

Repository of the Day

#25 Repository of the Day

Repository of the Week

#25 Repository of the Week

Repository of the Month

#25 Repository of the Month