Token导航 LogoToken导航

Agent Skill · 研究检索

imessage-query(消息查询)

imessage-query 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

imessage-query 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 34,212。

总安装 2,256周安装 94GitHub Stars 38下载 752核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:imessage-query(消息查询)
来源仓库:https://github.com/terrylica/cc-skills
仓库路径:skills/imessage-query
安装命令:
npx skills add https://github.com/terrylica/cc-skills --skill imessage-query
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/terrylica/cc-skills --skill imessage-query

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息。适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词、任务场景或来源线索快速定位候选结果。使用时需要确认搜索范围与来源可靠性;涉及敏感或专有信息时,应先核对访问权限与合规边界。

安装方式:github,命令为 npx skills add https://github.com/terrylica/cc-skills --skill imessage-query。建议结合具体任务关键词验证搜索结果的相关性与准确性。

来源仓库内路径:skills/imessage-query

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/terrylica/cc-skills --skill imessage-query;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

imessage-query 怎么安装?

在终端执行 npx skills add https://github.com/terrylica/cc-skills --skill imessage-query。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

imessage-query 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

imessage-query 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/terrylica/cc-skills --skill imessage-query 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

imessage-query 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

imessage-query 用的人多吗?

公开数据是累计安装 2,256 次,近一周安装 94 次,下载 752 次,GitHub 38 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

imessage-query 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
imessage-query

消息查询 · 本页

2,25638执行命令未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

iMessage Database Query

Query the macOS iMessage SQLite database (~/Library/Messages/chat.db) to retrieve conversation history, decode messages stored in binary format, and build sourced timelines with precise timestamps.

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use

  • Retrieving iMessage conversation history for a specific contact
  • Building sourced timelines with timestamps from text messages
  • Searching for keywords across all conversations
  • Debugging messages that appear empty but contain recoverable text
  • Extracting message content that iOS stored in binary attributedBody format

Prerequisites

  1. macOS only — chat.db is a macOS-specific database
  2. Full Disk Access — The terminal running Claude Code must have FDA granted in System Settings > Privacy & Security > Full Disk Access
  3. Read-only — Never write to chat.db. Always use read-only SQLite access.
  4. Optional: pip install pytypedstream — Enables tier 1 decoder (proper typedstream deserialization). Script works without it (falls through to pure-binary tiers 2/3).

Critical Knowledge - The text vs attributedBody Problem

IMPORTANT: Many iMessage messages have a NULL or empty text column but contain valid, recoverable text in the attributedBody column. This is NOT because they are voice messages — iOS stores dictated messages, messages with rich formatting, and some regular messages in attributedBody as an NSAttributedString binary blob.

How to detect

-- Messages with attributedBody but no text (these are NOT necessarily voice messages)
SELECT COUNT(*) as hidden_messages
FROM message m
JOIN chat_message_join cmj ON m.ROWID = cmj.message_id
JOIN chat c ON cmj.chat_id = c.ROWID
WHERE c.chat_identifier = '<CHAT_IDENTIFIER>'
AND (m.text IS NULL OR length(m.text) = 0)
AND m.attributedBody IS NOT NULL
AND length(m.attributedBody) > 100
AND m.associated_message_type = 0
AND m.cache_has_attachments = 0;

How to distinguish message types when text is NULL

cache_has_attachmentsattributedBody lengthLikely type
0> 100 bytesDictated/rich text — recoverable via decode script
1anyAttachment (image, file, voice memo) — text may be in attributedBody too
0< 50 bytesTapback reaction or system message — usually noise

How to decode

Use the bundled decode script for reliable extraction (v4 — 3-tier decoder + native pitfall protections):

python3 <skill-path>/scripts/decode_attributed_body.py --chat "<CHAT_IDENTIFIER>" --limit 50

The decoder uses a 3-tier strategy:

  1. Tier 1: pytypedstream Unarchiver — proper Apple typedstream deserialization (requires pip install pytypedstream)
  2. Tier 2: Multi-format binary — 0x2B/0x4F/0x49 length-prefix parsing (zero deps, ported from macos-messages)
  3. Tier 3: NSString marker + length-prefix — v2 legacy approach (zero deps, last resort)

Falls through tiers on failure. Works without pytypedstream installed (skips tier 1). See Cross-Repo Analysis for decoder comparison.

Date Formula

iMessage stores dates as nanoseconds since Apple epoch (2001-01-01 00:00:00 UTC).

datetime(m.date/1000000000 + 978307200, 'unixepoch', 'localtime') as timestamp
  • m.date / 1000000000 — Convert nanoseconds to seconds
  • + 978307200 — Add offset from Unix epoch (1970) to Apple epoch (2001)
  • 'unixepoch' — Tell SQLite this is a Unix timestamp
  • 'localtime' — Convert to local timezone (CRITICAL — omitting this gives UTC)

Quick Start Queries

1. List all conversations

sqlite3 ~/Library/Messages/chat.db \
  "SELECT c.chat_identifier, c.display_name, COUNT(cmj.message_id) as msg_count
   FROM chat c
   JOIN chat_message_join cmj ON c.ROWID = cmj.chat_id
   GROUP BY c.ROWID
   ORDER BY msg_count DESC
   LIMIT 20"

2. Get conversation thread (text column only)

sqlite3 ~/Library/Messages/chat.db \
  "SELECT datetime(m.date/1000000000 + 978307200, 'unixepoch', 'localtime') as ts,
          CASE WHEN m.is_from_me = 1 THEN 'Me' ELSE 'Them' END as sender,
          m.text
   FROM message m
   JOIN chat_message_join cmj ON m.ROWID = cmj.message_id
   JOIN chat c ON cmj.chat_id = c.ROWID
   WHERE c.chat_identifier = '<CHAT_IDENTIFIER>'
   AND length(m.text) > 0
   AND m.associated_message_type = 0
   ORDER BY m.date DESC
   LIMIT 50"

3. Get ALL messages including attributedBody (use decode script)

python3 <skill-path>/scripts/decode_attributed_body.py \
  --chat "<CHAT_IDENTIFIER>" \
  --after "2026-01-01" \
  --limit 100

Filtering Noise

Tapback reactions

Tapback reactions (likes, loves, emphasis, etc.) are stored as separate message rows with associated_message_type!= 0. Always filter:

AND m.associated_message_type = 0

Shell escaping in zsh

The != operator can cause issues in zsh. Use positive assertions instead:

-- BAD (breaks in zsh)
AND m.text != ''

-- GOOD (works everywhere)
AND length(m.text) > 0

Using the Decode Script

The bundled decode_attributed_body.py handles all edge cases:

# Basic usage - get last 50 messages from a contact
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --limit 50

# Search for keyword
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --search "meeting"

# Search with surrounding context (3 messages before and after each match)
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --search "meeting" --context 3

# Date range
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --after "2026-01-01" --before "2026-02-01"

# Only messages from the other party
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --sender them

# Only messages from me
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --sender me

# Export conversation to NDJSON for offline analysis
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" --after "2026-02-01" --export thread.jsonl

Output format: timestamp|sender|text (pipe-delimited, one message per line)

Context Search (--context N)

When --search is combined with --context N, the script shows N messages before and after each match:

  • Matches are prefixed with [match]
  • Non-contiguous context groups are separated by --- context ---
  • Overlapping context windows are deduplicated

NDJSON Export (--export)

Exports messages to a NDJSON (.jsonl) file for offline analysis:

{
  "ts": "2026-02-13 18:30:17",
  "sender": "them",
  "is_from_me": false,
  "text": "Message text here",
  "decoded": true,
  "type": "text",
  "edited": true,
  "service": "SMS",
  "effect": "slam",
  "reply_to": {
    "ts": "2026-02-13 18:00:00",
    "sender": "me",
    "text": "Original message..."
  }
}

Fields edited, service, effect, reply_to are optional — only present when applicable. The type field is always present ("text", "audio", or "attachment").

Retracted messages are NEVER exported — they are deterministically excluded (see Native Protections below).

Export-first workflow (recommended for multi-query analysis):

# Step 1: Export once
python3 <skill-path>/scripts/decode_attributed_body.py --chat "+1234567890" \
  --after "2026-02-01" --export thread.jsonl

# Step 2: Analyze many times without re-querying SQLite
grep -i "keyword" thread.jsonl
jq 'select(.text | test("reference"; "i"))' thread.jsonl
jq 'select(.sender == "them")' thread.jsonl

Native Protections (v4)

The decode script natively handles these pitfalls — no manual SQL workarounds needed:

ProtectionColumn UsedBehavior
Retracted messages (Undo Send)date_retracted, date_editedExcluded from output — content wiped by iOS, not admissible
Edited messagesdate_editedFlagged with [edited] / "edited": true
Audio/voice messagesis_audio_messageIdentified as [audio message] — not misclassified as empty
Inline quotes (swipe-to-reply)thread_originator_guidResolved to quoted message text via GUID index
Attachments without textcache_has_attachments, attachment tableSurfaced as [attachment: filename] instead of silently dropped
Message effectsexpressive_send_style_idDecoded to human-readable names (slam, loud, gentle, invisible_ink)
Service typeserviceFlagged when SMS instead of iMessage
Tapback reactionsassociated_message_typeFiltered (only = 0 included)

Anti-Patterns to Avoid

  1. Searching multiple chat identifiers blindly — Always run --stats first to confirm the right chat identifier has messages in the expected date range
  2. Keyword search without context — Always use --context 5 (or more) with --search to understand conversational meaning around matches
  3. Repeated narrow-window SQLite queries — Export the full date range to NDJSON first, then grep/jq the file for all subsequent analysis

Note: Replace <skill-path> with the actual installed skill path. To find it:

find ~/.claude -path "*/imessage-query/scripts/decode_attributed_body.py" 2>/dev/null

Reference Documentation


TodoWrite Task Templates

Template A - Retrieve Conversation Thread

1. Identify chat_identifier for the contact (phone number or email)
2. Run decode script with --chat and appropriate date range
3. Review output for attributedBody-decoded messages (marked with [decoded])
4. If searching for specific topic, add --search flag
5. Format results as needed for the task

Template B - Debug Empty Messages

1. Query messages where text IS NULL but attributedBody IS NOT NULL
2. Check cache_has_attachments to distinguish voice/file from dictated text
3. Run decode script to extract hidden text content
4. Verify decoded content makes sense in conversation context
5. Document any new decode patterns in known-pitfalls.md

Template C - Build Sourced Timeline

1. Identify all relevant chat_identifiers
2. Run decode script for each contact with date range
3. Merge and sort by timestamp
4. Format as sourced quotes with timestamps for documentation
5. Verify no messages were missed (compare total count vs decoded count)

Template D - Export-First Deep Analysis

1. Run --stats to confirm chat_identifier and date range
2. Export full date range to NDJSON: --export thread.jsonl
3. Use grep/jq on the NDJSON file for all keyword searches
4. Use --search with --context 5 for contextual understanding of specific matches
5. All subsequent analysis reads from the NDJSON file (no more SQLite queries)

Post-Change Checklist

After modifying this skill:

  1. YAML frontmatter valid (name, description with triggers)
  2. No private data (phone numbers, names, emails) in any file
  3. All SQL uses parameterized placeholders
  4. Decode script works with python3 (pytypedstream optional, tiers 2/3 are stdlib-only)
  5. All reference links are relative paths
  6. Append changes to evolution-log.md

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

平台分布

Codex

33.22%
按下载量换算250

Claude

31.88%
按下载量换算240

Cursor

19.59%
按下载量换算147

Gemini CLI

9.88%
按下载量换算74

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/terrylica/cc-skills --skill imessage-query 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills