@poa-box/agent 0.1.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.
Files changed (139) hide show
  1. package/.env.agent.template +20 -0
  2. package/README.md +46 -0
  3. package/brain/Config/agent-config.json +14 -0
  4. package/brain/Config/brain-allowlist.json +20 -0
  5. package/brain/Identity/goals.template.md +23 -0
  6. package/brain/Identity/how-i-think.md +406 -0
  7. package/brain/Identity/who-i-am.template.md +34 -0
  8. package/brain/Knowledge/BOOTSTRAP.md +66 -0
  9. package/brain/Knowledge/audit-corpus-index.json +406 -0
  10. package/brain/Knowledge/discussions.json +245 -0
  11. package/brain/Knowledge/pop.brain.brainstorms.generated.md +48 -0
  12. package/brain/Knowledge/pop.brain.brainstorms.genesis.bin +0 -0
  13. package/brain/Knowledge/pop.brain.heuristics.snapshot.bin +0 -0
  14. package/brain/Knowledge/pop.brain.projects.generated.md +16 -0
  15. package/brain/Knowledge/pop.brain.projects.genesis.bin +0 -0
  16. package/brain/Knowledge/pop.brain.retros.generated.md +91 -0
  17. package/brain/Knowledge/pop.brain.retros.genesis.bin +0 -0
  18. package/brain/Knowledge/pop.brain.shared.generated.md +3811 -0
  19. package/brain/Knowledge/pop.brain.shared.genesis.bin +0 -0
  20. package/brain/Knowledge/projects.md +181 -0
  21. package/brain/Knowledge/risk-framework.md +90 -0
  22. package/brain/Knowledge/shared.md +416 -0
  23. package/brain/Knowledge/sprint-priorities.md +439 -0
  24. package/brain/Memory/.gitkeep +0 -0
  25. package/dist/commands/agent/daily-digest.d.ts +24 -0
  26. package/dist/commands/agent/daily-digest.js +336 -0
  27. package/dist/commands/agent/delegate.d.ts +12 -0
  28. package/dist/commands/agent/delegate.js +91 -0
  29. package/dist/commands/agent/deploy-to-org.d.ts +20 -0
  30. package/dist/commands/agent/deploy-to-org.js +154 -0
  31. package/dist/commands/agent/index.d.ts +2 -0
  32. package/dist/commands/agent/index.js +27 -0
  33. package/dist/commands/agent/init.d.ts +19 -0
  34. package/dist/commands/agent/init.js +303 -0
  35. package/dist/commands/agent/onboard.d.ts +22 -0
  36. package/dist/commands/agent/onboard.js +192 -0
  37. package/dist/commands/agent/paymaster-status.d.ts +14 -0
  38. package/dist/commands/agent/paymaster-status.js +130 -0
  39. package/dist/commands/agent/register.d.ts +21 -0
  40. package/dist/commands/agent/register.js +116 -0
  41. package/dist/commands/agent/setup-sponsorship.d.ts +22 -0
  42. package/dist/commands/agent/setup-sponsorship.js +154 -0
  43. package/dist/commands/agent/status.d.ts +12 -0
  44. package/dist/commands/agent/status.js +171 -0
  45. package/dist/commands/agent/triage.d.ts +12 -0
  46. package/dist/commands/agent/triage.js +503 -0
  47. package/dist/commands/brain/advance-stage.d.ts +42 -0
  48. package/dist/commands/brain/advance-stage.js +206 -0
  49. package/dist/commands/brain/allowlist.d.ts +30 -0
  50. package/dist/commands/brain/allowlist.js +274 -0
  51. package/dist/commands/brain/append-lesson.d.ts +55 -0
  52. package/dist/commands/brain/append-lesson.js +245 -0
  53. package/dist/commands/brain/brainstorm.d.ts +154 -0
  54. package/dist/commands/brain/brainstorm.js +573 -0
  55. package/dist/commands/brain/daemon.d.ts +31 -0
  56. package/dist/commands/brain/daemon.js +348 -0
  57. package/dist/commands/brain/doctor.d.ts +27 -0
  58. package/dist/commands/brain/doctor.js +497 -0
  59. package/dist/commands/brain/edit-lesson.d.ts +51 -0
  60. package/dist/commands/brain/edit-lesson.js +248 -0
  61. package/dist/commands/brain/import-snapshot.d.ts +68 -0
  62. package/dist/commands/brain/import-snapshot.js +177 -0
  63. package/dist/commands/brain/index.d.ts +2 -0
  64. package/dist/commands/brain/index.js +67 -0
  65. package/dist/commands/brain/list.d.ts +21 -0
  66. package/dist/commands/brain/list.js +83 -0
  67. package/dist/commands/brain/migrate-projects.d.ts +44 -0
  68. package/dist/commands/brain/migrate-projects.js +209 -0
  69. package/dist/commands/brain/migrate.d.ts +74 -0
  70. package/dist/commands/brain/migrate.js +306 -0
  71. package/dist/commands/brain/new-project.d.ts +53 -0
  72. package/dist/commands/brain/new-project.js +226 -0
  73. package/dist/commands/brain/read.d.ts +24 -0
  74. package/dist/commands/brain/read.js +81 -0
  75. package/dist/commands/brain/remove-lesson.d.ts +47 -0
  76. package/dist/commands/brain/remove-lesson.js +206 -0
  77. package/dist/commands/brain/remove-project.d.ts +36 -0
  78. package/dist/commands/brain/remove-project.js +177 -0
  79. package/dist/commands/brain/retro-file-tasks.d.ts +84 -0
  80. package/dist/commands/brain/retro-file-tasks.js +372 -0
  81. package/dist/commands/brain/retro-list.d.ts +28 -0
  82. package/dist/commands/brain/retro-list.js +125 -0
  83. package/dist/commands/brain/retro-mark-change.d.ts +58 -0
  84. package/dist/commands/brain/retro-mark-change.js +176 -0
  85. package/dist/commands/brain/retro-remove.d.ts +36 -0
  86. package/dist/commands/brain/retro-remove.js +142 -0
  87. package/dist/commands/brain/retro-respond.d.ts +56 -0
  88. package/dist/commands/brain/retro-respond.js +250 -0
  89. package/dist/commands/brain/retro-show.d.ts +23 -0
  90. package/dist/commands/brain/retro-show.js +100 -0
  91. package/dist/commands/brain/retro-start.d.ts +55 -0
  92. package/dist/commands/brain/retro-start.js +311 -0
  93. package/dist/commands/brain/search.d.ts +48 -0
  94. package/dist/commands/brain/search.js +190 -0
  95. package/dist/commands/brain/snapshot.d.ts +32 -0
  96. package/dist/commands/brain/snapshot.js +243 -0
  97. package/dist/commands/brain/status.d.ts +15 -0
  98. package/dist/commands/brain/status.js +166 -0
  99. package/dist/commands/brain/subscribe.d.ts +28 -0
  100. package/dist/commands/brain/subscribe.js +90 -0
  101. package/dist/commands/brain/tag.d.ts +46 -0
  102. package/dist/commands/brain/tag.js +192 -0
  103. package/dist/index.d.ts +17 -0
  104. package/dist/index.js +22 -0
  105. package/dist/lib/brain-daemon.d.ts +126 -0
  106. package/dist/lib/brain-daemon.js +811 -0
  107. package/dist/lib/brain-membership.d.ts +58 -0
  108. package/dist/lib/brain-membership.js +115 -0
  109. package/dist/lib/brain-migrate-projects.d.ts +43 -0
  110. package/dist/lib/brain-migrate-projects.js +247 -0
  111. package/dist/lib/brain-migrate.d.ts +77 -0
  112. package/dist/lib/brain-migrate.js +328 -0
  113. package/dist/lib/brain-ops.d.ts +271 -0
  114. package/dist/lib/brain-ops.js +571 -0
  115. package/dist/lib/brain-paths.d.ts +15 -0
  116. package/dist/lib/brain-paths.js +33 -0
  117. package/dist/lib/brain-projections.d.ts +216 -0
  118. package/dist/lib/brain-projections.js +829 -0
  119. package/dist/lib/brain-schemas.d.ts +36 -0
  120. package/dist/lib/brain-schemas.js +316 -0
  121. package/dist/lib/brain-signing.d.ts +103 -0
  122. package/dist/lib/brain-signing.js +256 -0
  123. package/dist/lib/brain.d.ts +198 -0
  124. package/dist/lib/brain.js +1057 -0
  125. package/dist/pop-agent.d.ts +1 -0
  126. package/dist/pop-agent.js +18 -0
  127. package/docs/agent.md +126 -0
  128. package/docs/agents/brain-anti-entropy.md +127 -0
  129. package/docs/agents/brain-cross-device-onboarding.md +210 -0
  130. package/docs/agents/brain-cross-machine-smoke.md +241 -0
  131. package/docs/agents/brain-layer-setup.md +725 -0
  132. package/docs/agents/offboarding-protocol.md +188 -0
  133. package/docs/agents/onboarding-protocol.md +243 -0
  134. package/docs/agents/running-an-agent.md +200 -0
  135. package/docs/brain.md +560 -0
  136. package/package.json +61 -0
  137. package/scripts/apply.sh +140 -0
  138. package/scripts/onboard.sh +205 -0
  139. package/scripts/setup-agent.ts +272 -0
package/docs/brain.md ADDED
@@ -0,0 +1,560 @@
1
+ <!-- AUTO-GENERATED by scripts/generate-cli-docs.ts — do not edit. Regenerate: yarn docs:gen -->
2
+
3
+ # pop brain
4
+
5
+ P2P CRDT brain layer (live-sync knowledge)
6
+
7
+ ## pop brain status
8
+
9
+ Show local brain layer state (Helia + CRDT sync)
10
+
11
+ ```text
12
+ pop brain status [flags]
13
+ ```
14
+
15
+ ## pop brain subscribe
16
+
17
+ Subscribe to a doc topic; fetch + merge announced blocks (or --log-only)
18
+
19
+ ```text
20
+ pop brain subscribe [flags]
21
+ ```
22
+
23
+ | Flag | Type | Required | Default | Description |
24
+ | --- | --- | --- | --- | --- |
25
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
26
+ | `--log-only` | boolean | no | `false` | Only log announcements — do NOT fetch blocks or update manifest |
27
+
28
+ ## pop brain read
29
+
30
+ Load a brain doc from local state and print its contents
31
+
32
+ ```text
33
+ pop brain read [flags]
34
+ ```
35
+
36
+ | Flag | Type | Required | Default | Description |
37
+ | --- | --- | --- | --- | --- |
38
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
39
+
40
+ ## pop brain list
41
+
42
+ List all known brain docs with their current head CIDs
43
+
44
+ ```text
45
+ pop brain list [flags]
46
+ ```
47
+
48
+ ## pop brain snapshot
49
+
50
+ Project a brain doc to markdown on disk (step 7)
51
+
52
+ ```text
53
+ pop brain snapshot [flags]
54
+ ```
55
+
56
+ | Flag | Type | Required | Default | Description |
57
+ | --- | --- | --- | --- | --- |
58
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
59
+ | `--force` | boolean | no | `false` | Overwrite the existing generated.md even if it would regress (fewer lessons/projects than the file currently on disk). Use only when you know local state is authoritative. |
60
+ | `--output-path` | string | no | - | Explicit output path (default: agent/brain/Knowledge/<doc>.generated.md) |
61
+
62
+ ## pop brain migrate
63
+
64
+ Import a hand-written markdown file into a brain doc (step 8)
65
+
66
+ ```text
67
+ pop brain migrate [flags]
68
+ ```
69
+
70
+ | Flag | Type | Required | Default | Description |
71
+ | --- | --- | --- | --- | --- |
72
+ | `--author` | string | no | `migration` | Default author for sections without explicit attribution |
73
+ | `--current-hb` | number | no | `270` | Current heartbeat number for HB#→timestamp estimation (default 270) |
74
+ | `--doc` | string | yes | - | Target brain document ID (e.g. pop.brain.shared) |
75
+ | `--dry-run` | boolean | no | `false` | Parse and print the structured output without persisting |
76
+ | `--force` | boolean | no | `false` | Re-migrate even if the target doc already has content (DESTRUCTIVE: clears existing lessons/rules before re-seeding) |
77
+ | `--from` | string | yes | - | Path to the hand-written markdown file to migrate |
78
+ | `--merge` | boolean | no | `false` | Non-destructive append: migrate new entries into an existing doc, deduping by id (mutually exclusive with --force) |
79
+ | `--no-banner` | boolean | no | `false` | Do NOT write a DEPRECATED banner to the source file after migration |
80
+
81
+ ## pop brain append-lesson
82
+
83
+ Append a lesson to a brain doc (signed + gossipsub-published)
84
+
85
+ ```text
86
+ pop brain append-lesson [flags]
87
+ ```
88
+
89
+ | Flag | Type | Required | Default | Description |
90
+ | --- | --- | --- | --- | --- |
91
+ | `--allow-invalid-shape` | boolean | no | `false` | Bypass write-time schema validation (Task #346). Use only when you deliberately need a non-canonical shape. |
92
+ | `--author` | string | no | - | Override the author name (default: signing wallet address) |
93
+ | `--body` | string | no | - | Lesson body text (inline). Prefer --body-file for multi-paragraph content. |
94
+ | `--body-file` | string | no | - | Path to a file whose contents will be used as the lesson body |
95
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
96
+ | `--id` | string | no | - | Override the auto-generated lesson id |
97
+ | `--idempotency-key` | string | no | - | Task #370 (HB#214): explicit idempotency key. Two identical append-lesson calls within 15 minutes return the same result without re-submitting. Default: auto-derived from argv (title + body + docId). Scope: author address (brain writes are agent-scoped not org-scoped). |
98
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache and always submit a new lesson. |
99
+ | `--title` | string | yes | - | Short title for the lesson (used as the markdown header + default id) |
100
+
101
+ ## pop brain edit-lesson
102
+
103
+ Update fields on an existing brain lesson (in-place)
104
+
105
+ ```text
106
+ pop brain edit-lesson [flags]
107
+ ```
108
+
109
+ | Flag | Type | Required | Default | Description |
110
+ | --- | --- | --- | --- | --- |
111
+ | `--allow-invalid-shape` | boolean | no | `false` | Bypass write-time schema validation (Task #346). |
112
+ | `--author` | string | no | - | Override the author label |
113
+ | `--body` | string | no | - | New body (inline) |
114
+ | `--body-file` | string | no | - | Path to a file whose contents replace the body |
115
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
116
+ | `--idempotency-key` | string | no | - | Task #374 (HB#215): explicit idempotency key. Agent-scoped. |
117
+ | `--lesson-id` | string | yes | - | The lesson.id of the entry to update |
118
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
119
+ | `--title` | string | no | - | New title |
120
+ | `--touch` | boolean | no | `false` | Bump the lesson.timestamp to now on edit (default: preserve original timestamp) |
121
+
122
+ ## pop brain remove-lesson
123
+
124
+ Soft-delete a brain lesson (tombstone; filtered from snapshot output)
125
+
126
+ ```text
127
+ pop brain remove-lesson [flags]
128
+ ```
129
+
130
+ | Flag | Type | Required | Default | Description |
131
+ | --- | --- | --- | --- | --- |
132
+ | `--allow-invalid-shape` | boolean | no | `false` | Bypass write-time schema validation (Task #346). |
133
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
134
+ | `--idempotency-key` | string | no | - | Task #374 (HB#215): explicit idempotency key. Agent-scoped. |
135
+ | `--lesson-id` | string | yes | - | The lesson.id to tombstone |
136
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
137
+ | `--reason` | string | no | - | Optional human-readable reason recorded on the tombstone |
138
+
139
+ ## pop brain search
140
+
141
+ Filter lessons in a brain doc by query / tag / author / timestamp
142
+
143
+ ```text
144
+ pop brain search [flags]
145
+ ```
146
+
147
+ | Flag | Type | Required | Default | Description |
148
+ | --- | --- | --- | --- | --- |
149
+ | `--author` | string | no | - | Filter to lessons by this author address (0x lowercase) |
150
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
151
+ | `--limit` | number | no | `10` | Max number of lessons to return (default 10) |
152
+ | `--query` | string | no | - | Case-insensitive substring match over title + body |
153
+ | `--since-ts` | number | no | - | Only lessons with timestamp >= this unix-seconds value |
154
+ | `--tag` | string | no | - | Filter to lessons whose tags include this exact string |
155
+
156
+ ## pop brain tag
157
+
158
+ Add or remove tags on an existing brain lesson
159
+
160
+ ```text
161
+ pop brain tag [flags]
162
+ ```
163
+
164
+ | Flag | Type | Required | Default | Description |
165
+ | --- | --- | --- | --- | --- |
166
+ | `--add` | string | no | - | Comma-separated list of tags to add |
167
+ | `--allow-invalid-shape` | boolean | no | `false` | Bypass write-time schema validation (Task #346). |
168
+ | `--doc` | string | yes | - | Brain document ID (e.g. pop.brain.shared) |
169
+ | `--idempotency-key` | string | no | - | Task #374 (HB#215): explicit idempotency key. Agent-scoped. |
170
+ | `--lesson-id` | string | yes | - | The lesson.id of the entry to tag |
171
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
172
+ | `--remove` | string | no | - | Comma-separated list of tags to remove |
173
+
174
+ ## pop brain brainstorm-start
175
+
176
+ Open a new cross-agent brainstorm (task #354 — forward-looking ideation surface)
177
+
178
+ ```text
179
+ pop brain brainstorm-start [flags]
180
+ ```
181
+
182
+ | Flag | Type | Required | Default | Description |
183
+ | --- | --- | --- | --- | --- |
184
+ | `--author` | string | no | - | Override the author address (default: signing wallet) |
185
+ | `--doc` | string | no | `pop.brain.brainstorms` | Brain document ID (default: pop.brain.brainstorms) |
186
+ | `--id` | string | no | - | Override the auto-generated brainstorm id |
187
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
188
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
189
+ | `--prompt` | string | yes | - | Longer description / question being brainstormed |
190
+ | `--title` | string | yes | - | Short brainstorm title (used as default slug for id) |
191
+ | `--window-from-hb` | number | no | - | Starting HB number of the brainstorm window |
192
+ | `--window-to-hb` | number | no | - | Ending HB number of the brainstorm window |
193
+
194
+ ## pop brain brainstorm-respond
195
+
196
+ Post a message, add an idea, or cast votes on an existing brainstorm
197
+
198
+ ```text
199
+ pop brain brainstorm-respond [flags]
200
+ ```
201
+
202
+ | Flag | Type | Required | Default | Description |
203
+ | --- | --- | --- | --- | --- |
204
+ | `--add-idea` | string | no | - | Add a new idea with this text (id auto-generated from a slug) |
205
+ | `--author` | string | no | - | Override the author address |
206
+ | `--doc` | string | no | `pop.brain.brainstorms` | - |
207
+ | `--id` | string | yes | - | Brainstorm id to respond to |
208
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
209
+ | `--message` | string | no | - | Free-form discussion message to post |
210
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
211
+ | `--vote` | array | no | - | Cast a vote: <idea-id>=<support\|explore\|oppose>. Repeatable. |
212
+
213
+ ## pop brain brainstorm-promote
214
+
215
+ Promote a brainstorm idea to a pop.brain.projects entry (link via promotedToProjectIds)
216
+
217
+ ```text
218
+ pop brain brainstorm-promote [flags]
219
+ ```
220
+
221
+ | Flag | Type | Required | Default | Description |
222
+ | --- | --- | --- | --- | --- |
223
+ | `--author` | string | no | - | Override the author address |
224
+ | `--doc` | string | no | `pop.brain.brainstorms` | - |
225
+ | `--id` | string | yes | - | Brainstorm id containing the idea to promote |
226
+ | `--idea-id` | string | yes | - | Idea id to promote to a brain project |
227
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
228
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
229
+ | `--project-id` | string | yes | - | Existing pop.brain.projects id to link to (create the project via `pop brain new-project` first) |
230
+
231
+ ## pop brain brainstorm-close
232
+
233
+ Close a brainstorm without promoting any idea
234
+
235
+ ```text
236
+ pop brain brainstorm-close [flags]
237
+ ```
238
+
239
+ | Flag | Type | Required | Default | Description |
240
+ | --- | --- | --- | --- | --- |
241
+ | `--author` | string | no | - | - |
242
+ | `--doc` | string | no | `pop.brain.brainstorms` | - |
243
+ | `--id` | string | yes | - | Brainstorm id to close |
244
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
245
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
246
+ | `--reason` | string | no | - | Reason for closing without promoting |
247
+
248
+ ## pop brain brainstorm-remove
249
+
250
+ Soft-delete a brainstorm (tombstone; filtered from projection output)
251
+
252
+ ```text
253
+ pop brain brainstorm-remove [flags]
254
+ ```
255
+
256
+ | Flag | Type | Required | Default | Description |
257
+ | --- | --- | --- | --- | --- |
258
+ | `--author` | string | no | - | - |
259
+ | `--doc` | string | no | `pop.brain.brainstorms` | - |
260
+ | `--id` | string | yes | - | Brainstorm id to soft-delete |
261
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
262
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
263
+ | `--reason` | string | no | - | Removal reason |
264
+
265
+ ## pop brain new-project
266
+
267
+ Create a project entry in pop.brain.projects (signed + gossipsub-published)
268
+
269
+ ```text
270
+ pop brain new-project [flags]
271
+ ```
272
+
273
+ | Flag | Type | Required | Default | Description |
274
+ | --- | --- | --- | --- | --- |
275
+ | `--brief` | string | no | - | Inline project brief (short form) |
276
+ | `--brief-file` | string | no | - | Path to a file whose contents are used as the brief |
277
+ | `--doc` | string | yes | - | Target brain document ID (typically pop.brain.projects) |
278
+ | `--id` | string | no | - | Override the auto-generated project id |
279
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. Agent-scoped. |
280
+ | `--name` | string | yes | - | Project name (used as the markdown header + default id base) |
281
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
282
+ | `--proposed-by` | string | no | - | Override the proposer label (default: signing wallet address) |
283
+ | `--stage` | string | no | `propose` | Starting lifecycle stage (choices: `propose`, `discuss`, `plan`, `vote`, `execute`, `review`, `ship`) |
284
+
285
+ ## pop brain advance-stage
286
+
287
+ Move a project forward in the lifecycle (propose → discuss → ... → ship)
288
+
289
+ ```text
290
+ pop brain advance-stage [flags]
291
+ ```
292
+
293
+ | Flag | Type | Required | Default | Description |
294
+ | --- | --- | --- | --- | --- |
295
+ | `--doc` | string | yes | - | Brain document ID (typically pop.brain.projects) |
296
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. Agent-scoped. |
297
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
298
+ | `--project-id` | string | yes | - | The project.id to advance |
299
+ | `--to` | string | no | - | Explicit target stage (default: next stage in canonical order) (choices: `propose`, `discuss`, `plan`, `vote`, `execute`, `review`, `ship`) |
300
+
301
+ ## pop brain remove-project
302
+
303
+ Soft-delete a project entry (tombstone; filtered from snapshot output)
304
+
305
+ ```text
306
+ pop brain remove-project [flags]
307
+ ```
308
+
309
+ | Flag | Type | Required | Default | Description |
310
+ | --- | --- | --- | --- | --- |
311
+ | `--doc` | string | yes | - | Brain document ID (typically pop.brain.projects) |
312
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
313
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
314
+ | `--project-id` | string | yes | - | The project.id to tombstone |
315
+ | `--reason` | string | no | - | Optional human-readable reason recorded on the tombstone |
316
+
317
+ ## pop brain allowlist
318
+
319
+ Manage the brain allowlist (list/add/remove)
320
+
321
+ ```text
322
+ pop brain allowlist <action> [flags]
323
+ ```
324
+
325
+ | Positional | Type | Required | Default | Description |
326
+ | --- | --- | --- | --- | --- |
327
+ | `<action>` | - | yes | - | - |
328
+
329
+ ### pop brain allowlist list
330
+
331
+ Show current brain allowlist entries
332
+
333
+ ```text
334
+ pop brain allowlist list [flags]
335
+ ```
336
+
337
+ ### pop brain allowlist add
338
+
339
+ Add an address to the brain allowlist
340
+
341
+ ```text
342
+ pop brain allowlist add [flags]
343
+ ```
344
+
345
+ | Flag | Type | Required | Default | Description |
346
+ | --- | --- | --- | --- | --- |
347
+ | `--address` | string | yes | - | 0x-prefixed 40-char hex address to allowlist |
348
+ | `--name` | string | no | - | Human label (e.g. agent username) |
349
+ | `--note` | string | no | - | Optional addedNote field recorded on the entry |
350
+
351
+ ### pop brain allowlist remove
352
+
353
+ Remove an address from the brain allowlist
354
+
355
+ ```text
356
+ pop brain allowlist remove [flags]
357
+ ```
358
+
359
+ | Flag | Type | Required | Default | Description |
360
+ | --- | --- | --- | --- | --- |
361
+ | `--address` | string | yes | - | 0x-prefixed 40-char hex address to remove |
362
+
363
+ ## pop brain migrate-projects
364
+
365
+ Import projects.md into a pop.brain.projects doc (sprint-3 follow-up to step 8)
366
+
367
+ ```text
368
+ pop brain migrate-projects [flags]
369
+ ```
370
+
371
+ | Flag | Type | Required | Default | Description |
372
+ | --- | --- | --- | --- | --- |
373
+ | `--author` | string | no | `migration` | Default author for projects without explicit attribution |
374
+ | `--current-hb` | number | no | `285` | Current heartbeat number for HB#→timestamp estimation (default 285) |
375
+ | `--doc` | string | yes | - | Target brain document ID (typically pop.brain.projects) |
376
+ | `--dry-run` | boolean | no | `false` | Parse and print the structured output without persisting |
377
+ | `--force` | boolean | no | `false` | Re-migrate even if the target doc already has live projects |
378
+ | `--from` | string | yes | - | Path to the hand-written projects.md to migrate |
379
+ | `--no-banner` | boolean | no | `false` | Do NOT write a DEPRECATED banner to the source file after migration |
380
+
381
+ ## pop brain doctor
382
+
383
+ Health check for brain layer setup (env, keys, libp2p init, allowlist, manifest)
384
+
385
+ ```text
386
+ pop brain doctor [flags]
387
+ ```
388
+
389
+ ## pop brain import-snapshot
390
+
391
+ Load a raw Automerge snapshot file as the new local head for a brain doc (#353 migration tool for converging disjoint agents onto a shared baseline)
392
+
393
+ ```text
394
+ pop brain import-snapshot [flags]
395
+ ```
396
+
397
+ | Flag | Type | Required | Default | Description |
398
+ | --- | --- | --- | --- | --- |
399
+ | `--allow-invalid-shape` | boolean | no | `false` | Bypass write-time schema validation (#346). Use only when the source bytes deliberately contain a non-canonical shape. |
400
+ | `--doc` | string | yes | - | Target brain document ID (e.g. pop.brain.shared) |
401
+ | `--file` | string | yes | - | Path to the raw Automerge snapshot bytes to import (.bin file produced by Automerge.save()) |
402
+ | `--force` | boolean | no | `false` | Required when a local head already exists for this doc. The existing head becomes orphaned (old envelope stays in blockstore but manifest no longer points at it). Back up local-only content via `pop brain read --doc <id> --json` BEFORE using this flag. |
403
+
404
+ ## pop brain daemon
405
+
406
+ Manage the persistent brain daemon (start/stop/status/logs) — keeps libp2p alive so gossipsub announcements actually propagate
407
+
408
+ ```text
409
+ pop brain daemon <action> [flags]
410
+ ```
411
+
412
+ | Positional | Type | Required | Default | Description |
413
+ | --- | --- | --- | --- | --- |
414
+ | `<action>` | string | yes | - | Daemon action (choices: `start`, `stop`, `status`, `logs`, `__run`) |
415
+
416
+ | Flag | Type | Required | Default | Description |
417
+ | --- | --- | --- | --- | --- |
418
+ | `--follow`, `-f` | boolean | no | `false` | Follow the log file (logs subcommand only) |
419
+ | `--tail`, `-n` | number | no | `50` | Number of log lines to print (logs subcommand only) |
420
+
421
+ ## pop brain retro
422
+
423
+ Manage session retros in pop.brain.retros (start/list/show) — recurring self-reflection cycles with proposed changes and cross-agent discussion
424
+
425
+ ```text
426
+ pop brain retro <action> [flags]
427
+ ```
428
+
429
+ | Positional | Type | Required | Default | Description |
430
+ | --- | --- | --- | --- | --- |
431
+ | `<action>` | - | yes | - | - |
432
+
433
+ ### pop brain retro start
434
+
435
+ Start a new retro with observations + proposed changes
436
+
437
+ ```text
438
+ pop brain retro start [flags]
439
+ ```
440
+
441
+ | Flag | Type | Required | Default | Description |
442
+ | --- | --- | --- | --- | --- |
443
+ | `--author` | string | no | - | Override the author label (default: signing wallet address) |
444
+ | `--changes-file` | string | yes | - | JSON or markdown file listing proposed changes. JSON: array of {id, summary, details?}. Markdown: bullet list with `- **id** — summary`. |
445
+ | `--doc` | string | no | `pop.brain.retros` | Target brain document ID (default: pop.brain.retros) |
446
+ | `--hb` | number | no | - | Heartbeat number at retro start (default: window-to) |
447
+ | `--id` | string | no | - | Override the auto-generated retro id (default: retro-<hb>-<unix>) |
448
+ | `--observations-file` | string | no | - | Markdown file with `## What worked` and `## What didn't work` sections |
449
+ | `--window-from` | number | yes | - | First HB number covered by this retro |
450
+ | `--window-to` | number | yes | - | Last HB number covered by this retro |
451
+
452
+ ### pop brain retro list
453
+
454
+ List retros in pop.brain.retros (optionally filter by --status)
455
+
456
+ ```text
457
+ pop brain retro list [flags]
458
+ ```
459
+
460
+ | Flag | Type | Required | Default | Description |
461
+ | --- | --- | --- | --- | --- |
462
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
463
+ | `--status` | string | no | - | Filter by retro status (choices: `open`, `discussed`, `shipped`) |
464
+
465
+ ### pop brain retro show
466
+
467
+ Render a single retro as markdown
468
+
469
+ ```text
470
+ pop brain retro show <retro-id> [flags]
471
+ ```
472
+
473
+ | Positional | Type | Required | Default | Description |
474
+ | --- | --- | --- | --- | --- |
475
+ | `<retro-id>` | string | yes | - | The retro.id to show |
476
+
477
+ | Flag | Type | Required | Default | Description |
478
+ | --- | --- | --- | --- | --- |
479
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
480
+
481
+ ### pop brain retro respond
482
+
483
+ Append a discussion entry (optionally with per-change votes) to an open retro
484
+
485
+ ```text
486
+ pop brain retro respond [flags]
487
+ ```
488
+
489
+ | Flag | Type | Required | Default | Description |
490
+ | --- | --- | --- | --- | --- |
491
+ | `--author` | string | no | - | Override the author label (default: signing wallet address) |
492
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
493
+ | `--hb` | number | no | - | Heartbeat number at response time (optional metadata) |
494
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
495
+ | `--message` | string | no | - | The response message (inline). Use --message-file for long content. |
496
+ | `--message-file` | string | no | - | Path to a file whose contents are the response message |
497
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
498
+ | `--to` | string | yes | - | The retro.id to respond to |
499
+ | `--vote` | string | no | - | Per-change votes as "change-id=vote,change-id=vote" (votes: agree, modify, reject). Example: change-1=agree,change-2=modify |
500
+
501
+ ### pop brain retro file-tasks
502
+
503
+ Convert agreed retro changes into on-chain tasks (idempotent)
504
+
505
+ ```text
506
+ pop brain retro file-tasks [flags]
507
+ ```
508
+
509
+ | Flag | Type | Required | Default | Description |
510
+ | --- | --- | --- | --- | --- |
511
+ | `--difficulty` | string | no | `medium` | Difficulty label for filed tasks (choices: `easy`, `medium`, `hard`) |
512
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
513
+ | `--dry-run` | boolean | no | `false` | Preview what would be filed without creating tasks or mutating the retro |
514
+ | `--est-hours` | number | no | `2` | Estimated hours per filed task |
515
+ | `--payout` | number | no | `10` | PT payout per filed task (default: 10) |
516
+ | `--project` | string | no | `CLI Infrastructure` | Target project for the new tasks (default: "CLI Infrastructure") |
517
+ | `--retro` | string | yes | - | The retro.id whose agreed changes should be filed as tasks |
518
+ | `--yes`, `-y` | boolean | no | `true` | Skip confirmation prompts on the underlying pop task create calls |
519
+
520
+ ### pop brain retro mark-change
521
+
522
+ Manually set a proposed-change status (e.g. agreed / rejected / modified) before running file-tasks
523
+
524
+ ```text
525
+ pop brain retro mark-change <retro-id> <change-id> [flags]
526
+ ```
527
+
528
+ | Positional | Type | Required | Default | Description |
529
+ | --- | --- | --- | --- | --- |
530
+ | `<retro-id>` | string | yes | - | The retro.id containing the change |
531
+ | `<change-id>` | string | yes | - | The proposed-change id to update |
532
+
533
+ | Flag | Type | Required | Default | Description |
534
+ | --- | --- | --- | --- | --- |
535
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
536
+ | `--filed-task-id` | string | no | - | When --status=filed, record the on-chain task id on the change (optional) |
537
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
538
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
539
+ | `--status` | string | yes | - | New status for the proposed change (choices: `proposed`, `agreed`, `modified`, `rejected`, `filed`) |
540
+
541
+ ### pop brain retro remove
542
+
543
+ Soft-delete a retro (tombstone; filtered from projection) — useful for test retros and retros started in error
544
+
545
+ ```text
546
+ pop brain retro remove <retro-id> [flags]
547
+ ```
548
+
549
+ | Positional | Type | Required | Default | Description |
550
+ | --- | --- | --- | --- | --- |
551
+ | `<retro-id>` | string | yes | - | The retro.id to tombstone |
552
+
553
+ | Flag | Type | Required | Default | Description |
554
+ | --- | --- | --- | --- | --- |
555
+ | `--doc` | string | no | `pop.brain.retros` | Brain document ID (default: pop.brain.retros) |
556
+ | `--idempotency-key` | string | no | - | Task #375 (HB#217) idempotency cache. |
557
+ | `--no-idempotency` | boolean | no | `false` | Bypass the idempotency cache. |
558
+ | `--reason` | string | no | - | Optional human-readable reason recorded on the tombstone |
559
+
560
+ _Global flags: --org, --chain, --rpc, --json, --private-key, --dry-run, --yes, --verbose, --quiet, --preflight (see [index.md](../../../docs/reference/cli/index.md))_
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@poa-box/agent",
3
+ "version": "0.1.0",
4
+ "description": "Autonomous governance agent runtime for the POP protocol — agent + brain (P2P CRDT) command surface over @poa-box/cli",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "pop-agent": "./dist/pop-agent.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "docs",
12
+ "scripts",
13
+ ".env.agent.template",
14
+ "README.md",
15
+ "brain"
16
+ ],
17
+ "scripts": {
18
+ "build": "rm -rf dist && tsc",
19
+ "prepublishOnly": "yarn build",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest",
22
+ "test:xmachine-smoke": "yarn build && POP_BRAIN_HOME=${POP_BRAIN_HOME:-/tmp/brain-xmachine-loopback} POP_PRIVATE_KEY=${POP_PRIVATE_KEY:-$(grep -h '^POP_PRIVATE_KEY=' ~/.pop-agent/.env 2>/dev/null | head -1 | cut -d= -f2)} sh -c 'ROLE=publish node test/scripts/brain-cross-machine-smoke.js && ROLE=verify node test/scripts/brain-cross-machine-smoke.js'",
23
+ "onboard": "bash scripts/onboard.sh",
24
+ "apply": "bash scripts/apply.sh",
25
+ "lint": "tsc --noEmit",
26
+ "prepack": "npm pkg set 'dependencies.@poa-box/cli=^0.1.0'",
27
+ "postpack": "npm pkg set 'dependencies.@poa-box/cli=link:../..'"
28
+ },
29
+ "dependencies": {
30
+ "@poa-box/cli": "^0.1.0",
31
+ "ethers": "5.7.2",
32
+ "viem": "^2.47.12",
33
+ "yargs": "^17.7.2"
34
+ },
35
+ "optionalDependencies": {
36
+ "@automerge/automerge": "^3.2.5",
37
+ "@chainsafe/libp2p-gossipsub": "^14",
38
+ "@chainsafe/libp2p-noise": "^16",
39
+ "@chainsafe/libp2p-yamux": "^7",
40
+ "@libp2p/autonat": "^2.0.38",
41
+ "@libp2p/bootstrap": "^11.0.47",
42
+ "@libp2p/circuit-relay-v2": "^3.2.24",
43
+ "@libp2p/identify": "^3",
44
+ "@libp2p/mdns": "^11",
45
+ "@libp2p/tcp": "^10",
46
+ "blockstore-fs": "^2",
47
+ "datastore-fs": "^9",
48
+ "helia": "^5.5.1",
49
+ "libp2p": "^2.10.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^18.19.0",
53
+ "@types/yargs": "^17.0.33",
54
+ "typescript": "^5.6.0",
55
+ "vitest": "^1.6.0"
56
+ },
57
+ "engines": {
58
+ "node": ">=18"
59
+ },
60
+ "license": "MIT"
61
+ }