@unbrained/pm-cli 2026.3.9

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 (245) hide show
  1. package/.pi/extensions/pm-cli/index.ts +778 -0
  2. package/AGENTS.md +475 -0
  3. package/LICENSE +21 -0
  4. package/PRD.md +1390 -0
  5. package/README.md +655 -0
  6. package/dist/cli/commands/activity.d.ts +14 -0
  7. package/dist/cli/commands/activity.js +80 -0
  8. package/dist/cli/commands/activity.js.map +1 -0
  9. package/dist/cli/commands/append.d.ts +13 -0
  10. package/dist/cli/commands/append.js +46 -0
  11. package/dist/cli/commands/append.js.map +1 -0
  12. package/dist/cli/commands/beads.d.ts +15 -0
  13. package/dist/cli/commands/beads.js +475 -0
  14. package/dist/cli/commands/beads.js.map +1 -0
  15. package/dist/cli/commands/claim.d.ts +19 -0
  16. package/dist/cli/commands/claim.js +79 -0
  17. package/dist/cli/commands/claim.js.map +1 -0
  18. package/dist/cli/commands/close.d.ts +12 -0
  19. package/dist/cli/commands/close.js +58 -0
  20. package/dist/cli/commands/close.js.map +1 -0
  21. package/dist/cli/commands/comments.d.ts +15 -0
  22. package/dist/cli/commands/comments.js +80 -0
  23. package/dist/cli/commands/comments.js.map +1 -0
  24. package/dist/cli/commands/completion.d.ts +10 -0
  25. package/dist/cli/commands/completion.js +469 -0
  26. package/dist/cli/commands/completion.js.map +1 -0
  27. package/dist/cli/commands/config.d.ts +15 -0
  28. package/dist/cli/commands/config.js +72 -0
  29. package/dist/cli/commands/config.js.map +1 -0
  30. package/dist/cli/commands/create.d.ts +60 -0
  31. package/dist/cli/commands/create.js +456 -0
  32. package/dist/cli/commands/create.js.map +1 -0
  33. package/dist/cli/commands/delete.d.ts +12 -0
  34. package/dist/cli/commands/delete.js +33 -0
  35. package/dist/cli/commands/delete.js.map +1 -0
  36. package/dist/cli/commands/docs.d.ts +16 -0
  37. package/dist/cli/commands/docs.js +113 -0
  38. package/dist/cli/commands/docs.js.map +1 -0
  39. package/dist/cli/commands/files.d.ts +17 -0
  40. package/dist/cli/commands/files.js +113 -0
  41. package/dist/cli/commands/files.js.map +1 -0
  42. package/dist/cli/commands/gc.d.ts +9 -0
  43. package/dist/cli/commands/gc.js +80 -0
  44. package/dist/cli/commands/gc.js.map +1 -0
  45. package/dist/cli/commands/get.d.ts +12 -0
  46. package/dist/cli/commands/get.js +28 -0
  47. package/dist/cli/commands/get.js.map +1 -0
  48. package/dist/cli/commands/health.d.ts +15 -0
  49. package/dist/cli/commands/health.js +288 -0
  50. package/dist/cli/commands/health.js.map +1 -0
  51. package/dist/cli/commands/history.d.ts +13 -0
  52. package/dist/cli/commands/history.js +72 -0
  53. package/dist/cli/commands/history.js.map +1 -0
  54. package/dist/cli/commands/index.d.ts +26 -0
  55. package/dist/cli/commands/index.js +27 -0
  56. package/dist/cli/commands/index.js.map +1 -0
  57. package/dist/cli/commands/init.d.ts +10 -0
  58. package/dist/cli/commands/init.js +59 -0
  59. package/dist/cli/commands/init.js.map +1 -0
  60. package/dist/cli/commands/install.d.ts +18 -0
  61. package/dist/cli/commands/install.js +87 -0
  62. package/dist/cli/commands/install.js.map +1 -0
  63. package/dist/cli/commands/list.d.ts +21 -0
  64. package/dist/cli/commands/list.js +137 -0
  65. package/dist/cli/commands/list.js.map +1 -0
  66. package/dist/cli/commands/reindex.d.ts +16 -0
  67. package/dist/cli/commands/reindex.js +154 -0
  68. package/dist/cli/commands/reindex.js.map +1 -0
  69. package/dist/cli/commands/restore.d.ts +20 -0
  70. package/dist/cli/commands/restore.js +208 -0
  71. package/dist/cli/commands/restore.js.map +1 -0
  72. package/dist/cli/commands/search.d.ts +45 -0
  73. package/dist/cli/commands/search.js +531 -0
  74. package/dist/cli/commands/search.js.map +1 -0
  75. package/dist/cli/commands/stats.d.ts +13 -0
  76. package/dist/cli/commands/stats.js +88 -0
  77. package/dist/cli/commands/stats.js.map +1 -0
  78. package/dist/cli/commands/test-all.d.ts +30 -0
  79. package/dist/cli/commands/test-all.js +157 -0
  80. package/dist/cli/commands/test-all.js.map +1 -0
  81. package/dist/cli/commands/test.d.ts +29 -0
  82. package/dist/cli/commands/test.js +492 -0
  83. package/dist/cli/commands/test.js.map +1 -0
  84. package/dist/cli/commands/update.d.ts +52 -0
  85. package/dist/cli/commands/update.js +467 -0
  86. package/dist/cli/commands/update.js.map +1 -0
  87. package/dist/cli/extension-command-options.d.ts +1 -0
  88. package/dist/cli/extension-command-options.js +76 -0
  89. package/dist/cli/extension-command-options.js.map +1 -0
  90. package/dist/cli/main.d.ts +2 -0
  91. package/dist/cli/main.js +1494 -0
  92. package/dist/cli/main.js.map +1 -0
  93. package/dist/cli.d.ts +2 -0
  94. package/dist/cli.js +3 -0
  95. package/dist/cli.js.map +1 -0
  96. package/dist/command-types.d.ts +1 -0
  97. package/dist/command-types.js +2 -0
  98. package/dist/command-types.js.map +1 -0
  99. package/dist/constants.d.ts +1 -0
  100. package/dist/constants.js +2 -0
  101. package/dist/constants.js.map +1 -0
  102. package/dist/core/extensions/builtins.d.ts +3 -0
  103. package/dist/core/extensions/builtins.js +47 -0
  104. package/dist/core/extensions/builtins.js.map +1 -0
  105. package/dist/core/extensions/index.d.ts +13 -0
  106. package/dist/core/extensions/index.js +88 -0
  107. package/dist/core/extensions/index.js.map +1 -0
  108. package/dist/core/extensions/loader.d.ts +301 -0
  109. package/dist/core/extensions/loader.js +917 -0
  110. package/dist/core/extensions/loader.js.map +1 -0
  111. package/dist/core/fs/fs-utils.d.ts +6 -0
  112. package/dist/core/fs/fs-utils.js +58 -0
  113. package/dist/core/fs/fs-utils.js.map +1 -0
  114. package/dist/core/fs/index.d.ts +1 -0
  115. package/dist/core/fs/index.js +2 -0
  116. package/dist/core/fs/index.js.map +1 -0
  117. package/dist/core/history/history.d.ts +12 -0
  118. package/dist/core/history/history.js +44 -0
  119. package/dist/core/history/history.js.map +1 -0
  120. package/dist/core/history/index.d.ts +1 -0
  121. package/dist/core/history/index.js +2 -0
  122. package/dist/core/history/index.js.map +1 -0
  123. package/dist/core/item/id.d.ts +3 -0
  124. package/dist/core/item/id.js +54 -0
  125. package/dist/core/item/id.js.map +1 -0
  126. package/dist/core/item/index.d.ts +3 -0
  127. package/dist/core/item/index.js +4 -0
  128. package/dist/core/item/index.js.map +1 -0
  129. package/dist/core/item/item-format.d.ts +9 -0
  130. package/dist/core/item/item-format.js +363 -0
  131. package/dist/core/item/item-format.js.map +1 -0
  132. package/dist/core/item/parse.d.ts +3 -0
  133. package/dist/core/item/parse.js +72 -0
  134. package/dist/core/item/parse.js.map +1 -0
  135. package/dist/core/lock/index.d.ts +1 -0
  136. package/dist/core/lock/index.js +2 -0
  137. package/dist/core/lock/index.js.map +1 -0
  138. package/dist/core/lock/lock.d.ts +1 -0
  139. package/dist/core/lock/lock.js +100 -0
  140. package/dist/core/lock/lock.js.map +1 -0
  141. package/dist/core/output/output.d.ts +7 -0
  142. package/dist/core/output/output.js +79 -0
  143. package/dist/core/output/output.js.map +1 -0
  144. package/dist/core/search/cache.d.ts +17 -0
  145. package/dist/core/search/cache.js +212 -0
  146. package/dist/core/search/cache.js.map +1 -0
  147. package/dist/core/search/embedding-batches.d.ts +7 -0
  148. package/dist/core/search/embedding-batches.js +54 -0
  149. package/dist/core/search/embedding-batches.js.map +1 -0
  150. package/dist/core/search/providers.d.ts +59 -0
  151. package/dist/core/search/providers.js +265 -0
  152. package/dist/core/search/providers.js.map +1 -0
  153. package/dist/core/search/vector-stores.d.ts +89 -0
  154. package/dist/core/search/vector-stores.js +546 -0
  155. package/dist/core/search/vector-stores.js.map +1 -0
  156. package/dist/core/shared/command-types.d.ts +7 -0
  157. package/dist/core/shared/command-types.js +2 -0
  158. package/dist/core/shared/command-types.js.map +1 -0
  159. package/dist/core/shared/constants.d.ts +19 -0
  160. package/dist/core/shared/constants.js +134 -0
  161. package/dist/core/shared/constants.js.map +1 -0
  162. package/dist/core/shared/errors.d.ts +4 -0
  163. package/dist/core/shared/errors.js +9 -0
  164. package/dist/core/shared/errors.js.map +1 -0
  165. package/dist/core/shared/index.d.ts +3 -0
  166. package/dist/core/shared/index.js +4 -0
  167. package/dist/core/shared/index.js.map +1 -0
  168. package/dist/core/shared/serialization.d.ts +3 -0
  169. package/dist/core/shared/serialization.js +70 -0
  170. package/dist/core/shared/serialization.js.map +1 -0
  171. package/dist/core/shared/time.d.ts +3 -0
  172. package/dist/core/shared/time.js +28 -0
  173. package/dist/core/shared/time.js.map +1 -0
  174. package/dist/core/store/index.d.ts +3 -0
  175. package/dist/core/store/index.js +4 -0
  176. package/dist/core/store/index.js.map +1 -0
  177. package/dist/core/store/item-store.d.ts +42 -0
  178. package/dist/core/store/item-store.js +186 -0
  179. package/dist/core/store/item-store.js.map +1 -0
  180. package/dist/core/store/paths.d.ts +8 -0
  181. package/dist/core/store/paths.js +29 -0
  182. package/dist/core/store/paths.js.map +1 -0
  183. package/dist/core/store/settings.d.ts +4 -0
  184. package/dist/core/store/settings.js +148 -0
  185. package/dist/core/store/settings.js.map +1 -0
  186. package/dist/errors.d.ts +1 -0
  187. package/dist/errors.js +2 -0
  188. package/dist/errors.js.map +1 -0
  189. package/dist/extensions/builtins/beads/index.d.ts +8 -0
  190. package/dist/extensions/builtins/beads/index.js +29 -0
  191. package/dist/extensions/builtins/beads/index.js.map +1 -0
  192. package/dist/extensions/builtins/todos/import-export.d.ts +26 -0
  193. package/dist/extensions/builtins/todos/import-export.js +460 -0
  194. package/dist/extensions/builtins/todos/import-export.js.map +1 -0
  195. package/dist/extensions/builtins/todos/index.d.ts +8 -0
  196. package/dist/extensions/builtins/todos/index.js +38 -0
  197. package/dist/extensions/builtins/todos/index.js.map +1 -0
  198. package/dist/fs-utils.d.ts +1 -0
  199. package/dist/fs-utils.js +2 -0
  200. package/dist/fs-utils.js.map +1 -0
  201. package/dist/history.d.ts +1 -0
  202. package/dist/history.js +2 -0
  203. package/dist/history.js.map +1 -0
  204. package/dist/id.d.ts +1 -0
  205. package/dist/id.js +2 -0
  206. package/dist/id.js.map +1 -0
  207. package/dist/item-format.d.ts +1 -0
  208. package/dist/item-format.js +2 -0
  209. package/dist/item-format.js.map +1 -0
  210. package/dist/item-store.d.ts +1 -0
  211. package/dist/item-store.js +2 -0
  212. package/dist/item-store.js.map +1 -0
  213. package/dist/lock.d.ts +1 -0
  214. package/dist/lock.js +2 -0
  215. package/dist/lock.js.map +1 -0
  216. package/dist/output.d.ts +1 -0
  217. package/dist/output.js +2 -0
  218. package/dist/output.js.map +1 -0
  219. package/dist/parse.d.ts +1 -0
  220. package/dist/parse.js +2 -0
  221. package/dist/parse.js.map +1 -0
  222. package/dist/paths.d.ts +1 -0
  223. package/dist/paths.js +2 -0
  224. package/dist/paths.js.map +1 -0
  225. package/dist/serialization.d.ts +1 -0
  226. package/dist/serialization.js +2 -0
  227. package/dist/serialization.js.map +1 -0
  228. package/dist/settings.d.ts +1 -0
  229. package/dist/settings.js +2 -0
  230. package/dist/settings.js.map +1 -0
  231. package/dist/time.d.ts +1 -0
  232. package/dist/time.js +2 -0
  233. package/dist/time.js.map +1 -0
  234. package/dist/types/index.d.ts +1 -0
  235. package/dist/types/index.js +2 -0
  236. package/dist/types/index.js.map +1 -0
  237. package/dist/types.d.ts +179 -0
  238. package/dist/types.js +21 -0
  239. package/dist/types.js.map +1 -0
  240. package/docs/ARCHITECTURE.md +246 -0
  241. package/docs/EXTENSIONS.md +329 -0
  242. package/docs/RELEASING.md +65 -0
  243. package/package.json +79 -0
  244. package/scripts/install.ps1 +112 -0
  245. package/scripts/install.sh +113 -0
package/AGENTS.md ADDED
@@ -0,0 +1,475 @@
1
+ # AGENTS.md - Operating Rules for `pm`
2
+
3
+ This document defines how coding agents must use `pm` for planning, execution, and reporting in this repository.
4
+
5
+ ## 1) Core Rules
6
+
7
+ - Use `pm` as the system of record for project work.
8
+ - Prefer deterministic, script-friendly command usage (`--json` when strict parsing is needed).
9
+ - Default to TOON output when human + model readability and low token use are desired.
10
+ - Never make destructive item changes outside `pm` mutations.
11
+ - Every mutation must produce a history entry.
12
+
13
+ ### 1.1) Session Bootstrap (Required)
14
+
15
+ - Determine command invocation before running mutations:
16
+ - Use `PM_CMD="pm"` only when `pm` clearly resolves to this repository's current build.
17
+ - Otherwise use `PM_CMD="node dist/cli.js"` from repository root.
18
+ - Set `PM_AUTHOR` explicitly for all maintainer runs.
19
+ - Refresh the global CLI from this repository for maintainer runs:
20
+ - Run `npm install -g .` from repository root.
21
+ - Verify availability with `pm --version` before mutation commands.
22
+ - For real repository tracking, do not override `PM_PATH`.
23
+ - For tests only, always use sandboxed `PM_PATH` and `PM_GLOBAL_PATH` (or `node scripts/run-tests.mjs ...`).
24
+
25
+ ## 2) Canonical Agent Workflow
26
+
27
+ ### Step A - Pick next work
28
+
29
+ Use one of:
30
+
31
+ - `pm list-in-progress --limit 20`
32
+ - `pm list-open --limit 20`
33
+ - `pm list-blocked --limit 20`
34
+
35
+ Then filter:
36
+
37
+ - by type: `--type Task|Feature|Issue|Chore|Epic`
38
+ - by priority: `--priority 0..4`
39
+ - by tag: `--tag <name>`
40
+
41
+ ### Step B - Claim ownership
42
+
43
+ - `pm claim <ID>`
44
+ - If conflict and explicitly approved: `pm claim <ID> --force`
45
+
46
+ Rules:
47
+
48
+ - Do not work unclaimed unless the task is intentionally collaborative.
49
+ - If switching context, release previous claim.
50
+
51
+ ### Step C - Clarify task intent
52
+
53
+ Populate metadata early:
54
+
55
+ - `pm update <ID> --description "..."`
56
+ - `pm update <ID> --acceptance-criteria/--ac "..."`
57
+ - `pm update <ID> --estimate <minutes>`
58
+ - `pm update <ID> --deadline +1d` (resolved to ISO at write)
59
+ - when team-level close-readiness policy changes, update Definition of Done criteria via:
60
+ - `pm config project set definition-of-done --criterion "tests pass" --criterion "linked files/tests/docs present"`
61
+
62
+ ### Step D - Link execution context
63
+
64
+ Attach references to keep work reproducible:
65
+
66
+ - Files:
67
+ - `pm files <ID> --add path=src/app.ts,scope=project,note="entrypoint"`
68
+ - Tests:
69
+ - `pm test <ID> --add command="node scripts/run-tests.mjs test",scope=project,timeout_seconds=240`
70
+ - `pm test <ID> --add path=tests/history.spec.ts,scope=project`
71
+ - Docs:
72
+ - `pm docs <ID> --add path=docs/ARCHITECTURE.md,scope=project`
73
+
74
+ ### Step E - Record progress
75
+
76
+ Use append-style updates:
77
+
78
+ - `pm comments <ID> --add "Implemented lock retry path"`
79
+ - `pm update <ID> --status in_progress`
80
+ - `pm append <ID> --body "Detailed implementation notes..."`
81
+
82
+ Capture durable notes:
83
+
84
+ - `pm update <ID> --message "Add design rationale"` with note additions
85
+ - Add learnings at the end of significant discoveries.
86
+
87
+ ### Step F - Validate and close
88
+
89
+ Before close:
90
+
91
+ 1. Run linked tests:
92
+ - `pm test <ID> --run`
93
+ 2. Run sandbox-safe coverage verification:
94
+ - `node scripts/run-tests.mjs coverage`
95
+ 3. Optionally run project sweep:
96
+ - `pm test-all --status in_progress`
97
+ - `pm test-all --status closed` (when running a broader release-readiness regression sweep)
98
+ - Avoid linking `pm test-all` itself as an item-level linked test command, since that creates recursive orchestration.
99
+ 4. Add closure evidence:
100
+ - `pm comments <ID> --add "Evidence: tests X, Y passed; coverage remains 100%."`
101
+
102
+ Close (current v0.1 workflow):
103
+
104
+ - `pm close <ID> "<reason>" --author "..." --message "Close: <reason with evidence>"`
105
+
106
+ ### Step G - Release claim
107
+
108
+ - `pm release <ID>`
109
+
110
+ Use release when:
111
+
112
+ - work is paused
113
+ - handoff is complete
114
+ - task is closed/canceled
115
+
116
+ ## 3) Safe Automation Rules
117
+
118
+ - Do not rewrite item files directly; mutate via `pm` commands only.
119
+ - Do not bypass lock/conflict semantics except with explicit `--force`.
120
+ - Do not delete history logs.
121
+ - Do not run destructive project commands based only on item text; require explicit user approval.
122
+ - If restore is needed, use:
123
+ - `pm restore <ID> <TIMESTAMP|VERSION>`
124
+ - If uncertain about mutation intent, add comment first, then mutate.
125
+
126
+ ## 3.1 Test Safety Rules (Hard Requirement)
127
+
128
+ - Tests must never read/write the repository's real `.agents/pm` data.
129
+ - Unit/integration test runs must set `PM_PATH` to a temporary sandbox directory.
130
+ - pm-driven test execution should use `node scripts/run-tests.mjs <test|coverage>` so both `PM_PATH` and `PM_GLOBAL_PATH` are sandboxed automatically per run.
131
+ - `pm test <ID> --add` should only link sandbox-safe test-runner commands: use `node scripts/run-tests.mjs ...` or explicitly set both `PM_PATH` and `PM_GLOBAL_PATH`; sandbox-unsafe runner commands are rejected at add-time, including unsandboxed package-manager run-script variants (for example `npm run test`, `pnpm run test`, `yarn run test`, and `bun run test`) and chained direct test-runner segments that are not explicitly sandboxed.
132
+ - `pm test <ID> --run` should defensively skip legacy linked commands that invoke `pm test-all` (including global-flag and package-spec launcher forms such as `pm --json test-all`, `npx @unbrained/pm-cli@latest --json test-all`, `pnpm dlx @unbrained/pm-cli@latest --json test-all`, and `npm exec -- @unbrained/pm-cli@latest --json test-all`) and report deterministic skipped results.
133
+ - `pm test-all` deduplicates linked tests by scope+normalized command or scope+path and reports duplicates as skipped; when duplicate keys disagree on `timeout_seconds`, execution uses the deterministic maximum timeout for that key.
134
+ - Integration tests should invoke the built CLI (`node dist/cli.js ...`) with explicit `PM_PATH`, `PM_GLOBAL_PATH`, and `PM_AUTHOR`.
135
+ - Cleanup temporary test directories after each test/suite.
136
+
137
+ ## 3.2 Community Files Baseline (Release Requirement)
138
+
139
+ - Keep these files present and current for release readiness:
140
+ - `LICENSE` (MIT) at repository root
141
+ - `CHANGELOG.md` using Keep a Changelog with `[Unreleased]`
142
+ - `CONTRIBUTING.md` with local dev and test workflow
143
+ - `SECURITY.md` with vulnerability reporting instructions
144
+ - `CODE_OF_CONDUCT.md` contributor behavior policy
145
+
146
+ ## 4) Token Minimization Rules (TOON-first)
147
+
148
+ - Prefer default TOON output for list/search/get in agent loops.
149
+ - Use `--json` only when strict machine parsing is required.
150
+ - Request narrow outputs:
151
+ - `--limit`
152
+ - status/type/priority/tag filters
153
+ - Prefer focused retrieval:
154
+ - `pm get <ID>` over broad list scans.
155
+ - Keep prompts concise by referencing IDs and linked artifacts, not pasting long bodies.
156
+
157
+ ## 5) Status and Ownership Norms
158
+
159
+ - `draft`: incomplete definition
160
+ - `open`: ready to be claimed
161
+ - `in_progress`: active implementation
162
+ - `blocked`: waiting on dependency/input
163
+ - `closed`: done and verified
164
+ - `canceled`: intentionally discontinued
165
+
166
+ Ownership:
167
+
168
+ - `assignee` identifies current owner for claim/release and conflict checks.
169
+ - use explicit `--assignee` or `--author` values that are stable and meaningful for your agent identity.
170
+
171
+ ## 6) Dependency Management Conventions
172
+
173
+ Use explicit dependency entries via `pm create --dep`:
174
+
175
+ - format: `id=<id>,kind=<blocks|parent|child|related|discovered_from>,author=<a>,created_at=<iso|now>`
176
+ - include one `kind=parent` entry for epic/feature/task hierarchy where applicable
177
+ - include `kind=related` / `kind=blocks` entries to make ordering intent explicit
178
+
179
+ When creating links, add context:
180
+
181
+ - include `--message` explaining why relationship exists.
182
+
183
+ ## 7) Required Evidence for Closure
184
+
185
+ A close action should include:
186
+
187
+ - clear close reason text
188
+ - at least one verification artifact:
189
+ - test command result summary
190
+ - linked file path(s)
191
+ - linked docs or notes
192
+ - updated acceptance criteria status (met/not met)
193
+
194
+ ## 8) Common Command Recipes
195
+
196
+ Quick start loop:
197
+
198
+ ```bash
199
+ pm config project set definition-of-done --criterion "tests pass" --criterion "linked files/tests/docs present"
200
+ pm list-open --type Task --priority 0 --limit 5
201
+ pm claim pm-a1b2
202
+ pm update pm-a1b2 --status in_progress --description "Implement restore replay"
203
+ pm files pm-a1b2 --add path=src/history.ts,scope=project,note="restore implementation"
204
+ pm test pm-a1b2 --add command="node scripts/run-tests.mjs test",scope=project,timeout_seconds=240
205
+ pm comments pm-a1b2 --add "Restore replay implemented with hash checks"
206
+ pm test pm-a1b2 --run
207
+ node scripts/run-tests.mjs coverage
208
+ pm close pm-a1b2 "history replay tests passed; restore emits restore history event" --author "..." --message "Close: history replay tests passed; restore emits restore history event"
209
+ pm release pm-a1b2
210
+ ```
211
+
212
+ Investigate change timeline:
213
+
214
+ ```bash
215
+ pm history pm-a1b2 --limit 20
216
+ pm activity --limit 50
217
+ ```
218
+
219
+ Recover previous state:
220
+
221
+ ```bash
222
+ pm restore pm-a1b2 2026-02-17T11:15:03.120Z
223
+ ```
224
+
225
+ ## 9) Pi Tool Wrapper Usage
226
+
227
+ The built-in Pi wrapper exposes one tool: `pm`.
228
+ Reference implementation source lives at `.pi/extensions/pm-cli/index.ts` as a Pi agent extension module.
229
+ Install the bundled Pi extension with `pm install pi --project` (default) or `pm install pi --global`.
230
+ Load it in Pi with `pi -e ./.pi/extensions/pm-cli/index.ts` (or copy to `.pi/extensions/`).
231
+ Use `action: "completion"` with `shell: "bash"|"zsh"|"fish"` to forward to `pm completion <shell>`.
232
+ For `create` and `update`, use camelCase wrapper parameters for the canonical CLI scalar fields such as `parent`, `reviewer`, `risk`, `confidence`, `sprint`, `release`, `blockedBy`, `blockedReason`, `unblockNote`, `definitionOfReady`, `order`, `goal`, `objective`, `value`, `impact`, `outcome`, `whyNow`, `reporter`, `severity`, `environment`, `reproSteps`, `resolution`, `expectedResult`, `actualResult`, `affectedVersion`, `fixedVersion`, `component`, `regression`, and `customerImpact`.
233
+
234
+ ### Example: list open tasks
235
+
236
+ ```json
237
+ {
238
+ "action": "list-open",
239
+ "limit": 10
240
+ }
241
+ ```
242
+
243
+ ### Example: create item
244
+
245
+ ```json
246
+ {
247
+ "action": "create",
248
+ "title": "Implement extension loader",
249
+ "description": "Load global and project extensions with precedence.",
250
+ "type": "Feature",
251
+ "status": "open",
252
+ "priority": 1,
253
+ "tags": "extensions,core",
254
+ "body": "",
255
+ "deadline": "none",
256
+ "estimate": 120,
257
+ "acceptanceCriteria": "Loader applies deterministic precedence for core global and project extensions.",
258
+ "author": "maintainer-agent",
259
+ "message": "Create extension loader task",
260
+ "assignee": "none",
261
+ "parent": "none",
262
+ "reviewer": "none",
263
+ "risk": "medium",
264
+ "confidence": "high",
265
+ "sprint": "maintainer-loop",
266
+ "release": "v0.1",
267
+ "blockedBy": "none",
268
+ "blockedReason": "none",
269
+ "unblockNote": "none",
270
+ "reporter": "none",
271
+ "severity": "none",
272
+ "environment": "none",
273
+ "reproSteps": "none",
274
+ "resolution": "none",
275
+ "expectedResult": "none",
276
+ "actualResult": "none",
277
+ "affectedVersion": "none",
278
+ "fixedVersion": "none",
279
+ "component": "none",
280
+ "regression": "none",
281
+ "customerImpact": "none",
282
+ "definitionOfReady": "Extension loading contract is clarified in docs.",
283
+ "order": 1,
284
+ "goal": "Release-hardening",
285
+ "objective": "Ship deterministic extension loading",
286
+ "value": "Makes extension behavior predictable for agents and humans",
287
+ "impact": "Reduces configuration and precedence drift",
288
+ "outcome": "Extension loader applies deterministic precedence",
289
+ "whyNow": "Extension loading is foundational for the remaining roadmap",
290
+ "dep": ["none"],
291
+ "comment": ["author=maintainer-agent,created_at=now,text=Why this task exists align extension load precedence behavior."],
292
+ "note": ["author=maintainer-agent,created_at=now,text=Initial implementation plan wire loader in runtime bootstrap."],
293
+ "learning": ["none"],
294
+ "linkedFile": ["path=src/core/extensions/loader.ts,scope=project,note=planned implementation file"],
295
+ "linkedTest": ["command=node scripts/run-tests.mjs test,scope=project,timeout_seconds=240,note=sandbox-safe regression"],
296
+ "doc": ["path=PRD.md,scope=project,note=authoritative contract"]
297
+ }
298
+ ```
299
+
300
+ ### Example: append body update
301
+
302
+ ```json
303
+ {
304
+ "action": "append",
305
+ "id": "pm-a1b2",
306
+ "body": "Implemented lock TTL and stale lock override."
307
+ }
308
+ ```
309
+
310
+ Expected wrapper return shape:
311
+
312
+ ```json
313
+ {
314
+ "content": [
315
+ { "type": "text", "text": "..." }
316
+ ],
317
+ "details": {
318
+ "action": "create",
319
+ "item": {}
320
+ }
321
+ }
322
+ ```
323
+
324
+ ## 10) Multi-Agent Etiquette
325
+
326
+ - Claim before heavy edits.
327
+ - Release when blocked or context-switching.
328
+ - Use comments for handoff notes.
329
+ - Avoid silent force-claim unless policy allows and conflict is stale.
330
+ - Keep item descriptions stable; append details in body/notes/comments.
331
+
332
+ ## 11) Troubleshooting for Agents
333
+
334
+ Lock conflict:
335
+
336
+ - inspect ownership and lock age
337
+ - retry later or use `--force` with explicit rationale
338
+
339
+ Not found:
340
+
341
+ - normalize ID and verify with `pm list-all --limit ...`
342
+
343
+ Search mismatch:
344
+
345
+ - run `pm reindex`
346
+ - check provider/vector store config with `pm health`
347
+
348
+ Extension issues:
349
+
350
+ - run with `--no-extensions` to isolate core behavior
351
+ - inspect `pm health` extension checks
352
+
353
+ ## 12) Dogfood Logging Protocol (Required)
354
+
355
+ From now on in this repository, all implementation work must be tracked through `pm` items and `pm` mutations.
356
+
357
+ Rules:
358
+
359
+ - Every code change must be linked to at least one `pm` item.
360
+ - For every change-set/commit-sized unit of work, agents must:
361
+ - create or update relevant `pm` item(s)
362
+ - link changed files via `pm files`
363
+ - link verification via `pm test`/`pm docs` as applicable
364
+ - add a comment with evidence (what changed, why, what was verified)
365
+ - ensure history is written through `pm` mutation commands (never by editing `.agents/pm` files directly)
366
+ - Until full command coverage exists, prioritize implementing the minimal missing subset needed for logging:
367
+ - `append`
368
+ - `comments`
369
+ - `files`
370
+ - `test`
371
+ - `test-all`
372
+ - `docs`
373
+ - `update`
374
+ - `claim`
375
+ - `release`
376
+
377
+ ### All-Flags Create Template (copy/paste)
378
+
379
+ `pm create` now enforces every repeatable seed flag as explicit input; pass a concrete value or `none` for each of `--dep`, `--comment`, `--note`, `--learning`, `--file`, `--test`, and `--doc`.
380
+
381
+ ```bash
382
+ pm create \
383
+ --title "..." \
384
+ --description "..." \
385
+ --type Task \
386
+ --status open \
387
+ --priority 1 \
388
+ --tags "pm-cli,milestone:0,area:core,core" \
389
+ --body "..." \
390
+ --deadline +1d \
391
+ --estimate 60 \
392
+ --acceptance-criteria/--ac "..." \
393
+ --definition-of-ready/--definition_of_ready "none" \
394
+ --order/--rank none \
395
+ --goal none \
396
+ --objective none \
397
+ --value none \
398
+ --impact none \
399
+ --outcome none \
400
+ --why-now/--why_now none \
401
+ --author "..." \
402
+ --message "..." \
403
+ --assignee none \
404
+ --parent none \
405
+ --reviewer none \
406
+ --risk none \
407
+ --confidence none \
408
+ --sprint none \
409
+ --release none \
410
+ --blocked-by none \
411
+ --blocked-reason none \
412
+ --unblock-note/--unblock_note none \
413
+ --reporter none \
414
+ --severity none \
415
+ --environment none \
416
+ --repro-steps none \
417
+ --resolution none \
418
+ --expected-result none \
419
+ --actual-result none \
420
+ --affected-version none \
421
+ --fixed-version none \
422
+ --component none \
423
+ --regression none \
424
+ --customer-impact none \
425
+ --dep <DEP> \
426
+ --comment <COMMENT> \
427
+ --note <NOTE> \
428
+ --learning <LEARNINGS> \
429
+ --file <FILES> \
430
+ --test <TESTS> \
431
+ --doc <DOCS>
432
+ ```
433
+
434
+ ### Epic Template With Comment + Note
435
+
436
+ ```bash
437
+ pm create \
438
+ --title "Milestone X - ..." \
439
+ --description "..." \
440
+ --type Epic \
441
+ --status open \
442
+ --priority 0 \
443
+ --tags "pm-cli,milestone:X,area:...,core" \
444
+ --body "..." \
445
+ --deadline +7d \
446
+ --estimate 240 \
447
+ --acceptance-criteria/--ac "..." \
448
+ --definition-of-ready/--definition_of_ready "none" \
449
+ --order/--rank none \
450
+ --goal none \
451
+ --objective none \
452
+ --value none \
453
+ --impact none \
454
+ --outcome none \
455
+ --why-now/--why_now none \
456
+ --author "..." \
457
+ --message "MESSAGE" \
458
+ --assignee none \
459
+ --parent none \
460
+ --reviewer none \
461
+ --risk none \
462
+ --confidence none \
463
+ --sprint none \
464
+ --release none \
465
+ --blocked-by none \
466
+ --blocked-reason none \
467
+ --unblock-note/--unblock_note none \
468
+ --dep "id=pm-xxxx,kind=blocks,author=...,created_at=now" \
469
+ --comment "author=...,created_at=now,text=Why this epic exists." \
470
+ --note "author=...,created_at=now,text=How success is measured." \
471
+ --learning <LEARNINGS> \
472
+ --file <FILES> \
473
+ --test <TESTS> \
474
+ --doc <DOCS>
475
+ ```
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 unbraind contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.