Scaffold persistent state spine

This commit is contained in:
Meta Vens 2026-05-16 03:43:43 +01:00
commit d9ac23b014
14 changed files with 461 additions and 0 deletions

15
.gitignore vendored Normal file
View file

@ -0,0 +1,15 @@
*.tmp
*.bak
__pycache__/
*.pyc
state/*.msgpack
state/*.msgpack.lock
state/*.projection.json
state/scratch-compaction-*.md
.weksa-runs/
.weksa-smoke/
node_modules/
dist/
build/
.venv/
venv/

53
AGENTS.md Normal file
View file

@ -0,0 +1,53 @@
# Weksa Instructions
Weksa follows the global coherence rule: map first, cut cleanly, build only the
parts whose authority is clear.
Before substantial implementation, state:
- Objective
- Current mechanism
- Invariants
- Intended change
- Cut line
## Project Doctrine
- Do not translate English directly into alien words.
- Decompose source text into meaning first.
- Let the alien ontology decide which distinctions split, collapse, or become
obligatory.
- Keep neural models as semantic decomposition, generation, and critique tools.
- Keep linguistic authority in explicit tables, typed state, and deterministic
renderers.
- Do not build rules-based language cops for fuzzy meaning. Use model-based
classification or trainable readers for semantic interpretation; reserve
hand-written rules for deterministic grammar and validation.
## Ownership
- Ontology owns concept identity, relations, domains, salience, and worldview
distortions.
- Grammar owns required expression, syntax, inflection, agreement, and clause
structure.
- Phonology owns legal sounds, syllable shape, prosody, phonotactics, and sound
symbolism constraints.
- Morphology owns derivation, inflection, compounding, and root-family behavior.
- Diachrony owns historical sound change, semantic drift, register split, loan
strata, and irregularity.
- Renderer owns surface forms from already-structured meaning.
- Persistent state owns maps, accepted design, invariants, evidence, scratch,
and durable decisions.
## Persistent State
The live state architecture is ported from EpiphanyAgent in reduced form:
- `state/map.yaml` is canonical and slow-changing.
- `state/scratch.md` is temporary and disposable.
- `schemas/` explains state contracts in human language.
- `packages/weksa-state-model` owns executable typed state.
Project truth does not belong in agent personality memory. If Weksa later grows
role dossiers or heartbeat scheduling, those surfaces must remain separate from
language-project truth.

35
README.md Normal file
View file

@ -0,0 +1,35 @@
# Weksa
Weksa is a procedural language engine for alien grammars grounded in concept,
culture, and constraint.
The project starts from a blunt rule: English words are not the source of truth.
Meaning is decomposed into an ontology, passed through a worldview, constrained
by grammar, shaped by phonology, distorted by history, and only then rendered as
surface text.
## Ownership Model
- Ontology owns meaning.
- Grammar owns required expression.
- Phonology owns sound shape.
- Diachrony owns historical distortion.
- Renderer owns surface text.
- Persistent state owns durable maps, constraints, decisions, and evidence.
If a future module cannot state what it owns and what invariant it protects, it
does not get to exist. Harsh, but the alternative is a language generator with a
clipboard and delusions of nationhood.
## Scaffold
- `state/map.yaml`: canonical working map.
- `state/scratch.md`: disposable workbench.
- `schemas/`: human-facing state contract receipts.
- `docs/`: architecture, language model, and roadmap.
## Implementation Status
No runtime language has been selected yet. The first committed artifact is the
persistent state spine: map, scratch, schemas, docs, and examples. The engine
implementation should be chosen after the pipeline and data ownership are clear.

7
data/roots/README.md Normal file
View file

@ -0,0 +1,7 @@
# Root Data
Placeholder for seed roots, phonesthetic notes, and derivational family
experiments.
Root data should remain subordinate to ontology, morphology, phonology, and
diachrony. A root list is not a language. It is a bag of nouns wearing ambition.

7
data/typology/README.md Normal file
View file

@ -0,0 +1,7 @@
# Typology Data
Placeholder for typological notes, feature inventories, and references that can
inform Weksa language projects.
Do not turn this into a random trivia drawer. Each datum should eventually
support a generator decision, validation rule, or critique prompt.

36
docs/architecture.md Normal file
View file

@ -0,0 +1,36 @@
# Architecture
Weksa is currently a state spine and a pipeline map, not an implementation.
## Objective
Build a procedural alien-language engine whose outputs are grounded in
worldview, semantics, grammar, phonology, morphology, and history.
## Current Mechanism
There is no runtime mechanism yet. The repo contains persistent state surfaces
that define the intended data flow and the ownership boundaries future code must
respect.
## Invariants
- Meaning precedes words.
- Ontology owns concept distinctions.
- Grammar owns obligatory expression.
- Morphology owns form families.
- Phonology owns sound legality.
- Diachrony owns plausible irregularity.
- Renderer owns output, not interpretation.
## Intended Change
Future implementation should turn the pipeline in `state/map.yaml` into a small,
inspectable machine. The first executable slice should probably read a tiny
language project definition, render a handful of structured meaning packets, and
produce traceable glossed output.
## Cut Line
Do not add a runtime language, service, database, queue, plugin system, prompt
framework, or adapter until the pipeline stage needing it is known.

27
docs/language-model.md Normal file
View file

@ -0,0 +1,27 @@
# Language Model
Weksa's linguistic model is concept-first.
## Translation Path
1. Preserve the source utterance.
2. Decompose it into structured meaning.
3. Apply an alien ontology that may split, collapse, or reweight concepts.
4. Select grammatical commitments required by the target language.
5. Build morpheme plans from roots, derivation, inflection, and compounds.
6. Apply phonological constraints.
7. Apply diachronic history.
8. Render surface text, glosses, and explanation.
## Model Use
LLMs and embedding models are useful for:
- semantic decomposition
- concept clustering
- typological inspiration
- consistency critique
- example generation
They are not the canonical state store. A completion becomes durable only after
it is normalized into explicit language-project state.

21
docs/roadmap.md Normal file
View file

@ -0,0 +1,21 @@
# Roadmap
## Now
- Keep the persistent state spine small and readable.
- Decide the first language-project state format.
- Build a hand-authored toy language project before automating generation.
## First Prototype
- Parse or load one language project definition.
- Accept a structured meaning packet.
- Render glossed output through grammar, morphology, phonology, and diachrony.
- Emit a trace explaining which stage made each decision.
## Later
- Add model-assisted semantic decomposition from English.
- Add embeddings for concept clustering.
- Add model critique against the explicit language state.
- Add corpus generation and consistency checks.

View file

@ -0,0 +1,13 @@
# First Contact Example
Placeholder for the first toy language project.
This example should stay small:
- one ontology slice
- one grammar slice
- one phonology
- one morphology pattern
- one diachronic rule
- a few structured meaning packets
- rendered output with glosses

24
schemas/README.md Normal file
View file

@ -0,0 +1,24 @@
# Schemas
This folder records Weksa's persistent state contracts in human language.
The repo deliberately starts without executable schema code. Runtime language,
storage backend, and generated type targets are undecided. Until those decisions
are made, this folder is the receipt surface: if a state shape matters enough to
steer the machine, describe its authority here.
## Canonical Surfaces
- [project-state.md](./project-state.md): project map, scratch, decisions,
evidence, and open questions.
- [language-project-state.md](./language-project-state.md): future per-language
state for ontology, grammar, morphology, phonology, diachrony, and renderer
configuration.
## Source Of Truth
- `state/map.yaml` is the canonical live map for this workspace.
- `state/scratch.md` is temporary working memory.
- `schemas/` explains the contracts.
- Future executable schemas must be generated from or reconciled with these
receipts in the same pass that introduces them.

View file

@ -0,0 +1,24 @@
# Language Project State
This is the intended future state shape for an individual generated language.
It is not executable yet.
## Ownership Families
- `metadata`: language name, world/culture context, authorship, version.
- `ontology`: concept inventory, semantic relations, splits, collapses, salience.
- `interlingua`: source meaning representation accepted by the renderer.
- `grammar`: syntax, agreement, evidentiality, aspect, valence, required
categories.
- `morphology`: roots, affixes, compounding, derivation, inflection.
- `phonology`: phonemes, syllable shapes, phonotactics, prosody, romanization.
- `diachrony`: proto-forms, sound changes, semantic drift, strata, registers.
- `lexicon`: generated forms, glosses, etymologies, usage constraints.
- `corpus`: example sentences, analyses, translations, provenance.
- `critique`: model or human findings about consistency and plausibility.
## Boundary Rule
The language project should not store raw model completions as truth. A model
completion can be evidence, suggestion, or critique. Accepted language state
must be normalized into the owned families above.

37
schemas/project-state.md Normal file
View file

@ -0,0 +1,37 @@
# Project State
Weksa's project state is the durable memory surface for the workspace.
It exists to keep architecture, decisions, invariants, and evidence separate
from chat transcript fog. This is the EpiphanyAgent persistent-state pattern,
trimmed down before it starts making grand claims in a hallway mirror.
## Files
- `state/map.yaml`: canonical, slow-changing project map.
- `state/scratch.md`: disposable workbench.
- `schemas/`: human-readable state contracts.
- `docs/`: explanatory design documents.
## Map Shape
`state/map.yaml` currently carries:
- `project`: name, status, phase, premise
- `objective`: primary and current objective
- `constraints`: live boundaries
- `invariants`: statements that must remain true
- `data_flow`: observe, process, and cut model
- `pipeline`: stages and edges
- `accepted_design`: durable decisions
- `open_questions`: unresolved design pressure
- `landed_baseline`: completed scaffold state
## Policy
- The map is not an activity log.
- Scratch is not canonical.
- Accepted design should describe the live system, not celebrate old wounds.
- Evidence belongs here only when it changes future behavior.
- Runtime scaffolding should not appear until ownership and data flow justify
it.

145
state/map.yaml Normal file
View file

@ -0,0 +1,145 @@
project:
name: Weksa
status: scaffolded
phase: state_spine
premise: >
Build a procedural language engine that generates alien languages from
explicit concepts, cultural constraints, grammar, phonology, morphology,
and diachronic history instead of direct English word substitution.
objective:
primary: >
Create a durable workspace where Weksa can develop from a persistent map
before runtime architecture decisions are made.
current: >
Establish the language-neutral state spine ported from the EpiphanyAgent
pattern: canonical map, scratch surface, schema receipts, and pipeline
documentation.
constraints:
- Runtime implementation language is undecided.
- Do not add framework, package, build, CLI, or service scaffolding until the
architecture earns it.
- Neural models may decompose, suggest, generate, and critique; they do not
own the canonical language state.
- Explicit project state must distinguish durable decisions from scratch.
- Avoid direct English-to-alien word replacement as the core design.
invariants:
- Ontology owns meaning.
- Grammar owns required expression.
- Phonology owns sound shape.
- Morphology owns derivation, inflection, compounding, and root families.
- Diachrony owns historical distortion, semantic drift, register split, loan
strata, and irregularity.
- Renderer owns surface text and glosses from already-structured meaning.
- Persistent state owns durable maps, accepted decisions, open questions,
evidence, and working memory.
- Scratch is disposable; the map is slow-changing.
data_flow:
observe:
- source utterance
- translation context
- world model
- existing language project state
process:
- decompose source into structured interlingua
- apply alien ontology and cultural salience
- select grammatical commitments
- derive morphology and lexical families
- apply phonological constraints
- apply diachronic history
- render surface alien text, gloss, and explanation
cut:
- remove stages that do not own a clear invariant
- reject generic adapters until a real external boundary exists
- keep model prompts as replaceable tools, not hidden sources of truth
pipeline:
stages:
- id: source-input
title: Source Input
owns: raw utterance and context
emits: source packet
invariant: input text remains recoverable as evidence
- id: interlingua
title: Meaning Interlingua
owns: structured semantic representation
emits: concept/event graph
invariant: meaning is explicit before alien rendering
- id: ontology
title: Alien Ontology
owns: concept splits, collapses, salience, and worldview pressure
emits: alien concept frame
invariant: alien worldview decides which distinctions matter
- id: grammar
title: Grammar
owns: required expression, syntax, agreement, and clause structure
emits: grammatical plan
invariant: surface output carries required commitments
- id: morphology
title: Morphology
owns: roots, derivation, inflection, compounds, and families
emits: morpheme plan
invariant: related forms remain related for a reason
- id: phonology
title: Phonology
owns: legal sounds, syllables, phonotactics, and prosody
emits: legal proto-forms
invariant: generated forms belong to one sound system
- id: diachrony
title: Diachrony
owns: historical sound change, semantic drift, registers, loans, scars
emits: attested forms
invariant: plausible irregularity comes from history, not decoration
- id: renderer
title: Renderer
owns: surface alien text, glosses, and analysis output
emits: final translation packet
invariant: rendering does not invent meaning
edges:
- source: source-input
target: interlingua
carries: source packet
- source: interlingua
target: ontology
carries: concept/event graph
- source: ontology
target: grammar
carries: alien concept frame
- source: grammar
target: morphology
carries: grammatical plan
- source: morphology
target: phonology
carries: morpheme plan
- source: phonology
target: diachrony
carries: legal proto-forms
- source: diachrony
target: renderer
carries: attested forms
accepted_design:
- Weksa starts with a language-neutral persistent state spine rather than a
runtime scaffold.
- The EpiphanyAgent pattern is ported as architecture discipline, not as Rust
code or product-specific organs.
- The first model is concept-first translation through an explicit
interlingua, ontology, grammar, morphology, phonology, diachrony, and
renderer pipeline.
open_questions:
- Which implementation language best serves the first usable engine?
- What format should language projects use for ontology, grammar, phonology,
morphology, and diachrony definitions?
- Which model provider and embedding strategy should be used for semantic
decomposition and critique?
- How much deterministic validation belongs in v0?
landed_baseline:
- Language-neutral state spine.
- Canonical pipeline map.
- Scratch surface.
- Schema receipt docs.

17
state/scratch.md Normal file
View file

@ -0,0 +1,17 @@
# Weksa Scratch
Disposable working surface. Promote only durable decisions into
`state/map.yaml` or `schemas/`.
## Current Thread
Weksa is named after a PIE-ish speech root flavor. The core idea is a
procedural alien-language engine that avoids English word substitution by
rendering structured meaning through an alien ontology and language pipeline.
## Immediate Next Questions
- Decide the first artifact format for a language project.
- Decide whether the first prototype should be notebook-like, CLI-first,
library-first, or editor/tool-first.
- Evaluate implementation language after the data model is clearer.