@alan512/experienceengine 0.1.0 → 0.1.3

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 (215) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.mcp.json +4 -8
  3. package/LICENSE +21 -0
  4. package/README.md +158 -47
  5. package/README.zh-CN.md +178 -57
  6. package/dist/adapters/codex/instruction-template.d.ts +3 -0
  7. package/dist/adapters/codex/instruction-template.js +12 -0
  8. package/dist/adapters/codex/instruction-template.js.map +1 -0
  9. package/dist/adapters/codex/mcp-server.d.ts +38 -41
  10. package/dist/adapters/codex/mcp-server.js +107 -338
  11. package/dist/adapters/codex/mcp-server.js.map +1 -1
  12. package/dist/analyzer/llm-learning-gate.js +39 -0
  13. package/dist/analyzer/llm-learning-gate.js.map +1 -1
  14. package/dist/cli/commands/claude-hook.js +12 -3
  15. package/dist/cli/commands/claude-hook.js.map +1 -1
  16. package/dist/cli/commands/config.js +88 -2
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/doctor.d.ts +4 -28
  19. package/dist/cli/commands/doctor.js +136 -68
  20. package/dist/cli/commands/doctor.js.map +1 -1
  21. package/dist/cli/commands/feedback.js +4 -0
  22. package/dist/cli/commands/feedback.js.map +1 -1
  23. package/dist/cli/commands/init.d.ts +28 -0
  24. package/dist/cli/commands/init.js +419 -0
  25. package/dist/cli/commands/init.js.map +1 -0
  26. package/dist/cli/commands/inspect.js +203 -37
  27. package/dist/cli/commands/inspect.js.map +1 -1
  28. package/dist/cli/commands/install.js +9 -0
  29. package/dist/cli/commands/install.js.map +1 -1
  30. package/dist/cli/commands/maintenance.js +1 -1
  31. package/dist/cli/commands/maintenance.js.map +1 -1
  32. package/dist/cli/commands/mcp-server.js +4 -0
  33. package/dist/cli/commands/mcp-server.js.map +1 -1
  34. package/dist/cli/commands/status.js +57 -7
  35. package/dist/cli/commands/status.js.map +1 -1
  36. package/dist/cli/dispatch.js +22 -7
  37. package/dist/cli/dispatch.js.map +1 -1
  38. package/dist/cli/state-model.d.ts +14 -0
  39. package/dist/cli/state-model.js +23 -0
  40. package/dist/cli/state-model.js.map +1 -0
  41. package/dist/config/config-schema.d.ts +32 -0
  42. package/dist/config/config-schema.js +26 -0
  43. package/dist/config/config-schema.js.map +1 -1
  44. package/dist/config/default-config.js +3 -0
  45. package/dist/config/default-config.js.map +1 -1
  46. package/dist/config/load-config.js +19 -1
  47. package/dist/config/load-config.js.map +1 -1
  48. package/dist/config/path-resolver.d.ts +0 -1
  49. package/dist/config/path-resolver.js +0 -2
  50. package/dist/config/path-resolver.js.map +1 -1
  51. package/dist/config/runtime-env.d.ts +8 -0
  52. package/dist/config/runtime-env.js +14 -0
  53. package/dist/config/runtime-env.js.map +1 -0
  54. package/dist/config/secrets-store.d.ts +15 -0
  55. package/dist/config/secrets-store.js +56 -0
  56. package/dist/config/secrets-store.js.map +1 -0
  57. package/dist/config/settings-store.d.ts +10 -0
  58. package/dist/config/settings-store.js +44 -0
  59. package/dist/config/settings-store.js.map +1 -1
  60. package/dist/controller/candidate-retriever.d.ts +35 -2
  61. package/dist/controller/candidate-retriever.js +189 -10
  62. package/dist/controller/candidate-retriever.js.map +1 -1
  63. package/dist/controller/injection-renderer.js +52 -1
  64. package/dist/controller/injection-renderer.js.map +1 -1
  65. package/dist/controller/injection-scorecard.d.ts +14 -2
  66. package/dist/controller/injection-scorecard.js +18 -1
  67. package/dist/controller/injection-scorecard.js.map +1 -1
  68. package/dist/controller/intervention-controller.d.ts +15 -2
  69. package/dist/controller/intervention-controller.js +173 -11
  70. package/dist/controller/intervention-controller.js.map +1 -1
  71. package/dist/controller/lexical-retriever.d.ts +14 -0
  72. package/dist/controller/lexical-retriever.js +117 -0
  73. package/dist/controller/lexical-retriever.js.map +1 -0
  74. package/dist/controller/model-reranker.d.ts +20 -0
  75. package/dist/controller/model-reranker.js +187 -0
  76. package/dist/controller/model-reranker.js.map +1 -0
  77. package/dist/controller/node-ranker.js +1 -0
  78. package/dist/controller/node-ranker.js.map +1 -1
  79. package/dist/controller/query-rewrite.d.ts +8 -0
  80. package/dist/controller/query-rewrite.js +69 -0
  81. package/dist/controller/query-rewrite.js.map +1 -0
  82. package/dist/controller/trigger-evaluator.d.ts +23 -2
  83. package/dist/controller/trigger-evaluator.js +57 -3
  84. package/dist/controller/trigger-evaluator.js.map +1 -1
  85. package/dist/distillation/experience-family.d.ts +4 -0
  86. package/dist/distillation/experience-family.js +14 -0
  87. package/dist/distillation/experience-family.js.map +1 -0
  88. package/dist/distillation/host-llm.d.ts +1 -0
  89. package/dist/distillation/host-llm.js +5 -1
  90. package/dist/distillation/host-llm.js.map +1 -1
  91. package/dist/distillation/llm-distiller.js +4 -0
  92. package/dist/distillation/llm-distiller.js.map +1 -1
  93. package/dist/distillation/merge-decider.js +4 -0
  94. package/dist/distillation/merge-decider.js.map +1 -1
  95. package/dist/distillation/prompt-contract.d.ts +1 -1
  96. package/dist/distillation/prompt-contract.js +3 -0
  97. package/dist/distillation/prompt-contract.js.map +1 -1
  98. package/dist/distillation/queue-worker.js +57 -7
  99. package/dist/distillation/queue-worker.js.map +1 -1
  100. package/dist/feedback/state-transition.js +9 -0
  101. package/dist/feedback/state-transition.js.map +1 -1
  102. package/dist/input/input-adapter.js +2 -1
  103. package/dist/input/input-adapter.js.map +1 -1
  104. package/dist/input/outcome-resolver.js +5 -5
  105. package/dist/input/outcome-resolver.js.map +1 -1
  106. package/dist/input/tasktype-resolver.js +2 -0
  107. package/dist/input/tasktype-resolver.js.map +1 -1
  108. package/dist/input/tool-event-significance.d.ts +5 -0
  109. package/dist/input/tool-event-significance.js +7 -0
  110. package/dist/input/tool-event-significance.js.map +1 -0
  111. package/dist/install/claude-code-doctor.d.ts +7 -2
  112. package/dist/install/claude-code-doctor.js +38 -9
  113. package/dist/install/claude-code-doctor.js.map +1 -1
  114. package/dist/install/claude-marketplace-state.d.ts +14 -0
  115. package/dist/install/claude-marketplace-state.js +47 -0
  116. package/dist/install/claude-marketplace-state.js.map +1 -0
  117. package/dist/install/codex-installer.d.ts +18 -0
  118. package/dist/install/codex-installer.js +91 -1
  119. package/dist/install/codex-installer.js.map +1 -1
  120. package/dist/install/openclaw-installer.d.ts +7 -0
  121. package/dist/install/openclaw-installer.js +16 -0
  122. package/dist/install/openclaw-installer.js.map +1 -1
  123. package/dist/install/public-install.d.ts +14 -4
  124. package/dist/install/public-install.js +20 -7
  125. package/dist/install/public-install.js.map +1 -1
  126. package/dist/interaction/repo-summary.d.ts +3 -17
  127. package/dist/interaction/repo-summary.js +10 -27
  128. package/dist/interaction/repo-summary.js.map +1 -1
  129. package/dist/interaction/service.d.ts +44 -95
  130. package/dist/interaction/service.js +333 -248
  131. package/dist/interaction/service.js.map +1 -1
  132. package/dist/maintenance/scope-merge.d.ts +0 -1
  133. package/dist/maintenance/scope-merge.js +0 -20
  134. package/dist/maintenance/scope-merge.js.map +1 -1
  135. package/dist/plugin/openclaw-plugin.d.ts +23 -0
  136. package/dist/plugin/openclaw-plugin.js +86 -6
  137. package/dist/plugin/openclaw-plugin.js.map +1 -1
  138. package/dist/plugin/openclaw-routine-interaction.d.ts +6 -0
  139. package/dist/plugin/openclaw-routine-interaction.js +296 -0
  140. package/dist/plugin/openclaw-routine-interaction.js.map +1 -0
  141. package/dist/runtime/service.d.ts +0 -1
  142. package/dist/runtime/service.js +20 -29
  143. package/dist/runtime/service.js.map +1 -1
  144. package/dist/store/sqlite/db.js +9 -0
  145. package/dist/store/sqlite/db.js.map +1 -1
  146. package/dist/store/sqlite/repositories/candidate-repo.js +8 -2
  147. package/dist/store/sqlite/repositories/candidate-repo.js.map +1 -1
  148. package/dist/store/sqlite/repositories/injection-repo.d.ts +1 -0
  149. package/dist/store/sqlite/repositories/injection-repo.js +11 -0
  150. package/dist/store/sqlite/repositories/injection-repo.js.map +1 -1
  151. package/dist/store/sqlite/repositories/input-record-repo.d.ts +2 -0
  152. package/dist/store/sqlite/repositories/input-record-repo.js +22 -0
  153. package/dist/store/sqlite/repositories/input-record-repo.js.map +1 -1
  154. package/dist/store/sqlite/repositories/node-repo.js +17 -2
  155. package/dist/store/sqlite/repositories/node-repo.js.map +1 -1
  156. package/dist/store/sqlite/repositories/task-run-repo.d.ts +2 -0
  157. package/dist/store/sqlite/repositories/task-run-repo.js +18 -2
  158. package/dist/store/sqlite/repositories/task-run-repo.js.map +1 -1
  159. package/dist/store/sqlite/schema.sql +9 -49
  160. package/dist/store/vector/api-embedding-provider.d.ts +2 -0
  161. package/dist/store/vector/api-embedding-provider.js +23 -19
  162. package/dist/store/vector/api-embedding-provider.js.map +1 -1
  163. package/dist/store/vector/embeddings.d.ts +1 -1
  164. package/dist/store/vector/embeddings.js +4 -1
  165. package/dist/store/vector/embeddings.js.map +1 -1
  166. package/dist/types/domain.d.ts +30 -46
  167. package/dist/types/plugin.d.ts +2 -1
  168. package/docs/releases/v0.1.2.md +3 -3
  169. package/docs/releases/v0.1.3.md +94 -0
  170. package/docs/user-guide.md +226 -123
  171. package/openclaw.plugin.json +1 -1
  172. package/package.json +3 -2
  173. package/plugins/claude-code-experienceengine/.claude-plugin/plugin.json +1 -1
  174. package/plugins/claude-code-experienceengine/.mcp.json +4 -3
  175. package/plugins/claude-code-experienceengine/scripts/claude-hook.sh +30 -1
  176. package/plugins/claude-code-experienceengine/scripts/install-deps.sh +41 -6
  177. package/dist/cli/commands/pack.d.ts +0 -1
  178. package/dist/cli/commands/pack.js +0 -321
  179. package/dist/cli/commands/pack.js.map +0 -1
  180. package/dist/compiler/agents-renderer.d.ts +0 -4
  181. package/dist/compiler/agents-renderer.js +0 -105
  182. package/dist/compiler/agents-renderer.js.map +0 -1
  183. package/dist/compiler/claude-renderer.d.ts +0 -2
  184. package/dist/compiler/claude-renderer.js +0 -40
  185. package/dist/compiler/claude-renderer.js.map +0 -1
  186. package/dist/compiler/codex-renderer.d.ts +0 -2
  187. package/dist/compiler/codex-renderer.js +0 -40
  188. package/dist/compiler/codex-renderer.js.map +0 -1
  189. package/dist/compiler/compiler.d.ts +0 -4
  190. package/dist/compiler/compiler.js +0 -87
  191. package/dist/compiler/compiler.js.map +0 -1
  192. package/dist/compiler/deployer.d.ts +0 -21
  193. package/dist/compiler/deployer.js +0 -64
  194. package/dist/compiler/deployer.js.map +0 -1
  195. package/dist/compiler/github-renderer.d.ts +0 -2
  196. package/dist/compiler/github-renderer.js +0 -63
  197. package/dist/compiler/github-renderer.js.map +0 -1
  198. package/dist/compiler/types.d.ts +0 -45
  199. package/dist/compiler/types.js +0 -2
  200. package/dist/compiler/types.js.map +0 -1
  201. package/dist/interaction/pack-actions-service.d.ts +0 -59
  202. package/dist/interaction/pack-actions-service.js +0 -172
  203. package/dist/interaction/pack-actions-service.js.map +0 -1
  204. package/dist/packs/fs-registry.d.ts +0 -27
  205. package/dist/packs/fs-registry.js +0 -216
  206. package/dist/packs/fs-registry.js.map +0 -1
  207. package/dist/packs/index-sync.d.ts +0 -9
  208. package/dist/packs/index-sync.js +0 -54
  209. package/dist/packs/index-sync.js.map +0 -1
  210. package/dist/packs/types.d.ts +0 -55
  211. package/dist/packs/types.js +0 -2
  212. package/dist/packs/types.js.map +0 -1
  213. package/dist/store/sqlite/repositories/pack-repo.d.ts +0 -16
  214. package/dist/store/sqlite/repositories/pack-repo.js +0 -192
  215. package/dist/store/sqlite/repositories/pack-repo.js.map +0 -1
@@ -11,6 +11,19 @@ In practice, this means:
11
11
  - noisy or harmful prior patterns can be cooled or retired
12
12
  - the system gradually learns which guidance is actually useful
13
13
 
14
+ It also means ExperienceEngine separates:
15
+
16
+ - `task history`
17
+ - broad runtime records of what happened
18
+ - `reusable experience`
19
+ - only the subset of tasks that produced transferable decision guidance
20
+
21
+ So a task can be recorded without being promoted into learning.
22
+
23
+ For a focused explanation of what ExperienceEngine stores and how an experience node is governed, see:
24
+
25
+ - [docs/development/experience-model.md](development/experience-model.md)
26
+
14
27
  For a practical end-to-end workflow on a real repository, see:
15
28
 
16
29
  - [docs/development/real-repo-playbook.md](development/real-repo-playbook.md)
@@ -48,6 +61,24 @@ When it injects guidance, you will usually see a lightweight notice like:
48
61
 
49
62
  If there is no intervention, it stays silent.
50
63
 
64
+ When ExperienceEngine is less certain but still sees a credible same-family match, it may choose a conservative injection instead of skipping entirely. In that case the injected block stays smaller by default, but mature low-risk nodes can still include a short `Goal / Steps / Avoid` structure when that makes the guidance more actionable.
65
+
66
+ When you inspect the latest turn, you may also see a learning decision such as:
67
+
68
+ ```text
69
+ Learning status: captured
70
+ Learning reason: provider routing debugging exposed a reusable configuration pattern
71
+ ```
72
+
73
+ or:
74
+
75
+ ```text
76
+ Learning status: rejected
77
+ Learning reason: task stayed in expression-layer refinement: wording, copy, or presentation changes are recorded but not learned
78
+ ```
79
+
80
+ This is intentional. ExperienceEngine now records broad task history, but it only promotes tasks with transferable decision value into the reusable experience pool.
81
+
51
82
  When the host surfaces task-finalization metadata, ExperienceEngine can also show a lightweight feedback reminder after an injected turn so the user can quickly mark whether the hint helped or harmed.
52
83
 
53
84
  You can also turn inline notices off:
@@ -58,63 +89,187 @@ ee config set notices.inline false
58
89
 
59
90
  ## Install And First Run
60
91
 
61
- ExperienceEngine installation is now host-native.
92
+ ExperienceEngine installation now starts from the host you want to use.
62
93
 
63
94
  That means the first installation step belongs to the host you want to use, not to the `ee` CLI.
64
95
 
65
- Install ExperienceEngine through the host-specific flow for:
96
+ Install ExperienceEngine through the host setup flow for:
66
97
 
67
98
  - `OpenClaw`
68
- - planned one-step command:
99
+ - host-native plugin install:
69
100
  - `openclaw plugins install @alan512/experienceengine`
70
- - current status:
71
- - blocked until the public npm package `@alan512/experienceengine` is published
101
+ - after installing, restart the gateway before the first real task:
102
+ - `openclaw gateway restart`
72
103
  - `Codex`
73
- - planned one-step command:
104
+ - EE-managed Codex setup:
105
+ - `ee install codex`
106
+ - native/manual fallback:
74
107
  - `codex mcp add experienceengine --env EXPERIENCE_ENGINE_HOME=$HOME/.experienceengine -- npx -y @alan512/experienceengine codex-mcp-server`
75
- - current status:
76
- - blocked until the public npm package `@alan512/experienceengine` is published
108
+ - after either path, start a new Codex session in this repo so the MCP wiring and `AGENTS.md` instruction block are picked up
77
109
  - `Claude Code`
78
- - add the bundled marketplace from GitHub:
110
+ - host-native marketplace install:
111
+ - add the bundled marketplace from GitHub:
79
112
  - `/plugin marketplace add https://github.com/Alan-512/ExperienceEngine.git`
80
113
  - install the bundled plugin:
81
114
  - `/plugin install experienceengine@experienceengine`
82
115
  - `ee install claude-code` remains the explicit operator fallback when you need direct hooks + MCP wiring outside the marketplace flow
116
+ - after installation, start a new Claude Code session so the plugin hooks and bundled MCP config are loaded
117
+
118
+ Across all three hosts, the intended product journey is the same:
83
119
 
84
- Then use the `ee` CLI for validation and operations:
120
+ 1. install ExperienceEngine through the host-specific setup path
121
+ 2. initialize shared ExperienceEngine state with `ee init`
122
+ 3. restart or open a fresh host session until the repo is `Ready`
123
+ 4. keep routine review and feedback inside the host agent when the host supports it cleanly
124
+ 5. use `ee` as the operator fallback for validation, repair, and deeper inspection
125
+
126
+ The host-specific differences are real, but they sit underneath one shared model:
127
+
128
+ - installation mechanics differ by host
129
+ - routine interaction should feel similar wherever the host supports it
130
+ - CLI remains the explicit fallback and operator surface
131
+
132
+ Then continue using your host agent normally.
133
+
134
+ For most users, ExperienceEngine should stay in the background and be inspected through the host agent itself. Typical prompts are:
135
+
136
+ - "What did ExperienceEngine just inject?"
137
+ - "Why did that ExperienceEngine hint match?"
138
+ - "Mark the last ExperienceEngine intervention as helpful or harmful."
139
+
140
+ OpenClaw also supports these additional phase-2 routine questions in-session:
141
+
142
+ - "Is ExperienceEngine ready here?"
143
+ - "Is ExperienceEngine still warming up in this repo?"
144
+ - "Why didn't ExperienceEngine inject anything just now?"
145
+
146
+ For `OpenClaw`, `Codex`, and `Claude Code`, these routine follow-ups should stay in the host session first.
147
+
148
+ Use the `ee` CLI only when you need explicit validation, repair, or operator-style troubleshooting:
85
149
 
86
150
  ```bash
151
+ ee init
87
152
  ee doctor <openclaw|claude-code|codex>
88
153
  ee status
89
154
  ```
90
155
 
156
+ Use `ee init` once to initialize ExperienceEngine's shared distillation, embedding, and secret state. New host installations should reuse that same shared EE state instead of asking you to re-enter the same API key per host window.
157
+
158
+ In practical terms, the routine loop currently looks like this:
159
+
160
+ - `Codex`
161
+ - ask the host agent first for recent injections, matching reasons, and helped / harmed feedback
162
+ - `Claude Code`
163
+ - ask the host agent first for recent injections, matching reasons, and helped / harmed feedback
164
+ - `OpenClaw`
165
+ - ask the host agent first for recent injections, matching reasons, readiness, warm-up progress, recent silence, and helped / harmed feedback
166
+ - keep CLI/operator fallback for deeper inspection, repair, and advanced management
167
+
168
+ For onboarding and first value, ExperienceEngine now uses a two-layer product model:
169
+
170
+ - `Setup state`
171
+ - `Installed`
172
+ - `Initialized`
173
+ - `Ready`
174
+ - `Value state`
175
+ - `Warming up`
176
+ - `First value reached`
177
+
178
+ These are not one linear state machine.
179
+
180
+ Examples:
181
+
182
+ - a repo can already be `Ready` while still `Warming up`
183
+ - a repo can be `Ready` and already have reached first value
184
+
185
+ In practice:
186
+
187
+ - installation into a host gets you to `Installed`
188
+ - `ee init` moves the shared product state toward `Initialized`
189
+ - a restart or new host session usually completes `Ready`
190
+ - real task activity moves the value layer from `Warming up` toward `First value reached`
191
+
192
+ `First value reached` must be tied to visible output from real work, such as:
193
+
194
+ - a visible real task record
195
+ - a visible learning decision
196
+ - a visible intervention
197
+
198
+ These do **not** count by themselves:
199
+
200
+ - a static onboarding message
201
+ - a generic warm-up explanation
202
+ - a recommendation not tied to a real observed task run
203
+
91
204
  You do **not** need to clone the repository or run `pnpm build` for normal user installation.
92
205
 
93
206
  ### Operational CLI
94
207
 
95
- After a host-native installation succeeds, `ee` becomes the shared operational surface.
208
+ After the host setup succeeds, the host agent remains the primary interaction surface.
96
209
 
97
- Use it for:
210
+ Use `ee` for:
98
211
 
212
+ - one-time shared initialization after the first host setup
99
213
  - installation validation
100
214
  - repair guidance
101
215
  - runtime status checks
102
216
  - learning and intervention inspection
103
217
  - quick helped / harmed feedback
104
218
 
219
+ `ee status` and `ee doctor` now also summarize recent retrieval health in product language. They still show the raw counters, but they additionally explain whether ExperienceEngine is mostly injecting, mostly staying conservative, or still skipping too many close-match tasks in the current repo.
220
+
221
+ Their roles are intentionally different:
222
+
223
+ - `ee status`
224
+ - daily progress view
225
+ - current setup/value state
226
+ - next practical step
227
+ - `ee doctor <host>`
228
+ - explicit validation and troubleshooting
229
+ - install and wiring verification
230
+ - repair-oriented next steps
231
+
232
+ The most useful inspection command during product debugging is still:
233
+
234
+ ```bash
235
+ ee inspect --last
236
+ ```
237
+
238
+ That output now tells you both:
239
+
240
+ - what was injected
241
+ - whether the finalized task was learned, rejected from learning, or only kept as runtime history
242
+ - whether the intervention was a normal injection or a conservative one
243
+ - why ExperienceEngine acted that way in plain language instead of only raw gate fields
244
+ - how trustworthy the selected guidance currently is
245
+
246
+ When you inspect a specific node, ExperienceEngine now also shows a lightweight quality judgment layer:
247
+
248
+ - a `quality band` (`strong`, `building`, or `risky`)
249
+ - the short drivers behind that judgment
250
+ - a compact applicability profile covering best fit, scope validity, confidence, risk, and when to avoid reuse
251
+
105
252
  ## How MCP Interaction Works
106
253
 
107
254
  For `Codex` and `Claude Code`, ExperienceEngine is designed to work mainly through MCP.
108
255
 
109
256
  That means after installation, you usually do not leave the agent session to manage ExperienceEngine. Instead, you ask the agent naturally and the agent can call ExperienceEngine MCP resources, prompts, and tools for you.
110
257
 
258
+ This is one host-specific implementation of the same shared product model described above:
259
+
260
+ - host-native install or wiring gets the repo to `Installed`
261
+ - shared `ee init` state gets the product to `Initialized`
262
+ - a fresh host session gets the repo to `Ready`
263
+ - routine inspection and feedback stay inside the host when the host supports them cleanly
264
+ - CLI remains the explicit fallback and operator path
265
+
111
266
  Typical examples:
112
267
  - "What did ExperienceEngine just inject?"
268
+ - "Why did that ExperienceEngine hint match?"
113
269
  - "Show the recent injected turns."
114
270
  - "List active warning nodes."
115
271
  - "Pause ExperienceEngine for this project."
116
- - "Mark the last ExperienceEngine intervention as harmful."
117
- - "Record quick feedback for the last ExperienceEngine intervention."
272
+ - "Mark the last ExperienceEngine intervention as helpful or harmful."
118
273
  - "Create a backup of ExperienceEngine state."
119
274
  - "Rollback ExperienceEngine to backup `<id>`."
120
275
 
@@ -155,104 +310,17 @@ Today, ExperienceEngine's minimal governance surface is:
155
310
 
156
311
  A dedicated standalone review UI is still deferred. The current product shape is intentionally CLI/MCP-first rather than UI-first.
157
312
 
158
- ## Experience Pack v1
159
-
160
- Experience Pack v1 is a **local shared-directory registry** for reusable experience assets.
161
-
162
- It lets you take a group of already-validated nodes and move them through a minimal lifecycle:
163
-
164
- ```text
165
- draft -> review -> publish -> rollback
166
- ```
167
-
168
- Pack v1 is intentionally local-first:
169
-
170
- - packs live under `~/.experienceengine/packs`
171
- - packs are host-agnostic assets, not host-specific config fragments
172
- - multiple local repos can reuse the same published pack
173
- - there is no team sync, remote distribution, or UI workflow in v1
174
-
175
- Current CLI surface:
176
-
177
- ```bash
178
- ee pack list
179
- ee pack inspect <pack-id>
180
- ee pack status <pack-id> [version] [agents|codex|github|claude] [repo-path]
181
- ee pack draft create <pack-id> <node-id[,node-id...]> [name...]
182
- ee pack review <pack-id> <description...>
183
- ee pack publish <pack-id>
184
- ee pack compile <pack-id> [version]
185
- ee pack compile <pack-id> [version] codex
186
- ee pack compile <pack-id> [version] github
187
- ee pack compile <pack-id> [version] claude
188
- ee pack deploy <pack-id> [version] [agents|codex|github|claude] [repo-path] [--dry-run] [--force] [--status-only]
189
- ee pack rollback <pack-id> <version>
190
- ```
191
-
192
- Use this when you want to turn a set of proven nodes into a managed local asset instead of leaving them only in SQLite state.
193
-
194
- ### Compiler v1
195
-
196
- Compiler v1 turns a published or rolled-back Experience Pack into host-friendly static artifacts.
197
-
198
- It is intentionally conservative:
199
-
200
- - it only reads Pack files that already exist in the local registry
201
- - it only exports a static artifact
202
- - it does **not** auto-write into your repo root
203
-
204
- Example:
205
-
206
- ```bash
207
- ee pack compile auth-debug-pack
208
- ee pack compile auth-debug-pack codex
209
- ee pack compile auth-debug-pack github
210
- ee pack compile auth-debug-pack claude
211
- ee pack deploy auth-debug-pack agents /path/to/repo --dry-run
212
- ee pack deploy auth-debug-pack codex /path/to/repo
213
- ee pack deploy github-pack github /path/to/repo --force
214
- ee pack deploy auth-debug-pack claude /path/to/repo
215
- ee pack deploy auth-debug-pack agents /path/to/repo --status-only
216
- ee pack status auth-debug-pack agents /path/to/repo
217
- ```
218
-
219
- Default output location:
220
-
221
- ```text
222
- ~/.experienceengine/packs/<pack-id>/compiled/<target>/<version>/
223
- ```
224
-
225
- Artifacts produced:
226
-
227
- - `AGENTS.md` for `agents` target
228
- - `CODEX.md` for `codex` target
229
- - `CLAUDE.md` for `claude` target
230
- - `<pack-id>.agent.md` for `github` target
231
- - `compile-report.json`
232
-
233
- Deploying compiled artifacts:
234
-
235
- - `agents` target writes to `<repo>/AGENTS.md`
236
- - `codex` target writes to `<repo>/CODEX.md`
237
- - `claude` target writes to `<repo>/CLAUDE.md`
238
- - `github` target writes to `<repo>/.github/agents/<pack-id>.md`
239
-
240
- Use `--dry-run` to preview the destination without writing files. Existing files are protected by default; use `--force` only when you intentionally want to overwrite the destination. Use `--status-only` to inspect whether the destination is `missing`, `up_to_date`, or `drifted` without writing anything.
241
-
242
- If you only want the deployment state without invoking the deploy command shape, use:
243
-
244
- ```bash
245
- ee pack status <pack-id> [version] [agents|codex|github|claude] [repo-path]
246
- ```
247
-
248
- Compiler visibility is also exposed through:
249
-
250
- - `ee pack list`
251
- - `ee pack inspect <pack-id>`
252
- - `ee inspect learning`
253
- - `ee doctor <adapter>`
313
+ That does not mean every host surface is identical today:
254
314
 
255
- These surfaces show which targets the current Pack version has already compiled, whether a published Pack is stale, and the latest compile target/time.
315
+ - `Codex` and `Claude Code` use MCP-native host interaction for routine use
316
+ - `OpenClaw` now supports six in-session routine interaction families through the plugin path:
317
+ - what was injected
318
+ - why it matched
319
+ - helped / harmed feedback
320
+ - readiness in the current repo
321
+ - warm-up / first-value progress
322
+ - recent silence on the latest turn
323
+ - advanced operator actions still remain more explicit in CLI across all hosts
256
324
 
257
325
  ## Host-Specific Setup
258
326
 
@@ -264,6 +332,14 @@ Before installing ExperienceEngine into any host, make sure the host CLI itself
264
332
 
265
333
  ExperienceEngine wires itself into an existing host environment. It does not install the host CLI for you.
266
334
 
335
+ If you are installing ExperienceEngine into a repo for the first time, prefer:
336
+
337
+ ```bash
338
+ ee install codex
339
+ ```
340
+
341
+ That command wires the shared MCP server and writes the local `AGENTS.md` instruction block for the current repo.
342
+
267
343
  If you are operating or debugging the product directly, the explicit fallback commands still exist:
268
344
 
269
345
  ```bash
@@ -278,6 +354,12 @@ These are operator-facing controls, not the preferred public onboarding path.
278
354
 
279
355
  ExperienceEngine now supports a multi-provider embedding stack for semantic retrieval.
280
356
 
357
+ Retrieval is now hybrid by default:
358
+
359
+ - semantic retrieval remains the main recall path
360
+ - lexical retrieval and query normalization help preserve engineering intent when the prompt wording shifts
361
+ - reranking can promote a better-matching candidate above older score advantages, especially when an external reranker is configured
362
+
281
363
  Default behavior (`embeddingProvider = "api"`):
282
364
 
283
365
  - ExperienceEngine first tries API embeddings for better retrieval quality
@@ -463,6 +545,11 @@ Even though MCP is the main user interaction model for Claude/Codex, the `ee` CL
463
545
 
464
546
  Use MCP first for normal day-to-day interaction inside Claude/Codex.
465
547
 
548
+ For the common routine loop, keep these actions in the host session first:
549
+ - ask what ExperienceEngine just injected
550
+ - ask why it matched
551
+ - mark the last intervention as helped or harmed
552
+
466
553
  Use `ee` directly when:
467
554
  - the host session cannot currently access MCP
468
555
  - you are scripting or automating locally
@@ -494,7 +581,11 @@ ee rollback <backup-id>
494
581
 
495
582
  ## Doctor, Repair, and Upgrade
496
583
 
497
- Use doctor first if something looks wrong:
584
+ If something feels wrong in normal use, ask the host agent to inspect ExperienceEngine first.
585
+
586
+ Use the `ee` CLI when you need explicit local validation or the host cannot currently surface enough state.
587
+
588
+ CLI fallback:
498
589
 
499
590
  ```bash
500
591
  ee doctor openclaw
@@ -511,7 +602,7 @@ What doctor tells you:
511
602
  - how many raw task records / task runs / pending candidates / formal nodes exist today
512
603
  - the next step to reach first durable value when the system is still warming up
513
604
 
514
- Use repair when host wiring drifted:
605
+ Use repair when host wiring drifted and you need an explicit local recovery step:
515
606
 
516
607
  ```bash
517
608
  ee repair openclaw
@@ -558,7 +649,7 @@ Managed artifacts live under:
558
649
 
559
650
  Use backup when you want a restorable checkpoint of current ExperienceEngine state.
560
651
 
561
- In an MCP-capable host, ask the agent to create a backup. The agent should first show you a plan and only execute after you confirm.
652
+ In an MCP-capable host, ask the agent to create a backup first. The agent should show a plan and only execute after you confirm.
562
653
 
563
654
  CLI fallback:
564
655
 
@@ -587,6 +678,8 @@ Import restores a valid ExperienceEngine snapshot directory.
587
678
 
588
679
  Before import overwrites current ExperienceEngine state, the system creates a safeguard backup automatically.
589
680
 
681
+ In MCP-capable hosts, prefer asking the agent to plan the import first.
682
+
590
683
  CLI fallback:
591
684
 
592
685
  ```bash
@@ -599,6 +692,8 @@ Rollback restores one of the managed backups.
599
692
 
600
693
  Before rollback overwrites current ExperienceEngine state, the system also creates a safeguard backup automatically.
601
694
 
695
+ In MCP-capable hosts, prefer asking the agent to plan the rollback first.
696
+
602
697
  CLI fallback:
603
698
 
604
699
  ```bash
@@ -618,6 +713,11 @@ For risky changes:
618
713
 
619
714
  ### Review what happened last
620
715
 
716
+ For normal day-to-day usage in Claude Code or Codex, ask the host agent first:
717
+
718
+ - "What did ExperienceEngine just inject?"
719
+ - "Why did that ExperienceEngine hint match?"
720
+
621
721
  Fallback CLI:
622
722
 
623
723
  ```bash
@@ -629,11 +729,11 @@ This view now also shows:
629
729
  - origin record ids when they exist
630
730
  - the node evidence summary attached to each injected hint
631
731
 
632
- In MCP-capable hosts, ask:
732
+ ### Review recent injected turns
633
733
 
634
- - "What did ExperienceEngine just inject?"
734
+ In MCP-capable hosts, ask:
635
735
 
636
- ### Review recent injected turns
736
+ - "Show the recent injected ExperienceEngine turns."
637
737
 
638
738
  Fallback CLI:
639
739
 
@@ -641,12 +741,10 @@ Fallback CLI:
641
741
  ee inspect recent injected 10
642
742
  ```
643
743
 
644
- In MCP-capable hosts, ask:
645
-
646
- - "Show the recent injected ExperienceEngine turns."
647
-
648
744
  ### Review current node inventory
649
745
 
746
+ In MCP-capable hosts, ask for the current active strategies or warnings first.
747
+
650
748
  Fallback CLI:
651
749
 
652
750
  ```bash
@@ -658,6 +756,8 @@ ee inspect node <id>
658
756
 
659
757
  ### Manually correct feedback
660
758
 
759
+ In MCP-capable hosts, prefer asking the agent to mark the last intervention as helpful or harmful.
760
+
661
761
  Fallback CLI:
662
762
 
663
763
  ```bash
@@ -673,6 +773,8 @@ ee feedback node <id> harmed
673
773
 
674
774
  ### Temporarily pause interventions
675
775
 
776
+ In MCP-capable hosts, prefer asking the agent to pause or resume ExperienceEngine for the current scope.
777
+
676
778
  Fallback CLI:
677
779
 
678
780
  ```bash
@@ -687,12 +789,13 @@ What is already mature enough to use:
687
789
  - real runtime integration on Claude Code
688
790
  - real runtime integration on Codex
689
791
  - MCP-native inspect/control workflows on Claude/Codex
792
+ - in-session routine review and feedback workflows on OpenClaw
690
793
  - managed state backup and restore over MCP `plan + confirm`
691
794
 
692
795
  What is still intentionally simpler:
693
- - OpenClaw does not yet have the same MCP-native user interaction layer as Claude/Codex
796
+ - OpenClaw does not use the same MCP-native interaction shape as Claude/Codex
694
797
  - user-facing docs are lighter than a full product site
695
- - CLI fallback is still more complete than some host-native surfaces
798
+ - CLI fallback is still more complete than some host-side surfaces
696
799
 
697
800
  ## If Something Feels Wrong
698
801
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "experienceengine",
3
3
  "name": "ExperienceEngine",
4
- "version": "0.1.0",
4
+ "version": "0.1.3",
5
5
  "description": "Context-aware experience intervention controller for coding and debugging tasks.",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@alan512/experienceengine",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
- "description": "ExperienceEngine v2 MVP scaffold for OpenClaw companion-layer experience intervention.",
5
+ "description": "Experience governance for coding agents: learn from real task outcomes, inject reusable hints, and retire low-value guidance.",
6
+ "license": "MIT",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "https://github.com/Alan-512/ExperienceEngine.git"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "experienceengine",
3
3
  "description": "Context-aware experience intervention controller for Claude Code.",
4
- "version": "0.1.0",
4
+ "version": "0.1.3",
5
5
  "author": {
6
6
  "name": "ExperienceEngine"
7
7
  },
@@ -4,12 +4,13 @@
4
4
  "type": "stdio",
5
5
  "command": "node",
6
6
  "args": [
7
- "${CLAUDE_PLUGIN_DATA}/node_modules/@alan512/experienceengine/dist/cli/index.js",
7
+ "${CLAUDE_PLUGIN_ROOT}/node_modules/@alan512/experienceengine/dist/cli/index.js",
8
8
  "mcp-server"
9
9
  ],
10
10
  "env": {
11
- "NODE_PATH": "${CLAUDE_PLUGIN_DATA}/node_modules",
12
- "EXPERIENCE_ENGINE_HOME": "${CLAUDE_PLUGIN_DATA}/experienceengine-home"
11
+ "NODE_PATH": "${CLAUDE_PLUGIN_ROOT}/node_modules",
12
+ "EXPERIENCE_ENGINE_HOME": "${CLAUDE_PLUGIN_ROOT}/experienceengine-home",
13
+ "EXPERIENCE_ENGINE_CLAUDE_HOOK_SOURCE": "marketplace"
13
14
  }
14
15
  }
15
16
  }
@@ -1,9 +1,38 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- PLUGIN_DATA="${CLAUDE_PLUGIN_DATA:?CLAUDE_PLUGIN_DATA is required}"
4
+ PLUGIN_DATA="${CLAUDE_PLUGIN_DATA:-${CLAUDE_PLUGIN_ROOT:-}}"
5
+ if [[ -z "${PLUGIN_DATA}" ]]; then
6
+ echo "CLAUDE_PLUGIN_DATA or CLAUDE_PLUGIN_ROOT is required" >&2
7
+ exit 1
8
+ fi
5
9
 
6
10
  export NODE_PATH="${PLUGIN_DATA}/node_modules${NODE_PATH:+:${NODE_PATH}}"
7
11
  export EXPERIENCE_ENGINE_HOME="${EXPERIENCE_ENGINE_HOME:-${PLUGIN_DATA}/experienceengine-home}"
12
+ STATE_PATH="${EXPERIENCE_ENGINE_HOME}/claude-marketplace-state.json"
13
+
14
+ node - "${STATE_PATH}" <<'NODE'
15
+ const fs = require("node:fs");
16
+ const path = require("node:path");
17
+
18
+ const [statePath] = process.argv.slice(2);
19
+ let current = {};
20
+ try {
21
+ current = JSON.parse(fs.readFileSync(statePath, "utf8"));
22
+ } catch {}
23
+
24
+ const next = {
25
+ adapter: "claude-code",
26
+ install_mode: "marketplace",
27
+ hook_source: "marketplace",
28
+ package_version: current.package_version,
29
+ written_at: current.written_at ?? new Date().toISOString(),
30
+ last_hook_seen_at: new Date().toISOString(),
31
+ last_mcp_seen_at: current.last_mcp_seen_at
32
+ };
33
+
34
+ fs.mkdirSync(path.dirname(statePath), { recursive: true });
35
+ fs.writeFileSync(statePath, `${JSON.stringify(next, null, 2)}\n`);
36
+ NODE
8
37
 
9
38
  exec node --no-warnings "${PLUGIN_DATA}/node_modules/@alan512/experienceengine/dist/cli/index.js" claude-hook "$@"
@@ -1,19 +1,54 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- PLUGIN_DATA="${CLAUDE_PLUGIN_DATA:?CLAUDE_PLUGIN_DATA is required}"
4
+ PLUGIN_DATA="${CLAUDE_PLUGIN_DATA:-${CLAUDE_PLUGIN_ROOT:-}}"
5
+ if [[ -z "${PLUGIN_DATA}" ]]; then
6
+ echo "CLAUDE_PLUGIN_DATA or CLAUDE_PLUGIN_ROOT is required" >&2
7
+ exit 1
8
+ fi
5
9
  PACKAGE_DIR="${PLUGIN_DATA}/node_modules/@alan512/experienceengine"
10
+ PACKAGE_ENTRY="${PACKAGE_DIR}/dist/cli/index.js"
6
11
  STAMP_PATH="${PLUGIN_DATA}/.experienceengine-plugin-version"
7
- REPO_URL="${EXPERIENCE_ENGINE_PLUGIN_GIT_URL:-https://github.com/Alan-512/ExperienceEngine.git}"
8
- REPO_REF="${EXPERIENCE_ENGINE_PLUGIN_GIT_REF:-main}"
9
- PACKAGE_VERSION="0.1.0"
12
+ EXPERIENCE_ENGINE_HOME_PATH="${EXPERIENCE_ENGINE_HOME:-${PLUGIN_DATA}/experienceengine-home}"
13
+ STATE_PATH="${EXPERIENCE_ENGINE_HOME_PATH}/claude-marketplace-state.json"
14
+ PACKAGE_VERSION="0.1.3"
15
+ PACKAGE_SPEC="${EXPERIENCE_ENGINE_PLUGIN_PACKAGE_SPEC:-@alan512/experienceengine@${PACKAGE_VERSION}}"
10
16
 
11
17
  mkdir -p "${PLUGIN_DATA}"
18
+ mkdir -p "${EXPERIENCE_ENGINE_HOME_PATH}"
19
+
20
+ write_marketplace_state() {
21
+ node - "${STATE_PATH}" "${PACKAGE_VERSION}" <<'NODE'
22
+ const fs = require("node:fs");
23
+ const path = require("node:path");
24
+
25
+ const [statePath, packageVersion] = process.argv.slice(2);
26
+ let current = {};
27
+ try {
28
+ current = JSON.parse(fs.readFileSync(statePath, "utf8"));
29
+ } catch {}
30
+
31
+ const next = {
32
+ adapter: "claude-code",
33
+ install_mode: "marketplace",
34
+ hook_source: "marketplace",
35
+ package_version: packageVersion,
36
+ written_at: current.written_at ?? new Date().toISOString(),
37
+ last_hook_seen_at: current.last_hook_seen_at,
38
+ last_mcp_seen_at: current.last_mcp_seen_at
39
+ };
40
+
41
+ fs.mkdirSync(path.dirname(statePath), { recursive: true });
42
+ fs.writeFileSync(statePath, `${JSON.stringify(next, null, 2)}\n`);
43
+ NODE
44
+ }
12
45
 
13
- if [[ -f "${STAMP_PATH}" ]] && [[ "$(cat "${STAMP_PATH}")" == "${PACKAGE_VERSION}" ]] && [[ -d "${PACKAGE_DIR}" ]]; then
46
+ if [[ -f "${STAMP_PATH}" ]] && [[ "$(cat "${STAMP_PATH}")" == "${PACKAGE_VERSION}" ]] && [[ -f "${PACKAGE_ENTRY}" ]]; then
47
+ write_marketplace_state
14
48
  exit 0
15
49
  fi
16
50
 
17
51
  rm -rf "${PLUGIN_DATA}/node_modules"
18
- npm install --prefix "${PLUGIN_DATA}" --no-package-lock --omit=dev "${REPO_URL}#${REPO_REF}"
52
+ npm install --prefix "${PLUGIN_DATA}" --no-package-lock --omit=dev --ignore-scripts "${PACKAGE_SPEC}"
19
53
  printf '%s' "${PACKAGE_VERSION}" > "${STAMP_PATH}"
54
+ write_marketplace_state
@@ -1 +0,0 @@
1
- export declare const runPackCommand: (args: string[]) => void;