{"id":50762135,"url":"https://github.com/sixtdreanight/companion-engine","last_synced_at":"2026-06-11T11:01:44.597Z","repository":{"id":359733539,"uuid":"1247289843","full_name":"sixtdreanight/companion-engine","owner":"sixtdreanight","description":"AI companion core engine -- personality, relationship, memory, safety, and pipeline","archived":false,"fork":false,"pushed_at":"2026-05-23T06:51:36.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-23T08:26:06.731Z","etag":null,"topics":["ai-companion","chatbot","llm","personality-engine","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sixtdreamnight/companion-engine","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sixtdreanight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-23T05:53:47.000Z","updated_at":"2026-05-23T06:51:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sixtdreanight/companion-engine","commit_stats":null,"previous_names":["sixtdreanight/companion-core"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sixtdreanight/companion-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixtdreanight%2Fcompanion-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixtdreanight%2Fcompanion-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixtdreanight%2Fcompanion-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixtdreanight%2Fcompanion-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sixtdreanight","download_url":"https://codeload.github.com/sixtdreanight/companion-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixtdreanight%2Fcompanion-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34195117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-companion","chatbot","llm","personality-engine","typescript"],"created_at":"2026-06-11T11:01:42.508Z","updated_at":"2026-06-11T11:01:44.538Z","avatar_url":"https://github.com/sixtdreanight.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Language:** [English](README.md) | [简体中文](README.zh-CN.md) | [繁體中文](README.zh-Hant.md) | [日本語](README.ja.md)\n\n# @sixtdreamnight/companion-engine\n\n**AI companion core engine — personality, relationship, memory, safety, and pipeline.**\n\nPowers [Yumema](https://github.com/sixtdreanight/Yumema).\n\n[![npm version](https://img.shields.io/npm/v/@sixtdreamnight/companion-engine.svg)](https://www.npmjs.com/package/@sixtdreamnight/companion-engine)\n[![License: GPL-3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![TypeScript](https://img.shields.io/badge/%3C/%3E-TypeScript-3178C6.svg)](https://www.typescriptlang.org/)\n\n---\n\n## Installation\n\n```bash\nnpm install @sixtdreamnight/companion-engine\n```\n\n## Quick Start\n\n```typescript\nimport { loadConfig, processMessage, processMessageStream } from \"@sixtdreamnight/companion-engine\";\nimport \"dotenv/config\";\n\nconst config = loadConfig();\n\n// Standard pipeline\nconst reply = await processMessage(\"Hello!\", { userId: \"user-1\", config });\nconsole.log(reply);\n\n// Streaming pipeline (token-level)\nfor await (const chunk of processMessageStream(\"Hello!\", { userId: \"user-1\", config })) {\n  process.stdout.write(chunk);\n}\n```\n\n## API Overview\n\n| Module | Description |\n|--------|-------------|\n| **Config** | Load and manage app configuration, profiles, environment variables |\n| **Pipeline** | 5-stage message pipeline with streaming support + persistent checkpoints |\n| **Personality** | Character engine — mood, topic suggestion, emotional support, session management |\n| **Emotion** | Stateful emotion model — 7 emotions with probabilistic transitions |\n| **Relationship** | Affection system, relationship stages, confession/breakup, affection decay, multi-character |\n| **Memory** | Short-term / long-term memory, summarization, forgetting curve, semantic search |\n| **Safety** | Multi-layer safety — regex, LLM-based, composite checker. Profile validation |\n| **Scheduler** | Cron-based background task scheduler |\n| **Search** | Web search and conversation history search |\n| **Checkpointer** | Persistent session state (JSON default) |\n| **Embedding** | Text vectorization for semantic memory (TF-IDF default) |\n| **Validation** | Zod runtime schema validation |\n| **MBTI** | Conversation-based MBTI inference |\n| **Card Import** | SillyTavern V1/V2/V3 + Character.AI character card import |\n\n## Key Features (v0.2.0)\n\n- **Persistent sessions**: `JsonCheckpointer` survives process restarts\n- **Streaming pipeline**: `processMessageStream()` token-level async generator\n- **Emotion model**: 7-state emotional system with intensity tracking\n- **Affection decay**: Gradual affection loss after 7 days of inactivity\n- **Multi-character relationships**: Each character gets independent state\n- **Semantic memory**: `TfIdfEmbeddingProvider` for vector-based retrieval\n- **Zod validation**: Runtime type validation for Profile and AppConfig\n- **LLM safety checker**: Optional LLM-based safety layer\n- **MBTI inference**: Personality type detection from conversation\n- **C.AI import**: Character.AI export format support\n\n## Peer Dependencies\n\n- `@ai-sdk/anthropic` ^3.0.0\n- `@ai-sdk/openai` ^3.0.0\n- `ai` ^6.0.0\n- `dotenv` ^17.0.0\n- `node-cron` ^3.0.0\n- `zod` ^3.0.0\n\nFull API docs: [API_REFERENCE.md](API_REFERENCE.md)\n\n## License\n\nGPL-3.0 — see [LICENSE](./LICENSE).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Language / 语言 / 言語**\n\n[**English**](README.md) | [**简体中文**](README.zh-CN.md) | [**繁體中文**](README.zh-Hant.md) | [**日本語**](README.ja.md)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixtdreanight%2Fcompanion-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixtdreanight%2Fcompanion-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixtdreanight%2Fcompanion-engine/lists"}