Skip to content

Claude/multi agent orchestrator sojag#3055

Open
AlexanderSmil wants to merge 8 commits intovinta:masterfrom
AlexanderSmil:claude/multi-agent-orchestrator-SOJAG
Open

Claude/multi agent orchestrator sojag#3055
AlexanderSmil wants to merge 8 commits intovinta:masterfrom
AlexanderSmil:claude/multi-agent-orchestrator-SOJAG

Conversation

@AlexanderSmil
Copy link
Copy Markdown

Project

Project Name

Checklist

  • One project per PR
  • PR title format: Add project-name
  • Entry format: - [project-name](url) - Description ending with period.
  • Description is concise and short

Why This Project Is Awesome

Which criterion does it meet? (pick one)

  • Industry Standard - The go-to tool for a specific use case
  • Rising Star - 5000+ stars in < 2 years, significant adoption
  • Hidden Gem - Exceptional quality, solves niche problems elegantly

Explain:

How It Differs

If similar entries exist, what makes this one unique?

claude and others added 8 commits April 5, 2026 11:33
Includes process boundaries (Розділ 0) with integration map for ПЗ.9.10,
ПУ.2.10, Prozorro, Мегаполіс, АСКОД, and full RACI matrix (15 steps × 5 roles).

https://claude.ai/code/session_01C85MmENY41FpGmV9ZprDnV
…endations-9hMj4

docs: add normalized regulation ПЗ.9.4 for TMC nomenclature management
Full multi-school psychological self-exploration platform combining the
Leela board game with a five-school analytical engine (Jungian, Freudian,
CBT, Gestalt, Transactional Analysis).

Components delivered:
- core/security.py: HMAC-SHA256 pseudonymisation + AES-GCM (Fernet) encryption
- core/kms_lite.py: KMS abstraction stub (AWS KMS / Vault ready)
- storage/vector_storage.py: encrypted JSONL store; _SAFE_FIELDS whitelist
  enforces privacy-by-design (session_id NEVER persisted in plain form)
- storage/faiss_adapter.py: FAISS kNN index with graceful degradation
- ai/embedding_client.py: async embed client with disk cache
- ai/synthesizer.py: ConflictSynthesizer — dialectical polarity detection
- agents/qa/*: five psychological analyzers (async, pluggable)
- agents/feedback/user_feedback_agent.py: rating 1-5 validation + storage
- agents/learning/self_learning_agent.py: feedback aggregation + metrics
- models/unified_insight.py: dataclasses for the full insight graph
- game/leela_psychological.py: main facade — asyncio.gather over all layers
- exporters/clinical_exporter.py: Markdown / JSON / PDF clinical reports
- web/feedback_api.py: Flask Blueprint + create_app factory
- web/templates/feedback.html: Ukrainian-language feedback form
- tests/test_anonymization.py: 13 privacy / cryptography unit tests
- tests/test_integration.py: 9 end-to-end integration tests
- docs/clinical_guide.md: clinical usage guide for therapists and clients
- requirements.txt, Dockerfile, docker-compose.yml, .env.example
- scripts/init_secrets.sh, scripts/build_release.py
- .github/workflows/ci.yml: matrix test + lint + pip-audit pipeline

Test results: 22/22 passed (pytest 9.0.3, Python 3.11)

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
Compressed archive of the complete Leela Quest+Psychology AI v1.1.0
project (45 source files, 74 entries, 30 KB) — excludes __pycache__,
runtime data directories, and secrets per .gitignore rules.

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
…alidation

Addresses all Medium/High gaps from the Staff Engineer Architectural Audit:

1. tests/test_web_api.py (NEW — 14 tests)
   - POST /api/feedback: valid, missing fields, rating bounds (0,6,1,5),
     oversized comment, malformed JSON, empty body
   - GET /api/feedback/stats: empty queue + after submissions
   - GET /api/feedback/<id>: unknown id + per-insight filtering
   Fixture pattern: isolated VectorStorage per test, cleared _feedback_queue

2. web/feedback_api.py
   - Add MAX_COMMENT_LENGTH = 2000 guard (400 if exceeded)
   - Treat get_json() returning None as invalid JSON (400, not silent empty)

3. .github/workflows/ci.yml
   - Remove "|| true" from pip-audit — build now fails on real CVEs
   - Replace with documented allowlist comment (empty by default)

Test results: 36/36 passed (22 existing + 14 new)

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
…metrics

Closes all remaining architectural audit recommendations.

1. ai/embedding_synthesizer.py (NEW — v2.0 audit item vinta#6)
   - Dynamic polarity detection via cosine similarity between concept embeddings
   - Replaces static POLARITY_MAP with semantic distance (threshold 0.55)
   - Intensity labels: profound/strong/noticeable/subtle based on distance
   - Concept embedding cache to avoid re-embedding within a session
   - Works with any school — no manual polarity pairs needed

2. agents/devops/health_agent.py (NEW)
   - HealthAgent: synchronous self-diagnostic of security/storage/ai/synthesis
   - Thread-isolated asyncio.run() to avoid event loop conflicts
   - Returns {"status": "healthy"|"degraded", "checks": {...}, "version": "1.2.0"}
   - Implements async execute() for orchestrator compatibility

3. monitoring/metrics_collector.py (NEW)
   - Thread-safe rolling-window MetricsCollector
   - timer() context manager, record_ms(), increment() counter
   - snapshot() with avg/min/max/p95 per metric name
   - Module-level singleton: from monitoring.metrics_collector import metrics

4. game/leela_psychological.py
   - Instrument analyze_turn: records total latency, per-school call counts,
     consent_granted/consent_denied counters

5. web/feedback_api.py
   - GET /api/health — liveness/readiness probe (200 healthy, 503 degraded)
   - GET /api/metrics — performance metrics snapshot

6. tests/test_embedding_synthesizer.py (NEW — 17 tests)
   - 6 EmbeddingSynthesizer tests (polarity detection, cache, alignment)
   - 6 MetricsCollector tests (counters, timers, rolling window, p95, reset)
   - 5 HealthAgent tests (all-ok, latency, async execute, unknown action)

Test results: 53/53 passed

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
…ring, pytest.ini

1. journals/journal_manager.py (NEW)
   - JournalEntry dataclass: turn, cell_id, cell_name, move_type, schools,
     synthesis_snippet (≤200 chars), archetypes, timestamp
   - JournalManager: record(), load_session(), export_narrative(), delete_session()
   - Privacy: only synthesis snippet stored — never raw user text
   - Path traversal sanitisation on session_id → filename mapping
   - GDPR erasure via delete_session()

2. game/leela_psychological.py
   - Wire EmbeddingSynthesizer as primary (2+ layers) / ConflictSynthesizer fallback
   - Optional JournalManager param: engine = LeelaPsychologicalEngine(journal=jm)
   - Journal.record() called after each turn when journal is set

3. pytest.ini (NEW)
   - asyncio_mode = strict, testpaths = tests, pythonpath = .
   - Enables: cd leela_psychology && python -m pytest

4. tests/test_integration.py
   - test_multi_layer_uses_embedding_synthesizer: verifies v2.0 synthesis path
   - test_journal_records_turns: verifies turn counter and entry count

5. tests/test_journal_manager.py (NEW — 13 tests)
   - JSONL file creation, turn counter, load/delete, snippet truncation,
     privacy (no raw text), session isolation, narrative export,
     path traversal protection

6. leela_psychology_v1.2.0.tar.gz (replaces v1.1.0)
   - 91 entries, 43 KB — includes all v1.2.0 files

Test results: 69/69 passed

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
…docs, CSS

1. leela_psychology/__init__.py (NEW)
   - Package root with __version__ = "1.2.0" and version history

2. monitoring/__init__.py (NEW)
   - Explicit package init (was namespace package — now proper package)

3. docs/architecture.md (NEW)
   - Full system architecture: ASCII diagram, package structure,
     data flow / privacy chain, v1.x vs v2.0 synthesis comparison,
     HTTP API reference, test suite breakdown

4. web/static/leela.css (NEW)
   - Extract inline styles from feedback.html into proper CSS file
   - CSS custom properties (design tokens) for consistent theming
   - Added :focus, :active, :hover states and .health-ok/.health-degraded

5. web/templates/feedback.html
   - Replace <style> block with <link rel="stylesheet" href="/static/leela.css">

6. scripts/build_release.py
   - Add check_package_init_files(): 15 packages verified
   - Add check_v120_modules(): 6 v1.2.0 files + content markers
   - Add check_version(): __version__ == "1.2.0" assertion
   - All 5 non-test checks pass: ./scripts/build_release.py --skip-tests

7. leela_psychology_v1.2.0.tar.gz
   - Rebuilt clean (no .pytest_cache): 87 entries, 45 KB

https://claude.ai/code/session_01Nmtk7oaHGcmm56rjXeMa3Z
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