@gi4nks/ph 1.4.0 → 1.6.0
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.
- package/CHANGELOG.md +7 -0
- package/README.md +147 -58
- package/dist/cli.js +2292 -1021
- package/dist/cli.js.map +1 -1
- package/docs/evals/context-retrieval-golden.json +26 -0
- package/docs/evals/context-retrieval.md +27 -0
- package/docs/hooks.md +13 -7
- package/docs/ph-analysis.html +145 -0
- package/docs/ph-manual.md +352 -231
- package/docs/specs/SPEC-001-architecture-cli.md +82 -0
- package/docs/specs/SPEC-002-database-layer.md +105 -0
- package/docs/specs/SPEC-003-capture-modes.md +110 -0
- package/docs/specs/SPEC-004-filter-metadata.md +82 -0
- package/docs/specs/SPEC-005-search.md +102 -0
- package/docs/specs/SPEC-006-analysis-pipeline.md +98 -0
- package/docs/specs/SPEC-007-memory-summaries.md +96 -0
- package/docs/specs/SPEC-008-embeddings.md +90 -0
- package/docs/specs/SPEC-009-retention-archive.md +91 -0
- package/docs/specs/SPEC-010-remote-sync.md +106 -0
- package/docs/specs/SPEC-011-mcp-server.md +94 -0
- package/docs/specs/SPEC-012-tui-browser.md +98 -0
- package/docs/specs/SPEC-013-importers.md +109 -0
- package/docs/specs/SPEC-014-analytics-commands.md +109 -0
- package/docs/specs/SPEC-015-config-env.md +85 -0
- package/docs/specs/SPEC-INDEX.md +35 -0
- package/docs/specs/SPEC-ISSUES.md +122 -0
- package/docs/specs/_TEMPLATE.md +65 -0
- package/docs/superpowers/plans/2026-06-12-ph-evolution-phase1.md +466 -0
- package/docs/superpowers/plans/2026-06-12-ph-evolution-phase2.md +351 -0
- package/docs/superpowers/specs/2026-06-12-ph-evolution-design.md +173 -0
- package/hooks/codex/README.md +54 -0
- package/hooks/codex/ph-hook.sh +14 -0
- package/hooks/opencode/ph-plugin.ts +60 -57
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/gi4nks/ph/compare/v1.5.0...v1.6.0) (2026-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* publish current ph snapshot against GitHub main ([943ced9](https://github.com/gi4nks/ph/commit/943ced97aa63e1c183ac029ae76833583559ce98))
|
|
7
|
+
|
|
1
8
|
# [1.4.0](https://github.com/gi4nks/ph/compare/v1.3.2...v1.4.0) (2026-05-16)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -1,104 +1,193 @@
|
|
|
1
|
-
# ph — Prompt History
|
|
1
|
+
# ph — Prompt History and Project Memory
|
|
2
2
|
|
|
3
|
-
`ph`
|
|
3
|
+
`ph` captures prompt and response history from AI command-line tools and makes it searchable from the terminal or available to agents through MCP. It stores data in a local SQLite database and can optionally analyze, archive, or synchronize that data.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What it does
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
7
|
+
- Captures conversations through a transparent command wrapper, native hooks, direct logging, or history import.
|
|
8
|
+
- Searches prompts and responses with SQLite FTS5, or searches by semantic similarity with Ollama embeddings and sqlite-vec.
|
|
9
|
+
- Groups records by project, tool, language, role, tags, time, and quality metadata.
|
|
10
|
+
- Builds project summaries and an append-only analysis history with optional Ollama or Gemini analysis.
|
|
11
|
+
- Exposes prompt history and project knowledge through an MCP server over stdio.
|
|
12
|
+
- Provides an interactive terminal browser for filtering, reviewing, editing metadata, starring, exporting, and rerunning prompts.
|
|
13
|
+
- Supports optional HTTP sync between a local database and a remote `ph` server.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
Install from npm:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
|
-
|
|
19
|
-
git clone git@github.com:gi4nks/ph.git
|
|
20
|
-
cd ph
|
|
21
|
-
npm install
|
|
22
|
-
make build
|
|
23
|
-
make install
|
|
20
|
+
npm install -g @gi4nks/ph
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
Or
|
|
23
|
+
Or build from source:
|
|
24
|
+
|
|
27
25
|
```bash
|
|
28
|
-
|
|
26
|
+
git clone https://github.com/gi4nks/ph.git
|
|
27
|
+
cd ph
|
|
28
|
+
npm ci
|
|
29
|
+
npm run build
|
|
30
|
+
npm link
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Requires Node.js 20 or later. Ollama is optional; it is used for local analysis and semantic embeddings. Gemini can be used for analysis when configured.
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
32
36
|
|
|
33
37
|
```bash
|
|
34
|
-
#
|
|
38
|
+
# Capture a prompt by wrapping an installed AI CLI tool
|
|
35
39
|
ph claude "explain goroutines"
|
|
36
40
|
|
|
37
|
-
# Search history
|
|
41
|
+
# Search prompt history
|
|
38
42
|
ph search "goroutines"
|
|
39
43
|
ph search --semantic "concurrency patterns"
|
|
40
|
-
ph search --tool claude --role debug --since 2026-01-01
|
|
41
44
|
|
|
42
|
-
#
|
|
45
|
+
# Open the interactive browser
|
|
43
46
|
ph browse
|
|
44
47
|
|
|
45
|
-
#
|
|
46
|
-
ph
|
|
48
|
+
# Add a record directly
|
|
49
|
+
ph log --tool claude --prompt "Explain this function" --response "It parses..."
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Capture history
|
|
53
|
+
|
|
54
|
+
### Wrapper
|
|
55
|
+
|
|
56
|
+
Run an installed tool through `ph` to record its prompt and response:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
ph claude "explain goroutines"
|
|
60
|
+
ph --ph-role debug --ph-tag auth claude "fix JWT expiration"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Interactive wrapper mode is available when the wrapped tool is run without command-line prompt arguments.
|
|
64
|
+
|
|
65
|
+
### Native hooks
|
|
66
|
+
|
|
67
|
+
Hooks capture completed exchanges without changing the tool invocation:
|
|
68
|
+
|
|
69
|
+
- Claude Code: [hooks/claude/ph-hook.sh](hooks/claude/ph-hook.sh)
|
|
70
|
+
- Codex CLI: [hooks/codex/ph-hook.sh](hooks/codex/ph-hook.sh)
|
|
71
|
+
- Gemini CLI: [hooks/gemini/ph-hook.sh](hooks/gemini/ph-hook.sh)
|
|
72
|
+
- OpenCode: [hooks/opencode/ph-plugin.ts](hooks/opencode/ph-plugin.ts)
|
|
73
|
+
|
|
74
|
+
See [docs/hooks.md](docs/hooks.md) for the integration overview and [docs/ph-manual.md](docs/ph-manual.md) for setup details.
|
|
75
|
+
|
|
76
|
+
### Direct logging and history import
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
ph log --tool claude --prompt "Explain this function" --response "It parses..."
|
|
80
|
+
echo '{"tool":"claude","prompt":"Explain this function","response":"It parses..."}' | ph log --stdin
|
|
81
|
+
|
|
82
|
+
ph import claude --dry-run
|
|
83
|
+
ph import gemini --filter
|
|
84
|
+
ph import opencode
|
|
85
|
+
ph import codex --dry-run
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Codex is also available through wrapper and context-injected modes: `ph codex exec "prompt"` and `ph chat codex exec "prompt"`. See [Codex hook setup](hooks/codex/README.md).
|
|
89
|
+
|
|
90
|
+
## Search and project context
|
|
47
91
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ph
|
|
51
|
-
ph
|
|
92
|
+
```bash
|
|
93
|
+
ph search --tool claude --role debug --since 2026-01-01
|
|
94
|
+
ph search --semantic "How did I configure SQLite migrations?"
|
|
95
|
+
ph search --archive "database migration"
|
|
96
|
+
|
|
97
|
+
# Retrieve project knowledge and related prompts for the current directory
|
|
98
|
+
ph context "How are database migrations handled?"
|
|
99
|
+
|
|
100
|
+
# Limit the output to project summaries and memories
|
|
101
|
+
ph context --memories-only --project ph
|
|
52
102
|
```
|
|
53
103
|
|
|
54
|
-
|
|
104
|
+
`ph context`, `ph chat`, and MCP project-context tools use shared retrieval and formatting. Semantic results are scoped to the requested project before the result limit is applied.
|
|
105
|
+
|
|
106
|
+
## Project memory and analysis
|
|
55
107
|
|
|
56
|
-
|
|
108
|
+
Enable background analysis after each capture:
|
|
57
109
|
|
|
58
110
|
```bash
|
|
59
|
-
ph config set
|
|
60
|
-
ph config set
|
|
61
|
-
ph config set
|
|
111
|
+
ph config set background-analysis true
|
|
112
|
+
ph config set analyze-provider ollama
|
|
113
|
+
ph config set ollama-model llama3.1:latest
|
|
114
|
+
ph config set ollama-embed-model nomic-embed-text-v2-moe
|
|
62
115
|
```
|
|
63
116
|
|
|
64
|
-
|
|
117
|
+
For Gemini analysis:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
ph config set analyze-provider gemini
|
|
121
|
+
ph config set gemini-api-key "$GEMINI_API_KEY"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Project summaries merge deduplicated insights and technical decisions. Individual analysis results remain in an append-only memory timeline. Analysis and embeddings require the corresponding provider to be available; basic capture and full-text search do not.
|
|
125
|
+
|
|
126
|
+
## MCP integration
|
|
127
|
+
|
|
128
|
+
Start the stdio server with:
|
|
65
129
|
|
|
66
|
-
|
|
130
|
+
```bash
|
|
131
|
+
ph mcp
|
|
132
|
+
```
|
|
67
133
|
|
|
68
|
-
|
|
69
|
-
|------|--------------|-------------|
|
|
70
|
-
| Database | `~/.prompt_history.db` | SQLite with FTS5 + sqlite-vec |
|
|
71
|
-
| Config | `~/.ph_config.json` | JSON with 0o600 permissions |
|
|
134
|
+
The server exposes tools for prompt search and lookup, project context and summaries, project timelines, knowledge checks, and saving decisions. Configure `ph mcp` as a stdio server in the MCP client you use.
|
|
72
135
|
|
|
73
|
-
##
|
|
136
|
+
## Remote sync
|
|
74
137
|
|
|
138
|
+
Run an HTTP server on the machine that will store the shared database:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
ph config set remote-api-key "$PH_REMOTE_API_KEY"
|
|
142
|
+
ph server --host 127.0.0.1 --port 3001
|
|
75
143
|
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
144
|
+
|
|
145
|
+
Set a client remote URL and synchronize:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
ph config set remote-url http://127.0.0.1:3001
|
|
149
|
+
ph remote push
|
|
150
|
+
ph remote pull
|
|
151
|
+
ph remote status
|
|
84
152
|
```
|
|
85
153
|
|
|
86
|
-
|
|
154
|
+
`PH_REMOTE_URL` overrides the configured remote URL. If `remote-api-key` is set on the server, clients must also provide that key. Use a private network or a TLS-terminating proxy when connecting across machines. Each `ph log` performs a non-blocking push when a remote is configured.
|
|
87
155
|
|
|
88
|
-
|
|
156
|
+
## Configuration and storage
|
|
89
157
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
158
|
+
Configuration is stored in `~/.ph_config.json`; the database defaults to `~/.prompt_history.db`.
|
|
159
|
+
|
|
160
|
+
| Setting | Default | Purpose |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| `db-path` | `~/.prompt_history.db` | SQLite database location |
|
|
163
|
+
| `analyze-provider` | `ollama` | Analysis provider: `ollama` or `gemini` |
|
|
164
|
+
| `ollama-url` | `http://localhost:11434` | Ollama endpoint |
|
|
165
|
+
| `ollama-model` | `llama3.1:latest` | Analysis model |
|
|
166
|
+
| `ollama-embed-model` | `nomic-embed-text-v2-moe` | Embedding model; current schema expects 768 dimensions |
|
|
167
|
+
| `background-analysis` | `false` | Analyze newly captured prompts asynchronously |
|
|
168
|
+
| `filter-min-length` | `15` | Minimum prompt length accepted by filtering |
|
|
169
|
+
| `filter-min-relevance` | `3` | Relevance threshold for filtered imports/analysis workflows |
|
|
170
|
+
| `remote-url` | unset | Remote `ph` server; `PH_REMOTE_URL` takes precedence |
|
|
171
|
+
| `remote-api-key` | unset | Optional server authentication key |
|
|
93
172
|
|
|
94
173
|
## Development
|
|
95
174
|
|
|
96
175
|
```bash
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
176
|
+
npm ci
|
|
177
|
+
npm test
|
|
178
|
+
npm run lint
|
|
179
|
+
npx tsc --noEmit
|
|
180
|
+
npm run build
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Run the optional model-backed retrieval evaluation when an Ollama embedding endpoint is available:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm run eval:retrieval
|
|
100
187
|
```
|
|
101
188
|
|
|
189
|
+
See [docs/ph-manual.md](docs/ph-manual.md), [docs/specs/SPEC-INDEX.md](docs/specs/SPEC-INDEX.md), and [docs/ph-analysis.html](docs/ph-analysis.html) for the user guide, behavior specifications, and architecture report.
|
|
190
|
+
|
|
102
191
|
## License
|
|
103
192
|
|
|
104
193
|
MIT
|