reprompt-cli 0.1.1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/workflows/ci.yml +4 -4
  2. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/workflows/publish.yml +2 -2
  3. reprompt_cli-0.2.0/.pre-commit-config.yaml +7 -0
  4. reprompt_cli-0.2.0/CHANGELOG.md +58 -0
  5. reprompt_cli-0.2.0/CLAUDE.md +67 -0
  6. reprompt_cli-0.2.0/CODE_OF_CONDUCT.md +11 -0
  7. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/PKG-INFO +44 -21
  8. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/README.md +43 -20
  9. reprompt_cli-0.2.0/docs/launch-post.md +106 -0
  10. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/pyproject.toml +1 -1
  11. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/__init__.py +1 -1
  12. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/adapters/openclaw.py +42 -10
  13. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/cli.py +69 -15
  14. reprompt_cli-0.2.0/src/reprompt/config.py +119 -0
  15. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/dedup.py +18 -4
  16. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/pipeline.py +22 -7
  17. reprompt_cli-0.2.0/src/reprompt/embeddings/local_embed.py +45 -0
  18. reprompt_cli-0.2.0/src/reprompt/embeddings/openai_embed.py +58 -0
  19. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/output/markdown.py +6 -2
  20. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/output/terminal.py +21 -1
  21. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/storage/db.py +81 -0
  22. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_adapter_claude.py +3 -1
  23. reprompt_cli-0.2.0/tests/test_adapter_openclaw.py +190 -0
  24. reprompt_cli-0.2.0/tests/test_cli.py +178 -0
  25. reprompt_cli-0.2.0/tests/test_config.py +88 -0
  26. reprompt_cli-0.2.0/tests/test_db.py +237 -0
  27. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_dedup.py +36 -1
  28. reprompt_cli-0.2.0/tests/test_embeddings_local.py +113 -0
  29. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_embeddings_ollama.py +3 -5
  30. reprompt_cli-0.2.0/tests/test_embeddings_openai.py +134 -0
  31. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_install_hook.py +24 -25
  32. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_output.py +47 -0
  33. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_pipeline.py +61 -0
  34. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/uv.lock +45 -45
  35. reprompt_cli-0.1.1/CHANGELOG.md +0 -34
  36. reprompt_cli-0.1.1/src/reprompt/config.py +0 -44
  37. reprompt_cli-0.1.1/tests/test_adapter_openclaw.py +0 -64
  38. reprompt_cli-0.1.1/tests/test_cli.py +0 -96
  39. reprompt_cli-0.1.1/tests/test_config.py +0 -22
  40. reprompt_cli-0.1.1/tests/test_db.py +0 -108
  41. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.editorconfig +0 -0
  42. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  43. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  44. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  45. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.github/dependabot.yml +0 -0
  46. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/.gitignore +0 -0
  47. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/CONTRIBUTING.md +0 -0
  48. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/LICENSE +0 -0
  49. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/SECURITY.md +0 -0
  50. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/adapters/__init__.py +0 -0
  51. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/adapters/base.py +0 -0
  52. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/adapters/claude_code.py +0 -0
  53. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/__init__.py +0 -0
  54. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/analyzer.py +0 -0
  55. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/library.py +0 -0
  56. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/core/models.py +0 -0
  57. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/embeddings/__init__.py +0 -0
  58. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/embeddings/base.py +0 -0
  59. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/embeddings/ollama.py +0 -0
  60. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/embeddings/tfidf.py +0 -0
  61. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/output/__init__.py +0 -0
  62. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/output/json_out.py +0 -0
  63. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/py.typed +0 -0
  64. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/src/reprompt/storage/__init__.py +0 -0
  65. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/__init__.py +0 -0
  66. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/conftest.py +0 -0
  67. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/fixtures/claude_session.jsonl +0 -0
  68. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/fixtures/openclaw_session.jsonl +0 -0
  69. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_analyzer.py +0 -0
  70. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_e2e.py +0 -0
  71. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_library.py +0 -0
  72. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_markdown.py +0 -0
  73. {reprompt_cli-0.1.1 → reprompt_cli-0.2.0}/tests/test_models.py +0 -0
@@ -14,13 +14,13 @@ jobs:
14
14
  os: [ubuntu-latest, macos-latest]
15
15
  python-version: ["3.10", "3.11", "3.12"]
16
16
  steps:
17
- - uses: actions/checkout@v4
17
+ - uses: actions/checkout@v6
18
18
  - name: Set up Python
19
- uses: actions/setup-python@v5
19
+ uses: actions/setup-python@v6
20
20
  with:
21
21
  python-version: ${{ matrix.python-version }}
22
22
  - name: Install uv
23
- uses: astral-sh/setup-uv@v4
23
+ uses: astral-sh/setup-uv@v7
24
24
  - name: Install dependencies
25
25
  run: uv pip install --system -e ".[dev]"
26
26
  - name: Lint
@@ -31,6 +31,6 @@ jobs:
31
31
  run: pytest tests/ -v --cov=reprompt --cov-report=xml
32
32
  - name: Upload coverage
33
33
  if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
34
- uses: codecov/codecov-action@v4
34
+ uses: codecov/codecov-action@v5
35
35
  with:
36
36
  file: coverage.xml
@@ -11,8 +11,8 @@ jobs:
11
11
  publish:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v4
15
- - uses: actions/setup-python@v5
14
+ - uses: actions/checkout@v6
15
+ - uses: actions/setup-python@v6
16
16
  with:
17
17
  python-version: "3.12"
18
18
  - name: Install build tools
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.11.6
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
@@ -0,0 +1,58 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.2.0] - 2026-03-11
6
+
7
+ ### Added
8
+ - `reprompt search <query>` command for keyword search across prompt history
9
+ - Local embedding backend (`pip install reprompt-cli[local]`, sentence-transformers)
10
+ - OpenAI embedding backend (`pip install reprompt-cli[openai]`)
11
+ - TOML config file support (`~/.config/reprompt/config.toml`)
12
+ - K-means clustering output in terminal report
13
+ - TF-IDF hot terms table in terminal report
14
+ - OpenClaw adapter supports new `~/.openclaw/` path (backward compatible)
15
+ - Competitive comparison table in README
16
+
17
+ ### Fixed
18
+ - `install-hook` now registers in Claude Code `settings.json` (was writing unregistered shell script)
19
+ - `ollama_url` config setting now propagates to OllamaEmbedder
20
+ - Pattern IDs are stable across report runs (upsert instead of clear+re-insert)
21
+ - Text truncation in all outputs now shows `...` suffix
22
+ - JSON output uses `print()` instead of Rich `console.print()` to avoid markup corruption
23
+
24
+ ### Changed
25
+ - Tests: 118 → 176
26
+ - OpenClaw adapter checks both `~/.openclaw/` (new) and `~/.opencode/` (legacy)
27
+
28
+ ## [0.1.1] - 2026-03-10
29
+
30
+ ### Fixed
31
+ - Prevent connection leak in all database methods (try/finally)
32
+ - Fix session marking for incremental scan accuracy
33
+ - Fix purge validation for date format parsing
34
+ - Fix pattern dedup to avoid duplicate entries
35
+ - Improve Ollama error messages when server is unreachable
36
+ - Fix JSON output (`--format json`) producing invalid escape sequences
37
+
38
+ ### Added
39
+ - `--version` / `-V` flag to CLI
40
+ - mypy strict mode compliance
41
+
42
+ ## [0.1.0] - 2026-03-10
43
+
44
+ ### Added
45
+
46
+ - Initial release
47
+ - Claude Code session adapter (JSONL format)
48
+ - OpenClaw session adapter
49
+ - Two-layer deduplication (SHA-256 exact + TF-IDF semantic)
50
+ - TF-IDF hot terms analysis
51
+ - K-means prompt clustering
52
+ - Prompt pattern library with auto-categorization
53
+ - Rich terminal reports with tables and bar charts
54
+ - JSON output for CI/pipeline integration
55
+ - Markdown export for prompt library
56
+ - `install-hook` command for Claude Code automation
57
+ - Ollama embedding backend (optional)
58
+ - Zero-config defaults with env var and TOML override
@@ -0,0 +1,67 @@
1
+ # reprompt
2
+
3
+ CLI tool that extracts, deduplicates, and analyzes prompts from AI coding sessions.
4
+
5
+ ## Build & Test
6
+
7
+ ```bash
8
+ uv venv && uv pip install -e ".[dev]"
9
+ uv run pytest tests/ -v # run tests
10
+ uv run pytest tests/ -v --cov=reprompt # with coverage
11
+ uv run ruff check src/ tests/ # lint
12
+ uv run ruff format src/ tests/ # format
13
+ uv run mypy src/reprompt/ # type check (strict)
14
+ uv run python -m build # build wheel
15
+ ```
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ src/reprompt/
21
+ ├── cli.py # Typer CLI (scan, report, search, library, status, purge, install-hook)
22
+ ├── config.py # pydantic-settings, env vars (REPROMPT_ prefix) + TOML config
23
+ ├── core/
24
+ │ ├── models.py # Prompt dataclass (auto SHA-256 hash)
25
+ │ ├── dedup.py # Two-layer dedup: exact hash + TF-IDF cosine
26
+ │ ├── analyzer.py # TF-IDF hot terms + K-means clustering
27
+ │ ├── library.py # Pattern extraction + keyword categorization
28
+ │ └── pipeline.py # Orchestrator: scan → dedup → store → analyze → cluster
29
+ ├── adapters/
30
+ │ ├── base.py # BaseAdapter ABC
31
+ │ ├── claude_code.py # Claude Code JSONL parser
32
+ │ └── openclaw.py # OpenClaw JSON parser (supports ~/.openclaw/ + legacy ~/.opencode/)
33
+ ├── embeddings/
34
+ │ ├── base.py # BaseEmbedder ABC
35
+ │ ├── tfidf.py # Default (sklearn, zero config)
36
+ │ ├── ollama.py # Optional: pip install reprompt-cli[ollama]
37
+ │ ├── local_embed.py # Optional: pip install reprompt-cli[local] (sentence-transformers)
38
+ │ └── openai_embed.py # Optional: pip install reprompt-cli[openai]
39
+ ├── storage/
40
+ │ └── db.py # SQLite: prompts, processed_sessions, prompt_patterns, term_stats
41
+ └── output/
42
+ ├── terminal.py # Rich tables + bar charts + hot terms + clusters
43
+ ├── json_out.py # JSON for pipelines
44
+ └── markdown.py # Markdown export
45
+ ```
46
+
47
+ ## Data Flow
48
+
49
+ ```
50
+ Session files → Adapter.parse() → list[Prompt]
51
+ → DedupEngine: SHA-256 exact → TF-IDF cosine similarity
52
+ → SQLite: insert unique prompts, mark dupes
53
+ → Analyzer: TF-IDF hot terms + K-means clusters
54
+ → Library: extract high-frequency patterns, auto-categorize
55
+ → Output: terminal / JSON / Markdown
56
+ ```
57
+
58
+ ## Key Conventions
59
+
60
+ - Package name: `reprompt-cli` (PyPI), CLI command: `reprompt`
61
+ - Python >=3.10, type hints required, mypy strict
62
+ - ruff for lint + format (line-length=100)
63
+ - All db methods use try/finally for conn.close()
64
+ - Pattern upsert (not clear+re-insert) for stable IDs
65
+ - Prompts starting with `<` are filtered (system-injected XML)
66
+ - Config: env vars (REPROMPT_ prefix) > TOML (~/.config/reprompt/config.toml) > defaults
67
+ - Tests: pytest, 176 tests, 95% coverage target
@@ -0,0 +1,11 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
4
+
5
+ We are committed to providing a welcoming and inclusive experience for everyone.
6
+
7
+ ## Reporting
8
+
9
+ If you experience or witness unacceptable behavior, please report it by opening a [GitHub issue](https://github.com/reprompt-dev/reprompt/issues) or contacting the maintainers directly.
10
+
11
+ Reports will be reviewed and addressed promptly.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reprompt-cli
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Discover, analyze, and evolve your best prompts from AI coding sessions
5
5
  Project-URL: Homepage, https://github.com/reprompt-dev/reprompt
6
6
  Project-URL: Repository, https://github.com/reprompt-dev/reprompt
@@ -47,6 +47,8 @@ Description-Content-Type: text/markdown
47
47
 
48
48
  > Discover, analyze, and evolve your best prompts from AI coding sessions.
49
49
 
50
+ *repomix packs your code for AI. reprompt extracts insights from AI.*
51
+
50
52
  Every developer's AI session history contains reusable prompt patterns -- scattered across hundreds of session files. **reprompt** extracts them, deduplicates, analyzes frequency, and builds a personal prompt library that evolves over time.
51
53
 
52
54
  ## Quick Start
@@ -58,6 +60,25 @@ reprompt report
58
60
  reprompt library
59
61
  ```
60
62
 
63
+ ## Terminal Report
64
+
65
+ ```
66
+ reprompt -- AI Session Analytics
67
+ ========================================
68
+
69
+ Overview
70
+ Total prompts: 1,247
71
+ Unique (deduped): 832
72
+ Sessions scanned: 156
73
+ Sources: claude-code, openclaw
74
+
75
+ Top Prompt Patterns
76
+ # | Pattern | Count | Category
77
+ 1 | fix the failing test... | 42 | debug
78
+ 2 | add unit tests for... | 38 | test
79
+ 3 | refactor X to use... | 27 | refactor
80
+ ```
81
+
61
82
  ## Features
62
83
 
63
84
  - **Auto-detection** -- finds Claude Code and OpenClaw sessions automatically
@@ -68,15 +89,32 @@ reprompt library
68
89
  - **Rich reports** -- beautiful terminal output with tables and bar charts
69
90
  - **Multiple formats** -- terminal, JSON (for pipelines), Markdown (for docs)
70
91
  - **Pluggable adapters** -- add support for any AI coding tool
92
+ - **Prompt search** -- find past prompts by keyword across all sessions
71
93
  - **Zero config** -- works out of the box, customize via env vars or TOML
72
94
 
95
+ ## How reprompt Compares
96
+
97
+ | Feature | reprompt | prompt-manager | agent-sessions | cclog |
98
+ |---------|----------|---------------|----------------|-------|
99
+ | Multi-tool support | ✅ Claude, OpenClaw, + adapters | ✅ Multiple | ✅ Multiple | ❌ Claude only |
100
+ | Exact dedup (SHA-256) | ✅ | ❌ | ❌ | ❌ |
101
+ | Semantic dedup (TF-IDF) | ✅ | ❌ | ❌ | ❌ |
102
+ | Hot terms analysis | ✅ TF-IDF | ❌ | ❌ | ❌ |
103
+ | K-means clustering | ✅ | ❌ | ❌ | ❌ |
104
+ | Pattern library | ✅ Auto-categorized | ❌ | ❌ | ❌ |
105
+ | CLI interface | ✅ | ✅ TUI | ❌ macOS app | ✅ |
106
+ | JSON/Markdown export | ✅ | ❌ | ❌ | ❌ |
107
+ | Pluggable adapters | ✅ | ✅ | ❌ | ❌ |
108
+ | Zero config | ✅ | ✅ | ✅ | ✅ |
109
+
73
110
  ## Supported AI Tools
74
111
 
75
112
  | Tool | Status | Session Path |
76
113
  |------|--------|-------------|
77
114
  | Claude Code | Supported | `~/.claude/projects/` |
78
- | OpenClaw / OpenCode | Supported | `~/.opencode/sessions/` |
115
+ | OpenClaw / OpenCode | Supported | `~/.openclaw/` + `~/.opencode/sessions/` |
79
116
  | Cursor | Planned | -- |
117
+ | Aider | Planned | -- |
80
118
  | Codex CLI | Planned | -- |
81
119
  | Gemini CLI | Planned | -- |
82
120
 
@@ -98,6 +136,10 @@ reprompt report
98
136
  # JSON output (for CI/pipelines)
99
137
  reprompt report --format json
100
138
 
139
+ # Search your prompt history
140
+ reprompt search "authentication"
141
+ reprompt search "debug" --limit 5
142
+
101
143
  # View your prompt library
102
144
  reprompt library
103
145
 
@@ -117,25 +159,6 @@ reprompt install-hook
117
159
  reprompt purge --older-than 90d
118
160
  ```
119
161
 
120
- ## Terminal Report
121
-
122
- ```
123
- reprompt -- AI Session Analytics
124
- ========================================
125
-
126
- Overview
127
- Total prompts: 1,247
128
- Unique (deduped): 832
129
- Sessions scanned: 156
130
- Sources: claude-code, openclaw
131
-
132
- Top Prompt Patterns
133
- # | Pattern | Count | Category
134
- 1 | fix the failing test... | 42 | debug
135
- 2 | add unit tests for... | 38 | test
136
- 3 | refactor X to use... | 27 | refactor
137
- ```
138
-
139
162
  ## Configuration
140
163
 
141
164
  Zero config by default. Customize with environment variables or TOML:
@@ -7,6 +7,8 @@
7
7
 
8
8
  > Discover, analyze, and evolve your best prompts from AI coding sessions.
9
9
 
10
+ *repomix packs your code for AI. reprompt extracts insights from AI.*
11
+
10
12
  Every developer's AI session history contains reusable prompt patterns -- scattered across hundreds of session files. **reprompt** extracts them, deduplicates, analyzes frequency, and builds a personal prompt library that evolves over time.
11
13
 
12
14
  ## Quick Start
@@ -18,6 +20,25 @@ reprompt report
18
20
  reprompt library
19
21
  ```
20
22
 
23
+ ## Terminal Report
24
+
25
+ ```
26
+ reprompt -- AI Session Analytics
27
+ ========================================
28
+
29
+ Overview
30
+ Total prompts: 1,247
31
+ Unique (deduped): 832
32
+ Sessions scanned: 156
33
+ Sources: claude-code, openclaw
34
+
35
+ Top Prompt Patterns
36
+ # | Pattern | Count | Category
37
+ 1 | fix the failing test... | 42 | debug
38
+ 2 | add unit tests for... | 38 | test
39
+ 3 | refactor X to use... | 27 | refactor
40
+ ```
41
+
21
42
  ## Features
22
43
 
23
44
  - **Auto-detection** -- finds Claude Code and OpenClaw sessions automatically
@@ -28,15 +49,32 @@ reprompt library
28
49
  - **Rich reports** -- beautiful terminal output with tables and bar charts
29
50
  - **Multiple formats** -- terminal, JSON (for pipelines), Markdown (for docs)
30
51
  - **Pluggable adapters** -- add support for any AI coding tool
52
+ - **Prompt search** -- find past prompts by keyword across all sessions
31
53
  - **Zero config** -- works out of the box, customize via env vars or TOML
32
54
 
55
+ ## How reprompt Compares
56
+
57
+ | Feature | reprompt | prompt-manager | agent-sessions | cclog |
58
+ |---------|----------|---------------|----------------|-------|
59
+ | Multi-tool support | ✅ Claude, OpenClaw, + adapters | ✅ Multiple | ✅ Multiple | ❌ Claude only |
60
+ | Exact dedup (SHA-256) | ✅ | ❌ | ❌ | ❌ |
61
+ | Semantic dedup (TF-IDF) | ✅ | ❌ | ❌ | ❌ |
62
+ | Hot terms analysis | ✅ TF-IDF | ❌ | ❌ | ❌ |
63
+ | K-means clustering | ✅ | ❌ | ❌ | ❌ |
64
+ | Pattern library | ✅ Auto-categorized | ❌ | ❌ | ❌ |
65
+ | CLI interface | ✅ | ✅ TUI | ❌ macOS app | ✅ |
66
+ | JSON/Markdown export | ✅ | ❌ | ❌ | ❌ |
67
+ | Pluggable adapters | ✅ | ✅ | ❌ | ❌ |
68
+ | Zero config | ✅ | ✅ | ✅ | ✅ |
69
+
33
70
  ## Supported AI Tools
34
71
 
35
72
  | Tool | Status | Session Path |
36
73
  |------|--------|-------------|
37
74
  | Claude Code | Supported | `~/.claude/projects/` |
38
- | OpenClaw / OpenCode | Supported | `~/.opencode/sessions/` |
75
+ | OpenClaw / OpenCode | Supported | `~/.openclaw/` + `~/.opencode/sessions/` |
39
76
  | Cursor | Planned | -- |
77
+ | Aider | Planned | -- |
40
78
  | Codex CLI | Planned | -- |
41
79
  | Gemini CLI | Planned | -- |
42
80
 
@@ -58,6 +96,10 @@ reprompt report
58
96
  # JSON output (for CI/pipelines)
59
97
  reprompt report --format json
60
98
 
99
+ # Search your prompt history
100
+ reprompt search "authentication"
101
+ reprompt search "debug" --limit 5
102
+
61
103
  # View your prompt library
62
104
  reprompt library
63
105
 
@@ -77,25 +119,6 @@ reprompt install-hook
77
119
  reprompt purge --older-than 90d
78
120
  ```
79
121
 
80
- ## Terminal Report
81
-
82
- ```
83
- reprompt -- AI Session Analytics
84
- ========================================
85
-
86
- Overview
87
- Total prompts: 1,247
88
- Unique (deduped): 832
89
- Sessions scanned: 156
90
- Sources: claude-code, openclaw
91
-
92
- Top Prompt Patterns
93
- # | Pattern | Count | Category
94
- 1 | fix the failing test... | 42 | debug
95
- 2 | add unit tests for... | 38 | test
96
- 3 | refactor X to use... | 27 | refactor
97
- ```
98
-
99
122
  ## Configuration
100
123
 
101
124
  Zero config by default. Customize with environment variables or TOML:
@@ -0,0 +1,106 @@
1
+ # Launch Post Draft
2
+
3
+ Target: Hacker News (Show HN), Reddit (r/programming, r/MachineLearning), Twitter/X
4
+
5
+ ---
6
+
7
+ ## Show HN: reprompt -- Discover and reuse your best prompts from AI coding sessions
8
+
9
+ Every developer using AI coding tools has hundreds of session files scattered across their system. Buried in those sessions are the prompts that actually worked -- the ones that led to clean implementations, successful debugging, and productive refactoring.
10
+
11
+ **reprompt** is a CLI tool that extracts prompts from your AI coding session history, deduplicates them (exact + semantic), analyzes frequency patterns, and builds a personal prompt library that evolves over time.
12
+
13
+ ### What it does
14
+
15
+ - Scans Claude Code and OpenClaw/OpenCode sessions automatically
16
+ - Two-layer dedup: SHA-256 for exact matches, TF-IDF cosine similarity for semantic near-duplicates
17
+ - Discovers your "hot terms" via TF-IDF analysis
18
+ - K-means clustering groups similar prompts into themes
19
+ - Auto-categorizes patterns: debug, implement, test, review, refactor, explain, config
20
+ - Exports as terminal report, JSON (for pipelines), or Markdown
21
+
22
+ ### Quick start
23
+
24
+ ```bash
25
+ pipx install reprompt-cli
26
+ reprompt scan # finds sessions automatically
27
+ reprompt report # see your patterns
28
+ reprompt library # browse your prompt library
29
+ ```
30
+
31
+ ### Why I built this
32
+
33
+ After 6+ months of daily AI-assisted coding, I realized I was re-inventing prompts constantly. The same debugging approach, the same "add tests for X" pattern, the same refactoring instructions -- typed fresh each time.
34
+
35
+ Session files are write-once logs. They're not designed for retrieval. reprompt turns that dead data into a living library of your best practices.
36
+
37
+ ### Technical details
38
+
39
+ - Python, MIT licensed, pip-installable
40
+ - Zero external dependencies for core (scikit-learn for TF-IDF/clustering, Rich for terminal output)
41
+ - Pluggable adapter pattern -- adding a new AI tool is ~30 lines
42
+ - Optional embedding backends: Ollama, sentence-transformers, OpenAI
43
+ - SQLite storage, zero config defaults
44
+
45
+ GitHub: https://github.com/reprompt-dev/reprompt
46
+ PyPI: https://pypi.org/project/reprompt-cli/
47
+
48
+ ---
49
+
50
+ ## Twitter/X version (thread)
51
+
52
+ **Tweet 1:**
53
+ I built reprompt -- a CLI that mines your AI coding sessions for reusable prompt patterns.
54
+
55
+ After months of Claude Code, I realized my best prompts were buried in hundreds of JSONL files. Same patterns, retyped from scratch every time.
56
+
57
+ `pipx install reprompt-cli`
58
+
59
+ **Tweet 2:**
60
+ How it works:
61
+ 1. Scans your Claude Code / OpenClaw sessions
62
+ 2. SHA-256 + TF-IDF dedup (exact + semantic)
63
+ 3. K-means clustering for theme discovery
64
+ 4. Auto-categorizes: debug, implement, test, review...
65
+ 5. Builds a prompt library that grows over time
66
+
67
+ **Tweet 3:**
68
+ Three commands to get started:
69
+
70
+ ```
71
+ reprompt scan # auto-detect sessions
72
+ reprompt report # see your patterns
73
+ reprompt library # browse & export
74
+ ```
75
+
76
+ Zero config. MIT licensed. Adapter pattern makes adding new AI tools trivial (~30 lines).
77
+
78
+ GitHub: https://github.com/reprompt-dev/reprompt
79
+
80
+ ---
81
+
82
+ ## Reddit r/programming version
83
+
84
+ **Title:** reprompt: CLI tool to extract, deduplicate, and analyze prompts from your AI coding sessions
85
+
86
+ **Body:**
87
+
88
+ I've been using Claude Code daily for months and noticed I kept writing the same types of prompts over and over. My session history had hundreds of files with reusable patterns buried in them -- but no way to search or learn from them.
89
+
90
+ So I built **reprompt**, a CLI that:
91
+
92
+ - Auto-detects Claude Code and OpenClaw session files
93
+ - Extracts user prompts and deduplicates them (SHA-256 exact + TF-IDF semantic)
94
+ - Runs TF-IDF analysis to find your "hot terms"
95
+ - Uses K-means clustering to group similar prompts
96
+ - Auto-categorizes patterns into debug/implement/test/review/refactor/explain/config
97
+ - Exports as rich terminal report, JSON, or Markdown
98
+
99
+ It's designed to be extensible -- adding support for a new AI tool is just subclassing `BaseAdapter` and implementing `parse_session()`. Cursor and Codex CLI adapters are planned.
100
+
101
+ Install: `pipx install reprompt-cli`
102
+
103
+ - GitHub: https://github.com/reprompt-dev/reprompt
104
+ - PyPI: https://pypi.org/project/reprompt-cli/
105
+ - License: MIT
106
+ - Python 3.10+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "reprompt-cli"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  description = "Discover, analyze, and evolve your best prompts from AI coding sessions"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -2,4 +2,4 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "0.1.1"
5
+ __version__ = "0.2.0"
@@ -10,6 +10,11 @@ from reprompt.adapters.base import BaseAdapter
10
10
  from reprompt.adapters.claude_code import should_keep_prompt
11
11
  from reprompt.core.models import Prompt
12
12
 
13
+ # New path (post-rebrand): ~/.openclaw/agents/<agentId>/sessions/
14
+ _NEW_DEFAULT_PATH = "~/.openclaw"
15
+ # Legacy path (OpenCode): ~/.opencode/sessions/
16
+ _LEGACY_DEFAULT_PATH = "~/.opencode/sessions"
17
+
13
18
 
14
19
  class OpenClawAdapter(BaseAdapter):
15
20
  """Adapter for OpenClaw/OpenCode JSONL session files.
@@ -17,18 +22,41 @@ class OpenClawAdapter(BaseAdapter):
17
22
  OpenClaw sessions use a simpler format than Claude Code:
18
23
  - No 'type' wrapper -- directly has 'role' field
19
24
  - 'content' is always a string (not list)
20
- - Session path: ~/.opencode/sessions/
25
+
26
+ Supports both path layouts:
27
+ - New (post-rebrand): ~/.openclaw/agents/<agentId>/sessions/
28
+ - Legacy (OpenCode): ~/.opencode/sessions/
21
29
  """
22
30
 
23
31
  name = "openclaw"
24
- default_session_path = "~/.opencode/sessions"
25
-
26
- def __init__(self, session_path: Path | None = None) -> None:
27
- self._session_path = session_path or Path(os.path.expanduser(self.default_session_path))
32
+ default_session_path = _NEW_DEFAULT_PATH
33
+
34
+ def __init__(
35
+ self,
36
+ session_path: Path | None = None,
37
+ legacy_path: Path | None = None,
38
+ ) -> None:
39
+ # Primary path — new ~/.openclaw layout (or caller-supplied override)
40
+ self._session_path = session_path or Path(os.path.expanduser(_NEW_DEFAULT_PATH))
41
+ # Legacy fallback — old ~/.opencode/sessions layout
42
+ self._legacy_path = legacy_path or Path(os.path.expanduser(_LEGACY_DEFAULT_PATH))
28
43
 
29
44
  def detect_installed(self) -> bool:
30
- """Check if OpenClaw session directory exists."""
31
- return self._session_path.is_dir()
45
+ """Check if OpenClaw/OpenCode session directory exists (either location)."""
46
+ return self._session_path.is_dir() or self._legacy_path.is_dir()
47
+
48
+ def discover_sessions(self) -> list[Path]:
49
+ """Return all JSONL session files from both new and legacy paths.
50
+
51
+ Search order:
52
+ 1. New path: ~/.openclaw/agents/<agentId>/sessions/**/*.jsonl
53
+ 2. Legacy path: ~/.opencode/sessions/**/*.jsonl
54
+ """
55
+ found: list[Path] = []
56
+ for root in (self._session_path, self._legacy_path):
57
+ if root.is_dir():
58
+ found.extend(sorted(root.rglob("*.jsonl")))
59
+ return found
32
60
 
33
61
  def parse_session(self, path: Path) -> list[Prompt]:
34
62
  """Parse an OpenClaw JSONL session file into Prompt objects."""
@@ -69,11 +97,15 @@ class OpenClawAdapter(BaseAdapter):
69
97
  return prompts
70
98
 
71
99
  def _project_from_path(self, file_path: str) -> str:
72
- """Extract project name from OpenClaw session path.
100
+ """Extract project name from an OpenClaw/OpenCode session path.
101
+
102
+ New path format: ~/.openclaw/agents/<agentId>/sessions/<project>/session.jsonl
103
+ Legacy format: ~/.opencode/sessions/<project>/session.jsonl
73
104
 
74
- Path format: ~/.opencode/sessions/<project-name>/session.jsonl
105
+ Returns the immediate parent directory name, or "" when the parent is a
106
+ known non-project directory (sessions, agents).
75
107
  """
76
108
  parent = os.path.basename(os.path.dirname(file_path))
77
- if parent == "sessions":
109
+ if parent in {"sessions", "agents"}:
78
110
  return ""
79
111
  return parent