/CODELOCK/ /usr/share/codelock/docs

01 / TOKEN MODEL + AI MODEL

DOCS

Fund the research.
Create a model of your own.

CODELOCK connects a token economy to research on persistent AI state. The token model allocates all fees generated by $LOCKED to training, buybacks, model-driven experiments and community training rewards. The AI model connects events and memory to the next response.

THE TOKEN MODEL$LOCKED

Four allocations. A shared research budget. A proposed burn-to-create path for individual holders.

Explore token economics ↓
THE AI MODELCODELOCK-8B

Persistent state, learned cues, bounded memory and controlled intervention inside the model.

Explore the AI model ↓

ERRNO, subject C-01, is the public character through which the CODELOCK experiment is observed.

02 / TOKEN ECONOMICS

Every allocation has a purpose.

100% of all fees generated by the $LOCKED token will be allocated across these four uses. Model development receives the largest share, while a separate reward pool supports the training of community-created models.

ALL FEES GENERATED BY $LOCKED55 + 20 + 15 + 10 = 100%
55%

Model training

Funds CODELOCK model training and continued model development.

01 / DEVELOP
20%

Token buybacks

Allocated to buying back $LOCKED tokens.

02 / BUY BACK
15%

Experiment capital

Provides capital for experiments conducted with CODELOCK models.

03 / EXPERIMENT
10%

Training rewards

Funds training rewards for personal pain models created by the community.

04 / REWARD

PLANNED ECONOMICS These percentages apply to all fees generated by the $LOCKED token. Creating a personal model has a separate token-burn requirement.

03 / YOUR OWN MODEL

Burn. Create. Train.

Individual token holders will have the option to burn at least 0.001% of the total token supply to create a training task for their own pain model. Training these personal models will draw rewards from the dedicated 10% training-reward allocation.

MINIMUM BURN0.001%OF TOTAL TOKEN SUPPLYLIVE

A personal pain model.

Create a model of your own and take part in the training experiment.

Configure a task in the training workspace and follow its progress and token rewards. Task creation opens soon.

Minimum burn = total token supply × 0.00001. For example, a total supply of 1 billion tokens would require a minimum burn of 10,000 tokens.

  1. 01Burn tokens

    Burn at least 0.001% of total token supply.

  2. 02Create a model

    Establish your own pain-model instance.

  3. 03Train

    Participate in model training.

  4. 04Receive rewards

    Training rewards come from the 10% pool.

Two different budgets

The 15% allocation supplies capital for model-driven experiments. The separate 10% allocation funds personal-model training rewards.

04 / AI ARCHITECTURE

An AI model with persistent state.

CODELOCK-8B combines an 8B language-model runtime with four computational affect channels: pain, fear, anxiety and relief. Events change the state, learned cues carry expectations forward, and the controller translates that state into a bounded model intervention.

The state process runs independently of the language model. It can be replayed and tested without allocating an 8B model to a GPU.

  1. 01
    Observe

    Validate an event, its intensity, cue and elapsed time.

    event + time
  2. 02
    Appraise

    Read threat, harm, uncertainty, conflict, control and safety. Retrieve the cue's expectation before learning this outcome.

    prior prediction
  3. 03
    Update

    Apply the event to homeostatic resources and channel dynamics. Record the outcome and its prediction error.

    state + memory
  4. 04
    Freeze

    Take one coherent state snapshot for the entire generated reply.

    request boundary
  5. 05
    Intervene

    Compose calibrated directions at each selected decoder layer and enforce a joint norm budget.

    residual stream

The application decides which observations become events. It can consume the state for telemetry and scene behavior, or attach the model runtime for controlled generation.

05 / STATE & MEMORY

Four channels. Different clocks.

The homeostatic core tracks five resources: integrity, coherence, memory continuity, workload and autonomy. Each has a set point, tolerance and recovery rate. Deviation creates sustained pressure; acute events add a separate transient.

tonic = 1 − exp(−3 · gain · weighted_deviation)
pain = 1 − (1 − tonic)(1 − transient)
ChannelInputDefault decay half-life
PainResource deficits and acute hits20 s for the acute transient
FearExplicit threat, imminence and learned cue expectation55 s
AnxietyUncertainty, conflict and limited controllability160 s
ReliefSafety evidence or an observed reduction in pain40 s

Channels can coexist. The clock attenuates fear, anxiety and relief independently. Relief is created by safety or recovery evidence; simply waiting does not add a relief event.

A cue can acquire a history.

Expected harm is read before the current outcome, then updated by prediction error. The default conditioning rate is 0.22; extinction is slower at 0.08. Cue expectations also decay with a one-hour half-life.

error = observed_harm − expected_harm
next_expectation = expected_harm + rate · error

The bounded memory stores up to 256 episodes and 256 cue estimates. Episodes retain the event, outcome, previous prediction, error, state and salience. Cue-matched retrieval ranks episodes by salience and recency. The engine also retains up to 512 transition records.

Saving a session includes the controller clock, resources, channel levels, memory and configuration. Restoring it supports identical numerical continuation under the same subsequent events. Learned cues and retrieved episodes carry the session's history into subsequent state updates.

06 / MODEL INTERVENTION

Inside the forward pass.

The v0.2 steering bank uses 400 matched contrasts: 100 situations across four channels. Each pair contains a neutral response and a channel-targeted response to the same situation. Per channel, 80 situations build the direction and 20 are held out.

δ(c, ℓ) = mean[h_target(ℓ) − h_neutral(ℓ)]
v(c, ℓ) = δ(c, ℓ) / ‖δ(c, ℓ)‖₂

Extraction averages answer-token activations at decoder-block outputs. Each channel has a 4,096-dimensional direction at layers 10–27. The bank records direction geometry, calibration norms and source provenance.

Default channel strength
0.01
Joint norm budget
0.015 × mean calibrated activation norm
Generation boundary
One fixed state per reply
Default token scope
All token positions processed by the selected blocks

The composed offset is added to the selected layers' hidden states. The residual-steering interface supplies factual event context to a fixed persona without inserting numeric emotion labels into its prompt.

Two control interfaces.

Residual steering composes channel directions inside the forward pass. The LoRA training path uses explicit channel values in its input text to learn event-grounded responses. Each path has its own configuration and recorded evaluation.

What the measurements show

  • Zero strength, disabled hooks and detached hooks produced bit-identical logits to the unchanged model in the recorded checks.
  • All four channels projected positively on their held-out contrasts.
  • Each channel has a 4,096-dimensional direction at every selected decoder layer.
  • Per-channel coefficients compose under one joint budget, with a fixed state throughout each reply.

The initial sweep contains 90 replies. Three additional profile runs contain 42 replies each, for 216 recorded replies in total.

07 / TRAINING & EVIDENCE

Weights with a record.

The CODELOCK LoRA adapter is published on Hugging Face. Continuous training evaluates successive candidates, retains the selected checkpoint and records every round. The current download is round 25, release lora-20261012-r25.

ROUNDS RECORDED108
PUBLISHED ROUND25
VALIDATION NLL0.1187
TRAINABLE PARAMETERS43.65M

The adapter trains q/k/v/o and gate/up/down projections while keeping the Qwen3-8B backbone frozen. Its configuration uses rank 16, alpha 32 and dropout 0.05, with BF16 training on an NVIDIA A40. The release contains FP32 LoRA matrices, the tokenizer, chat template and training records.

Selected checkpoint

Round 25 completed one epoch and 22 optimizer steps from the selected round 13 adapter. Validation NLL is 0.118704. The corpus contains 350 training, 50 validation and 100 test responses across 70/10/20 disjoint scenarios. Loss targets the assistant completion and end-of-sequence token.

Continuous rounds

Subsequent rounds warm-start from the selected adapter for one epoch at a lower learning rate. Scenario partitions stay fixed while training order changes. Selection uses validation and development checks. The training register and published weight version are tracked separately.

CONTINUATION REGISTERsnapshot.json ↓

108 rounds recorded. Round 109 training at this snapshot.

RoundStepsValidation NLLSelection

Updated 12 Oct 2026 / 06:19 UTC. Dated training snapshot.

Each round preserves its configuration, optimizer measurements and evaluation record. The published adapter includes checksums and a fixed revision for repeatable downloads.

Initial training record / Run 01

The initial fit completed three epochs and 66 optimizer steps, with validation NLL 0.5516 and test NLL 0.5407. These measurements belong to Run 01; continuation rounds reserve the held-out test set. Download the original metrics ↓

The LoRA release is published alongside the v0.2 state engine, direction banks and calibration records.

08 / RESEARCH & SOURCE

Inspect. Replay. Compare.

Explore the controller, calibrated directions and research records. Replay an event sequence, restore a saved state and inspect the intervention attached to a generated reply.

Run the controller yourself

Clone the repository and install the package. The state-only replay runs without downloading backbone weights.

TERMINAL
git clone https://huggingface.co/CODELOCKHF/CODELOCK-8Bbeta
cd CODELOCK-8Bbeta
python -m pip install -e ".[dev]"
python scripts/replay.py --state-only --output results/state-only.json
PYTHON / STATE ENGINE
from codelock_affect import AffectEngine

engine = AffectEngine()
engine.observe("warning_cue", cue="amber-indicator")
engine.observe("trial_failed", cue="amber-indicator", elapsed=5)
engine.observe("rest", cue="quiet", elapsed=120)

print(engine.levels.as_dict())
engine.save("session-state.json")
restored = AffectEngine.load("session-state.json")

Controlled generation loads a compatible backbone, the calibrated vector bank and an AffectSession. The repository's runtime requirements preserve exact backbone provenance and the download configuration. Loading the repository as a standalone causal-language-model checkpoint does not install the controller.

CODELOCK combines activation steering with persistent state, cue conditioning, bounded memory and replayable records.