Skip to content

About

No description, website, or topics provided.

Resources

Stars

176 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

Repository files navigation

Cognitive Landscape

An experimental cognitive layer for studying how experience changes a system itself, rather than what it can look up. It is not a memory retrieval system: nothing the user says is stored, and there is no index to search.

The question it tries to make testable: can a history of interaction leave persistent internal structure that changes what can happen later?

Core mechanism

Every structure holds three states:

State Role
m fast state; reacts first to local mismatch, decays with real elapsed time
theta slow structure; changes only by consolidating a fraction of m
p plasticity; gates how much of m reaches theta, and is itself changed by instability

One local update (landscape/plasticity.py) is: predict with theta + m, measure mismatch against the input, move m toward the mismatch, consolidate p * rate * m into theta, keep the rest in m, then raise p when |m| stays large and lower it when things are quiet. There is no reward, no importance score, no central judge, and no LLM deciding what matters.

What this version does (v0.2)

Two perception channels feed the same equations:

  1. Embedding channel (primary). Each turn of text is embedded locally (BAAI/bge-small-zh-v1.5 through fastembed/ONNX Runtime, no torch) and routed by cosine similarity into unnamed vector structures, where theta is a region centre, m a fast offset and p a scalar. The v0.1 scalar equations are applied unchanged to vectors via a minimal Vector type (landscape/vector.py). An input far from every region starts a new one; thresholds and the measurements behind them are documented in VectorLandscapeConfig (landscape/config.py). The model loads on a background thread, so a host never blocks on it.
  2. Keyword channel (parallel, from v0.1). Host-supplied EvidenceSignals still update the original keyed scalar structures.

Readout happens only at compile time (landscape/vector_compiler.py): the prompt is embedded, regions it would route into are selected, and each one is described with the nearest phrases from a fixed library of ~100 topic phrases and ~100 interaction-style phrases (landscape/phrases.py), three near theta, two near m, plus a tension line when the current position would no longer route back into its own centre. Phrases are never written back into structures.

Ten consecutive turns with no signal on any channel write a zero-signal warning, so silent perception failure is visible.

State lives in two files: the v0.1 keyed structures (schema unchanged) and a separate vector file holding only numbers and timestamps.

This version does not include reaction learning, behaviour prediction, or a shadow mode.

Not verified

  • Effect on LLM behaviour is unverified. Compiled context has not been shown to change what a model does; there is no evaluation of injection.
  • Vector structures mostly track topic content, not interaction style. In a 10-turn test the nearest phrases were often interaction phrases, but the margins between competing phrases were under 0.01 cosine, which is noise rather than signal.
  • theta never decays, although principle 5 in docs/CORE_V0.md requires unmaintained structure to fade.
  • No benchmark and no long-term real-user validation. Threshold calibration used 40 short sentences across 8 topics; real turns are longer and more mixed.
  • No structure merge or split: a turn that passes the best match's threshold on shared everyday wording is absorbed into that region.

Install and run

Python 3.13. The core package uses the standard library only.

python -m unittest discover -s tests   # 92 tests
python main.py                         # minimal scalar organism/world demo

The embedding channel is an optional dependency:

pip install -r requirements.txt

Without it, tests covering embedding behaviour skip themselves and the keyword channel still runs. The model (~95 MB) is downloaded on first use into ~/.cache/cognitive-landscape/models; override with COGNITIVE_LANDSCAPE_MODEL_DIR.

from landscape import LiveSession

session = LiveSession("state.json")
session.observe_text("今天下了一整天雨,哪儿也没去")
print(session.compile_text("晚上吃什么")["context"])

LiveSession is the host entry point; the Pi-agent bridge that calls it lives outside this repository.

Design principles

From docs/CORE_V0.md:

  • No memory object, no retrieval index, no user profile.
  • No global importance score, reward, or central judge of what matters.
  • Raw user text is never stored; state files contain only derived numbers.
  • Perception does not interpret: no labels, no personality or preference categories, no LLM judging the input. Interpretation exists only at readout, for one rendering.
  • Structures are unnamed. High-level categories may be observed, never declared in advance.

License

MIT, see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

176 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages