@fiale-plus/pi-rogue-advisor 0.1.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/README.md +9 -0
- package/assets/binary-gate-model.json +24026 -0
- package/package.json +41 -0
- package/skills/advisor/SKILL.md +47 -0
- package/src/extension.test.ts +54 -0
- package/src/extension.ts +599 -0
- package/src/index.ts +2 -0
- package/src/internal.ts +48 -0
- package/src/preflight-signals.test.ts +22 -0
- package/src/preflight-signals.ts +21 -0
- package/src/router.test.ts +78 -0
- package/src/router.ts +516 -0
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fiale-plus/pi-rogue-advisor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "PiRogue advisor extension for Pi — multi-model support, SOTA model suggestion, cache-aware session advisory.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "https://github.com/fiale-plus/pi-rogue",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package"
|
|
10
|
+
],
|
|
11
|
+
"main": "./src/index.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./src/index.ts"
|
|
14
|
+
},
|
|
15
|
+
"pi": {
|
|
16
|
+
"extensions": [
|
|
17
|
+
"./src/extension.ts"
|
|
18
|
+
],
|
|
19
|
+
"skills": [
|
|
20
|
+
"./skills"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
25
|
+
"@earendil-works/pi-ai": "^0.74.0",
|
|
26
|
+
"@earendil-works/pi-tui": "^0.74.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"typebox": "^1.1.24"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"src",
|
|
36
|
+
"skills",
|
|
37
|
+
"assets",
|
|
38
|
+
"README.md",
|
|
39
|
+
"package.json"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: advisor
|
|
3
|
+
description: Zero-config strategic advisor for Pi. Auto-detects best model, phase-aware routing, preflight + post-review + cache. Use for architecture, tradeoffs, planning.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PiRogue Advisor
|
|
7
|
+
|
|
8
|
+
Works out of the box. Just install and use `/advisor`.
|
|
9
|
+
|
|
10
|
+
> 96 strategic calls saved ~$53 on GPT-5.5 over 3,071 turns — see [`docs/savings.md`](../../docs/savings.md)
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
- `/advisor` — status + config
|
|
15
|
+
- `/advisor <question>` — get immediate advice
|
|
16
|
+
- `/advisor on|off` — enable/disable
|
|
17
|
+
|
|
18
|
+
Zero config needed. Falls back through SOTA models (gpt-5.5 → claude-opus-4-6 → sonnet-4-6) automatically.
|
|
19
|
+
|
|
20
|
+
The router is phase-aware: it keeps tiny edits cheap, escalates complex/high-risk work to SOTA, and writes compact routing logs for future classifier training.
|
|
21
|
+
|
|
22
|
+
## When to call
|
|
23
|
+
|
|
24
|
+
Agent should call `advisor` tool before: new frameworks, refactoring, API design, concurrency, security, tradeoffs.
|
|
25
|
+
Skip: reads, small edits, one-liners.
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
| Command | What it does |
|
|
30
|
+
|---------|-------------|
|
|
31
|
+
| `/advisor` | Show status, config, cached note |
|
|
32
|
+
| `/advisor <question>` | Get immediate strategic advice |
|
|
33
|
+
| `/advisor on` | Enable auto mode (preflight+post+cache) |
|
|
34
|
+
| `/advisor off` | Disable |
|
|
35
|
+
| `/advisor mode auto\|manual\|off` | Set advisor mode |
|
|
36
|
+
| `/advisor model <provider/model>` | Set specific model (e.g. `openai-codex/gpt-5.5`) |
|
|
37
|
+
| `/advisor status` | Full status with model info |
|
|
38
|
+
| `/advisor config` | Show current 3-field config |
|
|
39
|
+
| `/advisor review light\|strict\|off` | Set review aggressiveness |
|
|
40
|
+
|
|
41
|
+
## Config (3 fields, all optional)
|
|
42
|
+
|
|
43
|
+
Defaults: `mode: auto, review: light`
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{ "mode": "auto", "review": "light" }
|
|
47
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import type { AdvisorConfig } from "./extension.js";
|
|
3
|
+
|
|
4
|
+
describe("AdvisorConfig", () => {
|
|
5
|
+
it("defaults to auto mode and light review with no model override", () => {
|
|
6
|
+
const cfg: AdvisorConfig = { mode: "auto", review: "light" };
|
|
7
|
+
expect(cfg.mode).toBe("auto");
|
|
8
|
+
expect(cfg.review).toBe("light");
|
|
9
|
+
expect(cfg.model).toBeUndefined();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("accepts all 3 modes", () => {
|
|
13
|
+
for (const mode of ["auto", "manual", "off"] as const) {
|
|
14
|
+
const cfg: AdvisorConfig = { mode, review: "light" };
|
|
15
|
+
expect(cfg.mode).toBe(mode);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("accepts all 3 review levels", () => {
|
|
20
|
+
for (const review of ["light", "strict", "off"] as const) {
|
|
21
|
+
const cfg: AdvisorConfig = { mode: "auto", review };
|
|
22
|
+
expect(cfg.review).toBe(review);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("accepts optional model override", () => {
|
|
27
|
+
const cfg: AdvisorConfig = { mode: "auto", review: "light", model: "claude-sonnet-4-6" };
|
|
28
|
+
expect(cfg.model).toBe("claude-sonnet-4-6");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("serializes/deserializes without data loss (JSON round-trip)", () => {
|
|
32
|
+
const original: AdvisorConfig = { mode: "auto", review: "light", model: "claude-opus-4-6" };
|
|
33
|
+
const json = JSON.stringify(original);
|
|
34
|
+
const parsed = JSON.parse(json) as AdvisorConfig;
|
|
35
|
+
expect(parsed.mode).toBe("auto");
|
|
36
|
+
expect(parsed.review).toBe("light");
|
|
37
|
+
expect(parsed.model).toBe("claude-opus-4-6");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("has exactly 3 properties (mode, review, model)", () => {
|
|
41
|
+
const keys = Object.keys({ mode: "auto", review: "light" } as AdvisorConfig);
|
|
42
|
+
expect(keys.length).toBeLessThanOrEqual(3);
|
|
43
|
+
const allKeys = ["mode", "review", "model"];
|
|
44
|
+
const configKeys = Object.keys({ mode: "auto", review: "light" } as AdvisorConfig);
|
|
45
|
+
expect(configKeys.every((k) => allKeys.includes(k))).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("SOTA model suggestions", () => {
|
|
50
|
+
it("includes gpt-5.5 as primary option", () => {
|
|
51
|
+
const cfg: AdvisorConfig = { mode: "auto", review: "light" };
|
|
52
|
+
expect(cfg.model).toBeUndefined(); // model is optional, auto-detect
|
|
53
|
+
});
|
|
54
|
+
});
|