Metadata-Version: 2.4
Name: concinno-skills-session-search
Version: 0.2.0
Summary: Concinno's cross-session search — SQLite FTS5 index over past Claude Code session transcripts with optional Haiku-generated summaries, lifecycle hooks, and a CLI.
Project-URL: Homepage, https://github.com/aiking931931/concinno
Project-URL: Documentation, https://github.com/aiking931931/concinno/blob/main/projects/concinno-skills-session-search/README.md
Project-URL: Repository, https://github.com/aiking931931/concinno
Project-URL: Issues, https://github.com/aiking931931/concinno/issues
Project-URL: Changelog, https://github.com/aiking931931/concinno/blob/main/projects/concinno-skills-session-search/CHANGELOG.md
Author-email: "AI King (Chen-Xuan Wang)" <me@ai-king.dev>
License-Expression: AGPL-3.0-or-later
License-File: LICENSE
Keywords: agent-memory,concinno,cross-session,fts5,haiku,session-search,sqlite
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.40; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: anthropic>=0.40; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# concinno-skills-session-search

Cross-session search for the Concinno agent. A long-running agent
forgets prior sessions because each Claude Code transcript is isolated.
This sub-package gives the agent a queryable SQLite FTS5 index over
its own past sessions plus optional Haiku-generated summaries, so it
can answer "did we already debug this?" / "what did the last KILL 10
wave decide?" / "where did we put the audit plan?" inside one tool-use
round.

## Install

```sh
pip install concinno-skills-session-search                    # core
pip install 'concinno-skills-session-search[anthropic]'       # + Haiku summaries
```

The core install is **stdlib-only** — `sqlite3` ships with CPython.
The `anthropic` SDK is optional; without it, the summariser falls back
to a truncate-first-N-chars heuristic so the import path never
hard-fails.

## Quick start

```python
from concinno_skills_session_search import SessionIndex

idx = SessionIndex()  # ~/.concinno/session_search.sqlite by default
idx.index_session(
    session_id="2026-04-28-W4-fast-followers",
    transcript_text="we shipped HP4 cross-session search ...",
    started_at=1714305600.0,
    ended_at=1714312800.0,
)
for hit in idx.search("HP4 cross-session"):
    print(hit.session_id, hit.summary[:120])
```

## Lifecycle wiring

When Concinno main >=4.6.0 is installed, the three lifecycle hooks
run automatically:

* `on_session_start` — read-only no-op (the agent reads on demand).
* `on_stop`           — index this session's transcript with a
  best-effort Haiku summary; ImportError / API errors are swallowed.
* `on_session_end`    — `idx.prune(days=90)` enforces 90-day retention.

See `concinno.hooks.on_session_start` / `on_stop` for the wiring site.

## CLI

```sh
concinno-session-search --query "audit plan" --limit 5
concinno-session-search --count
concinno-session-search --prune-days 90
concinno-session-search --reindex --session-id S1 --transcript-file t.txt
```

`--format=json` is supported on every subcommand.

## Environment

| Variable | Purpose |
|---|---|
| `CONCINNO_SESSION_SEARCH_DB` | Override `~/.concinno/session_search.sqlite`. |
| `ANTHROPIC_API_KEY` | Read by the optional Haiku summariser. |

## License

AGPL-3.0-or-later. Copyright (C) 2026 Chen Syuan Wang (王晨宣 / AI King).
