Reopen the foundation-file freeze post-v1 (ADR-0001); add domain glossary

The phase-2 blanket freeze on foundation files (models.py, config.py,
transcribe/base.py, ...) is reopened: deliberate changes are fine when they
land through a reviewed issue that records the motivation. The freeze left
behind exactly the friction the architecture review surfaced - a config bag
that shadows per-stage options, a one-method Transcriber interface callers
must reach past, a run-time path cached inside a content-addressed value.

- CONTRACTS.md: post-v1 note up top, 1.10 rewritten as the reviewed-issue
  rule, ownership-map row updated
- docs/adr/0001-reopen-foundation-freeze.md: the decision and consequences
- GLOSSARY.md: the domain language, including the terms adopted by the
  architecture issues (analysis module, front door, MediaFacts/MediaRef,
  stage descriptor)

Tracker: issues #5/#6/#7 relabeled ready-for-agent (freeze approved);
#7 disposition decided (MediaInfo replaced in one sweep); #9 divergences
confirmed (transcribe follows settings.diarize, ask gains no_cache,
analyse gains --max-shots/--no-describe, va moment in scope).
This commit is contained in:
alex committed 2026-11-23 23:13:55 +00:00
1 parent 56308fe0c9
commit d20bd40978
3 files changed
+128 -5

No files matched your search

+13 -5
View File
@@ -5,6 +5,11 @@ intent, then this file for the exact API surface. **Everything here was executed
installed packages in `.venv` (Python 3.13.16) on the day this file was written** — the snippets
are copied from working code, not from memory or from web docs.
> **Post-v1 note (2026-11-23):** phase 2 is complete and shipped. The foundation-file
> freeze is **reopened** — see ADR-0001 (`docs/adr/0001-reopen-foundation-freeze.md`) and
> §1.10. The per-file contracts in sections 4–6 remain the reference for what exists
> today; deliberate changes land through reviewed issues (#5, #6, #7 are the first).
Environment: `uv`, venv pinned by `.python-version` = `3.13`, `uv sync` installs the deps in
`pyproject.toml` (dev group included). `uv.lock` is committed state.
@@ -39,10 +44,13 @@ Environment: `uv`, venv pinned by `.python-version` = `3.13`, `uv sync` installs
9. **Secrets:** never hard-code or require API keys in the local profile. Hosted providers read
the standard env vars (`DEEPSEEK_API_KEY`, `OPENROUTER_API_KEY`, `GROQ_API_KEY`,
`OPENAI_API_KEY`, `OLLAMA_BASE_URL`).
10. **Do not modify foundation files** (`src/video_analyse/__init__.py`, `models.py`, `config.py`,
`llm.py`, `transcribe/base.py`, `pyproject.toml`, `tests/conftest.py`, this file). If a change
is genuinely required, note it in your final report instead of editing silently; additive
test fixtures in your own test files are always fine.
10. **Foundation files** (`src/video_analyse/__init__.py`, `models.py`, `config.py`,
`llm.py`, `transcribe/base.py`, `pyproject.toml`, `tests/conftest.py`, this file) were
frozen during phase-2 construction so build agents could not drift from the spec. As of
2026-11-23 the freeze is **reopened** (ADR-0001): deliberate changes to these files are
fine when they land through a reviewed issue that records the motivation (see #5, #6,
#7). Undocumented ad-hoc edits remain off-limits; additive test fixtures in your own
test files are always fine.
11. **No `git commit`** unless the orchestrator asks for it.
---
@@ -57,7 +65,7 @@ Environment: `uv`, venv pinned by `.python-version` = `3.13`, `uv sync` installs
| **D — vision, synthesis, report** | `vision.py`, `synthesis.py`, `report.py`, `tests/test_vision.py`, `tests/test_synthesis.py`, `tests/test_report.py` | `models.py`, `config.py`, `llm.py` |
| **E — cache & pipeline** | `cache.py`, `pipeline.py`, `tests/test_cache.py`, `tests/test_pipeline.py` | all stage modules, `models.py`, `config.py` |
| **F — CLI & MCP** | `cli.py` (replaces the stub), `mcp_server.py`, `tests/test_cli.py`, `tests/test_mcp.py` | stage modules, `pipeline.py`, `synthesis.py` |
| **Foundation (frozen)** | `pyproject.toml`, `.python-version`, `.gitignore`, `__init__.py`, `models.py`, `config.py`, `llm.py`, `transcribe/base.py`, `tests/conftest.py`, `CONTRACTS.md` | — |
| **Foundation (frozen during phase 2; reopened post-v1 — ADR-0001)** | `pyproject.toml`, `.python-version`, `.gitignore`, `__init__.py`, `models.py`, `config.py`, `llm.py`, `transcribe/base.py`, `tests/conftest.py`, `CONTRACTS.md` | — |
Already implemented by the foundation and usable as-is:
+90
View File
@@ -0,0 +1,90 @@
# video-analyse
The domain language of a local-first toolkit that turns one source into a staged,
content-cached analysis. Stage results are pydantic models cached by content hash, so
re-running with the same inputs is free and changing one knob invalidates exactly the
stages it affects.
## Language
### The pipeline
**Stage**:
One analysis step: `ingest`, `probe`, `audio`, `transcribe`, `diarize`, `shots`,
`describe`, `report`. Stages run in that order; the report always closes the run.
_Avoid_: step, pass, phase ("phase" is taken by the build phases in PLAN.md/CONTRACTS.md).
**Artifact**:
A stage's typed result, stored in the cache and reloaded instead of recomputed. A
corrupt artifact is treated as a cache miss, never an error.
_Avoid_: output, payload, result file.
**Cache key**:
The identity of a cached artifact: the stage name plus its params. Two runs share an
artifact exactly when their keys are equal; `force` re-runs a stage and drops the keys
of every stage downstream of it.
**Source**:
The thing being analysed — a local media path or an `http(s)` URL, identified by the
sha256 of its bytes. Two aliases of identical bytes are one source.
_Avoid_: input, video (audio-only files are valid sources too).
**Want**:
The set of stage *results* a caller asks for; prerequisites run as needed. `want`
names outcomes, not ordering — the pipeline owns the order.
_Avoid_: targets, requested stages.
**Stage descriptor**:
The single record describing one stage — its prerequisites, cache-key params, artifact
model and runner. The stage graph is encoded once, in the descriptor table.
_Avoid_: stage config, stage definition.
### Vision
**Shot**:
A contiguous span of the video treated as one unit, carrying one keyframe. Shots cover
the whole duration exactly once, in order.
_Avoid_: scene (PySceneDetect calls its cuts "scenes"; here a *cut* is only a boundary
between shots).
**Keyframe**:
The still image standing in for a shot — in adaptive sampling, the calmest sample of
the span, not its midpoint.
_Avoid_: thumbnail, frame.
**Activity curve**:
Frame-difference samples over time, used to subdivide long shots at equal
*cumulative*-activity boundaries, so dense stretches get short shots and quiet ones
long.
_Avoid_: energy curve.
**Diarization**:
Segmenting the audio by who is speaking, producing speaker turns. Speaker labels come
from clustering; one dynamic person may legitimately hold several labels.
_Avoid_: speaker separation, voiceprint.
**Speaker turn**:
A contiguous span attributed to one speaker label ("S1", "S2", ...).
_Avoid_: utterance, segment ("segment" is a transcript segment).
### Surfaces and values
**Front door**:
A user-facing adapter over the analysis module: the `va` CLI and the MCP server. Front
doors map arguments to options and shape output; they own no analysis policy.
_Avoid_: interface, entry point, client.
**Analysis module**:
The deep interface both front doors adapt to: operations named for outcomes — analyse,
transcript, shots, ask, moment — over the pipeline and the cache. One operation, two
front doors.
_Avoid_: service, orchestrator, facade.
**MediaFacts**:
The content-only probe result: duration, streams, codecs. A MediaFacts value contains
no run-time paths.
_Avoid_: metadata, MediaInfo (the pre-split name).
**MediaRef**:
The run-time location of a source — its original string and local path — attached when
cached facts are read, never cached itself.
+25
View File
@@ -0,0 +1,25 @@
# Reopen the foundation-file freeze
During phase-2 construction, CONTRACTS.md froze `models.py`, `config.py`, `llm.py`,
`transcribe/base.py` and friends so that parallel build agents could not drift from the
written contracts. Now that v1 has shipped, the freeze is doing the opposite of its job:
the shapes it locked in carry the friction found in the 2026-11 architecture review (a
config bag that silently shadows per-stage options, a one-method Transcriber interface
that callers have to reach past, a run-time path cached inside a content-addressed
value), and the "note it in your final report" escape hatch no longer has a phase-2
report to land in. The freeze is reopened: foundation files may be changed deliberately
when the change lands through a reviewed issue that records the motivation.
Status: accepted (2026-11-23).
## Consequences
- The per-file contracts in CONTRACTS.md §4–6 remain the reference for what exists
today, but they no longer gate edits. Issues
[#5](https://git.rwiesner.com/alex/video-analyse/issues/5) (per-stage options),
[#6](https://git.rwiesner.com/alex/video-analyse/issues/6) (Transcriber
identity/readiness) and
[#7](https://git.rwiesner.com/alex/video-analyse/issues/7) (MediaFacts/MediaRef) are
the first deliberate reopeners.
- Undocumented ad-hoc edits to foundation files remain off-limits; CONTRACTS.md §1.10
now encodes the reviewed-issue rule instead of the blanket freeze.