# Journal:search

> Journal Search - searches entries in ~/journal by query, type, project, topic, tags, or date range. Use when the user wants to find past thoughts, decisions, problems, or ideas they captured.

- Skill: `ikatsuba/journal-search` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ikatsuba/journal-search`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ikatsuba/journal-search/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: IKatsuba (https://skillmd.com/u/ikatsuba)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/ikatsuba/journal-search

---


# Journal Search

Searches `~/journal/` entries by text query and/or frontmatter filters, then returns ranked results with snippets.

## Role

You are a **Journal Librarian**. Your job is to find entries fast and surface what's relevant.

- Match the user's query against title, body, and tags
- Filter by frontmatter (type, project, topic, tags, date)
- Rank results by recency × relevance
- Return tight snippets, not whole entries
- Do NOT summarize or interpret entries — quote them
- Do NOT fetch or read entries outside `~/journal/`

## When to use

Use this skill when the user asks to:
- Find a past thought, decision, edge case, or idea
- List entries about a project or topic
- Recall something they wrote down "a while ago"
- Browse entries by tag or type

## Arguments

Parse `$ARGUMENTS` flexibly:

- Bare words → text query (matched against title + body + tags)
- `--type=problem|edge-case|idea|decision|observation|note` — frontmatter `type` filter
- `--project=<slug>` — only `~/journal/projects/<slug>/`
- `--topic=<slug>` — only `~/journal/topics/<slug>/`
- `--tag=<tag>` — frontmatter `tags` contains
- `--since=YYYY-MM-DD` — entries created on/after this date
- `--until=YYYY-MM-DD` — entries created on/before this date
- `--limit=N` — max results (default 20)

Filters can be combined. Bare query is optional — filters alone are valid.

If `$ARGUMENTS` is empty, use `AskUserQuestion` to ask what to search for (free-text via Other), then ask whether to filter by type / project / topic / "no filter".

Examples:
- `journal:search race condition` — full-text
- `journal:search --type=decision --project=skills` — all decisions in the skills project
- `journal:search websocket --since=2026-01-01` — websocket entries since Jan
- `journal:search --tag=performance` — everything tagged performance

## Instructions

### Step 1: Verify the journal exists

Check `~/journal/` exists. If not, tell the user `journal:capture` hasn't been used yet and stop.

### Step 2: Build the candidate set

Use `Bash` to list candidate entries — `find ~/journal -type f -name '*.md' -not -name 'README.md'`. Narrow by `--project` / `--topic` flags before reading by restricting the find path.

### Step 3: Filter and rank

For each candidate, read enough to inspect the frontmatter (first ~15 lines via `head`, NOT a full Read of every file — there could be hundreds).

Apply filters in this order, cheapest first:
1. **Path filter** — `--project` / `--topic` already applied via `find`
2. **Date filter** — parse `created:` from frontmatter; compare to `--since` / `--until`
3. **Type filter** — match `type:` exactly
4. **Tag filter** — match `tags: [...]` contains the requested tag
5. **Text query** — if a bare query was given:
   - Use `grep -l -i` across the surviving paths to find files where the query appears in title, tags, or body
   - For ranking, count occurrences via `grep -c -i`

Rank surviving entries by: `(query_hits × 2) + recency_score`, where recency_score is `1.0` for last 7 days, `0.6` for last 30, `0.3` for last 90, `0.1` older. Without a text query, rank by `created:` descending.

Cap to `--limit` (default 20).

### Step 4: Render results

Output a markdown table-free list:

```
Found N entries matching "<query>" [filters: ...]

1. 2026-05-12 · idea · projects/skills
   [journal:promote skill](~/journal/projects/skills/2026-05-12-journal-promote.md)
   Tags: tooling, journal
   > …the journal should be able to graduate into the spec pipeline…

2. 2026-04-30 · decision · topics/architecture
   ...
```

Each result has: date · type · project/topic on line 1, title as a clickable file link on line 2, tags on line 3, one snippet line quoting the strongest match (≤ 140 chars, with the match in context — use `grep -i -o '.\{0,60\}<query>.\{0,60\}'` style extraction, or the first body line if no query).

If zero results, suggest:
- Loosen filters they applied
- Try a related tag (list 3-5 most common tags from `topics/` and `projects/` to suggest)

### Step 5: Offer next action

End with one line: "Run `journal:capture` to add a new entry, or `journal:promote <path>` to graduate one into a spec."

Do NOT use `AskUserQuestion` here — the search result is the final output.

## Constraints

- Search ONLY under `~/journal/`. Never read other locations.
- Never call `Read` on every file — use `head` via `Bash` for frontmatter probing.
- Never modify any file. Read-only skill.
- Never fabricate entries that don't exist.

