kioku

command module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

kioku

kioku (記憶) is Japanese for "memory".

Search every Claude Code, Codex and Pi session on your Mac, down to the message, in English, Chinese, Japanese and Korean.

  • Message-level hits. Every row is the message that matched, ranked by BM25, with its agent, project and age.
  • Real CJK search. fts5-cjk is compiled in, so 結帳, ログイン and 결제 match inside running text.
  • Read the context, then continue. The transcript folds unrelated turns into ⋯. enter resumes the session in its own directory with claude --resume, codex resume or pi --session. o opens the project in your editor.
  • Local and read-only. It never writes to agent stores. The only file it writes is its own index in ~/.cache/kioku.

kioku searching 結帳 across Traditional Chinese messages, with the word Pay marked by a highlighter

Screenshots show the real TUI running on a synthetic demo home (demo/make_demo_home.py, regenerated by demo/screenshot.sh). Every project and conversation in them is invented.

macOS for now. Linux is planned.

Install

Download (macOS)

Grab the archive for your Mac from Releases: darwin_arm64 for Apple Silicon, darwin_amd64 for Intel.

arch=$(uname -m | sed 's/x86_64/amd64/')
curl -fsSLO "https://github.com/Ray0907/kioku/releases/latest/download/SHA256SUMS"
file=$(grep "darwin_${arch}" SHA256SUMS | awk '{print $2}')
curl -fsSLO "https://github.com/Ray0907/kioku/releases/latest/download/${file}"
shasum -a 256 -c SHA256SUMS --ignore-missing
tar -xzf "$file" kioku && sudo mv kioku /usr/local/bin/

The binary is not notarized. Downloaded with curl it runs as is; if you downloaded it in a browser and macOS blocks it, run xattr -d com.apple.quarantine /usr/local/bin/kioku.

From source

Requires Go 1.26+ and a C compiler (Xcode Command Line Tools).

go install -tags sqlite_fts5 github.com/Ray0907/kioku@latest
# or, from a checkout:
make build

The sqlite_fts5 build tag is required.

Use

kioku                    # recent sessions
kioku 紅茶                # interactive search
kioku --json snapshot    # compact JSON page for scripts/agents
kioku --harness pi 魚池   # restrict to one agent
kioku index              # sync and print counts
kioku index --rebuild    # replace the index

When stdout is not a TTY, search prints a compact text page; --json prints a structured JSON page. --version prints the version; --no-mouse disables mouse input. The initial scan runs on first use; the TUI opens with its existing index and refreshes when the scan finishes.

Search: space means AND; "black tea" is an exact phrase; -word excludes; bare words are prefixes (resum finds resuming); use kioku -- --help to search a flag-like word. CJK terms match inside text, including single characters. Empty or negative-only queries show the latest message of each recent session. The TUI shows up to 300 results by default; one-shot text and JSON pages show 10 (--limit N changes either): selective queries use FTS5 BM25 (newest first on ties); queries whose positive ASCII terms and full FTS match both cover at least 90% use newest matching message time instead. Matching user/assistant messages appear before tool output, with the existing order preserved within each group. Only a single unquoted 1–2 letter Latin prefix is restricted to messages from the seven days before the index's latest timestamp; when older matches are omitted, text pages end with N older matches omitted (--all-time) and JSON includes omitted_older (a message count, including in --sessions). Use --all-time to remove this restriction.

For agents

kioku --limit 5 snapshot                  # short refs + snippets, at most 5 hits
kioku -p kioku --limit 5 snapshot        # exact project basename, case-insensitive; repeat -p for more
kioku --limit 5 --cursor TOKEN snapshot   # next page, same query and flags
kioku --sessions --limit 5 snapshot       # conversation-bearing sessions first; per-role hit counts
kioku show a1b2c3d4e5f6:12 --query "snapshot" --context 3  # center the hit, with surrounding messages
kioku show a1b2c3d4e5f6:12 --full         # entire marked message; context remains compact
kioku show a1b2c3d4e5f6 --context 0 --all    # walk the entire session, 10 messages/page
kioku --json --limit 5 snapshot          # one JSON object with hits and next_cursor

Replace the example ref and token with values from your output. Refs are stable short hashes of the source-qualified session ID plus the message index; show also accepts an unambiguous native session ID. Search snippets use at most 160 display cells; show text uses at most 400 unless --full is used for the marked hit (JSON then includes its original full text). The hit header and JSON total_sessions count distinct sessions across all matches. The copyable expand: command passes the search query to show, which centers the marked message around its first visible match; without --query, show starts at the beginning of the text. Session results include a directly showable best_ref, per-role counts (roles.you, roles.asst, roles.tool in JSON), and a 70-cell topic from the first real user message. show repeats that topic in its header and JSON. Sessions with conversation hits precede tool-only sessions; BM25 order remains within each tier. Show headers and JSON start, end, and hit_index use the same zero-based message indices as refs; session_total is the message count. A cursor: footer (or JSON next_cursor) appears only when more results exist; reuse it with the same mode, query, and flags. show --all starts at the first message and pages through the full session. JSON mirrors the text fields without full transcripts; use show to expand a result. Cursors use offsets against the current index, so a simultaneous reindex can shift later pages.

Key Action
typing search (30 ms debounce)
↓ / Esc search → results
↑↓ / j k select message; ↑ on first row returns to search
/ focus search
n / N next / previous hit in transcript
h / H add a highlight / clear highlights
v toggle full transcript
o open project in editor
y copy resume command
Enter resume selected session in its original directory
Tab / Shift-Tab cycle all / claude / codex / pi
? help
Ctrl-C / Esc in results quit

Mouse clicks select/focus rows, click a highlighter tag to remove it, and wheel scrolls. Colors follow terminal background; KIOKU_THEME=light|dark overrides detection.

Editor resolution: KIOKU_EDITOR, then VISUAL, then the first available zed, cursor, code, subl, then supported macOS apps, then Finder. Clipboard uses pbcopy plus OSC 52.

Data and privacy

Local-only and read-only: transcript stores are never changed or uploaded. The only persistent writes are the search index under $XDG_CACHE_HOME/kioku/index.db (or ~/.cache/kioku/index.db). Override it with KIOKU_INDEX; override source roots independently with KIOKU_CLAUDE_DIR, KIOKU_CODEX_DIR, KIOKU_PI_DIR. $HOME controls the default roots. Set KIOKU_DEBUG_TIMING=1 for startup/sync/query/snippet/render timings on stderr.

Search tokenization uses fts5-cjk, statically linked under its original license in internal/cjk/.

Agent skill

skills/kioku/SKILL.md teaches coding agents to reach for kioku whenever you mention earlier work ("last time we…", "where did I…", 之前、上次). With it, they search wide to narrow instead of grepping raw transcripts: --sessions, then hits, then show, paging with --cursor. Install it once:

git clone https://github.com/Ray0907/kioku && cd kioku
mkdir -p ~/.claude/skills/kioku ~/.agents/skills/kioku
cp skills/kioku/SKILL.md ~/.claude/skills/kioku/   # Claude Code
cp skills/kioku/SKILL.md ~/.agents/skills/kioku/   # Codex, Pi and other agents that read ~/.agents/skills

The kioku binary must be on your PATH.

License

MIT. Bundles fts5-cjk (MIT) and SQLite headers (public domain).

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cjk

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL