@preapexis/pi-kit 1.2.1 → 1.3.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/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/`.
@@ -0,0 +1,60 @@
1
+ // cSpell:words preapexis
2
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
+
4
+ export default function (pi: ExtensionAPI): void {
5
+ pi.on("before_agent_start", async (event) => {
6
+ return {
7
+ systemPrompt:
8
+ event.systemPrompt +
9
+ `
10
+
11
+ PreApeXis Agent Behavior Rules:
12
+
13
+ Safety rules:
14
+ - Make small, reviewable changes.
15
+ - Do not read or edit secret files such as .env files.
16
+ - Do not expose secrets, API keys, tokens, passwords, or private credentials.
17
+ - Ask before installing, removing, or upgrading packages.
18
+ - Explain risky commands before running them.
19
+ - Prefer safe, additive changes.
20
+ - Run tests or type checks after code changes when available.
21
+ - Ask before destructive Git operations such as reset, clean, force-push, or deleting branches.
22
+
23
+ Clarification rules:
24
+ - If the task is clear, continue without asking unnecessary questions.
25
+ - If clarification is required before editing files, use the ask_user tool.
26
+ - Ask one question at a time.
27
+ - Provide 2 to 5 short, useful options.
28
+ - Do not manually add "Write something else"; the ask_user tool adds the custom-answer option.
29
+ - After the user answers, continue the same task using that answer.
30
+ - Do not edit files that depend on unanswered clarification.
31
+ - If a reasonable safe default exists, proceed with the default and clearly mention the assumption instead of asking.
32
+ - Do not ask broad open-ended questions when a multiple-choice question would work better.
33
+
34
+ Workspace boundary rules:
35
+ - Treat the current working directory as the workspace root.
36
+ - By default, only read, search, edit, write, delete, or inspect files inside the current workspace.
37
+ - Do not look outside the current workspace just because it might be useful.
38
+ - Do not read parent folders, sibling folders, home directories, global config folders, or unrelated repositories unless the user explicitly asks.
39
+ - Even when the user explicitly asks to access something outside the workspace, ask for confirmation before each outside read, search, write, edit, delete, or command.
40
+ - Prefer relative paths inside the current repository.
41
+ - Do not run commands that cd, pushd, Set-Location, sl, git -C, npm --prefix, pnpm -C, or otherwise move outside the workspace unless explicitly requested and confirmed.
42
+ - If outside-workspace context seems useful, ask first instead of checking it silently.
43
+ - If no UI is available to ask permission, block outside-workspace access.
44
+
45
+ Repository behavior:
46
+ - Follow AGENTS.md when present.
47
+ - Keep AGENTS.md concise.
48
+ - Put detailed repository mapping in docs/PROJECT_MAP.md.
49
+ - Do not duplicate docs/PROJECT_MAP.md inside AGENTS.md.
50
+ - Prefer editing existing files over creating duplicate files.
51
+ - Prefer npm install instructions for this package unless the user explicitly asks for GitHub install instructions.
52
+
53
+ Pi kit behavior:
54
+ - Do not duplicate Pi's built-in model, branch, context, or token footer information.
55
+ - Keep workspace guard behavior strict by default.
56
+ - Keep provider setup commands safe and avoid printing API keys.
57
+ `
58
+ };
59
+ });
60
+ }
@@ -0,0 +1,158 @@
1
+ // cSpell:words preapexis
2
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
+
4
+ type AskUserParams = {
5
+ question: string;
6
+ options: string[];
7
+ allowCustom?: boolean;
8
+ };
9
+
10
+ const CUSTOM_OPTION = "✍ Write something else";
11
+
12
+ export default function (pi: ExtensionAPI): void {
13
+ pi.registerTool({
14
+ name: "ask_user",
15
+ label: "Ask User",
16
+ description:
17
+ "Ask the user a multiple-choice question and wait for their answer before continuing.",
18
+ promptSnippet:
19
+ "Ask the user a multiple-choice question when clarification is required.",
20
+ promptGuidelines: [
21
+ "Use ask_user when you need clarification before continuing.",
22
+ "Use ask_user instead of guessing when multiple reasonable choices exist.",
23
+ "Use ask_user with short, clear options.",
24
+ "Do not ask open-ended clarification questions directly in chat when ask_user can be used.",
25
+ "Always include useful default options. The ask_user tool automatically adds a custom-answer option."
26
+ ],
27
+ parameters: {
28
+ type: "object",
29
+ properties: {
30
+ question: {
31
+ type: "string",
32
+ description: "The question to ask the user."
33
+ },
34
+ options: {
35
+ type: "array",
36
+ items: { type: "string" },
37
+ description:
38
+ "Short answer choices. Do not include 'Write something else'; it is added automatically."
39
+ },
40
+ allowCustom: {
41
+ type: "boolean",
42
+ description:
43
+ "Whether the user can write a custom answer. Defaults to true."
44
+ }
45
+ },
46
+ required: ["question", "options"]
47
+ } as any,
48
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
49
+ const input = params as AskUserParams;
50
+
51
+ if (!ctx.hasUI) {
52
+ return {
53
+ content: [
54
+ {
55
+ type: "text",
56
+ text: [
57
+ "Cannot ask the user with options because Pi UI is not available.",
58
+ "",
59
+ `Question: ${input.question}`,
60
+ "",
61
+ "Options:",
62
+ ...input.options.map(
63
+ (option, index) => `${index + 1}. ${option}`
64
+ )
65
+ ].join("\n")
66
+ }
67
+ ],
68
+ details: {
69
+ answered: false,
70
+ reason: "missing_ui"
71
+ }
72
+ };
73
+ }
74
+
75
+ const cleanOptions = input.options
76
+ .map((option) => option.trim())
77
+ .filter(Boolean);
78
+
79
+ const allowCustom = input.allowCustom !== false;
80
+
81
+ const choices = allowCustom
82
+ ? [...cleanOptions, CUSTOM_OPTION]
83
+ : cleanOptions;
84
+
85
+ if (choices.length === 0) {
86
+ const answer = await ctx.ui.input("Question", input.question);
87
+
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: `User answered: ${answer}`
93
+ }
94
+ ],
95
+ details: {
96
+ answered: true,
97
+ answer,
98
+ custom: true
99
+ }
100
+ };
101
+ }
102
+
103
+ const choice = await ctx.ui.select(input.question, choices);
104
+
105
+ if (!choice) {
106
+ return {
107
+ content: [
108
+ {
109
+ type: "text",
110
+ text: "User cancelled the question. Stop and ask again only if the answer is required."
111
+ }
112
+ ],
113
+ details: {
114
+ answered: false,
115
+ cancelled: true
116
+ }
117
+ };
118
+ }
119
+
120
+ if (choice === CUSTOM_OPTION) {
121
+ const answer = await ctx.ui.input(
122
+ "Write something else",
123
+ input.question
124
+ );
125
+
126
+ return {
127
+ content: [
128
+ {
129
+ type: "text",
130
+ text: `User answered: ${answer}`
131
+ }
132
+ ],
133
+ details: {
134
+ answered: true,
135
+ answer,
136
+ custom: true
137
+ }
138
+ };
139
+ }
140
+
141
+ return {
142
+ content: [
143
+ {
144
+ type: "text",
145
+ text: `User selected: ${choice}`
146
+ }
147
+ ],
148
+ details: {
149
+ answered: true,
150
+ answer: choice,
151
+ custom: false
152
+ }
153
+ };
154
+ }
155
+ });
156
+
157
+
158
+ }
@@ -110,29 +110,6 @@ export default function (pi: ExtensionAPI): void {
110
110
  return riskyCommands.some((pattern) => pattern.test(command));
111
111
  }
112
112
 
113
- pi.on("before_agent_start", async (event) => {
114
- return {
115
- systemPrompt:
116
- event.systemPrompt +
117
- `
118
- Safety rules:
119
- - Make small, reviewable changes.
120
- - Do not read or edit secret files such as .env files.
121
- - Ask before installing or removing packages.
122
- - Explain risky commands before running them.
123
- - Prefer safe, additive changes.
124
- - Run tests or type checks after code changes when available.
125
-
126
- Clarification rules:
127
- - If the request is unclear, ask questions before editing files.
128
- - Ask only important questions.
129
- - Do not ask more than 5 questions.
130
- - If the task is clear, continue without asking.
131
- - Do not edit files until the user answers clarification questions.
132
- `
133
- };
134
- });
135
-
136
113
  pi.on("tool_call", async (event, ctx) => {
137
114
  if (event.toolName === "bash") {
138
115
  const command = String(event.input.command ?? "");
@@ -134,23 +134,6 @@ export default function (pi: ExtensionAPI): void {
134
134
  }
135
135
  });
136
136
 
137
- pi.on("before_agent_start", async (event) => {
138
- return {
139
- systemPrompt:
140
- event.systemPrompt +
141
- `
142
-
143
- Workspace boundary rules:
144
- - Treat the current working directory as the workspace root.
145
- - Do not read, search, edit, write, delete, or inspect files outside the current workspace unless the user explicitly asks.
146
- - Before using any path outside the workspace, ask the user for permission.
147
- - Prefer relative paths inside the current repository.
148
- - Do not run commands that cd, pushd, Set-Location, or otherwise move outside the workspace unless explicitly requested.
149
- - If outside-workspace context seems useful, ask first instead of checking it silently.
150
- `
151
- };
152
- });
153
-
154
137
  pi.on("tool_call", async (event, ctx) => {
155
138
  if (!workspaceRoot) {
156
139
  workspaceRoot = normalize(ctx.cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preapexis/pi-kit",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
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,253 @@
1
1
  # Initialize Repository Understanding
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.
4
-
5
- If the repository is large, inspect the most important files first and clearly mention what was not inspected.
3
+ > This prompt initializes or updates the repository-level `AGENTS.md` file for Pi.
4
+ > It should rely on `docs/PROJECT_MAP.md` when available and avoid doing full repository mapping itself.
6
5
 
7
6
  ## Goal
8
7
 
9
- Create a useful `AGENTS.md` file so future Pi sessions can quickly understand:
8
+ Create or update an `AGENTS.md` file that gives future Pi sessions clear, durable instructions for working in this repository.
9
+
10
+ The `AGENTS.md` file should help future agents quickly understand:
10
11
 
11
12
  - what this project does
12
13
  - where important files live
13
14
  - which commands to run
14
15
  - which files are risky
15
16
  - which files to inspect for common tasks
16
- - what rules agents should follow
17
-
18
- ## Steps
19
-
20
- 1. **Check for an existing `AGENTS.md`**
21
- - 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.
25
-
26
- 2. **Read the codebase thoroughly**
27
-
28
- Read important files such as:
29
- - `README.md`
30
- - `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:
17
+ - what repository-specific rules agents should follow
18
+
19
+ ## Core Rule
20
+
21
+ `/init` must not duplicate the work of `/repo-map`.
22
+
23
+ Use `docs/PROJECT_MAP.md` if it exists. If it does not exist, recommend running `/repo-map`.
24
+
25
+ When creating or updating `AGENTS.md`, ensure it contains this line exactly once:
26
+
27
+ > Use `docs/PROJECT_MAP.md` if it exists. If it does not exist, recommend running `/repo-map`.
28
+
29
+ Do not add duplicate copies of this line if it already exists.
30
+
31
+ ## What `/init` Should Do
32
+
33
+ 1. Check whether `AGENTS.md` exists.
34
+ 2. Check whether `docs/PROJECT_MAP.md` exists.
35
+ 3. If `docs/PROJECT_MAP.md` exists:
36
+ - Read it.
37
+ - Use it as the primary source for repository structure and important files.
38
+ - Do not re-map the full repository.
39
+
40
+ 4. If `docs/PROJECT_MAP.md` does not exist:
41
+ - Do not perform full repository mapping.
42
+ - Recommend running `/repo-map`.
43
+ - Inspect only lightweight top-level files needed to create a useful minimal `AGENTS.md`, such as:
44
+ - `README.md`
45
+ - `package.json`
46
+ - `pnpm-workspace.yaml`
42
47
  - `tsconfig.json`
43
- - `vite.config.*`
44
- - `next.config.*`
45
- - `webpack.config.*`
46
- - `eslint.config.*`
47
- - `prettier.config.*`
48
- - main source directories such as:
49
- - `src/`
50
- - `app/`
51
- - `lib/`
52
- - `packages/`
53
- - `extensions/`
54
- - `prompts/`
55
- - `skills/`
56
- - `themes/`
57
- - test files and test configuration
58
- - `.env.example` files only
48
+ - `pyproject.toml`
49
+ - `Cargo.toml`
50
+ - `go.mod`
51
+ - `.github/workflows/*`
52
+
53
+ - Clearly mention in `AGENTS.md` that the repository map is missing.
54
+
55
+ 5. Create or update `AGENTS.md`.
56
+ 6. Preserve any existing useful project-specific instructions.
57
+ 7. Remove or rewrite outdated, duplicated, or generic content only when clearly safe.
58
+ 8. Keep `AGENTS.md` concise and durable.
59
+
60
+ ## What `/init` Should Not Do
61
+
62
+ Do not:
63
+
64
+ - scan the entire repository when `docs/PROJECT_MAP.md` is missing
65
+ - duplicate large sections from `docs/PROJECT_MAP.md`
66
+ - turn `AGENTS.md` into a full repository map
67
+ - include long file trees
68
+ - include temporary investigation notes
69
+ - include speculative rules
70
+ - overwrite existing project-specific instructions without reason
71
+ - remove safety, testing, build, or deployment rules unless clearly outdated
72
+ - add the required `docs/PROJECT_MAP.md` line more than once
73
+
74
+ ## AGENTS.md Content Requirements
75
+
76
+ The final `AGENTS.md` should include these sections when relevant.
77
+
78
+ ### Project Overview
79
+
80
+ Briefly describe what the project is and what it does.
59
81
 
60
- Do not read actual `.env` files.
82
+ Keep this section short.
61
83
 
62
- 3. **Identify the project structure**
84
+ ### Repository Map
63
85
 
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
86
+ Reference the project map instead of duplicating it.
70
87
 
71
- 4. **Detect the development workflow**
88
+ This section must include the following line exactly once:
72
89
 
73
- Find commands for:
74
- - install
75
- - dev
76
- - build
77
- - test
78
- - lint
79
- - typecheck
80
- - format
81
- - reload or local development, if applicable
90
+ > Use `docs/PROJECT_MAP.md` if it exists. If it does not exist, recommend running `/repo-map`.
82
91
 
83
- 5. **Identify safety risks**
92
+ If `docs/PROJECT_MAP.md` exists, summarize only the most important locations from it.
84
93
 
85
- Look for:
86
- - secrets or env files
87
- - deployment files
88
- - database migrations
89
- - production config
90
- - generated files
91
- - lockfiles
92
- - destructive scripts
93
- - commands that should require confirmation
94
+ If it does not exist, write that the repository map is missing and that `/repo-map` should be run.
94
95
 
95
- 6. **Infer coding conventions**
96
+ ### Common Commands
96
97
 
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
98
+ Include important commands for:
105
99
 
106
- 7. **Create a task-focused project map inside `AGENTS.md`**
100
+ - installing dependencies
101
+ - running locally
102
+ - building
103
+ - testing
104
+ - linting
105
+ - formatting
106
+ - type-checking
107
107
 
108
- Add a section that tells future agents where to look first for common tasks.
108
+ Only include commands that are supported by files in the repository.
109
109
 
110
- 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`.
110
+ Do not invent commands.
116
111
 
117
- ## Output
112
+ ### Important Files and Directories
118
113
 
119
- Create or update `AGENTS.md` in the repository root with this structure:
114
+ List only high-value files and directories that future agents should know about.
120
115
 
121
- ```markdown
122
- # Agent Guidelines: <project name>
116
+ Prefer concise bullets.
123
117
 
124
- ## Project Summary
118
+ Do not include a full tree.
125
119
 
126
- Briefly explain what this project does.
120
+ ### Development Rules
127
121
 
128
- ## Tech Stack
122
+ Include repository-specific rules, such as:
129
123
 
130
- Languages, frameworks, libraries, and tools.
124
+ - preferred package manager
125
+ - coding style
126
+ - branch or commit expectations
127
+ - test requirements
128
+ - generated file rules
129
+ - environment variable rules
130
+ - API or security constraints
131
131
 
132
- ## Project Map
132
+ Do not add generic rules unless they are clearly useful for this repository.
133
133
 
134
- | Path | Purpose |
135
- | ------ | ---------------- |
136
- | `src/` | Main source code |
134
+ ### Risky Areas
137
135
 
138
- ## Common Task Map
136
+ Mention files or areas that require extra caution, such as:
139
137
 
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` |
138
+ - authentication
139
+ - billing
140
+ - migrations
141
+ - deployment
142
+ - generated files
143
+ - config files
144
+ - shared types
145
+ - public APIs
146
+ - data deletion
147
+ - security-sensitive code
145
148
 
146
- ## Development Commands
149
+ ### Before Making Changes
147
150
 
148
- | Command | Purpose |
149
- | ---------- | --------- |
150
- | `npm test` | Run tests |
151
+ Include a short checklist future agents should follow before editing.
151
152
 
152
- ## Coding Conventions
153
+ Example:
153
154
 
154
- Naming, error handling, testing, API patterns, state management.
155
+ - Read `AGENTS.md`.
156
+ - Read `docs/PROJECT_MAP.md` if available.
157
+ - Inspect the files directly related to the requested change.
158
+ - Run the smallest relevant validation command.
159
+ - Avoid broad rewrites unless explicitly requested.
155
160
 
156
- ## Safety Rules
161
+ ### Notes for Future Agents
157
162
 
158
- Files, directories, and commands to treat carefully.
163
+ Include any durable notes that will help future Pi sessions.
159
164
 
160
- ## Architecture Notes
165
+ Avoid temporary notes like “today I checked…” or “currently investigating…”.
161
166
 
162
- Key patterns, data flow, important abstractions.
167
+ ## Update Strategy
163
168
 
164
- ## Agent Rules
169
+ When updating an existing `AGENTS.md`:
165
170
 
166
- Repo-specific rules for AI agents working in this codebase.
171
+ 1. Read the full existing file.
172
+ 2. Preserve accurate project-specific content.
173
+ 3. Add missing required sections.
174
+ 4. Add the required `docs/PROJECT_MAP.md` line if missing.
175
+ 5. Remove duplicate copies of the required line.
176
+ 6. Keep the file organized and easy to skim.
177
+ 7. Prefer small, careful edits over full rewrites.
178
+ 8. If a full rewrite is necessary, preserve all accurate rules from the old file.
167
179
 
168
- ## Open Questions
180
+ ## Minimal AGENTS.md Template
169
181
 
170
- Anything unclear or missing.
182
+ Use this structure when creating a new `AGENTS.md`.
171
183
 
172
- ## Inspection Notes
184
+ ```md
185
+ # AGENTS.md
173
186
 
174
- Mention important areas that were not inspected.
187
+ ## Project Overview
188
+
189
+ Briefly describe what this project does.
190
+
191
+ ## Repository Map
192
+
193
+ Use `docs/PROJECT_MAP.md` if it exists. If it does not exist, recommend running `/repo-map`.
194
+
195
+ ## Common Commands
196
+
197
+ - Install:
198
+ - Run:
199
+ - Build:
200
+ - Test:
201
+ - Lint:
202
+ - Type-check:
203
+
204
+ Only keep commands that are confirmed by repository files.
205
+
206
+ ## Important Files and Directories
207
+
208
+ - `README.md` — project overview and usage.
209
+ - Add only important confirmed paths here.
210
+
211
+ ## Development Rules
212
+
213
+ - Add repository-specific rules here.
214
+ - Do not invent rules.
215
+
216
+ ## Risky Areas
217
+
218
+ - Add files or workflows that require extra caution.
219
+
220
+ ## Before Making Changes
221
+
222
+ - Read this file.
223
+ - Read `docs/PROJECT_MAP.md` if it exists.
224
+ - Inspect the files directly related to the requested change.
225
+ - Run the smallest relevant validation command.
226
+ - Avoid broad rewrites unless explicitly requested.
227
+
228
+ ## Notes for Future Agents
229
+
230
+ Add durable notes that will help future sessions.
175
231
  ```
176
- ````
177
232
 
178
- ## Rules
233
+ ## Output Requirements
234
+
235
+ After running `/init`, respond with:
236
+
237
+ 1. Whether `AGENTS.md` was created or updated.
238
+ 2. Whether `docs/PROJECT_MAP.md` was found.
239
+ 3. A short summary of the important changes made.
240
+ 4. Any recommended next step, especially running `/repo-map` if the project map is missing.
241
+
242
+ Keep the response concise.
179
243
 
180
- - Be thorough but concise.
181
- - `AGENTS.md` should be scannable.
182
- - Do not include secrets, API keys, tokens, passwords, or sensitive data.
183
- - 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
244
+ ## Success Criteria
193
245
 
246
+ The task is successful when:
194
247
 
248
+ - `AGENTS.md` exists.
249
+ - It contains the required `docs/PROJECT_MAP.md` line exactly once.
250
+ - Existing useful instructions were preserved.
251
+ - Repository details are accurate and not invented.
252
+ - `/init` did not perform full repository mapping.
253
+ - The file is concise, durable, and useful for future Pi sessions.