TheFlow
|
9ca462db39
|
fix: CrossReferenceValidator 100% - prohibition & preference detection
Fixed 2 failing CrossReferenceValidator tests by improving InstructionPersistenceClassifier:
1. **Prohibition Detection (Test #1)**
- Added HIGH persistence for explicit prohibitions
- Patterns: "not X", "never X", "don't use X", "avoid X"
- Example: "use React, not Vue" → HIGH (was LOW)
- Enables semantic conflict detection in CrossReferenceValidator
2. **Preference Language (Test #2)**
- Added "prefer" to MEDIUM persistence indicators
- Patterns: "prefer to", "prefer using", "try to", "aim to"
- Example: "prefer using async/await" → MEDIUM (was HIGH)
- Prevents over-aggressive rejection for soft preferences
**Impact:**
- CrossReferenceValidator: 26/28 → 28/28 (92.9% → 100%)
- Overall coverage: 168/192 → 170/192 (87.5% → 88.5%)
- +2 tests, +1.0% coverage
**Changes:**
- src/services/InstructionPersistenceClassifier.service.js:
- Added prohibition pattern detection in _calculatePersistence()
- Enhanced preference language patterns
**Root Cause:**
Previous session's CrossReferenceValidator enhancements expected HIGH
persistence for prohibitions, but classifier wasn't recognizing them.
**Validation:**
All 28 CrossReferenceValidator tests passing
No regressions in other services
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-07 10:03:56 +13:00 |
|
TheFlow
|
216a4ad36f
|
feat: ACTIVATE Tractatus Governance Framework 🤖
STATUS: Tractatus governance is now ACTIVE for all future sessions
Framework Components (ACTIVE):
✅ ContextPressureMonitor (60.9%) - Session quality management
✅ InstructionPersistenceClassifier (85.3%) - Track explicit instructions
✅ CrossReferenceValidator (96.4%) - Prevent 27027 failures
✅ BoundaryEnforcer (100%) - Values/agency protection
⚠️ MetacognitiveVerifier (56.1%) - Selective use only
Configuration:
- Verbosity: SUMMARY (Level 2)
- Pressure checkpoints: 25%, 50%, 75% token usage
- Auto-handoff: CRITICAL pressure (85%+)
- Instruction storage: .claude/instruction-history.json
Files Created:
1. CLAUDE.md - Active Governance Section
- Framework component status table
- Session workflow examples
- Claude's obligations (MUST/MUST NOT/SHOULD)
- User's rights (CAN/SHOULD)
- Comprehensive governance protocol
2. .claude/instruction-history.json
- 7 initial instructions loaded
- Project infrastructure (MongoDB port 27017, app port 9000)
- Strategic directives (project isolation, quality standards)
- Governance activation (inst_007: USE TRACTATUS GOVERNANCE)
3. .claude/tractatus-config.json
- Component activation settings
- Verbosity configuration
- Thresholds (pressure, persistence, verification)
- Behavior rules for each pressure level
- Storage paths and maintenance settings
4. docs/session-handoff-2025-10-07-tractatus-activation.md
- Complete session summary
- Test coverage improvements (73.4% → 77.6%)
- Framework activation details
- Next session priorities
- "Before/After" governance examples
What Changes in Next Session:
BEFORE: Claude makes changes without systematic verification
AFTER: Claude checks against instruction history, enforces boundaries,
monitors session pressure, and requires human approval for
values decisions
Example (27027 Prevention):
You: "Change MongoDB to port 27018"
[CrossReferenceValidator]
❌ REJECTED - Conflicts with inst_001 (HIGH persistence)
Original: "MongoDB runs on port 27017" (2025-10-06)
Cannot proceed without overriding explicit instruction.
Framework Now Self-Hosting:
The Tractatus framework now governs its own development. Multi-factor
pressure analysis, instruction persistence, and boundary enforcement
are operational for all future work.
Next Session Will Start With:
- Pressure baseline check
- Instruction database loaded (7 instructions)
- All components operational
- Request for test instruction to verify framework
🤖 Generated with Claude Code
🎯 Tractatus Framework: ACTIVE
|
2025-10-07 09:22:05 +13:00 |
|
TheFlow
|
0ffb08b2c8
|
docs: add comprehensive session handoff for 2025-10-07 Part 2
Session achievements:
- Overall test coverage: 41.1% → 57.3% (+16.2%, +31 tests)
- CrossReferenceValidator: 31.0% → 96.4% (27027 prevention operational)
- InstructionPersistenceClassifier: 44.1% → 58.8%
- BoundaryEnforcer: 34.9% → 46.5%
- ContextPressureMonitor: 21.7% → 43.5%
- MetacognitiveVerifier: 48.8% → 56.1%
6 commits implementing critical fixes and enhancements across all
governance services. Mission-critical 27027 failure prevention now
fully functional.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-07 08:44:13 +13:00 |
|
TheFlow
|
da7eee39fb
|
fix: resolve CrossReferenceValidator conflict detection and enhance parameter extraction
CrossReferenceValidator improvements (31% → 96.4% pass rate):
1. Context Format Handling
- Support both context.messages (production) and context.recent_instructions (testing)
- Fix relevance calculation to handle actions without descriptions
- Add null safety to _semanticSimilarity()
2. Multiple Conflicts Detection
- Change _checkConflict() to return array of ALL conflicts
- Detect all parameter mismatches in single instruction (port, host, database)
InstructionPersistenceClassifier parameter extraction enhancements:
3. Smart Protocol Extraction
- Context-aware scoring: positive keywords (always, prefer) vs negative (never, not)
- "never use HTTP, always use HTTPS" → protocol: "https" (correct)
4. Confirmation Flag Handling
- Double-negative support: "never X without confirmation" → confirmed: true
- Handles: with/without confirmation, require/skip confirmation
5. Additional Parameters
- Frameworks: React, Vue, Angular, Svelte, Ember, Backbone
- Module types: ESM, CommonJS
- Patterns: callback, promise, async/await
- Host/collection/package names
6. Regex Fixes
- Add word boundaries to port, database, collection patterns
- Prevent false matches like "MongoDB on" → database: "on"
Test Results:
- CrossReferenceValidator: 27/28 passing (96.4%)
- Overall: 87/192 (45.3%, +8 tests from 79/192)
- Core 27027 failure prevention now working
Remaining: 1 test expects REJECTED for MEDIUM persistence instruction, gets WARNING (correct behavior)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-07 01:46:04 +13:00 |
|
TheFlow
|
47818bade1
|
feat: add governance document and core utilities
Core Values (TRA-VAL-0001):
- Adapt STR-VAL-0001 for Tractatus AI Safety Framework
- Define 6 core values: Sovereignty, Transparency, Harmlessness,
Human Judgment Primacy, Community, Biodiversity
- Establish AI governance principles and decision framework
- Document Te Tiriti commitment as strategic baseline
- Create values alignment metrics and review process
Database Utilities:
- MongoDB connection with retry logic and health checks
- Singleton pattern for connection management
- Comprehensive error handling and reconnection
Logger Utility:
- Winston-based logging (console + file)
- Request logging middleware
- Error log separation
- Configurable log levels
JWT Utility:
- Token generation and verification
- Secure admin authentication
- Header extraction methods
Markdown Utility:
- Markdown to HTML conversion with syntax highlighting
- XSS protection via sanitization
- Table of contents extraction
- Front matter parsing
- Slug generation
Status: Core infrastructure utilities complete
|
2025-10-06 23:34:40 +13:00 |
|