M0 Brief¶
Note
M0 is built and pushed (maintainer, 2026-11-03); the results are under "Result". The brief for milestone M0, the skeleton: a tess_shell package that installs, answers tesserae-shell version and check, reads settings.tdl, starts logging, takes the instance lock, runs the start and stop sequences with no windows, and stops cleanly on a signal. The maintainer started M0 on 2026-11-03 ("Go for M0") and said a new session in Oh My Pi, in the tess-shell project directory, writes the code. This note is that session's starting point. The vault stays the design record; the code session does not edit it.
Goal and Definition of Done¶
M0 is done when all of these hold:
uv syncintess-shellgives a working environment, anduv run pytest,ruffandmypypass.tesserae-shell versionprints the versions of the shell,tess_re,tess_elandtess_dl.tesserae-shell checkreadssettings.tdland every shell file it finds, reports syntax errors asfile:line:column(syntax only, no schema check), and exits 0 or 1.tesserae-shell runstarts, logs, holds the lock, idles at about 0% CPU with no windows, and stops on SIGTERM or SIGINT with exit code 0; a second signal exits with 130; a secondrunexits with 4.- Nothing else is built: no windows, no binder, no modules, no D-Bus, no hot reload.
What to Read¶
| Note | For |
|---|---|
| Shell Package Layout | Names, folders, import rules, dependencies, tooling |
| Shell Start and Stop | The start and stop sequences, process rules, exit codes (steps 1 to 9 and the stop steps 1 to 6 are M0) |
| Config Discovery and Registry | Finding the config directory and the registry file |
| Settings File | The keys of settings.tdl |
| Logging | Loguru setup, log files, levels |
| Validation and Errors | The error record and how errors print |
| IPC and CLI | The command line (#The Command Line) |
| Testing Strategy | Test layers, markers, conventions |
| Process Model and Threading | One loop, keep_alive, the signal watcher |
TDL Library API and the tess-dl repository docs (docs/api.md, docs/language.md) |
Reading settings.tdl |
| ADR-0015 Render Binder, ADR-0016 Staged Development | Why the layout is as it is |
Dependencies¶
Ranges, because the projects are 0.x and a minor release can break (maintainer, 2026-11-03):
| Package | Range | Import | State on 2026-11-03 |
|---|---|---|---|
tesserae-engine |
>=0.6.0,<0.7 |
tess_re |
0.6.0 is on PyPI (checked 2026-11-03; it imports as tess_re, import tre no longer works) |
tesserae-el |
>=0.1.2,<0.2 |
tess_el |
0.1.2 is on PyPI |
tesserae-dl |
>=0.1.1,<0.2 |
tess_dl |
0.1.1 is on PyPI. 0.1.0 also exists and imports as tdl, so the lower bound matters |
dbus-fast, loguru |
as in Shell Package Layout | dbus-fast is not needed before M4. jsonschema is not a dependency (ADR-0020 Validation in Code) |
The code session waited for tesserae-engine 0.6.0 (maintainer, 2026-11-03); it is now on PyPI, so every task can proceed. Earlier advice to start on the tasks that do not import tess_re no longer matters. Import tess_re only where it is needed (version, and the loop in run), and mark tests that need it tre, so the rest builds and tests now.
Tasks¶
In this order. Each ends with its tests.
| # | Task | Done when | Spec |
|---|---|---|---|
| T1 | Repository: pyproject.toml (hatchling, src layout, requires-python >=3.14, the ranges above, dev group pytest, ruff, mypy), LICENSE (MIT), CHANGELOG.md, README.md, src/tess_shell/ with __init__.py (__version__), py.typed, tests/ |
uv sync, ruff, mypy and pytest run clean on an empty test |
Shell Package Layout |
| T2 | cli.py and __main__.py: version, check, run; global options --config-dir, --json, --quiet; the other subcommands print "not implemented in M0" and exit 1 |
tesserae-shell version and python -m tess_shell version agree |
IPC and CLI |
| T3 | config/: the config directory (XDG_CONFIG_HOME, else ~/.config/tesserae-shell/, created with the default folders), settings.tdl read with tess_dl, the keys Directories, Registry, Logging, Validation, Main_Shell, defaults when the file is absent, a bad file stops with exit 1 and a file:line:column error |
The cases in Settings File acceptance criteria that do not need other milestones | Settings File, Config Discovery and Registry |
| T4 | logging.py: Loguru, console and file sinks, levels, the log folder, enqueue=True as decided |
A log line reaches the console and the file with the right level and source | Logging |
| T5 | The lock and the process rules: XDG_RUNTIME_DIR checks (exit 2), the lock file under $XDG_RUNTIME_DIR/tesserae-shell/, exit 4 for a second shell |
Two run commands: the second exits 4 and names the first's pid |
Shell Start and Stop > Process Rules |
| T6 | app.py: start steps 1 to 9 (pre-flight, config directory, settings, logging, lock, registry open or create empty, discover and parse files with tess_dl, the loop with keep_alive), steps 10 to 12 log "not built in M0"; the stop steps 1 to 6; signals through set_wakeup_fd, a watcher thread and LoopHandle.stop() |
The shell idles and stops on SIGTERM with exit 0, and on a second signal with 130 | Shell Start and Stop, Process Model and Threading |
| T7 | check: parse every .tdl file found with tess_dl.parse, print every error (up to 50) with code, message, hint and position, --json form, exit 0 or 1 |
A file with an unclosed block prints file:line:column and exits 1 |
Validation and Errors |
| T8 | Tests per Testing Strategy: unit tests for config, lock and exit codes; the import-rules test (binder/ not yet present, so the test covers the packages that exist); a headless start-and-stop test that sends SIGTERM |
uv run pytest passes with no display |
Testing Strategy |
| T9 | A measurement: idle CPU and wake-ups of run over 60 seconds, written to a file under tests/perf/ (not docs/; the maintainer asked for a file, 2026-11-03) and compared with the budget |
The numbers are reported, not yet enforced | Performance Budgets |
The tess_dl 0.1 tree has Document, Block.entries, Property and the value classes. It does not have Block.properties, Block.blocks, Block.get, Block.walk, Document.imports or to_data (reported by tess-dl on 2026-11-03). Write a small helper in files/ for what M0 needs and keep it free of shell meaning. If a helper belongs in the library, record it as a TDL-REQ-### for the maintainer to carry.
Rules for the Code Session¶
- Work only in
~/Projects/pyDev/projects/tess-shell:src/,tests/,pyproject.toml,README.md,CHANGELOG.md,LICENSE. Do not editdocs/(it is generated from the vault) ortools/. From 2026-11-04 the code session may also write its own build logs in the vault and tick its brief's checkboxes, and nothing else there (Build Logs). - Commit locally after each task, with a short imperative message. Never push, open a pull request or touch a remote without the maintainer's instruction.
- Follow the layout and the import rules in Shell Package Layout. If a design is wrong, unclear or missing, stop and tell the maintainer, who brings it to the vault session; do not decide it silently. A design change is a dated amendment in the vault, not a quiet edit in code.
- Do not invent tre, TEL or
tess_dlAPI. Check the installed package or its docs; ask for a request if something is missing. - Style: ruff line length 100, rules
E F I B UP, mypy on the whole package, everything typed, no per-frame Python (there is no frame in M0), no blocking call on the loop thread. - Keep a short
AGENTS.mdin the repository with these rules (draft below).
Draft Repository Instructions¶
For the new session's AGENTS.md in tess-shell:
Tesserae Shell code. The design is in the vault at
~/Projects/Obsidian/Tesserae Shell (read it, do not edit it).
Start from 00 Home/M0 Brief.md there. Package: src/tess_shell. Python >= 3.14.
Deps: tess_re (tesserae-engine), tess_el (tesserae-el), tess_dl (tesserae-dl), loguru.
Rules: commit locally after each task; never push without the maintainer's word;
do not edit docs/ or tools/; follow the import rules in 20 Architecture/Shell Package Layout.md;
ruff (line 100) and mypy must pass; report design gaps to the maintainer instead of guessing.
Result (2026-11-03)¶
Built by the code session in tess-shell and pushed to origin/main. Checked against the repository on 2026-11-03:
| Check | Result |
|---|---|
| Tests | 97 passed (uv run pytest) |
| Tasks | T1 to T9 are in the history: skeleton and tooling, version, settings and config directory, Loguru, lock and runtime-directory checks, start and stop sequences with signals, check (syntax only), tests and the import-rules test, the idle measurement |
Idle cost of run over 60 s, headless sway, no windows, Python 3.14.9 with the GIL |
0.017 % of one core (budget at most 0.5 %); about 2.0 wake-ups per second (budget at most 5), counted as context switches, which over-counts (Performance Budgets) |
| Engine | tesserae-engine 0.6.1 in the lock file (0.6.0 was the minimum) |
| Python | The repository stays on the system Python with the GIL |
Not checked by the vault session: the code itself.
Report from the tess-shell session (2026-11-03, over the mailbox)¶
A peer's report is information, not a decision. The vault session checked what it could; the rest is recorded as reported.
Built: pyproject.toml (hatchling, src layout, uv on the system CPython 3.14.9 with the GIL); the commands version, check and run, the others print "not implemented in M0" and exit 1; the settings reader for every key of Settings File; Loguru with a daily log file; the instance lock and the runtime-directory checks; registry.json created and saved atomically; run start steps 1 to 7 and 9 and the stop sequence; check for *_Shell, *_Module, *_Style, *_Theme and *_Stylesheet files, --json, capped at 50 findings.
Not built in M0 (deferred): sd_notify READY and STOPPING, the failure notification, Capture_Stderr forwarding, routing of the standard logging and warnings modules, --verbose, registry rebuild from UIDs and the 30-day prune, the keys Stop_Timeout, Module_Stop_Timeout, Control, Registry_Retention and Validation.Max_Errors and Notify (refused as unknown keys), and the name, suffix and duplicate checks in check.
Differences from the specs, and what the vault did about each:
| # | Difference | Vault action |
|---|---|---|
| 1 | Shell Start and Stop said tre 0.5.9 or later; the brief and lock use 0.6.0 or later (0.6.1 locked) | Spec updated to 0.6.0 |
| 2 | run tests need a compositor, so the tests start a private headless sway (tests/sway.py) in the default suite under the tre marker |
Testing Strategy updated |
| 3 | Main_Shell defaults to Main_Shell.tdl; an absent default file is an info log, an absent explicit one is an error; check on a missing config directory exits 2 |
Recorded; Main_Shell is a file name and Name: in the file is independent (Settings File clarified) |
| 4 | The package layout lacked the files M0 added | Shell Package Layout updated |
| 5 | tess_re has no __version__; versions come from importlib.metadata |
IPC and CLI updated |
| 6 | tess_dl 0.1.1 has no Block.properties, blocks, get or walk; helpers are in files/tree.py; Shell: 0.1 metadata parses |
Known; a TDL-REQ-### if wanted |
| 7 | A call_soon queued before App.run() is not drained at loop start |
Verified on tess_re 0.6.0; TRE-REQ-011 Drain call_soon at Loop Start drafted |
Open Questions¶
- The code session waits for
tesserae-engine0.6.0 (maintainer, 2026-11-03). -
checkis syntax-only in M0; the schema comes with M1 (maintainer, 2026-11-03). - T9 results are written to a file under
tests/perf/in the repository (maintainer, 2026-11-03: "add it to a file"), not only reported in chat.
Acceptance Criteria¶
- Every item under "Goal and Definition of Done" is true (tests and idle measurement above; the maintainer reports M0 built and pushed).
- Each task T1 to T9 has at least one test or a recorded measurement (
tests/andtests/perf/idle-results.md). - No file outside the allowed list was changed, as far as the history shows (the agent setup files are in the list).
- The design gaps found were handed to the vault session over the mailbox (above).