studytrails 0.2.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 (37) hide show
  1. studytrails-0.2.0/.gitignore +24 -0
  2. studytrails-0.2.0/.python-version +1 -0
  3. studytrails-0.2.0/CONTRIBUTING.md +95 -0
  4. studytrails-0.2.0/LICENSE +21 -0
  5. studytrails-0.2.0/PKG-INFO +62 -0
  6. studytrails-0.2.0/README.md +176 -0
  7. studytrails-0.2.0/assets/banner.svg +20 -0
  8. studytrails-0.2.0/assets/logo.svg +9 -0
  9. studytrails-0.2.0/docs/PYPI.md +47 -0
  10. studytrails-0.2.0/docs/RELEASING.md +70 -0
  11. studytrails-0.2.0/docs/USER_GUIDE.md +103 -0
  12. studytrails-0.2.0/pyproject.toml +43 -0
  13. studytrails-0.2.0/study_agent/__init__.py +1 -0
  14. studytrails-0.2.0/study_agent/__main__.py +3 -0
  15. studytrails-0.2.0/study_agent/agent.py +121 -0
  16. studytrails-0.2.0/study_agent/cli.py +298 -0
  17. studytrails-0.2.0/study_agent/config.py +54 -0
  18. studytrails-0.2.0/study_agent/default_notes/java/basics.md +11 -0
  19. studytrails-0.2.0/study_agent/default_notes/python/collections.md +25 -0
  20. studytrails-0.2.0/study_agent/default_notes/python/functions.md +29 -0
  21. studytrails-0.2.0/study_agent/default_notes/python/loops.md +30 -0
  22. studytrails-0.2.0/study_agent/demo.py +48 -0
  23. studytrails-0.2.0/study_agent/models.py +42 -0
  24. studytrails-0.2.0/study_agent/notes.py +39 -0
  25. studytrails-0.2.0/study_agent/onboarding.py +167 -0
  26. studytrails-0.2.0/study_agent/preferences.py +107 -0
  27. studytrails-0.2.0/study_agent/storage.py +142 -0
  28. studytrails-0.2.0/study_agent/tools.py +63 -0
  29. studytrails-0.2.0/tests/conftest.py +39 -0
  30. studytrails-0.2.0/tests/test_agent.py +158 -0
  31. studytrails-0.2.0/tests/test_cli.py +84 -0
  32. studytrails-0.2.0/tests/test_config.py +26 -0
  33. studytrails-0.2.0/tests/test_onboarding.py +271 -0
  34. studytrails-0.2.0/tests/test_storage.py +53 -0
  35. studytrails-0.2.0/tests/test_tools.py +47 -0
  36. studytrails-0.2.0/tests/wheel_smoke.py +58 -0
  37. studytrails-0.2.0/uv.lock +593 -0
@@ -0,0 +1,24 @@
1
+ .venv/
2
+ .venv-*/
3
+ .env
4
+ .env.*
5
+ !.env.example
6
+ data/
7
+ notes/private/
8
+ __pycache__/
9
+ *.py[cod]
10
+ .pytest_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ *.egg-info/
14
+ build/
15
+ dist/
16
+ .uv-cache/
17
+ .idea/
18
+ .vscode/
19
+
20
+ config.json
21
+ config.tmp
22
+ notes/personal/
23
+ notes/python/
24
+ notes/java/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,95 @@
1
+ # Contributing to StudyTrail
2
+
3
+ Thanks for helping make StudyTrail easier to learn from and more useful to study with.
4
+ Small, focused improvements are welcome, including documentation-only changes.
5
+
6
+ ## Choose a contribution
7
+
8
+ - Report a bug with clear steps to reproduce it.
9
+ - Improve setup instructions or add a useful example.
10
+ - Add accurate study notes you wrote or have permission to share.
11
+ - Fix a proven issue and add a regression test when appropriate.
12
+ - Discuss a larger feature before starting substantial implementation.
13
+
14
+ Current areas to explore include retrieval evaluation, more provider integrations,
15
+ and terminal usability. Discuss changes before expanding the supported API formats.
16
+
17
+ ## Set up locally
18
+
19
+ Fork the repository on its hosting service, then clone your fork under
20
+ `C:\CLAUDE_env`. If you received a source download, you can still develop locally
21
+ and share a focused patch with the maintainer.
22
+
23
+ From the project folder in PowerShell:
24
+
25
+ ```powershell
26
+ uv sync --locked
27
+ uv run python -m study_agent demo
28
+ ```
29
+
30
+ Use the project's `.venv`; do not install dependencies into system Python.
31
+ The demo and automated tests do not need an API key. Live checks use your selected provider account and its limits. Keep real keys in
32
+ the OS credential store or environment, never in test fixtures or committed files.
33
+
34
+ ## Make a focused change
35
+
36
+ 1. Create a descriptive branch, for example `fix/quiz-resume-message`.
37
+ 2. Reproduce a bug before fixing it, or describe the intended new behaviour.
38
+ 3. Make the smallest useful change; avoid unrelated refactoring.
39
+ 4. Add meaningful tests for changed behaviour. Documentation-only changes do not
40
+ need new application tests.
41
+ 5. Update the README or user guide when commands or behaviour change.
42
+
43
+ ```powershell
44
+ uv run git switch -c fix/quiz-resume-message
45
+ uv run ruff format .
46
+ uv run ruff check .
47
+ uv run ruff format --check .
48
+ uv run pytest -q
49
+ ```
50
+
51
+ Tests use temporary databases and mocked model responses. They must not make live
52
+ API calls, depend on personal credentials, or modify real study progress.
53
+ If dependencies change, update both `pyproject.toml` and `uv.lock` using uv.
54
+
55
+ ## Open a pull request
56
+
57
+ Explain:
58
+
59
+ - The problem or user need.
60
+ - What changes for the user, with a small example where helpful.
61
+ - How you checked the change.
62
+ - Any known limitations or follow-up work.
63
+
64
+ For terminal changes, a short before/after transcript is helpful. For visuals,
65
+ include a preview. Keep screenshots and logs free of keys and private notes.
66
+
67
+ Before committing, review what will be shared:
68
+
69
+ ```powershell
70
+ uv run git status --short
71
+ uv run git diff
72
+ ```
73
+
74
+ Stage only the intended files. Do not commit `.env`, `.venv`, `data/`, private notes,
75
+ or local caches. `.env.example` should contain names and placeholders only.
76
+
77
+ ## Report an issue
78
+
79
+ Include the command or prompt you used, expected behaviour, actual behaviour, and
80
+ steps another person can repeat. For API problems, include the model name, HTTP
81
+ status, and request ID when available. Never include the API key.
82
+
83
+ If reporting an incorrect quiz answer, share the question, options, explanation,
84
+ and why you believe it is wrong. AI-generated content is not guaranteed correct.
85
+
86
+ ## Review expectations
87
+
88
+ Be clear, constructive, and respectful. Prefer evidence over assumptions and simple
89
+ code over unnecessary abstraction. Contributions are reviewed; submitting one does
90
+ not guarantee it will be merged.
91
+
92
+ StudyTrail uses the MIT licence. Contributions are provided under the same terms;
93
+ see [LICENSE](LICENSE).
94
+
95
+ [Back to StudyTrail](README.md)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StudyTrail contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.5
2
+ Name: studytrails
3
+ Version: 0.2.0
4
+ Summary: A personal multi-subject AI study coach with tools, local progress, and an offline demo.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: <3.14,>=3.12
8
+ Requires-Dist: keyring<26,>=25
9
+ Requires-Dist: openai<3,>=2.0
10
+ Requires-Dist: platformdirs<5,>=4
11
+ Requires-Dist: pydantic<3,>=2.0
12
+ Requires-Dist: python-dotenv<2,>=1.0
13
+ Requires-Dist: rich<15,>=13.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ # StudyTrail
17
+
18
+ Learn a little. Practise with purpose. See your progress.
19
+
20
+ StudyTrail is a terminal AI study coach. Bring your own compatible provider API
21
+ key, add study notes, practise with quizzes, and track progress locally.
22
+
23
+ Requires Python 3.12 or 3.13. Once this release is published, install it in an
24
+ activated environment with `pip install studytrails`, or install an isolated CLI
25
+ with `uv tool install studytrails`. Run `studytrails` to open the welcome menu.
26
+
27
+ ## Features
28
+
29
+ - Interactive provider, model, and hidden API-key setup.
30
+ - OpenAI-compatible Chat Completions endpoints with tool-calling models.
31
+ - OpenAI and Groq address presets; custom compatible endpoints supported.
32
+ - Multi-subject coaching and subject-specific note retrieval.
33
+ - Paste notes or import UTF-8 `.md` and `.txt` files up to 200 KB.
34
+ - Multiple-choice quizzes, explanations, and local SQLite progress.
35
+ - A fixed offline Python quiz demo that needs no API key.
36
+ - Keys stored in supported operating-system credential stores, without a plaintext fallback.
37
+
38
+ ## Commands
39
+
40
+ ```text
41
+ studytrails
42
+ studytrails config
43
+ studytrails chat --subject java
44
+ studytrails notes-add
45
+ studytrails notes "inheritance" --subject java
46
+ studytrails scores
47
+ studytrails pending
48
+ studytrails demo
49
+ studytrails doctor
50
+ ```
51
+
52
+ Run `studytrails doctor` to see the personal storage location. Existing source
53
+ checkouts retain their original data directories. Set `STUDYTRAIL_HOME` to choose
54
+ a different root. Machines without a usable OS credential store can supply
55
+ `STUDYTRAIL_API_KEY` through the environment.
56
+
57
+ The software is MIT-licensed. API costs and limits depend on your provider and plan;
58
+ StudyTrail cannot guarantee free API usage. Your prompts, retrieved note passages,
59
+ and score summaries may be sent to the configured provider. Notes are retrieved by
60
+ keywords, not used to train a model. AI answers and quiz keys may contain mistakes.
61
+ The app does not execute generated code. Native APIs with incompatible request
62
+ formats are not supported. A provider preset does not guarantee every model works.
@@ -0,0 +1,176 @@
1
+ <p align="center">
2
+ <img src="assets/banner.svg" alt="StudyTrail - your personal AI study coach" width="100%">
3
+ </p>
4
+
5
+ # StudyTrail
6
+
7
+ **Learn a little. Practise with purpose. See your progress.**
8
+
9
+ StudyTrail is a terminal study coach for Python, Java, and other subjects. Bring
10
+ an API key from a compatible provider, add your notes, and practise with quizzes.
11
+ Your progress stays on your computer. You do not need to run a server.
12
+
13
+ **Python 3.12 or 3.13 | Your choice of compatible AI provider | Local progress**
14
+
15
+ ## Get started
16
+
17
+ This version is prepared for packaging but **has not been published to PyPI**.
18
+ Do not assume a package currently using the name `studytrails` is this project.
19
+
20
+ From the source checkout:
21
+
22
+ ```powershell
23
+ cd C:\CLAUDE_env\Study_Agent_python
24
+ uv sync --locked
25
+ uv run studytrails
26
+ ```
27
+
28
+ If uv is not on your terminal PATH after installation, run the existing environment:
29
+
30
+ ```powershell
31
+ & .\.venv\Scripts\studytrails.exe
32
+ ```
33
+
34
+ The original command also works: `python -m study_agent` in the activated environment.
35
+ Keep development environments under `C:\CLAUDE_env`; do not install into system Python.
36
+
37
+ After the maintainer publishes a verified release, users will be able to install it
38
+ in an activated Python environment with `pip install studytrails`, or use
39
+ `uv tool install studytrails` for an isolated command-line installation. They can
40
+ then run `studytrails` from any directory.
41
+
42
+ ## First launch
43
+
44
+ ```text
45
+ Welcome to StudyTrail!
46
+ Learn from your notes. Practise with quizzes. Track your progress.
47
+
48
+ Configure AI now? [y/N]:
49
+
50
+ 1. Start learning 2. Manage notes 3. View progress
51
+ 4. Configure AI 5. Pending quizzes 6. Offline demo 0. Exit
52
+ ```
53
+
54
+ Choose **Configure AI** to supply:
55
+
56
+ 1. An OpenAI-compatible custom endpoint, or the OpenAI/Groq address preset.
57
+ 2. The exact model ID from your provider. It must support Chat Completions tool calling.
58
+ 3. Your API key, entered with hidden input.
59
+
60
+ The app displays the destination before you enter your key. An API key is not
61
+ universal: it must match the endpoint and model. Native APIs with a different
62
+ protocol are not supported by this release. A preset supplies an address; it is
63
+ not a guarantee that every model at that provider is compatible.
64
+
65
+ You can optionally test tool calling during setup. This makes a small API request
66
+ and may consume paid quota. Skipping it saves unverified settings. Provider
67
+ compatibility is covered with mocked HTTP tests; no live cross-provider certification
68
+ is claimed.
69
+
70
+ Keys are saved using a supported operating-system credential store. They are never
71
+ written to `config.json`. If your machine has no usable credential store, supply
72
+ `STUDYTRAIL_API_KEY` through your environment and rerun setup. There is no plaintext
73
+ fallback. Run `studytrails config` to change providers or models later.
74
+
75
+ **Free app does not mean free API.** Offline features need no API calls. Live
76
+ coaching uses your provider's free allowance or paid plan. StudyTrail cannot inspect
77
+ or enforce your billing tier. One study request may make several API calls.
78
+
79
+ ## Learn using your notes
80
+
81
+ Choose **Manage notes**, then paste text or import a UTF-8 `.txt` or `.md` file.
82
+ Give it a subject such as `java`, `python`, or `world-history`, and a short title.
83
+ When pasting, enter `.done` on its own line to finish.
84
+
85
+ Choose **Start learning** and enter the same subject. A blank subject searches all
86
+ notes. Try:
87
+
88
+ ```text
89
+ Explain inheritance using my Java notes, then give me two beginner questions.
90
+ Review my scores and suggest what to practise next.
91
+ ```
92
+
93
+ Notes are organised by subject. Search is restricted to the selected subject and
94
+ returns passages with filename/line references. New quiz topics include that
95
+ subject, so `java loops` and `python loops` have separate score labels. Historical
96
+ quiz labels are retained unchanged; scores display all topics.
97
+
98
+ No model training happens. This is keyword retrieval: good headings, concrete
99
+ terms, and clear examples help. PDF, Word, images, and embeddings are not supported.
100
+ Files above 200 KB are skipped. Matching passages are sent to the selected provider;
101
+ only add material you are comfortable sharing with that provider. AI answers,
102
+ answer keys, and citations still need your judgment.
103
+
104
+ ## Practise and track progress
105
+
106
+ Choose A, B, C, or D during a quiz. StudyTrail grades and saves your submitted answers,
107
+ then displays explanations. Enter Q to leave without submitting. Resuming starts
108
+ from question one. A completed quiz cannot be submitted twice.
109
+
110
+ Inside chat, use `/scores`, `/pending`, or `/quit`. Chat history lasts for the current
111
+ session; completed results survive restarts. The offline demo uses fixed Python
112
+ questions and a separate database. It is not a local AI model.
113
+
114
+ ## Useful commands
115
+
116
+ ```powershell
117
+ studytrails
118
+ studytrails config
119
+ studytrails chat --subject java
120
+ studytrails ask "Explain Java inheritance" --subject java
121
+ studytrails notes-add
122
+ studytrails notes "inheritance" --subject java
123
+ studytrails scores
124
+ studytrails pending
125
+ studytrails quiz QUIZ_ID
126
+ studytrails demo
127
+ studytrails doctor
128
+ studytrails --help
129
+ ```
130
+
131
+ Add `--demo` to `scores`, `pending`, or `quiz QUIZ_ID` to use demo progress.
132
+ `doctor` reports paths and settings without exposing the key or contacting the API.
133
+ All commands also work after `uv run python -m study_agent` in the source checkout.
134
+
135
+ ## Where are my files?
136
+
137
+ Installed releases use your operating system's personal application-data directory
138
+ (for example `%LOCALAPPDATA%\StudyTrail` on Windows). Run `studytrails doctor` for
139
+ the exact location. Within it:
140
+
141
+ - `config.json`: provider address and model, without the API key.
142
+ - `notes/personal/SUBJECT/`: imported or pasted notes with unique filenames.
143
+ - `notes/python/` and `notes/java/`: bundled examples, copied only when missing.
144
+ - `data/study.sqlite3`: real progress; `data/demo.sqlite3`: offline demonstration.
145
+
146
+ Existing source checkouts retain their original `data/` and `notes/` directories.
147
+ Existing `.env` settings using `GROQ_API_KEY` and `GROQ_MODEL` work until you save a
148
+ new provider configuration. Saved configuration takes precedence. No database
149
+ migration or deletion is performed. `STUDYTRAIL_HOME` selects another storage root;
150
+ copying existing data there is a deliberate manual step, not automatic merging.
151
+
152
+ ## How it works
153
+
154
+ The model can call three tools: `get_scores`, `search_notes`, and `create_quiz`.
155
+ Pydantic validates tool arguments. SQLite stores quizzes and actual submitted
156
+ answers. Python grades answers; the model cannot fabricate saved scores. Requests
157
+ are bounded to six model rounds and ten tool calls. Tool order is suggested by the
158
+ prompt, not enforced. The agent cannot execute generated code.
159
+
160
+ The source is intentionally small: `agent.py` contains the tool loop, `tools.py`
161
+ defines allowed actions, `notes.py` searches notes, `storage.py` stores results,
162
+ `cli.py` runs the terminal interface, and `onboarding.py`/`preferences.py` handle
163
+ setup and personal storage.
164
+
165
+ ## Contributions welcome
166
+
167
+ Bug reports, clearer documentation, sample notes, and focused improvements are
168
+ welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md). Please include steps to reproduce
169
+ bugs and never share API keys, private notes, or your personal database.
170
+
171
+ See the [user guide](docs/USER_GUIDE.md) for configuration and troubleshooting,
172
+ and the [release guide](docs/RELEASING.md) for packaging and publishing.
173
+
174
+ ## Licence
175
+
176
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,20 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="360" viewBox="0 0 1200 360" role="img" aria-labelledby="title desc">
2
+ <title id="title">StudyTrail — Your next step starts with a question.</title>
3
+ <desc id="desc">StudyTrail, a personal AI study coach. Learn, practise, reflect. A teal learning-path logo sits beside white lettering on a navy background.</desc>
4
+ <rect width="1200" height="360" rx="24" fill="#101D35"/>
5
+ <rect x="0" y="0" width="9" height="360" fill="#48E0C2"/>
6
+ <g transform="translate(70 99)">
7
+ <rect width="146" height="146" rx="32" fill="#172A46"/>
8
+ <path d="M39 104V82Q39 73 50 73H96Q107 73 107 62V40" fill="none" stroke="#48E0C2" stroke-width="9" stroke-linecap="round"/>
9
+ <circle cx="39" cy="104" r="10" fill="#48E0C2"/>
10
+ <circle cx="73" cy="73" r="9" fill="#172A46" stroke="#48E0C2" stroke-width="5"/>
11
+ <circle cx="107" cy="40" r="10" fill="#F5C968"/>
12
+ </g>
13
+ <g font-family="Segoe UI, Arial, sans-serif">
14
+ <text x="257" y="107" fill="#48E0C2" font-size="16" font-weight="600" letter-spacing="3">YOUR PERSONAL AI STUDY COACH</text>
15
+ <text x="253" y="181" fill="#FFFFFF" font-size="68" font-weight="700" letter-spacing="-2">StudyTrail</text>
16
+ <text x="257" y="229" fill="#C5D2E4" font-size="25">Your next step starts with a question.</text>
17
+ <text x="257" y="282" fill="#48E0C2" font-size="16" font-weight="600" letter-spacing="2">LEARN / PRACTISE / REFLECT</text>
18
+ <text x="1125" y="317" text-anchor="end" fill="#889BB6" font-size="14">Built with Python. Powered by Groq.</text>
19
+ </g>
20
+ </svg>
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-labelledby="title desc">
2
+ <title id="title">StudyTrail logo</title>
3
+ <desc id="desc">A rising path connecting three learning milestones on a navy square.</desc>
4
+ <rect width="128" height="128" rx="30" fill="#101D35"/>
5
+ <path d="M34 91V72Q34 64 44 64H84Q94 64 94 54V35" fill="none" stroke="#48E0C2" stroke-width="8" stroke-linecap="round"/>
6
+ <circle cx="34" cy="91" r="9" fill="#48E0C2"/>
7
+ <circle cx="64" cy="64" r="8" fill="#101D35" stroke="#48E0C2" stroke-width="5"/>
8
+ <circle cx="94" cy="35" r="9" fill="#F5C968"/>
9
+ </svg>
@@ -0,0 +1,47 @@
1
+ # StudyTrail
2
+
3
+ Learn a little. Practise with purpose. See your progress.
4
+
5
+ StudyTrail is a terminal AI study coach. Bring your own compatible provider API
6
+ key, add study notes, practise with quizzes, and track progress locally.
7
+
8
+ Requires Python 3.12 or 3.13. Once this release is published, install it in an
9
+ activated environment with `pip install studytrails`, or install an isolated CLI
10
+ with `uv tool install studytrails`. Run `studytrails` to open the welcome menu.
11
+
12
+ ## Features
13
+
14
+ - Interactive provider, model, and hidden API-key setup.
15
+ - OpenAI-compatible Chat Completions endpoints with tool-calling models.
16
+ - OpenAI and Groq address presets; custom compatible endpoints supported.
17
+ - Multi-subject coaching and subject-specific note retrieval.
18
+ - Paste notes or import UTF-8 `.md` and `.txt` files up to 200 KB.
19
+ - Multiple-choice quizzes, explanations, and local SQLite progress.
20
+ - A fixed offline Python quiz demo that needs no API key.
21
+ - Keys stored in supported operating-system credential stores, without a plaintext fallback.
22
+
23
+ ## Commands
24
+
25
+ ```text
26
+ studytrails
27
+ studytrails config
28
+ studytrails chat --subject java
29
+ studytrails notes-add
30
+ studytrails notes "inheritance" --subject java
31
+ studytrails scores
32
+ studytrails pending
33
+ studytrails demo
34
+ studytrails doctor
35
+ ```
36
+
37
+ Run `studytrails doctor` to see the personal storage location. Existing source
38
+ checkouts retain their original data directories. Set `STUDYTRAIL_HOME` to choose
39
+ a different root. Machines without a usable OS credential store can supply
40
+ `STUDYTRAIL_API_KEY` through the environment.
41
+
42
+ The software is MIT-licensed. API costs and limits depend on your provider and plan;
43
+ StudyTrail cannot guarantee free API usage. Your prompts, retrieved note passages,
44
+ and score summaries may be sent to the configured provider. Notes are retrieved by
45
+ keywords, not used to train a model. AI answers and quiz keys may contain mistakes.
46
+ The app does not execute generated code. Native APIs with incompatible request
47
+ formats are not supported. A provider preset does not guarantee every model works.
@@ -0,0 +1,70 @@
1
+ # Releasing StudyTrail
2
+
3
+ The package is prepared locally. No upload or public release is performed by setup,
4
+ tests, or CI. The distribution name is `studytrails`; the import remains `study_agent`.
5
+ Version 0.2.0 adds packaging, personal settings, provider setup, and subject notes.
6
+
7
+ ## Before the first release
8
+
9
+ 1. Create your PyPI account and enable two-factor authentication. Check the current
10
+ availability of `studytrails` on PyPI and TestPyPI separately. A missing project
11
+ page is not a reservation or a guarantee that PyPI will accept the name.
12
+ 2. Review the MIT licence and package metadata. Add your public repository URL to
13
+ `[project.urls]` when ready; no repository URL is invented by this project.
14
+ 3. Check package contents for accidental secrets, databases, or personal notes.
15
+ Wheels include only the `study_agent` package and its bundled example notes.
16
+ Source distributions use an explicit allowlist. `notes/`, `.env`, and `data/`
17
+ from the local checkout are not published.
18
+ 4. Update the README's unpublished status only when the release is actually live.
19
+ Use absolute public links/images in the PyPI description if adding repository
20
+ branding there. The package uses a self-contained `docs/PYPI.md` description.
21
+
22
+ ## Build and verify
23
+
24
+ From the project under `C:\CLAUDE_env`:
25
+
26
+ ```powershell
27
+ uv sync --locked
28
+ uv run ruff check .
29
+ uv run ruff format --check .
30
+ uv run pytest -q
31
+ uv build
32
+ ```
33
+
34
+ If the local sandbox blocks pytest's temporary folder, supply `--basetemp` with a
35
+ new, dedicated writable test directory. Do not point it at existing valuable data:
36
+ pytest manages that directory itself.
37
+
38
+ Install the wheel in a separate uv-managed environment and test outside the source
39
+ checkout. The CI workflow also builds and installs the wheel. Verify the welcome
40
+ menu, offline demo, note search, and configuration recovery with temporary storage.
41
+ Test real provider access only with your own credentials and awareness of quota.
42
+ The automated suite mocks providers and the OS vault; it does not certify every
43
+ provider/model or every desktop keyring configuration.
44
+
45
+ ## Publish when approved
46
+
47
+ Prefer PyPI Trusted Publishing with a reviewed GitHub release workflow, or use a
48
+ scoped upload token held in your local environment. Never commit upload tokens.
49
+ TestPyPI is a separate service with separate accounts, tokens, and project names.
50
+ Install dependencies from the regular index when testing a TestPyPI package; avoid
51
+ blindly combining indexes for production installs.
52
+
53
+ For an explicitly approved manual release, uv supports:
54
+
55
+ ```powershell
56
+ uv publish dist/studytrails-0.2.0-py3-none-any.whl dist/studytrails-0.2.0.tar.gz
57
+ ```
58
+
59
+ Supply authentication securely as documented by uv. This command publishes publicly;
60
+ it is not part of the build/test workflow. Inspect the exact two artifacts before
61
+ running it. A published version cannot simply be replaced with different contents;
62
+ increment the version for a correction.
63
+
64
+ After publishing, test a fresh install of the exact published version and update
65
+ the README. Users can then run `pip install studytrails` in an activated environment
66
+ or `uv tool install studytrails`, followed by `studytrails`.
67
+
68
+ References: [uv publishing](https://docs.astral.sh/uv/guides/package/),
69
+ [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/), and
70
+ [Python packaging](https://packaging.python.org/en/latest/tutorials/packaging-projects/).
@@ -0,0 +1,103 @@
1
+ # StudyTrail user guide
2
+
3
+ ## Setup and storage
4
+
5
+ Run `studytrails` to open the menu, or `studytrails config` to configure AI directly.
6
+ Choose a provider preset or enter an OpenAI-compatible Chat Completions base URL.
7
+ Enter a model that supports function/tool calling and that your account can access.
8
+ Setup displays the API destination before requesting the key. HTTPS is required
9
+ for remote endpoints; HTTP is accepted only for localhost development.
10
+
11
+ Settings go into `config.json`; keys go into a supported OS credential store.
12
+ StudyTrail supports the keyring Windows, macOS, Secret Service, KWallet, and
13
+ libsecret backends. Availability depends on your OS/session. It rejects plaintext
14
+ fallbacks. For a headless machine, inject `STUDYTRAIL_API_KEY` through your environment.
15
+ Never put real keys in shell commands that you plan to share or commit.
16
+
17
+ Configuration precedence:
18
+
19
+ 1. If the storage root has `config.json`, its endpoint/model are used. An explicit
20
+ `STUDYTRAIL_API_KEY` overrides the stored credential for that configuration.
21
+ 2. Without saved configuration, `STUDYTRAIL_BASE_URL`, `STUDYTRAIL_MODEL`, and
22
+ `STUDYTRAIL_API_KEY` configure a custom endpoint.
23
+ 3. Otherwise legacy `GROQ_API_KEY` and `GROQ_MODEL` are supported. A source checkout
24
+ reads its own `.env`, without overriding existing environment variables.
25
+
26
+ A saved configuration never borrows a legacy key for a different endpoint. Clear
27
+ an old `STUDYTRAIL_API_KEY` environment override before switching providers if it
28
+ belongs to the previous provider. Provider changes do not erase earlier credentials
29
+ from the operating system's credential manager; remove obsolete entries there.
30
+ Keys are scoped by storage root and API endpoint, so changing `STUDYTRAIL_HOME`
31
+ requires configuring credentials for the new location.
32
+
33
+ Run `studytrails doctor` to find storage paths. Installed wheels use personal
34
+ application data. Editable/source installations keep data beside the project.
35
+ `STUDYTRAIL_HOME` overrides either mode. No settings are loaded from an arbitrary
36
+ current working directory in an installed release.
37
+
38
+ ## Notes and subjects
39
+
40
+ Use `studytrails notes-add` or Manage notes in the menu. Paste text (finish with
41
+ `.done`) or import a UTF-8 `.md`/`.txt` file. Imports copy the contents and leave the
42
+ original file untouched. Each note receives a unique filename; existing notes are
43
+ not overwritten. Subject/title input accepts 1-50 ASCII letters, digits, spaces,
44
+ and hyphens; spaces normalise to hyphens. Use `java`, `python`, or `world-history`.
45
+
46
+ Search a subject with `studytrails notes "inheritance" --subject java` and start
47
+ chat with `studytrails chat --subject java`. Subject-specific search reads only
48
+ `notes/SUBJECT/` and `notes/personal/SUBJECT/`. Older notes in the root or `private/`
49
+ remain accessible in all-subject mode; move them into a subject directory if you
50
+ want them included in that subject's searches.
51
+
52
+ Search uses shared keyword counts, up to four passages, overlapping windows of
53
+ 24 lines with an 18-line step, and a 2,500-character passage cap. Files over
54
+ 200,000 bytes are skipped. No indexing step is needed. PDF/OCR, Word import,
55
+ semantic embeddings, and automatic factual verification are not implemented.
56
+
57
+ The coach is instructed to cite notes as `[filename:line]` and distinguish general
58
+ knowledge when no notes match. These are model instructions, not a guarantee.
59
+ Relevant excerpts, score summaries, and recent chat messages may be sent to your
60
+ selected provider. Personal note files are Git-ignored in the source checkout.
61
+
62
+ ## Progress, backups, and compatibility
63
+
64
+ SQLite stores pending quizzes and completed attempts. Quiz topic labels include
65
+ the selected subject for new subject-specific requests. Scores show all topics,
66
+ weakest first. Old topic labels and results are preserved. Demo scores are separate.
67
+ Chat memory holds only the most recent three completed turns and is not persisted.
68
+
69
+ Close the app before copying the `data/` and `notes/` folders to a backup. You may
70
+ also back up `config.json`; it contains no key. Configure credentials separately
71
+ on a new machine. Do not share personal databases publicly.
72
+
73
+ The original `python -m study_agent` commands remain supported. `notes QUERY` is
74
+ still a local search command; `notes-add` opens the interactive notes manager.
75
+ Offline commands do not make provider API requests.
76
+
77
+ ## Troubleshooting
78
+
79
+ - **Command not found:** activate the environment used to install the package, or
80
+ use `uv run studytrails` from the checkout. On Windows the existing environment
81
+ can run `.\.venv\Scripts\studytrails.exe` directly.
82
+ - **401 / authentication failure:** run `studytrails config`; check that the key
83
+ belongs to the displayed endpoint and inspect any environment-key override.
84
+ - **404 / model not found:** copy the current model ID from your provider and check
85
+ account access. An incorrect base URL can also produce 404.
86
+ - **400 / unsupported parameters or tools:** choose a compatible Chat Completions
87
+ model. Some providers implement only part of the protocol. Native non-compatible
88
+ APIs require a separate integration; changing the key cannot fix this.
89
+ - **429 / quota:** wait for your provider's reset or inspect its plan. The app cannot
90
+ determine whether a request is free. Each study turn can make several requests.
91
+ - **Credential store unavailable:** configure an OS-backed keyring or supply
92
+ `STUDYTRAIL_API_KEY` via the environment; setup never saves a plaintext fallback.
93
+ - **Hidden input unavailable:** run setup in a real terminal or use an environment
94
+ key. Piped setup does not fall back to visibly echoing a key.
95
+ - **No matching notes:** check subject, file type, UTF-8 encoding, size, and keywords.
96
+ - **Invalid config.json:** run `studytrails config` to replace provider settings.
97
+ This does not modify notes or quiz databases.
98
+
99
+ The app reports provider status codes and request IDs without printing raw API
100
+ responses or headers. Share those identifiers and the model ID when reporting bugs,
101
+ not your API key.
102
+
103
+ [Back to README](../README.md)