probbit persona: the individuality layer (CLI, MCP, Python, wasm) - #9
Merged
Merged
Conversation
A persona file (YAML subset or JSON: traits with priors, moods with inertia, couplings, per-turn inputs, history features, habits as hard rules) + an individual's state + a turn's inputs compile to ONE probbit-ir program, run in process by probbit run's own instruction at fixed work. The stance (levels with exact odds, habits in force and bound, refusals, a why, a stance line of at most 40 estimated tokens) and the next state are canonical JSON. - probbit persona init|turn|replay|explain|diff|lint|check|compile| describe (probbit-cli/src/persona.rs); a strict YAML-subset reader (yaml.rs); a strict validator (one persona error object, exit 2) - one canonical number rule for every digest (docs/persona.md 5.2); SHA-256 in process, no dependency - MCP tools probbit_persona_init and probbit_persona_turn (stateless) - Python probbit.persona_init, persona_turn, persona_replay - probbit-wasm ops 4 and 5; the playground's "Meet three individuals from one persona" - docs/persona.md, a README section, docs/agents.md rows, CHANGELOG - examples/persona: three fictional personas (YAML and JSON) and their goldens, equal to an independent reference implementation's documents byte for byte (its program texts carry the pre-rename IR key) - tests: goldens byte for byte, the YAML subset's cases, 1,000-turn replays, habit properties over 2,160 random-persona turns, lint, the evaluate bridge, refusals, 600 malformed documents, Python 3.9, MCP answers == CLI answers, wasm documents == CLI documents python/test_mcp.py: the tool-list assertions now expect the two persona tools after the five existing ones.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
probbit personagives an agent an individual temperament that lives outside the model. A persona file (YAML subset or JSON:traits with priors, moods with inertia, couplings, per-turn inputs, history features, habits as hard rules) + an individual's
state + a turn's inputs compile to ONE probbit-ir program, answered in process by
probbit run's own instruction at fixed work.The stance (a level per trait with exact odds, the habits in force and the ones that changed it, a refusal when the engine cannot
vouch, a why, a stance line of at most 40 estimated tokens) and the next state are canonical JSON. Format:
docs/persona.md.What is in it:
probbit persona init | turn | replay | explain | diff | lint | check | compile | describe(probbit-cli/src/persona.rs),a strict YAML-subset reader (
yaml.rs), a strict validator (one{"error": {"code": "persona", ...}}object, exit 2), onecanonical number rule for every digest (docs/persona.md §5.2), SHA-256 in process. No dependency added.
probbit_persona_init,probbit_persona_turninprobbit mcp(stateless; the CLI's documents).probbit.persona_init,persona_turn,persona_replay.docs/persona.md, a README section "The individuality layer", rows in docs/agents.md, CHANGELOG.examples/persona/: three fictional personas (YAML + JSON, one digest each) and their goldens.Parity: the goldens equal an independent reference implementation's documents byte for byte (state0, all 20 workday stances,
the final state, lint), except that each
engine.programdigest is of a program whose IR key isprobbit_ir(the reference ranthe 0.4.0 engine, key
pbit_ir; the program texts are otherwise byte-identical on every turn). A further 5,400 random-input turns(3 personas x 3 seeds x as written /
values: semantic/ forced onto the sampler; held, yielded, refused and fallback turns)are equal too.
Tests (all new,
probbit-cli/tests/persona.rsandprobbit-wasm/tests/persona.rs):stdout_matches_the_persona_goldens(bothfile forms, init / compile / 20 x turn / replay / lint), the YAML subset's accepted and refused cases, 1,000-turn replays
byte-identical across processes and against
turn --state, habit properties over 2,160 turns of 12 random personas (every habitin force re-checked, 481 bound habits broken by the habit-free twin, positional == semantic), lint (clean examples, planted
contradictions statically, at load and at run time), the
evaluatebridge at judge weight 0 == the run path (625 trait answers),refusals (no unvouched trait in the line), 600 malformed documents (never a crash, one error object), Python 3.9
(
python/test_persona.py), MCP answers == CLI answers (python/test_mcp.py), wasm documents == CLI documents. The CI wasm job'scheck.mjsalso replays the three personas in the real browser module against the goldens.Changed in existing files:
probbit mcplists seven tools (the two persona tools after the five;python/test_mcp.py's twotool-list assertions updated);
sys.rsgainsloadavg(); usage and help listprobbit persona. No other command's behaviour oroutput changes; the 0.5.0 golden digests are untouched.
Checks (final sha
20c8529ad613):test: cli 65, persona 10, evaluate 8, stress 11 + 1 ignored,acceptance 19, ir 47, core 4, wasm no_threads 3 + persona 1), the wasm job (
check.mjs: each persona's 20 workday stances in thereal module equal the goldens) and the four release targets.
cargo test --release --workspace159 existing + 1 ignored + 11 new; the two wall-clock tests ofprobbit-decide/tests/acceptance.rsmiss their 10 ms local limit only at 1-minute load 33-46 (they pass on CI).test_persona.py5,test_mcp.py8,test_probbit.pyunchanged and passing.bytes (+461,552); wasm module 839,523 -> 1,169,601 bytes (+330,078).