@gi4nks/ph 1.6.0 → 1.8.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/LICENSE +1 -1
  3. package/README.md +79 -19
  4. package/dist/cli.js +3593 -3677
  5. package/dist/cli.js.map +1 -1
  6. package/docs/evals/context-retrieval-golden.json +17 -1
  7. package/docs/ph-architecture-review.html +179 -0
  8. package/docs/ph-manual.md +129 -73
  9. package/docs/ph-operational-memory-analysis.html +104 -0
  10. package/docs/plans/2026-10-10-operational-memory.md +192 -0
  11. package/docs/specs/SPEC-001-architecture-cli.md +100 -72
  12. package/docs/specs/SPEC-002-database-layer.md +22 -3
  13. package/docs/specs/SPEC-003-capture-modes.md +22 -9
  14. package/docs/specs/SPEC-005-search.md +46 -11
  15. package/docs/specs/SPEC-006-analysis-pipeline.md +8 -6
  16. package/docs/specs/SPEC-007-memory-summaries.md +19 -19
  17. package/docs/specs/SPEC-008-embeddings.md +8 -2
  18. package/docs/specs/SPEC-009-retention-archive.md +2 -2
  19. package/docs/specs/SPEC-010-remote-sync.md +77 -103
  20. package/docs/specs/SPEC-011-mcp-server.md +7 -4
  21. package/docs/specs/SPEC-012-tui-browser.md +30 -96
  22. package/docs/specs/SPEC-015-config-env.md +4 -0
  23. package/docs/specs/SPEC-016-operational-memory.md +48 -0
  24. package/docs/specs/SPEC-017-architecture-consolidation.md +63 -0
  25. package/docs/specs/SPEC-018-interaction-inspection-and-recall-integrity.md +164 -0
  26. package/docs/specs/SPEC-019-network-capture-and-ranking-integrity.md +36 -0
  27. package/docs/specs/SPEC-INDEX.md +12 -7
  28. package/docs/specs/SPEC-ISSUES.md +104 -18
  29. package/hooks/claude/README.md +1 -1
  30. package/hooks/codex/README.md +1 -1
  31. package/hooks/codex/ph-hook.sh +2 -1
  32. package/hooks/gemini/README.md +1 -1
  33. package/package.json +6 -7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [1.8.0](https://github.com/gi4nks/ph/compare/v1.7.0...v1.8.0) (2026-10-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * harden PH capture, recall, and synchronization ([0e65743](https://github.com/gi4nks/ph/commit/0e657438bc2e59f2dcf14dd73e02882c29bfa390))
7
+
8
+
9
+ ### Features
10
+
11
+ * add operational memory and consolidate architecture ([39aeae5](https://github.com/gi4nks/ph/commit/39aeae507a6bab93c8d1ff49555b82fb7fc9fc37))
12
+ * make PH capture setup automatic ([35aad32](https://github.com/gi4nks/ph/commit/35aad321730dd8f1b04665af890e60e8c75a56e9))
13
+ * simplify PH command-line workflow ([05b5ea7](https://github.com/gi4nks/ph/commit/05b5ea7202d55a05c277eafc6e2b51b1913f5063))
14
+
15
+ # [1.7.0](https://github.com/gi4nks/ph/compare/v1.6.0...v1.7.0) (2026-10-18)
16
+
17
+
18
+ ### Features
19
+
20
+ * integrate Wise providers in ph ([4f8094e](https://github.com/gi4nks/ph/commit/4f8094e506430f43a96eaca299c6fc85a65870a9))
21
+
1
22
  # [1.6.0](https://github.com/gi4nks/ph/compare/v1.5.0...v1.6.0) (2026-10-09)
2
23
 
3
24
 
@@ -48,7 +69,7 @@ All notable changes to this project will be documented in this file. See [standa
48
69
  * **config:** `remote-url`, `remote-api-key` config keys + `PH_REMOTE_URL` env var support
49
70
  * **opencode:** native importer (`ph import opencode`) + real-time plugin hook
50
71
 
51
- ### (prima di continuare con il commit fammi vedere se ti piace la situazione ) vabene?
72
+ ### Before continuing with the commit, show me the current state and check that it looks good.
52
73
 
53
74
 
54
75
  ## [1.3.0](https://github.com/gi4nks/ph/compare/v1.2.0...v1.3.0) (2026-04-12)
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Gianluca
3
+ Copyright (c) 2026 gi4nks
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -5,12 +5,9 @@
5
5
  ## What it does
6
6
 
7
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.
8
+ - Searches prompts and responses, then retrieves task-relevant project context through one command.
9
+ - Reviews recent work and saves durable project decisions only after explicit approval.
10
+ - Keeps data local by default; hooks and MCP are available for automatic capture and agent access.
14
11
 
15
12
  ## Install
16
13
 
@@ -30,25 +27,33 @@ npm run build
30
27
  npm link
31
28
  ```
32
29
 
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.
30
+ Requires Node.js 22 or later (the Wise/AI SDK provider stack requires Node 22). Ollama is optional; it is used for local analysis and semantic embeddings. Gemini can be used for analysis when configured.
34
31
 
35
32
  ## Quick start
36
33
 
37
34
  ```bash
38
- # Capture a prompt by wrapping an installed AI CLI tool
39
- ph claude "explain goroutines"
35
+ # Connect PH once to the AI CLIs you use
36
+ ph setup
37
+
38
+ # Then use Claude Code, Codex, or Gemini CLI normally. Completed exchanges
39
+ # are captured in the background by each tool's native hook.
40
+ claude
41
+ codex
40
42
 
41
43
  # Search prompt history
42
44
  ph search "goroutines"
43
- ph search --semantic "concurrency patterns"
44
-
45
- # Open the interactive browser
46
- ph browse
45
+ ph show 42 # Full prompt, response, and available analysis
46
+ # Search all projects when needed
47
+ ph search --all "goroutines"
47
48
 
48
49
  # Add a record directly
49
50
  ph log --tool claude --prompt "Explain this function" --response "It parses..."
50
51
  ```
51
52
 
53
+ `ph setup` detects installed Claude Code, Codex CLI, Gemini CLI, and OpenCode integrations, then installs capture hooks while preserving existing settings. Pass tool names to select explicitly (`ph setup codex claude`). It is safe to run again. Use `ph <tool>` as a wrapper if you prefer not to install hooks.
54
+
55
+ `ph search "query"` searches the current project and shows five matches, ranked by text relevance. Use `--limit <n>` for more results or `--all` to search across projects. Codex hook captures use the active CLI working directory so new conversations get associated with the project where Codex was launched.
56
+
52
57
  ## Capture history
53
58
 
54
59
  ### Wrapper
@@ -85,7 +90,7 @@ ph import opencode
85
90
  ph import codex --dry-run
86
91
  ```
87
92
 
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).
93
+ Codex is also available through wrapper mode: `ph codex exec "prompt"`. See [Codex hook setup](hooks/codex/README.md).
89
94
 
90
95
  ## Search and project context
91
96
 
@@ -93,15 +98,27 @@ Codex is also available through wrapper and context-injected modes: `ph codex ex
93
98
  ph search --tool claude --role debug --since 2026-01-01
94
99
  ph search --semantic "How did I configure SQLite migrations?"
95
100
  ph search --archive "database migration"
101
+ ph show 42 --json # Machine-readable interaction detail
102
+ ph show 42 # full prompt, response, and available analysis
103
+ ph show 42 --json # machine-readable detail
96
104
 
97
105
  # Retrieve project knowledge and related prompts for the current directory
98
106
  ph context "How are database migrations handled?"
99
107
 
100
108
  # Limit the output to project summaries and memories
101
109
  ph context --memories-only --project ph
110
+
111
+ # Retrieve a task brief with relevant history (read-only)
112
+ ph context "add Wise provider" --limit 5 --budget 3500
113
+
114
+ # Review recent work and explicitly promote useful knowledge (defaults to 3h)
115
+ ph close
116
+ ph close --from 1670 --to 1682 --dry-run
102
117
  ```
103
118
 
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.
119
+ `ph context "task"` retrieves task-specific history when you want to supply it explicitly. `ph close` is an optional review workflow for promoting durable knowledge; it is not required for capture or search. `ph prepare` remains a compatibility alias for `ph context`.
120
+
121
+ Running `ph` prints the short setup-first workflow; it does not open a TUI. `ph browse` remains as a compatibility alias for listing recent interactions. `ph help --all` lists maintenance and integration commands.
105
122
 
106
123
  ## Project memory and analysis
107
124
 
@@ -121,7 +138,41 @@ ph config set analyze-provider gemini
121
138
  ph config set gemini-api-key "$GEMINI_API_KEY"
122
139
  ```
123
140
 
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.
141
+ For OpenRouter, use the environment or enter the key through ph's hidden prompt, then select an exact model ID:
142
+
143
+ ```bash
144
+ export OPENROUTER_API_KEY="your_openrouter_api_key"
145
+ ph models openrouter
146
+ ph config set openrouter-api-key # prompts securely; stored in ~/.ph_config.json
147
+ ph config set analyze-provider openrouter
148
+ ph config set openrouter-model "provider/model-id"
149
+ ph config show # shows active settings, redacts keys
150
+ ph analyze
151
+ ```
152
+
153
+ For MLX-Serve on Parmenide, open an SSH tunnel to its API port (11234 by default),
154
+ then select an ID returned by the server. Keep the tunnel running in a separate terminal:
155
+
156
+ ```bash
157
+ # Terminal 1
158
+ ssh -N -L 11234:127.0.0.1:11234 parmenide
159
+ ```
160
+
161
+ ```bash
162
+ # Terminal 2
163
+ ph models mlx-serve
164
+ ph config set analyze-provider mlx-serve
165
+ ph config set mlx-serve-model "exact-model-id-from-server"
166
+ ph analyze
167
+ ```
168
+
169
+ The MLX-Serve URL defaults to `http://127.0.0.1:11234/v1`; override it with
170
+ `MLX_SERVE_BASE_URL` or `ph config set mlx-serve-url <url>`. If the server requires
171
+ authentication, set `MLX_SERVE_API_KEY` or run `ph config set mlx-serve-api-key`
172
+ for a hidden prompt. `ph config show` redacts credentials. The model catalog
173
+ marks installed models as `[loaded]` or `[unloaded]`.
174
+
175
+ Automatic analysis enriches each interaction with classification, summary, insights, and decisions; these derived fields are searchable and visible with `ph show`. Analysis does not modify active project memories or summaries. Only approved `ph close` proposals and MCP `save_decision` promote knowledge. Existing memories remain available. Task context retrieval is shared by `ph context`, `ph chat`, and MCP knowledge checks, with a labeled recent-history fallback.
125
176
 
126
177
  ## MCP integration
127
178
 
@@ -151,7 +202,7 @@ ph remote pull
151
202
  ph remote status
152
203
  ```
153
204
 
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.
205
+ `PH_REMOTE_URL` overrides the configured remote URL. The server refuses to start until `remote-api-key` is configured, and every client must provide the same key. It listens on loopback by default; use an explicit `--host` only for a protected network interface and use TLS when traffic crosses an untrusted network. `/health` is public and returns status only. Resumable ID cursors are scoped to both the remote target and local database, and byte-bounded subpages stay below the server's 32 MiB request cap. A bulk push pauses before a live wrapper interaction until its response is saved. `ph log` and both wrapper modes push after capture when a remote is configured; the request is bounded to five seconds so an unavailable server cannot hang the command indefinitely. An invalid remote URL does not prevent local capture or launching the wrapped tool. Current limitation: a remote database replacement behind the same URL is not detected, and last-push/pull status timestamps are shared across targets.
155
206
 
156
207
  ## Configuration and storage
157
208
 
@@ -160,15 +211,24 @@ Configuration is stored in `~/.ph_config.json`; the database defaults to `~/.pro
160
211
  | Setting | Default | Purpose |
161
212
  |---|---|---|
162
213
  | `db-path` | `~/.prompt_history.db` | SQLite database location |
163
- | `analyze-provider` | `ollama` | Analysis provider: `ollama` or `gemini` |
214
+ | `analyze-provider` | `ollama` | Analysis provider: `ollama`, `gemini`, `openrouter`, or `mlx-serve` |
164
215
  | `ollama-url` | `http://localhost:11434` | Ollama endpoint |
165
216
  | `ollama-model` | `llama3.1:latest` | Analysis model |
217
+ | `openrouter-model` | unset | Exact OpenRouter model ID, including its provider prefix |
218
+ | `openrouter-url` | `https://openrouter.ai/api/v1` | OpenRouter-compatible API root |
219
+ | `mlx-serve-model` | unset | Exact model ID returned by MLX-Serve |
220
+ | `mlx-serve-url` | `http://127.0.0.1:11234/v1` | MLX-Serve API root, normally the Parmenide SSH tunnel |
166
221
  | `ollama-embed-model` | `nomic-embed-text-v2-moe` | Embedding model; current schema expects 768 dimensions |
167
222
  | `background-analysis` | `false` | Analyze newly captured prompts asynchronously |
168
223
  | `filter-min-length` | `15` | Minimum prompt length accepted by filtering |
169
224
  | `filter-min-relevance` | `3` | Relevance threshold for filtered imports/analysis workflows |
170
225
  | `remote-url` | unset | Remote `ph` server; `PH_REMOTE_URL` takes precedence |
171
- | `remote-api-key` | unset | Optional server authentication key |
226
+ | `remote-api-key` | unset | Required to start the HTTP server; sent by remote clients |
227
+
228
+ Provider credentials can be stored in `~/.ph_config.json` through the hidden
229
+ `ph config set <provider>-api-key` prompts or supplied through environment
230
+ variables. Environment values take precedence; MLX-Serve also accepts the
231
+ existing `GLB_OMLX_API_KEY` variable.
172
232
 
173
233
  ## Development
174
234