Skip to content

Land hybrid Nomic line (icloud-commits-20251125) - #22

Closed
CrazyDubya wants to merge 7 commits into
mainfrom
icloud-commits-20251125
Closed

CrazyDubya wants to merge 7 commits into
mainfrom
icloud-commits-20251125

Conversation

@CrazyDubya

@CrazyDubya CrazyDubya commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Branch icloud-commits-20251125 carries a hybrid Nomic line:

  • games/nomic/proper_nomic.py (~508KB) plus hybrid/logging/cost docs & tests
  • After rebase, coexists with main's root nomic/ layout (both present)

Rebase status

  • Rebased 6 commits onto current main (103e9f3)
  • New tip: 9809bd5
  • ahead 6 / behind 0 — conflict-free

Intent

Inclusive squash for review. Product direction (hybrid vs root nomic coexistence) decided in review. No auto-merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Stephen Thompson and others added 6 commits October 2, 2026 11:40
Major improvements to fix AI context drift and add analytics:

Context Fixes:
• Add explicit Nomic game headers to all 5 deliberation prompts
• Include victory condition (100 points) and current scores
• Add valid vs invalid rule examples to prevent non-game proposals
• Emphasize competitive nature and strategic focus

Stats Page Enhancement:
• Replace basic JSON stats with beautiful HTML analytics dashboard
• Add gradient background, glassmorphism effects, and animations
• Create tier-based model classification
• Include progress bars, live updates, and responsive design
• Split into HTML route (/stats) and API endpoint (/api/stats)

These changes directly address the user's concern about AI agents proposing
rules about city council and energy audits instead of proper Nomic rules.

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

Co-Authored-By: Claude <[email protected]>
- Fixed aggressive 4-second game loop interrupting human typing (now 10s with smart pausing)
- Preserved dropdown selections and text across automatic UI updates
- Implemented comprehensive input sanitization (ASCII-only, SQL/XSS/prompt injection protection)
- Added ContextWindowManager for intelligent token tracking and prompt optimization
- Built async deliberation system where AI players think immediately when proposals are made
- Enhanced voting with pre-computed analysis plus real-time voting context
- Fixed game flow bug where turns wouldn't advance after human voting completed
- Added focus restoration to prevent cursor loss during UI updates

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

Co-Authored-By: Claude <[email protected]>
MAJOR FIXES:
• Fix double penalty bug - players lose 10 points (not 20) for failed proposals
• Fix turn order bug - removed duplicate advance_turn() calls
• Fix starting points - players start with 50 points (goal: 100)
• Replace invalid xai/grok-3-mini model with working anthropic/claude-3-haiku
• Fix analytics crashes by adding defensive programming for missing keys

AI BEHAVIOR IMPROVEMENTS:
• Rebalance voting prompts to reduce toxic negativity while maintaining competition
• Change "Think strategically - you're trying to WIN, not be fair" to balanced approach
• Add auto-lose rule awareness (Rule 117) to prevent destructive strategies
• Increase reasoning display from 100 to 300 characters for better transparency
• Update fallback reasoning from generic "Strategic NAY" to descriptive messages

TECHNICAL IMPROVEMENTS:
• Add processing_proposal_result flag to prevent race conditions
• Fix indentation errors in process_proposal_result method
• Implement smart model assignment based on player count
• Add comprehensive Game Master integration with prevention of duplicate effects

GAME BALANCE:
• Players now competitive but aware of consequences of overly destructive rules
• Maintained strategic thinking while encouraging thoughtful gameplay
• Added warnings about auto-lose conditions to prevent game-ending scenarios

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

Co-Authored-By: Claude <[email protected]>
Fixed two critical issues with context trimming:
1. Added missing claude-3.5-sonnet model to token limits (200k instead of 8k default)
2. Enhanced _split_prompt_sections() to properly detect Nomic-specific content

This prevents aggressive trimming from 1,303 → 68 characters, ensuring AIs receive full context for strategic deliberation.

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

Co-Authored-By: Claude <[email protected]>
…otation

MAJOR FEATURES ADDED:
✅ 20 unique characters across 4 model families (5 per family)
✅ Character-specific traits system (risk, cooperation, decision speed, strategic focus)
✅ Dynamic rotation with winner retention and forced rotation after 2 neutral games
✅ Character-specific deliberation ranges based on personality
✅ Personalized prompt customization system

CHARACTER FAMILIES:
• Gemini Family: Dr. Maya Chen, Lady Victoria, Professor Atlas, Captain Nova, Sage Minerva
• GPT-4o Family: Rex Thunder, Rusty, Blitz Martinez, Storm Walker, Phoenix Rising
• Claude Sonnet Family: Professor Iris, Judge Sterling, Harmony Bell, Scholar Moon, Architect Prime
• Claude Haiku Family: Jack Chaos, Spark Wild, Echo Dance, Rebel Knight, Trickster Fox

ROTATION SYSTEM:
• Winners stay for next game
• Losers must leave
• No character can stay >2 games without winning/losing
• Family balancing ensures model representation
• Automatic character trait-based deliberation selection

PROMPT OPTIMIZATION:
• Simplified deliberation prompts for early/simple game states
• Enhanced proposal examples showing successful patterns
• Improved voting prompts to reduce over-analysis
• Better vote parsing with multiple fallback methods
• Character-specific personality adjustments in prompts

This creates a much more dynamic and interesting game experience with 20 distinct AI personalities, proper rotation mechanics, and character-driven strategic diversity.

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

Co-Authored-By: Claude <[email protected]>
…ization

## Critical Logging System Fix
- **Problem**: Global game variable caused race condition when multiple port instances (8083, 8084) ran simultaneously
- **Root Cause**: Last instance to start overwrote global variable, breaking Flask routes for earlier instances
- **Solution**: Eliminated global variable, replaced with Flask app context storage
- **Result**: All port instances now maintain complete independent logging with full JSON files

## Major Feature: Hybrid Cost Optimization System
- **Achievement**: 70-75% cost reduction through intelligent big/small model selection
- **Model Family Pairings**:
  - Claude: claude-3.5-sonnet (big) + claude-3.5-haiku (small)
  - OpenAI: gpt-4o (big) + gpt-4o-mini (small)
  - Google: gemini-2.5-pro-preview (big) + gemini-2.5-flash (small)
  - xAI: grok-3-beta (big) + grok-3-mini (small)

## System Components
- **ComplexityDetectionEngine**: 8 complexity factors for intelligent escalation
- **HybridModelSelector**: Dynamic model selection based on game state
- **Smart Escalation Logic**: Budget-aware threshold adjustment
- **Complete Integration**: Embedded in deliberation and voting systems

## Technical Implementation
- Updated 15+ Flask routes to use current_app.config['game']
- Added --hybrid command line flag with budget management
- Comprehensive test suite (logic, components, integration, CLI)
- Production ready with real-time cost tracking and analytics

## Files Modified
- proper_nomic.py: Core hybrid system + logging fix
- Added test_hybrid_system.py, test_hybrid_integration.py, test_hybrid_simple.py
- Added comprehensive documentation: HYBRID_SYSTEM_COMPLETE.md, HYBRID_TEST_RESULTS.md, LOGGING_FIX_SUMMARY.md

## Production Usage
./venv312/bin/python proper_nomic.py --openrouter --hybrid --budget 10.0

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

Co-Authored-By: Claude <[email protected]>
@CrazyDubya
CrazyDubya force-pushed the icloud-commits-20251125 branch from aed23aa to 9809bd5 Compare October 2, 2026 15:41
Routes that still used a bare global game now read
current_app.config['game'], matching the multi-port app factory.
Also drop an unused global on the analytics cache.
@CrazyDubya

Copy link
Copy Markdown
Owner Author

Closing as already landed: work is already in the default branch.

@CrazyDubya CrazyDubya closed this Oct 6, 2026
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.

1 participant