Conversation
…torage Layer 2 data layer for individual review + team debrief: - models.py: PersonalReflection (per-role reflections), TeamDebriefResult (team consensus) - store.py: +2 tables (personal_reflections, team_debriefs), +save_reflection/get_reflection/get_round_reflections/save_debrief Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…f (Layer 2 S3) Replace single CEO-only reflect() with: - individual_review(role, constructs) — Phase 5 per-role review with construct-guided prompts for CEO/CFO/CMO - team_debrief() — Phase 6 CEO-hosted consensus debrief synthesizing all 3 perspectives into Team Beliefs - Legacy reflect() wrapper for backward compatibility Each review prompt injects construct weights (growth, risk) to ensure reflections are guided by role identity, preserving experimental validity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace single reflect() calls with Individual Review + Team Debrief: - Phase 5: all 3 agents review in parallel via asyncio.gather - Phase 6: CEO hosts team debrief for consensus beliefs Each agent's construct weights are passed to individual_review() so reflections are guided by role identity (growth/risk tendencies). Applied to both _run_single_llm_round() and _run_multi_llm_round(). Fixed role case mismatch: normalize role to lowercase for prompt lookup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
get_context_for_prompt() now includes the agent's own personal reflection from the previous round. Each agent sees only their own reflection, creating role-specific continuity across rounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Includes commit conventions with step tags, per-step checklist (lint → format → import check → test → commit), and pre-merge checklist. Ensures consistent commit quality across iterations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New modules for ReAct loop support: - agents/memory/store.py: AgentMemory for conversation context - agents/tools/schema.py: ToolCall, ToolResult, ToolDefinition models - agents/tools/executor.py: ToolRegistry for dispatching tool calls - tests/test_phase1_enhancements.py: Phase 1 integration tests - tests/test_phase2_react.py: ReAct loop tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- llm/base.py: Add chat_with_tools() abstract method, LLMResponse.tool_calls - llm/openai_compat.py: Implement tool calling, _THINKING_MODELS set, temperature=1.0 enforcement for thinking models Enables ReAct loops with tool calling for data-driven decisions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…porting - finance.py: Fix interest accrual, add bank state helpers, improve credit rating transitions and payment delay handling - game_loop.py: Generate market reports per round (price/volume per SKU, market share rankings), track disruption events - storage/schema.sql: Add market_reports and disruption_events tables Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- erpsim_decision.py: Add RoundHistoryEntry.pricing_snapshot, inventory_snapshot, total_units_sold/produced fields - market_report.py: New model for agent market context - erpsim_adapter.py: Enhance apply_llm_decision() to handle marketing spend, loan repayment, capacity expansion - erpsim_context.py: _build_round_history() fills new fields; market report included in ERPSimContext Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ceo.j2: Add CRITICAL PRICING/PRODUCTION RULES, beliefs + summary Jinja2 blocks, enforce 2-3x cost pricing guidance - cfo.j2: Add shared beliefs block, financial analysis guidance - cmo.j2: Add shared beliefs block, channel strategy guidance Prevents LLM agents from pricing below production cost. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- executive.py: Add react_loop() with tool calling support - erpsim_executive.py: Add react_loop(), react_decision(), long_term_memory injection, _build_react_context() for tool-informed decisions - erpsim_discussion.py: Refactor to support ReAct-aware discussion - discussion.py: Enhance with richer message tracking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Module __init__.py exposes the hindsight memory system: Episode, Belief, EntitySummary, PersonalReflection, TeamDebriefResult models; AgentMemory store; individual_review() + team_debrief() functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New platform module for multi-team matches: - platform/auth/: Login/register with bcrypt password hashing - platform/match/: Match lifecycle (create → lobby → running → finished) - platform/yaml_parser/: Parse uploaded experiment YAML configs - platform/api/router.py: Mount all platform routes on FastAPI app - api/app.py: Register platform router Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…w pages - Add i18n/ with context.tsx, en.ts, zh.ts - Add ProtectedRoute, AppLayout, AdminLayout - New pages: Dashboard, ConfigUpload, MatchLobby, MatchLive, MatchReport, MatchWeekly, Login, Landing, AdminCreateMatch - API: api/platform.ts for match/auth endpoints - ERPSimDetail: full redesign with tabbed live/report/weekly views - App.tsx: Route restructuring, auth integration - Style: index.css with Tailwind 4 upgrade, status badges Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- hindsight-memory.md: 4-layer memory architecture, Layer 1+2 design, OB experimental validity analysis, Layer 3 future outlook - agent-competition-platform.md: Multi-user match platform design Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove trailing newlines from various modules, fix test assertions after config changes, and add llm_teams field to ERPSimExperimentConfig for the --all-llm CLI flag. No functional change to core logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runtime SQLite databases should not be tracked. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the card-based discussion view in ERPSimDetail with an iMessage group-chat layout. Left sidebar lists teams (hidden for single-team experiments), right panel shows chat bubbles with role avatars. - Backend: expose team_id in MessageItem API response - Extract decision renderers from ERPSimDetail into components/chat/ - New components: ChatView, ChatBubble, RoleAvatar, TeamList, FinalDecisionCard - i18n keys for chat UI in both en/zh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ChatView now infers which teams are LLM-driven by checking which teams have discussion messages, instead of hardcoding team_0 as the only LLM team. Also auto-selects the first team with messages and shows message counts in the TeamList sidebar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Experiment list now shows single-column wide cards with status badges, condition tags, and financial summaries for completed experiments. Each card includes a mini valuation bar chart comparing all teams, LLM team rank, and net profit indicator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Widen left/right padding from px-8 (32px) to px-12 (48px) for better visual separation between sidebar and content cards. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…geneous directories
Move flat erpsim/{ceo,cfo,cmo}.j2 into erpsim/homogeneous/ and create
differentiated erpsim/heterogeneous/ variants with divergent decision
frameworks (CEO aggressive growth, CFO conservative guardrails, CMO
market-share focus). Update constructs.yaml with per-role philosophy
strings and tuned heterogeneous weight spreads (CEO long_term 0.7→0.8,
CFO long_term 0.5→0.3) to widen the construct gap for the experiment's
independent variable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…m_results Root cause: sales_by_sku was populated AFTER team_results read it, so total_units_sold was always 0 despite actual sales occurring. Also fixes: - Initial raw material buffer (3 days of daily capacity) - Raw material consumption: only produce what materials allow - credit_rating stored as .value (string) not enum object Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…et report Extend ERPSimContext with four new feedback fields populated from Round 2 onward: sales_feedback (team-private SKU/DC/region breakdown), banking_feedback (interest, borrowing, repayment), market_report (public anonymized market share, SKU averages, DC throughput, carbon ranking), and weekly_snapshots (team-private weekly sales trend). Add context extractors in erpsim_context.py that pull data from game._round_results. Enrich agent user prompts with structured feedback sections so LLM agents can reason about last-round performance. Move beliefs/summary injection from system prompt to user prompt to avoid duplication. Load prompt templates by construct_type subdirectory. Increase discussion max_rounds from 2 to 3 for richer deliberation. Add market_transparency config field to ERPSimExperimentConfig (full / range / rank_only) and thread it through context building. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd latest-round API
Switch ERPSimDatabase from per-call connect/close to a single persistent
connection with WAL mode, eliminating repeated open/close overhead.
Add get_latest_round_result() and get_single_round_result() queries to
avoid fetching all rounds when only one is needed. Replace composite
index idx_erpsim_rounds_experiment with idx_erpsim_rounds_exp_round
covering (experiment_id, round_number) for faster single-round lookups.
Add GET /api/erpsim/{id}/rounds/latest endpoint and refactor the
existing single-round endpoint to use the new targeted query.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…imizations ERPSimDetail: add TeamSelector component to switch metrics view between LLM team and bot teams. OverviewSection, CashFlowChart, and CarbonTrend now accept selectedTeam prop and read from all_team_results accordingly. Add PricingTrendChart showing per-round price evolution for selected team. Wrap all chart components with React.memo + useMemo to prevent redundant re-renders during polling. Memoize RoundSelector, RoundDataSection, and OverviewSection as well. ExperimentCard: redesign with left accent bar colored by construct type, inline LLM rank display, pill-style tags, and simplified layout (remove MiniValuationChart and loading skeleton). Use getLatestRound API instead of fetching all rounds for the list view. ExperimentList: remove loadingRounds state, tighten spacing, use new latest-round endpoint. Add zh.ts i18n key for llmRank. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…orts test_e9: add 7 new tests for round feedback system — verify no feedback in Round 1, then check sales_feedback, market_report (range and full transparency), weekly_snapshots, banking_feedback, and full 12-SKU pricing in history after Round 1. Verify prompt paths updated to homogeneous/ subdirectory and add heterogeneous template rendering test. test_e7: fix integration test that assumed idle teams — now team_0 actively purchases raw materials and prices products. Fix import ordering to satisfy ruff isort rules. Relax idle-team valuation assertion to check relative ranking rather than negative values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… and frontend Add TokenAccumulator class to aggregate prompt/completion token counts across all LLM calls within a round (discussion + individual review + team debrief). ERPSimDiscussion.run() and run_react() now return (decision, token_usage) tuple. ERPSimExecutiveAgent.respond() and make_final_decision() propagate response.usage. Per-message token_count stored in discussion history. Schema: add total_prompt_tokens, total_completion_tokens, total_tokens columns to erpsim_rounds. Add token_count column to messages insert. Database migration handles existing tables. DB.update_round_tokens() persists aggregated totals. Frontend: display token metrics in OverviewSection grid with K-formatted numbers and prompt/completion split. Add i18n keys for both zh and en. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gurable Three critical fixes for experiment validity: 1. Bot procurement: order raw materials for 30 days (was only 1 day) 2. Game loop: process PO arrivals BEFORE production each day 3. Agent prompts: explain production_orders is a daily schedule repeated 30x Also adds --rounds CLI flag to override default 6-round game length. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The MCI demand model's marketing_term was computed as (M+1)^beta with raw EUR budgets (0–500K), producing 500x+ multipliers that completely dominated pricing. Add MKT_SCALE=10,000 normalization so zero marketing yields 1.0 and 50K yields ~3–5x — matching ERPsim's actual behavior. Scale all DC approx_market_size_per_team by 2x (DC10: 90K→180K, DC12: 360K→720K, DC14: 135K→270K) for a profitable-but-competitive equilibrium where teams can cover fixed costs with reasonable pricing. Update test assertions to match new market sizes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gurable Game loop: add cumulative_units_sold to TeamState for consistent per-round vs cumulative field semantics. team_results now includes round_revenue, round_profit, round_units_sold (per-round) alongside total_revenue, total_profit, total_units_sold (cumulative). Storage: add llm_teams_json column to erpsim_experiments for multi-LLM team config persistence. Add migration to backfill total_rounds for experiments that ran more than 6 rounds. Runner now writes num_rounds and llm_teams_json at experiment creation. API: expose llm_teams in ERPSimExperimentDetail response. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…avigation ExperimentCard and ChatView now read llm_teams from experiment config to correctly identify LLM-driven teams instead of hardcoding team_0. TeamSelector and RoundDataSection use isLLM() helper for highlighting. ERPSimDetail: add left/right arrow keyboard navigation for round switching. RoundSelector now derives range from actual max round number instead of hardcoded [1..6], supporting configurable round counts. API types: add llm_provider, llm_model, temperature, llm_teams to ERPSimExperiment interface. UI polish: larger team/round selector buttons with shadow on active state. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cript Add experiment design documents: - 00-实验路线图: overall research roadmap with 5 experiment phases - PRD-01: Construct differentiation via ERPsim (primary experiment) - PRD-02: Social inference via communication experiment - PRD-03: Decision authority allocation experiment - PRD-04: Exploration/Exploitation experiment - PRD-05: Construct representation granularity experiment Each PRD includes variables, hypotheses, operationalization, and analysis plan. Also includes prompt design docs and variable tables. Add scripts/run_pilot.py: batch runner for PRD-01 pilot that runs N games with 3 homogeneous + 3 heterogeneous LLM teams, collects per-round metrics, and runs Welch's t-test on profit differences. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 'cd frontend && npm run lint' to Common Commands section. Document DEFAULT_LLM_PROVIDER/model default values and .env override options for Kimi, DeepSeek, and Anthropic providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tric accents LandingPage: replace centered card layout with asymmetric left-aligned hero, large mono headline, animated grid background, rotating circle decoration, and numbered feature cards with hover-activated left border. Stats bar uses separated value+label pairs instead of single string. PublicLayout: add geometric OC logo mark, version number in footer, full-height main area for proper content flow. LoginPage: center form vertically within flex container. CSS: add landing-grid (subtle dot grid with radial mask), landing-circle rotation animation, feature-card hover styles, stagger-features reveal. i18n: split landing.stats into individual keys (skus, regions, rounds, agents) for both en and zh locales. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…18n keys LandingPage: use min-h-[calc(100vh-160px)] with flex centering to vertically center the hero section in the viewport. Add bottom divider with dot accent. Remove unused stats bar (stats keys inlined in JSX). PublicLayout: add items-center to main for horizontal centering. i18n: remove landing.stats.skus/regions/rounds/agents keys from both en.ts and zh.ts — values are now hardcoded in the stats component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MCI demand model now accepts volatility and rng parameters. ERPSimGame wires market_condition (stable=0.10, dynamic=0.40 volatility) into the demand engine with a dedicated RNG stream for reproducibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…urity Add SustainabilityInvestmentOption and AccountsReceivableDetail models to ERPSimContext and PrivateContext. Context builder now computes ROI estimates for sustainability investments and AR due schedules, giving agents better information for financial planning decisions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the FIRST-FIT capacity allocation algorithm in CEO prompts so agents understand that production_orders are processed in order against a 24K daily capacity. Add shorter production reminders to CFO/CMO prompts. Applies to both homogeneous and heterogeneous conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement a dynamic construct system based on Kelly's PCT where agent cognitive frameworks evolve through prediction-revision cycles rather than static weight vectors. New kelly/ module: - models.py: PersonalConstruct, ConstructSystem, prediction/revision types - engine.py: predict_outcomes, revise_constructs, compute_centrality - repgrid.py: LLM-driven repertory grid elicitation via triadic sorting - profiles.py: role-specific bias injection for heterogeneous/homogeneous - store.py: SQLite persistence for construct evolution history Integration: - ERPSimExecutiveAgent gains kelly_system/kelly_store and prediction/ revision methods; system prompt renders Kelly constructs when active - ERPSimRunner._create_discussions is now async; initializes Kelly agents via RepGrid extraction and runs prediction/revision phases each round - CLI accepts kelly_homogeneous and kelly_heterogeneous conditions - reflect.py adds kelly_construct_revision for Phase 5.5 - constructs.yaml defines kelly_ condition profiles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Widen gaps between subtitle, headline, description, CTA buttons, and feature cards for better visual breathing room. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mpts Add: Phase0 diagnostic report, literature review, uniqueness analysis, Kelly implementation plan, validation experiment design, work summary, AAAI'26 experiment plan and collaboration outreach doc. Remove: obsolete Chinese prompt design docs (now superseded by Jinja2 templates in agents/prompts/erpsim/). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename 28 files from English to Chinese filenames - Archive 7 completed plans to docs/archive/ - Move diagnostic report and work summary to docs/logs/ - Move literature review to docs/reviews/ - Delete 2 overlapping files (merged into reviews/独特性分析) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Exclude docs/, *.pdf, and .claude/ from tracking. docs/ files remain on local disk but will not be published. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gine - Add multi-SKU demand calculation (calculate_dc_demand_multi_sku) with configurable elasticity and marketing scale parameters - Refactor CarbonTaxSchedule to list[CarbonTaxEntry] for flexible round ranges - Add AAA/AAA- credit ratings and FeasibilityConstraints model - Add packaging support in PurchaseOrderDecision (material_type field) - Add SetupTimeOptionSummary, operation_feedback, and feasibility_constraints to ERPSimContext for richer agent decision context - Expand game_loop with packaging tracking, setup time, and multi-SKU demand - Add progress-scaled DDM valuation (constant amplification across rounds) - Expand manufacturing.yaml and config loader for new game parameters - Add new LLM providers (deepseek, dashscope) and kimi-k2.6 thinking model - Update all simulation tests to match new APIs and model signatures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ve Kelly system - Extract 4 shared Jinja2 templates (_shared/base_company, base_pricing, base_production, base_response) from 12 role templates to eliminate duplication and ensure consistent game rules across conditions - Refactor all 12 role templates to 5-section structure: shared rules → decision profile (manipulation) → role focus → team interaction (manipulation) → shared decision rules - Remove adversarial directive verbs (override/block/oppose) from manipulation sections for cleaner experimental design - Add solo/ceo.j2 template for single-agent ablation studies - Replace LLM-generated Kelly constructs with predefined bipolar construct profiles (kelly/profiles.py) for reproducible experiments - Enrich agent context with feasibility constraints, operation feedback, inventory details, and per-DC sales feedback in discussion prompts - Improve fallback decision with realistic reference prices and packaging - Lower Kelly construct revision threshold (0.03 → 0.005) for sensitivity - Use round-level metrics (round_revenue/profit) in episode building Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…riment logging
- Replace --condition/--all-llm with granular --teams-homo/--teams-hetero/
--teams-kelly-homo/--teams-kelly-hetero/--teams-solo flags for flexible
team allocation across all 6 experimental conditions
- Auto-infer condition label from team allocation when --condition omitted
- Add per-experiment log files (logs/{tag}_{timestamp}.log) with DEBUG level
- Default LLM provider changed from kimi/kimi-k2.5 to deepseek/deepseek-v4-flash
- Add solo agent support in ERPSimRunner (single CEO, no discussion)
- Parallelize post-round reflection across all teams with asyncio.gather
- Inject FeasibilityConstraints and operation feedback into agent context
via ERPSimContextBuilder and ERPSimAdapter
- Add round summary logging with per-team revenue/profit/cash/valuation
- Simplify result summary to generic group-by-construct-type output
- Fix duplicate token fields in RoundData schema
- Fix config upload endpoint to use Body(..., embed=True)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Frontend: - Enhance ERPSimDetail page with improved team result display - Expand erpsim.ts API types for richer experiment data - Improve ValuationTrend and RankingsChart components - Add decision renderers for purchase orders and sustainability - Enhance usePolling hook with error handling and abort support - Add catch-all route redirect to home page - Update i18n strings and team color palette - Remove unused RoleAvatar and MiniValuationChart components Project metadata: - Update CLAUDE.md with solo mode, Kelly system, ERPSim discussion modes, batch workflow, known bugs section, and 2x2+2 design table - Add deepseek/dashscope to .env.example, update default model - Add scripts/ and paper/ to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--teams-homo/hetero/kelly-homo/kelly-hetero/soloflags replacing--condition+--all-llm; per-experiment log files; auto-condition inferenceKey changes by commit (latest batch)
feat(simulation)— Models, configs, simulation engines, and their tests (24 files)refactor(prompts)— Shared templates, solo mode, Kelly profiles, agent/memory (25 files)feat(runner)— CLI team allocation, experiment logging, solo support, API fixes (15 files)feat(frontend)— ERPSim views, charts, project documentation (22 files)Test plan
uv run pytest backend/tests/ -x -qpassesuv run ruff check backend/passesuv run python -m orgconstruct run-erpsim --teams-homo 1 --teams-hetero 1 --rounds 2 --seed 42completescd frontend && npm run buildsucceeds--teams-solo 1 --teams-homo 1 --rounds 2🤖 Generated with Claude Code