Skip to main content

Body emotion mapper: structured emotion analysis (AnalysisInput) JSON to body-axis states and prompt tags

Project description

🫀 Body Emotion Sensor

Give your AI agent a persistent emotional system based on the TCM Five Zang and Five Elements model.

License: MIT Python 3.10+ GitHub stars

Quick Start · Features · How It Works · 简体中文

Why Body Emotion Sensor? 💖

Do you ever feel that AI agents lack a true sense of "self"? They might simulate emotions in text, but they don't have a persistent internal state that carries over between conversations.

Body Emotion Sensor is here to change that:

  • Persistent State: Give your AI a long-term emotional and physical constitution (baseline) that evolves naturally.
  • TCM Five Zang Model: Built on the traditional Chinese medicine concepts of the Five Elements (Metal, Wood, Water, Fire, Earth) to map complex emotional states.
  • Turn-by-Turn Updates: Converts structured emotional analysis into real-time body state updates, affecting how the agent responds.

Quick Start 🚀

📥 Install:

pip install body-emotion-sensor

The visualization panel is included in the default install. After installation, you can use the CLI:

bes help
body-emotion-sensor help

🔄 Recommended Flow:

  1. Print the constitution initialization prompt: bes prompt init
  2. Initialize state: bes init-state --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --init-json /path/to/init.json
  3. Check readiness: bes check-init --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
  4. Bootstrap a new session: bes bootstrap --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
  5. Run turn updates: bes run --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --input /path/to/analysis-input.json

Features 🧩

  • State Persistence: Stores long-term body-emotion state per workspace and agent identity.
  • Session Bootstrap: Generates TURN_CHANGE_TAGS, BODY_TAG, and BASELINE_PERSONA before a new session starts.
  • Compact Prompt Payload: Provides a lightweight payload for reply shaping without overwhelming the context window.
  • Traceable History: Keeps state/history data for debugging and visualization.
  • Visualization Panel: Run bes panel to view the agent's emotional journey visually.

How It Works ✨

body-emotion-sensor distinguishes between two core concepts:

  • baseline: The agent's native constitution and long-term personality color.
  • current: The body state after the latest turn, influenced by recent interactions.

It converts one turn of structured emotional analysis JSON into persistent body-axis state updates and a compact prompt payload for the reply layer.

Development 🛠️

For local development:

pip install -e .
bes help

Visualization panel:

bes panel --workspace /path/to/workspace --agent-id my-agent

Repository-only docs remain in the source repo, for example:

  • docs/五脏情绪映射全表.md
  • docs/五脏情绪七阶状态表.md
  • prompts/example-openclaw-agents.md
  • prompts/example-openclaw-tools.md

License 📄

This project is released under the MIT license in the repository LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

body_emotion_sensor-0.1.1.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

body_emotion_sensor-0.1.1-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file body_emotion_sensor-0.1.1.tar.gz.

File metadata

  • Download URL: body_emotion_sensor-0.1.1.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for body_emotion_sensor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a09a368c1a80f0edea4053ac77d6becd2623e9559976a96f49a837c0d144fe29
MD5 829da2963d39785c4f3d4d71ff006536
BLAKE2b-256 f6d36c6bbf6ee915ad9823c4ebaa1b91e13c45546e9d768b865d9862d79d9006

See more details on using hashes here.

File details

Details for the file body_emotion_sensor-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for body_emotion_sensor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f71ca1326d92f8f8b64deb3c4938a34a26846395b6e958f3809c35e71772218a
MD5 415fccf3744203abd416cc11b6999b48
BLAKE2b-256 019d5d192b1eaaf191b984f67f50f30f2161152e5a997c6dff9755cee0363277

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page