Agent skill

Session History Search

by slopus in slopus/happy

Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs.

MITAuto-check passedAgent Workflows

Install Session History Search

skills CLI
$ npx skills add slopus/happy --skill sessions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install slopus/happy sessions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/slopus/happy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/sessions .claude/skills/sessions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sessions
GitHub stars
24k
Token cost
~3.1k tokens
SKILL.md length
1,486 words
Files
5 (incl. scripts)
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs.

  • Works in 7 steps: Determine scan window → Discover sessions and extract metadata → Filter and rank → …
  • Recalling what you tried on a bug in an earlier agent session
  • SKILL.md covers Usage, Pre-resolved context, Note: 2026 and Guardrails, plus 4 more sections
  • Runs Python and Shell scripts from its folder; calls python3, git and bash

What it does

Questions about earlier coding-agent work, such as what was tried before, how a problem was investigated or what happened recently, are what this skill answers. It runs as /ce-sessions with an optional question or topic, and it pre-resolves the current git branch and repository name to narrow down which sessions to look at. It also applies when you refer to previous attempts without using the word sessions.

Session files can run to several megabytes, so the skill never loads them whole. It calls bundled scripts to discover sessions and to extract metadata, errors and a skeleton of each conversation, then reasons over that filtered output and passes the synthesis to a subagent.

Guardrails keep the result safe to share: tool inputs and outputs are summarized rather than quoted, thinking blocks are left out, the current session is skipped, credentials and personal remarks stay out of the summary, and access errors are reported at once instead of being retried.

When your agent uses it

  • Recalling what you tried on a bug in an earlier agent session
  • Reviewing what happened on this branch over the past few days
  • Checking what earlier Codex or Cursor sessions decided about a design question

Example prompts

  • “What did we try last week when the build kept failing on this branch?”
  • “Search my earlier sessions for how we investigated the slow login query.”
  • “Summarize what was worked on in this repo during recent sessions.”

Requirements

  • Bash and Python for the bundled extraction scripts
  • Local session history from Claude Code, Codex or Cursor

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Determine scan window
  2. Discover sessions and extract metadata
  3. Filter and rank
  4. Set up scratch space
  5. Extract per-session content (file-mediated)
  6. Dispatch synthesis subagent
  7. Return findings

What it can do on your machine

Read from SKILL.md and the folder at commit 7ea7017. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 4 files in scripts/ (Python and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • git
    • bash

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Session History Search loads about 3.1k tokens when it runs. Until then it costs about 105 tokens; SKILL.md has 1,486 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~105
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from slopus/happy at commit 7ea7017, republished under its MIT licence (© slopus). 1,486 words, ~3,130 tokens.

Download SKILL.mdSave it as .claude/skills/sessions/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
sessions
description
Search and ask questions about coding agent session history across Claude Code, Codex, and Cursor. Use when asking what was worked on, what was tried before, how a problem was investigated across sessions, what happened recently, or any question about past agent sessions. Also use when the user references prior sessions, previous attempts, or past investigations — even without saying 'sessions' explicitly.

/sessions (installed from EveryInc/compound-engineering-plugin ce-sessions)

Search session history across Claude Code, Codex, and Cursor and synthesize findings about what was worked on, tried, decided, or learned in prior sessions.

Usage

/ce-sessions [question or topic]
/ce-sessions

Pre-resolved context

Git branch (pre-resolved): !git rev-parse --abbrev-ref HEAD 2>/dev/null || true

If the line above resolved to a plain branch name (like feat/my-branch), use it for branch filtering and pass it to the synthesis subagent. If it still contains a backtick command string or is empty, derive the branch at runtime instead.

Repo name (pre-resolved): !basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || true

If the line above resolved to a plain repo folder name, use it for session discovery. Otherwise derive at runtime.

Note: 2026

The current year is 2026. Use this when interpreting session timestamps.

Guardrails

These rules apply at all times during orchestration and synthesis.

  • Never read entire session files into context. Session files can be 1-7MB. Always use the extraction scripts to filter first, then reason over the filtered output.
  • Never extract or reproduce tool call inputs/outputs verbatim. Summarize what was attempted and what happened.
  • Never include thinking or reasoning block content. Claude Code thinking blocks are internal reasoning; Codex reasoning blocks are encrypted. Neither is actionable.
  • Never analyze the current session. Its conversation history is already available to the caller.
  • Surface technical content, not personal content. Sessions contain everything — credentials, frustration, half-formed opinions. Use judgment about what belongs in a technical summary and what doesn't.
  • Fail fast on access errors. If session discovery fails on permissions, report the issue immediately. Do not retry the same operation with different tools or approaches — repeated retries waste tokens without changing the outcome.

Execution

If no question argument is provided, ask what the user wants to know about their session history. Use the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), request_user_input in Codex, ask_user in Gemini, ask_user in Pi (requires the pi-ask-user extension). Fall back to asking in plain text only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question.

Step 1 — Determine scan window

Infer a time range from the user's question. Start narrow; widen only if a narrow scan finds nothing relevant.

SignalInitial scan window
"today", "this morning"1 day
"recently", "last few days", "this week", or no time signal7 days
"last few weeks", "this month"30 days
"last few months", broad feature history90 days

Claude Code retains session history for ~30 days by default. Wider windows may find nothing on Claude Code unless the user has extended retention.

Step 2 — Discover sessions and extract metadata

Run the discovery + metadata pipeline (preserving the null-delimited xargs hardening that lets extract-metadata.py run in batch mode):

bash
bash scripts/discover-sessions.sh <repo> <days> | tr '\n' '\0' | xargs -0 python3 scripts/extract-metadata.py --cwd-filter <repo>

Each output line is a JSON object describing a session (platform, file, size, ts, session, plus platform-specific fields). The final _meta line carries files_processed and parse_errors.

If the inventory's _meta line shows files_processed: 0, return "no relevant prior sessions" and stop.

If parse_errors > 0, note that some sessions could not be parsed and proceed with what was returned.

To narrow the platform set, add --platform claude, --platform codex, or --platform cursor to the discover-sessions.sh invocation. Default to all three.

Step 3 — Filter and rank

Apply these filters in order to pick the sessions worth deep-diving:

  1. Branch filter (Claude Code only). Keep sessions where branch == dispatch_branch exactly, or where the branch name contains a keyword from the question's topic (e.g., a question about "auth middleware" matches branches feat/auth-fix, chore/auth-refactor). Codex sessions don't carry gitBranch — skip this filter for them.

  2. If the branch filter returned zero sessions, or you're processing Codex sessions:

    • Derive 2-4 keywords from the question's topic. For "a recent crash in the auth middleware where session-validation rejects valid tokens", derive auth,middleware,session,token (or similar).
    • Re-invoke the discovery pipeline with --keyword K1,K2,... appended to the extract-metadata.py invocation. The script returns sessions with non-zero match_count plus per-keyword counts.
    • If files_matched: 0, return "no relevant prior sessions" and stop. Do not extract anything.
    • If files_matched > 0, treat those sessions as candidates. Rank by match_count, break ties by per-keyword counts.
  3. Drop sessions outside the scan window. Use last_ts when available, fall back to ts. Discard sessions where both fall before the window start.

  4. Exclude the current session — its conversation history is already available to the caller.

  5. Apply the deep-dive cap. Take at most 5 sessions total across all platforms. Narrow by branch-match → match_count → file size > 30KB → recency.

  6. Proceed only if at least one session remains after filtering. Otherwise return "no relevant prior sessions" and stop.

Note: gitBranch is captured at the first user message only. A session that began on main and did substantive work on a feature branch via mid-session git checkout records branch: "main". Branch-match returning nothing is not conclusive evidence — that's why the keyword-filter fallback in step 2 is required.

Step 4 — Set up scratch space

Create a per-run throwaway scratch directory:

bash
SCRATCH=$(mktemp -d -t ce-sessions-XXXXXX)

Capture the absolute path; thread it into Step 5 and Step 6. The OS handles cleanup on session end; an explicit rm -rf "$SCRATCH" at the end of Step 7 is harmless and makes intent explicit.

Show full SKILL.md (638 more words)Show less
Step 5 — Extract per-session content (file-mediated)

For each selected session, run the skeleton extractor with --output so content writes directly to the scratch file — extraction bytes never round-trip through the orchestrator's tool results:

bash
python3 scripts/extract-skeleton.py --output "$SCRATCH/<session-id>.skeleton.txt" < <session-file>

Stdout receives only a one-line JSON status ({"_meta": true, "wrote": "...", "bytes": N, ...}). Capture bytes and parse_errors from each status line.

Conditional tail-extract — if a skeleton terminates mid-investigation (last visible turn is a tool call with no resolution, or the assistant is mid-debugging without a conclusion), re-extract with a tail shape:

bash
python3 scripts/extract-skeleton.py --output "$SCRATCH/<session-id>.skeleton.tail.txt" < <session-file>

(The skeleton script does not accept a tail:N cap directly; if a tail-only view is needed, post-process the scratch file in shell with tail -n 50 after extraction. Use this only when the head output suggests the session was truncated mid-investigation.)

Conditional errors-mode — for sessions where investigation dead-ends are likely valuable:

bash
python3 scripts/extract-errors.py --output "$SCRATCH/<session-id>.errors.txt" < <session-file>

Use selectively — only when understanding what went wrong adds value. Cursor agent transcripts don't log tool results, so errors-mode produces nothing for Cursor sessions.

Step 6 — Dispatch synthesis subagent

Dispatch the ce-session-historian subagent via the platform's subagent primitive (Agent in Claude Code, spawn_agent in Codex, subagent in Pi via the pi-subagents extension). Omit the mode parameter so the user's configured permission settings apply. Run on the mid-tier model (e.g., model: "sonnet" in Claude Code) — the synthesizer doesn't need frontier reasoning.

The dispatch prompt is the agent's input contract. Pass these fields:

  • problem_topic — one sentence naming the concrete question. Lift from the user's argument or, if missing, from the answer to the no-arg prompt.
  • scratch_dir — absolute path to $SCRATCH.
  • sessions — an array of objects, one per extracted session, each with:
    • path — absolute path to the skeleton file (and optionally errors_path for the errors file when extracted)
    • platform — claude, codex, or cursor
    • branch — git branch when present (Claude Code only)
    • cwd — working directory when present (Codex only)
    • ts and last_ts — session timestamps
    • match_count and keyword_matches — when keyword filtering was used
  • output_schema — the structure the agent's response should follow. Default schema:
    Structure your response with these sections (omit any with no findings):
    - What was tried before
    - What didn't work
    - Key decisions
    - Related context
    When the caller (e.g., ce-compound) supplies a schema in the skill argument, pass it through verbatim.

Example dispatch shape:

Synthesize findings from these prior sessions:

Problem topic: <one-line topic>

Sessions to read (paths in $SCRATCH):
1. /tmp/ce-sessions-XXXX/abc123.skeleton.txt
   platform=claude branch=feat/auth-fix ts=2026-05-01
2. /tmp/ce-sessions-XXXX/def456.skeleton.txt  errors=/tmp/ce-sessions-XXXX/def456.errors.txt
   platform=codex cwd=/Users/.../my-project ts=2026-05-03
...

Output schema:
- What was tried before
- What didn't work
- Key decisions
- Related context

Filter rule: only surface findings directly relevant to this specific problem.
Ignore unrelated work from the same sessions or branches.

The agent reads each path via the platform's native file-read tool and returns prose findings. Bulk extraction content lives only in the agent's subagent context — the orchestrator's working state stays at file paths plus small inventory metadata.

Step 7 — Return findings

Return the synthesizer's output text to the caller verbatim. If discovery or keyword filtering returned zero sessions (Step 2 or Step 3), return the literal string no relevant prior sessions instead.

Optionally clean up scratch:

bash
rm -rf "$SCRATCH"

The OS handles cleanup eventually regardless; the explicit cleanup is for readers who expect it.

Output

When the caller (typically a user typing /ce-sessions, or another skill invoking ce-sessions via the platform's skill-invocation primitive) does not specify an output format, include a brief header noting what was searched:

**Sessions searched**: [count] ([N] Claude Code, [N] Codex, [N] Cursor) | [date range]

Then the synthesizer's prose findings. When the caller supplies a schema, honor it verbatim and omit the default header.

Time budget

Stop as soon as a complete answer is available. A confident "no relevant prior sessions" within seconds is a complete answer; do not extend the search to fill time. The structural caps in Step 3 (max 5 sessions deep-dived) and Step 5 (conditional tail/errors extraction) bound runtime by construction.

Error handling

If the discovery pipeline fails (e.g., unreadable home directory, permission failure), surface the error to the caller. Do not substitute git log, file listings, or other sources — this skill's contract is session metadata and synthesis.

If extraction --output write fails (disk full, permission), surface a clear error and do not dispatch the synthesizer with partial paths.

If _meta reports parse_errors > 0 from any script, note partial extraction in the dispatch prompt and proceed; the synthesizer flags partial in findings.

© slopus, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts) in .agents/skills/sessions of slopus/happy.

  • SKILL.md
  • scripts/discover-sessions.sh
  • scripts/extract-errors.py
  • scripts/extract-metadata.py
  • scripts/extract-skeleton.py

Open the folder on GitHubat commit 7ea7017

Compare with similar skills

Session History Search next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Session History Search compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Session History Search this skillslopus/happy24k—~3.1kAutomated safety check: PassMIT
Beads Task Memorygastownhall/beads28k—~1.2kAutomated safety check: PassMIT
Session Handoff Writercodewhale-hq/Codewhale41k—~1.2kAutomated safety check: PassMIT
File-Based Planning in ArabicOthmanAdi/planning-with-files27k—~3.2kAutomated safety check: NotesMIT
Context Savegarrytan/gstack136k—~9.7kAutomated safety check: NotesMIT
Gccdavila7/claude-code-templates32k—~1.6kAutomated safety check: PassMIT

Similar skills

  • Beads Task Memory

    gastownhall/beads

    Tracks multi-session work with dependencies in the bd issue tracker so the agent can find ready tasks and recover its context after conversation compaction.

    28k GitHub stars~1.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Session Handoff Writer

    codewhale-hq/Codewhale

    Writes a compact handoff note from real git and CI state so the next session or a teammate can pick up the work without rebuilding the context.

    41k GitHub stars~1.2k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • File-Based Planning in Arabic

    OthmanAdi/planning-with-files

    Arabic edition of a file-based planning skill that keeps task_plan.md, findings.md and progress.md on disk so multi-step agent work survives lost context.

    27k GitHub stars~3.2k tokensUpdated today
    Agent WorkflowsAuto-check: notes
  • Context Save

    garrytan/gstack

    Captures git state, decisions made and remaining work so that a later session can resume the task without losing context.

    136k GitHub stars~9.7k tokensUpdated today
    Agent WorkflowsAuto-check: notes
  • Gcc

    davila7/claude-code-templates

    Git Context Controller (GCC) - Manages agent memory as a versioned file system under .GCC/.

    32k GitHub stars~1.6k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Elite Longterm Memory

    aAAaqwq/AGI-Super-Team

    Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot.

    105 GitHub starsUsed in 2 repos~2.9k tokens
    Agent WorkflowsAuto-check passed

More from slopus/happy

All 8 skills in this repo
  • Agent Browser CLI

    slopus/happy

    Drives a real browser from the shell with the agent-browser CLI: open pages, snapshot elements by ref, click, fill and extract, for testing web flows.

    24k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Traces how an action moves through your code and draws it as a compact ASCII tree: functions called, payload types, state changes and components that re-render.

    24k GitHub stars~654 tokensUpdated today
    Auto-check passed
  • Local development guide for the Happy pnpm monorepo: install, build, test and run the CLI, server, Expo app and Tauri desktop packages.

    24k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Queries live Prometheus metrics and manages Grafana dashboards as code for Happy's infrastructure, using the grafanactl CLI and the Grafana datasource proxy API.

    24k GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Tests interactive CLI and TUI programs with Microsoft's tui-test, driving prompts, arrow keys and screen output in a real pseudo-terminal.

    24k GitHub stars~603 tokensUpdated today
    Auto-check passed
  • Walks you through releasing a component of the Happy monorepo (CLI, mobile, web or server) from a clean local main that matches origin/main.

    24k GitHub stars~6.6k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Session History Search

What does Session History Search do?

Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs. Questions about earlier coding-agent work, such as what was tried before, how a problem was investigated or what happened recently, are what this skill answers. It runs as /ce-sessions with an optional question or topic, and it pre-resolves the current git branch and repository name to narrow down which sessions to look at.

When should I use Session History Search?

Session History Search fits situations like: recalling what you tried on a bug in an earlier agent session; reviewing what happened on this branch over the past few days; checking what earlier Codex or Cursor sessions decided about a design question.

How do I install Session History Search in Claude Code?

Run `npx skills add slopus/happy --skill sessions -a claude-code`. Or copy the skill folder (.agents/skills/sessions in slopus/happy) into .claude/skills/sessions in your project. Claude Code loads it when a task matches its description.

How do I install Session History Search in Codex?

Run `npx skills add slopus/happy --skill sessions -a codex`. Or copy the skill folder (.agents/skills/sessions in slopus/happy) into .agents/skills/sessions in your project. Codex loads it when a task matches its description.

Can I use Session History Search in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add slopus/happy --skill sessions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sessions, .gemini/skills/sessions, .github/skills/sessions and .opencode/skills/sessions in your project.

What does Session History Search need to run?

Going by SKILL.md and its folder, Session History Search needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (python3, git and bash). Our summary lists: Bash and Python for the bundled extraction scripts; Local session history from Claude Code, Codex or Cursor.

Does Session History Search access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Session History Search safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Session History Search use?

Session History Search is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Session History Search use?

About 3.1k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Session History Search?

Skills that share tags, products or a category with Session History Search: Beads Task Memory (gastownhall/beads, 28k stars), Session Handoff Writer (codewhale-hq/Codewhale, 41k stars), File-Based Planning in Arabic (OthmanAdi/planning-with-files, 27k stars) and Context Save (garrytan/gstack, 136k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Session History Search?

slopus (a GitHub organization) maintains it in slopus/happy, which has 24,039 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 7, 2026.

Source: slopus/happy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.