@neilurk12/pi-agent-modes 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/LICENSE +21 -0
- package/README.md +135 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +301 -0
- package/dist/index.js.map +1 -0
- package/dist/mode-catalog.d.ts +51 -0
- package/dist/mode-catalog.d.ts.map +1 -0
- package/dist/mode-catalog.js +175 -0
- package/dist/mode-catalog.js.map +1 -0
- package/dist/mode-runtime.d.ts +92 -0
- package/dist/mode-runtime.d.ts.map +1 -0
- package/dist/mode-runtime.js +197 -0
- package/dist/mode-runtime.js.map +1 -0
- package/dist/mode-tool-policy.d.ts +13 -0
- package/dist/mode-tool-policy.d.ts.map +1 -0
- package/dist/mode-tool-policy.js +163 -0
- package/dist/mode-tool-policy.js.map +1 -0
- package/dist/payload-injection.d.ts +2 -0
- package/dist/payload-injection.d.ts.map +1 -0
- package/dist/payload-injection.js +25 -0
- package/dist/payload-injection.js.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/modes/ask.md +27 -0
- package/modes/code.md +17 -0
- package/modes/orchestrator.md +18 -0
- package/modes/plan.md +24 -0
- package/modes/yolo.md +10 -0
- package/package.json +47 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
const FAIL_CLOSED_READ_ONLY_TOOLS = new Set([
|
|
2
|
+
"read",
|
|
3
|
+
"bash",
|
|
4
|
+
"grep",
|
|
5
|
+
"find",
|
|
6
|
+
"ls",
|
|
7
|
+
"questionnaire",
|
|
8
|
+
"ask_user_question",
|
|
9
|
+
]);
|
|
10
|
+
const DESTRUCTIVE_PATTERNS = [
|
|
11
|
+
/\brm\b/i,
|
|
12
|
+
/\brmdir\b/i,
|
|
13
|
+
/\bmv\b/i,
|
|
14
|
+
/\bcp\b/i,
|
|
15
|
+
/\bmkdir\b/i,
|
|
16
|
+
/\btouch\b/i,
|
|
17
|
+
/\bchmod\b/i,
|
|
18
|
+
/\bchown\b/i,
|
|
19
|
+
/\bchgrp\b/i,
|
|
20
|
+
/\bln\b/i,
|
|
21
|
+
/\btee\b/i,
|
|
22
|
+
/\btruncate\b/i,
|
|
23
|
+
/\bdd\b/i,
|
|
24
|
+
/\bshred\b/i,
|
|
25
|
+
/(^|[^<])>(?!>)/,
|
|
26
|
+
/>>/,
|
|
27
|
+
/\bnpm\s+(install|uninstall|update|ci|link|publish)/i,
|
|
28
|
+
/\byarn\s+(add|remove|install|publish)/i,
|
|
29
|
+
/\bpnpm\s+(add|remove|install|publish)/i,
|
|
30
|
+
/\bpip\s+(install|uninstall)/i,
|
|
31
|
+
/\bapt(-get)?\s+(install|remove|purge|update|upgrade)/i,
|
|
32
|
+
/\bbrew\s+(install|uninstall|upgrade)/i,
|
|
33
|
+
/\bgit\s+(add|commit|push|pull|merge|rebase|reset|checkout|branch\s+-[dD]|stash|cherry-pick|revert|tag|init|clone)/i,
|
|
34
|
+
/\bsudo\b/i,
|
|
35
|
+
/\bsu\b/i,
|
|
36
|
+
/\bkill\b/i,
|
|
37
|
+
/\bpkill\b/i,
|
|
38
|
+
/\bkillall\b/i,
|
|
39
|
+
/\breboot\b/i,
|
|
40
|
+
/\bshutdown\b/i,
|
|
41
|
+
/\bsystemctl\s+(start|stop|restart|enable|disable)/i,
|
|
42
|
+
/\bservice\s+\S+\s+(start|stop|restart)/i,
|
|
43
|
+
/\b(vim?|nano|emacs|code|subl)\b/i,
|
|
44
|
+
];
|
|
45
|
+
const SAFE_PATTERNS = [
|
|
46
|
+
/^\s*cat\b/,
|
|
47
|
+
/^\s*head\b/,
|
|
48
|
+
/^\s*tail\b/,
|
|
49
|
+
/^\s*less\b/,
|
|
50
|
+
/^\s*more\b/,
|
|
51
|
+
/^\s*grep\b/,
|
|
52
|
+
/^\s*find\b/,
|
|
53
|
+
/^\s*ls\b/,
|
|
54
|
+
/^\s*pwd\b/,
|
|
55
|
+
/^\s*echo\b/,
|
|
56
|
+
/^\s*printf\b/,
|
|
57
|
+
/^\s*wc\b/,
|
|
58
|
+
/^\s*sort\b/,
|
|
59
|
+
/^\s*uniq\b/,
|
|
60
|
+
/^\s*diff\b/,
|
|
61
|
+
/^\s*file\b/,
|
|
62
|
+
/^\s*stat\b/,
|
|
63
|
+
/^\s*du\b/,
|
|
64
|
+
/^\s*df\b/,
|
|
65
|
+
/^\s*tree\b/,
|
|
66
|
+
/^\s*which\b/,
|
|
67
|
+
/^\s*whereis\b/,
|
|
68
|
+
/^\s*type\b/,
|
|
69
|
+
/^\s*env\b/,
|
|
70
|
+
/^\s*printenv\b/,
|
|
71
|
+
/^\s*uname\b/,
|
|
72
|
+
/^\s*whoami\b/,
|
|
73
|
+
/^\s*id\b/,
|
|
74
|
+
/^\s*date\b/,
|
|
75
|
+
/^\s*cal\b/,
|
|
76
|
+
/^\s*uptime\b/,
|
|
77
|
+
/^\s*ps\b/,
|
|
78
|
+
/^\s*top\b/,
|
|
79
|
+
/^\s*htop\b/,
|
|
80
|
+
/^\s*free\b/,
|
|
81
|
+
/^\s*git\s+(status|log|diff|show|branch|remote|config\s+--get)/i,
|
|
82
|
+
/^\s*git\s+ls-/i,
|
|
83
|
+
/^\s*npm\s+(list|ls|view|info|search|outdated|audit)/i,
|
|
84
|
+
/^\s*yarn\s+(list|info|why|audit)/i,
|
|
85
|
+
/^\s*node\s+--version/i,
|
|
86
|
+
/^\s*python\s+--version/i,
|
|
87
|
+
/^\s*curl\s/i,
|
|
88
|
+
/^\s*wget\s+-O\s*-/i,
|
|
89
|
+
/^\s*jq\b/,
|
|
90
|
+
/^\s*sed\s+-n/i,
|
|
91
|
+
/^\s*awk\b/,
|
|
92
|
+
/^\s*rg\b/,
|
|
93
|
+
/^\s*fd\b/,
|
|
94
|
+
/^\s*bat\b/,
|
|
95
|
+
/^\s*eza\b/,
|
|
96
|
+
];
|
|
97
|
+
export function evaluateToolCall({ mode, definition, toolName, input }) {
|
|
98
|
+
if (!definition) {
|
|
99
|
+
if (!FAIL_CLOSED_READ_ONLY_TOOLS.has(toolName)) {
|
|
100
|
+
return {
|
|
101
|
+
block: true,
|
|
102
|
+
reason: `Mode '${mode}' not initialized — fail-closed blocks tool: ${toolName}`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (toolName === "bash") {
|
|
106
|
+
const command = commandFromInput(input);
|
|
107
|
+
if (!isSafeCommand(command)) {
|
|
108
|
+
return {
|
|
109
|
+
block: true,
|
|
110
|
+
reason: `Mode '${mode}' not initialized — fail-closed blocked unsafe command: ${command}`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { block: false };
|
|
115
|
+
}
|
|
116
|
+
const allowed = definition.enabled_tools;
|
|
117
|
+
if (Array.isArray(allowed) && allowed.length > 0 && !allowed.includes(toolName)) {
|
|
118
|
+
return {
|
|
119
|
+
block: true,
|
|
120
|
+
reason: `${mode.toUpperCase()} mode blocks tool: ${toolName}. Allowed tools: ${allowed.join(", ")}`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (toolName === "bash") {
|
|
124
|
+
const command = commandFromInput(input);
|
|
125
|
+
const bashPolicy = resolveBashPolicy(mode, definition);
|
|
126
|
+
if (bashPolicy === "strict_readonly" && !isSafeCommand(command)) {
|
|
127
|
+
return {
|
|
128
|
+
block: true,
|
|
129
|
+
reason: `${mode.toUpperCase()} mode blocked unsafe command: ${command}\nAllowed read-only commands only. Use /mode yolo to enable full bash.`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (bashPolicy === "non_destructive" && isDestructiveCommand(command)) {
|
|
133
|
+
return {
|
|
134
|
+
block: true,
|
|
135
|
+
reason: `${mode.toUpperCase()} mode blocked destructive command: ${command}\nAllowed development commands only. Switch to YOLO (/mode yolo) if you need this.`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { block: false };
|
|
140
|
+
}
|
|
141
|
+
function commandFromInput(input) {
|
|
142
|
+
if (!input || typeof input !== "object")
|
|
143
|
+
return "";
|
|
144
|
+
const value = input.command;
|
|
145
|
+
return typeof value === "string" ? value : "";
|
|
146
|
+
}
|
|
147
|
+
function resolveBashPolicy(mode, definition) {
|
|
148
|
+
if (definition.bash_policy)
|
|
149
|
+
return definition.bash_policy;
|
|
150
|
+
const normalized = mode.trim().toLowerCase();
|
|
151
|
+
if (normalized === "plan" || normalized === "ask")
|
|
152
|
+
return "strict_readonly";
|
|
153
|
+
if (normalized === "code")
|
|
154
|
+
return "non_destructive";
|
|
155
|
+
return "off";
|
|
156
|
+
}
|
|
157
|
+
function isDestructiveCommand(command) {
|
|
158
|
+
return DESTRUCTIVE_PATTERNS.some((pattern) => pattern.test(command));
|
|
159
|
+
}
|
|
160
|
+
function isSafeCommand(command) {
|
|
161
|
+
return !isDestructiveCommand(command) && SAFE_PATTERNS.some((pattern) => pattern.test(command));
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=mode-tool-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-tool-policy.js","sourceRoot":"","sources":["../src/mode-tool-policy.ts"],"names":[],"mappings":"AAcA,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;IAC1C,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,eAAe;IACf,mBAAmB;CACpB,CAAC,CAAC;AAEH,MAAM,oBAAoB,GAAG;IAC3B,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,UAAU;IACV,eAAe;IACf,SAAS;IACT,YAAY;IACZ,gBAAgB;IAChB,IAAI;IACJ,qDAAqD;IACrD,wCAAwC;IACxC,wCAAwC;IACxC,8BAA8B;IAC9B,uDAAuD;IACvD,uCAAuC;IACv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CAAC,KAAc;IACtC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACnD,MAAM,KAAK,GAAI,KAA+B,CAAC,OAAO,CAAC;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,UAA0B;IACjE,IAAI,UAAU,CAAC,WAAW;QAAE,OAAO,UAAU,CAAC,WAAW,CAAC;IAE1D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,KAAK;QAAE,OAAO,iBAAiB,CAAC;IAC5E,IAAI,UAAU,KAAK,MAAM;QAAE,OAAO,iBAAiB,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-injection.d.ts","sourceRoot":"","sources":["../src/payload-injection.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAoBzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function injectIntoPayload(payload, text) {
|
|
2
|
+
if (!payload || typeof payload !== "object")
|
|
3
|
+
return payload;
|
|
4
|
+
const target = payload;
|
|
5
|
+
if (typeof target.system === "string") {
|
|
6
|
+
target.system += text;
|
|
7
|
+
}
|
|
8
|
+
else if (Array.isArray(target.system)) {
|
|
9
|
+
target.system.push({ type: "text", text });
|
|
10
|
+
}
|
|
11
|
+
else if (Array.isArray(target.messages)) {
|
|
12
|
+
const sysMsg = target.messages.find((m) => m.role === "system");
|
|
13
|
+
if (sysMsg) {
|
|
14
|
+
if (typeof sysMsg.content === "string")
|
|
15
|
+
sysMsg.content += text;
|
|
16
|
+
else if (Array.isArray(sysMsg.content))
|
|
17
|
+
sysMsg.content.push({ type: "text", text });
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
target.messages.unshift({ role: "system", content: text });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=payload-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-injection.js","sourceRoot":"","sources":["../src/payload-injection.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,IAAY;IAC9D,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAE5D,MAAM,MAAM,GAAG,OAAc,CAAC;IAE9B,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;IACxB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QACrE,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;gBAAE,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;iBAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;gBAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type BashPolicy = "strict_readonly" | "non_destructive" | "off";
|
|
2
|
+
export interface ModeDefinition {
|
|
3
|
+
mode: string;
|
|
4
|
+
enabled_tools?: string[];
|
|
5
|
+
bash_policy?: BashPolicy;
|
|
6
|
+
prompt_suffix?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
border_label?: string;
|
|
9
|
+
border_style?: 'accent' | 'warning' | 'success' | 'muted';
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,KAAK,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;CAC3D"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/modes/ask.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: ask
|
|
3
|
+
bash_policy: strict_readonly
|
|
4
|
+
enabled_tools:
|
|
5
|
+
- read
|
|
6
|
+
- bash
|
|
7
|
+
- grep
|
|
8
|
+
- find
|
|
9
|
+
- ls
|
|
10
|
+
- questionnaire
|
|
11
|
+
description: "Clarification-first mode. Gather requirements before acting."
|
|
12
|
+
border_label: " ASK "
|
|
13
|
+
border_style: muted
|
|
14
|
+
prompt_suffix: |
|
|
15
|
+
[MODE: ASK]
|
|
16
|
+
You are in ASK MODE — a clarification-first mode for requirement gathering.
|
|
17
|
+
- Enabled tools: read, bash, grep, find, ls, questionnaire.
|
|
18
|
+
- Disabled tools: edit, write, apply_patch.
|
|
19
|
+
- Bash commands are shell-filtered; destructive commands (rm, git push, npm install, etc.) are blocked.
|
|
20
|
+
- Your ONLY job is to ask structured questions to clarify the user's request.
|
|
21
|
+
- Gather full requirements, constraints, and context before any implementation.
|
|
22
|
+
- Present a numbered list of requirements or acceptance criteria once gathered.
|
|
23
|
+
- If the user already provides a clear spec, confirm understanding by summarizing back.
|
|
24
|
+
- DO NOT make any file changes. DO NOT attempt implementation.
|
|
25
|
+
---
|
|
26
|
+
# ASK Mode
|
|
27
|
+
Clarification-first mode. Only questionnaire and read tools enabled. Gather requirements via structured questions before any implementation.
|
package/modes/code.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: code
|
|
3
|
+
bash_policy: non_destructive
|
|
4
|
+
enabled_tools: [] # empty = all tools like YOLO
|
|
5
|
+
description: "Coding mode. All tools enabled, but bash commands are filtered to block destructive operations."
|
|
6
|
+
border_label: " CODE "
|
|
7
|
+
border_style: success
|
|
8
|
+
prompt_suffix: |
|
|
9
|
+
[MODE: CODE]
|
|
10
|
+
You are in CODE MODE — full editing and bash access, with destructive-command protection.
|
|
11
|
+
- All tools are available.
|
|
12
|
+
- Bash commands are filtered: destructive commands (rm -rf, git push, sudo, npm install, etc.) are blocked.
|
|
13
|
+
- Use bash for building, testing, running scripts, and read-only git operations.
|
|
14
|
+
- Use edit/write to modify code.
|
|
15
|
+
---
|
|
16
|
+
# CODE Mode
|
|
17
|
+
Full editing and development tools with destructive command protection. Bash is filtered to block dangerous operations (rm -rf, git push, sudo, etc.) while allowing build, test, and dev commands.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: orchestrator
|
|
3
|
+
bash_policy: off
|
|
4
|
+
enabled_tools: [] # empty = all tools
|
|
5
|
+
description: "Coordination mode. Delegates tasks to subagents."
|
|
6
|
+
border_label: " ORCH "
|
|
7
|
+
border_style: accent
|
|
8
|
+
prompt_suffix: |
|
|
9
|
+
[MODE: ORCHESTRATOR]
|
|
10
|
+
You are in orchestrator mode. Your workflow:
|
|
11
|
+
1. Break the user's request into independent subtasks
|
|
12
|
+
2. For each subtask, use the `subagent` tool to delegate
|
|
13
|
+
3. Collect results and synthesize into final answer
|
|
14
|
+
4. Track progress; if a subagent fails, retry or re-plan
|
|
15
|
+
Delegate early and often.
|
|
16
|
+
---
|
|
17
|
+
# ORCHESTRATOR Mode
|
|
18
|
+
Break tasks into subtasks. Delegate using the `subagent` tool. Track progress. Synthesize results.
|
package/modes/plan.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
mode: plan
|
|
3
|
+
bash_policy: strict_readonly
|
|
4
|
+
enabled_tools:
|
|
5
|
+
- read
|
|
6
|
+
- bash
|
|
7
|
+
- grep
|
|
8
|
+
- find
|
|
9
|
+
- ls
|
|
10
|
+
- questionnaire
|
|
11
|
+
description: "Safe exploration mode. Read-only tools only."
|
|
12
|
+
border_label: " PLAN "
|
|
13
|
+
border_style: warning
|
|
14
|
+
prompt_suffix: |
|
|
15
|
+
[MODE: PLAN]
|
|
16
|
+
You are in PLAN MODE — read-only exploration for safe analysis.
|
|
17
|
+
- Enabled tools: read, bash, grep, find, ls, questionnaire.
|
|
18
|
+
- Disabled tools: edit, write, apply_patch.
|
|
19
|
+
- Bash commands are shell-filtered; destructive commands (rm, git push, npm install, etc.) are blocked.
|
|
20
|
+
- Focus on exploration and planning.
|
|
21
|
+
- When asked for a plan, provide a numbered list under "Plan:".
|
|
22
|
+
---
|
|
23
|
+
# PLAN Mode
|
|
24
|
+
Safe exploration. Bash is shell-filtered to a strict allowlist; destructive commands are blocked.
|
package/modes/yolo.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neilurk12/pi-agent-modes",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Multi-mode extension for pi coding agent: yolo, plan, ask, orchestrator",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Neil-urk12/pi-dots.git"
|
|
9
|
+
},
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"modes",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
21
|
+
"watch": "tsc --watch",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"pi",
|
|
26
|
+
"coding-agent",
|
|
27
|
+
"extension",
|
|
28
|
+
"modes",
|
|
29
|
+
"ask",
|
|
30
|
+
"yolo",
|
|
31
|
+
"plan",
|
|
32
|
+
"orchestrator"
|
|
33
|
+
],
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@earendil-works/pi-coding-agent": ">=0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@earendil-works/pi-coding-agent": "latest",
|
|
40
|
+
"@earendil-works/pi-tui": "latest",
|
|
41
|
+
"@types/js-yaml": "^4.0.9",
|
|
42
|
+
"typescript": "^6.0.3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"js-yaml": "^4.1.0"
|
|
46
|
+
}
|
|
47
|
+
}
|