pi-session-insight 1.0.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/index.ts +34 -0
- package/package.json +21 -0
- package/prompt.md +30 -0
package/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { dirname, join } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __dir = (() => {
|
|
7
|
+
try { return dirname(fileURLToPath(import.meta.url)); }
|
|
8
|
+
catch { return process.cwd(); }
|
|
9
|
+
})();
|
|
10
|
+
|
|
11
|
+
const PROMPT = (() => {
|
|
12
|
+
try { return readFileSync(join(__dir, "prompt.md"), "utf-8"); }
|
|
13
|
+
catch { return "Analyze this conversation and extract the user's unspoken rules."; }
|
|
14
|
+
})();
|
|
15
|
+
|
|
16
|
+
export default function (pi: ExtensionAPI) {
|
|
17
|
+
pi.registerCommand("insight", {
|
|
18
|
+
description: "Extract your unspoken rules from this session using 5 theoretical frameworks.",
|
|
19
|
+
handler: async (_args, ctx) => {
|
|
20
|
+
const ok = await ctx.ui.confirm("Review this session?");
|
|
21
|
+
if (!ok) return;
|
|
22
|
+
|
|
23
|
+
const sessionPath = ctx.sessionManager?.getSessionFile?.() ?? "";
|
|
24
|
+
const note = sessionPath ? "\nSession file: " + sessionPath : "";
|
|
25
|
+
|
|
26
|
+
ctx.ui.notify("Review started. Please wait for analysis...", "info");
|
|
27
|
+
|
|
28
|
+
pi.sendMessage(
|
|
29
|
+
{ content: PROMPT + note, display: true },
|
|
30
|
+
{ triggerTurn: true }
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-session-insight",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Extract your unspoken rules from pi sessions using Gricean pragmatics, SBI, and Relevance Theory",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "halrixx",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package",
|
|
10
|
+
"pi",
|
|
11
|
+
"pi-coding-agent"
|
|
12
|
+
],
|
|
13
|
+
"pi": {
|
|
14
|
+
"extensions": ["./index.ts"]
|
|
15
|
+
},
|
|
16
|
+
"files": ["index.ts", "prompt.md", "README.md"],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/halrixx/pi-session-insight"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/prompt.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Analyze this conversation and extract the user's unspoken rules.
|
|
2
|
+
|
|
3
|
+
Use 5 theoretical frameworks:
|
|
4
|
+
1. Grice's Quality Maxim — Did the user ever challenge unsupported claims?
|
|
5
|
+
2. Grice's Quantity Maxim — Did the user find information too much or too little?
|
|
6
|
+
3. SBI Feedback Model — What Situation-Behavior-Impact does each brief correction imply?
|
|
7
|
+
4. Implicit Feedback — What default expectations do the user's corrections reveal?
|
|
8
|
+
5. Relevance Theory — What task scope does the user's instruction actually expect?
|
|
9
|
+
|
|
10
|
+
Format for each rule:
|
|
11
|
+
|
|
12
|
+
[Source Dialogue]
|
|
13
|
+
User said: (quote verbatim)
|
|
14
|
+
I said: (quote verbatim)
|
|
15
|
+
User then said: (quote verbatim)
|
|
16
|
+
|
|
17
|
+
[Rule]
|
|
18
|
+
What is the user's unspoken rule?
|
|
19
|
+
|
|
20
|
+
[Reasoning]
|
|
21
|
+
Why does this dialogue imply that rule?
|
|
22
|
+
|
|
23
|
+
[Framework]
|
|
24
|
+
Which of the 5 frameworks does this belong to?
|
|
25
|
+
|
|
26
|
+
Only output rules with solid evidence. Skip anything speculative.
|
|
27
|
+
|
|
28
|
+
When finished, ask the user:
|
|
29
|
+
1. Which of these rules should I add to your AGENTS.md?
|
|
30
|
+
2. Any other observations I may have missed?
|