@vibe-hero/server 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 (150) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +151 -0
  3. package/dist/catalog/bundled/claude-code/.gitkeep +0 -0
  4. package/dist/catalog/bundled/claude-code/context-management.yaml +302 -0
  5. package/dist/catalog/bundled/claude-code/planning.yaml +313 -0
  6. package/dist/catalog/bundled/claude-code/subagents.yaml +357 -0
  7. package/dist/catalog/bundled/general/.gitkeep +0 -0
  8. package/dist/catalog/bundled/general/_placeholder.yaml +39 -0
  9. package/dist/catalog/bundled/general/task-decomposition.yaml +390 -0
  10. package/dist/catalog/bundled/index.d.ts +39 -0
  11. package/dist/catalog/bundled/index.d.ts.map +1 -0
  12. package/dist/catalog/bundled/index.js +41 -0
  13. package/dist/catalog/bundled/index.js.map +1 -0
  14. package/dist/catalog/fetcher.d.ts +201 -0
  15. package/dist/catalog/fetcher.d.ts.map +1 -0
  16. package/dist/catalog/fetcher.js +452 -0
  17. package/dist/catalog/fetcher.js.map +1 -0
  18. package/dist/catalog/loader.d.ts +165 -0
  19. package/dist/catalog/loader.d.ts.map +1 -0
  20. package/dist/catalog/loader.js +241 -0
  21. package/dist/catalog/loader.js.map +1 -0
  22. package/dist/catalog/resolve.d.ts +85 -0
  23. package/dist/catalog/resolve.d.ts.map +1 -0
  24. package/dist/catalog/resolve.js +103 -0
  25. package/dist/catalog/resolve.js.map +1 -0
  26. package/dist/cli/getOffer.d.ts +38 -0
  27. package/dist/cli/getOffer.d.ts.map +1 -0
  28. package/dist/cli/getOffer.js +150 -0
  29. package/dist/cli/getOffer.js.map +1 -0
  30. package/dist/cli/index.d.ts +46 -0
  31. package/dist/cli/index.d.ts.map +1 -0
  32. package/dist/cli/index.js +88 -0
  33. package/dist/cli/index.js.map +1 -0
  34. package/dist/config.d.ts +34 -0
  35. package/dist/config.d.ts.map +1 -0
  36. package/dist/config.js +63 -0
  37. package/dist/config.js.map +1 -0
  38. package/dist/engine/elo.d.ts +76 -0
  39. package/dist/engine/elo.d.ts.map +1 -0
  40. package/dist/engine/elo.js +79 -0
  41. package/dist/engine/elo.js.map +1 -0
  42. package/dist/engine/graduation.d.ts +108 -0
  43. package/dist/engine/graduation.d.ts.map +1 -0
  44. package/dist/engine/graduation.js +161 -0
  45. package/dist/engine/graduation.js.map +1 -0
  46. package/dist/engine/lapse.d.ts +80 -0
  47. package/dist/engine/lapse.d.ts.map +1 -0
  48. package/dist/engine/lapse.js +125 -0
  49. package/dist/engine/lapse.js.map +1 -0
  50. package/dist/engine/selection.d.ts +84 -0
  51. package/dist/engine/selection.d.ts.map +1 -0
  52. package/dist/engine/selection.js +119 -0
  53. package/dist/engine/selection.js.map +1 -0
  54. package/dist/grading/deterministic.d.ts +102 -0
  55. package/dist/grading/deterministic.d.ts.map +1 -0
  56. package/dist/grading/deterministic.js +118 -0
  57. package/dist/grading/deterministic.js.map +1 -0
  58. package/dist/grading/freeform.d.ts +64 -0
  59. package/dist/grading/freeform.d.ts.map +1 -0
  60. package/dist/grading/freeform.js +85 -0
  61. package/dist/grading/freeform.js.map +1 -0
  62. package/dist/index.d.ts +52 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +91 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/observation/hookEvents.d.ts +113 -0
  67. package/dist/observation/hookEvents.d.ts.map +1 -0
  68. package/dist/observation/hookEvents.js +170 -0
  69. package/dist/observation/hookEvents.js.map +1 -0
  70. package/dist/observation/offers.d.ts +215 -0
  71. package/dist/observation/offers.d.ts.map +1 -0
  72. package/dist/observation/offers.js +327 -0
  73. package/dist/observation/offers.js.map +1 -0
  74. package/dist/observation/source.d.ts +133 -0
  75. package/dist/observation/source.d.ts.map +1 -0
  76. package/dist/observation/source.js +105 -0
  77. package/dist/observation/source.js.map +1 -0
  78. package/dist/profile/migrate.d.ts +122 -0
  79. package/dist/profile/migrate.d.ts.map +1 -0
  80. package/dist/profile/migrate.js +147 -0
  81. package/dist/profile/migrate.js.map +1 -0
  82. package/dist/profile/store.d.ts +84 -0
  83. package/dist/profile/store.d.ts.map +1 -0
  84. package/dist/profile/store.js +267 -0
  85. package/dist/profile/store.js.map +1 -0
  86. package/dist/schemas/common.d.ts +95 -0
  87. package/dist/schemas/common.d.ts.map +1 -0
  88. package/dist/schemas/common.js +106 -0
  89. package/dist/schemas/common.js.map +1 -0
  90. package/dist/schemas/content.d.ts +828 -0
  91. package/dist/schemas/content.d.ts.map +1 -0
  92. package/dist/schemas/content.js +219 -0
  93. package/dist/schemas/content.js.map +1 -0
  94. package/dist/schemas/profile.d.ts +599 -0
  95. package/dist/schemas/profile.d.ts.map +1 -0
  96. package/dist/schemas/profile.js +177 -0
  97. package/dist/schemas/profile.js.map +1 -0
  98. package/dist/schemas/tools.d.ts +1581 -0
  99. package/dist/schemas/tools.d.ts.map +1 -0
  100. package/dist/schemas/tools.js +286 -0
  101. package/dist/schemas/tools.js.map +1 -0
  102. package/dist/tools/config.d.ts +51 -0
  103. package/dist/tools/config.d.ts.map +1 -0
  104. package/dist/tools/config.js +104 -0
  105. package/dist/tools/config.js.map +1 -0
  106. package/dist/tools/gate.d.ts +50 -0
  107. package/dist/tools/gate.d.ts.map +1 -0
  108. package/dist/tools/gate.js +67 -0
  109. package/dist/tools/gate.js.map +1 -0
  110. package/dist/tools/guidance.d.ts +36 -0
  111. package/dist/tools/guidance.d.ts.map +1 -0
  112. package/dist/tools/guidance.js +117 -0
  113. package/dist/tools/guidance.js.map +1 -0
  114. package/dist/tools/listTopics.d.ts +55 -0
  115. package/dist/tools/listTopics.d.ts.map +1 -0
  116. package/dist/tools/listTopics.js +78 -0
  117. package/dist/tools/listTopics.js.map +1 -0
  118. package/dist/tools/offers.d.ts +60 -0
  119. package/dist/tools/offers.d.ts.map +1 -0
  120. package/dist/tools/offers.js +152 -0
  121. package/dist/tools/offers.js.map +1 -0
  122. package/dist/tools/placeholders.d.ts +27 -0
  123. package/dist/tools/placeholders.d.ts.map +1 -0
  124. package/dist/tools/placeholders.js +49 -0
  125. package/dist/tools/placeholders.js.map +1 -0
  126. package/dist/tools/recordObservation.d.ts +52 -0
  127. package/dist/tools/recordObservation.d.ts.map +1 -0
  128. package/dist/tools/recordObservation.js +87 -0
  129. package/dist/tools/recordObservation.js.map +1 -0
  130. package/dist/tools/startQuiz.d.ts +82 -0
  131. package/dist/tools/startQuiz.d.ts.map +1 -0
  132. package/dist/tools/startQuiz.js +180 -0
  133. package/dist/tools/startQuiz.js.map +1 -0
  134. package/dist/tools/status.d.ts +59 -0
  135. package/dist/tools/status.d.ts.map +1 -0
  136. package/dist/tools/status.js +133 -0
  137. package/dist/tools/status.js.map +1 -0
  138. package/dist/tools/submitAnswer.d.ts +156 -0
  139. package/dist/tools/submitAnswer.d.ts.map +1 -0
  140. package/dist/tools/submitAnswer.js +402 -0
  141. package/dist/tools/submitAnswer.js.map +1 -0
  142. package/dist/tools/types.d.ts +82 -0
  143. package/dist/tools/types.d.ts.map +1 -0
  144. package/dist/tools/types.js +48 -0
  145. package/dist/tools/types.js.map +1 -0
  146. package/dist/tools/us2/standing.d.ts +111 -0
  147. package/dist/tools/us2/standing.d.ts.map +1 -0
  148. package/dist/tools/us2/standing.js +143 -0
  149. package/dist/tools/us2/standing.js.map +1 -0
  150. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Sjors Robroek
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @vibe-hero/server
2
+
3
+ The vibe-hero MCP server. Exposes 10 MCP tools over stdio that a host agent
4
+ (Claude Code, Codex, Kiro) calls to drive adaptive learning sessions: quiz
5
+ delivery, Elo-style ability tracking, tier graduation, telemetry intake, and
6
+ offer management. All learning state lives here — the host model is stateless.
7
+
8
+ ## Requirements
9
+
10
+ - Node >= 18
11
+ - pnpm (workspace root manages dependencies)
12
+
13
+ ## Build and run
14
+
15
+ ```sh
16
+ # From the repository root — install all workspace deps first
17
+ pnpm install
18
+
19
+ # Compile the server
20
+ pnpm --filter @vibe-hero/server build
21
+
22
+ # Run tests
23
+ pnpm --filter @vibe-hero/server test
24
+
25
+ # Start the MCP server over stdio (for manual inspection / MCP inspector)
26
+ VIBE_HERO_HOME="$(mktemp -d)" pnpm --filter @vibe-hero/server start
27
+ ```
28
+
29
+ `start` executes `node dist/index.js`. The server communicates over stdio using
30
+ the MCP protocol; it is not a long-running HTTP service.
31
+
32
+ ## Environment variables
33
+
34
+ | Variable | Default | Purpose |
35
+ |---|---|---|
36
+ | `VIBE_HERO_HOME` | `~/.vibe-hero` | Root directory for the user profile (`profile.json`) and the content cache (`content/`). Point at a temp dir during tests to avoid touching a real profile. |
37
+ | `VIBE_HERO_CONTENT_URL` | *(disabled)* | URL of a remote content catalog to fetch and cache. When unset, the server serves only the bundled baseline content that ships with the package. |
38
+
39
+ ## Profile location
40
+
41
+ The learner profile is stored at `$VIBE_HERO_HOME/profile.json`
42
+ (default `~/.vibe-hero/profile.json`). It records per-(topic × tool) ability
43
+ estimates, tier graduation state, the review schedule, quiz history, and the
44
+ offer ledger. The profile is global per user — it is not per-project.
45
+
46
+ Profile writes are atomic (write-temp + rename under an advisory lock) so
47
+ concurrent host sessions cannot clobber each other's updates.
48
+
49
+ ## The 10 MCP tools
50
+
51
+ Every tool except `get_config` and `save_config` returns a
52
+ `{ "status": "SETUP_REQUIRED" }` sentinel when the profile has no
53
+ configuration. The host agent should respond by running the `vibe-hero-setup`
54
+ skill.
55
+
56
+ | Tool | Description |
57
+ |---|---|
58
+ | `get_status` | Per-topic standing and tier for a tool (or all tools). Read-only; never requires telemetry. |
59
+ | `list_topics` | Enumerate catalog topics, optionally filtered by tool or class. Returns `catalogVersion`. |
60
+ | `get_guidance` | Teaching text and a suggested next step for a topic, or the weakest/stalest area if no topic is named. |
61
+ | `start_quiz` | Begin a quiz session: selects 3–5 items by difficulty-targeting near current ability. Returns `PresentedItem[]` — answer keys are never included for deterministic items; `rubric` + `referenceAnswer` are included for free-form items so the host agent can judge. |
62
+ | `submit_answer` | Grade one item and update the ability estimate. Deterministic types (multiple-choice, short-answer) are graded by the engine; free-form types accept a per-criterion verdict from the host agent and the engine computes the score. Returns grade, guidance, ability delta, and any graduation change. |
63
+ | `save_config` | Persist the configuration produced by the setup Q&A. Clears the setup gate. Safe to re-run; never wipes learning progress. |
64
+ | `get_config` | Read current configuration (or absence). Used by skills and the Stop hook to check gate state. |
65
+ | `record_observation` | Intake for the Stop hook / telemetry source. Maps observed tool activity to candidate topics for offers. Stores only derived signals — never raw tool input/output. Awards nothing (usage never scores). |
66
+ | `get_offer` | Resolve whether to surface an end-of-work offer for the current session. Called by the Stop hook. Returns an offer or a suppression reason. |
67
+ | `record_offer_response` | Record accept / decline / defer so cadence and anti-nag rules are honored. A decline suppresses further offers for the session; repeated cross-session declines increase backoff and eventually mute offers globally. |
68
+
69
+ Full input/output shapes: `specs/001-vibe-hero-mvp/contracts/mcp-tools.md`.
70
+
71
+ ## Content model
72
+
73
+ Content is organized as a matrix of (topic × class × tier):
74
+
75
+ - **Tier** — 100 to 500 on a cognitive-depth scale (100 = introductory, 500 = expert).
76
+ - **Class** — `general` (tool-agnostic agentic-coding concepts) or `tool:<id>`
77
+ (e.g. `tool:claude-code`). Graduation is tracked independently per tool.
78
+ - **Topic** — one YAML file per (topic × class) under `content/`. Each file
79
+ contains all tier items for that topic plus trigger-signal declarations (the
80
+ tool names the engine uses to attribute observed activity to the topic).
81
+
82
+ Bundled baseline content ships with the package (offline-capable). If
83
+ `VIBE_HERO_CONTENT_URL` is set, the server fetches and caches an updated
84
+ catalog; on failure it falls back to the cached or bundled copy.
85
+
86
+ v1 content: `content/claude-code/` (subagents, context-management, planning)
87
+ and `content/general/` (task-decomposition).
88
+
89
+ ## Assessment model
90
+
91
+ - **Ability estimates** are per-(topic × class) and update on every graded
92
+ answer using an Elo-style formula against fixed item difficulty ratings.
93
+ Item difficulty is authored and never self-updates.
94
+ - **Graduation** to a tier requires crossing the tier boundary by a margin
95
+ (hysteresis band); demotion requires crossing a separate lower threshold.
96
+ Both require holding the crossing for 2 consecutive graded items (dwell),
97
+ preventing flip-flopping at the boundary.
98
+ - **Lapse / review scheduling** — if ability decays below the demotion
99
+ threshold or 30 days pass without assessment, the topic is surfaced for
100
+ review.
101
+ - Tunable parameters (K-factor, tier boundaries, hysteresis margin, decay
102
+ half-life, etc.) live in `src/config.ts`.
103
+
104
+ ## Privacy
105
+
106
+ The server never persists raw prompts, tool inputs, tool outputs, or any user
107
+ content. Observation intake extracts only derived signals:
108
+ `{ tool_name, topicKeys, success, timestamp, tool_use_id }`. The profile
109
+ contains only ability estimates, scores, timestamps, and configuration — no
110
+ content the user typed.
111
+
112
+ ## Wiring into Claude Code
113
+
114
+ ### MCP server
115
+
116
+ Add to `.claude/settings.json` (project) or `~/.claude/settings.json` (global):
117
+
118
+ ```jsonc
119
+ {
120
+ "mcpServers": {
121
+ "vibe-hero": {
122
+ "type": "stdio",
123
+ "command": "node",
124
+ "args": ["/absolute/path/to/vibe-hero/packages/server/dist/index.js"]
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### Stop hook (end-of-work offers)
131
+
132
+ See `hooks/claude-code/README.md` for how to register `hooks/claude-code/stop-offer.sh`
133
+ as a Claude Code Stop hook. The hook requires `jq` on `PATH` and the server
134
+ built (dist present). It is advisory-only: it exits 0 silently on any error.
135
+
136
+ ### Skills (portable agent surface)
137
+
138
+ Copy or reference the four skills from `skills/` into your agent skill path:
139
+
140
+ | Skill | Purpose |
141
+ |---|---|
142
+ | `vibe-hero-setup` | Required first-run Q&A; collects preferences and calls `save_config`. Must run before any other skill works. |
143
+ | `vibe-hero-quiz` | Drives the `start_quiz` / `submit_answer` loop; judges free-form items against the MCP-supplied rubric. |
144
+ | `vibe-hero-status` | Calls `get_status` and renders per-topic standing and suggestions. |
145
+ | `vibe-hero-learn` | Calls `get_guidance` (and optionally `list_topics`) to surface teaching text and a next step. |
146
+
147
+ ## Distribution
148
+
149
+ npm publishing and Claude Code plugin/marketplace bundling are planned as a
150
+ follow-up (spec 002). Currently the server is set up manually as described
151
+ above.
File without changes
@@ -0,0 +1,302 @@
1
+ # Topic: context-management (claude-code)
2
+ #
3
+ # Covers Claude Code context window hygiene: reading strategically, avoiding
4
+ # unnecessary re-reads, compaction, the TodoWrite/TodoRead pattern, and how
5
+ # large context affects performance and cost. Tiers 100–500.
6
+
7
+ id: context-management
8
+ class:
9
+ kind: tool
10
+ tool: claude-code
11
+ title: Context Window Management
12
+ summary: >-
13
+ Keeping the context window lean and effective — strategic reads, avoiding
14
+ re-reads, compaction signals, the Todo list as working memory, and what
15
+ happens when context fills up.
16
+
17
+ triggerSignals:
18
+ - tool: claude-code
19
+ match:
20
+ toolName: TodoWrite
21
+ weight: 1
22
+ - tool: claude-code
23
+ match:
24
+ toolName: TodoRead
25
+ weight: 0.8
26
+ - tool: claude-code
27
+ match:
28
+ toolNamePattern: "^Read$"
29
+ weight: 0.5
30
+ - tool: claude-code
31
+ match:
32
+ mcpToolPattern: ".*compact.*"
33
+ weight: 0.7
34
+
35
+ items:
36
+ # ── Tier 100 — Remember ──────────────────────────────────────────────────
37
+ - id: ctx-100-mc-a
38
+ tier: 100
39
+ bloom: remember
40
+ difficulty: 150
41
+ type: multiple_choice
42
+ prompt: >-
43
+ After successfully writing a file with the Edit or Write tool, should you
44
+ immediately re-read the file to verify the change?
45
+ choices:
46
+ - id: a
47
+ text: >-
48
+ Yes — always re-read to confirm the file on disk matches what you
49
+ intended
50
+ - id: b
51
+ text: >-
52
+ No — Edit/Write would have errored if the change failed; re-reading
53
+ wastes context
54
+ - id: c
55
+ text: >-
56
+ Only re-read files larger than 100 lines
57
+ - id: d
58
+ text: >-
59
+ Re-read only when using Write, not Edit
60
+ answerKey:
61
+ kind: choice
62
+ correctChoiceId: b
63
+ guidance: >-
64
+ The Edit and Write tools error on failure; if they return successfully the
65
+ change landed. Immediately re-reading the file after a successful edit
66
+ adds the full file content to context for no benefit — a costly habit at
67
+ scale.
68
+
69
+ - id: ctx-100-mc-b
70
+ tier: 100
71
+ bloom: remember
72
+ difficulty: 160
73
+ type: multiple_choice
74
+ prompt: >-
75
+ What is the TodoWrite tool used for in Claude Code?
76
+ choices:
77
+ - id: a
78
+ text: Writing TODO comments into source code files
79
+ - id: b
80
+ text: >-
81
+ Maintaining an in-session task list that tracks planned, in-progress,
82
+ and completed work
83
+ - id: c
84
+ text: Scheduling background tasks for later sessions
85
+ - id: d
86
+ text: Sending task notifications to the user
87
+ answerKey:
88
+ kind: choice
89
+ correctChoiceId: b
90
+ guidance: >-
91
+ TodoWrite (paired with TodoRead) is Claude Code's in-session task list.
92
+ It acts as working memory — externalizing what needs to be done so the
93
+ model doesn't have to hold the full plan in context. Mark tasks
94
+ in_progress when starting and completed when done.
95
+
96
+ # ── Tier 200 — Understand ───────────────────────────────────────────────
97
+ - id: ctx-200-mc-a
98
+ tier: 200
99
+ bloom: understand
100
+ difficulty: 250
101
+ type: multiple_choice
102
+ prompt: >-
103
+ You need to understand a function defined in a 2000-line file. What is
104
+ the most context-efficient approach?
105
+ choices:
106
+ - id: a
107
+ text: Read the entire file first, then locate the function
108
+ - id: b
109
+ text: >-
110
+ Use Read with offset and limit parameters to read only the relevant
111
+ section, or use Grep/a symbolic tool to find the function first
112
+ - id: c
113
+ text: Ask the user to paste the function into the chat
114
+ - id: d
115
+ text: Read the first 100 lines, then guess the rest
116
+ answerKey:
117
+ kind: choice
118
+ correctChoiceId: b
119
+ guidance: >-
120
+ Reading an entire large file when you only need a section is one of the
121
+ most common context-wasting patterns. Use Read with `offset`/`limit`, or
122
+ use Grep/symbolic tools to find the exact location first, then read only
123
+ that range. The instructions explicitly say to prefer dedicated tools over
124
+ cat/head/tail for this reason.
125
+
126
+ - id: ctx-200-sa-a
127
+ tier: 200
128
+ bloom: understand
129
+ difficulty: 260
130
+ type: short_answer
131
+ prompt: >-
132
+ What happens to a Claude Code session's context when it gets very full,
133
+ and what is the term for the automatic process that trims it?
134
+ answerKey:
135
+ kind: keyword
136
+ anyOf:
137
+ - compaction
138
+ - compact
139
+ - context compaction
140
+ - auto-compaction
141
+ normalize: lower
142
+ guidance: >-
143
+ When the context window fills up, Claude Code performs *compaction* —
144
+ it summarizes the conversation history to free space. Compaction is
145
+ automatic but lossy: details from earlier in the session may be
146
+ summarized away. Keeping context lean from the start delays compaction
147
+ and reduces information loss.
148
+
149
+ # ── Tier 300 — Apply ────────────────────────────────────────────────────
150
+ - id: ctx-300-mc-a
151
+ tier: 300
152
+ bloom: apply
153
+ difficulty: 350
154
+ type: multiple_choice
155
+ prompt: >-
156
+ You are starting a multi-file refactor that will span many steps. Before
157
+ writing a single line of code, which TodoWrite action is most valuable?
158
+ choices:
159
+ - id: a
160
+ text: >-
161
+ Write a single "refactor everything" task and mark it in_progress
162
+ - id: b
163
+ text: >-
164
+ Break the work into discrete tasks (each file or logical unit), write
165
+ them all to the Todo list, then start the first one
166
+ - id: c
167
+ text: Skip TodoWrite — it adds tool calls that cost context
168
+ - id: d
169
+ text: >-
170
+ Write all tasks as completed so the user sees the plan immediately
171
+ answerKey:
172
+ kind: choice
173
+ correctChoiceId: b
174
+ guidance: >-
175
+ Using TodoWrite to lay out discrete, ordered tasks before starting serves
176
+ as a lightweight project plan external to context. It lets you mark tasks
177
+ in_progress and completed as you go, which both keeps you on track and
178
+ signals to the user that progress is being made. One coarse task gives no
179
+ recovery point if context is compacted mid-session.
180
+
181
+ - id: ctx-300-mc-b
182
+ tier: 300
183
+ bloom: apply
184
+ difficulty: 360
185
+ type: multiple_choice
186
+ prompt: >-
187
+ Your session's context contains the full text of five large files you
188
+ read earlier but no longer need. You are about to start a complex new
189
+ subtask. What is the best strategy?
190
+ choices:
191
+ - id: a
192
+ text: >-
193
+ Continue normally — the model handles large context automatically
194
+ - id: b
195
+ text: >-
196
+ Ask the user to run /compact or /clear before proceeding so stale
197
+ large-file content is removed from context
198
+ - id: c
199
+ text: >-
200
+ Re-read the files you still need, which signals to the model what is
201
+ important
202
+ - id: d
203
+ text: >-
204
+ Open a new terminal session and start over
205
+ answerKey:
206
+ kind: choice
207
+ correctChoiceId: b
208
+ guidance: >-
209
+ Stale large-file content sitting in context is pure waste — it uses
210
+ tokens, may mislead later reasoning, and accelerates compaction. For a
211
+ fresh subtask, prompting the user to run /compact (summarize history) or
212
+ /clear (reset) is the correct hygiene move. The model does not
213
+ automatically prune irrelevant earlier reads.
214
+
215
+ # ── Tier 400 — Analyze ──────────────────────────────────────────────────
216
+ - id: ctx-400-mc-a
217
+ tier: 400
218
+ bloom: analyze
219
+ difficulty: 430
220
+ type: multiple_choice
221
+ prompt: >-
222
+ In a long session you notice the model is forgetting instructions given
223
+ at the start of the conversation. What is the most likely cause?
224
+ choices:
225
+ - id: a
226
+ text: A bug in Claude Code
227
+ - id: b
228
+ text: >-
229
+ Compaction has summarized away the early instructions to free context
230
+ space
231
+ - id: c
232
+ text: The CLAUDE.md file was not loaded
233
+ - id: d
234
+ text: The model intentionally ignores earlier turns in long sessions
235
+ answerKey:
236
+ kind: choice
237
+ correctChoiceId: b
238
+ guidance: >-
239
+ When context fills and compaction runs, the summary may lose or dilute
240
+ instructions given early in the session. Key persistent instructions
241
+ belong in CLAUDE.md (loaded fresh each session) or in the system prompt,
242
+ not only in early conversation turns. Compaction is expected behavior, not
243
+ a bug.
244
+
245
+ - id: ctx-400-sa-a
246
+ tier: 400
247
+ bloom: analyze
248
+ difficulty: 440
249
+ type: short_answer
250
+ prompt: >-
251
+ You must read a PDF file that is 25 pages long. Which Read tool parameter
252
+ must you provide (besides file_path) to avoid a failure, and what is the
253
+ maximum number of pages per request?
254
+ answerKey:
255
+ kind: keyword
256
+ anyOf:
257
+ - pages
258
+ - "pages parameter"
259
+ - "20"
260
+ - "20 pages"
261
+ normalize: lower
262
+ guidance: >-
263
+ The Read tool requires the `pages` parameter for large PDFs (more than 10
264
+ pages) and allows a maximum of 20 pages per request. Attempting to read a
265
+ large PDF without `pages` will fail. For a 25-page document you would need
266
+ two reads: e.g., pages "1-20" then pages "21-25".
267
+
268
+ # ── Tier 500 — Evaluate ─────────────────────────────────────────────────
269
+ - id: ctx-500-mc-a
270
+ tier: 500
271
+ bloom: evaluate
272
+ difficulty: 480
273
+ type: multiple_choice
274
+ prompt: >-
275
+ You are designing a workflow where Claude Code repeatedly re-reads the
276
+ same configuration file at the start of each subtask "to make sure it has
277
+ the latest content." Evaluate this pattern.
278
+ choices:
279
+ - id: a
280
+ text: >-
281
+ Good practice — always read fresh to avoid acting on stale data
282
+ - id: b
283
+ text: >-
284
+ Acceptable for small files; wasteful for large ones
285
+ - id: c
286
+ text: >-
287
+ Anti-pattern: the file was already read and unchanged reads just
288
+ inflate context with duplicate content; only re-read when the file
289
+ might have changed
290
+ - id: d
291
+ text: >-
292
+ Required — the Read tool does not cache content between tool calls
293
+ answerKey:
294
+ kind: choice
295
+ correctChoiceId: c
296
+ guidance: >-
297
+ Re-reading a file that has not changed since the last read is pure context
298
+ inflation. Each re-read copies the full file text into context again,
299
+ accelerating compaction and increasing cost. The correct pattern is to
300
+ read once, act on the result, and only re-read if an intervening action
301
+ (Edit/Write/Bash) has modified the file — or if the file is produced
302
+ externally and genuinely may have changed.