Transform offline Telegram Desktop chat exports (result.json) into quantified, quote-grounded rankings of unmet market needs with zero memory crashes and absolute source fidelity.
Activate this skill when:
result.json or multi-file directory) and requests market research, customer problem analysis, or tool opportunity discovery.json.load()) risks out-of-memory (OOM) fatal crashes.Do NOT use this skill when:
The 4MB Stream & Overlap Invariant (Memory Ceiling <= 8MB):
result.json files routinely exceed 500MB to 5GB.json.load() or fs.readFileSync().Cross-Chat Multiplicity Law ($U \ge 3$ Priority):
Verbatim Quote Anchor & Anti-Hallucination Law:
date) and chat identifier.[UNCONFIRMED / NO VERBATIM EVIDENCE].Bi-Lingual Case-Insensitive Seed Lexicons:
не хватает, вот бы, бесит, надоело, задолбал, ищу инструмент, ищу бот, есть ли бот, есть ли сервис, посоветуйте тул, не работает, вручную, рутина, приходится руками.i wish, missing, annoying, frustrating, looking for a tool, is there an app, is there a bot, any alternative to, doesn't work, manually, repetitive, waste of time.Strict Air-Gap & Zero Exfiltration:
| Anti-Pattern | Manifestation in Code/Workflow | Mandatory Production Counter-Rule |
|---|---|---|
| The OOM Slurp | data = json.load(open('result.json')) on 800MB file. |
Use incremental regex streaming or chunked buffered file reading with <= 8MB RAM footprint. |
| Chunk Boundary Blindness | Chunking without overlap, truncating "looking for a tool" across 4096-byte splits. |
Maintain a 4KB sliding overlap tail across chunk transitions. |
| Double-Count Overlap Trap | Counting hits found in both chunk $N$ and the overlap window of chunk $N+1$. | Only increment match counter if match.end() > overlap_size. |
| The Echo-Chamber Distortion | Elevating a bug mentioned 80 times by 1 single user in 1 chat to the #1 product opportunity. | Apply Cross-Chat Multiplicity Law ($U \times \sqrt{H}$) and count unique authors when available. |
| Hallucinated Quotations | "User expressed desire for better sync" written in quotes as "I really need better sync". |
Exact substring slice from source buffer; if unquoted, label as synthetic analysis. |
| Service Message Pollution | Mining system notifications ("pinned a message", "joined group", bot spam) as human needs. |
Filter out messages where type == "service" or text begins with known bot commands (/start). |
| Premature Uniqueness Claim | Stating "No tool currently exists for this problem" without validation. | Run explicit coverage audit; if unverified, output strictly: I cannot confirm this. |
| Lossy Encoding Crash | Crashing on multi-byte emoji surrogate pairs or non-UTF-8 characters in chat history. | Decode with errors='replace' or raw byte-level UTF-8 traversal. |
| Monolithic Theme Lumping | Grouping all complaints under "Users want better UI" or "Performance issues". |
Disaggregate into specific actionable workflows (e.g. "No zero-downtime database migration path"). |
| API Creep | Prompting the user for Telegram Bot tokens or phone numbers for MTProto login. | Reject live requests; reiterate that input contract requires offline result.json exports only. |
import re
import os
from typing import Generator, Dict, List, Tuple
CHUNK_SIZE = 4 * 1024 * 1024 # 4 MB
OVERLAP = 4096 # 4 KB
RU_LEXICON = re.compile(
r"(?i)\b(не\s+хватает|вот\s+бы|бесит|надоело|задолбал|ищу\s+(?:инструмент|бот|софт)|"
r"есть\s+ли\s+(?:бот|сервис|тул)|посоветуйте|вручную|рутина|приходится\s+руками)\b"
)
EN_LEXICON = re.compile(
r"(?i)\b(i\s+wish|missing|annoying|frustrating|looking\s+for\s+a\s+(?:tool|bot|app)|"
r"is\s+there\s+(?:an?\s+app|a\s+bot|a\s+tool)|any\s+alternative\s+to|manually|waste\s+of\s+time)\b"
)
def stream_chat_chunks(filepath: str) -> Generator[Tuple[str, int], None, None]:
overlap_tail = ""
with open(filepath, "r", encoding="utf-8", errors="replace") as f:
while True:
chunk = f.read(CHUNK_SIZE)
if not chunk:
break
combined = overlap_tail + chunk
yield combined, len(overlap_tail)
overlap_tail = combined[-OVERLAP:] if len(combined) >= OVERLAP else combined
def mine_need_signals(filepath: str, regex: re.Pattern, max_samples: int = 5) -> Dict:
hits = 0
samples: List[str] = []
for text_block, overlap_len in stream_chat_chunks(filepath):
for m in regex.finditer(text_block):
if m.end() > overlap_len:
hits += 1
if len(samples) < max_samples:
start = max(0, m.start() - 60)
end = min(len(text_block), m.end() + 140)
snippet = " ".join(text_block[start:end].split())
samples.append(snippet)
return {"total_hits": hits, "samples": samples}
{
"theme_id": "NEED-001",
"theme_name": "Zero-Downtime SQLite Replication for Edge Daemons",
"aggregate_score": 14.14,
"distinct_chats": 4,
"total_hits": 50,
"chats_observed": ["devops_talk_ru", "sqlite_users", "homelab_ops", "backend_craft"],
"evidence": [
{
"date": "2026-08-14T11:22:04",
"chat": "devops_talk_ru",
"verbatim_quote": "бесит что нет нормальной репликации для sqlite на edge серверах без поднятия тяжелого postgres"
},
{
"date": "2026-09-02T19:40:12",
"chat": "sqlite_users",
"verbatim_quote": "is there a tool that actually handles multi-master sqlite sync without crashing on high concurrency?"
}
],
"existing_coverage": [
{"tool": "LiteFS", "gap": "Requires Consul / Fly.io infrastructure; complex on bare-metal edge."},
{"tool": "rqlite", "gap": "Raft layer alters SQLite interface semantics."}
],
"verdict": "Real commercial gap for turnkey lightweight edge replication."
}
def process_export_directory(dir_path: str, pattern: re.Pattern) -> List[Dict]:
results = []
for root, _, files in os.walk(dir_path):
for file in files:
if file == "result.json" or file.endswith(".json"):
full_path = os.path.join(root, file)
chat_name = os.path.basename(root) if file == "result.json" else file
data = mine_need_signals(full_path, pattern)
if data["total_hits"] > 0:
results.append({"chat": chat_name, **data})
return results
Before emitting any market research summary or opportunity report, verify:
"I cannot confirm this"."I reviewed the chats and users are looking for better dev tools. Many people complain about speed and say they wish things worked better. There is a huge opportunity to build an AI bot for developers." Problems: Zero verbatim quotes, zero date citations, zero chat distribution count, ungrounded speculation, generic meaningless advice.
1. Schema Migration Rollbacks for Flyway in CI/CD — 38 hits across 4 chats ($U=4, H=38, \text{Score}=24.66$)
- Chat Distribution:
k8s_ru(14 hits),devops_community(12 hits),backend_pro(8 hits),java_chat(4 hits).- Evidence 1: "бесит когда flyway падает на миграции в CI и приходится вручную чистить schema_version таблицу на стейдже" (2026-07-19T09:12:44,
devops_community).- Evidence 2: "is there a tool to safely dry-run flyway down migrations before merging to master?" (2026-08-04T16:21:09,
k8s_ru).- Coverage Check: Flyway Pro provides undo migrations; however, community tier users lack automated sandbox validation without custom Docker scripts.
- Verdict: Confirmed gap for a lightweight CLI pre-flight validator for open-source Flyway migrations.