cgcardona / muse public
README.md markdown
156 lines 7.2 KB
5a7035e3 feat: Python 3.12 baseline, dep refresh, and docs navigation index Gabriel Cardona <gabriel@tellurstori.com> 2d ago
1 # Muse Documentation
2
3 > **Version:** v0.1.1 · [Project README](../README.md) · [Source](../muse/)
4
5 This directory contains the complete documentation for Muse — a domain-agnostic version control system for multidimensional state.
6
7 ---
8
9 ## Quick Navigation
10
11 | I want to… | Start here |
12 |-------------|-----------|
13 | Understand the full architecture | [Architecture Reference](architecture/muse-vcs.md) |
14 | Build a new domain plugin | [Plugin Authoring Guide](guide/plugin-authoring-guide.md) |
15 | Learn CRDT semantics | [CRDT Reference](guide/crdt-reference.md) |
16 | See an end-to-end walkthrough | [E2E Demo](architecture/muse-e2e-demo.md) |
17 | Read the protocol spec | [Plugin Protocol](protocol/muse-protocol.md) |
18 | Understand domain concepts | [Domain Concepts](protocol/muse-domain-concepts.md) |
19 | Look up a named type | [Type Contracts](reference/type-contracts.md) |
20 | Configure merge strategies | [`.museattributes` Reference](reference/muse-attributes.md) |
21 | Exclude files from snapshots | [`.museignore` Reference](reference/museignore.md) |
22 | Watch the demo narration | [Tour de Force Script](demo/tour-de-force-script.md) |
23
24 ---
25
26 ## Directory Map
27
28 ```
29 docs/
30 ├── README.md ← you are here
31
32 ├── architecture/
33 │ ├── muse-vcs.md — full technical design: protocol stack, storage,
34 │ │ diff algorithms, OT merge, CRDT semantics,
35 │ │ config system, and CLI command map
36 │ └── muse-e2e-demo.md — step-by-step lifecycle: init → commit → branch
37 │ → merge conflict → resolve → tag
38
39 ├── guide/
40 │ ├── plugin-authoring-guide.md — complete walkthrough for writing a new domain
41 │ │ plugin, from core protocol through OT merge
42 │ │ and CRDT convergent merge
43 │ └── crdt-reference.md — CRDT primer: lattice laws, all six primitives
44 │ (VectorClock, LWWRegister, ORSet, RGA, AWMap,
45 │ GCounter), composition patterns, when to use CRDTs
46
47 ├── protocol/
48 │ ├── muse-protocol.md — language-agnostic MuseDomainPlugin spec: six
49 │ │ required methods, StructuredMergePlugin and
50 │ │ CRDTPlugin optional extensions, invariants
51 │ ├── muse-domain-concepts.md — universal vocabulary: what "state", "delta",
52 │ │ "dimension", "drift", and "merge" mean across
53 │ │ music, genomics, simulation, and beyond
54 │ └── muse-variation-spec.md — variation semantics for the music domain
55
56 ├── reference/
57 │ ├── type-contracts.md — single source of truth for every named type:
58 │ │ TypedDicts, dataclasses, Protocols, Enums,
59 │ │ and TypeAliases with Mermaid diagrams
60 │ ├── muse-attributes.md — .museattributes TOML format reference:
61 │ │ [meta] domain, [[rules]] syntax, all five
62 │ │ strategies, multi-domain usage, examples
63 │ └── museignore.md — .museignore format: glob patterns, negation,
64 │ dotfile exclusion rules
65
66 └── demo/
67 └── tour-de-force-script.md — narration script for the video demo covering
68 all nine acts: core VCS through CRDT semantics
69 and the live domain dashboard
70 ```
71
72 ---
73
74 ## Architecture at a Glance
75
76 Muse separates the **VCS engine** (domain-agnostic) from **domain plugins** (domain-specific). The engine never changes when a new domain is added — only a new plugin is registered.
77
78 ```
79 ┌─────────────────────────────────────────────┐
80 │ muse CLI │
81 │ (15 commands, Typer-based) │
82 └──────────────────────┬──────────────────────┘
83
84 ┌──────────────────────▼──────────────────────┐
85 │ Muse Core Engine │
86 │ DAG · object store · branching · merging │
87 │ content-addressed blobs · lineage walking │
88 └──────┬────────────────────────────┬─────────┘
89 │ │
90 ┌──────▼──────┐ ┌──────▼──────┐
91 │MuseDomainPlugin│ │MuseDomainPlugin│
92 │ (music) │ │ (your domain) │
93 │ 6 methods │ │ 6 methods │
94 └──────────────┘ └───────────────┘
95 ```
96
97 The six required methods:
98
99 | Method | What it does |
100 |--------|-------------|
101 | `snapshot()` | Capture live state → content-addressed dict |
102 | `diff()` | Compute typed delta between two snapshots |
103 | `merge()` | Three-way reconciliation against a common ancestor |
104 | `drift()` | Compare committed state against live working tree |
105 | `apply()` | Apply a delta to reconstruct historical state |
106 | `schema()` | Declare data structure → drives diff algorithm selection |
107
108 Two optional protocol extensions enable richer merge semantics:
109
110 | Extension | Adds | Effect |
111 |-----------|------|--------|
112 | `StructuredMergePlugin` | `merge_ops()` | Operation-level OT merge — minimal real conflicts |
113 | `CRDTPlugin` | `join()` + 3 helpers | Convergent merge — `join` always succeeds, no conflict state |
114
115 ---
116
117 ## Adding a New Domain
118
119 1. Copy `muse/plugins/scaffold/` → `muse/plugins/<your_domain>/`
120 2. Rename `ScaffoldPlugin` → `<YourDomain>Plugin`
121 3. Replace every `raise NotImplementedError(...)` with real implementation
122 4. Register in `muse/plugins/registry.py`
123 5. Run `muse init --domain <your_domain>` in a project directory
124
125 All 15 `muse` CLI commands work immediately. See the [Plugin Authoring Guide](guide/plugin-authoring-guide.md) for the full walkthrough.
126
127 ---
128
129 ## Config Files Generated by `muse init`
130
131 | File | Location | Purpose |
132 |------|----------|---------|
133 | `repo.json` | `.muse/repo.json` | Immutable identity: repo UUID, schema version, domain |
134 | `config.toml` | `.muse/config.toml` | Mutable: `[user]`, `[auth]`, `[remotes]`, `[domain]` |
135 | `HEAD` | `.muse/HEAD` | Current branch ref |
136 | `.museattributes` | repo root | TOML merge strategy overrides (`[[rules]]`) |
137 | `.museignore` | repo root | Glob patterns to exclude from snapshots |
138
139 ---
140
141 ## Testing Standards
142
143 Every public function has a unit test. Integration tests wire real components. E2E tests invoke the CLI via `typer.testing.CliRunner`.
144
145 ```bash
146 # Run all tests
147 pytest tests/ -v
148
149 # Type-check
150 mypy muse/
151
152 # Zero-Any audit
153 python tools/typing_audit.py --dirs muse/ tests/ --max-any 0
154 ```
155
156 All three gates must be green before any PR merges.