search

search is a command for coding agents from jasonhnd/life_OS. It costs 26 tokens per session (644 once invoked), scanned A, original, Apache-2.0.

A command for searching earlier conversations and decisions stored in session files. It searches across sessions and shows matching lines with nearby context.

In plain words
What is it for?
Use it to find past discussions by one or more keywords, review the surrounding context, and check linked decisions or commitments.
Why use it?
It removes the need to remember which conversation contained a particular decision or discussion. It can also show related commitments and whether they were later acted on.

Command

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.

agentmods
npx agentmods add commands/jasonhnd/life_os/search
Clone the repo
git clone --depth 1 https://github.com/jasonhnd/life_OS

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 search

README.md
[![agentmods](https://agentmods.dev/badge/commands/jasonhnd/life_os/search.svg)](https://agentmods.dev/commands/jasonhnd/life_os/search)
Your own site
<a href="https://agentmods.dev/commands/jasonhnd/life_os/search"><img src="https://agentmods.dev/badge/commands/jasonhnd/life_os/search.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 644 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00026 $0.00644
Opus 5 $0.00013 $0.00322
Sonnet 5 $0.00005 $0.00129
Haiku 4.5 $0.00003 $0.00064

Measured 4d ago against content hash 1ab869a39977, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

search 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 4d ago.

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.

docs/history/v1.10-command-surfaces/scripts/commands/search.md · 60 lines

What it actually says

/search · 历史会话搜索 (v1.8.0 pivot)

v1.8.0 pivot 注解:之前调用 python -m tools.session_search(SQLite FTS5),但 tools/session_search.py 在 v1.8.0 pivot 中被删除。Search 现在用 Grep tool 直接搜 meta/sessions/*.md,没有 python 中间层。

Backup mode: 主要路径是 ROUTER 在 Cortex pull-based 调度下 launch hippocampus subagent,结果出现在 [COGNITIVE CONTEXT] 块里。这个命令是给"我想精确搜某个关键词不走 Cortex"的备份。详见 hosts/CLAUDE.md → §0.5 (Cortex pull-based)。

User invoked: /search $ARGUMENTS

你要做的

  1. 用 Grep 工具直接搜

    Grep(pattern="$ARGUMENTS", path="meta/sessions/", output_mode="files_with_matches", head_limit=10)
    
  2. 对每个命中文件,Read frontmatter + 摘录命中行的上下文

    • session 日期 + 标题(从 frontmatter)
    • 命中行 + 前后 2 行(用 Grep 的 -C 2
    • 当时是否有 SOUL 评分 / commitment / decision(看 frontmatter 的 outcome_score / commitments 字段)
  3. 报告给用户

    🔍 找到 N 条相关 session:
    
      1. 📅 <date> · <title>
         命中行:<excerpt>
         当时承诺:<commitment if any>
         ⤷ 现在兑现状态:<check via Read journal/decisions>
         [Read <session_file>] 看完整
    
      ...
    
  4. 如果 0 命中:建议拓宽关键词或先 /memory read 看短期记忆。

多关键词搜索

如果用户给多个关键词(空格分隔),用 Grep 的正则 OR:

Grep(pattern="(关键词1|关键词2|关键词3)", ...)

中文/日文关键词

Grep 支持 Unicode。无需特殊处理。

Anti-pattern

  • 不要只读出文件名 — 必须打开 session 文件提取 commitment 和兑现状态
  • 不要超过 10 条结果 — 太多反而让用户淹没
  • 不要尝试调用已删除的 tools/session_search.pytools/cli.pytools/rebuild_session_index.py(部分已删,部分没用)—— 直接 Grep
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. 4d ago First seen · 60 lines · 26 tokens per session scan A 1ab869a39977

Subscribe to this mod's changes

search is a command published in the GitHub repository jasonhnd/life_OS (5 stars, last pushed 27d ago), licensed Apache-2.0. It adds 26 tokens to every session and 644 once invoked, about $0.0001 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-31.