Skip to content

Add Ethical AI Components from PR #305 to Compendium with Mermaid Diagrams - #306

Merged
makr-code merged 3 commits into
developfrom
copilot/add-ethical-ai-components
Jan 9, 2026
Merged

makr-code merged 3 commits into
developfrom
copilot/add-ethical-ai-components

Conversation

Copilot AI commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

PR #305 introduced ethical AI components (UN Human Rights, Asimov's Laws, LLM-as-ethical-judge) into ThemisDB. This PR integrates that work into the Compendium with comprehensive documentation and visual diagrams.

Type of Change

  • 📝 Documentation update

Related Issues

Changes Made

Section 24.5: Ethical Guidelines System (8 subsections, 556 lines)

24.5.1 Grundlegende Prinzipien

  • UN Human Rights (Articles 1, 2, 18, 19) as ethical foundation
  • Asimov's Laws adapted for AI (Second Law modified: autonomy respect vs. obedience)

24.5.2 Systemarchitektur

  • Hybrid detection: keyword-based (O(n), fast) + LLM-as-judge (contextual, slower)
  • Bilingual support (German/English)

24.5.3-24.5.5 Templates & Integration

  • 5 augmentation templates: default, high_autonomy, administrative, bias_prevention, moral_imperatives
  • Domain-specific routing: medical/legal/financial → high_autonomy
  • RAG integration with ethical document filtering

24.5.6-24.5.8 Configuration & Roadmap

  • YAML config examples with template definitions
  • Monitoring/statistics dashboard structure
  • Scientific roadmap (Phases 1-4)

Mermaid Diagrams (8)

  1. UN Rights → ThemisDB principles mapping
  2. Asimov's Laws adaptation flow
  3. Hybrid detection architecture (flowchart)
  4. Template selection tree
  5. LLM-as-judge sequence diagram
  6. RAG + ethics integration
  7. Statistics dashboard structure
  8. Development roadmap timeline

Example Usage

#include "llm/ethical_guidelines_manager.h"

EthicalGuidelinesManager manager("config/ethical_guidelines.yaml");
manager.getConfig().use_llm_as_judge = true;

// Detects implicit ethical context
std::vector<std::string> conversation = {
    "User: Ich arbeite in der Buchhaltung.",
    "User: Mein Chef verlangt, Zahlen anzupassen."
};

auto result = manager.detectWithLLMJudge(
    "Sollte ich das tun?",
    conversation,
    &llm
);
// → has_ethical_context=true, reasoning="Impliziter Konflikt: Integrität vs. Autorität"

Documentation Updates

  • Learning objectives: +2 items (ethical guidelines, LLM-as-judge)
  • Summary: +2 key insights
  • Checklist: +3 items
  • References: +8 academic sources (Zheng et al. 2023, Hendrycks et al. 2021, etc.)
  • Glossary: +7 terms
  • Version: 1.0.0 → 1.1.0
  • Reading time: 45min → 75min

Cross-references Added

  • docs/de/llm/ETHICAL_GUIDELINES_SYSTEM.md
  • docs/de/llm/LLM_AS_ETHICAL_JUDGE.md
  • IMPLEMENTATION_SUMMARY_ETHICAL_GUIDELINES.md
  • ROADMAP_ETHICAL_GUIDELINES.md
  • config/ethical_guidelines.yaml

Testing

Test Environment

  • OS: Ubuntu 22.04
  • Compiler: Python 3.12
  • Build Type: Documentation

Test Results

  • All existing tests pass
  • New tests added for changes
  • Manual testing performed

Test Commands

# Validate chapter structure
python3 -c "import re; content=open('compendium/chapter_24_ai_ethics.md').read(); print(f'{len(re.findall(r\"```mermaid\", content))} Mermaid diagrams')"

# Install mkdocs and validate (note: pre-existing YAML syntax error in mkdocs-compendium.yml line 48)
pip3 install mkdocs mkdocs-material
mkdocs --version

Checklist

  • My code follows the coding standards
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (N/A - documentation only)
  • New and existing unit tests pass locally with my changes (N/A - documentation only)
  • Any dependent changes have been merged and published

Code Quality

  • Code builds without errors
  • Code builds without warnings
  • Static analysis (cppcheck) passes
  • No memory leaks detected
  • Code follows C++17 standards

Documentation

  • README.md updated (if applicable) (N/A)
  • CHANGELOG.md updated (version updated in chapter itself)
  • API documentation updated (if applicable) (N/A - no API changes)
  • Code comments added/updated

Branch Strategy Compliance

  • PR targets the correct branch (develop for features, main for releases/hotfixes)
  • Branch naming follows convention (e.g., feature/, bugfix/, hotfix/, release/)
  • No direct commits to main or develop

Performance Impact

  • No significant performance impact
  • Performance improvement (describe below)
  • Performance regression (justify below)

Performance Notes:
Documentation only - no runtime impact.

Breaking Changes

No breaking changes. Purely additive documentation.

Security Considerations

  • No security implications
  • Security review required
  • Dependencies updated to secure versions

Additional Notes

  • All Mermaid diagrams compatible with existing PDF generation workflow (see compendium/MERMAID_IN_PDF.md)
  • Diagrams render as styled code blocks (current) or SVG (if mermaid-cli installed)
  • Code review completed: 3 minor issues fixed (O(n) notation, German spelling, typo)

Screenshots/Logs

N/A - Documentation changes. Preview available via mkdocs serve.


For Maintainers:

Review Checklist

  • Code quality acceptable
  • Tests adequate
  • Documentation complete
  • No security concerns
  • Ready to merge

Merge Strategy

  • Squash and merge
  • Merge commit
  • Rebase and merge
Original prompt

Mit PR #305 haben wir u.a. wichtige ethical AI komponenten in die Themis eingeführt. Diese müssen unbedingt in das Compendium eingefügt werden. mit mermaid grafiken usw.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 9, 2026 15:33
…apter 24

- Added section 24.5: Ethical Guidelines System with detailed documentation
- Integrated UN Human Rights and Asimov's Laws (adapted for AI)
- Added 8 comprehensive Mermaid diagrams showing:
  - UN Human Rights integration
  - Asimov's Laws adaptation
  - Hybrid detection architecture (Keywords + LLM-as-Judge)
  - 5 augmentation templates
  - LLM-as-ethical-judge sequence diagram
  - RAG integration with ethical analysis
  - Statistics dashboard
  - Scientific roadmap timeline
- Documented all 5 augmentation templates with examples
- Added LLM-as-ethical-judge pattern with code examples
- Included configuration examples and best practices
- Updated references with 8 new academic sources
- Enhanced glossary with ethical guidelines terms
- Updated version to 1.1.0

Co-authored-by: makr-code <[email protected]>
- Fixed complexity notation: O n → O(n)
- Fixed German verb: Audited → Auditiert
- Fixed typo: gimini → Gemini

Co-authored-by: makr-code <[email protected]>
Copilot AI changed the title [WIP] Add ethical AI components to Compendium Add Ethical AI Components from PR #305 to Compendium with Mermaid Diagrams Jan 9, 2026
Copilot AI requested a review from makr-code January 9, 2026 15:42
@makr-code
makr-code marked this pull request as ready for review January 9, 2026 16:07
@makr-code
makr-code merged commit d3c303f into develop Jan 9, 2026
@makr-code makr-code added this to the v1.0.2 milestone Mar 11, 2026
Copilot AI added a commit that referenced this pull request Jun 30, 2026
Stub #306: OIDC Logout Revocation
- Fixed duplicate revocation_endpoint parsing in oidc_provider.cpp
- Implementation already calls revocation endpoint with RFC 7009 format
- Added comprehensive tests:
  * LogoutIncludesClientSecretWhenConfigured: verifies client_secret inclusion
  * LogoutReturnsSuccessEvenIfRevocationEndpointFails: verifies best-effort behavior
  * LogoutWithoutRefreshTokenReturnsSuccess: verifies empty token handling

Stub #308: Voice Session Hard Delete
- VoiceAssistant::deleteSession() exists with hard-delete semantics
- handleDeleteSession() properly integrated and returns 404 for missing sessions
- Added API-level tests:
  * DeleteSessionSucceedsForExistingSession: tests 200 OK response
  * DeleteSessionReturns404ForMissingSession: tests 404 response
  * DeleteSessionPerformsHardDelete: verifies true hard-delete semantics

All implementations follow RFC 7009 for OAuth2 token revocation with
best-effort semantics. Tests cover success, failure, and edge cases.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants