Skip to content

feat(scak): port production Self-Correcting Agent Kernel from internal#65

Merged
imran-siddique merged 1 commit intomainfrom
feat/port-scak-production
Mar 7, 2026
Merged

feat(scak): port production Self-Correcting Agent Kernel from internal#65
imran-siddique merged 1 commit intomainfrom
feat/port-scak-production

Conversation

@imran-siddique
Copy link
Member

Summary

Ports the production-grade SCAK (Self-Correcting Agent Kernel) from the internal agent-governance repository to the public OSS toolkit. This is the largest module upgrade so far, adding the Dual-Loop Architecture (Runtime + Offline loops) with 6 entirely new modules.

New Modules (6)

Module Lines Purpose
\completeness_auditor.py\ 227 Teacher model integration for soft failure detection
\patcher.py\ 574 Patch composition engine with classified patch application
\semantic_analyzer.py\ 307 NLP-based refusal detection beyond regex
\semantic_purge.py\ 337 Patch lifecycle management with decay classification (SYNTAX vs BUSINESS)
\
udge_mechanism.py\ 253 Post-give-up nudge injection to encourage retry
\ eacher.py\ 76 Cognitive glitch diagnosis using o1-preview

Upgraded Modules (7)

Module Delta Key Additions
\kernel.py\ +441L Dual-loop architecture (Runtime Loop 1 + Offline Loop 2), async queue
\�nalyzer.py\ +350L CognitiveGlitch diagnosis with evidence-based patterns
\outcome_analyzer.py\ +218L Semantic analysis + tool telemetry correlation
\ riage.py\ +108L Smart routing to sync (JIT) or async (batch) paths
\detector.py\ +75L Enhanced FailureQueue with custom handler registration
\memory_manager.py\ +38L Model version tracking and upgrade purge
_init_.py\ +18L Re-exports for all new modules

Tests

  • Added \ est_dual_loop.py\ (463L) for dual-loop architecture coverage
  • All 119 tests pass locally

Architecture: Dual-Loop Self-Correction

Loop 1 (Runtime): Immediate failure handling — detect, classify, patch, retry
Loop 2 (Offline): Quality improvement — semantic purge, completeness audits, model upgrades

This replaces the simple retry + exponential backoff with smart triage that routes failures to sync (JIT) or async (batch) processing based on criticality, tool context, and cognitive failure patterns.

Closes #57

…l repo

New files (6 modules):
- completeness_auditor.py (227L): Teacher model integration for soft failure detection
- patcher.py (574L): Patch composition engine with classified patch application
- semantic_analyzer.py (307L): NLP-based refusal detection beyond regex
- semantic_purge.py (337L): Patch lifecycle management with decay classification
- nudge_mechanism.py (253L): Post-give-up nudge injection to encourage retry
- teacher.py (76L): Cognitive glitch diagnosis using o1-preview

Upgraded files (7):
- kernel.py (+441L): Dual-loop architecture (Runtime Loop 1 + Offline Loop 2)
- analyzer.py (+350L): CognitiveGlitch diagnosis with evidence-based patterns
- outcome_analyzer.py (+218L): Semantic analysis + tool telemetry correlation
- triage.py (+108L): Smart routing to sync (JIT) or async (batch) paths
- detector.py (+75L): Enhanced FailureQueue with custom handler registration
- memory_manager.py (+38L): Model version tracking and upgrade purge
- __init__.py (+18L): Re-exports for all new modules

Tests:
- Added test_dual_loop.py (463L) for dual-loop architecture coverage
- All 119 tests pass

Closes #57

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added the tests label Mar 7, 2026
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@imran-siddique imran-siddique merged commit 3aed2ca into main Mar 7, 2026
22 checks passed
@imran-siddique imran-siddique deleted the feat/port-scak-production branch March 7, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Port production SCAK (Self-Correcting Agent Kernel) from internal

1 participant