Three naming systems meet in this repository: code and tests are named by the area they
belong to, behaviour changes are recorded as OpenSpec changes under openspec/changes/, and
lasting decisions are ADRs under docs/adr/. This page gives the rule for each; the
pull-request page owns the branch, commit-subject and PR-title grammar.
- Modules. One module per area inside
packages/studyloop/src/studyloop/: a CLI command file iscli/_<area>.py(leading underscore -- it is mounted by name incli/__init__.py, never imported by users); a web route file isweb/routes/<area>.py; shared behaviour is a module or package named for the rule it holds (learning/decision.py,planning/store.py), neverutilsorhelpers. - Tests.
packages/studyloop/tests/test_<area>_<what>.py, where<area>is the directory or surface the test proves:test_web_now.py,test_content_schemas.py,test_cli_plan.py,test_adapter_parity.py,test_docs_drift.py. The prefix is how a reader finds a suite and howjust test-webandjust test-contentgroup the files they list, so a new area gets a new prefix, not a suffix. Test helpers that are not tests start with an underscore (_content_generator.py,_fake_agent.py) so pytest never collects them. - Fixtures. Shared fixtures live in
packages/studyloop/tests/conftest.py. Autouse isolation fixtures are named_isolate_<what>and fail a test that writes to the real config directory, vault or tmux server; named fixtures say what they give you (mux_harness,tmp_path). Data fixtures are files underpackages/studyloop/tests/fixtures/. A fixture that only one file uses stays in that file. - Tiers. A test outside the default tier carries one marker from
pyproject.toml:integration,e2e,live_kiro,live_provider,live_obsidian,live_xtiles,acceptance,uat. All eight are deselected by default (F7); a test with no marker must pass on a clean machine with no harness, browser or network.
The scope in <type>(<scope>): … is the smallest stable subsystem the change lands in, and it
maps to a place in the tree. Use the existing word when one fits:
| Scope | Lands in |
|---|---|
web |
web/routes/, web/static/, web/app.py |
mcp |
mcp/tools.py, mcp/server.py |
doctor |
doctor/ |
agents |
root agents/, adapters/, harnesses.py |
plan |
planning/, cli/_plan.py |
now |
learning/decision.py, cli/_now.py, web/routes/now.py |
session |
session/, session_state.py, agent_launcher.py |
content |
content/ |
openspec |
openspec/changes/, openspec/specs/ |
contributing |
docs/contributor-*.md, docs/contributing.md |
A change that touches several of these is cross-cutting: omit the scope rather than invent one.
Open a change for a behaviour or design change (a new option, a changed flow, a new module); a small fix with a test goes straight to a pull request.
- Create
openspec/changes/<id>/withproposal.md(what and why),design.md(how, and the decisions taken),tasks.md(the ordered work) andspecs/<capability>/spec.mdholding the delta to the living spec inopenspec/specs/<capability>/spec.md. Requirements use SHALL and each has at least one#### Scenario:with WHEN/THEN. One requirement states one behaviour, and its body (the prose before the first scenario; fenced code does not count) stays under 500 characters -- the validator fails a longer one. When a requirement wants to say more, that is two requirements, or examples and edge cases that belong in scenarios; a conditional lead-in ("When the learner has an active plan: ...") is part of every requirement it governs, so repeat it rather than leave a SHALL without its condition. - Add
.openspec.yaml(schema: spec-driven,created:). A documentation-only change declaresskip_specs: truethere, as the archivedopenspec/changes/archive/2026-11-08-contributor-guide-v1/.openspec.yamldoes: theopenspecCLI refuses a change with no spec delta unless the flag is set (this change failedspec-checkuntil it was added), so the flag is the reviewer's cue that "no delta" was a choice. - Validate the structure with
openspec validate --specs --all --strict: every warning fails, so the output is a gate and not a list nobody reads. The recipe resolves the CLI throughscripts/openspec-cli.shat the one pinned release (OPENSPEC_VERSIONin theJustfile): a localopenspecat that version is used; at any other version it is never used --npxvalidates with the pinned one and says so, or the recipe refuses whennpxcannot run. Without node or the CLI the recipe printsSKIPPEDand exits 0 on your machine -- a skip is not a pass -- and thespec-checkjob in CI, which runs the same recipe, fails on the same absence:
just spec-checkChanging OPENSPEC_VERSION is a deliberate commit: a new CLI release can add rules (1.14
started warning on requirement bodies over 500 characters, which is how 84 warnings appeared
at once and hid a placeholder Purpose among them).
- Ship the spec delta in the same pull request as the code; the spec describes behaviour, the tests prove it.
- On completion the change is archived to
openspec/changes/archive/<YYYY-MM-DD>-<id>/and the delta is folded into the living spec. Adesign.mddies with its change; a decision that must outlive it becomes an ADR.
An Architecture Decision Record captures a choice a reasonable engineer could have made
differently, where the reason would otherwise be lost. docs/adr/README.md is the index and the
rulebook:
- File name
docs/adr/NNNN-kebab-case-title.md, zero-padded, never reused (the index indocs/adr/README.mdlists what exists; take the next number). - Status moves
Proposed→Accepted→Superseded by ADR-NNNNorDeprecated. An accepted ADR is never edited except on its status line; a changed mind is a new ADR that supersedes it. - Every ADR names the change that motivated it, so the context is recoverable from
openspec/changes/or its archive. - Add a row to the index table in
docs/adr/README.md(ADR · Title · Status · Change). - ADRs stay off the public site (
mkdocs.ymlexcludes everything not allowlisted); a public page describes the behaviour and may name the ADR, never link into it. The rest of the publishing rule is on the documentation page.