agent-chat-history

agent-chat-history is a skill for Claude Code from SummerSec/AI-Inner-Os. It costs 94 tokens per session (952 once invoked), scanned A, original, Apache-2.0.

A local search tool for finding coding-agent and chat-session history on Windows, macOS, and Linux by calendar date.

In plain words
What is it for?
Use it to list sessions, export only user prompts, search a specific client such as Codex or Cursor, and investigate missing history.
Why use it?
It helps recover or audit past conversations without manually searching JSONL files, SQLite databases, or editor storage.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: reads .claude/ paths; mentions Claude Code; mentions Codex.

Part of the ai-inner-os plugin — 4 skills, 1 command, 9 hooks shipped together

Good fit Use it to list sessions, export only user prompts, search a specific client such as Codex or Cursor, and investigate missing history.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/summersec/ai-inner-os/agent-chat-history
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add SummerSec/AI-Inner-Os --skill agent-chat-history
Clone the repo
git clone --depth 1 https://github.com/SummerSec/AI-Inner-Os

Made for: Claude Code.

Or install ai-inner-os, the plugin that ships this one along with the rest of its 4 skills, 1 command, 9 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-chat-history

README.md
[![agentmods](https://agentmods.dev/badge/skills/summersec/ai-inner-os/agent-chat-history/github.svg)](https://agentmods.dev/skills/summersec/ai-inner-os/agent-chat-history)
Your own site
<a href="https://agentmods.dev/skills/summersec/ai-inner-os/agent-chat-history"><img src="https://agentmods.dev/badge/skills/summersec/ai-inner-os/agent-chat-history/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-chat-history

Your own site · 80×15
<a href="https://agentmods.dev/skills/summersec/ai-inner-os/agent-chat-history"><img src="https://agentmods.dev/badge/skills/summersec/ai-inner-os/agent-chat-history.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 952 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00094 $0.00952
Opus 5 $0.00047 $0.00476
Sonnet 5 $0.00019 $0.00190
Haiku 4.5 $0.00009 $0.00095

Measured 12d ago against content hash 106d9f22d2d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

agent-chat-history scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/query_history.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

cursor/skills/agent-chat-history/SKILL.md · 58 lines

What it actually says

agent-chat-history:本地 Agent 历史对话按日检索(中文)

执行顺序(Agent 照做)

  1. 已有日期 YYYY-MM-DD:进入 skill 根目录 agent-chat-history/,运行下方命令;需要给下游贴结果时优先 --json
  2. 没有日期:只问用户一句,确认要查询的 YYYY-MM-DD(本地时区日界),再问是否只要提示词、是否限定某一客户端。
  3. 任务匹配:只要用户提示词 → --prompts-only(可加 --include-claude-global-history);只要路径/文件线索 → 默认列表模式,必要时加 --sqlite-keys
  4. 无命中或偏少:提示尝试 --claude-scan all;仍不对则读 references/storage-paths.md 核对自定义安装路径。

优先:固定日期用脚本(省 token)

不要先把本文件整篇读进上下文。 在仓库或已安装 skill 的 agent-chat-history/ 下执行:

python scripts/query_history.py --date YYYY-MM-DD
python scripts/query_history.py --date YYYY-MM-DD --prompts-only --json

常用参数(完整表与 JSON 形状见 references/query-history-script.md):

参数 含义
--date 必填,本地日历日 YYYY-MM-DD
--prompts-only 只提取用户侧提示词(Cursor 为启发式,可能不全
--json 结构化输出,便于原样贴回或只摘 prompts 数组
--mode all(默认)或 claude / codex / cursor 只查一类

路径规则与手工命令见 references/storage-paths.mdreferences/query-examples.md

Gotchas(易错点)

  • Cursor:从 state.vscdb 已知 key 启发式抽取,版本变更后可能漏项或混入非纯用户句。
  • Codex:依赖 history.jsonl 行内 ts(Unix 秒);无 ts 的行不会进入结果。
  • 非默认数据目录CODEX_HOMECLAUDE_CONFIG_DIR、Cursor --user-data-dir、Flatpak/Snap):脚本只覆盖常见布局,须对照 storage-paths.md 自行定位后再查。

何时仍需要读正文 / references

  • 要在 SQLite 里深挖 JSON 或新版本 key 名。
  • 用户只描述「上周某次」等模糊时间:先澄清日期再跑脚本。

摘要(三客户端)

客户端 要点
Claude Code ~/.claude/projects/**/*.jsonl + 可选 history.jsonl;列表模式用 mtime 落在本地日
Codex history.jsonl 行内 ts(Unix 秒)落在本地日
Cursor workspaceStorage/<hash>/ 目录 mtime + state.vscdb--sqlite-keys 仅列表模式下列 key

边界

路径与 DB key 随版本变化;未开启持久化或清理缓存可能导致无命中。只读;勿删改他人数据。

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 58 lines · 94 tokens per session scan A 106d9f22d2d9

Subscribe to this mod's changes

agent-chat-history is a skill published in the GitHub repository SummerSec/AI-Inner-Os (17 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 94 tokens to every session and 952 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.