Skip to main content
Glama
agy-session-search

agy-session-search

by ctx-o1
README.md
# agy-session-search

Give your agent searchable memory of past Antigravity conversations. Find earlier decisions, debugging sessions, and saved plans using local transcript files.

## Quick start

Requires **Node.js 22.16+**.

Point your coding agent at this repo:

```text
Set up agy-session-search in my MCP client using the instructions here:
https://github.com/ctx-o1/agy-session-search
```

<details>
<summary>Manual configuration</summary>

Add this server to your MCP configuration:

```json
{
  "mcpServers": {
    "agy-session-search": {
      "command": "npx",
      "args": ["-y", "agy-session-search"]
    }
  }
}
```

For Antigravity, merge it into `~/.gemini/config/mcp_config.json` (`%USERPROFILE%\.gemini\config\mcp_config.json` on Windows). Preserve your other server entries, then reload MCP servers.

</details>

Once connected, ask:

> Find the conversation where we implemented OAuth token refresh retries in my-project. Read the matching steps and summarize the decision.

## Tools

| Tool | Description |
| :--- | :--- |
| `search_sessions` | Search messages and artifacts by keyword, phrase, or prefix. Filter by project, role, surface, or date. |
| `list_sessions` | Browse recent sessions with titles, projects, timestamps, and artifact names. |
| `read_session` | Read steps around a search hit, with optional full-transcript expansion. |
| `read_artifact` | List or read a session's Markdown artifacts. |
| `reindex_sessions` | Sync changed files or rebuild the index. |

Queries support `"exact phrases"`, `prefix*`, and uppercase `OR`. Tool output and thinking summaries are excluded from searches by default. Session reads accept a full ID or a unique prefix of at least six characters.

To have your agent use it automatically, add this to your project rules:

```text
When I reference a past conversation or earlier decision, use agy-session-search
filtered by the current project, then read the matching steps before answering.
```

## CLI

```bash
npx -y agy-session-search search "OAuth retry" --project my-project
npx -y agy-session-search list --limit 10
npx -y agy-session-search read SESSION_ID --around 14 --context 4
npx -y agy-session-search artifact SESSION_ID walkthrough.md
npx -y agy-session-search stats
```

Replace `SESSION_ID` with an ID or prefix from a result. Use `--help` for flags and `--json` for structured search, list, read, or artifact output.

## Configuration

The default scan directories are `~/.gemini/antigravity/brain/` and `~/.gemini/antigravity-cli/brain/`. Supported files are `.system_generated/logs/transcript.jsonl` and Markdown artifacts directly inside each session directory. `transcript_full.jsonl` is used for expanded reads when requested. Sessions without available transcripts can only contribute artifacts.

| Environment variable | Flag | Description |
| :--- | :--- | :--- |
| `AGY_BRAIN_DIRS` | `--dir <path>` (repeatable) | Replace the default scan directories. Environment paths use `;` on Windows and `:` elsewhere. |
| `AGY_SESSION_SEARCH_DB` | `--db <path>` | Set the SQLite cache path, or `:memory:` for a nonpersistent index. |
| `AGY_SEARCH_ENGINE` | `--engine sqlite` or `--engine memory` | Choose SQLite FTS5 or pure-JavaScript BM25. SQLite is the default, with automatic fallback to memory. |

Flags override environment variables. Use absolute paths in MCP configuration. Custom directories have `surface: custom`; use a separate database path for each root configuration if overriding the cache location.

If searches return nothing, check `stats` for the scan directories and indexed counts, then try without a project filter. Available transcript files determine which conversations are searchable.

## Development

```bash
npm ci
npm run typecheck
npm test
```

Tests build the package and use synthetic session fixtures. `npm pack` creates a clean release tarball.

## License

[MIT](LICENSE)

TDQS

A4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool occupies a distinct slot in the workflow: enumerate (list_sessions), maintain the index (reindex_sessions), query (search_sessions), read transcript content (read_session), and read attached markdown files (read_artifact). The only near-pair, read_session vs read_artifact, is clearly separated by the descriptions (turns/steps vs markdown artifacts). No two tools could plausibly be swapped for the same task.

Naming Consistency5/5

All five names follow a strict snake_case verb_noun pattern (list_, reindex_, search_, read_, read_) with the shared 'session(s)'/'artifact' domain nouns. Verb choices accurately reflect the operation type, making the pattern predictable for an agent.

Tool Count5/5

Five tools is a tight, well-earned surface for a session search server: one to index, one to browse, one to search, and two to read results at different granularities. Nothing is redundant and nothing feels padded.

Completeness4/5

The lifecycle is covered end-to-end: build/refresh the index, list sessions, search, then drill into turns and artifacts, including pagination guidance for long transcripts. Minor gaps exist — no direct fetch of a single session's metadata by id, no cross-session artifact listing, and no index cleanup/delete — but these are workaroundable via search and list.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues