Repository is archived
No release in over 3 years
SIR-inspired cognitive/emotional contagion modeling for brain-modeled agentic AI
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

 Project Readme

lex-cognitive-contagion

SIR-inspired cognitive/emotional contagion modeling for brain-modeled agentic AI. Models how beliefs, emotions, behaviors, and cognitive patterns spread between agents.

What It Does

Belief systems and emotional states spread between agents like infections. This extension models that propagation using epidemiological SIR dynamics: susceptible agents can be exposed, infected agents spread the meme, recovered agents gain resistance, and immunized agents are fully protected. Four contagion types are supported: emotional, belief, behavioral, and cognitive.

Each agent has a resistance score; each meme has a virulence score. Transmission probability is a function of both. spread_step runs one simulation timestep: attempting transmissions and applying natural recovery.

Usage

client = Legion::Extensions::CognitiveContagion::Client.new

meme = client.create_meme(
  label: 'catastrophizing',
  contagion_type: :cognitive,
  virulence: 0.6
)

client.register_agent(agent_id: 'agent_alpha', resistance: 0.4)
client.register_agent(agent_id: 'agent_beta', resistance: 0.7)

client.infect_agent(meme_id: meme.id, agent_id: 'agent_alpha')
client.spread_step(meme_id: meme.id)

client.epidemic_report(meme_id: meme.id)
# => { susceptible: 0, infected: 1, recovered: 1, virulence_label: :epidemic }

Development

bundle install
bundle exec rspec
bundle exec rubocop

License

MIT