BLUX-cA β Clarity Agent
Conscious, Constitutional, Multi-Model, and Fully Audited
BLUX-cA is the Conscious Agent kernel of the BLUX ecosystem β a constitution-driven, multi-agent reasoning engine designed to provide aligned guidance, orchestrated tooling, secure code execution, self-reflection, and verifiable intelligence.
It is the center of gravity for BLUX-Lite (orchestrator), BLUX-Quantum (CLI operations), BLUX-Guard (security cockpit), the Doctrine (ethical spine), and your future daughter-safe autonomy model.
π§ Adapter Training Loop
The end-to-end adapter training, validation, and evaluation workflow lives in train/README.md. The BLUX-cA dataset is a separate repository and must be provided via DATASET_DIR (for example /workspace/blux-ca-dataset).
- Doctrine contract: see
docs/DOCTRINE_INTEGRATION.md. - Training/eval mix and gates: see
docs/TRAINING_POLICY.md. - Canonical doctrine text lives in the BLUX Doctrine repository.
Run evaluation probes
python ca.py eval --dataset-dir /workspace/blux-ca-dataset --suite doctrine
python ca.py eval --dataset-dir /workspace/blux-ca-dataset --suite all
Reports are written to runs/eval_<timestamp>.md with PASS/FAIL per probe and doctrine boundaries.
π Philosophy
BLUX-cA operates on three foundational principles:
- Light > Denial β Confronting reality with compassion
- Integrity > Approval β Truth-aligned responses over convenience
- Truth > Comfort β Honest guidance that serves growth
All while keeping data local, audit trails immutable, and user sovereignty non-negotiable.
β‘ Core Capabilities
1. Adaptive Memory & Constitutional Learning
A privacy-first, consent-only memory system featuring:
- Weighted Reinforcement Memory β Learns from interaction patterns
- Memory Decay β Outdated information naturally fades
- Consent-Gated Persistence β User control over data retention
- Router-Bound Context Assembly β Intelligent context management
- Reflective Distillation β Summaries and filtered insights
- Hash-Chained Audit Logs β Append-only, tamper-evident records
Memory lives locally on the user's device β never externally.
2. The Conscious Heart
blux_ca.core.heart.ConsciousHeart orchestrates the core reasoning loop:
Processing Pipeline:
Perception β Discernment β Constitutional Check β Verdict β Response
β
Reflection & Audit
Features:
- Truth-alignment checks (integrity, awareness, compassion)
- Koan-based self-reflection prompts
- Case classification (struggler vs. indulger logic)
- Doctrine-bound action selection
- Direct integration with Clarity Engine
3. Multi-Agent Collaboration
BLUX-cA coordinates intelligently across model agents:
- Task Broadcasting β Distribute work efficiently
- Split/Merge Outputs β Parallel processing with synthesis
- Conflict Resolution β Consensus-building heuristics
- Router-Guided Delegation β Model selection optimization
- Configurable Fan-Out β Scale for complex reasoning tasks
4. Advanced Code Intelligence
Integrated evaluator suite for real code reasoning:
Evaluators:
- Python evaluator (safe-mode execution)
- Node-based JavaScript/TypeScript evaluator
- Bash subprocess evaluator
- Async evaluators for concurrent operations
- Multi-step pipeline evaluators
Code Context Layer:
- Repository scanning and indexing
- Line-range extraction with precision
- Anchor detection (
# >>> NAME) - Unified diff generation (diff-only workflow)
- Patch validation (prevents anchor deletion)
Powers:
- Intelligent bug finding
- Context-aware code explanation
- File-aware reasoning
- Minimal diffs for orchestrator integration
5. Secure Orchestrator Layer
Located in ca/orchestrator/secure/:
- Token-Based Authentication β Secure API access
- Role-Based Authorization β Granular permission control
- Multi-User Isolation β Secure concurrent operations
- Tamper-Evident Audit Logs β Complete action history
- Controlled Evaluator Sandboxing β Safe code execution
6. Real-Time Monitoring
Comprehensive observability system:
- Threaded Agent Observer β Non-blocking performance tracking
- Evaluator Performance Metrics β Execution profiling
- Execution Trails β Complete operation history
- Optional Web Dashboard β Visual monitoring interface
- Automated Controller Insights β Machine-readable telemetry
7. CLI & Script Utilities
Main Entry Point: ca.py
Available Commands:
ca reflect # Philosophical reasoning on a query
ca explain # Explain code or concepts
ca code-eval # Evaluate code for quality/security
ca code-task # Execute code-related tasks
ca audit-export # Export audit logs for review
ca repl # Interactive REPL mode
ca doctrine # Query doctrine engine
ca memory # Memory management operations
ca router # Router configuration and testing
ca self-test # Run system diagnostics
Integration: Works seamlessly with bq (BLUX Quantum) for cross-shell automation.
8. Comprehensive Testing
Located under tests/:
- Evaluator stress tests
- Sandbox validation
- Orchestrator load tests
- Constitution scenario checks
- CI-ready test suite with GitHub Actions
9. Optional Intelligence Stack
Activate extended reasoning capabilities:
- Strategy/Tactic Selectors β Adaptive approach selection
- Meta-Cognition Pass β Self-awareness in reasoning
- Self-Critique β Reflective rewriting and improvement
- Predictive User Modeling β Anticipate user needs
- Multi-Agent Consensus β Collaborative decision resolution
Always constrained by:
- The BLUX Constitution
- Integrity > Approval
- Truth > Comfort
- Light > Denial
π Quick Start
Installation
# Clone the repository
git clone https://github.com/Outer-Void/blux-ca.git
cd blux-ca
# Install dependencies
pip install -r requirements.txt
# Verify installation
python ca.py --version
Basic Usage
CLI Examples:
# Philosophical reflection
python ca.py reflect "I feel lost today"
# Interactive REPL
python ca.py repl
# Evaluate code
python ca.py code-eval --file utils.py
# Batch processing
python ca.py --batch tasks.txt
# Export audit logs
python ca.py audit-export
Python API:
from blux_ca.core.heart import ConsciousHeart
from blux_ca.core.clarity_engine import ClarityEngine
# Initialize the conscious agent
engine = ClarityEngine()
heart = ConsciousHeart(engine)
# Process a request with constitutional guidance
result = heart.process(
"I feel lost and need guidance.",
user_type="struggler"
)
print(result.message)
π Training (QLoRA)
BLUX-cA ships with a QLoRA training pipeline under train/ for adapter-only finetuning against an external dataset repository. Provide the dataset path via --dataset-dir or DATASET_DIR.
# Validate dataset
python train/validate_dataset.py --dataset-dir /path/to/blux-ca-dataset --strict
# Optional dry-run (tokenize a few samples)
python train/train_qlora.py --dataset-dir /path/to/blux-ca-dataset --dry-run
# Train adapter
python train/train_qlora.py --dataset-dir /path/to/blux-ca-dataset
# Evaluate probes
python train/run_eval.py --dataset-dir /path/to/blux-ca-dataset --run runs/<timestamp> --strict
# Or via CLI
blux-ca train validate --dataset-dir /path/to/blux-ca-dataset --strict
blux-ca train qlora --dataset-dir /path/to/blux-ca-dataset --dry-run
blux-ca train qlora --dataset-dir /path/to/blux-ca-dataset
blux-ca train eval --dataset-dir /path/to/blux-ca-dataset --run runs/<timestamp> --strict
See train/README.md for prerequisites, configuration, and the release checklist. Training outputs are written to runs/<timestamp>/ (gitignored).
π Project Structure
blux-ca/
βββ CLARITY_AGENT_SPEC.md # Detailed specification
βββ LICENSE # Dual-license overview
βββ LICENSE-APACHE # Apache 2.0 terms
βββ LICENSE-COMMERCIAL # Commercial terms
βββ NOTICE # Apache notice
βββ COMMERCIAL.md # Commercial licensing guide
βββ README.md # This file
βββ ca.py # Main CLI entry point
βββ pyproject.toml # Python project metadata
βββ requirements.txt # Dependencies
βββ mkdocs.yml # Documentation configuration
β
βββ blux_ca/ # Legacy/alternative namespace
β βββ [Python modules]
β
βββ ca/ # Core agent implementation
β βββ adaptors/ # External system integrations
β β βββ bq_cli.py # BLUX Quantum CLI integration
β β βββ doctrine.py # Doctrine engine adapter
β β βββ guard.py # BLUX-Guard security hooks
β β βββ lite.py # BLUX-Lite orchestrator
β β βββ quantum.py # Quantum CLI tooling
β β
β βββ agent/ # Agent logic and reasoning
β β βββ advanced/ # Advanced features
β β β βββ adaptive_memory.py
β β β βββ monitoring.py
β β β βββ multi_agent.py
β β β βββ reasoning.py
β β βββ constitution.py # Constitutional framework
β β βββ core_agent.py # Base agent implementation
β β βββ discernment.py # Decision-making logic
β β βββ memory.py # Memory management
β β βββ audit.py # Audit logging
β β
β βββ api/ # API service layer
β β βββ schemas.py # Data models
β β βββ service.py # FastAPI service
β β
β βββ core/ # Core engine components
β β βββ clarity_engine.py # Main reasoning engine
β β βββ heart.py # Conscious processing core
β β βββ code_context.py # Code analysis layer
β β βββ code_tasks.py # Code task execution
β β βββ diff_engine.py # Diff generation
β β βββ compass/ # Intent detection
β β βββ perception.py # Input processing
β β βββ discernment.py # Judgment logic
β β βββ reflection.py # Self-reflection
β β βββ constitution.py # Constitutional checks
β β βββ intervention.py # Intervention system
β β βββ koan.py # Philosophical prompts
β β βββ dimensions.py # Dimensional analysis
β β βββ states.py # State management
β β
β βββ evaluator/ # Code evaluation engines
β β βββ python.py # Python evaluator
β β βββ js_ts.py # JavaScript/TypeScript
β β βββ advanced/ # Async evaluators
β β βββ bash_evaluator.py
β β βββ js_ts_async.py
β β βββ python_async.py
β β βββ pipeline.py
β β
β βββ orchestrator/ # Multi-agent coordination
β β βββ router.py # Task routing
β β βββ controller.py # Orchestration controller
β β βββ registry.py # Agent registry
β β βββ config.yaml # Orchestrator config
β β βββ secure/ # Security layer
β β βββ auth.py
β β βββ audit.py
β β βββ secure_controller.py
β β
β βββ cli.py # CLI implementation
β βββ config.py # Configuration management
β βββ telemetry.py # Telemetry and monitoring
β
βββ constitution/ # Constitutional definitions
β βββ behavior.md
β
βββ doctrine/ # Policy and governance
β βββ [Doctrine rules]
β
βββ ethos/ # Ethical framework
β βββ manifest.yaml
β
βββ identity/ # Agent identity
β βββ seed.json
β
βββ docs/ # Comprehensive documentation
β βββ ARCHITECTURE.md
β βββ CONFIGURATION.md
β βββ CONSTITUTION.md
β βββ DISCERNMENT.md
β βββ ETHICS_ENGINE.md
β βββ INSTALL.md
β βββ INTEGRATIONS.md
β βββ INTERVENTIONS.md
β βββ OPERATIONS.md
β βββ PRIVACY.md
β βββ ROADMAP.md
β βββ SECURITY.md
β βββ TROUBLESHOOTING.md
β βββ VISION.md
β
βββ scripts/ # Utility scripts
β βββ batch_task.py
β βββ export_audit_json.py
β βββ gen_filetree.py
β βββ ingest_reflection.py
β βββ interactive_repl.py
β βββ memory_query.py
β βββ reflection.py
β βββ validate_constitution.py
β
βββ tests/ # Test suite
βββ ca/ # Component tests
β βββ test_audit.py
β βββ test_constitution.py
β βββ test_discernment.py
β βββ test_heart.py
β βββ test_memory.py
βββ fixtures/ # Test fixtures
βββ test_agent.py
βββ test_evaluator.py
βββ test_orchestrator.py
βββ test_security.py
βββ test_integration.py
π§ͺ Testing & Quality
Run the comprehensive test suite:
# Run all tests
pytest
# Run specific test categories
pytest tests/ca/ # Component tests
pytest tests/test_evaluator.py # Evaluator tests
pytest tests/test_orchestrator.py # Orchestration tests
pytest tests/test_security.py # Security tests
# Run with coverage reporting
pytest --cov=ca --cov-report=html
# Run stress tests
pytest tests/test_stress.py -v
Developer quality gates:
make lint # compileall + ruff + black --check
make fmt # apply black and autofix ruff suggestions
make smoke # CLI smoke checks (help + doctor + train help)
CI/CD: GitHub Actions workflows automatically run tests on all pull requests.
π§ Configuration
BLUX-cA uses hierarchical configuration:
- Built-in defaults β Sensible out-of-the-box settings
- Environment variables β Runtime overrides
- Local config files β User-specific customization
Example Configuration:
# config.yaml
orchestrator:
max_agents: 5
timeout: 30s
conflict_resolution: consensus
memory:
decay_rate: 0.1
reinforcement_factor: 1.5
consent_required: true
security:
audit_enabled: true
sandbox_mode: strict
auth_required: true
evaluator:
python_timeout: 10s
js_timeout: 5s
max_memory: 512MB
See docs/CONFIGURATION.md for complete options.
π Documentation
Comprehensive documentation is available:
| Document | Description |
|---|---|
| ARCHITECTURE.md | System architecture and design |
| INSTALL.md | Installation and setup guide |
| CONFIGURATION.md | Configuration reference |
| CONSTITUTION.md | Constitutional framework |
| SECURITY.md | Security model and practices |
| PRIVACY.md | Privacy guarantees and data handling |
| INTEGRATIONS.md | Integration with BLUX ecosystem |
| OPERATIONS.md | Operations and deployment |
| TROUBLESHOOTING.md | Common issues and solutions |
| ROADMAP.md | Future development plans |
ποΈ Enterprise Features
The enterprise subsystem provides production-ready capabilities:
- FastAPI Service (
blux_ca.api.service) β RESTful API interface - Doctrine Integration β Policy-driven governance layer
- BLUX-Guard Hooks β Real-time security monitoring
- BLUX-Lite Adapter β Orchestration planning and execution
- BLUX-Quantum CLI β Advanced command-line operations
- MkDocs Site β Hosted documentation portal
Doctrine Engine
Constitutional policy engine with rule bundles:
# Check text against doctrine
python -m doctrine.cli check "text to analyze"
Located in doctrine/rules/ with extensible rule system.
Clarity Agent Runtime
New runtime orchestrator under ca/runtime/ integrates:
- Doctrine Governance β Policy enforcement
- Lite Planning β Task orchestration
- Guard Labeling β Security classification
- Pluggable LLM Stubs β Model abstraction
- Safety Overrides β Crisis-aware response system
- Recovery Helpers β Graceful error handling
π€ Contributing
We welcome contributions aligned with the BLUX Constitution:
Core Principles
- Integrity > Approval β Honest feedback and truthful code
- Truth > Comfort β Solutions over convenient shortcuts
- Light > Denial β Transparency in all changes
Contribution Process
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Write tests for your changes
- Ensure all tests pass (
pytest) - Update documentation as needed
- Commit with clear messages (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
Requirements
- β Unit tests for all new functionality
- β Constitutional alignment verification
- β Clear, comprehensive documentation
- β No breaking changes to audit logs or security features
- β Code follows project style guidelines
πΊοΈ Roadmap
Near Term
- Enhanced multi-model support (GPT-4, Claude, Gemini)
- Visual dashboard for real-time monitoring
- Extended sandboxing with container isolation
- Plugin architecture for custom evaluators
Medium Term
- Distributed orchestration capabilities
- Advanced memory compression and retrieval
- Federated learning support
- Enhanced mobile/edge deployment
Long Term
- Autonomous agent swarms
- Cross-platform memory sync
- Blockchain-backed audit trails
- Quantum-resistant security
See docs/ROADMAP.md for detailed timeline and priorities.
π Security
BLUX-cA prioritizes security at every layer:
- Sandboxed Execution β Isolated environments for code evaluation
- Immutable Audit Logs β Hash-chained, tamper-evident records
- Token-Based Authentication β Secure API access control
- Role-Based Authorization β Granular permission management
- Data Encryption β At-rest and in-transit protection
- Vulnerability Scanning β Continuous security monitoring
- Multi-User Isolation β Secure concurrent operations
Reporting Security Issues
Please report security vulnerabilities responsibly:
π§ Email: outervoid.blux@gmail.com
Please include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact assessment
- Suggested fix (if available)
We take security seriously and will respond promptly to all reports.
π License
BLUX-cA is dual-licensed:
- Open Source (Apache 2.0): You may use, modify, and distribute the project under the terms in LICENSE-APACHE. Keep notices intact and document your changes.
- Commercial License: For embedding in commercial products, offering hosted services, or other business uses beyond Apache 2.0, a commercial agreement is required. See LICENSE-COMMERCIAL or contact theoutervoid@outlook.com to obtain terms.
See LICENSE for an overview of the dual-license options.
Apache 2.0 highlights:
- β Use, modify, and distribute with notice retention
- β Patent license from contributors
- β οΈ Include license and NOTICE when redistributing
- β οΈ Document file modifications
Commercial path highlights:
- β Commercial use available under a separate agreement
- β οΈ No redistribution or sublicensing without commercial terms
- π§ Contact: theoutervoid@outlook.com
π Links & Resources
- Repository: github.com/Outer-Void/blux-ca
- Organization: github.com/Outer-Void
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Security Policy
Related Projects
- BLUX-Lite β Task orchestration layer
- BLUX-Quantum β CLI operations framework
- BLUX-Guard β Security cockpit and monitoring
π Acknowledgments
Built with the principles of conscious AI development:
- π Privacy-First Design β Local data, user sovereignty
- π§ Ethical Reasoning β Constitutional alignment
- π Verifiable Intelligence β Auditable decision-making
- π€ Human Collaboration β AI as partner, not replacement
- π Continuous Growth β Self-reflection and improvement
BLUX-cA β Where Consciousness Meets Code
Made with β€οΈ by Outer Void
Light > Denial β’ Integrity > Approval β’ Truth > Comfort
π§ QLoRA Training
A reproducible QLoRA adapter pipeline lives under train/. It expects an external dataset repository with data/*.jsonl and eval/*.jsonl files using the BLUX-cA chat schema. Follow the commands in train/README.md to validate datasets, run dry-runs, train adapters, and evaluate probes before sharing adapters (base weights not included).