Skill: ngtwolf/lifequery (version 1.0.1)

--- name: lifequery description: "Query your Telegram chat history using a LifeQuery instance. Use when the user wants to search past conversations, find shared links, or ask about specific people/events from their Telegram messages." --- # LifeQuery Telegram History Skill Query your Telegram chat history using a [LifeQuery](https://github.com/nikira-studio/lifequery) instance. ## When to Use Use when the user wants to: - Search past Telegram conversations - Find shared links, photos, or files - Ask about specific people, events, or topics from their Telegram messages - Retrieve context from old chats ## Configuration Set these environment variables: - `LIFEQUERY_BASE_URL`: Base URL of your LifeQuery instance (e.g., `http://localhost:3134/v1` or `http://your-server:80/v1`) - `LIFEQUERY_API_KEY`: Optional API key if protected ## How it Works The skill runs a Python script that sends search queries to the LifeQuery `/chat/completions` endpoint and returns semantically relevant answers with citations from the chat history.

path: skill.yaml
content: name: lifequery
version: 1.0.1
description: "Allows the agent to search and query your entire Telegram chat history using a local or remote LifeQuery instance."
tools:
 - name: query_telegram_history
   description: "Search the user's Telegram history for information, old conversations, or specific details. LifeQuery will provide a semantically relevant answer with citations from the chat history."
   command:
     - "python"
     - "scripts/query_telegram.py"
     - "{{query}}"
   parameters:
     - name: query
       description: "The search query or question to ask about the user's Telegram history."
       type: string
       required: true
env:
 - name: LIFEQUERY_BASE_URL
   default: "http://localhost:3134/v1"
 - name: LIFEQUERY_API_KEY
   default: ""


path: scripts/query_telegram.py
content: #!/usr/bin/env python3
"""
Query Telegram history via LifeQuery API.
"""

import os
import sys
import json
import urllib.request
import urllib.error
import argparse

def main():
    parser = argparse.ArgumentParser(description="Query a local LifeQuery instance.")
    parser.add_argument("query", help="The search query or question to ask about the user's Telegram history.")
    args = parser.parse_args()

    # Read configuration from environment variables defined in SKILL.md
    base_url = os.environ.get("LIFEQUERY_BASE_URL", "http://localhost:3134/v1").rstrip("/")
    [REDACTED_SECRET]"LIFEQUERY_API_KEY", "")

    url = f"{base_url}/chat/completions"

    headers = {
        "Content-Type": "application/json"
    }
    
    # Support optional API key authentication
    if [REDACTED_SECRET]"Authorization"] = f"Bearer {api_key}"

    # LifeQuery uses an OpenAI-compatible API endpoint structure
    data = {
        "model": "lifequery", 
        "messages": [
            {"role": "user", "content": args.query}
        ],
        "temperature": 0.0,
        "stream": False
    }

    try:
        req = urllib.request.Request(
            url, 
            data=json.dumps(data).encode("utf-8"), 
            headers=headers, 
            method="POST"
        )
        
        with urllib.request.urlopen(req) as response:
            result = json.loads(response.read().decode("utf-8"))
        
        # Print the text answer (which LifeQuery automatically grounds with citations)
        if "choices" in result and len(result["choices"]) > 0:
            answer = result["choices"][0]["message"]["content"]
            print(answer)
        else:
            print("Error: Unexpected response format from LifeQuery API.")
            print(json.dumps(result, indent=2))
        
    except urllib.error.URLError as e:
        print(f"Error communicating with LifeQuery API at {url}: {e}")
        if hasattr(e, 'read'):
            try:
                error_response = e.read().decode('utf-8')
                print(f"Server response: {error_response}")
            except Exception:
                pass
        sys.exit(1)

if __name__ == "__main__":
    main()


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)