Skip to content

Commit cb0315f

Browse files
committed
Merge remote-tracking branch 'origin/master' into merge-train/pi-33
# Conflicts: # README.md # dashboard/index.html # dashboard/server.js
2 parents d5b9a33 + 28195be commit cb0315f

15 files changed

Lines changed: 323 additions & 25 deletions

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
run:
1818
working-directory: universal-refiner
1919
steps:
20-
- uses: actions/checkout@v5
20+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
2121

2222
- name: Setup Node 22
23-
uses: actions/setup-node@v5
23+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
2424
with:
2525
node-version: '22'
2626

@@ -49,8 +49,8 @@ jobs:
4949
- primary
5050
- reversed
5151
steps:
52-
- uses: actions/checkout@v5
53-
- uses: actions/setup-node@v5
52+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
53+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
5454
with:
5555
node-version: '22'
5656
cache: npm
@@ -77,8 +77,8 @@ jobs:
7777
run:
7878
working-directory: universal-refiner
7979
steps:
80-
- uses: actions/checkout@v5
81-
- uses: actions/setup-node@v5
80+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
81+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
8282
with:
8383
node-version: '22'
8484
cache: npm
@@ -97,8 +97,8 @@ jobs:
9797
run:
9898
working-directory: universal-refiner
9999
steps:
100-
- uses: actions/checkout@v5
101-
- uses: actions/setup-node@v5
100+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
101+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
102102
with:
103103
node-version: '22'
104104
cache: npm
@@ -125,8 +125,8 @@ jobs:
125125
run:
126126
working-directory: universal-refiner
127127
steps:
128-
- uses: actions/checkout@v5
129-
- uses: actions/setup-node@v5
128+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
129+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
130130
with:
131131
node-version: '22'
132132
cache: npm
@@ -152,8 +152,8 @@ jobs:
152152
run:
153153
working-directory: universal-refiner
154154
steps:
155-
- uses: actions/checkout@v5
156-
- uses: actions/setup-node@v5
155+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
156+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
157157
with:
158158
node-version: '22'
159159
cache: npm

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ jobs:
2222
language: [ 'typescript' ]
2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
2626
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v3
27+
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4
2828
with:
2929
languages: ${{ matrix.language }}
3030
- name: Autobuild
31-
uses: github/codeql-action/autobuild@v3
31+
uses: github/codeql-action/autobuild@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4
3232
- name: Perform CodeQL Analysis
33-
uses: github/codeql-action/analyze@v3
33+
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4

.github/workflows/pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 10
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
20+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
2121
with:
2222
python-version: 3.x
2323
- run: pip install mkdocs-material
2424
- run: mkdocs build
25-
- uses: actions/upload-pages-artifact@v3
25+
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
2626
with:
2727
path: ./site
2828
deploy:
@@ -35,4 +35,4 @@ jobs:
3535
steps:
3636
- name: Deploy to GitHub Pages
3737
id: deployment
38-
uses: actions/deploy-pages@v4
38+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5

.github/workflows/pr-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717
steps:
18-
- uses: amannn/action-semantic-pull-request@v5
18+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6
1919
env:
2020
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
release-please:
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
issues: write
13+
uses: Coding-Autopilot-System/.github/.github/workflows/release-please-reusable.yml@f288e5e3b67b29a2c08880b76da7b852f4a132d0

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 10
1515
steps:
16-
- uses: actions/stale@v8
16+
- uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10
1717
with:
1818
days-before-stale: 60
1919
days-before-close: 7

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{".": "0.0.0"}

README.md

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,102 @@
2626
npm run link-mcp
2727
\\\
2828

29-
---
30-
*For a deep dive into the internal graph architecture, please see the [Wiki](WIKI/Home.md).*
29+
- prompt governance before code execution
30+
- MCP-based integration instead of editor-specific glue
31+
- evidence-backed refinement using history, tests, and repo context
32+
33+
## What It Demonstrates
34+
35+
- **MCP integration**: the active implementation is the `universal-refiner` package, a TypeScript MCP server for cross-CLI prompt refinement
36+
- **Governance pipeline**: prompts can be captured, classified, refined, and linked to execution outcomes instead of being treated as disposable chat
37+
- **Repo-aware context**: detectors, memory, and retrieval components adapt refinement to the current codebase
38+
- **Proof-oriented design**: tests and architecture docs emphasize traceability, learning, and operational visibility rather than prompt rewriting alone
39+
40+
## Features
41+
42+
- **RAG snippets**: FlexSearch-based retrieval over the local codebase to inject relevant examples into prompt refinement
43+
- **Persistent memory**: SQLite-backed storage for reusable rules, learned patterns, and prompt history
44+
- **Context scouting**: detectors identify language, framework, and architectural signals at startup
45+
- **Operational traceability**: history, timelines, and prompt-to-outcome correlation are first-class design goals
46+
47+
## Current Scope vs. Roadmap
48+
49+
The repo contains both implemented components and forward-looking architecture.
50+
51+
- **Implemented now**: the `universal-refiner` MCP server, Gemini-oriented packaging, tests, and install/build scripts
52+
- **Designed for later expansion**: broader routing, portal, and evidence workflows described in the architecture spec
53+
54+
That distinction matters because this repo is about credible system direction, not vague AI middleware claims.
55+
56+
## Architecture Snapshot
57+
58+
```mermaid
59+
flowchart LR
60+
CLI["AI CLI\n(Claude / Cursor)"] -->|"stdio"| PI["PromptImprover\n(universal-refiner)"]
61+
subgraph internal["PromptImprover Engine"]
62+
RAG["RAG Snippets\n(FlexSearch)"]
63+
Memory["SQLite Memory\n(LocalBrain)"]
64+
AutoHeal["Auto-Heal\n(BackgroundService)"]
65+
end
66+
PI --> RAG
67+
PI --> Memory
68+
PI --> AutoHeal
69+
internal --> Out["Augmented Prompt"]
70+
```
71+
72+
## Proof Points
73+
74+
- [Portfolio proof notes](./docs/portfolio-proof.md)
75+
- [Architecture spec](./docs/promptimprover-autogen-architecture-spec.md)
76+
- [Operator testing guide](./docs/operator-testing.md)
77+
- [Enterprise release gates](./docs/enterprise-release-gates.md)
78+
- [`universal-refiner/package.json`](./universal-refiner/package.json)
79+
- [`universal-refiner/tests`](./universal-refiner/tests)
80+
81+
## Quickstart
82+
83+
```powershell
84+
git clone https://github.com/Coding-Autopilot-System/Promptimprover.git
85+
cd Promptimprover
86+
.\build_and_install.ps1
87+
```
88+
89+
On Linux or macOS:
90+
91+
```sh
92+
git clone https://github.com/Coding-Autopilot-System/Promptimprover.git
93+
cd Promptimprover
94+
./build_and_install.sh
95+
```
96+
97+
Both installers perform a deterministic dependency install, run the full test suite, build the package, install it globally, and verify the `universal-refiner` command. Add that command to your MCP client configuration. See the [Setup Guide](https://github.com/Coding-Autopilot-System/Promptimprover/wiki/Setup-Guide) for full configuration instructions.
98+
99+
For optional automatic pre-prompt linting and post-execution recording, see the [cross-CLI automation guide](./docs/cross-cli-automation.md). Claude Code and Gemini CLI expose the required lifecycle hooks. Codex currently requires MCP-first instructions or explicit helper invocation because its hook lifecycle does not transparently intercept each prompt.
100+
101+
## Local Semantic Model
102+
103+
PromptImprover uses a local OpenAI-compatible endpoint before optional MCP sampling. The safe defaults target `http://localhost:9000/v1`, use `gemma3:12b` first, and fall back to `gemma3:1b`. If neither local model nor MCP sampling is available, rule-based refinement continues without semantic output.
104+
105+
Override the defaults per repository with `.universal-refiner.json`:
106+
107+
```json
108+
{
109+
"semantic": {
110+
"localEnabled": true,
111+
"mcpSamplingEnabled": true,
112+
"baseUrl": "http://localhost:9000/v1",
113+
"models": ["gemma3:12b", "gemma3:1b"],
114+
"timeoutMs": 120000,
115+
"temperature": 0.2,
116+
"allowNonLoopback": false
117+
}
118+
}
119+
```
120+
121+
Non-loopback model endpoints are rejected unless `allowNonLoopback` is explicitly enabled. Generated lessons and templates remain pending until reviewed through the MCP learning-review tools.
122+
123+
## License
124+
125+
MIT - see [LICENSE](LICENSE)
126+
127+
<!-- docs-verified: 101f63d702e5c0ab8052c8e0c67a104d8edfbddb 2026-07-08 -->

dashboard/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h1>Promptimprover Swarm Dashboard</h1>
4141
.replace(/>/g, "&gt;")
4242
.replace(/"/g, "&quot;")
4343
.replace(/'/g, "&#039;");
44-
44+
4545
tr.innerHTML = `
4646
<td>${escapeHtml(fmtTime)}</td>
4747
<td>${escapeHtml(log.span_id || 'N/A')}</td>

dashboard/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const PORT = 3000;
1111

1212
// Helper: read last N lines from trace file
1313
async function readLastLines(filePath, maxLines = 20) {
14+
if (!fs.existsSync(filePath)) return [];
1415
const stream = fs.createReadStream(filePath, { encoding: 'utf8' });
1516
let data = '';
1617
stream.on('data', chunk => { data += chunk; });

0 commit comments

Comments
 (0)