pi-orchestrator-config 4.1.5

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.
Files changed (175) hide show
  1. package/README.md +808 -0
  2. package/agents/api-documenter.md +32 -0
  3. package/agents/bash-expert.md +53 -0
  4. package/agents/code-reviewer-docs.md +145 -0
  5. package/agents/code-reviewer-guidelines.md +97 -0
  6. package/agents/code-reviewer-quality.md +142 -0
  7. package/agents/code-reviewer-security.md +107 -0
  8. package/agents/code-reviewer-spec.md +164 -0
  9. package/agents/debugger.md +63 -0
  10. package/agents/docker-expert.md +40 -0
  11. package/agents/docs-fetcher.md +48 -0
  12. package/agents/git-expert.md +63 -0
  13. package/agents/github-expert.md +83 -0
  14. package/agents/go-expert.md +62 -0
  15. package/agents/issue-reviewer-feasibility.md +60 -0
  16. package/agents/issue-reviewer-scope.md +63 -0
  17. package/agents/issue-reviewer-spec.md +77 -0
  18. package/agents/java-expert.md +31 -0
  19. package/agents/jenkins-expert.md +38 -0
  20. package/agents/kubernetes-expert.md +40 -0
  21. package/agents/planner.md +42 -0
  22. package/agents/python-expert.md +61 -0
  23. package/agents/reviewer.md +26 -0
  24. package/agents/scout.md +40 -0
  25. package/agents/security-auditor.md +254 -0
  26. package/agents/technical-documentation-writer.md +37 -0
  27. package/agents/test-automator.md +55 -0
  28. package/agents/test-runner.md +47 -0
  29. package/agents/ts-expert.md +23 -0
  30. package/agents/worker.md +30 -0
  31. package/extensions/acpx-provider/index.ts +104 -0
  32. package/extensions/acpx-provider/load-runtime.ts +99 -0
  33. package/extensions/acpx-provider/runtime-models.ts +40 -0
  34. package/extensions/cli-provider/agents/claude.ts +128 -0
  35. package/extensions/cli-provider/agents/cursor.ts +84 -0
  36. package/extensions/cli-provider/agents/gemini.ts +100 -0
  37. package/extensions/cli-provider/discover.ts +77 -0
  38. package/extensions/cli-provider/index.ts +57 -0
  39. package/extensions/cli-provider/parsers.ts +304 -0
  40. package/extensions/cli-provider/providers.ts +58 -0
  41. package/extensions/cli-provider/runner.ts +225 -0
  42. package/extensions/cli-provider/runtime-models.ts +32 -0
  43. package/extensions/cli-provider/session-reaper.ts +122 -0
  44. package/extensions/cli-provider/sessions.ts +533 -0
  45. package/extensions/cli-provider/shared/discover-cache.ts +235 -0
  46. package/extensions/cli-provider/types.ts +48 -0
  47. package/extensions/coms/coms-net-server.ts +1642 -0
  48. package/extensions/coms/coms-net-wrapper.ts +521 -0
  49. package/extensions/coms/coms-net.ts +1589 -0
  50. package/extensions/coms/coms-p2p.ts +1879 -0
  51. package/extensions/coms/coms-shared.ts +510 -0
  52. package/extensions/coms/coms-wrapper.ts +138 -0
  53. package/extensions/coms/index.ts +20 -0
  54. package/extensions/coms/themeMap.ts +147 -0
  55. package/extensions/image-gen/image-gen.ts +332 -0
  56. package/extensions/image-gen/index.ts +14 -0
  57. package/extensions/orchestrator/agents.ts +134 -0
  58. package/extensions/orchestrator/ask-user.ts +293 -0
  59. package/extensions/orchestrator/async-agents.ts +1037 -0
  60. package/extensions/orchestrator/async-capability.ts +129 -0
  61. package/extensions/orchestrator/async-runner.ts +324 -0
  62. package/extensions/orchestrator/async-status-parse.ts +31 -0
  63. package/extensions/orchestrator/async-status-ui.ts +201 -0
  64. package/extensions/orchestrator/async-wait.ts +36 -0
  65. package/extensions/orchestrator/btw.ts +210 -0
  66. package/extensions/orchestrator/cron-status-format.ts +126 -0
  67. package/extensions/orchestrator/cron-status-ui.ts +132 -0
  68. package/extensions/orchestrator/cron.ts +730 -0
  69. package/extensions/orchestrator/dreaming.ts +355 -0
  70. package/extensions/orchestrator/enforcement-helpers.ts +530 -0
  71. package/extensions/orchestrator/enforcement-rules.ts +329 -0
  72. package/extensions/orchestrator/enforcement.ts +828 -0
  73. package/extensions/orchestrator/extended-autocomplete.ts +593 -0
  74. package/extensions/orchestrator/git-helpers.ts +420 -0
  75. package/extensions/orchestrator/github-autocomplete.ts +250 -0
  76. package/extensions/orchestrator/icons.ts +17 -0
  77. package/extensions/orchestrator/index.ts +100 -0
  78. package/extensions/orchestrator/memory-embeddings.ts +281 -0
  79. package/extensions/orchestrator/memory-promotion.ts +449 -0
  80. package/extensions/orchestrator/memory-provenance.ts +80 -0
  81. package/extensions/orchestrator/memory-query-class.ts +90 -0
  82. package/extensions/orchestrator/memory-scoring.ts +434 -0
  83. package/extensions/orchestrator/memory-tools.ts +883 -0
  84. package/extensions/orchestrator/memory-tree.ts +212 -0
  85. package/extensions/orchestrator/nvim.ts +169 -0
  86. package/extensions/orchestrator/overlay-dashboard-utils.ts +25 -0
  87. package/extensions/orchestrator/overlay-dashboard.ts +512 -0
  88. package/extensions/orchestrator/pi-config-review-state.ts +303 -0
  89. package/extensions/orchestrator/preference-extractor.ts +106 -0
  90. package/extensions/orchestrator/project-settings.ts +468 -0
  91. package/extensions/orchestrator/promotion-queue.ts +311 -0
  92. package/extensions/orchestrator/resolve-agent-model.ts +32 -0
  93. package/extensions/orchestrator/review-ui.ts +204 -0
  94. package/extensions/orchestrator/rule-placeholders.ts +12 -0
  95. package/extensions/orchestrator/rules.ts +481 -0
  96. package/extensions/orchestrator/session-search.ts +243 -0
  97. package/extensions/orchestrator/session-validation.ts +374 -0
  98. package/extensions/orchestrator/situation-report.ts +370 -0
  99. package/extensions/orchestrator/status-bar.ts +31 -0
  100. package/extensions/orchestrator/status-line.ts +192 -0
  101. package/extensions/orchestrator/status.ts +110 -0
  102. package/extensions/orchestrator/subagent-tool.ts +1748 -0
  103. package/extensions/orchestrator/task-lifecycle.ts +88 -0
  104. package/extensions/orchestrator/utils.ts +227 -0
  105. package/extensions/pidash/index.ts +15 -0
  106. package/extensions/pidash/pidash.ts +941 -0
  107. package/extensions/pidiff/index.ts +13 -0
  108. package/extensions/pidiff/pidiff.ts +369 -0
  109. package/extensions/providers/acpx-driver.ts +479 -0
  110. package/extensions/providers/built-in-drivers.ts +52 -0
  111. package/extensions/providers/claude-driver.ts +319 -0
  112. package/extensions/providers/cursor-acpx-driver.ts +398 -0
  113. package/extensions/providers/cursor-cli-driver.ts +484 -0
  114. package/extensions/providers/gemini-driver.ts +302 -0
  115. package/extensions/providers/index.ts +513 -0
  116. package/extensions/shared/build-system-prompt.ts +57 -0
  117. package/extensions/shared/create-runtime-provider.ts +190 -0
  118. package/extensions/shared/daemon-manager.ts +248 -0
  119. package/extensions/shared/file-logger.ts +115 -0
  120. package/extensions/shared/managed-refresh.ts +211 -0
  121. package/extensions/shared/provider-driver.ts +295 -0
  122. package/extensions/shared/provider-errors.ts +305 -0
  123. package/extensions/shared/provider-registry.ts +388 -0
  124. package/extensions/shared/stream-builder.ts +275 -0
  125. package/extensions/shared/types.ts +20 -0
  126. package/extensions/shared/ui/README.md +10 -0
  127. package/extensions/shared/ui/badge.tsx +52 -0
  128. package/extensions/shared/ui/button.tsx +58 -0
  129. package/extensions/shared/ui/collapsible.tsx +21 -0
  130. package/extensions/shared/ui/dropdown-menu.tsx +266 -0
  131. package/extensions/shared/ui/input.tsx +20 -0
  132. package/extensions/shared/ui/popover.tsx +114 -0
  133. package/extensions/shared/ui/resizable.tsx +48 -0
  134. package/extensions/shared/ui/scroll-area.tsx +53 -0
  135. package/extensions/shared/ui/select.tsx +201 -0
  136. package/extensions/shared/ui/separator.tsx +25 -0
  137. package/extensions/shared/ui/tooltip.tsx +64 -0
  138. package/extensions/shared/ws-client.ts +74 -0
  139. package/package.json +59 -0
  140. package/prompts/coderabbit-rate-limit.md +95 -0
  141. package/prompts/create-coms-feature-manager.md +186 -0
  142. package/prompts/create-skill.md +128 -0
  143. package/prompts/domain-model.md +109 -0
  144. package/prompts/external-ai.md +665 -0
  145. package/prompts/implement-and-review.md +25 -0
  146. package/prompts/implement.md +26 -0
  147. package/prompts/issue-review.md +256 -0
  148. package/prompts/pr-review.md +753 -0
  149. package/prompts/query-db.md +154 -0
  150. package/prompts/refine-review.md +208 -0
  151. package/prompts/release.md +235 -0
  152. package/prompts/remember.md +33 -0
  153. package/prompts/review-handler-status.md +27 -0
  154. package/prompts/review-handler.md +677 -0
  155. package/prompts/review-local.md +159 -0
  156. package/prompts/scout-and-plan.md +21 -0
  157. package/rules/00-orchestrator-core.md +42 -0
  158. package/rules/05-issue-first-workflow.md +119 -0
  159. package/rules/10-agent-routing.md +58 -0
  160. package/rules/15-mcp-launchpad.md +46 -0
  161. package/rules/20-code-review-loop.md +234 -0
  162. package/rules/25-documentation-updates.md +15 -0
  163. package/rules/30-prompt-templates.md +19 -0
  164. package/rules/35-memory.md +240 -0
  165. package/rules/40-critical-rules.md +124 -0
  166. package/rules/45-file-preview.md +29 -0
  167. package/rules/50-agent-bug-reporting.md +90 -0
  168. package/rules/55-coms-protocol.md +63 -0
  169. package/rules/60-task-tracking.md +66 -0
  170. package/skills/conflict-resolver/SKILL.md +213 -0
  171. package/skills/skill-creator/SKILL.md +85 -0
  172. package/skills/systematic-debugging/SKILL.md +353 -0
  173. package/skills/test-driven-development/SKILL.md +335 -0
  174. package/skills/update-agents-md/SKILL.md +282 -0
  175. package/templates/coms-feature-manager-prompt.md +313 -0
@@ -0,0 +1,186 @@
1
+ ---
2
+ description: "Generate a coms feature-manager prompt customized for the current project"
3
+ ---
4
+
5
+ ## Raw Arguments
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ # Create Coms Feature Manager Prompt
12
+
13
+ > **Bug Reporting Policy:** If you encounter ANY error, unexpected behavior, or reproducible bug
14
+ > while executing this command — DO NOT work around it silently. Ask the user:
15
+ > "Should I create a GitHub issue for this?" Route to:
16
+ > `myk-org/pi-config` for plugin/command spec or `myk-pi-tools` CLI issues.
17
+ > Do not silently skip steps or apply manual fixes that hide the root cause.
18
+
19
+ Generates a project-specific **coms feature manager** prompt from the template.
20
+ The coms feature manager pattern uses pi's coms system (`coms_send`/`coms_list` — responses auto-deliver as followUp)
21
+ to coordinate between a manager agent (reviewer) and a coder agent (implementer).
22
+
23
+ ## What This Creates
24
+
25
+ A prompt file at `.pi/prompts/coms-feature-manager.md` in the current project that defines
26
+ a Feature Manager role — an agent that:
27
+
28
+ - Reviews and directs a coder peer via coms (inter-agent communication)
29
+ - Owns feature quality end-to-end
30
+ - Gates PR creation — coder cannot push without manager approval
31
+ - Iterates: review → feedback → wait for fixes → re-review
32
+
33
+ ## Workflow
34
+
35
+ ### Step 0: Check for Existing Prompt
36
+
37
+ Check if `.pi/prompts/coms-feature-manager.md` already exists in the current project.
38
+
39
+ If it **does NOT exist** → proceed to Step 1.
40
+
41
+ If it **exists** → ask the user using ask_user:
42
+
43
+ > `.pi/prompts/coms-feature-manager.md` already exists. What do you want to do?
44
+
45
+ Options:
46
+
47
+ - **Update** — Re-generate from template, preserving any manual customizations where possible
48
+ - **Overwrite** — Delete and generate fresh from template
49
+ - **Cancel** — Keep the existing prompt, do nothing
50
+
51
+ If **Update**: read the existing prompt first, then generate the new one, and merge any
52
+ custom sections the user added (sections not in the template) into the new output.
53
+
54
+ If **Overwrite**: delete the existing file and proceed from Step 1.
55
+
56
+ If **Cancel**: stop and inform the user.
57
+
58
+ ### Step 1: Read the Template
59
+
60
+ Read the template file:
61
+
62
+ ```text
63
+ ~/.pi/agent/git/github.com/myk-org/pi-config/templates/coms-feature-manager-prompt.md
64
+ ```
65
+
66
+ This is the immutable source template. NEVER modify it.
67
+
68
+ ### Step 2: Analyze the Project
69
+
70
+ Examine the current project to determine:
71
+
72
+ 1. **Test command**: Look for `Makefile` (test target), `tox.ini`, `pyproject.toml` (pytest config),
73
+ `package.json` (test script), or other test runners. Determine the exact command to run all tests.
74
+
75
+ 2. **Test locations**: Where are tests stored? (`tests/`, `test/`, `__tests__/`, `spec/`, etc.)
76
+
77
+ 3. **Project type**: Python, Node.js, Go, Java, etc. Determine from project files.
78
+
79
+ 4. **Verification approach**: Determined by user input (see Step 2.5)
80
+
81
+ 5. **AGENTS.md**: Does one exist? If so, note any architecture or review conventions.
82
+
83
+ 6. **Security concerns**: Does the project handle auth, secrets, sensitive data?
84
+
85
+ ### Step 2.5: Ask About Live Verification
86
+
87
+ Ask the user using ask_user:
88
+
89
+ > Does this project need **live/E2E verification** (deploy to dev, verify in browser/CLI, test unhappy paths)?
90
+
91
+ Options:
92
+
93
+ - **Yes** — Include E2E Verification AND Dev Server Operations sections
94
+ - **No** — Remove both sections (tests are sufficient)
95
+
96
+ If the user chooses **Yes**, ask a follow-up for the deploy details:
97
+
98
+ > Provide deploy details (or leave empty to fill later):
99
+ >
100
+ > - Deploy command (e.g., `make deploy-dev`, `kubectl apply`, `docker compose up`)
101
+ > - Dev URL (e.g., `http://localhost:8080`)
102
+ > - Health check command (e.g., `curl -s http://localhost:8080/health`)
103
+ > - Admin user (if applicable)
104
+
105
+ If the user doesn't provide values, use `TBD` as the placeholder text (never leave `{{...}}` tokens in the output).
106
+
107
+ ### Step 3: Fill Placeholders
108
+
109
+ Replace ALL `{{PLACEHOLDER}}` values in the template with project-specific values:
110
+
111
+ | Placeholder | How to determine |
112
+ |-------------|------------------|
113
+ | `{{TEST_COMMAND}}` | From Makefile, tox.ini, pyproject.toml, package.json |
114
+ | `{{TEST_LOCATIONS}}` | Scan for test directories |
115
+ | `{{VERIFICATION_STEP}}` | Based on project type — deploy+verify or just tests |
116
+ | `{{VERIFICATION_SIGNOFF}}` | Matching signoff line |
117
+ | `{{ADMIN_USER}}` | From project config if applicable |
118
+ | `{{DEV_URL}}` | From project config if applicable |
119
+ | `{{DEPLOY_COMMAND}}` | From Makefile, scripts, or docs |
120
+ | `{{DEPLOY_TASK}}` | Async subagent task description |
121
+ | `{{PROJECT_DIR}}` | Current working directory |
122
+ | `{{HEALTH_CHECK_COMMAND}}` | From project config if applicable |
123
+
124
+ ### Step 4: Handle Optional Sections
125
+
126
+ For each section marked `[OPTIONAL]`:
127
+
128
+ - **Include it** if the project has the relevant feature (deploy, E2E, security, CLI, etc.)
129
+ - **Remove it entirely** (including the HTML comment markers) if not applicable
130
+ - Remove the `<!-- [OPTIONAL] ... -->` comment wrappers from included sections
131
+ - Remove the `<!-- -->` guidance comments (e.g., `<!-- Examples: ... -->`)
132
+
133
+ Also remove:
134
+
135
+ - The usage block at the top (between `> **Usage:**` and `---`)
136
+ - Any remaining `<!-- ... -->` HTML comments
137
+
138
+ ### Step 5: Write the Output
139
+
140
+ Create the directory if needed and write the customized prompt:
141
+
142
+ ```bash
143
+ mkdir -p .pi/prompts
144
+ ```
145
+
146
+ Write to `.pi/prompts/coms-feature-manager.md`
147
+
148
+ **MANDATORY:** The output file MUST start with these exact 3 lines (the template does not include them):
149
+
150
+ Line 1: `---`
151
+ Line 2: `description: "Coms feature manager — review and direct a coder peer via inter-agent communication"`
152
+ Line 3: `---`
153
+
154
+ Do NOT include any fence markers or code block syntax — the file must start with literal `---` on line 1.
155
+ This registers it as a `/coms-feature-manager` slash command in pi.
156
+
157
+ ### Step 6: Report
158
+
159
+ Tell the user:
160
+
161
+ > ✅ Created `.pi/prompts/coms-feature-manager.md`
162
+ >
163
+ > Run `/reload` to register the new `/coms-feature-manager` command.
164
+ >
165
+ > To use it: start a coms session, then run `/coms-feature-manager` to activate the manager role.
166
+ > The manager will coordinate with a coder peer via coms to implement features.
167
+
168
+ List the key customizations made (test command, verification approach, included/excluded sections).
169
+
170
+ ### Step 7: Validate the Generated Prompt (MANDATORY)
171
+
172
+ After writing the file, read it back and validate against the current project:
173
+
174
+ 1. **No remaining placeholders** — search for `{{` in the output. If any `{{PLACEHOLDER}}` values
175
+ remain unfilled, either fill them now or remove the line/section they belong to.
176
+ 2. **No stale HTML comments** — search for `<!--`. All comment markers must be removed.
177
+ 3. **Test command works** — run the test command from the prompt and verify it executes
178
+ (it doesn't need to pass, just confirm the command is valid).
179
+ 4. **File paths are correct** — verify any hardcoded paths in the prompt exist on disk.
180
+ 5. **Sections match project** — if deploy/E2E sections are included, verify deploy commands
181
+ are real. If removed, verify no dangling references to deployment remain in other sections
182
+ (e.g., workflow steps, final sign-off).
183
+ 6. **Workflow is coherent** — read the Workflow section end-to-end and confirm every step
184
+ makes sense for this project. No references to features the project doesn't have.
185
+
186
+ If any issues are found, fix the generated prompt and re-write it. Report what was fixed.
@@ -0,0 +1,128 @@
1
+ ---
2
+ description: "Create a reusable skill from a successful workflow — /create-skill <name>"
3
+ ---
4
+
5
+ ## Raw Arguments
6
+
7
+ ```text
8
+ $ARGUMENTS
9
+ ```
10
+
11
+ > **Bug Reporting Policy:** If you encounter ANY error, unexpected behavior, or reproducible bug
12
+ > while executing this command — DO NOT work around it silently. Ask the user:
13
+ > "Should I create a GitHub issue for this?" Route to:
14
+ > `myk-org/pi-config` for prompt/extension issues, or to the relevant tool's repository for CLI issues.
15
+ > Do not silently skip steps or apply manual fixes that hide the root cause.
16
+
17
+ # Create Skill
18
+
19
+ Save a successful workflow as a reusable pi skill.
20
+
21
+ ## Usage
22
+
23
+ - `/create-skill <name>` — Create a skill with the given name from the current conversation
24
+ - `/create-skill` — Prompt for a name and scope
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1: Determine Skill Name
29
+
30
+ If a name was provided in the raw arguments, use it. Otherwise, ask the user.
31
+
32
+ The name must be:
33
+
34
+ - lowercase, hyphenated (e.g., `debug-container-build`)
35
+ - max 64 characters
36
+ - descriptive of what the skill does
37
+
38
+ Validate the name:
39
+
40
+ - Must match `^[a-z][a-z0-9-]*$` (lowercase, hyphens, starts with letter)
41
+ - No spaces, underscores, or special characters
42
+ - If invalid, ask the user to provide a valid name
43
+
44
+ ### Step 1.5: Determine Skill Scope
45
+
46
+ Ask the user where to create the skill:
47
+
48
+ > Where should this skill be created?
49
+ >
50
+ > - **Global** (`~/.agents/skills/`) — available in all projects
51
+ > - **Project** (`.pi/skills/`) — available only in this project
52
+
53
+ Use `ask_user` with options: `["Global", "Project"]`
54
+
55
+ Map the response to the path:
56
+
57
+ - "Global" → `~/.agents/skills/`
58
+ - "Project" → `.pi/skills/`
59
+
60
+ Store the resolved path for Step 3.
61
+
62
+ ### Step 2: Extract the Workflow
63
+
64
+ Review the current conversation and identify:
65
+
66
+ - What task was accomplished
67
+ - What steps were followed
68
+ - What commands were run
69
+ - What pitfalls were encountered
70
+ - What verification was done
71
+
72
+ ### Step 3: Write the SKILL.md
73
+
74
+ Create the skill file at the chosen location from Step 1.5:
75
+
76
+ - **Global:** `~/.agents/skills/<name>/SKILL.md`
77
+ - **Project:** `.pi/skills/<name>/SKILL.md`
78
+
79
+ ```bash
80
+ mkdir -p <chosen-path>/<name>
81
+ ```
82
+
83
+ The SKILL.md must follow this exact format:
84
+
85
+ ```markdown
86
+ ---
87
+ name: <name>
88
+ description: "<one-line description of what this skill does and when to use it — max 1024 chars>"
89
+ ---
90
+
91
+ # <Skill Title>
92
+
93
+ ## When to Use
94
+
95
+ - Trigger condition 1
96
+ - Trigger condition 2
97
+
98
+ ## Steps
99
+
100
+ 1. Step one with exact commands
101
+ 2. Step two
102
+ 3. Verification step
103
+
104
+ ## Pitfalls
105
+
106
+ - Common mistake and how to avoid it
107
+ ```
108
+
109
+ **Security:** Before writing the SKILL.md, strip any secrets, API keys, tokens,
110
+ passwords, or credentials from the workflow steps. Replace with placeholders
111
+ like `<API_KEY>` or `$ENV_VAR`. Skills are stored in plain text.
112
+
113
+ **Rules:**
114
+
115
+ - **Be specific** — exact commands, exact file paths, exact verification steps
116
+ - **No fluff** — skip background, motivation, history — just the procedure
117
+ - **Include pitfalls** — what went wrong during this session and how it was resolved
118
+ - **Include verification** — how to confirm each step worked
119
+ - **One line description** — the description field is what pi uses to match skills to tasks
120
+
121
+ ### Step 4: Confirm
122
+
123
+ Tell the user:
124
+
125
+ > ✅ Skill `<name>` created at `<chosen-path>/<name>/SKILL.md`
126
+ >
127
+ > **Global skills** are available in all projects. **Project skills** are available only in this project.
128
+ > Reload pi to use it immediately.
@@ -0,0 +1,109 @@
1
+ ---
2
+ description: Scan the codebase and build/update a CONTEXT.md domain glossary for consistent AI vocabulary
3
+ argument-hint: "[focus area]"
4
+ ---
5
+
6
+ ## Raw Arguments
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ > **Bug Reporting Policy:** If you encounter ANY error, unexpected behavior, or reproducible bug
13
+ > while executing this command — DO NOT work around it silently. Ask the user:
14
+ > "Should I create a GitHub issue for this?" Route to:
15
+ > `myk-org/pi-config` for plugin/command spec or `myk-pi-tools` CLI issues.
16
+ > Do not silently skip steps or apply manual fixes that hide the root cause.
17
+
18
+ # Domain Model Command
19
+
20
+ Scan the codebase, identify domain-specific terms and naming patterns, and create or update
21
+ a `CONTEXT.md` glossary at the repository root. This gives all AI agents a shared vocabulary
22
+ for the project — reducing verbosity and improving naming consistency.
23
+
24
+ ## Workflow
25
+
26
+ ### Phase 1: Scan the Codebase
27
+
28
+ If raw arguments specify a focus area, narrow the scan to that area.
29
+ Otherwise, scan the full codebase.
30
+
31
+ Read **source code only** — TypeScript/Python files, variable/function/class/type names,
32
+ file structure, code comments. Look for:
33
+
34
+ - **Domain-specific terms** — words used in code identifiers that mean something specific
35
+ in this project (not general programming concepts)
36
+ - **Naming patterns** — how the codebase names things in code (e.g., "handler" vs "controller")
37
+ - **Overloaded terms** — same word used for different concepts in different files
38
+ - **Inconsistent naming** — same concept called different things in different files
39
+ - **Acronyms and abbreviations** — project-specific shorthand in code
40
+
41
+ **DO NOT include:**
42
+
43
+ - Operational workflows or processes (how things are done — that belongs in rules/memory)
44
+ - Features described in README/docs (those are documentation, not vocabulary)
45
+ - Memory system entries or session knowledge
46
+ - Anything that isn't a term used in actual code identifiers or code comments
47
+
48
+ The glossary is for **naming consistency in code** — so the AI uses the same
49
+ identifier names the codebase uses. If a term doesn't appear as a variable name,
50
+ function name, type name, or class name in the code, it probably doesn't belong.
51
+
52
+ ### Phase 2: Check Existing CONTEXT.md
53
+
54
+ If `CONTEXT.md` exists at the repo root:
55
+
56
+ 1. Read it
57
+ 2. Cross-reference against the codebase scan — are definitions still accurate?
58
+ 3. Identify new terms that should be added
59
+ 4. Identify stale terms that no longer appear in the code
60
+ 5. Present a diff of proposed changes to the user
61
+
62
+ If no `CONTEXT.md` exists, proceed to Phase 3.
63
+
64
+ ### Phase 3: Draft CONTEXT.md
65
+
66
+ Create a draft following this format:
67
+
68
+ ```markdown
69
+ # {Project Name}
70
+
71
+ {One-sentence description of what this project is.}
72
+
73
+ ## Language
74
+
75
+ **{Term}**:
76
+ {One or two sentence definition of what it IS, not what it does.}
77
+
78
+ **{Another Term}**:
79
+ {Definition}
80
+ _Avoid_: {alternative words people might use that would cause confusion}
81
+ ```
82
+
83
+ **Rules for the glossary:**
84
+
85
+ - **Keep definitions tight** — one or two sentences max
86
+ - **Only project-specific terms** — general programming concepts don't belong
87
+ - **Group under subheadings** when natural clusters emerge
88
+ - **Cross-reference with code** — if the glossary says "Order", the code should use "Order"
89
+ not "Purchase" or "Transaction"
90
+ - **`_Avoid_` is optional** — only add it when there's genuine ambiguity where someone
91
+ (human or AI) might use a different word for the same concept. For code identifiers
92
+ with clear names (e.g., `resolveRepoRoot`), no `_Avoid_` is needed — the name speaks
93
+ for itself. Use `_Avoid_` for domain concepts like "Worktree" where someone might say
94
+ "working copy" or "branch copy" instead.
95
+
96
+ ### Phase 4: Present to User
97
+
98
+ Display the full draft and ask the user to review:
99
+
100
+ - Approve as-is
101
+ - Correct any definitions
102
+ - Add missing terms
103
+ - Remove terms that don't belong
104
+
105
+ Apply corrections and write `CONTEXT.md` to the repo root.
106
+
107
+ ### Phase 5: Commit
108
+
109
+ Stage and commit `CONTEXT.md` with message: `docs: create/update domain model glossary`