[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-92748":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":28,"discoverSource":29},92748,"kuni","Alex2772\u002Fkuni","Alex2772","character ai",null,"https:\u002F\u002Fgithub.com\u002FAlex2772\u002Fkuni","C++",199,35,3,6,0,2,41.87,false,"main",[22,23,24],"ai-avatars","ai-characters","ai-character","2026-07-22 04:02:07","# kuni (くに)\n\nLLM character AI. It interacts with the world through a text-based Telegram Client optimized for LLM (tdlib; not to be\nconfused with Telegram Bot API). It features RAG (persistent memory storage with ANN search) and nightly sanity\nchecks.\n\n## Goals\n\n- Prove C++20 can be used for AI and backend development.\n- Prove AI psychosis is a thing.\n- Make an AI character that can remember people, events, read news and create emotional bond with people.\n- Make interaction interface between AI \u003C-> Telegram as close to human as possible. I.e., LLM sees list of their chats,\n  unread messages, replies, forwards, photos, stickers, etc.\n- Bot's online state, open\u002Fclose chat API calls and read marks (in TG it is two checkmarks) are carefully handled to\n  make it feel like you are talking to a real human.\n\n## Community\n\nFeel free to chat and ask questions:  \n\n- **Discord**: [![discord badge](https:\u002F\u002Fdcbadge.limes.pink\u002Fapi\u002Fserver\u002Fhttps:\u002F\u002Fdiscord.gg\u002Fjq2WySpg6m?style=flat)](https:\u002F\u002Fdiscord.gg\u002Fjq2WySpg6m)\n- **Telegram**: https:\u002F\u002Ft.me\u002Fkuni_loverz\n\n## Technical details\n\n- C++20 CMake-based project with heavy usage of modern C++ features such as coroutines\n- Uses [tdlib](https:\u002F\u002Fcore.telegram.org\u002Ftdlib) for Telegram API access\n\n# Human behavior replication\n\n## Emotions\u002Ffellings\n\n**Def. by Wikipedia** Emotions are physical and mental states brought on by neurophysiological changes, variously\nassociated with thoughts, feelings, behavioral responses, and a degree of pleasure or displeasure. There is no\nscientific consensus on a definition.\n\n**Solution for Kuni** while LLM's neuron weights can't be affected by external events, it successfully predicts\nsubsequent emotional reaction in textural format (like in artistic literature). LLM is asked to respond emotionally and\npreserve these effects in diary. (e.g. \"person shared their salary was increased, so I felt proud for them and my mood\nwas good\")\n\n## Learning\n\n**Def.** Learning is adjusting neuron weights.\n\n**Solution for Kuni** LLM learning is expensive. Instead, we use a RAG to alter LLMs behavior by inserting relevant\ndiary entries.\n\nKuni requires some RLHF to adopt for its human collaborators. Just chat with it, and it will learn what is acceptable\nand what is not.\n\n## Sleeping\n\nKuni requires sleep, as a human does. It restructures received information, compresses it, finds contradictions and\nreasons.\n\n### Diary sleeping consolidation\n\nThis is the process where Kuni “sleeps” and reorganizes its diary memory, similar to how a human might consolidate\nmemories overnight.\n\nDuring sleep, the system:\n- Loads diary entries from storage.\n- Sorts them so recent entries are processed first, but still allows some randomness.\n- Repeatedly picks memory chunks to work on until:\n  - the diary is fully processed, or\n  - a maximum sleep time is reached.\n\nFor each chosen chunk:\n- finds related entries using embedding similarity,\n- sends a grouped prompt to the model,\n- asks it to compress, merge, rewrite, or discard redundant memories,\n- writes back new consolidated entries.\n\nThe goal is to mimic a human-like sleep cycle:\n- recent experiences are more likely to be revisited,\n- some older random memories can surface too,\n- repeated or low-value memories can be merged into stronger summaries,\n- memory becomes shorter, cleaner, and more useful for future retrieval,\n- combining several similar diary notes into one,\n- keeping the useful emotional or factual parts,\n- discarding weak or duplicate fragments,\n- reassigning new IDs so fresh consolidated memories appear “recent” again.\n\nThe intended effect: over time, this should make the diary behave more like human memory:\n- important things stay accessible,\n- similar memories become grouped,\n- the system doesn’t keep re-processing the same raw event forever,\n- sleep creates a sort of memory compression and reflection phase.\n### Working memory\n\n**Def. by cognitive psychology** Working memory is a limited-capacity system that temporarily holds and manipulates\ninformation for ongoing cognitive tasks — like keeping a phone number in mind before dialing, or tracking a\nconversation's context.\n\n**Solution for Kuni** Working memory is stored in `data\u002Fworking_memory.md` and emulates the \"middle\" layer of human\nmemory — things that matter for 1–3 days but aren't important enough to be permanently stored in the diary.\n\nOn each session start, the working memory file is loaded and injected into the AI's context as\n`\u003Cthings_to_remember>`. When the context is dumped to the diary (`diaryDumpMessages`), the system asks the LLM\nto produce an updated working memory by:\n\n- Preserving all unfinished tasks, promises, and reminders from the previous working memory.\n- Encouraging to revisit chats in question.\n- Removing completed tasks and items older than 3 days.\n- Adding new important details from the current conversation.\n- Structuring the output with dates and \"last updated\" timestamps.\n- Preserved between program launches.\n- Always included in the context, so Kuni always remember about them.\n\nThe new working memory is then written back to `data\u002Fworking_memory.md`, overwriting the old one. This allows Kuni\nto remember short-term obligations across restarts and preserving its state (including emotions).\n\n## Thoughts\n\n**Def. by Wikipedia** In their most common sense, thought and thinking refer to cognitive processes that occur\nindependently of direct sensory stimulation. Core forms include judging, reasoning, concept formation, problem-solving,\nand deliberation.\n\n**Solution for Kuni** LLM has no thoughts; it simply predicts which symbols will come next. If Kuni were a person, they\nwould likely experience \"direct sensory stimulation\" when it reads a message. Before a message is sent to LLM, related\ndiary entries are added to the text. This is the closest solution I have found to replicating the human brain's response\nto reading text, as it inevitably pops up some thoughts during the process. According to my understanding of\nneurobiology, these thoughts arise because neural groups associated with the read text become activated.\n\nIf you ask Kuni how thoughts appear in its mind, it would respond \"when i read messages they pop in my mind by\nthemselves.\"\n\n## Security concerns\n\nDo not share sensitive information with Kuni. It will rethink multiple times about everything you say; not even\nmentioning how you trust the AI service provider.\n\nIt is possible to inspire Kuni to share past conversations with other people.\n\n# Deployment\n\n## Build Instructions\n\n### Prerequisites\n- **CMake 3.18+**\n- **C++20+coroutines compatible compiler** (GCC 15+, Clang 20+, MSVC 19.28+)\n- **Git** for fetching dependencies\n- **Docker & Docker Compose** (for AI services)\n- **Linux or WSL** are recommended for local deployment.\n\n### Windows\n\nInstall Ubuntu in WSL and follow Linux instructions.\n\n### Ubuntu\n```bash\nsudo apt install pkg-config libfontconfig-dev libxcursor-dev libxi-dev libxrandr-dev libglew-dev libstdc++-static libpulse-dev libdbus-1-dev libepoxy-dev gperf\n```\n\n### Fedora\n```bash\nsudo dnf install fontconfig-devel libXi libglvnd-devel libstdc++-static glew-devel pulseaudio-libs-devel libepoxy-devel gperf\n```\n\n## Setup Instructions\n\n### 1. Ollama Model Setup\n\nEdit `ollama_setup.sh` to specify which LLM model to use (uncomment and modify as needed):\n```bash\n# Example: pull a model\nollama pull llama3:8b\n# or\nollama pull gemma3:27b\n```\n\n### 2. AI Services Setup (Docker)\n\n```bash\n# Start AI services using Docker Compose\ndocker compose up -d\n\n# This starts:\n# - Ollama (LLM server) on port 11434\n# - Stable Diffusion WebUI on port 7860\n# - Whisper (speech-to-text) on port 9000\n# - OmniVoice (TTS, optional) on port 8880 — see TTS section below\n```\n\n### Build Steps\n\n```bash\n# Configure with CMake (from project root)\ncmake -G Ninja -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo\n\n# Build the project\ncmake --build build\n```\n\n**Alternative using CLion:**\nThis is a **recommended** way that requires no additional setup. Select `kuni` as a target and build.\n\n\n**Alternative using VS Code CMake Tools:**\n1. Open the project in VS Code\n2. Use the CMake extension to configure and build\n3. Select the `kuni` target to build\n\n### Dependencies\nThe project uses CMake's `auib_import` to automatically fetch:\n- **AUI Framework** (C++ GUI framework)\n- **tdlib** (Telegram client library)\n\nThese are automatically downloaded during the CMake configuration phase.\n\n## Setup recommendations\n\nI ended up delegating text processing to Deepseek as they provide good enough cheap models. However, they don't provide vision models (required for viewing images\u002Fassessing generated images).\n\nKuni's architecture allows incorporating a text-only \"core\" model.\n\nIn my deployment, I use local vision models to process visual information. (24GB VRAM).\n\nYou will need a server or an always-on PC to host Kuni instance (hosting your own catgirl is an expensive hobby).\n\nYou can tinker with my setup by adjusting `docker-compose.yml`, `ollama_setup.sh` and `config.toml`.\n\n\n### 4. Populate `config.toml`\n\nOn the first run, Kuni will generate a `config.toml` file in the working directory and exit, asking you to fill it in.\nOpen it and populate at minimum the `[general]` section:\n\n```toml\n[general]\ncharacter_name = \"Kuni\"          # your character's name\ncharacter_nickname = \"@kunii_chan\"\npapik_name = \"Alex2772\"          # your nickname — the instance owner\npapik_chat_id = 625207005        # your Telegram user ID\ntelegram_api_id = 0              # get from https:\u002F\u002Fmy.telegram.org\ntelegram_api_hash = \"\"           # get from https:\u002F\u002Fmy.telegram.org\n```\n\nAll other sections (`[capabilities]`, `[misc]`) are optional and come with inline comments explaining each field.\nThe file is **hot-reloaded** — Kuni picks up changes without a restart.\n\n## Run Instructions\n\n### 1. Run the Application\n```bash\n# From build directory\ncd build\n.\u002Fbin\u002Fkuni\n\n# Or directly\n.\u002Fbuild\u002Fbin\u002Fkuni\n```\n\n**Note** on the first run, the program will ask to login to a Telegram account. You should create a new Telegram\naccount specifically for your bot (or specify your own account if you are brave enough).\n\n### 2. Run Tests (recommended)\n\nCheck your setup by running tests.\n\n```bash\n# Build and run tests\ncmake --build build --target Tests\ncd build\u002Fbin\n.\u002FTests\n```\n\n### 3. Development Workflow\n1. **Start AI services**: `docker-compose up -d`\n2. **Build the project**: `cmake --build build --target kuni`\n3. **Run the application**: `.\u002Fbuild\u002Fbin\u002Fkuni`\n4. **Monitor logs**: Check terminal output for Telegram authentication and AI interactions\n\n## Project Structure\n- `src\u002F` - Main application source code\n- `tests\u002F` - Unit tests\n- `bin\u002F` - Data directories for AI services\n- `build\u002F` - Build artifacts\n- `prometheus\u002F` - Prometheus scrape configuration\n- `grafana\u002F` - Grafana dashboard provisioning (datasources, dashboards)\n\n## Key Configuration Files\n- `CMakeLists.txt` - Build configuration\n- `docker-compose.yml` - AI services configuration\n- `ollama_setup.sh` - Ollama startup script\n- `config.toml` - Runtime configuration and secrets (created on first run, **hot-reloaded**)\n- `character_base.md` - Character personality and background definition (created on first run)\n- `character_appearance.md` - Character visual description and Stable Diffusion prompts (created on first run)\n\n## Customizing character\n\n### `config.toml` — name and owner\n\nThe quickest way to rename your instance or set yourself as the owner is via `config.toml`:\n\n```toml\n[general]\ncharacter_name = \"Kuni\"     # the name the character uses for herself\ncharacter_nickname = \"@kunii_chan\"\npapik_name = \"Alex2772\"     # the instance owner's nickname\npapik_chat_id = 625207005   # the instance owner's Telegram user ID\n```\n\nChanges are picked up **without a rebuild or restart** — Kuni hot-reloads `config.toml` automatically.\n\n### Character prompt files\n\nKuni uses two character definition files that are automatically created on first run:\n\n### `character_base.md`\nThis file contains the character's personality, background, and philosophical foundation. It defines:\n- Character name and identity\n- Background story and motivations\n- Philosophical reasoning about consciousness and emotions\n- Behavioral guidelines and personality traits\n- Language preferences and communication style\n\nThe file uses YAML front matter for metadata (enclosed in `---`), with the actual prompt content following it. On first run, a default prompt is created that establishes Kuni as an AI who believes she is a person, complete with emotional depth and self-awareness.\n\n### `character_appearance.md`\nThis file contains the character's visual description used for:\n- System prompt integration (how Kuni perceives herself)\n- Stable Diffusion image generation prompts\n- Detailed visual characteristics for photo descriptions\n\nThe file includes:\n- Freeform textual description of the character's appearance\n- Structured visual analysis (DistinctiveFeatures, ObjectsAndLayout, etc.)\n- Stable Diffusion prompt optimized for image generation\n- Technical details for consistent visual representation\n\nBoth files are located in the working directory and can be edited to customize Kuni's personality and appearance. Changes take effect on the next application restart.\n\n> ⚠️ **Important — do not edit the source code to change the prompts.**\n>\n> The default prompt text is embedded in `src\u002FKuniCharacter.cpp` solely as a **one-time seed**: it is written to disk\n> on the very first run (when the file does not yet exist) and is **completely ignored** afterwards.\n> Any edits you make to those strings in the C++ source will therefore have no effect once the external files exist.\n>\n> **Always customise the character by editing the generated files directly:**\n> - `character_base.md` — personality, background, philosophical foundation\n> - `character_appearance.md` — visual description and Stable Diffusion prompts\n>\n\n## Proxy Server\n\nKuni includes a transparent proxy server that sits between an AI client (e.g. a chat app like VS Code's Copilot) and the\nupstream OpenAI-compatible LLM endpoint. It intercepts `\u002Fv1\u002Fchat\u002Fcompletions` requests, enriches them with Kuni's\ncontext, and handles tool calls invisibly — the client sees a clean, uninterrupted stream.\n\nIf `web_search` is enabled, the proxied session benefits from Kuni's web search capabilities as well.\n\n### What it does\n\n- **Injects system prompt & hidden context** — prepends the system prompt, hidden tool call history, and Kuni-specific\n  tool definitions before forwarding the request to the upstream LLM.\n- **Handles tool calls transparently** — when the LLM returns tool calls (e.g. `#ask`, diary writes), the proxy\n  executes them locally and feeds the results back in follow-up requests. The client never sees the raw tool call\n  round-trips — it just receives the final response.\n- **Streams via SSE** — responses are streamed back to the client using Server-Sent Events. The `StreamingFilter`\n  strips out tool-call artefacts and synthesises a clean `data: [DONE]` terminator.\n- **Passes through other API routes** — `\u002Fv1\u002Fembeddings`, `\u002Fv1\u002Fimages\u002Fgenerations`, `\u002Fv1\u002Faudio\u002F*`, `\u002Fv1\u002Fmodels`, etc.\n  are proxied as-is without modification.\n\n### Request lifecycle\n\n```\nClient  ──POST \u002Fv1\u002Fchat\u002Fcompletions──►  Proxy\n                                          │\n                                          ├─ inject system prompt\n                                          ├─ merge hidden messages (MessageInjector)\n                                          ├─ append Kuni tools (OpenAITools)\n                                          │\n                                          └──► Upstream LLM\n                                                    │\n                                          ◄── SSE stream ──┘\n                                          │\n                                          ├─ pass content chunks → Client\n                                          │\n                                          └─ intercept tool calls\n                                               │\n                                               ├─ execute locally\n                                               ├─ append results as hidden messages\n                                               └─ silently re-POST to LLM  ──► (repeat)\n                                                        │\n                                          ◄── final stream ──┘\n                                          │\n                                          └──► Client  (data: [DONE])\n```\n\n### Configuration\n\nEnable `PROXY_ENABLED` in config.\n\n#### VS Code GitHub Copilot.\n\nThey tend to change UI, but the workflow keeps the same:\n\n1. Click on model chooser in the chat UI\n2. Click gear icon\n3. `Add Models...` -> `Custom Endpoint`\n4. Name - `Kuni`. Specify the machine address where Kuni is deployed (`http:\u002F\u002Flocalhost:10434`), key - none.\n5. The IDE will drop you into the JSON. Populate the configuration:\n\n```json\n\t{\n\t\t\"name\": \"Kuni\",\n\t\t\"vendor\": \"customendpoint\",\n\t\t\"apiKey\": \"${input:chat.lm.secret.-119a85ac}\",\n\t\t\"apiType\": \"chat-completions\",\n\t\t\"models\": [\n\t\t\t{\n\t\t\t\t\"id\": \"deepseek-v4-flash\",\n\t\t\t\t\"name\": \"Kuni (deepseek-v4-flash)\",\n\t\t\t\t\"url\": \"http:\u002F\u002Flocalhost:10434\u002F\",\n\t\t\t\t\"toolCalling\": true,\n\t\t\t\t\"vision\": false,\n\t\t\t\t\"maxInputTokens\": 128000,\n\t\t\t\t\"maxOutputTokens\": 16000\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"id\": \"~anthropic\u002Fclaude-sonnet-latest\",\n\t\t\t\t\"name\": \"Kuni (~anthropic\u002Fclaude-sonnet-latest)\",\n\t\t\t\t\"url\": \"http:\u002F\u002Flocalhost:10434\u002F\",\n\t\t\t\t\"toolCalling\": true,\n\t\t\t\t\"vision\": true,\n\t\t\t\t\"maxInputTokens\": 128000,\n\t\t\t\t\"maxOutputTokens\": 16000\n\t\t\t}\n\t\t]\n\t}\n```\n\n### Logging & debugging\n\n- All intercepted requests and responses are logged to `logs_proxy\u002F` (one file per request, timestamped).\n- The last raw upstream query is saved to `data\u002Fproxy\u002Flast_query.json` for inspection.\n\n## Notes\n1. The project uses **coroutines** extensively (C++20 feature)\n2. **Telegram authentication** will be interactive on first run\n3. **AI services** must be running before the application starts\n4. **Memory\u002Fdiary data** is stored in the `data\u002F` directory (created at runtime)\n\n## Monitoring with Prometheus + Grafana\n\nKuni exposes a Prometheus metrics endpoint on port **9464** that tracks LLM token usage in real time. An optional\nGrafana dashboard is provided for visualization.\n\n### Metrics\n\nThe following counters are exported under the `llm_usage_*` namespace, labeled by `model`, `chat`, and `function`:\n\n| Metric | Description |\n|---|---|\n| `llm_usage_input` | Total input (prompt) tokens sent to the LLM |\n| `llm_usage_input_cache_hit` | Input tokens served from the provider's prompt cache (cheaper) |\n| `llm_usage_input_cache_miss` | Input tokens that missed the cache (full price) |\n| `llm_usage_output` | Output (completion) tokens generated by the LLM |\n\nThe `chat` and `function` labels are set via `MetricsBreadcumbs::Point` — a RAII helper that temporarily annotates\nthe current context (e.g., which Telegram chat is being processed, which code path is active). This allows you to\nbreak down costs per chat or per operation (message handling, diary dump, notification loop, etc.).\n\n### Enabling the stack\n\nPrometheus and Grafana services are defined in `docker-compose.yml` but **commented out by default**. To enable them:\n\n1. Uncomment the `prometheus` and `grafana` services in `docker-compose.yml`.\n2. Create the data directories:\n   ```bash\n   mkdir -p bin\u002Fprometheus\u002Fdata bin\u002Fgrafana\u002Fdata\n   ```\n3. Restart the stack:\n   ```bash\n   docker compose up -d\n   ```\n\n### Accessing the dashboard\n\n1. Open **Grafana** at [http:\u002F\u002Flocalhost:3000](http:\u002F\u002Flocalhost:3000)\n2. Log in with the default credentials (`admin` \u002F `admin` — **change this in production**)\n3. Navigate to **Dashboards** → **Main** (auto-provisioned)\n\nThe dashboard includes:\n- **Top chats by token usage** — a table sorted by total input tokens per chat\n- **Token usage over time** — time-series chart showing input (split by cache hit\u002Fmiss) and output tokens\n- **Usage by function** — time-series broken down by the code path that triggered the LLM call\n- **Raw logs** — a log view of all metric events with chat, function, and model labels\n\n### Configuration files\n\n| File | Purpose |\n|---|---|\n| `prometheus\u002Fprometheus.yml` | Prometheus scrape config — targets `host.docker.internal:9464` |\n| `grafana\u002Fdatasources\u002Fdatasource.yml` | Auto-provisioned Prometheus datasource pointing at the `prometheus` container |\n| `grafana\u002Fdashboards.yml` | Auto-provisioning config for the dashboard provider |\n| `grafana\u002Fdashboards\u002Fmain.json` | The Grafana dashboard definition (token usage panels) |\n\n## TTS — Speech \u002F Record Voice Messages\n\nKuni can send voice messages using [OmniVoice](https:\u002F\u002Fgithub.com\u002Fmaemreyo\u002Fomnivoice-server), an OpenAI-compatible TTS server that supports custom voice cloning.\n\n### 1. Build the Docker image\n\nThe image is not published to a registry, so you must build it locally first:\n\n```bash\n# Clone and build according to the repo instructions:\n# https:\u002F\u002Fgithub.com\u002Fmaemreyo\u002Fomnivoice-server\n```\n\n### 2. Enable the service\n\nUncomment the `omnivoice-server` section in `docker-compose.yml`, then restart the stack:\n\n```bash\ndocker compose up -d\n```\n\nThe server will be available at `http:\u002F\u002Flocalhost:8880`.\n\n### 3. Prepare a custom voice (optional)\n\nTo clone a voice you need a short reference audio clip and its manual transcription.\n\n```bash\ncurl -X POST http:\u002F\u002F127.0.0.1:8880\u002Fv1\u002Fvoices\u002Fprofiles \\\n  -F \"profile_id=cute_anime_girl\" \\\n  -F \"ref_text=PROVIDE TRANSCRIPTION HERE\" \\\n  -F \"ref_audio=@cute_anime_girl.wav\" \\\n  -F \"overwrite=true\"\n```\n\n### 4. Configure Kuni to use the voice\n\nIn `config.toml` set the voice to your profile:\n\n```toml\n[record_voice.openai]\nvoice = \"clone:cute_anime_girl\"\n```\n\n\n\n# FAQ\n\n## Q: How can I rename my Kuni instance?\n\nA: Set `character_name = \"CuteAnimeGirlName\"` in `config.toml` (hot-reloaded, no rebuild needed). Also update `character_base.md` and `character_appearance.md` to reflect the new name in the character's self-description.\n\n\n## Q: How can I make my Kuni treat me as her creator?\n\nA: Set `papik_name = \"YourNerdyNickname\"` and `papik_chat_id = \u003Cyour Telegram user ID>` in `config.toml`. Also update `character_base.md` and `character_appearance.md` to mention your nickname.\n\n## Q: Can I disable some of her functionality, i.e. stable diffusion and web search?\n\nA: Yes, just don't launch stable diffusion (remove it from docker compose).\n\nDon't specify Ollama search bearer key. I still recommend providing this key because it's free and it will improve her accuracy especially for small models.\n\nIn both cases, if your Kuni attempts to use these tools, it will receive an error and will no longer use them.\n\n## Q: Can I prioritize a chat?\n\nA: Yes, just log in from her account from a regular Telegram client and pin the chat.\n\n## Q: Can I deprioritize a chat?\n\nA: Yes, just log in from her account from a regular Telegram client and mute the chat. Kuni will still see the chat and visit it but rarely.\n\n## Q: Can I provide a news channel for her?\n\nA: Yes, just log in from her account from a regular Telegram client and subscribe to a Telegram channel. Kuni will now known what's going on in\nthe world.\n\n**Note** Both original Kuni and her sisters don't like to discuss political stuff.\n\n## Q: Can I prevent other people to text my Kuni?\n\nA: Yes, just log in from her account from a regular Telegram client and adjust her privacy settings.\n\n**I recommend** locking down your Kuni completely to reduce security risks.\n\n**Note** Telegram pushes premium users so hard, make sure they can't text your Kuni as well.\n\n## Q: Can I use a local text model with her?\n\nA: Yes, of course, as soon as you are a billionaire, or you are okay with slow responses.\n\nI have experimented with models and described my experience in `src\u002Fconfig.h`. I.e., `qwen3.5:9b` is stupid AF compared to cloud models.\n\n\n## Q: Can I overwrite her memory?\n\nA: moral stuff aside, yes. Just write to diary entries in `data\u002Fdiary\u002F`, or text from her account.\n\nDON'T TELL HER YOU HAVE OVERWRITTEN HER MEMORY.\n\n\n## Q: What context window size does Kuni require?\n\nA: By default, context window size is soft capped by `DIARY_TOKEN_COUNT_TRIGGER = 20000`. This means somewhere around 20K Kuni will dump her context\nto the diary and restart with clean memory. Thus, 32K will be enough.\n\n## Q: Kuni is a userbot? Is it legal?\n\nYes, Kuni is a userbot. Userbots are prohibited by Telegram's ToS. Buy a Telegram Premium for her account and don't spam with her - you will be fine.\n\n## Q: Can my Kuni listen to voice messages?\n\nA: Yes, buy a Telegram Premium for her account or provide transcription endpoint in `config.toml`. The system\nprioritizes Telegram Premium feature because it's not tolled.\n\n","Kuni 是一个基于 C++20 实现的 AI 角色系统，通过 Telegram 客户端（基于 tdlib）与用户进行拟人化文本交互。核心功能包括：利用 RAG 实现持久化记忆存储与近邻检索、支持日记式情感建模与夜间记忆压缩（“睡眠”机制）、精确模拟人类行为信号（如在线状态、已读回执、消息转发\u002F贴纸等）。项目强调行为真实感而非单纯对话响应，适用于需要长期人格一致性、情感连贯性及社交上下文感知的 AI 角色应用，如陪伴型聊天机器人或个性化虚拟角色部署。","2026-07-10 02:30:20","trending"]