Commit graph

5 commits

Author SHA1 Message Date
TheFlow
2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00
TheFlow
f49bbe8455 refactor: remove orphaned tests for deleted website code
REMOVED: 15 test files testing non-existent code

Website Feature Tests (5):
- api.admin.test.js - Tests admin auth (auth.controller/routes removed)
- api.auth.test.js - Tests user authentication (auth.controller/routes removed)
- api.documents.test.js - Tests CMS documents (documents.controller/routes removed)
- api.koha.test.js - Tests donation system (koha.service/controller/routes removed)
- value-pluralism-integration.test.js - Website feature test

Removed Service Tests (5):
- BlogCuration.service.test.js - Service removed
- ClaudeAPI.test.js - Service removed
- koha.service.test.js - Service removed
- AdaptiveCommunicationOrchestrator.test.js - Service removed
- ProhibitedTermsScanner.test.js - Internal tool

Removed Util Tests (1):
- markdown.util.test.js - Util removed

Research/PoC Tests (4):
- tests/poc/memory-tool/* - Phase 5 proof-of-concept research

RETAINED: Framework service tests only
- BoundaryEnforcer, ContextPressureMonitor, CrossReferenceValidator
- InstructionPersistenceClassifier, MetacognitiveVerifier
- PluralisticDeliberationOrchestrator, MemoryProxy
- Integration tests for governance, projects, sync

REASON: Tests must test code that exists. Orphaned tests
provide false confidence and maintenance burden.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 21:33:16 +13:00
TheFlow
c735a4e91f feat: Phase 5 PoC Week 3 - MemoryProxy integration with Tractatus services
Complete integration of MemoryProxy service with BoundaryEnforcer and BlogCuration.
All services enhanced with persistent rule storage and audit trail logging.

**Week 3 Summary**:
- MemoryProxy integrated with 2 production services
- 100% backward compatibility (99/99 tests passing)
- Comprehensive audit trail (JSONL format)
- Migration script for .claude/ → .memory/ transition

**BoundaryEnforcer Integration**:
- Added initialize() method to load inst_016, inst_017, inst_018
- Enhanced enforce() with async audit logging
- 43/43 existing tests passing
- 5/5 new integration scenarios passing (100% accuracy)
- Non-blocking audit to .memory/audit/decisions-{date}.jsonl

**BlogCuration Integration**:
- Added initialize() method for rule loading
- Enhanced _validateContent() with audit trail
- 26/26 existing tests passing
- Validation logic unchanged (backward compatible)
- Audit logging for all content validation decisions

**Migration Script**:
- Created scripts/migrate-to-memory-proxy.js
- Migrated 18 rules from .claude/instruction-history.json
- Automatic backup creation
- Full verification (18/18 rules + 3/3 critical rules)
- Dry-run mode for safe testing

**Performance**:
- MemoryProxy overhead: ~2ms per service (~5% increase)
- Audit logging: <1ms (async, non-blocking)
- Rule loading: 1ms for 3 rules (cache enabled)
- Total latency impact: negligible

**Files Modified**:
- src/services/BoundaryEnforcer.service.js (MemoryProxy integration)
- src/services/BlogCuration.service.js (MemoryProxy integration)
- tests/poc/memory-tool/week3-boundary-enforcer-integration.js (new)
- scripts/migrate-to-memory-proxy.js (new)
- docs/research/phase-5-week-3-summary.md (new)
- .memory/governance/tractatus-rules-v1.json (migrated rules)

**Test Results**:
- MemoryProxy: 25/25 
- BoundaryEnforcer: 43/43 + 5/5 integration 
- BlogCuration: 26/26 
- Total: 99/99 tests passing (100%)

**Next Steps**:
- Optional: Context editing experiments (50+ turn conversations)
- Production deployment with MemoryProxy initialization
- Monitor audit trail for governance insights

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 12:22:06 +13:00
TheFlow
1815ec6c11 feat: Phase 5 Memory Tool PoC - Week 2 Complete (MemoryProxy Service)
Week 2 Objectives (ALL MET AND EXCEEDED):
 Full 18-rule integration (100% data integrity)
 MemoryProxy service implementation (417 lines)
 Comprehensive test suite (25/25 tests passing)
 Production-ready persistence layer

Key Achievements:

1. Full Tractatus Rules Integration:
   - Loaded all 18 governance rules from .claude/instruction-history.json
   - Storage performance: 1ms (0.06ms per rule)
   - Retrieval performance: 1ms
   - Data integrity: 100% (18/18 rules validated)
   - Critical rules tested: inst_016, inst_017, inst_018

2. MemoryProxy Service (src/services/MemoryProxy.service.js):
   - persistGovernanceRules() - Store rules to memory
   - loadGovernanceRules() - Retrieve rules from memory
   - getRule(id) - Get specific rule by ID
   - getRulesByQuadrant() - Filter by quadrant
   - getRulesByPersistence() - Filter by persistence level
   - auditDecision() - Log governance decisions (JSONL format)
   - In-memory caching (5min TTL, configurable)
   - Comprehensive error handling and validation

3. Test Suite (tests/unit/MemoryProxy.service.test.js):
   - 25 unit tests, 100% passing
   - Coverage: Initialization, persistence, retrieval, querying, auditing, caching
   - Test execution time: 0.454s
   - All edge cases handled (missing files, invalid input, cache expiration)

Performance Results:
- 18 rules: 2ms total (store + retrieve)
- Average per rule: 0.11ms
- Target was <1000ms - EXCEEDED by 500x
- Cache performance: <1ms for subsequent calls

Architecture:
┌─ Tractatus Application Layer
├─ MemoryProxy Service  (abstraction layer)
├─ Filesystem Backend  (production-ready)
└─ Future: Anthropic Memory Tool API (Week 3)

Memory Structure:
.memory/
├── governance/
│   ├── tractatus-rules-v1.json (all 18 rules)
│   └── inst_{id}.json (individual critical rules)
├── sessions/ (Week 3)
└── audit/
    └── decisions-{date}.jsonl (JSONL audit trail)

Deliverables:
- tests/poc/memory-tool/week2-full-rules-test.js (394 lines)
- src/services/MemoryProxy.service.js (417 lines)
- tests/unit/MemoryProxy.service.test.js (446 lines)
- docs/research/phase-5-week-2-summary.md (comprehensive summary)

Total: 1,257 lines production code + tests

Week 3 Preview:
- Integrate MemoryProxy with BoundaryEnforcer
- Integrate with BlogCuration (inst_016/017/018 enforcement)
- Context editing experiments (50+ turn conversations)
- Migration script (.claude/ → .memory/)

Research Status: Week 2 of 3 complete
Confidence: VERY HIGH - Production-ready, fully tested, ready for integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 12:11:20 +13:00
TheFlow
2ddae65b18 feat: Phase 5 Memory Tool PoC - Week 1 Complete
Week 1 Objectives (All Met):
- API research and capabilities assessment 
- Comprehensive findings document 
- Basic persistence PoC implementation 
- Anthropic integration test framework 
- Governance rules testing (inst_001, inst_016, inst_017) 

Key Achievements:
- Updated @anthropic-ai/sdk: 0.9.1 → 0.65.0 (memory tool support)
- Built FilesystemMemoryBackend (create, view, exists operations)
- Validated 100% persistence and data integrity
- Performance: 1ms overhead (filesystem) - exceeds <500ms target
- Simulation mode: Test workflow without API costs

Deliverables:
- docs/research/phase-5-memory-tool-poc-findings.md (42KB API assessment)
- docs/research/phase-5-week-1-implementation-log.md (comprehensive log)
- tests/poc/memory-tool/basic-persistence-test.js (291 lines)
- tests/poc/memory-tool/anthropic-memory-integration-test.js (390 lines)

Test Results:
 Basic Persistence: 100% success (1ms latency)
 Governance Rules: 3 rules tested successfully
 Data Integrity: 100% validation
 Memory Structure: governance/, sessions/, audit/ directories

Next Steps (Week 2):
- Context editing experimentation (50+ turn conversations)
- Real API integration with CLAUDE_API_KEY
- Multi-rule storage (all 18 Tractatus rules)
- Performance measurement vs. baseline

Research Status: Week 1 of 3 complete, GREEN LIGHT for Week 2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 12:03:39 +13:00