Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
PROMPT_REFINER_PRIMARY_MODEL: ${{ matrix.model-order == 'primary' && 'gemma3:12b' || 'gemma3:1b' }}
PROMPT_REFINER_FALLBACK_MODEL: ${{ matrix.model-order == 'primary' && 'gemma3:1b' || 'gemma3:12b' }}
run: npm run acceptance:semantic
- name: Run tracked-turn acceptance
run: npm run acceptance:tracked-turn

stress:
runs-on: ubuntu-latest
Expand All @@ -89,6 +91,10 @@ jobs:
PROMPT_REFINER_STRESS_WORKERS: '4'
PROMPT_REFINER_STRESS_WRITES: '100'
run: npm run stress:event-store
- name: Run abrupt recovery proof
run: npm run recovery:event-store:abrupt
- name: Run EventStore soak
run: npm run stress:event-store:soak

windows:
runs-on: windows-latest
Expand All @@ -108,7 +114,13 @@ jobs:
- run: npm run build
- run: npm run test:coverage
- run: npm run test:acceptance
- run: npm run acceptance:semantic
- run: npm run acceptance:tracked-turn
- run: npm run test:stress
- run: npm run stress:event-store
- run: npm run recovery:event-store:abrupt
- run: npm run stress:event-store:soak
- run: npm run acceptance:package-runtime

supply-chain:
runs-on: ubuntu-latest
Expand All @@ -125,9 +137,11 @@ jobs:
cache-dependency-path: universal-refiner/package-lock.json
- run: npm ci --no-fund
- run: npm run security:audit
- run: npm run security:audit:all
- run: npm run security:secrets
- run: npm run build
- run: npm run package:check
- run: npm run acceptance:package-runtime

release-gate:
if: always()
Expand Down
97 changes: 97 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# PromptImprover

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.

## Project Hierarchy

This project has a `context.md` tree. Always read the nearest context file before changing files in a directory.

- Root: `context.md` - project-wide mandates and submodule index.
- `universal-refiner/context.md` - active MCP server, refinement engine, history, learning, hooks, and dashboard.
- `gemini-extension/context.md` - Gemini CLI integration.
- `mcp-server/context.md` - legacy standalone MCP server.
- `docs/context.md` - architecture specs, roadmaps, and release-gate documentation.
- `archive/context.md` - deprecated code and historical experiments.

## Tech Stack

| Layer | Technology |
|---|---|
| Language | TypeScript, strict mode |
| Runtime | Node.js >= 22 |
| MCP transport | stdio via `@modelcontextprotocol/sdk` |
| Storage | SQLite via `better-sqlite3` |
| Build | `tsc` plus dashboard asset copy |
| Test | Vitest |

## Active Entry Points

| Path | Purpose |
|---|---|
| `universal-refiner/src/` | Active source code |
| `universal-refiner/dist/src/index.js` | Built MCP server used by global CLI registrations |
| `universal-refiner/hooks/` | Claude/Gemini hook runtime and fragments |
| `universal-refiner/scripts/operations/register-global.ps1` | Global Codex, Claude, and Gemini registration doctor |
| `universal-refiner/scripts/acceptance/` | Real-process and package-runtime acceptance gates |

## Standard Workflow

1. Read the relevant `context.md`, `AGENTS.md`, `GEMINI.md`, and this file before changing behavior.
2. Prefer the active `universal-refiner` package for new work. Avoid expanding legacy `mcp-server` unless the task explicitly targets it.
3. Keep changes scoped and preserve unrelated user work.
4. After code or package changes in `universal-refiner`, run the strongest proportionate gate. For broad hardening, use:

```powershell
cd C:\PersonalRepo\portfolio\Promptimprover\universal-refiner
npm.cmd run release:verify
```

5. Restart the local background runtime after rebuilding:

```powershell
$repo = 'C:\PersonalRepo\portfolio\Promptimprover\universal-refiner'
$env:PROMPT_REFINER_BACKGROUND = 'true'
Start-Process -WindowStyle Hidden -FilePath node -ArgumentList (Join-Path $repo 'dist\src\index.js') -WorkingDirectory $repo
```

6. Smoke-test runtime health:

```powershell
Invoke-RestMethod http://127.0.0.1:3000/api/health
```

## Release Gates

The authoritative local gate is:

```powershell
npm.cmd run release:verify
```

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.

## Global Registration

Use the registration doctor after changes that affect global MCP wiring:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Check
```

Apply only when the check reports real drift:

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Apply
```

The expected global MCP registrations are:

- Codex: `prompt-refiner`, `obsidian`
- Claude Code: `prompt-refiner`, `obsidian`, plus PromptImprover hooks
- Gemini: `prompt-refiner`, `obsidian`

## Security

- Never commit secrets, tokens, credentials, private prompts, or raw sensitive payloads.
- Treat `npm audit` failures as defects. Production audit is mandatory; full audit is also part of the release gate.
- If a plaintext token was ever present in local configuration, remove it and rotate it externally.
4 changes: 2 additions & 2 deletions docs/enterprise-release-gates.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Passing unit tests alone does not prove that PromptImprover is operationally rea
6. SQLite restart, migration, backup/restore, contention, and multi-process tests pass.
7. Claude and Gemini hook pre/post flows pass; Codex MCP-first flow passes.
8. Dashboard API security, review mutation, health telemetry, and browser smoke flows pass.
9. Dependency audit reports no known production vulnerabilities.
10. Package dry-run, global installation, runtime startup, and post-restart smoke tests pass.
9. Dependency audit reports no known production or development vulnerabilities at high severity or above.
10. Package dry-run plus `acceptance:package-runtime` global installation, runtime startup, and health smoke tests pass.
11. Secret scanning finds no committed credentials.
12. Linux and Windows CI jobs pass before merge.

Expand Down
Loading
Loading