Skip to content

Tubifix77/skitarii-cortex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corpus-Skitarii Cortex Emulator

Version 1.0 · Warhammer 40,000 fan-fiction rendered as executable code.

A Skitarius is a human surgically converted into a cybernetic soldier of the Adeptus Mechanicus. Most of the brain has been torn out and replaced with machinery. This project emulates that hybrid brain as a pipeline of ten "regions" — and the central conceit is that how much organic tissue a region retained decides what kind of program it is:

  • Organic tissue is associative, fluid, weight-based → it becomes an LLM call.
  • Cybernetic implants are deterministic, rigid, parsed → they become plain Python.

The goal is fidelity to a fictional being, not helpfulness. The Skitarius does not chat; it receives a directive, drags it across the surviving cortex, and answers with a flat binaric status burst.


Table of contents


What it does

You give the unit a verbal directive ("Secure that ridge at 200 meters"). Ten regions fire in a fixed order. Eight are deterministic cybernetic implants (plain Python); two are surviving organic remnants that actually call a small local LLM. Along the way the body floods with synthetic combat-stimulant while the analytic mind stays clinically cold — a separation called the Bastion of Calm that is enforced by how data is routed, not by asking the model to stay calm. The chain ends in a Vox-Skit-Code emission: a parsed, machine status burst.

If there is no directive and no signal, the unit doesn't idle politely — it drops into a hard-coded standby behaviour (the command vacuum).


Requirements

  • Python 3.10+ — standard library only. Nothing to pip install for the core.
  • Tkinter — bundled with python.org and most Python builds; needed only for the GUI.
  • Ollama with the gemma4:e2b model — needed only for the two organic LLM nodes. The tests, the command-vacuum mode, and the entire deterministic skeleton run with no Ollama, no GPU, and no network.

The model name gemma4:e2b is intentional — the e is part of the name.

To set up the model for the live path:

ollama serve            # in one terminal
ollama pull gemma4:e2b  # once

Quick start

The fastest way to see it run, no Ollama required:

# A pure-Python standby behaviour, start to finish:
python run_demo.py --vacuum

# Or open the GUI and click "COMMAND VACUUM":
python cogitator_hud.py

# Or run the full deterministic test transcript:
python tests/test_corpus_fake.py

To run a live directive (this is the only path that needs Ollama):

python run_demo.py "Secure that high ground ridge at 200 meters. Watch for flanking fire."

The three ways to run it

1. Cogitator HUD (graphical)

python cogitator_hud.py

A dark, three-pane Noospheric readout. Full guide below.

2. run_demo.py (command line)

python run_demo.py "<directive>" [options]
Argument / option Meaning
"<directive>" The verbal command. Omit it (or use --vacuum) for a command vacuum.
--feed '<json>' Noospheric telemetry as a JSON object, e.g. '{"cohort":"nominal","arty":"ready"}'.
--vacuum Run with no directive and no carrier (the standby behaviour).
--disconnect <seconds> Seconds since the link dropped. Affects the vacuum state only.
--threat A hostile is in proximity. Affects the vacuum state only.
--trace Print the full JSON cogitator trace (every region's provenance + output) at the end.

Examples:

python run_demo.py "Advance and breach the steel door" --feed '{"cohort":"nominal"}' --trace
python run_demo.py --vacuum --threat
python run_demo.py --vacuum --disconnect 600

3. The test suite (no Ollama)

python tests/test_corpus_fake.py                                   # printed transcript
pytest tests/test_corpus_fake.py                                   # all tests
pytest tests/test_corpus_fake.py::test_bastion_of_calm_partition   # one test

The Cogitator HUD — full guide

python cogitator_hud.py

The window opens in STANDBY. The pipeline runs in a background thread, so the window never freezes; events stream into the panes as each region fires.

The control bar

Across the top, in order:

Control What it is What to put in it
DIRECTIVE The verbal order given to the unit. Free text, e.g. Secure the ridge at 200 meters, watch for flanking fire. Press Enter here to transmit.
NOOSPHERE FEED Cohort battlefield telemetry piped in over the wireless data-link. A JSON object, or leave blank. See below.
DISCONNECT (s) Seconds since the Noospheric link was lost. A number. Default 0. Only matters in a command vacuum.
LOCAL THREAT Checkbox: a hostile has entered proximity. Tick it. Only matters in a command vacuum.

How the Noosphere Feed works

The Noospheric Transceiver is the unit's wireless link to its cohort. Whatever you put in this box is treated as incoming battlefield telemetry and is folded into the analytic context the thinking regions read — so the surviving cortex can reason with it.

It must be a JSON object (key/value pairs in curly braces). Examples that work:

{"cohort":"nominal","arty":"ready"}
{"contacts":3,"wind":"NE 12kph","ammo":"82%"}
  • Leave it blank → the transceiver reports NO CARRIER: the data-link is severed, the HUD overlay is blank. A directive still runs fine; the unit just has no cohort data to work with.
  • Plain text (e.g. hello) → rejected. The status label shows "FEED: invalid JSON" and nothing runs. Wrap strings in a key: {"note":"hello"}.
  • A bare number or list (e.g. 1 or [1,2]) → rejected with "FEED: must be a JSON object". Telemetry is always labelled fields, never a loose value.

The feed flows on the analytic channel, so the organic remnants can see it. The combat-stim surge does not — that is the Bastion of Calm (see below).

The Local Threat checkbox

This represents a hostile entering the unit's immediate proximity. It is consumed only by the command-vacuum behaviour — when there are no orders and no signal, ticking this drives the unit into a THREAT-REFLEX state (it neutralises the intruder with cold precision, then reverts to stasis).

Important: during a normal directive run the checkbox does nothing. The threat level that drives the adrenal surge there comes from threat words in the directive text itself ("fire", "enemy", "flank", "breach", "sniper"…), parsed by the Binary Translation Matrix — not from this box. So to make a directive run "hot," put danger words in the directive; the checkbox is for the vacuum scenario.

The Disconnect field

Seconds since the Noospheric carrier was lost. Like the threat box, it matters only in a command vacuum: once it reaches the link-loss timeout (300 s by default, PING_TIMEOUT_S in config.py) the unit abandons stasis and begins a PING-SEARCH — a methodical grid-walk to re-establish a handshake.

The two buttons

  • ▶ TRANSMIT DIRECTIVE — runs the full tactical chain on the directive you typed. Requires a non-empty directive (the button quietly does nothing if it's blank). This is the path that calls Ollama for the two organic nodes — ollama serve must be running with gemma4:e2b pulled, or you'll get an error in the live pane.
  • COMMAND VACUUM — ignores the directive and the feed entirely and runs the standby behaviour. Pure Python — no Ollama needed. The DISCONNECT and LOCAL THREAT controls select which vacuum state you get.

The three panes and the metrics strip

  • PIPELINE STATUS (left) — all ten regions. Each dot is grey until the region fires, then lights green (organic) / amber (cybernetic) / cyan (system) while active, and turns success-green when it completes. A ⚠ COMMAND VACUUM banner appears here in vacuum mode.
  • LIVE COGITATION (centre) — the active region's output as it streams. Organic thought is green, cybernetic implant lines are amber, an engaged override is red.
  • HANDOVER LOG (right) — each completed region's final emission, stacked.
  • VOX-SKIT-CODE EMISSION (bottom, red) — the final machine status burst.
  • Metrics strip — live readouts:
    • A_COMBAT — the adrenal combat gain (0–1).
    • MOTOR — actuator readiness %.
    • Ψ_TOTAL — sensory-cognitive integration capacity (≈199 on the stock chassis).
    • OVERRIDECLEAR, or red ENGAGED when the Cognitive Override Bypass Matrix has suppressed the prefrontal output.

How a directive flows through the cortex

The pipeline is a fixed linear relay:

noosphere → temporal_in → limbic → endocrine → left_hemisphere
          → right_hemisphere → prefrontal_cortex → cerebellum → brainstem → vox
# Region (key) Organic Kind Channel Role
1 Noospheric Transceiver (noosphere) — implant cybernetic analytic Folds the cohort feed in, or reports NO CARRIER.
2 Binary Translation Matrix (temporal_in) 15% cybernetic analytic Strips tone/sarcasm; parses cold params + a threat estimate.
3 Limbic Inhibitor (limbic) 0% cybernetic none Returns NULL affect — the inverse of an amygdala.
4 Endocrine Flush (endocrine) — subsystem system motor Computes A_combat; floods the motor track only.
5 Left Cerebral Hemisphere (left_hemisphere) 60% organic (LLM) analytic Spatial geometry, ballistic vectors, the path.
6 Right Cerebral Hemisphere (right_hemisphere) 5% cybernetic analytic Literal orientation; no metaphor or nuance.
7 Prefrontal Cortex (prefrontal_cortex) 10% organic (LLM) analytic Tactical-viability logic, then clamped by the Override Matrix.
8 Cerebellum (cerebellum) 80% cybernetic motor Motor readiness, balance, actuator priming.
9 Brainstem (brainstem) 95% cybernetic none Autonomic life-support / biomonitors.
10 Vox-Skit-Code Encryptor (vox) — output cybernetic none Flat binaric status burst — the inverse of a conversational Broca.

Two ideas are doing the heavy lifting:

  1. The Bastion of Calm is structural. The adrenal surge (endocrine, cerebellum) travels on the motor channel; the organic LLM nodes read only the analytic channel. The thinking mind therefore cannot see the combat-stim flood — the calm is enforced by routing, not by a prompt.

  2. The Cognitive Override Bypass Matrix is a deliberately crude keyword gate. It scans the 10% prefrontal output for any hint of refusal, fear, morality, preference, or selfhood; if it finds one, it discards the organic verdict and stamps AUTO-APPROVED. The tissue may balk — the implant overrules it. It is meant to be blunt, not wise.

The high-organic Cerebellum (80%) and Brainstem (95%) are still cybernetic nodes: organic mass picks the metaphor, but their function is motor/autonomic, not associative language, so an LLM wouldn't help.


Command vacuum: no orders, no signal

If there is no directive and no carrier, the chain short-circuits before any tactical cognition and reports the unit's standby behaviour:

State Trigger Behaviour
THREAT-REFLEX Local threat in proximity Neutralises the intruder coldly, then reverts to stasis.
PING-SEARCH Disconnect ≥ 300 s Geometric grid-walk to re-establish the Noospheric handshake.
PATHOLOGICAL-STASIS Default Perfect gyroscopic stillness for hours — no fidget, no fatigue.
AUTONOMIC-MAINTENANCE Biomonitor threshold tripped Mechanically ingests ration/water, returns to the exact pose. (Model state; not reachable from the current UI, which keeps homeostasis nominal.)

It emits an idle STB vox burst instead of the tactical one.


The two equations

Both are lifted from the in-universe source report and computed as real state, not flavour text (see skitarii/soma.py, constants in skitarii/config.py):

  • Adrenal Combat GainA_combat = σ(β·[C_adrenal] − μ·Φ_calm), where [C_adrenal] = C_ADRENAL_BASE + threat · C_ADRENAL_THREAT_SCALE. Drives heart rate, respiration, and motor readiness.
  • Integration CapacityΨ_total = ψ_org + Σ(Φ_aug,n · γ_sync,n). ψ_org scales with the mean retained organic mass across the brain regions; the sum runs over every node's augmentation throughput. On the stock chassis this lands ≈ 199.

Units are illustrative — this is the report's model, not a physiological claim.


Project layout

skitarii-cortex/
├── cogitator_hud.py          # Tkinter GUI (consumes the PipelineEvent stream)
├── run_demo.py               # CLI entry point
├── skitarii/
│   ├── __init__.py           # package exports + __version__
│   ├── config.py             # model, temperatures, equation constants, HUD palette
│   ├── ollama_client.py      # stdlib streaming client for Ollama
│   ├── soma.py               # autonomic/endocrine state + the two equations
│   ├── nodes.py              # CorpusNode + SKITARII_PIPELINE (the spine you edit)
│   ├── processors.py         # the cybernetic implants + override matrix + vacuum FSM
│   ├── pipeline.py           # CorpusPipeline, CortexContext, PipelineEvent, routing
│   └── trace.py              # CognitiveTrace with per-stage provenance
├── tests/
│   └── test_corpus_fake.py   # no-network smoke test of the whole skeleton
├── CLAUDE.md                 # design doc + load-bearing invariants (read before editing)
└── README.md                 # this file

To reshape the cortex, edit SKITARII_PIPELINE in skitarii/nodes.py. A node declares its kind, channel, organic_pct, phi_aug, gamma_sync, and either a system prompt (organic) or a processor key (cybernetic). Cybernetic processors are fn(ctx) -> (handover, data) registered in processors.PROCESSORS.


Testing

python tests/test_corpus_fake.py                                   # printed transcript
pytest tests/test_corpus_fake.py                                   # all tests
pytest tests/test_corpus_fake.py::test_bastion_of_calm_partition   # one test

A FakeClient stands in for Ollama, so the entire deterministic skeleton — every implant, the analytic/motor partition, the override matrix, and the command-vacuum branch — is exercised with no GPU, no daemon, and no display.


Project status

Version 1.0 — feature complete. The cortex pipeline, both organic LLM remnants, all eight cybernetic implants, the two equations, the command-vacuum state machine, the CLI, the Cogitator HUD, and the no-network test suite are all in place and passing.

Possible future directions (not required for v1): generalising the code-node seam back into the sibling brain-emulation project, and an orchestrated Thalamus-style router with the Noosphere as the hub.


Disclaimer

This is non-commercial fan-fiction. Warhammer 40,000, Adeptus Mechanicus, Skitarii, and related names are property of Games Workshop. This project is an unofficial creative/technical exercise with no affiliation or endorsement.

About

An experimental, from-scratch Warhammer 40k Skitarii cyborg-brain emulator in Python. Each brain region's organic mass decides its processor: organic remnants run as LLM calls, excised regions as deterministic implants. The deliberately faithful, near-unreadable first take that the brain-emulation fork replaced.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages