# Terms of Service

**Effective Date: October 19, 2026** 
**Version: 2.6 (Multi-Tenant Local-First Dashboard & Account Merging Update)**

Welcome to **Telelibra Knowledge Cloud**! These Terms of Service ("Terms", "Agreement") govern the relationship between the service developer ("Company", "Developer", "We") and the user ("User", "You") regarding the use of the `@telelibra_ai_bot` Telegram bot, Telegram Mini App interface, ScrapLibra Web Dashboard, and Model Context Protocol (MCP) gateway.

---

## 1. Scope & Service Transparency
1.1. **Telelibra Knowledge Cloud** is an automated personal intelligence and knowledge management SaaS ("Second Brain"). 
1.2. **Operational Architecture**:
* The Service extracts semantic content from links, articles, videos, documents, and Telegram Desktop chat export files (`messages.html` / `result.json`) voluntarily submitted by the User.
* AI engines powered by **Google Gemini** sanitize promo noise, synthesize key insights, generate tags, and organize materials into 20 curated taxonomy domains.
* The output is formatted as a structured **Obsidian Vault** (.zip archive with Markdown files and tags) and a master compendium for **Google NotebookLM** (for generating AI audio podcasts and deep research).
* The Service provides a secure **Model Context Protocol (MCP)** gateway with **TOON** format serialization (up to 45% token economy) for external AI agent integration (Claude Desktop, Cursor, Antigravity).
* The **ScrapLibra Web Dashboard** provides a local-first, multi-tenant interactive workspace featuring full Markdown editing, real-time search, taxonomy filtering, and Obsidian [[wikilink]] graph navigation.

---

## 2. Technical Data Processing & Credit Protection
2.1. **Zero-Credit Noise Shielding**: 
When processing Telegram Desktop chat exports (`messages.html` / `result.json`), the pre-ingestion filter inspects data locally prior to external AI invocation:
* System export placeholders (*"Not included, change data exporting settings to download"*), chat stickers, delivery notices, and orphan emojis are filtered out automatically.
* Non-knowledge noise items **never consume user credits (0 credits charged)**. Credit deduction occurs strictly on a 1-to-1 basis upon successful synthesis and storage of an Obsidian note.
2.2. **Automated Sensitive Number Filter**: 
Messages containing bank card numbers (13–19 digits), phone numbers, OTP verification codes, or banking transaction keywords (IBAN) are recognized as private noise. They are **never sent to external AI APIs**, never indexed into summaries, and **zero credits are deducted**. 
2.3. **Canonical URL Normalization**: 
All incoming URLs are sanitized by stripping marketing tracking parameters (`fbclid`, `utm_source`, `utm_medium`, `utm_campaign`, `igshid`) while preserving critical content query parameters (such as YouTube `v=` video IDs). This prevents duplicate credit charges when identical articles appear repeatedly across chat history. 
2.4. **User Context & Commentary Extraction**: 
If the User forwards a link with personal commentary or project notes, the text is extracted as `user_context` and passed to Gemini 3.5 Flash, generating a dedicated Obsidian callout block:
```markdown
## User Note & Context
> [!NOTE] User Context
> Your commentary text
```
2.5. **Cryptographic Anti-Spoofing & Signed Download Tokens (HMAC-SHA256)**: 
Direct archive downloads via raw `user_uuid` paths are strictly disabled. Vault archives are downloaded exclusively via time-limited, HMAC-SHA256 signed cryptographic tokens (`GET /export/download/{token}`):
* Tokens are signed using a server-side secret key and carry a 15–30 minute Time-To-Live (TTL).
* Verification is conducted using constant-time comparison (`hmac.compare_digest`), preventing timing attacks and cross-tenant User ID spoofing. 
2.6. **Single-Use Trial Protection (`/test_pay`)**: 
The `/test_pay` introductory trial command is strictly restricted to **1 execution per user account**. The usage is permanently recorded in `billing.json` (`test_pay_used: true`), and repeat executions are rejected. 
2.7. **Zero Token Loss Guarantee & 4-Pool Priority Hierarchy**: 
The Service operates an automated multi-pool credit deduction model designed to protect user assets and prevent accidental forfeiture. Balances are debited in strict priority order:
1. `monthly_subscription`: Monthly recurring subscription quotas burn first.
2. `referral_bonus`: Earned referral and promotional bonus credits burn second.
3. `purchased_packs`: Lifetime purchased credit packs burn third. **Zero Token Loss Guarantee**: Purchased pack credits never expire, carry zero maintenance or dormancy fees, and remain permanently available until actively consumed.
4. `free_tier`: Promotional welcome allocations (10 credits) burn fourth. 
2.8. **Permanent Read-Only Archive Invariant**: 
Every note created with 1 credit is permanently preserved in the user's isolated vault. Upon subscription expiration or credit depletion, the workspace transitions automatically to permanent read-only status (`ARCHIVED / READ-ONLY`). Notes are **never purged, deleted, or locked out** due to zero balance or account inactivity. The User retains perpetual rights to search, read, copy, and export their entire knowledge base. 
2.9. **Non-Custodial Account & Telegram Merging Policy**: 
Users may link Web Dashboard accounts (email/password) to a Telegram profile (or vice versa). Workspace merges execute atomically under strict transactional isolation:
* 100% of purchased lifetime credits are consolidated without loss.
* Note collision protection: Identical filenames with distinct content are safely preserved via deterministic suffixing (`{filename}_telegram_copy.md`), preventing silent overwriting.
* Canonical identity pointers (`merged_into.json`) guarantee unified, uninterrupted access across web and bot interfaces.

---

## 3. AI Processing & Privacy Guarantees (Inference-Only)
3.1. **Explicit User Submission**: 
The Service processes **only** materials that the User explicitly sends to `@telelibra_ai_bot` or uploads in the Mini App. The Service has zero access to private chats, contacts, or background device activities. 
3.2. **Inference-Only Mode (Zero Model Training)**: 
All processing occurs strictly in real-time inference mode. In accordance with Google Cloud enterprise terms and Company policies, **User materials are never used, logged, or retained to train, fine-tune, or test foundation AI models**. 
3.3. **Multi-Tenant Workspace Isolation**: 
Each User operates within an isolated virtual storage vault. Cross-tenant data access is strictly blocked at the filesystem and database layers. 
3.4. **Zero-Trace Logging**: 
Note contents, personal data, and access tokens are automatically redacted and never written to server log files.

---

## 4. Operational Analytics Ledger
4.1. **Right to Collect Telemetry**: 
The Company maintains an automated technical ledger in `telelibra_analytics.db` to ensure system stability, billing accuracy, proof of delivery, and abuse prevention. 
4.2. **Recorded Events**:
* `user_registered` — Workspace creation timestamp.
* `consent_accepted` — Legal proof of informed consent.
* `payment_success` / `tier_granted` — Telegram Stars transaction records.
* `sync_started` / `sync_completed` — Ingestion performance and credit accounting.
* `export_requested` — User trigger for vault archive generation.
* `export_acknowledged` — **Legal and technical proof of digital delivery**: User clicks "OK" in the export modal, confirming successful receipt of the knowledge base.
* `mcp_connected` / `mcp_call` — External AI agent gateway verification and quota enforcement.
* `data_deleted` — GDPR Article 17 audit entry confirming permanent deletion. 
4.3. **Metadata Only**: The ledger strictly records timestamps, `user_uuid`, credit balances, and latency. Note contents and private files are never stored in the analytics database.

---

## 5. Billing, Digital Delivery, & Refund Policy
5.1. Payments are processed in **Telegram Stars**. 
5.2. **Completion of Digital Delivery**: 
Service delivery is deemed **fully performed and consumed** upon the generation of the knowledge base, creation of an export archive, logging of `export_acknowledged`, or issuance of an MCP token. From that point, refunds are non-applicable due to immediate value consumption and direct AI compute costs. 
5.3. **Refund Conditions**: 
Refunds are evaluated exclusively in the event of continuous server outage exceeding 72 consecutive hours that prevented the processing of any submitted links (0 notes processed). 
5.4. Support is available via `/paysupport` or `support@telelibra.cloud`.

---

## 6. GDPR Article 17 Right to Erasure
6.1. The User may execute complete and irreversible deletion of all notes, databases, tokens, and billing records at any time using `/delete_my_data` or the Mini App settings. Deletion executes within 1 second.

---

## 7. Agreement Acceptance
7.1. Checking the consent box, clicking "Accept & Choose Plan", sending `/start`, or submitting payment constitutes full and irrevocable acceptance of these Terms.