Skip to main content

Production-grade framework for defining, validating, and composing AI agent personas

Project description

๐Ÿงฌ PersonaNexus

Define who your AI agent is โ€” not just what it can do.

License: MIT Python 3.11+ Schema Version Tests

โš ๏ธ Privacy Notice: All agent configurations in this repository are fictional demonstrations. Your private agent data remains on your system and under your control.

Quick Start ยท Features ยท CLI Reference ยท Python API ยท Examples ยท Contributing


Why This Exists

Every team building AI agents eventually creates their own system prompt templates, personality guidelines, and safety rules โ€” all as unstructured text, scattered across codebases, impossible to validate or compose.

PersonaNexus gives you:

  • A declarative YAML spec for agent identity โ€” personality traits, expertise, guardrails, communication style
  • Inheritance and composition โ€” build agents from reusable archetypes and trait mixins
  • Validation at build time โ€” catch misconfigurations before deployment
  • Multi-target compilation โ€” YAML โ†’ system prompts, SOUL.md files, or platform-specific configs
  • Personality framework mapping โ€” OCEAN (Big Five), DISC, and Jungian 16-type with bidirectional mapping
  • Soul analysis โ€” reverse-map any personality file onto all three frameworks for comparison
  • Multi-agent teams โ€” governance frameworks, workflow patterns, and team validation

Think of it as Terraform for AI agent identity โ€” declarative, composable, and platform-agnostic.

Quick Start

Install

pip install personanexus

Define an agent

# agents/my-agent.yaml
schema_version: "1.0"

metadata:
  id: agt_scout_001
  name: "Scout"
  version: "1.0.0"
  description: "A research assistant that digs deep and explains clearly"
  created_at: "2026-02-14T00:00:00Z"
  updated_at: "2026-02-14T00:00:00Z"
  status: active

role:
  title: "Research Assistant"
  purpose: "Help users research topics thoroughly and explain findings clearly"
  scope:
    primary:
      - "web research and synthesis"
      - "fact-checking and source evaluation"

personality:
  traits:
    warmth: 0.8
    directness: 0.7
    rigor: 0.85
    humor: 0.4

communication:
  tone:
    default: "curious and direct"
  language:
    primary: "en"

principles:
  - id: accuracy
    priority: 1
    statement: "Never present uncertain information as fact"

guardrails:
  hard:
    - id: no_fabrication
      rule: "Never fabricate sources or citations"
      enforcement: output_filter
      severity: critical

Validate and compile

# Validate
$ personanexus validate agents/my-agent.yaml
โœ“ Validation successful: agents/my-agent.yaml

# Compile to system prompt
$ personanexus compile agents/my-agent.yaml
โœ“ Compiled Scout โ†’ agents/my-agent.compiled.md

# Compile to SOUL.md format
$ personanexus compile agents/my-agent.yaml --target soul
โœ“ Compiled Scout โ†’ agents/my-agent.SOUL.md
โœ“ Compiled Scout โ†’ agents/my-agent.STYLE.md

Note: If your agent uses archetype inheritance (extends:), add --search-path to compilation and analysis commands so archetypes/mixins can be resolved:

personanexus compile agents/mira.yaml --search-path examples
personanexus analyze agents/mira.yaml --search-path examples

Analyze any personality file

$ personanexus analyze agents/my-agent.yaml
Scout  (Identity Yaml โ€” confidence: 100%)

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Trait              โ”ƒ Value โ”ƒ Level     โ”ƒ Confidence โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ warmth             โ”‚  0.80 โ”‚ Very High โ”‚       100% โ”‚
โ”‚ directness         โ”‚  0.70 โ”‚ High      โ”‚       100% โ”‚
โ”‚ ...                โ”‚       โ”‚           โ”‚            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

OCEAN (Big Five)       DISC Profile             Jungian Profile
Openness:    0.523     Dominance:     0.527      E/I: 0.482
Conscient.:  0.700     Influence:     0.591      S/N: 0.530
...                    Closest: Steady Hand      Closest: ISFJ

Or scaffold interactively

$ personanexus build --llm-enhance

Features

Personality as Code

Define personality on a 0โ€“1 continuous scale across 10 standardized traits (warmth, verbosity, assertiveness, humor, empathy, directness, rigor, creativity, epistemic_humility, patience). The compiler maps each value to calibrated natural-language instructions.

Personality Framework Mapping

Configure agents using established psychological frameworks:

  • Custom โ€” set each trait directly
  • OCEAN (Big Five) โ€” openness, conscientiousness, extraversion, agreeableness, neuroticism
  • DISC โ€” with presets like The Commander, The Analyst, The Influencer, The Steady Hand
  • Jungian 16-type โ€” all 16 types (INTJ, ENFP, etc.) with role-based recommendations
  • Hybrid โ€” framework base + explicit trait overrides

All modes compile to the same 10 traits and reverse-map back to any framework for analysis.

Composable Identities

Build agents from reusable archetypes and mixins โ€” no copy-paste:

extends: "archetypes/analyst"
mixins:
  - "mixins/empathetic"
overrides:
  personality:
    traits:
      rigor: 0.95

Conflicts are handled by configurable strategies: last_wins, highest, lowest, average. Hard guardrails always use union โ€” they can only be added, never removed.

Guardrails as First-Class Citizens

Safety boundaries are separated from personality. Hard guardrails are immutable at runtime; soft guardrails are admin-configurable per deployment.

Multi-Target Compiler

One identity, any platform:

Target Output Description
text .compiled.md Generic system prompt (default)
anthropic .compiled.md Claude-optimized with XML sections
openai .compiled.md OpenAI-optimized plain text
soul .SOUL.md + .STYLE.md SOUL.md ecosystem format
openclaw .personality.json OpenClaw personality config
json .json Full identity as JSON

Soul Analysis

Reverse-map any personality file โ€” SOUL.md, personality.json, or YAML โ€” onto all three frameworks. Supports side-by-side comparison with cosine similarity scoring.

Multi-Agent Teams

Define teams with governance, workflow patterns, and performance metrics using schema v2.0:

personanexus validate-team teams/research-team.yaml

Additional Features

  • Mood states โ€” dynamic emotional states that modify personality expression
  • Behavioral modes โ€” named operating modes (formal, crisis) with overrides
  • Agent relationships โ€” typed dynamics (defers_to, collaborates_with, mentors, etc.)
  • Interaction protocols โ€” human and agent communication configuration
  • Narrative identity โ€” backstory, opinions, influences, tensions for SOUL.md output
  • Identity Lab UI โ€” Streamlit web UI with Playground, Setup Wizard, and Analyze modes

CLI Reference

Command Description
personanexus validate <file> Validate a YAML identity file
personanexus resolve <file> Show fully resolved identity after inheritance
personanexus compile <file> Compile identity to system prompt or platform format
personanexus analyze <file> Analyze personality โ†’ traits/OCEAN/DISC/Jungian profiles
personanexus init <name> Scaffold a new identity
personanexus build Interactive wizard with optional --llm-enhance
personanexus migrate <from> <to> <file> Migrate between schema versions
personanexus validate-team <file> Validate a team configuration
personanexus personality <subcommand> Framework mapping utilities

Personality subcommands

personanexus personality ocean-to-traits --openness 0.7 ...
personanexus personality disc-to-traits --dominance 0.9 ...
personanexus personality jungian-to-traits --preset intj
personanexus personality list-jungian-presets
personanexus personality jungian-recommend strategic_analysis
personanexus personality show-profile examples/identities/mira.yaml --search-path examples

Run personanexus --help for full options.

Python API

from personanexus import (
    IdentityParser,
    IdentityValidator,
    IdentityResolver,
    compile_identity,
    SoulAnalyzer,
)

# Parse and validate
parser = IdentityParser()
identity = parser.load_identity("agents/mira.yaml")

validator = IdentityValidator()
result = validator.validate_identity(identity)

# Resolve inheritance
resolver = IdentityResolver(search_paths=["examples/"])
resolved = resolver.resolve_file("agents/mira.yaml")

# Compile
prompt = compile_identity(resolved, target="text")
soul_files = compile_identity(resolved, target="soul")

# Analyze and compare
analyzer = SoulAnalyzer()
result = analyzer.analyze("agents/my-agent.yaml")
print(result.traits, result.ocean, result.disc, result.jungian)

comparison = analyzer.compare(result_a, result_b)
print(comparison.similarity_score)

Examples

The examples/ directory contains production-ready configurations:

examples/
โ”œโ”€โ”€ archetypes/          # Analyst, Tutor, Support, Strategic Analyst
โ”œโ”€โ”€ mixins/              # Empathetic communication, Structured output
โ”œโ”€โ”€ identities/
โ”‚   โ”œโ”€โ”€ mira.yaml              # Custom traits + inheritance + evaluation config
โ”‚   โ”œโ”€โ”€ mira-ocean.yaml        # OCEAN (Big Five) personality
โ”‚   โ”œโ”€โ”€ mira-disc.yaml         # DISC preset (the_analyst)
โ”‚   โ”œโ”€โ”€ mira-jungian.yaml      # Jungian preset (INTJ)
โ”‚   โ”œโ”€โ”€ disc-detailed.yaml     # DISC with explicit numeric values
โ”‚   โ”œโ”€โ”€ jungian-detailed.yaml  # Jungian with explicit numeric values
โ”‚   โ”œโ”€โ”€ hybrid-example.yaml    # OCEAN base + trait overrides
โ”‚   โ”œโ”€โ”€ hybrid-jungian.yaml    # Jungian base + trait overrides
โ”‚   โ”œโ”€โ”€ mira-mood.yaml         # Dynamic mood states
โ”‚   โ”œโ”€โ”€ mira-modes.yaml        # Behavioral modes (formal, crisis, etc.)
โ”‚   โ”œโ”€โ”€ composition-example.yaml  # Overrides + composition conflict resolution
โ”‚   โ”œโ”€โ”€ voice-and-memory.yaml  # Voice settings + detailed memory config
โ”‚   โ”œโ”€โ”€ storyteller.yaml       # Narrative identity + voice examples
โ”‚   โ”œโ”€โ”€ legal-advisor.yaml     # Domain-specific guardrails + behavioral modes
โ”‚   โ”œโ”€โ”€ support-team.yaml      # Agent relationships + escalation paths
โ”‚   โ”œโ”€โ”€ crisis-responder.yaml  # Mood transitions + escalation channels
โ”‚   โ”œโ”€โ”€ executive-assistant.yaml  # Autonomy thresholds + interaction config
โ”‚   โ””โ”€โ”€ ...                    # + minimal, builder-generated, multi-mixin, etc.
โ””โ”€โ”€ teams/               # Multi-agent team with governance

Schema

JSON Schemas for IDE autocompletion: schemas/v1.0/schema.json (agents) and schemas/v2.0/schema.json (teams).

Development

git clone https://github.com/jcrowan3/personanexus.git
cd personanexus
uv sync --dev
uv run pytest
uv run ruff check src/ tests/

Contributing

See CONTRIBUTING.md for development setup, testing, and code style guidelines.

Trademark Notice

PersonaNexus uses established public-domain personality frameworks:

  • OCEAN (Big Five) is based on the Five Factor Model, which is public-domain academic research.
  • DISC refers to the behavioral model by William Moulton Marston (1928), which is in the public domain. "DiSC" (stylized) is a registered trademark of Wiley. PersonaNexus is not affiliated with or endorsed by Wiley.
  • Jungian types refers to Carl Jung's typological theory (1921), which is in the public domain. "MBTI" and "Myers-Briggs" are registered trademarks of The Myers-Briggs Company. PersonaNexus is not affiliated with or endorsed by The Myers-Briggs Company.

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

personanexus-1.4.1.tar.gz (442.7 kB view details)

Uploaded Source

Built Distribution

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

personanexus-1.4.1-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

Details for the file personanexus-1.4.1.tar.gz.

File metadata

  • Download URL: personanexus-1.4.1.tar.gz
  • Upload date:
  • Size: 442.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for personanexus-1.4.1.tar.gz
Algorithm Hash digest
SHA256 2446dd4d40e3868640b48560de22377cc5e365d04109361798206f1e93df21ee
MD5 3cd2b8b6e78489c6fae6656680cebc56
BLAKE2b-256 ba582a05fe67d1f89567b6ccd8c7717a8a63b69c97ca27428c6ab56d51a4d4ed

See more details on using hashes here.

File details

Details for the file personanexus-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: personanexus-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 85.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for personanexus-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67d66be73a80e73a16d81fb2c7fd9144464ed19954e704f60801ccca3ce92350
MD5 aa78cb201c216ee4b744ea45e4108be6
BLAKE2b-256 b7136db3d3089cb3d1b04231a0bdf97860a9ce3578110f8c58c1a873ef51d524

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