studysystem 1.0.0__tar.gz

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 (112) hide show
  1. studysystem-1.0.0/LICENSE +21 -0
  2. studysystem-1.0.0/PKG-INFO +254 -0
  3. studysystem-1.0.0/README.md +219 -0
  4. studysystem-1.0.0/pyproject.toml +91 -0
  5. studysystem-1.0.0/pyproject.toml.orig +78 -0
  6. studysystem-1.0.0/src/studysystem/__init__.py +1 -0
  7. studysystem-1.0.0/src/studysystem/assets/note-callouts.lua +100 -0
  8. studysystem-1.0.0/src/studysystem/assets/note-no-html.lua +28 -0
  9. studysystem-1.0.0/src/studysystem/assets/note.css +146 -0
  10. studysystem-1.0.0/src/studysystem/cli.py +344 -0
  11. studysystem-1.0.0/src/studysystem/dashboard.html +781 -0
  12. studysystem-1.0.0/src/studysystem/dashboard.py +377 -0
  13. studysystem-1.0.0/src/studysystem/db/__init__.py +1 -0
  14. studysystem-1.0.0/src/studysystem/db/engine.py +158 -0
  15. studysystem-1.0.0/src/studysystem/db/migrate.py +122 -0
  16. studysystem-1.0.0/src/studysystem/db/migrations/env.py +59 -0
  17. studysystem-1.0.0/src/studysystem/db/migrations/script.py.mako +29 -0
  18. studysystem-1.0.0/src/studysystem/db/migrations/versions/0000_baseline.py +19 -0
  19. studysystem-1.0.0/src/studysystem/db/migrations/versions/0001_the_whole_schema.py +1743 -0
  20. studysystem-1.0.0/src/studysystem/db/migrations/versions/0002_semester_ignores_case.py +38 -0
  21. studysystem-1.0.0/src/studysystem/db/migrations/versions/0003_course_vault_folder.py +26 -0
  22. studysystem-1.0.0/src/studysystem/db/migrations/versions/0004_note_pdf_path.py +26 -0
  23. studysystem-1.0.0/src/studysystem/db/migrations/versions/0005_tagging_kind.py +39 -0
  24. studysystem-1.0.0/src/studysystem/db/migrations/versions/0006_practice_mode.py +36 -0
  25. studysystem-1.0.0/src/studysystem/db/migrations/versions/0007_exam_prep_from.py +25 -0
  26. studysystem-1.0.0/src/studysystem/db/migrations/versions/0008_more_papers_kind.py +37 -0
  27. studysystem-1.0.0/src/studysystem/db/migrations/versions/0009_past_exam_month_date.py +28 -0
  28. studysystem-1.0.0/src/studysystem/db/migrations/versions/0010_task_parts.py +70 -0
  29. studysystem-1.0.0/src/studysystem/db/migrations/versions/0011_observation_kind.py +39 -0
  30. studysystem-1.0.0/src/studysystem/db/migrations/versions/0012_profile_claim.py +52 -0
  31. studysystem-1.0.0/src/studysystem/db/migrations/versions/0013_assumed_instructor_papers.py +40 -0
  32. studysystem-1.0.0/src/studysystem/db/migrations/versions/0014_scan_confirmation.py +44 -0
  33. studysystem-1.0.0/src/studysystem/db/migrations/versions/0015_practice_item_count.py +37 -0
  34. studysystem-1.0.0/src/studysystem/db/migrations/versions/0016_timetable_patterns.py +102 -0
  35. studysystem-1.0.0/src/studysystem/db/migrations/versions/0017_course_dropped.py +36 -0
  36. studysystem-1.0.0/src/studysystem/db/migrations/versions/0018_syllabus_topics.py +82 -0
  37. studysystem-1.0.0/src/studysystem/db/migrations/versions/0019_course_lab_group.py +36 -0
  38. studysystem-1.0.0/src/studysystem/db/migrations/versions/0020_chapter_scope.py +61 -0
  39. studysystem-1.0.0/src/studysystem/db/migrations/versions/0021_note_retired_at.py +28 -0
  40. studysystem-1.0.0/src/studysystem/db/migrations/versions/0022_rescope.py +48 -0
  41. studysystem-1.0.0/src/studysystem/db/migrations/versions/0023_backlog_reason.py +42 -0
  42. studysystem-1.0.0/src/studysystem/db/migrations/versions/0024_guess_sensitivity.py +35 -0
  43. studysystem-1.0.0/src/studysystem/db/migrations/versions/0025_shortfall_inputs.py +83 -0
  44. studysystem-1.0.0/src/studysystem/db/migrations/versions/0026_trials_switch.py +36 -0
  45. studysystem-1.0.0/src/studysystem/db/tables.py +1096 -0
  46. studysystem-1.0.0/src/studysystem/demo.py +722 -0
  47. studysystem-1.0.0/src/studysystem/errors.py +39 -0
  48. studysystem-1.0.0/src/studysystem/server/__init__.py +83 -0
  49. studysystem-1.0.0/src/studysystem/server/__main__.py +5 -0
  50. studysystem-1.0.0/src/studysystem/services/__init__.py +1 -0
  51. studysystem-1.0.0/src/studysystem/services/adherence.py +147 -0
  52. studysystem-1.0.0/src/studysystem/services/assessments.py +171 -0
  53. studysystem-1.0.0/src/studysystem/services/capacity.py +164 -0
  54. studysystem-1.0.0/src/studysystem/services/claims.py +405 -0
  55. studysystem-1.0.0/src/studysystem/services/course_folder.py +82 -0
  56. studysystem-1.0.0/src/studysystem/services/courses.py +176 -0
  57. studysystem-1.0.0/src/studysystem/services/coverage.py +121 -0
  58. studysystem-1.0.0/src/studysystem/services/dashboard_key.py +102 -0
  59. studysystem-1.0.0/src/studysystem/services/feedback.py +412 -0
  60. studysystem-1.0.0/src/studysystem/services/forward_eval.py +65 -0
  61. studysystem-1.0.0/src/studysystem/services/gate.py +77 -0
  62. studysystem-1.0.0/src/studysystem/services/generation.py +2864 -0
  63. studysystem-1.0.0/src/studysystem/services/ids.py +15 -0
  64. studysystem-1.0.0/src/studysystem/services/intake.py +278 -0
  65. studysystem-1.0.0/src/studysystem/services/launcher.py +455 -0
  66. studysystem-1.0.0/src/studysystem/services/lookups.py +91 -0
  67. studysystem-1.0.0/src/studysystem/services/materials.py +97 -0
  68. studysystem-1.0.0/src/studysystem/services/note_markdown.py +241 -0
  69. studysystem-1.0.0/src/studysystem/services/notes.py +396 -0
  70. studysystem-1.0.0/src/studysystem/services/parts.py +65 -0
  71. studysystem-1.0.0/src/studysystem/services/past_exams.py +115 -0
  72. studysystem-1.0.0/src/studysystem/services/pdf_render.py +148 -0
  73. studysystem-1.0.0/src/studysystem/services/pdf_worker.py +184 -0
  74. studysystem-1.0.0/src/studysystem/services/plan.py +1300 -0
  75. studysystem-1.0.0/src/studysystem/services/private_view.py +38 -0
  76. studysystem-1.0.0/src/studysystem/services/profiles.py +544 -0
  77. studysystem-1.0.0/src/studysystem/services/programs.py +16 -0
  78. studysystem-1.0.0/src/studysystem/services/replacements.py +107 -0
  79. studysystem-1.0.0/src/studysystem/services/rescope.py +277 -0
  80. studysystem-1.0.0/src/studysystem/services/settings.py +50 -0
  81. studysystem-1.0.0/src/studysystem/services/setup.py +235 -0
  82. studysystem-1.0.0/src/studysystem/services/shortfall.py +443 -0
  83. studysystem-1.0.0/src/studysystem/services/state.py +846 -0
  84. studysystem-1.0.0/src/studysystem/services/statements.py +222 -0
  85. studysystem-1.0.0/src/studysystem/services/study_loop.py +998 -0
  86. studysystem-1.0.0/src/studysystem/services/summaries.py +369 -0
  87. studysystem-1.0.0/src/studysystem/services/syllabus.py +138 -0
  88. studysystem-1.0.0/src/studysystem/services/system_work.py +113 -0
  89. studysystem-1.0.0/src/studysystem/services/taxonomy.py +459 -0
  90. studysystem-1.0.0/src/studysystem/services/topics.py +477 -0
  91. studysystem-1.0.0/src/studysystem/services/trials.py +201 -0
  92. studysystem-1.0.0/src/studysystem/services/unconfirmed.py +95 -0
  93. studysystem-1.0.0/src/studysystem/services/units.py +34 -0
  94. studysystem-1.0.0/src/studysystem/services/users.py +53 -0
  95. studysystem-1.0.0/src/studysystem/services/values.py +168 -0
  96. studysystem-1.0.0/src/studysystem/startup.py +147 -0
  97. studysystem-1.0.0/src/studysystem/tools/__init__.py +4 -0
  98. studysystem-1.0.0/src/studysystem/tools/course_setup.py +185 -0
  99. studysystem-1.0.0/src/studysystem/tools/dashboard.py +27 -0
  100. studysystem-1.0.0/src/studysystem/tools/feedback.py +66 -0
  101. studysystem-1.0.0/src/studysystem/tools/gate.py +24 -0
  102. studysystem-1.0.0/src/studysystem/tools/generation.py +156 -0
  103. studysystem-1.0.0/src/studysystem/tools/materials.py +32 -0
  104. studysystem-1.0.0/src/studysystem/tools/notes.py +29 -0
  105. studysystem-1.0.0/src/studysystem/tools/past_exams.py +51 -0
  106. studysystem-1.0.0/src/studysystem/tools/ping.py +9 -0
  107. studysystem-1.0.0/src/studysystem/tools/plan.py +40 -0
  108. studysystem-1.0.0/src/studysystem/tools/profiles.py +94 -0
  109. studysystem-1.0.0/src/studysystem/tools/results.py +77 -0
  110. studysystem-1.0.0/src/studysystem/tools/study_loop.py +145 -0
  111. studysystem-1.0.0/src/studysystem/tools/summaries.py +52 -0
  112. studysystem-1.0.0/src/studysystem/tools/topics.py +143 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mohammadmassaf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: studysystem
3
+ Version: 1.0.0
4
+ Summary: An MCP server that plans and tracks a student's semester: courses, past exams, topics, a ranked study plan, logged hours.
5
+ Keywords: mcp,study-planner,exam-prep,spaced-repetition,claude
6
+ Author: mohammadmassaf
7
+ Author-email: mohammadmassaf <mohammadmassaf1@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Education
16
+ Requires-Dist: alembic>=1.20.0,<2
17
+ Requires-Dist: click>=8.5.0,<9
18
+ Requires-Dist: fsrs==6.3.2
19
+ Requires-Dist: jsonschema>=4.26.0,<5
20
+ Requires-Dist: mcp>=2,<3
21
+ Requires-Dist: pillow>=12.3.0,<14
22
+ Requires-Dist: platformdirs>=4.11.9,<5
23
+ Requires-Dist: pypandoc-binary>=1.17,<2
24
+ Requires-Dist: pypdf>=6.19.0,<8
25
+ Requires-Dist: pypdfium2>=5.13.0,<6
26
+ Requires-Dist: python-ulid>=4.0.1,<5
27
+ Requires-Dist: sqlalchemy>=2.0.54,<2.2
28
+ Requires-Dist: starlette>=1.6.0,<2
29
+ Requires-Dist: uvicorn>=0.52.4,<1
30
+ Requires-Python: >=3.13
31
+ Project-URL: Homepage, https://github.com/mohammadmassaf/STUDYSYSTEM
32
+ Project-URL: Source, https://github.com/mohammadmassaf/STUDYSYSTEM
33
+ Project-URL: Issues, https://github.com/mohammadmassaf/STUDYSYSTEM/issues
34
+ Description-Content-Type: text/markdown
35
+
36
+ # STUDYSYSTEM
37
+
38
+ An MCP server that plans and tracks a student's semester: courses, past exams, topics, a ranked
39
+ study plan, logged hours. Python 3.13 or later, official `mcp` SDK v2, managed with `uv`.
40
+
41
+ The server never calls a model. The host (Claude Desktop, Cowork...) does all the generation; the
42
+ server stores, validates and schedules. Generation is a two-tool contract: the host asks
43
+ `study_start_generation` for a task, does it, and hands the result to `study_submit_generation`,
44
+ which keeps what passes the schema.
45
+
46
+ ## Install
47
+
48
+ You need Windows or macOS, and [Claude Desktop](https://claude.com/download) (Cowork is part of it).
49
+ You do not need this repo, and you do not need Python: uv brings its own.
50
+
51
+ On Windows, Cowork also needs Windows' Virtual Machine Platform, and a Claude that was installed with
52
+ administrator rights ([Claude's requirements](https://support.claude.com/en/articles/12622703)).
53
+
54
+ 1. **Open a terminal outside Claude.** On Windows: Start menu, Windows PowerShell. On a Mac: Terminal.
55
+ Do every step there. Windows keeps what is made inside Claude private to it: uv's Python download
56
+ fails there, and step 4 refuses.
57
+ 2. **Install [uv](https://docs.astral.sh/uv/getting-started/installation/)**, then close the terminal
58
+ and open a new one, so that it finds `uv`.
59
+
60
+ Windows:
61
+
62
+ ```powershell
63
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
64
+ ```
65
+
66
+ macOS:
67
+
68
+ ```sh
69
+ curl -LsSf https://astral.sh/uv/install.sh | sh
70
+ ```
71
+
72
+ 3. **Install the study system:**
73
+
74
+ ```sh
75
+ uv tool install studysystem
76
+ ```
77
+
78
+ If uv warns that its folder is not on your PATH, run `uv tool update-shell` and open a new
79
+ terminal.
80
+ 4. **Set up this computer.** Create a folder for your notes first (an Obsidian vault's study folder
81
+ works too). Start Claude once if you never did. Then run:
82
+
83
+ ```sh
84
+ study setup
85
+ ```
86
+
87
+ It asks for the full path of that folder, tells you how to quit Claude, connects Claude, and asks
88
+ whether the dashboard starts every time you sign in.
89
+ 5. **Check it.** Start Claude, open a new Cowork task, and write: *Call study_ping.* The answer is
90
+ the current time.
91
+
92
+ Run `study setup` before you paste an entry into any host by hand. Setup makes the data folder; on
93
+ Windows, a server that Claude starts first makes one that only Claude sees.
94
+
95
+ If setup finds no Claude config, start Claude, quit it, and run `study setup` again.
96
+
97
+ ### The slash commands
98
+
99
+ The step-by-step flows are slash commands in a plugin: `/study-plan`, `/study-day`, `/add-chapter`
100
+ and `/explain-chapter`. Each one names the tools to call and their order, so the hours land on the
101
+ plan's item.
102
+
103
+ In Cowork: Customize > Plugins > Add marketplace, enter `mohammadmassaf/STUDYSYSTEM`, then install
104
+ `studysystem` from it. In Claude Code:
105
+
106
+ ```sh
107
+ claude plugin marketplace add mohammadmassaf/STUDYSYSTEM
108
+ claude plugin install studysystem@studysystem
109
+ ```
110
+
111
+ ### Other hosts
112
+
113
+ The server speaks MCP on stdio. At its end, `study setup` prints the entry to paste into the host's
114
+ MCP config (Claude Code, Gemini CLI). It holds the full path of `study`:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "studysystem": {
120
+ "command": "/full/path/to/study",
121
+ "args": ["serve"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ For Codex, whose config is not JSON, `study setup` prints a line to run instead:
128
+
129
+ ```sh
130
+ codex mcp add studysystem -- "/full/path/to/study" serve
131
+ ```
132
+
133
+ ### What setup decides
134
+
135
+ - **The output folder.** Notes and summaries are written under it as markdown and PDF, in each
136
+ course's `vault_folder`; a course with none gets `<semester>/<code> - <name>`. With no output
137
+ folder, notes are still saved in the database, but every export reports it. Outside code, the
138
+ files hold no image, HTML or live block: a picture becomes `[image: its text]`.
139
+ `STUDYSYSTEM_VAULT_DIR` is used only while no folder is saved. To change the folder, run
140
+ `study setup` again.
141
+ - **The start at sign-in.** On Windows and macOS (not yet tested on a Mac). Your computer's startup
142
+ settings turn it off.
143
+ Without it, `study start` starts the dashboard in the background.
144
+ - **The dashboard's lock.** The dashboard answers only a browser that the study system opened:
145
+ ask your AI to open the dashboard, or open the link that `study start` prints (each link works
146
+ once). A bookmark of http://127.0.0.1:8765 works in that browser after that.
147
+ - **PDFs** are printed with a local Chrome, Chromium or Edge. If none is found on the usual paths,
148
+ set `STUDYSYSTEM_CHROME` to the browser's executable.
149
+
150
+ ## Upgrade
151
+
152
+ 1. Quit Claude. Closing its window is not enough: on Windows use the icon near the clock, then Quit;
153
+ on a Mac press Cmd+Q.
154
+ 2. In a terminal outside Claude, paste this line:
155
+
156
+ ```sh
157
+ study stop; uv tool upgrade studysystem; study migrate; study start
158
+ ```
159
+
160
+ 3. Start Claude. In Cowork, Customize > Plugins, choose "Check for updates" on the marketplace.
161
+
162
+ `study migrate` copies the database first, then updates it. After an upgrade that changes the
163
+ database, the tools and the dashboard refuse until you run it, and name this command.
164
+ [CHANGELOG.md](https://github.com/mohammadmassaf/STUDYSYSTEM/blob/main/CHANGELOG.md) says which
165
+ versions do.
166
+
167
+ ## Try it without your own data
168
+
169
+ See a working dashboard on invented data. After the install, run `study demo` and open
170
+ http://127.0.0.1:8766. Without installing it, uv alone is enough:
171
+
172
+ ```sh
173
+ uvx --from studysystem study demo
174
+ ```
175
+
176
+ The data is shaped like a real semester: nine courses, past papers, topics, a ranked plan and a month
177
+ of logged hours, all dated relative to the day you run it. The command builds its own database in a
178
+ folder of its own (`studysystem-demo` beside the real data folder) and rebuilds it on every run. It
179
+ never opens, reads or changes your own database.
180
+
181
+ ## Tools
182
+
183
+ All tools start with `study_`. A failure comes back as `{code, message, field_errors[], fix}`.
184
+
185
+ - **Setup:** `study_add_course`, `study_drop_course`, `study_set_course_input`,
186
+ `study_add_assessment`, `study_set_assessment_input`, `study_set_capacity`,
187
+ `study_accept_capacity_suggestion`
188
+ - **Evidence:** `study_add_past_exam`, `study_add_material`, `study_add_instructor_statement`
189
+ - **Generation:** `study_start_generation`, `study_submit_generation` (transcription, notes,
190
+ tagging), `study_confirm_transcription`, `study_rescope_generation`, `study_export_notes`,
191
+ `study_get_summary_task`, `study_save_summary`
192
+ - **Feedback:** `study_submit_feedback` (a rule it proposes counts only after you confirm it on the
193
+ dashboard's Plan page)
194
+ - **Topics and profiles:** `study_get_topics`, `study_confirm_topic_proposal`,
195
+ `study_add_syllabus_topics`, `study_merge_topics`, `study_split_topic`, `study_derive_profile`
196
+ - **Plan and study loop:** `study_get_plan`, `study_respond_to_offer`, `study_start_session`,
197
+ `study_submit_attempt`, `study_log_hours` (the only way minutes are recorded), `study_get_gate`
198
+ - **Dashboard:** `study_dashboard`
199
+ - **Generator trials:** `study_set_trials` (off by default; see below)
200
+ - **Smoke test:** `study_ping`
201
+
202
+ ### Generator trials (optional)
203
+
204
+ `study_set_trials` (or the switch on the dashboard's Plan page) turns on discrimination trials.
205
+ With them on, every walkthrough of a past paper hides one generated question among the paper's
206
+ questions. After each answer the host asks "real or generated?", the server records the guess,
207
+ and then it shows where the question came from. The guesses test how real the generated
208
+ questions look. They are off by default, because they add a question to every walkthrough
209
+ answer: turn them on only if you want to judge the generator.
210
+
211
+ ## Where the data lives
212
+
213
+ - The database is `studysystem.db` in the platform data folder (on Windows
214
+ `%LOCALAPPDATA%\studysystem`). The first start of the server or the dashboard builds it. Set
215
+ `STUDYSYSTEM_DATA_DIR` to use another folder (`study setup` refuses while it is set). Keep it out
216
+ of cloud-synced folders.
217
+ - `snapshots/` next to it holds restore points: one copy per day at server start, plus one
218
+ before every `study migrate` (`-premigrate-`) and `study downgrade` (`-predowngrade-`).
219
+ To restore one, stop every server and the dashboard, move `studysystem.db`,
220
+ `studysystem.db-wal` and `studysystem.db-shm` (those that are there) to another folder, then
221
+ copy the snapshot back as `studysystem.db`: an old `-wal` file changes or damages the copy. If the database goes missing while a copy is here, the server
222
+ refuses to start instead of building an empty one;
223
+ to start over with an empty one, run `study migrate`.
224
+ - `papers/` holds the server's own copy of every past paper and material, named by its hash.
225
+
226
+ ## Commands
227
+
228
+ - `study setup` - set up this computer: the output folder, Claude, the start at sign-in.
229
+ - `study start`, `study stop` - start and stop the dashboard in the background. `study start` prints
230
+ the link that opens it.
231
+ - `study dashboard` - serve the dashboard in this terminal.
232
+ - `study demo` - the dashboard on invented data.
233
+ - `study migrate` - snapshot, then bring the database up to date. Run it after every upgrade.
234
+ - `study serve` - start the MCP server on stdio. The host runs this, not you.
235
+ - `study downgrade <revision|base>` - undo migrations (development only; it drops tables and columns,
236
+ so it snapshots first).
237
+
238
+ ## Development
239
+
240
+ Work on the code from a clone:
241
+
242
+ - `uv sync` - install the dependencies. Every command then runs through uv: `uv run study demo`,
243
+ `uv run study migrate`.
244
+ - Without `STUDYSYSTEM_DATA_DIR`, a clone uses the same data folder as the installed one. Set it to
245
+ another folder to leave your own data alone.
246
+ - `uv run pytest` - the full suite. Without a Postgres it proves SQLite only; the Postgres
247
+ cases skip themselves.
248
+ - `uv run ruff check` - lint.
249
+ - To run both engines locally, bring up the Postgres in `compose.yaml`. The commands are in
250
+ that file's header comment. CI runs both engines on every pull request and on every push to
251
+ `main`.
252
+ - `uv run python scripts/build_plugin.py` - build the plugin as a file, `dist/studysystem.plugin`, to
253
+ try a change under `plugin/` before it is on `main`. Raise `version` in
254
+ `plugin/.claude-plugin/plugin.json` only at a release.
@@ -0,0 +1,219 @@
1
+ # STUDYSYSTEM
2
+
3
+ An MCP server that plans and tracks a student's semester: courses, past exams, topics, a ranked
4
+ study plan, logged hours. Python 3.13 or later, official `mcp` SDK v2, managed with `uv`.
5
+
6
+ The server never calls a model. The host (Claude Desktop, Cowork...) does all the generation; the
7
+ server stores, validates and schedules. Generation is a two-tool contract: the host asks
8
+ `study_start_generation` for a task, does it, and hands the result to `study_submit_generation`,
9
+ which keeps what passes the schema.
10
+
11
+ ## Install
12
+
13
+ You need Windows or macOS, and [Claude Desktop](https://claude.com/download) (Cowork is part of it).
14
+ You do not need this repo, and you do not need Python: uv brings its own.
15
+
16
+ On Windows, Cowork also needs Windows' Virtual Machine Platform, and a Claude that was installed with
17
+ administrator rights ([Claude's requirements](https://support.claude.com/en/articles/12622703)).
18
+
19
+ 1. **Open a terminal outside Claude.** On Windows: Start menu, Windows PowerShell. On a Mac: Terminal.
20
+ Do every step there. Windows keeps what is made inside Claude private to it: uv's Python download
21
+ fails there, and step 4 refuses.
22
+ 2. **Install [uv](https://docs.astral.sh/uv/getting-started/installation/)**, then close the terminal
23
+ and open a new one, so that it finds `uv`.
24
+
25
+ Windows:
26
+
27
+ ```powershell
28
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
29
+ ```
30
+
31
+ macOS:
32
+
33
+ ```sh
34
+ curl -LsSf https://astral.sh/uv/install.sh | sh
35
+ ```
36
+
37
+ 3. **Install the study system:**
38
+
39
+ ```sh
40
+ uv tool install studysystem
41
+ ```
42
+
43
+ If uv warns that its folder is not on your PATH, run `uv tool update-shell` and open a new
44
+ terminal.
45
+ 4. **Set up this computer.** Create a folder for your notes first (an Obsidian vault's study folder
46
+ works too). Start Claude once if you never did. Then run:
47
+
48
+ ```sh
49
+ study setup
50
+ ```
51
+
52
+ It asks for the full path of that folder, tells you how to quit Claude, connects Claude, and asks
53
+ whether the dashboard starts every time you sign in.
54
+ 5. **Check it.** Start Claude, open a new Cowork task, and write: *Call study_ping.* The answer is
55
+ the current time.
56
+
57
+ Run `study setup` before you paste an entry into any host by hand. Setup makes the data folder; on
58
+ Windows, a server that Claude starts first makes one that only Claude sees.
59
+
60
+ If setup finds no Claude config, start Claude, quit it, and run `study setup` again.
61
+
62
+ ### The slash commands
63
+
64
+ The step-by-step flows are slash commands in a plugin: `/study-plan`, `/study-day`, `/add-chapter`
65
+ and `/explain-chapter`. Each one names the tools to call and their order, so the hours land on the
66
+ plan's item.
67
+
68
+ In Cowork: Customize > Plugins > Add marketplace, enter `mohammadmassaf/STUDYSYSTEM`, then install
69
+ `studysystem` from it. In Claude Code:
70
+
71
+ ```sh
72
+ claude plugin marketplace add mohammadmassaf/STUDYSYSTEM
73
+ claude plugin install studysystem@studysystem
74
+ ```
75
+
76
+ ### Other hosts
77
+
78
+ The server speaks MCP on stdio. At its end, `study setup` prints the entry to paste into the host's
79
+ MCP config (Claude Code, Gemini CLI). It holds the full path of `study`:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "studysystem": {
85
+ "command": "/full/path/to/study",
86
+ "args": ["serve"]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ For Codex, whose config is not JSON, `study setup` prints a line to run instead:
93
+
94
+ ```sh
95
+ codex mcp add studysystem -- "/full/path/to/study" serve
96
+ ```
97
+
98
+ ### What setup decides
99
+
100
+ - **The output folder.** Notes and summaries are written under it as markdown and PDF, in each
101
+ course's `vault_folder`; a course with none gets `<semester>/<code> - <name>`. With no output
102
+ folder, notes are still saved in the database, but every export reports it. Outside code, the
103
+ files hold no image, HTML or live block: a picture becomes `[image: its text]`.
104
+ `STUDYSYSTEM_VAULT_DIR` is used only while no folder is saved. To change the folder, run
105
+ `study setup` again.
106
+ - **The start at sign-in.** On Windows and macOS (not yet tested on a Mac). Your computer's startup
107
+ settings turn it off.
108
+ Without it, `study start` starts the dashboard in the background.
109
+ - **The dashboard's lock.** The dashboard answers only a browser that the study system opened:
110
+ ask your AI to open the dashboard, or open the link that `study start` prints (each link works
111
+ once). A bookmark of http://127.0.0.1:8765 works in that browser after that.
112
+ - **PDFs** are printed with a local Chrome, Chromium or Edge. If none is found on the usual paths,
113
+ set `STUDYSYSTEM_CHROME` to the browser's executable.
114
+
115
+ ## Upgrade
116
+
117
+ 1. Quit Claude. Closing its window is not enough: on Windows use the icon near the clock, then Quit;
118
+ on a Mac press Cmd+Q.
119
+ 2. In a terminal outside Claude, paste this line:
120
+
121
+ ```sh
122
+ study stop; uv tool upgrade studysystem; study migrate; study start
123
+ ```
124
+
125
+ 3. Start Claude. In Cowork, Customize > Plugins, choose "Check for updates" on the marketplace.
126
+
127
+ `study migrate` copies the database first, then updates it. After an upgrade that changes the
128
+ database, the tools and the dashboard refuse until you run it, and name this command.
129
+ [CHANGELOG.md](https://github.com/mohammadmassaf/STUDYSYSTEM/blob/main/CHANGELOG.md) says which
130
+ versions do.
131
+
132
+ ## Try it without your own data
133
+
134
+ See a working dashboard on invented data. After the install, run `study demo` and open
135
+ http://127.0.0.1:8766. Without installing it, uv alone is enough:
136
+
137
+ ```sh
138
+ uvx --from studysystem study demo
139
+ ```
140
+
141
+ The data is shaped like a real semester: nine courses, past papers, topics, a ranked plan and a month
142
+ of logged hours, all dated relative to the day you run it. The command builds its own database in a
143
+ folder of its own (`studysystem-demo` beside the real data folder) and rebuilds it on every run. It
144
+ never opens, reads or changes your own database.
145
+
146
+ ## Tools
147
+
148
+ All tools start with `study_`. A failure comes back as `{code, message, field_errors[], fix}`.
149
+
150
+ - **Setup:** `study_add_course`, `study_drop_course`, `study_set_course_input`,
151
+ `study_add_assessment`, `study_set_assessment_input`, `study_set_capacity`,
152
+ `study_accept_capacity_suggestion`
153
+ - **Evidence:** `study_add_past_exam`, `study_add_material`, `study_add_instructor_statement`
154
+ - **Generation:** `study_start_generation`, `study_submit_generation` (transcription, notes,
155
+ tagging), `study_confirm_transcription`, `study_rescope_generation`, `study_export_notes`,
156
+ `study_get_summary_task`, `study_save_summary`
157
+ - **Feedback:** `study_submit_feedback` (a rule it proposes counts only after you confirm it on the
158
+ dashboard's Plan page)
159
+ - **Topics and profiles:** `study_get_topics`, `study_confirm_topic_proposal`,
160
+ `study_add_syllabus_topics`, `study_merge_topics`, `study_split_topic`, `study_derive_profile`
161
+ - **Plan and study loop:** `study_get_plan`, `study_respond_to_offer`, `study_start_session`,
162
+ `study_submit_attempt`, `study_log_hours` (the only way minutes are recorded), `study_get_gate`
163
+ - **Dashboard:** `study_dashboard`
164
+ - **Generator trials:** `study_set_trials` (off by default; see below)
165
+ - **Smoke test:** `study_ping`
166
+
167
+ ### Generator trials (optional)
168
+
169
+ `study_set_trials` (or the switch on the dashboard's Plan page) turns on discrimination trials.
170
+ With them on, every walkthrough of a past paper hides one generated question among the paper's
171
+ questions. After each answer the host asks "real or generated?", the server records the guess,
172
+ and then it shows where the question came from. The guesses test how real the generated
173
+ questions look. They are off by default, because they add a question to every walkthrough
174
+ answer: turn them on only if you want to judge the generator.
175
+
176
+ ## Where the data lives
177
+
178
+ - The database is `studysystem.db` in the platform data folder (on Windows
179
+ `%LOCALAPPDATA%\studysystem`). The first start of the server or the dashboard builds it. Set
180
+ `STUDYSYSTEM_DATA_DIR` to use another folder (`study setup` refuses while it is set). Keep it out
181
+ of cloud-synced folders.
182
+ - `snapshots/` next to it holds restore points: one copy per day at server start, plus one
183
+ before every `study migrate` (`-premigrate-`) and `study downgrade` (`-predowngrade-`).
184
+ To restore one, stop every server and the dashboard, move `studysystem.db`,
185
+ `studysystem.db-wal` and `studysystem.db-shm` (those that are there) to another folder, then
186
+ copy the snapshot back as `studysystem.db`: an old `-wal` file changes or damages the copy. If the database goes missing while a copy is here, the server
187
+ refuses to start instead of building an empty one;
188
+ to start over with an empty one, run `study migrate`.
189
+ - `papers/` holds the server's own copy of every past paper and material, named by its hash.
190
+
191
+ ## Commands
192
+
193
+ - `study setup` - set up this computer: the output folder, Claude, the start at sign-in.
194
+ - `study start`, `study stop` - start and stop the dashboard in the background. `study start` prints
195
+ the link that opens it.
196
+ - `study dashboard` - serve the dashboard in this terminal.
197
+ - `study demo` - the dashboard on invented data.
198
+ - `study migrate` - snapshot, then bring the database up to date. Run it after every upgrade.
199
+ - `study serve` - start the MCP server on stdio. The host runs this, not you.
200
+ - `study downgrade <revision|base>` - undo migrations (development only; it drops tables and columns,
201
+ so it snapshots first).
202
+
203
+ ## Development
204
+
205
+ Work on the code from a clone:
206
+
207
+ - `uv sync` - install the dependencies. Every command then runs through uv: `uv run study demo`,
208
+ `uv run study migrate`.
209
+ - Without `STUDYSYSTEM_DATA_DIR`, a clone uses the same data folder as the installed one. Set it to
210
+ another folder to leave your own data alone.
211
+ - `uv run pytest` - the full suite. Without a Postgres it proves SQLite only; the Postgres
212
+ cases skip themselves.
213
+ - `uv run ruff check` - lint.
214
+ - To run both engines locally, bring up the Postgres in `compose.yaml`. The commands are in
215
+ that file's header comment. CI runs both engines on every pull request and on every push to
216
+ `main`.
217
+ - `uv run python scripts/build_plugin.py` - build the plugin as a file, `dist/studysystem.plugin`, to
218
+ try a change under `plugin/` before it is on `main`. Raise `version` in
219
+ `plugin/.claude-plugin/plugin.json` only at a release.
@@ -0,0 +1,91 @@
1
+ [project]
2
+ name = "studysystem"
3
+ version = "1.0.0"
4
+ description = "An MCP server that plans and tracks a student's semester: courses, past exams, topics, a ranked study plan, logged hours."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.13"
9
+ keywords = [
10
+ "mcp",
11
+ "study-planner",
12
+ "exam-prep",
13
+ "spaced-repetition",
14
+ "claude",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 5 - Production/Stable",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Education",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Education",
23
+ ]
24
+ dependencies = [
25
+ "alembic>=1.20.0,<2",
26
+ "click>=8.5.0,<9",
27
+ "fsrs==6.3.2",
28
+ "jsonschema>=4.26.0,<5",
29
+ "mcp>=2,<3",
30
+ "pillow>=12.3.0,<14",
31
+ "platformdirs>=4.11.9,<5",
32
+ "pypandoc-binary>=1.17,<2",
33
+ "pypdf>=6.19.0,<8",
34
+ "pypdfium2>=5.13.0,<6",
35
+ "python-ulid>=4.0.1,<5",
36
+ "sqlalchemy>=2.0.54,<2.2",
37
+ "starlette>=1.6.0,<2",
38
+ "uvicorn>=0.52.4,<1",
39
+ ]
40
+
41
+ [[project.authors]]
42
+ name = "mohammadmassaf"
43
+ email = "mohammadmassaf1@gmail.com"
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/mohammadmassaf/STUDYSYSTEM"
47
+ Source = "https://github.com/mohammadmassaf/STUDYSYSTEM"
48
+ Issues = "https://github.com/mohammadmassaf/STUDYSYSTEM/issues"
49
+
50
+ [project.scripts]
51
+ study = "studysystem.cli:study"
52
+
53
+ [build-system]
54
+ requires = ["uv_build>=0.12.13,<0.13.0"]
55
+ build-backend = "uv_build"
56
+
57
+ [dependency-groups]
58
+ dev = [
59
+ "playwright>=1.64.0",
60
+ "psycopg[binary]>=3.3.6",
61
+ "pytest>=9.1.1",
62
+ "ruff>=0.16.7",
63
+ ]
64
+
65
+ [tool.ruff]
66
+ line-length = 100
67
+ target-version = "py313"
68
+ src = [
69
+ "src",
70
+ "tests",
71
+ ]
72
+
73
+ [tool.ruff.lint]
74
+ select = [
75
+ "E",
76
+ "F",
77
+ "I",
78
+ "UP",
79
+ "B",
80
+ "DTZ",
81
+ ]
82
+
83
+ [tool.ruff.lint.per-file-ignores]
84
+ "src/studysystem/db/migrations/versions/*" = ["E501"]
85
+
86
+ [tool.pytest.ini_options]
87
+ testpaths = ["tests"]
88
+
89
+ [tool.pyright]
90
+ venvPath = "."
91
+ venv = ".venv"
@@ -0,0 +1,78 @@
1
+ [project]
2
+ name = "studysystem"
3
+ version = "1.0.0"
4
+ description = "An MCP server that plans and tracks a student's semester: courses, past exams, topics, a ranked study plan, logged hours."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "mohammadmassaf", email = "mohammadmassaf1@gmail.com" }
10
+ ]
11
+ requires-python = ">=3.13"
12
+ keywords = ["mcp", "study-planner", "exam-prep", "spaced-repetition", "claude"]
13
+ classifiers = [
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Education",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Topic :: Education",
20
+ ]
21
+ # uv tool install ignores uv.lock: each limit stops below the next untested release (D-360).
22
+ dependencies = [
23
+ "alembic>=1.20.0,<2",
24
+ "click>=8.5.0,<9",
25
+ "fsrs==6.3.2",
26
+ "jsonschema>=4.26.0,<5",
27
+ "mcp>=2,<3",
28
+ "pillow>=12.3.0,<14",
29
+ "platformdirs>=4.11.9,<5",
30
+ "pypandoc-binary>=1.17,<2",
31
+ "pypdf>=6.19.0,<8",
32
+ "pypdfium2>=5.13.0,<6",
33
+ "python-ulid>=4.0.1,<5",
34
+ "sqlalchemy>=2.0.54,<2.2",
35
+ "starlette>=1.6.0,<2",
36
+ "uvicorn>=0.52.4,<1",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/mohammadmassaf/STUDYSYSTEM"
41
+ Source = "https://github.com/mohammadmassaf/STUDYSYSTEM"
42
+ Issues = "https://github.com/mohammadmassaf/STUDYSYSTEM/issues"
43
+
44
+ [project.scripts]
45
+ study = "studysystem.cli:study"
46
+
47
+ [build-system]
48
+ requires = ["uv_build>=0.12.13,<0.13.0"]
49
+ build-backend = "uv_build"
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "playwright>=1.64.0",
54
+ "psycopg[binary]>=3.3.6",
55
+ "pytest>=9.1.1",
56
+ "ruff>=0.16.7",
57
+ ]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py313"
62
+ src = ["src", "tests"]
63
+
64
+ [tool.ruff.lint]
65
+ select = ["E", "F", "I", "UP", "B", "DTZ"]
66
+
67
+ [tool.ruff.lint.per-file-ignores]
68
+ # Alembic writes one long line per constraint; the file is generated, not hand-kept.
69
+ "src/studysystem/db/migrations/versions/*" = ["E501"]
70
+
71
+ [tool.pytest.ini_options]
72
+ testpaths = ["tests"]
73
+
74
+ # The editor's type checker resolves imports from uv's environment, not whichever Python the
75
+ # editor picked - without it every import of a dependency reads as missing.
76
+ [tool.pyright]
77
+ venvPath = "."
78
+ venv = ".venv"
@@ -0,0 +1 @@
1
+ """STUDYSYSTEM: an MCP server that plans and tracks a student's semester."""