|
| 1 | +# PromptImprover |
| 2 | + |
| 3 | +MCP server middleware for prompt governance. The active implementation is the Universal Refiner package, which provides prompt refinement, local memory, commit-correlated learning, dashboard review workflows, and evidence capture for agent runs. |
| 4 | + |
| 5 | +## Project Hierarchy |
| 6 | + |
| 7 | +This project has a `context.md` tree. Always read the nearest context file before changing files in a directory. |
| 8 | + |
| 9 | +- Root: `context.md` - project-wide mandates and submodule index. |
| 10 | +- `universal-refiner/context.md` - active MCP server, refinement engine, history, learning, hooks, and dashboard. |
| 11 | +- `gemini-extension/context.md` - Gemini CLI integration. |
| 12 | +- `mcp-server/context.md` - legacy standalone MCP server. |
| 13 | +- `docs/context.md` - architecture specs, roadmaps, and release-gate documentation. |
| 14 | +- `archive/context.md` - deprecated code and historical experiments. |
| 15 | + |
| 16 | +## Tech Stack |
| 17 | + |
| 18 | +| Layer | Technology | |
| 19 | +|---|---| |
| 20 | +| Language | TypeScript, strict mode | |
| 21 | +| Runtime | Node.js >= 22 | |
| 22 | +| MCP transport | stdio via `@modelcontextprotocol/sdk` | |
| 23 | +| Storage | SQLite via `better-sqlite3` | |
| 24 | +| Build | `tsc` plus dashboard asset copy | |
| 25 | +| Test | Vitest | |
| 26 | + |
| 27 | +## Active Entry Points |
| 28 | + |
| 29 | +| Path | Purpose | |
| 30 | +|---|---| |
| 31 | +| `universal-refiner/src/` | Active source code | |
| 32 | +| `universal-refiner/dist/src/index.js` | Built MCP server used by global CLI registrations | |
| 33 | +| `universal-refiner/hooks/` | Claude/Gemini hook runtime and fragments | |
| 34 | +| `universal-refiner/scripts/operations/register-global.ps1` | Global Codex, Claude, and Gemini registration doctor | |
| 35 | +| `universal-refiner/scripts/acceptance/` | Real-process and package-runtime acceptance gates | |
| 36 | + |
| 37 | +## Standard Workflow |
| 38 | + |
| 39 | +1. Read the relevant `context.md`, `AGENTS.md`, `GEMINI.md`, and this file before changing behavior. |
| 40 | +2. Prefer the active `universal-refiner` package for new work. Avoid expanding legacy `mcp-server` unless the task explicitly targets it. |
| 41 | +3. Keep changes scoped and preserve unrelated user work. |
| 42 | +4. After code or package changes in `universal-refiner`, run the strongest proportionate gate. For broad hardening, use: |
| 43 | + |
| 44 | +```powershell |
| 45 | +cd C:\PersonalRepo\portfolio\Promptimprover\universal-refiner |
| 46 | +npm.cmd run release:verify |
| 47 | +``` |
| 48 | + |
| 49 | +5. Restart the local background runtime after rebuilding: |
| 50 | + |
| 51 | +```powershell |
| 52 | +$repo = 'C:\PersonalRepo\portfolio\Promptimprover\universal-refiner' |
| 53 | +$env:PROMPT_REFINER_BACKGROUND = 'true' |
| 54 | +Start-Process -WindowStyle Hidden -FilePath node -ArgumentList (Join-Path $repo 'dist\src\index.js') -WorkingDirectory $repo |
| 55 | +``` |
| 56 | + |
| 57 | +6. Smoke-test runtime health: |
| 58 | + |
| 59 | +```powershell |
| 60 | +Invoke-RestMethod http://127.0.0.1:3000/api/health |
| 61 | +``` |
| 62 | + |
| 63 | +## Release Gates |
| 64 | + |
| 65 | +The authoritative local gate is: |
| 66 | + |
| 67 | +```powershell |
| 68 | +npm.cmd run release:verify |
| 69 | +``` |
| 70 | + |
| 71 | +It includes build, 100% coverage, MCP acceptance, semantic fallback, tracked-turn acceptance, stress/recovery/soak, production and full audit checks, secret scanning, package dry-run, and packaged runtime startup smoke. |
| 72 | + |
| 73 | +## Global Registration |
| 74 | + |
| 75 | +Use the registration doctor after changes that affect global MCP wiring: |
| 76 | + |
| 77 | +```powershell |
| 78 | +powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Check |
| 79 | +``` |
| 80 | + |
| 81 | +Apply only when the check reports real drift: |
| 82 | + |
| 83 | +```powershell |
| 84 | +powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Apply |
| 85 | +``` |
| 86 | + |
| 87 | +The expected global MCP registrations are: |
| 88 | + |
| 89 | +- Codex: `prompt-refiner`, `obsidian` |
| 90 | +- Claude Code: `prompt-refiner`, `obsidian`, plus PromptImprover hooks |
| 91 | +- Gemini: `prompt-refiner`, `obsidian` |
| 92 | + |
| 93 | +## Security |
| 94 | + |
| 95 | +- Never commit secrets, tokens, credentials, private prompts, or raw sensitive payloads. |
| 96 | +- Treat `npm audit` failures as defects. Production audit is mandatory; full audit is also part of the release gate. |
| 97 | +- If a plaintext token was ever present in local configuration, remove it and rotate it externally. |
0 commit comments