@preapexis/piexis 0.1.2 → 0.2.2

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.
@@ -0,0 +1,35 @@
1
+ name: Publish npm package
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ permissions:
13
+ contents: read
14
+ id-token: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+
19
+ - uses: actions/setup-node@v6
20
+ with:
21
+ node-version: 24
22
+ registry-url: https://registry.npmjs.org
23
+ package-manager-cache: false
24
+
25
+ - run: npm ci --ignore-scripts
26
+ - run: npm run check
27
+ - run: npm test
28
+
29
+ - name: Verify version tag
30
+ run: |
31
+ VERSION=$(node -p "require('./package.json').version")
32
+ TAG=${GITHUB_REF_NAME#v}
33
+ test "$VERSION" = "$TAG"
34
+
35
+ - run: npm publish --access public
package/README.md CHANGED
@@ -1,15 +1,14 @@
1
- # Piexis
1
+ # PieXis
2
2
 
3
- Piexis is a Pi package with permission/approval controls, background Git-worktree tasks, prompts, skills, and UI resources. It requires Node.js 22.19+ and a current Pi release (local runtime checks passed with Pi 0.85.1 and 0.87.1 on Linux).
3
+ PieXis is a Pi package with permission/approval controls, background Git-worktree tasks, prompts, skills, and UI resources. It requires Node.js 22.19+ and a current Pi release (local runtime checks passed with Pi 0.85.1 and 0.87.1 on Linux).
4
4
 
5
5
  > [!WARNING]
6
- > **Piexis permission controls are not a security boundary.** They help prevent accidental or unapproved agent tool actions; they do **not** provide OS-level sandboxing, filesystem isolation, workspace-only filesystem enforcement, protected-path enforcement, network isolation, or network allowlisting. Run Pi in an appropriate container, VM, sandbox, or restricted user account when executing untrusted code or allowing unattended/high-autonomy agents.
6
+ > **PieXis permission controls are not a security boundary.** They help prevent accidental or unapproved agent tool actions; they do **not** provide OS-level sandboxing, filesystem isolation, workspace-only filesystem enforcement, protected-path enforcement, network isolation, or network allowlisting. Run Pi in an appropriate container, VM, sandbox, or restricted user account when executing untrusted code or allowing unattended/high-autonomy agents.
7
7
 
8
8
  ## Install and use
9
9
 
10
10
  ```sh
11
- npm ci --ignore-scripts
12
- pi install /absolute/path/to/piexis
11
+ pi install npm:@preapexis/piexis
13
12
  ```
14
13
 
15
14
  Installing the package loads its declared extensions, prompts, skills, and theme. Loading only `extensions/mode.ts` loads only the permission extension. Restart Pi or run `/reload` after installation.
@@ -25,7 +24,7 @@ Use `Alt+M` while the agent is idle to cycle Manual → Accept Edits → Plan
25
24
  | **Plan** (`plan`) | Allows project-local ordinary reads, task status/diff inspection/cancellation, and `AskQuestion`; Bash, external/sensitive path-tool reads, task creation/apply/cleanup, and file mutations are blocked. |
26
25
  | **Auto** (`auto`) | Directly permits ordinary project-local reads, `edit`, and `write`. Sensitive paths, protected configuration edits, uncertain recursive searches, and malformed or unsupported paths/tools remain denied. Bash outside the harmless-builtin set and eligible narrow session grants, plus remaining known external actions, receive intent-aware model review. Missing authorization, timeout, error, or invalid review denies the action. |
27
26
  | **Don't Ask** (`dontAsk`) | Permits only pre-approved reads/questions and harmless Bash builtins; denies other calls without a dialog. Launch-only. |
28
- | **Bypass Permissions** (`bypassPermissions`) | Skips **Piexis extension-level permission checks**. It does not enter or escape a sandbox, and does not override OS permissions or other extensions. Task scope/confirmation safeguards remain. Launch-only. |
27
+ | **Bypass Permissions** (`bypassPermissions`) | Skips **PieXis extension-level permission checks**. It does not enter or escape a sandbox, and does not override OS permissions or other extensions. Task scope/confirmation safeguards remain. Launch-only. |
29
28
 
30
29
  Approval UI is fail-closed: calls requiring approval are denied when no permission UI is available. Relative paths resolve against the tool's current working directory, independently of the repository boundary. Both requested and resolved paths are checked; a symlink that resolves outside the project is treated as external, and malformed or unresolvable paths are denied. This is a permission policy, not filesystem sandboxing.
31
30
 
@@ -51,7 +50,7 @@ Repository configuration currently selects models only; there are no repository-
51
50
 
52
51
  ## Configuration
53
52
 
54
- Launching Piexis does not create `.pi/` or project configuration. It uses in-memory defaults when `.pi/permission-modes.json` is absent. Run `/piexis-init` to explicitly create `.pi/settings.json` and `.pi/permission-modes.json`; existing files are never overwritten.
53
+ Launching PieXis does not create `.pi/` or project configuration. It uses in-memory defaults when `.pi/permission-modes.json` is absent. Run `/piexis-init` to explicitly create `.pi/settings.json` and `.pi/permission-modes.json`; existing files are never overwritten.
55
54
 
56
55
  `permission-modes.json` can select Auto's authenticated classifier and permitted background models:
57
56
 
@@ -98,7 +97,7 @@ For reviewed actions, the configured provider receives:
98
97
  - Bounded shell parsing results and risk findings; no script or Git configuration contents.
99
98
  - For task creation and worker review, the proposed task/brief, selected model, and delegated path/Bash scope, explicitly marked as untrusted action data—not user authorization.
100
99
 
101
- Other than the proposed delegation brief described above, it does **not** receive assistant prose/reasoning, raw tool-output history, worker result summaries, compaction summaries, file contents, edit/write replacement text, environment-variable objects, or Pi authentication credentials. The reviewer has no tool access. User prose, paths, commands, and approval strings can themselves contain secrets: recognition/redaction is best-effort, not a secret-detection guarantee. Do not use Auto when those details must not be disclosed to the selected provider. Recognizably secret-bearing or oversized review payloads are denied locally, without contacting the provider. Piexis does not log review payloads; Pi's normal user-message/session storage still applies.
100
+ Other than the proposed delegation brief described above, it does **not** receive assistant prose/reasoning, raw tool-output history, worker result summaries, compaction summaries, file contents, edit/write replacement text, environment-variable objects, or Pi authentication credentials. The reviewer has no tool access. User prose, paths, commands, and approval strings can themselves contain secrets: recognition/redaction is best-effort, not a secret-detection guarantee. Do not use Auto when those details must not be disclosed to the selected provider. Recognizably secret-bearing or oversized review payloads are denied locally, without contacting the provider. PieXis does not log review payloads; Pi's normal user-message/session storage still applies.
102
101
 
103
102
  ### Provenance and context limits
104
103
 
@@ -116,7 +115,7 @@ Only standalone `pwd`, `pwd -L`, `pwd -P`, `true`, and `false` are automatic Bas
116
115
 
117
116
  ### Reusable grants
118
117
 
119
- For this first bounded implementation, reusable Bash grants cover only **Git status queries** with a fixed option vocabulary: `--short`/`-s`, `--branch`/`-b`, `--porcelain[=v1|=v2]`, and `--untracked-files=no|normal|all`. Choose either the exact command or that narrow query family. Both are bound to the canonical working directory and a fingerprint of the resolved Git executable's metadata, relevant environment, Git configuration, and Piexis settings/permission configuration. A changed fingerprint requires fresh approval/review. A status query can update Git's optional index caches; it is not part of the automatic read-only builtin set.
118
+ For this first bounded implementation, reusable Bash grants cover only **Git status queries** with a fixed option vocabulary: `--short`/`-s`, `--branch`/`-b`, `--porcelain[=v1|=v2]`, and `--untracked-files=no|normal|all`. Choose either the exact command or that narrow query family. Both are bound to the canonical working directory and a fingerprint of the resolved Git executable's metadata, relevant environment, Git configuration, and PieXis settings/permission configuration. A changed fingerprint requires fresh approval/review. A status query can update Git's optional index caches; it is not part of the automatic read-only builtin set.
120
119
 
121
120
  Configuration is inspected locally with bounded reads and never sent to the classifier. Unknown Git configuration keys, includes, aliases, hooks/fsmonitor/pager settings, shell startup overrides, script wrappers named Git, and linked worktrees decline reusable grants. Only a small set of inert core/user/remote/branch Git configuration keys is supported. Reuse is currently unavailable on Windows. Ordinary one-time approval or Auto review remains available when reuse is declined. Scripts (`npm test`, `make`, Python, shell scripts, etc.) do **not** receive reusable narrow grants; arbitrary dependency changes cannot therefore silently reuse such a grant. Full script-dependency analysis is not implemented.
122
121
 
@@ -133,7 +132,7 @@ Denials include a reason and suggest a genuinely narrower action, clarification,
133
132
 
134
133
  Once stopped, subsequent tool calls remain blocked except `AskQuestion` (and the deliberately launch-only Bypass mode). A newly delivered provenance-verified user request resets the budget; extension-injected messages and automatic retries do not. Pending sibling approvals cannot grant or execute after the stop. Already executing processes are subject to Pi's normal cancellation, not OS isolation.
135
134
 
136
- Without permission UI, approval-required actions are immediately denied. At the threshold Piexis emits a `permission_blocked` diagnostic on **stderr**, records a count-only session stop entry, and aborts the run without waiting for input or forcing the whole host process to exit. Pi JSON/RPC consumers must inspect the blocked/aborted outcome; this extension does not promise a nonzero JSON-mode exit status.
135
+ Without permission UI, approval-required actions are immediately denied. At the threshold PieXis emits a `permission_blocked` diagnostic on **stderr**, records a count-only session stop entry, and aborts the run without waiting for input or forcing the whole host process to exit. Pi JSON/RPC consumers must inspect the blocked/aborted outcome; this extension does not promise a nonzero JSON-mode exit status.
137
136
 
138
137
  ## Background tasks
139
138
 
@@ -162,13 +161,13 @@ Use `/task status`, `/task review <id>`, `/task diff <id>`, `/task cancel <id>`,
162
161
 
163
162
  Apply always requires a user dialog showing the **actual changed paths**, sensitive/configuration warnings, and observed command results—even in Auto/Bypass. The patch digest and destination findings are checked again after confirmation, followed by Git apply validation. Worker prose cannot establish successful verification: observations come from post-execution tool records, not claimed test results or blocked tool-start events. Successful command completion is not proof of test coverage; verify again in the parent workspace after application. Repeatedly declined or headless agent-requested apply/cleanup actions use the foreground denial budget.
164
163
 
165
- Cleanup confirms deletion and validates the Piexis ownership marker, temporary directory, Git worktree, and repository before removal. Completed unapplied changes are retained rather than discarded. Headless apply/cleanup is denied. Trusted Pi/Git executables are assumed. These checks are not protection against arbitrary host code or filesystem races.
164
+ Cleanup confirms deletion and validates the PieXis ownership marker, temporary directory, Git worktree, and repository before removal. Completed unapplied changes are retained rather than discarded. Headless apply/cleanup is denied. Trusted Pi/Git executables are assumed. These checks are not protection against arbitrary host code or filesystem races.
166
165
 
167
166
  Metadata lives at `<agent-dir>/piexis/tasks/<project-hash>.json`, not in the repository. Legacy `.pi/piexis-tasks.json` is imported if user-level state is absent; the source is retained. Interrupted worktrees can be reviewed/cleaned, but authorization, process handles, broker tokens, and user-intent snapshots are never restored from metadata. Fast tests use Git fixtures, mocked worker processes, and mocked reviewers. A separate [runtime suite](tests/runtime/README.md) checks actual Pi RPC/JSON flows, worker processes, and TUI permissions through a pseudo-terminal on Linux, using a deterministic local provider. Live-model accuracy, other platforms, and full visual/terminal compatibility remain unvalidated.
168
167
 
169
168
  ## Select package resources
170
169
 
171
- Piexis uses Pi's native package resource filtering; it does not add its own plugin manager. Run `pi config` (or `pi config --local` for a trusted project) to enable or disable discovered resources. In settings, the package object can narrow resources declared by this package:
170
+ PieXis uses Pi's native package resource filtering; it does not add its own plugin manager. Run `pi config` (or `pi config --local` for a trusted project) to enable or disable discovered resources. In settings, the package object can narrow resources declared by this package:
172
171
 
173
172
  ```json
174
173
  {
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@preapexis/piexis",
3
- "version": "0.1.2",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Extensions, skills, prompts, and themes for pi",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/VarunGaikwad/piexis"
9
+ },
6
10
  "keywords": [
7
11
  "pi-package"
8
12
  ],
@@ -20,6 +24,7 @@
20
24
  "test:runtime": "node --test tests/runtime/*.test.mjs",
21
25
  "check": "tsc --noEmit",
22
26
  "eval:permissions": "node eval/permissions.mjs",
27
+ "release": "node scripts/release.mjs",
23
28
  "test:sandbox": "PIEXIS_REQUIRE_SANDBOX=1 node --test tests/mode-sandbox.test.mjs"
24
29
  },
25
30
  "pi": {
@@ -0,0 +1,32 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { readFileSync } from "node:fs";
3
+
4
+ const bump = process.argv[2] ?? "patch";
5
+ if (!["patch", "minor", "major"].includes(bump)) {
6
+ console.error("Usage: npm run release -- [patch|minor|major]");
7
+ process.exit(1);
8
+ }
9
+
10
+ function run(command, args) {
11
+ const result = spawnSync(command, args, { stdio: "inherit", shell: false });
12
+ if (result.error) throw result.error;
13
+ if (result.status !== 0) process.exit(result.status ?? 1);
14
+ }
15
+
16
+ const status = spawnSync("git", ["status", "--porcelain"], { encoding: "utf8" });
17
+ if (status.status !== 0) process.exit(status.status ?? 1);
18
+ if (status.stdout.trim()) {
19
+ console.error("Working tree is not clean. Commit or stash changes first.");
20
+ process.exit(1);
21
+ }
22
+
23
+ console.log("Running checks...");
24
+ run("npm", ["run", "check"]);
25
+ run("npm", ["test"]);
26
+
27
+ console.log(`Bumping ${bump} version and creating a Git tag...`);
28
+ run("npm", ["version", bump]);
29
+
30
+ const packageJson = JSON.parse(readFileSync("package.json", "utf8"));
31
+ console.log(`Pushing v${packageJson.version}; GitHub Actions will publish it.`);
32
+ run("git", ["push", "origin", "HEAD", "--follow-tags"]);
@@ -1,63 +0,0 @@
1
- name: CI and publish
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
- release:
8
- types: [published]
9
-
10
- permissions:
11
- contents: read
12
-
13
- jobs:
14
- test:
15
- name: Check and test
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - name: Checkout
19
- uses: actions/checkout@v5
20
-
21
- - name: Set up Node.js
22
- uses: actions/setup-node@v5
23
- with:
24
- node-version: 24
25
- cache: npm
26
-
27
- - name: Install dependencies
28
- run: npm ci --ignore-scripts
29
-
30
- - name: Type-check
31
- run: npm run check
32
-
33
- - name: Test
34
- run: npm test
35
-
36
- - name: Check package contents
37
- run: npm pack --dry-run
38
-
39
- publish:
40
- name: Publish to npm
41
- if: github.event_name == 'release' && github.event.action == 'published'
42
- needs: test
43
- runs-on: ubuntu-24.04
44
- permissions:
45
- contents: read
46
- id-token: write
47
- steps:
48
- - name: Checkout release tag
49
- uses: actions/checkout@v5
50
-
51
- - name: Set up Node.js
52
- uses: actions/setup-node@v5
53
- with:
54
- node-version: 24
55
- registry-url: https://registry.npmjs.org
56
-
57
- - name: Install dependencies
58
- run: npm ci --ignore-scripts
59
-
60
- - name: Publish package
61
- run: npm publish --provenance
62
- env:
63
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,279 +0,0 @@
1
- # Piexis Permission Modes Improvement Plan
2
-
3
- ## Recommended direction
4
-
5
- **Make Piexis similar in permission workflow—not a replica of Claude Code’s security architecture.**
6
-
7
- Focus on:
8
- - Fewer interruptions during ordinary coding.
9
- - Auto decisions grounded in what the user actually requested.
10
- - Clear approval boundaries for consequential actions.
11
- - Consistent behavior between foreground and background agents.
12
- - Understandable denials and permission controls.
13
-
14
- **Exclude containers, OS sandboxing, network proxies, and claims of filesystem/network containment.**
15
-
16
- This plan records the original baseline and proposed work; the comparison and future-tense descriptions below are historical, not a current behavior reference. Phases 1–4 have been implemented. Phase 5 adds documentation alignment, mode-restoration regression coverage, and a labeled offline classifier evaluation harness. Controlled Linux runtime checks now cover real Pi RPC/JSON flows, worker lifecycle, and TUI permission interactions through a pseudo-terminal (`tests/runtime/README.md`). Live-model evaluation, full visual/terminal compatibility, and cross-platform validation remain open. See `README.md` and `eval/README.md` for current behavior and validation limits.
17
-
18
- ## Corrections to the comparison
19
-
20
- The comparison table is useful as inspiration, but not an implementation specification:
21
-
22
- - **Headless denial already exists:** approval-required calls are blocked without permission UI.
23
- - **Deny-and-continue partly exists:** blocked tool calls already receive reasons. Missing pieces are retry limits and better guidance.
24
- - **Sensitive-path checks exist**, but they inspect the requested path—not every file a recursive search or shell command might access.
25
- - **Auto currently ignores all session approvals**, rather than carrying narrow ones forward.
26
- - **Persistent allow/deny rules and trusted-environment configuration do not exist yet.**
27
- - **Workers already exist**, with worktrees and an approval broker, but use a separate permission flow and have no Bash.
28
- - Claude Code also has a `dontAsk` mode; that is not a Piexis-only advantage.
29
- - Exact claims about Claude’s classifier stages and injection screening need current authoritative verification. We should not make those prerequisites.
30
-
31
- ## Phase 1 — Make the existing permission foundation consistent
32
-
33
- **Do this before expanding Auto.**
34
-
35
- ### 1. Extract one permission evaluator
36
-
37
- Move decision-making out of `extensions/mode.ts` into shared library code.
38
-
39
- Inputs should include:
40
- - Mode.
41
- - Tool and validated arguments.
42
- - Actual working directory and workspace boundary.
43
- - User authorization context.
44
- - Applicable approvals.
45
- - Foreground or worker identity.
46
-
47
- Return a structured result: **allow, deny, require approval, or require model review**, with a reason/category.
48
-
49
- The extension should handle UI and lifecycle; the library should decide policy.
50
-
51
- ### 2. Fix path-policy limitations
52
-
53
- In `lib/path-policy.ts`:
54
-
55
- - Resolve relative paths against the **tool’s actual working directory**, then compare against the repository boundary. Currently those two concepts are conflated.
56
- - Check both requested and resolved paths for sensitive locations.
57
- - Distinguish reading credentials from modifying execution/security configuration.
58
- - Cover recursive searches: approving `grep` on the repository root must not imply that every descendant is ordinary.
59
- - Add categories for credentials, Git internals/hooks, and Pi permission/extension configuration.
60
- - Avoid treating every example environment file as a real secret; support narrow, explicit exceptions.
61
-
62
- If recursive filtering requires wrapping built-in tools, do that explicitly rather than claiming the path check already provides it.
63
-
64
- ### 3. Protect policy configuration
65
-
66
- Ordinary edit permissions should not silently authorize changes to the configuration controlling those permissions.
67
-
68
- Repository-provided trust settings must not automatically grant themselves additional authority. Widening permissions needs user confirmation.
69
-
70
- **Deliverable:** one documented decision order and consistent path handling, with regression tests.
71
-
72
- ## Phase 2 — Make Auto genuinely useful for ordinary development
73
-
74
- ### 1. Pre-approve ordinary local edits
75
-
76
- Auto should directly allow:
77
- - Ordinary project-local reads/searches.
78
- - Ordinary project-local `edit` and `write`.
79
- - `AskQuestion`.
80
-
81
- Exceptions remain for sensitive paths, policy/configuration changes, malformed requests, and external targets.
82
-
83
- This is the highest-value usability improvement.
84
-
85
- ### 2. Add user-intent context to the classifier
86
-
87
- Extend `lib/permission-classifier.ts` beyond tool/path/command.
88
-
89
- Include:
90
- - Current user request.
91
- - Relevant earlier user constraints from the active branch.
92
- - Explicit approvals and their scopes.
93
- - Working directory/workspace.
94
- - Proposed action and deterministic risk findings.
95
-
96
- Exclude:
97
- - Assistant explanations and reasoning.
98
- - Raw tool-output history.
99
- - Worker summaries presented as authorization.
100
- - Unnecessary file contents and secrets.
101
-
102
- **Important:** a message with a `user` role is not automatically proof of human authorization. Pi extensions can inject user messages. Preserve provenance where available and treat ambiguous origins conservatively.
103
-
104
- Handle session resume, branching, compaction, and changed instructions without carrying stale authorization forward.
105
-
106
- ### 3. Introduce a small policy taxonomy
107
-
108
- | Category | Proposed Auto behavior |
109
- |---|---|
110
- | Ordinary local development | Allow |
111
- | External filesystem access | Review scope and intent |
112
- | Destructive changes | Require specific authorization; deny ambiguity |
113
- | Credential discovery/exposure | Deny automated exploration |
114
- | Uploads/data egress | Review destination, payload, and intent |
115
- | Production/shared-system changes | Require explicit target and authorization |
116
- | Privilege/security changes | Deny unattended escalation |
117
- | Safeguard bypasses | Require explicit authorization; never infer from “fix it” |
118
- | Download-and-execute or opaque execution | Conservative review/denial |
119
-
120
- Distinguish **using an existing authenticated CLI** from **reading/exporting its credentials**.
121
-
122
- ### 4. Keep one model reviewer initially
123
-
124
- Use:
125
-
126
- **Deterministic checks → model review only when needed.**
127
-
128
- That already provides a fast path. Do not add a second model until evaluation shows a measurable benefit.
129
-
130
- **Deliverable:** Auto feels substantially less intrusive while making better authorization judgments.
131
-
132
- ## Phase 3 — Improve Bash decisions and permission UX
133
-
134
- ### Bash analysis
135
-
136
- Add a bounded shell analyzer that identifies:
137
- - Command chains and pipelines.
138
- - Redirections.
139
- - Command substitutions.
140
- - Working-directory changes.
141
- - Environment assignments and wrappers.
142
- - Interpreter/script execution.
143
- - Destructive Git operations.
144
- - Uploads, deployments, and safeguard-bypass flags.
145
-
146
- Use parsing, not only regular expressions. Unsupported syntax should lead to review—not automatic approval.
147
-
148
- **Do not equate `npm test`, `make`, or `python script.py` with safety.** Those execute project-controlled code. A command’s name is not its complete effect.
149
-
150
- Initially, allow only a small, carefully tested set of simple read-only commands without review. Everything else retains approval/classification.
151
-
152
- ### Scoped approvals
153
-
154
- Add:
155
- - Exact command + working-directory grants.
156
- - File/directory grants scoped to operation.
157
- - Narrow command/subcommand rules.
158
- - A user-facing `/permissions` command to inspect and revoke grants.
159
-
160
- For Auto:
161
- - Honor eligible narrow approvals after non-overridable checks.
162
- - Ignore whole-Bash and blanket interpreter/executable grants.
163
- - Do not reuse an execution approval blindly after the relevant script or policy changes.
164
-
165
- Persistent rules can follow later; start with session rules to limit complexity.
166
-
167
- ### Denial behavior
168
-
169
- Provide concise reasons and a legitimate next step:
170
- - Use a narrower action.
171
- - Request clarification.
172
- - Wait for explicit authorization.
173
-
174
- Do not suggest switching tools to achieve the same denied effect.
175
-
176
- Add configurable repeated-denial limits. Stop the agent’s run when it is stuck; do not automatically switch modes or broaden permissions. Headless runs should report a clear blocked outcome without waiting for dialogs.
177
-
178
- **Deliverable:** fewer confusing prompts and no endless denial loops.
179
-
180
- ## Phase 4 — Bring background tasks into the same permission system
181
-
182
- Update `extensions/background-tasks.ts` and `extensions/background-worker.ts`.
183
-
184
- ### 1. Recognize task tools individually
185
-
186
- Auto should understand:
187
- - Status and cancellation.
188
- - Diff inspection.
189
- - Task creation.
190
- - Applying changes.
191
- - Destructive cleanup.
192
-
193
- Do not allow every custom tool simply because it exists.
194
-
195
- Note that `task_diff` currently runs `git add -N` for untracked files: it needs adjustment before being treated as genuinely read-only.
196
-
197
- ### 2. Give workers bounded delegated authority
198
-
199
- Worker authorization should be the intersection of:
200
- - The user’s authorized task.
201
- - Parent permission policy.
202
- - The worker’s delegated scope.
203
-
204
- An assistant-written task brief must not expand user authorization.
205
-
206
- Use the existing parent broker to evaluate worker actions through the shared policy. Handle mode changes, cancellation, session replacement, and broker failure explicitly.
207
-
208
- ### 3. Add worker Bash only as an opt-in
209
-
210
- Workers can then test/build/debug through the same approval/classifier pipeline.
211
-
212
- But call this **permission-controlled command execution**, not sandboxed execution. Worktrees isolate Git changes, not host access.
213
-
214
- Keep:
215
- - No recursive delegation initially.
216
- - Explicit approval before applying patches.
217
- - Validated, confirmed cleanup.
218
-
219
- ### 4. Review returned changes, not just worker prose
220
-
221
- Treat worker output as untrusted task data. Inspect the actual patch for sensitive/configuration changes before applying it. Record what verification actually ran.
222
-
223
- **Deliverable:** useful workers without building a new orchestration or sandbox platform.
224
-
225
- ## Phase 5 — Polish, documentation, and evaluation
226
-
227
- Preserve the six modes:
228
-
229
- | Mode | Target behavior |
230
- |---|---|
231
- | Manual | Safe operations directly; approval otherwise |
232
- | Accept Edits | Also allow ordinary local edits |
233
- | Plan | Read-only exploration; no implicit transition to execution |
234
- | Auto | Local coding directly; consequential actions reviewed against intent |
235
- | Don’t Ask | Only pre-approved actions; no permission dialogs |
236
- | Bypass | Skip Piexis permission checks, with clear warnings |
237
-
238
- Keep mode changes user-controlled and idle-only.
239
-
240
- Add tests covering:
241
- - Nested working directories, symlinks, and recursive searches.
242
- - Local edits versus sensitive/configuration edits.
243
- - Shell chains, wrappers, scripts, and uploads.
244
- - Intent changes, branching, and injected messages.
245
- - Classifier timeout, cancellation, malformed responses, and unavailable models.
246
- - Approval revocation and unsafe broad grants.
247
- - Worker/foreground consistency.
248
- - Headless denial limits.
249
-
250
- Run `npm run check` and relevant tests during implementation. Build a labeled classifier evaluation set as well: mocked unit tests alone cannot measure model decision quality.
251
-
252
- ## Deliberately deferred
253
-
254
- - OS/container/network sandboxing.
255
- - Network allowlisting presented as enforcement.
256
- - Full shell/program semantic analysis.
257
- - Two-model classification.
258
- - A generic prompt-injection detector marketed as protection.
259
- - Automatic acceptance of worker changes.
260
- - Broad domain/org trust configuration before concrete use cases exist.
261
-
262
- For injection resistance, prioritize provenance and keeping tool/worker text out of authorization decisions. Optional screening can come later.
263
-
264
- ## Recommended first release
265
-
266
- **Ship Phases 1–3 first.** They provide the biggest Claude-like improvement without ballooning the project. Integrate workers afterward.
267
-
268
- ## Three decisions before implementation
269
-
270
- These recommendations are pending user confirmation.
271
-
272
- 1. **Auto escalation:** should uncertain/high-impact actions remain denied, or may Auto ask for explicit one-time approval?
273
- **Recommendation:** deny the action first; allow a clear user-controlled approval path in interactive sessions.
274
-
275
- 2. **Classifier privacy:** are you comfortable sending relevant user requests to the configured classifier provider?
276
- **Recommendation:** yes, with bounded context, clear disclosure, and no raw tool history.
277
-
278
- 3. **Worker Bash:** should workers eventually run tests/builds without containment?
279
- **Recommendation:** opt-in only, after the shared permission pipeline is implemented.
package/WHAT_YOU_GET.md DELETED
@@ -1,153 +0,0 @@
1
- # What you get with Piexis
2
-
3
- Piexis (`@preapexis/piexis`) is a package for the **Pi coding agent**, not a standalone application. It adds control over agent actions, background coding tasks, reusable workflows, and a compact terminal interface.
4
-
5
- Installing the full package makes these resources available:
6
-
7
- | Included | What it gives you |
8
- | --- | --- |
9
- | **5 extensions** | Permission modes, interactive questions, background tasks, file discovery, and a custom terminal UI. |
10
- | **18 skills** | Task-specific guidance for coding, debugging, reviews, architecture, integrations, and document work. |
11
- | **3 prompt templates** | `/init`, `/commit`, and `/summary`. |
12
- | **1 theme** | An optional warm, dark `orange` theme. |
13
-
14
- ## Permission controls you choose
15
-
16
- A new session starts in **Manual** mode unless you select a launch mode or restore a saved session mode. Use **Alt+M** while the agent is idle to cycle through Manual → Accept Edits → Plan → Auto. Auto is skipped when no authenticated classifier is configured.
17
-
18
- | Mode | What to expect |
19
- | --- | --- |
20
- | **Manual** (`default`) | Ordinary project-local reads and searches are pre-approved. Edits, most Bash commands, and external or sensitive paths require approval. |
21
- | **Accept Edits** (`acceptEdits`) | Also pre-approves ordinary project-local `edit` and `write` calls. Most Bash commands and external or sensitive paths still require approval. |
22
- | **Plan** (`plan`) | Read-only exploration and task status/diff inspection/cancellation. Blocks Bash, file changes, task creation/apply/cleanup, and external or sensitive path-tool reads. |
23
- | **Auto** (`auto`) | Allows ordinary project-local reads and edits, rejects sensitive or unsupported actions, and reviews consequential supported actions against verified user intent. Failed or invalid reviews deny the action. |
24
- | **Don't Ask** (`dontAsk`) | Allows pre-approved reads/questions, task inspection/cancellation, and tiny harmless Bash builtins; denies other calls without prompting. Launch-only. |
25
- | **Bypass Permissions** (`bypassPermissions`) | Skips Piexis permission checks. Launch-only; it does not override OS permissions or other extensions. |
26
-
27
- Start planning with `/plan <task>`. To select a mode at launch, use `pi --permission-mode <mode>`.
28
-
29
- Approval dialogs let you **allow once**, deny, or approve a narrower session scope: a file, directory, ordinary project files for one tool, an eligible exact Git status command, or its narrow query family, bound to the directory and configuration. A clearly labelled whole-tool session approval is also available. Session approvals stay in memory; they are not saved for future sessions. Actions requiring approval are denied when permission UI is unavailable.
30
-
31
- **These controls are not a sandbox.** They do not provide OS containment, filesystem isolation, or network restrictions. Use an appropriate container, VM, or restricted account for untrusted or unattended work.
32
-
33
- ### Optional Auto setup
34
-
35
- Run `/piexis-init` to create missing `.pi/settings.json` and `.pi/permission-modes.json` without overwriting existing files. When an authenticated text model is available, initialization selects one for the classifier and background tasks. Simply launching Piexis does not create project configuration.
36
-
37
- You can change the classifier in `permission-modes.json` or override it with `PI_PERMISSION_CLASSIFIER=provider/model`. Pi's existing authentication is reused; no credentials are stored in this configuration.
38
-
39
- Auto reviews make additional model requests. The classifier receives action details, bounded verified user requests/constraints, and eligible narrow approval scopes. Delegation reviews also include the proposed task brief as untrusted action data. File contents, replacement text, raw tool history, and worker result summaries are excluded. These selected inputs can still contain sensitive information. See [the README](README.md#auto-review-policy-and-privacy) for limits and disclosure details.
40
-
41
- ## Background tasks without mixing edits into your checkout
42
-
43
- Use `/task <work>` to delegate a task to another Pi process. Use task commands to inspect progress; a new ordinary user prompt revokes outstanding worker authorization and cancels active/queued tasks. Up to **two workers** run concurrently; additional tasks queue.
44
-
45
- Each worker starts from committed **HEAD** in a separate Git worktree. It receives your task description and any supplied task brief, not the full foreground conversation or your uncommitted changes. Include relevant files, constraints, and acceptance criteria in the task.
46
-
47
- | Command | Purpose |
48
- | --- | --- |
49
- | `/task <work>` | Start a background task. |
50
- | `/task status` | List tasks and their states. |
51
- | `/task review <id>` | Read the worker's result. |
52
- | `/task diff <id>` | Inspect its actual file changes. |
53
- | `/task cancel <id>` | Cancel queued or running work. |
54
- | `/task apply <id>` | Apply a completed task's diff after confirmation. |
55
- | `/task clean <id>` | Remove a validated task worktree after confirmation; refuses completed, unapplied work. |
56
- | `/task interrupted` | Find interrupted tasks whose saved work needs inspection. |
57
-
58
- The agent also gets `background_task`, `task_status`, `task_diff`, `task_cancel`, `task_apply`, and `task_clean` tools, subject to the active permission policy. Each task tool has its own policy. Auto reviews creation and worker mutations against user intent; apply/cleanup always require explicit confirmation. Plan blocks creation, application, and cleanup.
59
-
60
- **Important limits:**
61
-
62
- - Git and a repository with a commit are required. Worktrees separate Git changes, **not host filesystem access**.
63
- - Workers have bounded read/search and edit/write capabilities. Launch with `--background-bash` to opt into permission-controlled command execution, not sandboxing; Bash requires whole-worktree scope.
64
- - Every worker call uses the parent permission broker; foreground grants are not inherited. Auto reviews worker mutations; Manual prompts for non-pre-approved actions. Missing, denied, or expired authorization blocks the action.
65
- - Workers do not load your usual skills, prompt templates, or context files. Put essential project guidance in the task brief.
66
- - Background models use Pi authentication and incur their own model usage. They default to the active model when no background model list is configured; a nonempty `background.models` list restricts model selection; an absent or empty list falls back to the active parent model.
67
- - Results are not automatically applied or committed. Diff inspection uses temporary Git storage, without staging into the real index. Sensitive/configuration patch bodies are withheld. Apply checks actual paths and reconfirms patch identity; verification observations come from executed tools, not worker claims. Verify again in your checkout.
68
- - Task metadata and results are saved under Pi's user agent directory. Interrupted worktrees can be inspected or cleaned, but dead worker processes cannot resume.
69
-
70
- ## Better questions and file discovery
71
-
72
- - **`AskQuestion`** lets the agent pause for structured clarification: single-choice, multiple-choice, or free-form answers. Questions are asked sequentially, and you can cancel. It remains permitted in every permission mode but requires the interactive terminal UI.
73
- - **`glob`** finds files by patterns such as `src/**/*.ts`, respects `.gitignore`, and returns paths relative to the search directory. It wraps Pi's file-finding tool under a familiar name.
74
-
75
- ## 18 task-focused skills
76
-
77
- Skills are instructions, references, and—in some cases—helper scripts, not always-running agents. Pi advertises their descriptions and loads the detailed guidance when relevant. You can explicitly select one with `/skill:<name> <request>`.
78
-
79
- ### Coding and engineering
80
-
81
- | Skill | Use it for |
82
- | --- | --- |
83
- | `lean-build` | Implementing a focused feature or ticket with clear scope and acceptance criteria. |
84
- | `diagnosing-bugs` | Investigating failures and regressions, then making a narrow fix with evidence. |
85
- | `tdd` | Test-first work using a red–green–refactor workflow. |
86
- | `safe-refactor` | Restructuring code while preserving behavior. |
87
- | `migration` | Compatibility-safe schema, data, API, configuration, or dependency transitions. |
88
- | `code-review` | Reviewing diffs, branches, pull requests, or repositories for actionable issues. |
89
- | `verify-and-stop` | Checking completed work against acceptance conditions without expanding scope. |
90
- | `codebase-design` | Designing or auditing architecture, interfaces, ownership, and module boundaries. |
91
- | `grilling` | Clarifying requirements, pressure-testing plans, and turning ideas into specifications. |
92
- | `writing-for-agents` | Writing useful skills, `AGENTS.md`, and other agent instructions. |
93
-
94
- ### Interfaces and integrations
95
-
96
- | Skill | Use it for |
97
- | --- | --- |
98
- | `frontend-design` | Product web interfaces, visual hierarchy, responsive behavior, and accessibility. |
99
- | `webapp-testing` | Testing local web apps with Playwright, screenshots, and browser logs. |
100
- | `mcp-builder` | Building MCP servers in Python or TypeScript to expose external services as tools. |
101
- | `claude-api` | Anthropic API and SDK integrations, streaming, tools, agents, and troubleshooting. |
102
-
103
- ### Documents and data
104
-
105
- | Skill | Use it for |
106
- | --- | --- |
107
- | `docx` | Creating, reading, and editing Word documents and templates. |
108
- | `pdf` | PDF extraction, creation, merging, splitting, OCR, and forms. |
109
- | `pptx` | Creating and editing presentations, slides, and templates. |
110
- | `xlsx` | Spreadsheets, formulas, formatting, charts, and tabular-data cleanup. |
111
-
112
- Document and browser workflows may require additional software such as Python packages, Playwright browsers, or LibreOffice. Installing Piexis does **not** provision every skill's external dependencies. Skills also do not bypass permission checks.
113
-
114
- ## Three reusable prompts
115
-
116
- | Prompt | What it asks the agent to do |
117
- | --- | --- |
118
- | `/init [focus or constraints]` | Inspect the repository and create or improve concise, evidence-backed `AGENTS.md` guidance. |
119
- | `/commit` | Review Git changes and return a concise commit message. **It does not create a Git commit.** |
120
- | `/summary` | Summarize completed work, decisions, open items, next steps, and the user-message count. |
121
-
122
- `/init` writes agent guidance; `/piexis-init` initializes Piexis configuration. They are different commands. Prompt templates guide the model and remain subject to your current permission mode.
123
-
124
- ## A compact terminal workspace
125
-
126
- The UI extension adds a Piexis startup header, a project-specific terminal title, and a compact footer showing activity, permission mode, Git branch, model, and context usage.
127
-
128
- The bundled **`orange`** theme provides warm accents on dark backgrounds. Select it through **`/settings` → Theme**; installation makes it available but does not automatically change your chosen theme.
129
-
130
- ## Install and try it
131
-
132
- Use a current Pi release; the project README records local runtime checks with Pi **0.85.1 and 0.87.1 on Linux**. The package declares **Node.js 22.19+**; also satisfy your installed Pi version's requirements.
133
-
134
- From a local checkout:
135
-
136
- ```sh
137
- npm ci --ignore-scripts
138
- pi install /absolute/path/to/piexis
139
- ```
140
-
141
- Restart Pi or run `/reload`. Installing the package loads its declared resources; loading only `extensions/mode.ts` does not give you the rest of the bundle.
142
-
143
- Try these in Pi:
144
-
145
- ```text
146
- /plan Explain the authentication flow and propose improvements
147
- /skill:code-review Review the current changes
148
- /summary
149
- ```
150
-
151
- Use **Alt+M** when idle to leave Plan before requesting edits.
152
-
153
- **Keep only what you want:** run `pi config` (or `pi config --local`) to enable or disable package resources. You can keep permission controls without the custom UI, or keep coding skills without document workflows. See [the README](README.md#select-package-resources) for resource-filtering examples and configuration details.