Skip to content

Lean game mode with DAG-based simulation navigation - #19

Open
freesig wants to merge 19 commits into
freesig/sim-4-membersfrom
freesig/sim-5-lean-game
Open

Lean game mode with DAG-based simulation navigation#19
freesig wants to merge 19 commits into
freesig/sim-4-membersfrom
freesig/sim-5-lean-game

Conversation

@freesig

@freesig freesig commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add lean game mode: lightweight DAG-based simulation navigation
  • Lean orchestration engine with graph, prompts, and types modules
  • Warmup system with scenario-driven spec gap exploration
  • TUI rendering and input handling for lean game
  • Preserve full navigation history for send-actions
  • Delete spec from gallery with double-press confirmation

Stack

  • PR 1/5: TUI Infrastructure
  • PR 2/5: Simulation Core & UX
  • PR 3/5: Sim Tools, Game Mode & Streaming
  • PR 4/5: Members Screen
  • PR 5/5 ← you are here

Test plan

  • Lean game launches from TUI
  • DAG navigation works with back-navigation
  • Warmup interactions display while game loads
  • Spec updates propagate correctly from lean game actions
  • Delete spec requires double-press confirmation

freesig added 19 commits April 2, 2026 08:52
New experimental game mode focused on efficient spec refinement through
simulated software play. Each output generates 2 new child nodes plus
shortcut edges to existing nodes, forming a DAG. Batch pre-generation
(depth 3) keeps navigation instant, and background spec updates refine
the spec as the player navigates. Includes TUI panel, MCP tools, and
entropy-guided interaction selection.
Use spec_read_only config for lean batch generation so the AI can only
call search_nodes, get_node, get_descendants, and get_spec_summary.
Removes filesystem tools (Read, Glob, Grep) and explicitly tells the
AI not to attempt any write or sim/game tools.
… and backgrounding

Allow pressing back while a scene is generating by updating can_go_back
during Processing status and cancelling in-flight leaf generation via the
generation counter. Auto-trigger pregen when landing on nodes with shallow
depth (after initial turn, navigation, and go-back). Change Esc to
background lean games instead of destroying them, with full session
restore via the existing session picker.
…le spec

Main lean AI now signals spec-relevant behavior via per-node spec_updates in
the batch response. On navigation, a separate background AI session with write
tools and full spec context determines the best placement — adding Q&A nodes,
updating existing answers, or creating new features as appropriate.
Remove automatic background Claude sessions for spec updates during lean
game navigation. Instead, navigation history accumulates as unsent actions
that the user explicitly sends (press 's') with notes to the main AI
session via --resume. The AI then uses write MCP tools to update the spec.

Key changes:
- Track unsent action count via lean_sent_path_len on SimSession
- Queue leaf generation and send-actions when session is busy
- Warn on quit if unsent actions remain (double-press Q to confirm)
- Show send(N) in status bar, spec update progress in output title
- Remove LeanSpecSuggestion, background spec update orchestration,
  and separate spec update Claude sessions
- Add LeanGraph::replace_at() for modify: replaces current node's content
  and edges with the new batch so the modified output is immediately visible
- Update format_navigation_history to use edge labels (e.g. "Click Submit")
  instead of raw_text for clearer action descriptions
- Send actions overlay now lists all unsent actions by label before the
  notes input, so users can see what they're sending
Show "◐" yellow indicator on edges approaching ungenerated frontier nodes
instead of the normal "●" green. Trigger background pregen immediately
after navigating via a leaf edge so the next level generates without delay.
Silent navigation now signals acceptance — the AI is instructed to
treat unmodified/unqueried outputs as correct and use them to fill
unspecified gaps in the spec.
Op notifications were silently dropped while on LeanGame or Simulation
screens, leaving self.nodes stale. Nodes added via MCP during those
sessions would appear empty or missing when navigating back to SpecView.
…tputs

Add explicit instructions across system prompt, channel semantics, and DAG
rules telling the AI to render concrete application output rather than
surfacing spec-level questions or uncertainty markers in channel text.
Back navigation no longer removes entries from the send-actions history.
A separate append-only lean_action_history records every forward and back
navigation chronologically, so send-actions reflects the complete player
journey including backtracking.
Pregen was not triggering when navigating to a leaf node because:
1) A prior pregen (from an ancestor) held lean_generating=true, and
   after completing it never re-checked the current position.
2) The pregen anchor was the navigated-to node which might have only
   generative edges — merge_batch couldn't attach the new batch.

Now find_pregen_target BFS-walks to the nearest node with leaf edges,
and spawn_queued_work re-checks the current position after pregen ends.
Generative/Shortcut navigation now explicitly sets status to Idle, and
the Processing branch syncs interactions from the graph so existing
nodes always show their edges regardless of status timing.
Include all simulation channels (network, audio, errors, logs) in the
navigation history sent to the spec update prompt, and add guidance for
the AI to reason about system-wide implications of UI interactions.
The lean game AI was not grounding its outputs in the spec, making
different choices even when the spec clearly specified behavior. Add
SPEC FIDELITY and WHEN THE SPEC IS SILENT sections to both system
prompt builders to prioritize faithful spec rendering over entropy
exploration.
Spawn fast Haiku-based text scenarios in parallel with the slow initial
lean game turn so the player has something to do while waiting. Warmup
picks high-entropy spec nodes, generates short situational prompts, and
captures player responses for later spec updates via send-actions.
Restructure lean game prompts so the AI acts as a scenario designer
rather than a generic simulator. The AI now identifies high-entropy
decisions it had to make and designs DAG paths as mini-scenarios that
force the player to confront those assumptions.

Key changes:
- Activate spec_gaps field: AI logs implementer assumptions per channel
- Feature-scoped entropy: high-entropy nodes filtered to focus feature
- Scenario design framing: CARDINAL RULE rewritten for gap exploration
- spec_gaps flow into send-actions prompt as validation evidence
- Resume prompt guides continued scenario exploration
Show warmup scenarios in the output panel while the main game loads.
Players press 'r' to enter response mode and Ctrl+S to submit. The
status bar shows warmup-specific hints and a "game ready!" indicator
when the real game has loaded. Warmup state is synced from the session
and cleared on transition to the real game.
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