Split schema and project documentation into focused contracts

This commit is contained in:
mchus committed 2026-10-03 09:35:38 +03:00
1 parent b0e6402d66
commit d0d7233700
21 files changed
+405 -327

No files matched your search

@@ -0,0 +1,35 @@
# Contract: Project Architecture Documents
Part of [Project Bible](../contract.md).
## system-overview.md Rules
- List what is **in scope** and what is **explicitly out of scope**.
- Out of scope section prevents scope creep; update it when you reject a feature.
- Include tech stack and local run command.
## data-model.md Rules
- Document canonical naming: if domain model uses `Machine` but API uses `asset`, say so explicitly.
- List all DB tables with one-line description of each.
- Document any non-obvious invariants (e.g. "parts are projections of history, not source of truth").
- Migration policy: how migrations are numbered and applied.
## api-surface.md Rules
- Every endpoint: method, path, brief description, key response fields.
- Group by domain area (Registry, Ingest, Timeline, etc.).
- Note any endpoints that are UI-only routes vs JSON API.
- Document pagination, filtering params where non-obvious.
## runtime-flows.md Rules
This is the most important file. Document flows that are **easy to break**:
- Mutation paths (what happens step by step when user does X)
- Event/time source priority rules
- Deduplication logic
- Cross-entity side effects (e.g. removing a component affects asset status)
- Anything that caused a bug or regression: add a "DO NOT reintroduce" note
Format each flow as a numbered list of steps, not prose.
+6 -63
View File
@@ -1,6 +1,6 @@
# Contract: Project Bible (bible-local/)
Version: 1.0
Version: 1.1
## Purpose
@@ -35,68 +35,6 @@ Optional (add when relevant):
INTEGRATION_GUIDE.md - external system integration (formats, protocols)
```
## system-overview.md Rules
- List what is **in scope** and what is **explicitly out of scope**.
- Out of scope section prevents scope creep; update it when you reject a feature.
- Include tech stack and local run command.
## data-model.md Rules
- Document canonical naming: if domain model uses `Machine` but API uses `asset`, say so explicitly.
- List all DB tables with one-line description of each.
- Document any non-obvious invariants (e.g. "parts are projections of history, not source of truth").
- Migration policy: how migrations are numbered and applied.
## api-surface.md Rules
- Every endpoint: method, path, brief description, key response fields.
- Group by domain area (Registry, Ingest, Timeline, etc.).
- Note any endpoints that are UI-only routes vs JSON API.
- Document pagination, filtering params where non-obvious.
## runtime-flows.md Rules
This is the most important file. Document flows that are **easy to break**:
- Mutation paths (what happens step by step when user does X)
- Event/time source priority rules
- Deduplication logic
- Cross-entity side effects (e.g. removing a component affects asset status)
- Anything that caused a bug or regression: add a "DO NOT reintroduce" note
Format each flow as a numbered list of steps, not prose.
## Architectural Decision Log (ADL)
Write a decision entry when:
- You choose between two non-obvious approaches
- You intentionally reject a feature or pattern
- A bug caused a rule change (e.g. cursor safety)
- You freeze or deprecate something
**Format:**
```markdown
# Decision: <short title>
**Date:** YYYY-MM-DD
**Status:** active | superseded by YYYY-MM-DD-topic.md
## Context
What situation made this decision necessary.
## Decision
What was decided, stated clearly.
## Consequences
What this means going forward. What is now forbidden or required.
```
- One decision per file, named `YYYY-MM-DD-short-topic.md`.
- When a decision is superseded, add `superseded by` to the old file's status; do not delete it.
- Record the decision **in the same commit** as the code that implements it.
## What NOT to Put in bible-local/
- Generic rules (CSV format, logging, pagination) -> these are in `bible/rules/patterns/`
@@ -111,3 +49,8 @@ What this means going forward. What is now forbidden or required.
- If a section becomes outdated, fix or delete it; stale docs are worse than no docs.
- Bible files are in **English only**.
- Do not use em dash in Bible files; prefer ASCII punctuation such as `-`, `:`, or `;` depending on the sentence.
## Topic Contracts
- [Architecture documents](architecture/contract.md)
- [Decision records and promotion to shared rules](decisions/contract.md)
@@ -0,0 +1,37 @@
# Contract: Project Decisions
Part of [Project Bible](../contract.md).
## Architectural Decision Log (ADL)
Write a decision entry when:
- You choose between two non-obvious approaches
- You intentionally reject a feature or pattern
- A bug caused a rule change (e.g. cursor safety)
- You freeze or deprecate something
**Format:**
```markdown
# Decision: <short title>
**Date:** YYYY-MM-DD
**Status:** active | superseded by YYYY-MM-DD-topic.md
## Context
What situation made this decision necessary.
## Decision
What was decided, stated clearly.
## Consequences
What this means going forward. What is now forbidden or required.
```
- One decision per file, named `YYYY-MM-DD-short-topic.md`.
- When a project-specific decision is superseded, add `superseded by` to its status; retain
its unique rationale. Shared knowledge promoted to `bible` is not a second local decision:
after the updated submodule is available, remove the local shared rules and replace their
index entries with links to the owning contracts. Preserve only project-specific bindings
and consequences locally; delete a file if no unique local knowledge remains.
- Record the decision **in the same commit** as the code that implements it.