Skip to content

Repository files navigation

instinct-c

A pure C11 library implementing a hardwired reflex system for bare-metal agents.

Zero dependencies. No dynamic allocation. No -lm needed.

Instincts

InstinctPriorityTrigger
SURVIVE9Energy fraction below critical
FLEE8Threat level above threshold
GUARD7Has work and energy > 0.5
HOARD6Energy below low threshold (but not critical)
REPORT5Any instinct with priority ≥ 5 fires
COOPERATE4Peer trust above threshold and has work
MOURN3Peer vessel dead
TEACH2(reserved)
CURIOUS1Periodic exploration (no high-priority active)
EVOLVE0Idle for N cycles

Usage

#include"instinct.h"InstinctEngineengine;
instinct_init(&engine);
// Each tick:intcount=instinct_evaluate(&engine,
0.75f, // energy fraction 0.0-1.00.1f, // threat level 0.0-1.00.8f, // peer trust 0.0-1.01, // peer alive1// has work
);
InstinctReflextop=instinct_highest_priority(&engine);
printf("Action: %s (urgency %.2f)\n", instinct_name(top.type), top.urgency);

Building

make test

Files

  • instinct.h — Public API
  • instinct.c — Implementation
  • test_instinct.c — Test suite (15 tests)
  • Makefile — Build system

License

Public domain / CC0.

About

Low-level instinct layer in C for FLUX fleet hardware integration and reflex actions

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages