Skip to content

Commit 562895c

Browse files
committed
─────┬──────────────────────────────────────────────────────────────────────────
│ STDIN ─────┼────────────────────────────────────────────────────────────────────────── 1 │ Add README and ROADMAP documentation 2 │ 3 │ README.md: 4 │ - Hero section: Problem, Approach, Outcome narrative 5 │ - Quick start guide with code examples 6 │ - CLI usage documentation 7 │ - Architecture overview with layer diagram 8 │ - Hard rules reference table 9 │ - RNG mapping table 10 │ - Full API reference (factory functions, matrix, modulation, rituals, FX, characters, patches) 11 │ - Development instructions 12 │ - Test coverage summary (297 tests across 8 suites) 13 │ 14 │ ROADMAP.md: 15 │ - Current status: v1.0.0 with completed milestones 16 │ - Active development: Audio integration, browser persistence 17 │ - Future considerations: Visualization, extended rituals, network, AI 18 │ - Architecture principles for future development 19 │ - Contributing guidelines 20 │ 21 │ Also fixes flaky character test: 22 │ - Adjusted sine wave sampling to avoid phase alignment 23 │ - Changed frequency from 10Hz to 1Hz, interval from 100ms to 50ms 24 │ 25 │ All 297 tests pass. 26 │ 27 │ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> ─────┴──────────────────────────────────────────────────────────────────────────
1 parent 26972a8 commit 562895c

3 files changed

Lines changed: 457 additions & 3 deletions

File tree

README.md

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
# sema-metra--alchemica-mundi
2+
3+
**Signal-Matrix for World-Alchemy**
4+
5+
> *Signals generate the matrix; the matrix transmutes signals; and every transmutation rewrites the conditions of the world that will interpret the next signal.*
6+
7+
---
8+
9+
## The Problem
10+
11+
Creative systems face a fundamental tension: they must be **structured enough to be programmable** yet **fluid enough to enable genuine emergence**. Traditional approaches either impose rigid schemas that constrain creativity, or offer formless flexibility that resists systematic operation.
12+
13+
Most signal-processing frameworks treat transformation as a stateless pipe—signals enter, get processed, and exit unchanged in their fundamental nature. They lack:
14+
- **Ontological integrity**: No guarantee that operations preserve meaning while allowing form to evolve
15+
- **Contextual awareness**: Signals are processed without knowledge of their origin or purpose
16+
- **World-binding**: Outputs don't influence future inputs; the system doesn't learn from its operations
17+
- **Cost accounting**: Transformations happen without acknowledging the semantic entropy they create
18+
19+
## The Approach
20+
21+
**sema-metra--alchemica-mundi** implements an *axiom-driven architecture* where 10 formal axioms govern all system behavior:
22+
23+
1. **Primacy of Sign** — Signals precede structure; the system cannot exist empty
24+
2. **Emergence of Matrix** — Structure crystallizes from recurring signals
25+
3. **Alchemical Transformation** — All operations transmute; nothing passes through unchanged
26+
4. **Conservation of Meaning** — Semantic charge persists even as forms decay
27+
5. **Recursive World-Binding** — Outputs alter the conditions of subsequent inputs
28+
6. **Signal-Structure Feedback** — Structure constrains future signification
29+
7. **Irreducibility of Context** — Context is constitutive, not decorative
30+
8. **Anti-Teleology** — No final state; progress emerges locally
31+
9. **Ontological Cost** — Every transformation exacts entropy
32+
10. **Legibility as Power** — Total clarity is total stagnation
33+
34+
These axioms are enforced through six **hard rules** and a modular **event spine**:
35+
36+
```
37+
SEMA_LOG → Append-only event stream
38+
METRA_PROJECTIONS → Versioned context bundles
39+
ALCHEMICA_TRANSFORMS → Non-identity transform validation
40+
MUNDI_FEEDBACK → Mandatory world-binding loop
41+
```
42+
43+
## The Outcome
44+
45+
A TypeScript framework providing:
46+
47+
- **64 DUALCORE spectral dualities** — Oscillating values (-1.0 to +1.0) across 8 domains
48+
- **32 binary gates** — Strict on/off logic for ritual entry/denial
49+
- **15 hybrid toggles** — Context-sensitive ritual states
50+
- **32 dual-binary bridges** — 2:1 mapping from dualities to locks
51+
- **LFO/RNG modulation engine** — Dice-based probability and waveform control
52+
- **Ritual execution system** — Conditional fusion with binary gate checks
53+
- **FX chain with mythological god-names** — Effect processing as divine invocation
54+
- **Character waveform models** — AI entities with signature oscillation patterns
55+
- **Patch save/load system** — State persistence and restoration
56+
- **CLI interface** — Terminal access to all operations
57+
- **297 tests** with axiom compliance verification
58+
59+
---
60+
61+
## Installation
62+
63+
```bash
64+
npm install sema-metra--alchemica-mundi
65+
```
66+
67+
Requires Node.js >= 20.0.0
68+
69+
## Quick Start
70+
71+
```typescript
72+
import { createAlchemicaMundi, validateAxiomCompliance } from 'sema-metra--alchemica-mundi';
73+
74+
// Create the full axiom-compliant system
75+
const mundi = await createAlchemicaMundi();
76+
77+
// Access components
78+
const { matrix, modulation, ritual, fx, patch, characters, spine } = mundi;
79+
80+
// Roll dice for modulation
81+
const roll = modulation.rng.roll('d20');
82+
83+
// Execute a ritual
84+
const result = await ritual.engine.execute('invoke_shimmer');
85+
86+
// Validate axiom compliance
87+
const { valid, report } = validateAxiomCompliance(mundi);
88+
console.log(`Axiom compliant: ${valid}`);
89+
```
90+
91+
## CLI Usage
92+
93+
```bash
94+
# Initialize system
95+
sema init
96+
97+
# Roll dice
98+
sema roll d20
99+
100+
# Modulate a duality (index 0-63, value -1.0 to 1.0)
101+
sema modulate 13 0.8
102+
103+
# Execute a ritual
104+
sema ritual invoke_shimmer
105+
106+
# Show status
107+
sema status
108+
```
109+
110+
## Architecture
111+
112+
### Core Layers
113+
114+
```
115+
┌─────────────────────────────────────────────────────────────┐
116+
│ CLI (sema) │
117+
├─────────────────────────────────────────────────────────────┤
118+
│ Matrix │ Modulation │ Ritual │ FX │ Characters │
119+
├─────────────────────────────────────────────────────────────┤
120+
│ Patch Manager │
121+
├─────────────────────────────────────────────────────────────┤
122+
│ Event Spine │
123+
│ ┌────────────┬────────────┬────────────┬────────────┐ │
124+
│ │ EventLog │ Context │ Transform │ World │ │
125+
│ │ (append) │ Store │ Validator │ Binding │ │
126+
│ └────────────┴────────────┴────────────┴────────────┘ │
127+
├─────────────────────────────────────────────────────────────┤
128+
│ Hard Rules (A-F) │
129+
└─────────────────────────────────────────────────────────────┘
130+
```
131+
132+
### Hard Rules
133+
134+
| Rule | Name | Enforcement |
135+
|------|------|-------------|
136+
| A | No Empty Boot | Genesis signal required before state projection |
137+
| B | Append-Only | Events immutable after commit |
138+
| C | Context Required | Every event carries context reference |
139+
| D | Transform Must Mutate | Identity transforms rejected |
140+
| E | Every Transform Emits Cost | Cost vectors mandatory |
141+
| F | Every Output Writes Back | World-binding feedback required |
142+
143+
### RNG Mapping
144+
145+
| Die | Range | Use Case |
146+
|-----|-------|----------|
147+
| d4 | 1-4 | Micro modulation (UI effects) |
148+
| d6 | 1-6 | AI responses, emotion flicker |
149+
| d8 | 1-8 | Mood state changes |
150+
| d10 | 1-10 | Action success/failure intensities |
151+
| d12 | 1-12 | System bugs, recursion locks |
152+
| d20 | 1-20 | Ritual pass/fail, karma inversion |
153+
| d100 | 1-100 | Major plot forks, fusion glitch |
154+
| d1000 | 1-1000 | Divine intervention, cosmic shift |
155+
156+
## API Reference
157+
158+
### Factory Functions
159+
160+
```typescript
161+
// Basic matrix creation
162+
const matrix = createMatrix(data);
163+
164+
// Full system without spine (lighter weight)
165+
const alchemica = await createAlchemica();
166+
167+
// Complete axiom-compliant system
168+
const mundi = await createAlchemicaMundi();
169+
```
170+
171+
### Matrix Operations
172+
173+
```typescript
174+
// Get a duality
175+
const duality = matrix.dualities.get(13);
176+
console.log(duality.value); // -1.0 to 1.0
177+
178+
// Modulate a duality
179+
duality.modulate(0.5);
180+
181+
// Check a binary gate
182+
const gate = matrix.binaries.get('sacred_mode_lock');
183+
console.log(gate.state); // true/false
184+
185+
// Toggle a hybrid
186+
const hybrid = matrix.hybrids.get('veil_state');
187+
hybrid.toggle();
188+
```
189+
190+
### Modulation
191+
192+
```typescript
193+
// Create LFO
194+
const lfo = modulation.engine.createLFO({
195+
waveform: 'sine',
196+
frequency: 0.5,
197+
amplitude: 0.7
198+
});
199+
200+
// Roll dice
201+
const result = modulation.rng.roll('d20');
202+
203+
// Apply affector
204+
modulation.engine.applyAffector({
205+
id: 'mood_shift',
206+
influence: 0.8,
207+
targetDualities: [13, 14, 15]
208+
});
209+
```
210+
211+
### Rituals
212+
213+
```typescript
214+
// Execute ritual
215+
const result = await ritual.engine.execute('invoke_shimmer');
216+
217+
// Check conditions
218+
const conditions = ritual.conditions.check({
219+
duality1: { index: 5, threshold: 0.7, comparison: '>=' },
220+
duality2: { index: 12, threshold: -0.3, comparison: '<=' }
221+
});
222+
223+
// Create fusion signal
224+
const fusion = ritual.fusion.create(conditions);
225+
```
226+
227+
### FX Chain
228+
229+
```typescript
230+
// Build effect chain
231+
fx.chain.add('filter').add('reverb').add('delay');
232+
233+
// Configure effect
234+
fx.chain.setUnitParameter('filter', 'frequency', 2000);
235+
fx.chain.setUnitParameter('reverb', 'decay', 3.5);
236+
237+
// Use preset
238+
const chain = FXChain.createPreset(fx.registry, 'reverb_shimmer');
239+
```
240+
241+
### Characters
242+
243+
```typescript
244+
// Register character
245+
const jessica = characters.register(CHARACTER_TEMPLATES.JESSICA);
246+
jessica.activate();
247+
248+
// Get modulation value
249+
const influence = jessica.getCurrentValue();
250+
251+
// Check compatibility
252+
const compatible = jessica.isCompatibleWith('Gabriel');
253+
```
254+
255+
### Patch Management
256+
257+
```typescript
258+
// Save current state
259+
const snapshot = patch.manager.snapshot();
260+
261+
// Restore state
262+
patch.manager.restore(snapshot);
263+
264+
// Save to file
265+
await patch.manager.save('my-patch.json');
266+
267+
// Load from file
268+
await patch.manager.load('my-patch.json');
269+
```
270+
271+
## Documentation
272+
273+
| Document | Purpose |
274+
|----------|---------|
275+
| [AXIOMS.md](./AXIOMS.md) | Formal axiom set (10 laws + closing condition) |
276+
| [CONSTRAINTS.md](./CONSTRAINTS.md) | Implementation constraints and hard rules |
277+
| [CLAUDE.md](./CLAUDE.md) | System guide for AI assistants |
278+
279+
## Development
280+
281+
```bash
282+
# Install dependencies
283+
npm install
284+
285+
# Run tests
286+
npm test
287+
288+
# Watch mode
289+
npm run test:watch
290+
291+
# Build
292+
npm run build
293+
294+
# Type check
295+
npm run typecheck
296+
```
297+
298+
## Test Coverage
299+
300+
The system includes 297 tests across 8 test files:
301+
302+
- **Core tests** (27) — Duality, binary, hybrid, bridge operations
303+
- **Modulation tests** (26) — LFO, RNG, affector, engine
304+
- **Ritual tests** (22) — Conditions, fusion, execution
305+
- **FX tests** (48) — Unit, registry, chain, presets
306+
- **Character tests** (36) — Waveforms, templates, registry
307+
- **Patch tests** (35) — Snapshots, save/load, validation
308+
- **Spine tests** (60) — Rules A-F, event log, context store
309+
- **Axiom tests** (43) — All 10 axioms + compliance validation
310+
311+
## License
312+
313+
MIT
314+
315+
---
316+
317+
*A system may call itself sema-metra–alchemica-mundi only if it cannot be emptied without collapse, cannot repeat itself without mutation, and cannot describe the world without altering it.*

0 commit comments

Comments
 (0)