@preapexis/pi-kit 1.2.1 → 1.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.
package/AGENTS.md CHANGED
@@ -1,20 +1,111 @@
1
- # AGENTS.md
1
+ # Agent Guidelines: preapexis-pi-kit
2
+
3
+ ## Project Summary
4
+
5
+ `preapexis-pi-kit` is a personal Pi coding-agent package that bundles TypeScript extensions, prompt templates, reusable skills, and UI themes for the [Pi Agent Harness](https://github.com/earendil-works/pi). It adds safety guards, status displays, prompt workflows, and custom branding to AI-assisted coding sessions.
6
+
7
+ Published to npm as `@preapexis/pi-kit`.
8
+
9
+ ## Tech Stack
10
+
11
+ - **Language:** TypeScript (ES2022, NodeNext module resolution)
12
+ - **Runtime:** Node.js
13
+ - **Test runner:** Vitest
14
+ - **Package manager:** npm
15
+ - **Peer dependency:** `@earendil-works/pi-coding-agent`
16
+
17
+ ## Project Map
18
+
19
+ | Path | Purpose |
20
+ | ------------------ | --------------------------------------------------------------------------------------------------------- |
21
+ | `AGENTS.md` | Core rules and guidance for agents working in this repository. Read this first before any edit. |
22
+ | `README.md` | Public documentation, installation instructions, and usage guide. |
23
+ | `package.json` | Pi package manifest. Declares `pi.extensions`, `pi.prompts`, `pi.skills`, and `pi.themes`. |
24
+ | `CHANGELOG.md` | Version history and release notes. |
25
+ | `LICENSE` | ISC license. |
26
+ | `settings.json` | Local Pi settings (`theme`, `defaultProjectTrust`). Not published as part of the package manifest. |
27
+ | `tsconfig.json` | TypeScript configuration covering `extensions/**/*.ts`, `tests/**/*.ts`, and `vitest.config.ts`. |
28
+ | `vitest.config.ts` | Vitest test runner configuration (Node environment, globals enabled). |
29
+ | `extensions/` | TypeScript Pi extensions. Each file exports a default function receiving `ExtensionAPI`. |
30
+ | `prompts/` | Markdown prompt templates. The filename (without `.md`) becomes a slash command. |
31
+ | `skills/` | Reusable skills. Each skill lives in its own subfolder containing a `SKILL.md` with frontmatter. |
32
+ | `themes/` | JSON theme files for Pi UI. Each file must have `name`, `vars`, `colors`, and `$schema`. |
33
+ | `tests/` | Vitest test suite validating package structure, extension syntax, prompt conventions, skills, and themes. |
34
+ | `scripts/` | Development helper scripts. Currently contains `git-release.mjs`. |
35
+ | `docs/` | Project documentation. `docs/plans/` is the target directory for `/save-plan`. |
36
+
37
+ ## Common Task Map
38
+
39
+ | Task | Read These Files First |
40
+ | --------------------------- | --------------------------------------------------------------------------------------------- |
41
+ | Change branding/UI | `extensions/brand-ui.ts`, `themes/` |
42
+ | Change update behavior | `extensions/update.ts` |
43
+ | Change safety behavior | `extensions/safety.ts`, `extensions/git-guard.ts`, `extensions/workspace-guard.ts` |
44
+ | Change footer/status | `extensions/status.ts`, `extensions/usage-tracker.ts` |
45
+ | Change prompt workflows | `extensions/prompts.ts`, `prompts/` |
46
+ | Change sound cues | `extensions/sound-cues.ts` |
47
+ | Change workspace boundaries | `extensions/workspace-guard.ts` |
48
+ | Add a new extension | `AGENTS.md` (Extension Rules), `tests/extensions.test.ts`, then create `extensions/<name>.ts` |
49
+ | Add a new prompt | `AGENTS.md` (Prompt Rules), `tests/prompts.test.ts`, then create `prompts/<name>.md` |
50
+ | Add a new skill | `AGENTS.md` (Skill Rules), `tests/skills.test.ts`, then create `skills/<name>/SKILL.md` |
51
+ | Add a new theme | `tests/themes.test.ts`, then create `themes/<name>.json` |
52
+ | Release a new version | `scripts/git-release.mjs`, `package.json`, `CHANGELOG.md`, `.github/workflows/publish.yml` |
53
+
54
+ ## Development Commands
55
+
56
+ | Command | Purpose |
57
+ | -------------------- | ------------------------------------------------------------------------------ |
58
+ | `npm test` | Run the full Vitest test suite (structure, syntax, and validation tests). |
59
+ | `npm run test:watch` | Run Vitest in watch mode. |
60
+ | `npm run git` | Run the interactive git-release script (bumps version, commits, tags, pushes). |
61
+ | `pi install -l .` | Install this package locally into Pi for development testing. |
62
+ | `/reload` | Reload Pi after installing, updating, or changing extensions. |
63
+
64
+ ## Coding Conventions
65
+
66
+ - **Language:** TypeScript with strict mode enabled.
67
+ - **Module system:** ES modules (`"type": "module"`), NodeNext resolution.
68
+ - **Extension pattern:** Each extension exports a default function receiving `ExtensionAPI`.
69
+ - **Naming:** Use clear, explicit names. Prefer `kebab-case` for filenames.
70
+ - **Error handling:** Extensions use `ctx.hasUI` checks before UI operations; fall back to `console.log` or blocking when UI is unavailable.
71
+ - **Testing:** Tests are in `tests/` using Vitest. Tests validate structural constraints (default exports, frontmatter, valid JSON) rather than deep behavioral logic.
72
+ - **Dependencies:** Do not add dependencies unless explicitly approved. The package has no runtime dependencies; only `typescript` and `vitest` as devDependencies.
73
+ - **Comments:** Avoid comments that only repeat the code. Use JSDoc for extension-level documentation.
2
74
 
3
- Guidance for AI agents working in this repository.
75
+ ## Safety Rules
76
+
77
+ Agents must avoid:
78
+
79
+ - reading or editing `.env` files
80
+ - editing `.git`
81
+ - editing `node_modules`
82
+ - editing build output such as `dist`, `build`, `out`, or `coverage`
83
+ - changing lockfiles unless the user approves
84
+ - running package install/remove commands unless the user approves
85
+ - running destructive Git commands (`git push --force`, `git reset --hard`, `git clean -fd`)
86
+ - running destructive shell commands
87
+ - running commands that leave the workspace without approval
4
88
 
5
- ## Project
89
+ Before risky edits, check whether the repo is dirty. Avoid overwriting user work.
6
90
 
7
- This repository is `preapexis-pi-kit`, a personal Pi coding-agent package.
91
+ The `scripts/git-release.mjs` script performs `git push` and may create tags; review its behavior before running in a dirty worktree.
8
92
 
9
- It contains:
93
+ ## Architecture Notes
10
94
 
11
- - `extensions/` TypeScript Pi extensions.
12
- - `prompts/` prompt templates that become slash commands.
13
- - `skills/` reusable skills, each in its own folder with a `SKILL.md`.
14
- - `themes/` Pi UI themes.
15
- - `package.json` declares this repository as a Pi package.
95
+ - **Extension API:** All extensions consume `@earendil-works/pi-coding-agent`'s `ExtensionAPI`. They hook into lifecycle events (`session_start`, `before_agent_start`, `tool_call`, `agent_end`) and register slash commands.
96
+ - **System prompt injection:** `safety.ts`, `workspace-guard.ts`, and potentially other extensions append rules to the agent system prompt via `before_agent_start`.
97
+ - **UI availability:** Extensions must check `ctx.hasUI` before calling `ctx.ui.notify`, `ctx.ui.confirm`, `ctx.ui.select`, or `ctx.ui.setStatus`.
98
+ - **Workspace boundary:** `workspace-guard.ts` locks the workspace root at `session_start` and blocks tool calls targeting outside paths.
99
+ - **Git checkpointing:** `git-guard.ts` creates `pi-checkpoint-<branch>-<timestamp>` branches before risky edits when the working tree is dirty.
100
+ - **Separation of concerns:**
101
+ - Git branch display belongs in `git-guard.ts`.
102
+ - Model, mode, repo trust, and test status belong in `status.ts`.
103
+ - Risky non-Git shell command protection belongs in `safety.ts`.
104
+ - Prompt menu belongs in `prompts.ts`.
16
105
 
17
- ## Core Rules
106
+ ## Agent Rules
107
+
108
+ ### Core Rules
18
109
 
19
110
  - Keep changes small, focused, and reviewable.
20
111
  - Read existing files before editing them.
@@ -25,7 +116,7 @@ It contains:
25
116
  - Do not rewrite Git history.
26
117
  - Do not edit secrets, `.env` files, `.git`, build output, or generated files.
27
118
 
28
- ## Package Structure Rules
119
+ ### Package Structure Rules
29
120
 
30
121
  The Pi package should continue to use this structure:
31
122
 
@@ -57,9 +148,7 @@ skills/
57
148
 
58
149
  Do not place skill files directly inside `skills/` unless Pi explicitly supports that format.
59
150
 
60
- ## Extension Rules
61
-
62
- Extensions are TypeScript files in `extensions/`.
151
+ ### Extension Rules
63
152
 
64
153
  Current expected extensions:
65
154
 
@@ -69,20 +158,13 @@ Current expected extensions:
69
158
  - `prompts.ts` — `/prompts` menu.
70
159
  - `brand-ui.ts` — custom UI branding.
71
160
 
72
- Avoid duplicate responsibilities:
73
-
74
- - Git branch display belongs in `git-guard.ts`.
75
- - Model, mode, repo trust, and test status belong in `status.ts`.
76
- - Risky non-Git shell command protection belongs in `safety.ts`.
77
- - Prompt menu belongs in `prompts.ts`.
161
+ Avoid duplicate responsibilities (see Architecture Notes).
78
162
 
79
163
  Do not reintroduce duplicate `/plan`, `/commit`, `/security`, or similar commands in extensions if matching prompt files already exist.
80
164
 
81
- ## Prompt Rules
165
+ ### Prompt Rules
82
166
 
83
- Prompt files live in `prompts/`.
84
-
85
- The filename becomes the slash command.
167
+ Prompt files live in `prompts/`. The filename becomes the slash command.
86
168
 
87
169
  Examples:
88
170
 
@@ -112,7 +194,7 @@ Prompt behavior rules:
112
194
  - Save-plan prompt should save plans under `docs/plans/`.
113
195
  - Do not edit `AGENTS.md` from a prompt unless the user approves.
114
196
 
115
- ## Skill Rules
197
+ ### Skill Rules
116
198
 
117
199
  Skill files must start with valid frontmatter:
118
200
 
@@ -127,31 +209,7 @@ Do not add an extra `---` after the frontmatter.
127
209
 
128
210
  Keep skills focused and reusable.
129
211
 
130
- Good skill categories for this repo:
131
-
132
- - safe coding
133
- - frontend onboarding
134
- - frontend quality review
135
- - component implementation
136
-
137
- ## Safety Rules
138
-
139
- Agents must avoid:
140
-
141
- - reading or editing `.env` files
142
- - editing `.git`
143
- - editing `node_modules`
144
- - editing build output such as `dist`, `build`, `out`, or `coverage`
145
- - changing lockfiles unless the user approves
146
- - running package install/remove commands unless the user approves
147
- - running destructive Git commands
148
- - running destructive shell commands
149
-
150
- If a task is unclear, ask questions before editing.
151
-
152
- Ask only important questions. If the task is clear, continue.
153
-
154
- ## Verification
212
+ ### Verification
155
213
 
156
214
  When code changes are made, run the narrowest relevant check if available:
157
215
 
@@ -164,25 +222,7 @@ If checks cannot be run, explain why.
164
222
 
165
223
  Do not claim tests passed unless they were actually run.
166
224
 
167
- ## Git Rules
168
-
169
- Before risky edits, check whether the repo is dirty.
170
-
171
- Dirty means there are uncommitted changes.
172
-
173
- Avoid overwriting user work.
174
-
175
- Do not run:
176
-
177
- ```bash
178
- git push --force
179
- git reset --hard
180
- git clean -fd
181
- ```
182
-
183
- unless the user explicitly approves and the safety extension allows it.
184
-
185
- ## README Rules
225
+ ### README Rules
186
226
 
187
227
  Keep `README.md` aligned with the actual files.
188
228
 
@@ -190,10 +230,38 @@ If an extension, prompt, skill, or theme is renamed, update the README.
190
230
 
191
231
  Avoid mentioning removed files such as `team.ts` or old names such as `workflow.ts` if they no longer exist.
192
232
 
193
- ## Style
233
+ ### Style
194
234
 
195
235
  - Use clear, simple language.
196
236
  - Prefer plain Markdown.
197
237
  - Avoid unnecessary complexity.
198
238
  - Avoid adding comments that only repeat the code.
199
239
  - Prefer explicit names over clever names.
240
+
241
+ ### Clarification
242
+
243
+ If a task is unclear, ask questions before editing.
244
+
245
+ Ask only important questions. If the task is clear, continue.
246
+
247
+ Do not edit files until the user answers clarification questions.
248
+
249
+ ## Open Questions
250
+
251
+ None.
252
+
253
+ ## Inspection Notes
254
+
255
+ All important files were inspected:
256
+
257
+ - Root files: `package.json`, `README.md`, `CHANGELOG.md`, `LICENSE`, `settings.json`, `tsconfig.json`, `vitest.config.ts`, `.gitignore`
258
+ - Extensions: all 9 files in `extensions/`
259
+ - Prompts: all 8 files in `prompts/`
260
+ - Skills: all 4 `SKILL.md` files
261
+ - Themes: all 4 JSON files
262
+ - Tests: all 6 test files plus `tests/helpers.ts`
263
+ - Scripts: `scripts/git-release.mjs`
264
+ - CI/CD: `.github/workflows/publish.yml`
265
+ - Editor configs: `.vscode/settings.json`, `.pi/settings.json`
266
+
267
+ Not inspected in detail: individual theme JSON internals (only structure was validated via tests), and the full `node_modules/` tree (not relevant).
@@ -0,0 +1,228 @@
1
+ # Project Map
2
+
3
+ ## Purpose
4
+
5
+ `preapexis-pi-kit` is a personal Pi coding-agent package that bundles TypeScript extensions, prompt templates, reusable skills, and UI themes for the [Pi Agent Harness](https://github.com/earendil-works/pi). It adds safety guards, status displays, prompt workflows, and custom branding to AI-assisted coding sessions.
6
+
7
+ ## Important Files
8
+
9
+ | File | Purpose |
10
+ |------|---------|
11
+ | `AGENTS.md` | Core rules and guidance for agents working in this repository. Read this first before any edit. |
12
+ | `README.md` | Public documentation, installation instructions, and usage guide. |
13
+ | `package.json` | Pi package manifest. Declares `pi.extensions`, `pi.prompts`, `pi.skills`, and `pi.themes`. Also defines npm scripts and dev dependencies. |
14
+ | `CHANGELOG.md` | Version history and release notes. |
15
+ | `LICENSE` | ISC license. |
16
+ | `settings.json` | Local Pi settings (`theme`, `defaultProjectTrust`). Not published as part of the package manifest. |
17
+ | `tsconfig.json` | TypeScript configuration covering `extensions/**/*.ts`, `tests/**/*.ts`, and `vitest.config.ts`. |
18
+ | `vitest.config.ts` | Vitest test runner configuration (Node environment, globals enabled). |
19
+ | `.gitignore` | Git ignore rules. |
20
+
21
+ ## Directory Map
22
+
23
+ | Directory | Purpose |
24
+ |-----------|---------|
25
+ | `extensions/` | TypeScript Pi extensions. Each file exports a default function receiving `ExtensionAPI`. |
26
+ | `prompts/` | Markdown prompt templates. The filename (without `.md`) becomes a slash command. |
27
+ | `skills/` | Reusable skills. Each skill lives in its own subfolder containing a `SKILL.md` with frontmatter. |
28
+ | `themes/` | JSON theme files for Pi UI. Each file must have `name`, `vars`, `colors`, and `$schema`. |
29
+ | `tests/` | Vitest test suite validating package structure, extension syntax, prompt conventions, skills, and themes. |
30
+ | `scripts/` | Development helper scripts. |
31
+ | `docs/` | Project documentation. Currently contains this map. `docs/plans/` is the target directory for `/save-plan`. |
32
+
33
+ ## Extension Map
34
+
35
+ ### `extensions/brand-ui.ts`
36
+ - **Slash commands:** none
37
+ - **UI/status changes:** Custom PreApeXis terminal branding and visual UI customization.
38
+ - **Safety behavior:** none
39
+ - **When to edit:** Changing branding, colors, or terminal UI styling.
40
+
41
+ ### `extensions/git-guard.ts`
42
+ - **Slash commands:** none
43
+ - **UI/status changes:** May show dirty-worktree warnings and checkpoint-branch notifications.
44
+ - **Safety behavior:** Warns on dirty Git worktrees; blocks `git push --force`; confirms `git reset --hard`; creates checkpoint branches before risky edits.
45
+ - **When to edit:** Changing Git-specific safety behavior or checkpoint logic.
46
+
47
+ ### `extensions/prompts.ts`
48
+ - **Slash commands:** `/prompts`
49
+ - **UI/status changes:** Displays a menu listing available prompt workflows.
50
+ - **Safety behavior:** none
51
+ - **When to edit:** Adding or removing prompt workflows, or changing how the menu is rendered.
52
+
53
+ ### `extensions/safety.ts`
54
+ - **Slash commands:** none
55
+ - **UI/status changes:** none
56
+ - **Safety behavior:** Blocks risky shell commands; prevents reading/editing `.env` files; blocks edits to `node_modules`, build output, `.git` internals, and generated files; requires confirmation for package install/remove commands; injects safety and clarification rules into the agent system prompt.
57
+ - **When to edit:** Changing general (non-Git) safety rules or protected path lists.
58
+
59
+ ### `extensions/sound-cues.ts`
60
+ - **Slash commands:** `/sound-on`, `/sound-off`, `/sound-test`
61
+ - **UI/status changes:** none
62
+ - **Safety behavior:** none
63
+ - **When to edit:** Changing sound cue triggers or audio behavior.
64
+
65
+ ### `extensions/status.ts`
66
+ - **Slash commands:** `/test-pass`, `/test-fail`, `/test-none`
67
+ - **UI/status changes:** Shows compact kit status in the footer (e.g., `kit: safe · trusted · tests:none`).
68
+ - **Safety behavior:** none
69
+ - **When to edit:** Changing footer display format or status indicators.
70
+
71
+ ### `extensions/update.ts`
72
+ - **Slash commands:** `/update`
73
+ - **UI/status changes:** Displays an update menu for Pi, this kit, or project packages.
74
+ - **Safety behavior:** none
75
+ - **When to edit:** Changing update behavior or menu options.
76
+
77
+ ### `extensions/usage-tracker.ts`
78
+ - **Slash commands:** `/usage`, `/usage-reset`
79
+ - **UI/status changes:** May display session token usage and estimated cost.
80
+ - **Safety behavior:** none
81
+ - **When to edit:** Changing usage tracking logic or cost estimation.
82
+
83
+ ### `extensions/workspace-guard.ts`
84
+ - **Slash commands:** `/workspace-root`
85
+ - **UI/status changes:** Sets status indicator `workspace: locked` on session start.
86
+ - **Safety behavior:** Blocks file operations (`read`, `write`, `edit`, `ls`, `grep`, `find`) and `bash` commands that target paths outside the workspace root; injects workspace-boundary rules into the agent system prompt.
87
+ - **When to edit:** Changing workspace boundary behavior or outside-access confirmation logic.
88
+
89
+ ## Prompt Map
90
+
91
+ | Slash command | File path | Purpose | When to use it |
92
+ |---------------|-----------|---------|----------------|
93
+ | `/commit` | `prompts/commit.md` | Suggests a conventional commit message from current Git changes. Does not commit automatically. | After making changes and before committing. |
94
+ | `/implement` | `prompts/implement.md` | Implements a saved or pasted plan. May edit files. Should follow the plan closely and ask if unclear. | After `/plan` and `/save-plan` (or when a plan is provided). |
95
+ | `/init` | `prompts/init.md` | Inspects a repository and creates an onboarding report. Read-only. | When opening a new repo or unfamiliar feature area. |
96
+ | `/plan` | `prompts/plan.md` | Creates a read-only implementation plan with batches, model choice, effort guidance, and risk level. | Before starting implementation work. |
97
+ | `/repo-map` | `prompts/repo-map.md` | Creates or updates `docs/PROJECT_MAP.md`. Read-only for source files. | When the project structure has changed or a map is missing. |
98
+ | `/review-safe` | `prompts/review-safe.md` | Runs a read-only project review. | When wanting a general code or project review. |
99
+ | `/save-plan` | `prompts/save-plan.md` | Saves a generated plan as a markdown file under `docs/plans/`. | After `/plan` to persist the plan. |
100
+ | `/security` | `prompts/security.md` | Runs a read-only security review. | When reviewing for security issues. |
101
+
102
+ ## Skill Map
103
+
104
+ | Skill name | File path | Purpose | When it should activate |
105
+ |------------|-----------|---------|------------------------|
106
+ | `component-implementation` | `skills/component-implementation/SKILL.md` | Builds or modifies frontend components using existing patterns, styling, accessibility rules, and test conventions. | When creating or modifying frontend UI components. |
107
+ | `frontend-onboarding` | `skills/frontend-onboarding/SKILL.md` | Understands frontend app structure, framework, routing, build tools, styling system, and test setup. Read-only unless asked. | When starting work in an unfamiliar frontend repo or feature area. |
108
+ | `frontend-quality` | `skills/frontend-quality/SKILL.md` | Reviews frontend code for accessibility, responsiveness, performance, UX states, browser behavior, and maintainability. Read-only unless asked. | When reviewing or improving frontend quality. |
109
+ | `safe-coding` | `skills/safe-coding/SKILL.md` | Applies safe, reviewable coding practices: small diffs, pre-read, no secrets, no lockfiles, post-edit verification. | When modifying any file in a codebase. |
110
+
111
+ ## Theme Map
112
+
113
+ | Theme | File path |
114
+ |-------|-----------|
115
+ | Latte Review | `themes/latte-review.json` |
116
+ | Neon Guardian | `themes/neon-guardian.json` |
117
+ | Safe Dark | `themes/safe-dark.json` |
118
+ | Tokyo Midnight | `themes/tokyo-midnight.json` |
119
+
120
+ ## Common Tasks
121
+
122
+ ### Change branding/UI
123
+ Read:
124
+ - `extensions/brand-ui.ts`
125
+ - `themes/`
126
+
127
+ ### Change update behavior
128
+ Read:
129
+ - `extensions/update.ts`
130
+
131
+ ### Change safety behavior
132
+ Read:
133
+ - `extensions/safety.ts`
134
+ - `extensions/git-guard.ts`
135
+ - `extensions/workspace-guard.ts`
136
+
137
+ ### Change footer/status
138
+ Read:
139
+ - `extensions/status.ts`
140
+ - `extensions/usage-tracker.ts`
141
+
142
+ ### Change prompt workflows
143
+ Read:
144
+ - `extensions/prompts.ts`
145
+ - `prompts/`
146
+
147
+ ### Change sound cues
148
+ Read:
149
+ - `extensions/sound-cues.ts`
150
+
151
+ ### Change workspace boundaries
152
+ Read:
153
+ - `extensions/workspace-guard.ts`
154
+
155
+ ### Add a new extension
156
+ Read first:
157
+ - `AGENTS.md` (Extension Rules)
158
+ - `tests/extensions.test.ts`
159
+ Then create:
160
+ - `extensions/<name>.ts`
161
+
162
+ ### Add a new prompt
163
+ Read first:
164
+ - `AGENTS.md` (Prompt Rules)
165
+ - `tests/prompts.test.ts`
166
+ Then create:
167
+ - `prompts/<name>.md`
168
+ Update:
169
+ - `extensions/prompts.ts` (if the prompt should appear in the `/prompts` menu)
170
+
171
+ ### Add a new skill
172
+ Read first:
173
+ - `AGENTS.md` (Skill Rules)
174
+ - `tests/skills.test.ts`
175
+ Then create:
176
+ - `skills/<name>/SKILL.md`
177
+
178
+ ### Add a new theme
179
+ Read first:
180
+ - `tests/themes.test.ts`
181
+ Then create:
182
+ - `themes/<name>.json`
183
+
184
+ ### Release a new version
185
+ Read:
186
+ - `scripts/git-release.mjs`
187
+ - `package.json`
188
+ - `CHANGELOG.md`
189
+
190
+ ## Common Commands
191
+
192
+ | Command | Purpose |
193
+ |---------|---------|
194
+ | `npm test` | Run the full Vitest test suite (structure, syntax, and validation tests). |
195
+ | `npm run test:watch` | Run Vitest in watch mode. |
196
+ | `npm run git` | Run the interactive git-release script (bumps version, commits, tags, pushes). |
197
+ | `pi install -l .` | Install this package locally into Pi for development testing. |
198
+ | `/reload` | Reload Pi after installing, updating, or changing extensions. |
199
+
200
+ ## Safety Notes
201
+
202
+ - **Do not edit `.env` files** — blocked by `extensions/safety.ts`.
203
+ - **Do not edit `.git` internals** — blocked by `extensions/safety.ts`.
204
+ - **Do not edit `node_modules`** — blocked by `extensions/safety.ts`.
205
+ - **Do not edit build output** (`dist`, `build`, `out`, `coverage`) — blocked by `extensions/safety.ts`.
206
+ - **Do not change lockfiles** unless the user explicitly approves.
207
+ - **Do not run destructive Git commands** (`git push --force`, `git reset --hard`, `git clean -fd`) without explicit user approval — guarded by `extensions/git-guard.ts`.
208
+ - **Do not run commands leaving the workspace** without approval — guarded by `extensions/workspace-guard.ts`.
209
+ - **`scripts/git-release.mjs`** performs `git push` and may create tags; review its behavior before running in a dirty worktree.
210
+
211
+ ## Agent Rules
212
+
213
+ - Read `AGENTS.md` before making any edits.
214
+ - Keep changes small, focused, and reviewable.
215
+ - Read existing files before editing them.
216
+ - Preserve existing behavior unless explicitly asked to change it.
217
+ - Match the style already used in the repo.
218
+ - Do not add dependencies unless explicitly approved.
219
+ - Do not delete files unless explicitly approved.
220
+ - Do not rewrite Git history.
221
+ - Each skill must live in its own folder under `skills/`.
222
+ - Prompt filenames become slash commands; do not create `prompts/prompts.md` because `/prompts` is provided by `extensions/prompts.ts`.
223
+ - Extensions must export a default function receiving `ExtensionAPI`.
224
+ - Run `npm test` after structural changes to extensions, prompts, skills, or themes.
225
+ - Update `README.md` and `CHANGELOG.md` when adding or renaming public features.
226
+ - Planning and review prompts should remain read-only.
227
+ - The `/commit` prompt must suggest a message only; it must not commit automatically.
228
+ - The `/save-plan` prompt should save plans under `docs/plans/`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preapexis/pi-kit",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Personal Pi coding-agent kit with safety extensions, status UI, prompt workflows, skills, and themes.",
5
5
  "keywords": [
6
6
  "pi-package",
package/prompts/init.md CHANGED
@@ -1,194 +1,228 @@
1
- # Initialize Repository Understanding
1
+ # Initialize Agent Guidelines
2
2
 
3
- Your job is to deeply inspect this repository and create or update an `AGENTS.md` file that captures everything Pi needs to know to work effectively in this codebase.
3
+ Your job is to create or update the root `AGENTS.md` file for this repository.
4
4
 
5
- If the repository is large, inspect the most important files first and clearly mention what was not inspected.
5
+ This prompt must **not** duplicate the full repository map. The detailed repository map belongs in:
6
+
7
+ `docs/PROJECT_MAP.md`
8
+
9
+ If `docs/PROJECT_MAP.md` exists, read it and use it as the main source for repository structure.
10
+
11
+ If `docs/PROJECT_MAP.md` does not exist, do **not** create a large project map inside `AGENTS.md`. Instead, inspect only the most important project files and add a note in `AGENTS.md` saying that `/repo-map` should be run to generate `docs/PROJECT_MAP.md`.
6
12
 
7
13
  ## Goal
8
14
 
9
- Create a useful `AGENTS.md` file so future Pi sessions can quickly understand:
15
+ Create a concise, useful `AGENTS.md` file that tells future Pi agents:
10
16
 
11
17
  - what this project does
12
- - where important files live
18
+ - which repository map file to read
13
19
  - which commands to run
14
20
  - which files are risky
15
- - which files to inspect for common tasks
16
- - what rules agents should follow
21
+ - which files to inspect first for common tasks
22
+ - what rules agents must follow
23
+
24
+ `AGENTS.md` should be short, scannable, and task-focused.
25
+
26
+ It should act as an **agent operating guide**, not a full file inventory.
27
+
28
+ ## Important Rule
29
+
30
+ Do not copy the full contents of `docs/PROJECT_MAP.md` into `AGENTS.md`.
31
+
32
+ Instead, summarize only the most important paths and link to it.
33
+
34
+ Good:
35
+
36
+ - For the full repository map, read `docs/PROJECT_MAP.md`.
37
+
38
+ Bad:
39
+
40
+ - Listing every source file, prompt file, skill file, theme file, test file, and config file again inside `AGENTS.md`.
17
41
 
18
42
  ## Steps
19
43
 
20
- 1. **Check for an existing `AGENTS.md`**
44
+ 1. Check for an existing `AGENTS.md`
21
45
  - If it exists, read it first.
22
- - Preserve anything that is still accurate and relevant.
23
- - Do not remove existing project-specific rules unless they are clearly outdated.
24
- - Merge new findings with the existing content.
46
+ - Preserve accurate project-specific rules.
47
+ - Remove duplicated or overly detailed file inventory if it is already covered by `docs/PROJECT_MAP.md`.
48
+ - Keep the file concise.
49
+
50
+ 2. Check for `docs/PROJECT_MAP.md`
51
+ - If it exists, read it.
52
+ - Use it to understand the project structure.
53
+ - Reference it from `AGENTS.md`.
54
+ - Do not duplicate it.
25
55
 
26
- 2. **Read the codebase thoroughly**
56
+ 3. Read key project files
27
57
 
28
- Read important files such as:
58
+ Read only the files needed to create good agent guidance:
29
59
  - `README.md`
30
60
  - `package.json`
31
- - `pyproject.toml`
32
- - `go.mod`
33
- - `Cargo.toml`
34
- - `pom.xml`
35
- - `build.gradle`
36
- - `CONTRIBUTING.md`
37
- - `docs/`
38
- - `.github/workflows/`
39
- - `docker-compose.yml`
40
- - `Dockerfile`
41
- - config files such as:
61
+ - `AGENTS.md`, if present
62
+ - `docs/PROJECT_MAP.md`, if present
63
+ - `.github/workflows/`, if present
64
+ - important config files such as:
42
65
  - `tsconfig.json`
43
- - `vite.config.*`
44
- - `next.config.*`
45
- - `webpack.config.*`
46
66
  - `eslint.config.*`
47
67
  - `prettier.config.*`
48
- - main source directories such as:
49
- - `src/`
50
- - `app/`
51
- - `lib/`
52
- - `packages/`
68
+
69
+ - main package directories such as:
53
70
  - `extensions/`
54
71
  - `prompts/`
55
72
  - `skills/`
56
73
  - `themes/`
57
- - test files and test configuration
58
- - `.env.example` files only
74
+ - `tests/`
59
75
 
60
76
  Do not read actual `.env` files.
61
77
 
62
- 3. **Identify the project structure**
63
-
64
- Find:
65
- - main entry points
66
- - important directories and their purposes
67
- - config files
68
- - generated/build output directories
69
- - files that should be treated carefully
70
-
71
- 4. **Detect the development workflow**
78
+ 4. Detect the development workflow
72
79
 
73
80
  Find commands for:
74
81
  - install
75
- - dev
76
- - build
77
82
  - test
78
- - lint
79
83
  - typecheck
80
- - format
81
- - reload or local development, if applicable
84
+ - release
85
+ - local Pi usage
86
+ - package publishing, if applicable
82
87
 
83
- 5. **Identify safety risks**
88
+ 5. Identify safety risks
84
89
 
85
90
  Look for:
86
- - secrets or env files
87
- - deployment files
88
- - database migrations
89
- - production config
90
- - generated files
91
+ - auth files
92
+ - env files
93
+ - GitHub Actions publishing workflows
94
+ - release scripts
95
+ - package version files
91
96
  - lockfiles
92
- - destructive scripts
93
- - commands that should require confirmation
97
+ - destructive commands
98
+ - workspace boundary rules
94
99
 
95
- 6. **Infer coding conventions**
100
+ 6. Create or update `AGENTS.md`
96
101
 
97
- Look for:
98
- - language/framework
99
- - naming style
100
- - error handling style
101
- - testing style
102
- - API conventions
103
- - dependency management
104
- - state management and data flow, if applicable
102
+ Use this structure:
105
103
 
106
- 7. **Create a task-focused project map inside `AGENTS.md`**
104
+ # Agent Guidelines: <project name>
107
105
 
108
- Add a section that tells future agents where to look first for common tasks.
106
+ ## Project Summary
107
+
108
+ Briefly explain what this project does.
109
+
110
+ ## Start Here
111
+
112
+ Tell future agents which files to read first.
113
+
114
+ Include:
115
+ - `README.md`
116
+ - `docs/PROJECT_MAP.md`, if present
117
+ - `package.json`
118
+ - key task-specific files
119
+
120
+ If `docs/PROJECT_MAP.md` is missing, say:
121
+ - Run `/repo-map` to generate `docs/PROJECT_MAP.md`.
122
+
123
+ ## Repository Map
124
+
125
+ Keep this section short.
126
+
127
+ If `docs/PROJECT_MAP.md` exists, write:
128
+ - Full repository map: `docs/PROJECT_MAP.md`
129
+
130
+ Then include only a small high-level table, not a full inventory.
109
131
 
110
132
  Example:
111
- - For branding/UI changes, read `extensions/brand-ui.ts`.
112
- - For update behavior, read `extensions/update.ts`.
113
- - For safety behavior, read `extensions/safety.ts` and `extensions/git-guard.ts`.
114
- - For prompt workflows, read `prompts/`.
115
- - For skills, read `skills/<skill-name>/SKILL.md`.
116
133
 
117
- ## Output
134
+ | Path | Purpose |
135
+ | ------------- | ---------------------- |
136
+ | `extensions/` | Pi extension modules |
137
+ | `prompts/` | Slash prompt workflows |
138
+ | `skills/` | Packaged Pi skills |
139
+ | `themes/` | Pi themes |
140
+ | `tests/` | Vitest tests |
118
141
 
119
- Create or update `AGENTS.md` in the repository root with this structure:
142
+ ## Common Task Map
120
143
 
121
- ```markdown
122
- # Agent Guidelines: <project name>
144
+ Keep this task-focused.
123
145
 
124
- ## Project Summary
146
+ Example:
125
147
 
126
- Briefly explain what this project does.
148
+ | Task | Read These Files First |
149
+ | ----------------------- | ---------------------------------------------------------------------------------- |
150
+ | Change branding/UI | `extensions/brand-ui.ts`, `themes/` |
151
+ | Change update behavior | `extensions/update.ts` |
152
+ | Change safety behavior | `extensions/safety.ts`, `extensions/git-guard.ts`, `extensions/workspace-guard.ts` |
153
+ | Change prompt workflows | `prompts/`, `extensions/prompts.ts` |
154
+ | Change LiteLLM provider | `extensions/litellm-provider.ts` |
155
+ | Change release behavior | `scripts/git-release.mjs`, `.github/workflows/` |
127
156
 
128
- ## Tech Stack
157
+ ## Development Commands
129
158
 
130
- Languages, frameworks, libraries, and tools.
159
+ Include only commands that are present in the project.
131
160
 
132
- ## Project Map
161
+ Example:
133
162
 
134
- | Path | Purpose |
135
- | ------ | ---------------- |
136
- | `src/` | Main source code |
163
+ | Command | Purpose |
164
+ | ----------------------------- | ---------------------------------------------- |
165
+ | `npm test` | Run tests |
166
+ | `npm run git --msg="message"` | Commit, optionally bump version, tag, and push |
137
167
 
138
- ## Common Task Map
168
+ ## Coding Conventions
139
169
 
140
- | Task | Read These Files First |
141
- | ---------------------- | ------------------------------------------------- |
142
- | Change branding/UI | `extensions/brand-ui.ts`, `themes/` |
143
- | Change update behavior | `extensions/update.ts` |
144
- | Change safety behavior | `extensions/safety.ts`, `extensions/git-guard.ts` |
170
+ Summarize important conventions only.
145
171
 
146
- ## Development Commands
172
+ Include language, module style, formatting style, testing style, and extension patterns.
147
173
 
148
- | Command | Purpose |
149
- | ---------- | --------- |
150
- | `npm test` | Run tests |
174
+ ## Safety Rules
151
175
 
152
- ## Coding Conventions
176
+ Include rules agents must follow.
153
177
 
154
- Naming, error handling, testing, API patterns, state management.
178
+ Mention:
179
+ - Do not read `.env` files.
180
+ - Do not expose secrets.
181
+ - Do not modify files outside the current workspace unless explicitly allowed.
182
+ - Be careful with release scripts, npm publishing, GitHub workflows, and package version files.
183
+ - Ask before destructive Git commands.
184
+ - Do not duplicate `docs/PROJECT_MAP.md` inside `AGENTS.md`.
155
185
 
156
- ## Safety Rules
186
+ ## Architecture Notes
157
187
 
158
- Files, directories, and commands to treat carefully.
188
+ Summarize important architecture patterns.
159
189
 
160
- ## Architecture Notes
190
+ Keep this short.
161
191
 
162
- Key patterns, data flow, important abstractions.
192
+ ## Agent Rules
163
193
 
164
- ## Agent Rules
194
+ Include direct rules for future agents.
165
195
 
166
- Repo-specific rules for AI agents working in this codebase.
196
+ Example:
197
+ - Prefer editing existing extension files over creating duplicates.
198
+ - Keep `AGENTS.md` concise.
199
+ - Put detailed repository mapping in `docs/PROJECT_MAP.md`.
200
+ - Do not add GitHub install instructions if this package should be installed from npm.
201
+ - Do not duplicate Pi’s built-in status/footer information.
202
+ - Keep workspace guard behavior strict by default.
167
203
 
168
- ## Open Questions
204
+ ## Open Questions
169
205
 
170
- Anything unclear or missing.
206
+ List anything unclear.
171
207
 
172
- ## Inspection Notes
208
+ ## Inspection Notes
173
209
 
174
- Mention important areas that were not inspected.
175
- ```
176
- ````
210
+ Mention what was inspected and what was not inspected.
177
211
 
178
- ## Rules
212
+ ## Output Rules
179
213
 
180
- - Be thorough but concise.
181
- - `AGENTS.md` should be scannable.
214
+ - Only create or update `AGENTS.md`.
215
+ - Do not modify source code.
216
+ - Do not modify `docs/PROJECT_MAP.md`.
217
+ - Do not create a second project map inside `AGENTS.md`.
218
+ - Keep `AGENTS.md` concise.
219
+ - Prefer references to `docs/PROJECT_MAP.md` over duplicated file lists.
182
220
  - Do not include secrets, API keys, tokens, passwords, or sensitive data.
183
221
  - Do not read actual `.env` files.
184
- - If `AGENTS.md` already exists, merge with it instead of blindly replacing it.
185
- - Focus on information that helps an AI agent write better code.
186
- - Prefer specific file paths over vague explanations.
187
- - Do not modify source code during initialization.
188
- - Only create or update `AGENTS.md`.
189
- - After creating or updating `AGENTS.md`, report:
190
- - file path
191
- - what sections were added or updated
192
- - anything that was unclear
193
222
 
223
+ After updating `AGENTS.md`, report:
194
224
 
225
+ - file path
226
+ - sections added or updated
227
+ - whether `docs/PROJECT_MAP.md` was found and used
228
+ - anything unclear