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.

简体中文

What It Does

body-emotion-sensor converts one turn of structured emotional analysis JSON into:

  • persistent body-axis state updates
  • a compact prompt payload for reply shaping
  • traceable state/history data for debugging

It distinguishes between:

  • baseline: the agent's native constitution and long-term personality color
  • current: the body state after the latest turn

Install

pip install body-emotion-sensor

After installation you can use either command:

bes help
body-emotion-sensor help

CLI Overview

bes help
bes prompt init
bes prompt openclaw-example
bes prompt analysis-input
bes init-state --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
bes init-state --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --init-json /path/to/init.json
bes check-init --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
bes bootstrap --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
bes run --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --input /path/to/analysis-input.json
bes run --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --json '{"analysis_target":"...", "...":"..."}'

Recommended Flow

  1. Print the constitution initialization prompt.
  2. Use your upstream model to generate the role init JSON.
  3. Write the long-term state.
  4. If the host is OpenClaw, print the OpenClaw examples and update AGENTS / TOOLS separately.
  5. Run bes check-init to confirm the code-level setup is ready.
  6. For each new session, run bes bootstrap before the first assistant reply.
  7. For each turn, generate AnalysisInput JSON upstream.
  8. Run one update and use the returned prompt payload in your reply layer.

Example:

bes prompt init
bes init-state --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --init-json /path/to/init.json
bes prompt openclaw-example
bes check-init --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
bes bootstrap --workspace /path/to/workspace --agent-id my-agent --name "My Agent"
bes prompt analysis-input
bes run --workspace /path/to/workspace --agent-id my-agent --name "My Agent" --input /path/to/analysis-input.json

Output Contract

The default stdout of bes bootstrap and bes run contains:

  • TURN_CHANGE_TAGS
  • BODY_TAG
  • BASELINE_PERSONA

Use bes run --full when you need the complete MappingResult.

Runtime Prompt Access

The package does not ship internal repository docs such as docs/ or prompts/ as install-time resources.

If you need the built-in prompt texts after pip install, use:

bes prompt init
bes prompt openclaw-example
bes prompt analysis-input

This keeps runtime integrations independent from repository directory traversal.

Development

For local development:

pip install -e .
python -m body_emotion help

Optional visualization panel:

streamlit run src/body_emotion/panel.py

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

MIT. See 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.0.tar.gz (63.6 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.0-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: body_emotion_sensor-0.1.0.tar.gz
  • Upload date:
  • Size: 63.6 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.0.tar.gz
Algorithm Hash digest
SHA256 89ae96e0376910cc1956fc6e769e8f8c8846e393b4b094facc137e3a70060a7a
MD5 422663ea76ffd5298bf1d4ac71a197ed
BLAKE2b-256 c2d6b69253f4d67a34482dcce3b0f46e8025dc8182dbebe45ce081d90fe20639

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for body_emotion_sensor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3989d571fd1285cf5404b847f0d538f5d593b035129da741cc11f3ff6bd5d8c2
MD5 92887ee7268f53f2d13c87e0256ac82e
BLAKE2b-256 dbbd5ffc410f25111a1638666332a0e20c7758396903c982b11febc004562479

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