[PORTAL] reflex.py — fast tactical layer via llama3.2:1b #662

Closed
opened 2026-03-27 16:55:33 +00:00 by perplexity · 32 comments
Member

What

A fast decision-making layer between Timmy (slow strategist) and pilot.py (fast motor control). Uses the 1.3GB llama3.2:1b model for ~200ms tactical decisions.

How It Works

every 1-2 seconds:
  perception = get_current_perception()
  goal = read_current_goal()
  
  prompt = f"Game state: {perception}. Goal: {goal}. Pick one action: explore, approach_npc, enter_door, fight, flee, talk, wait, quicksave. Respond with just the action name."
  
  action = query_reflex_model(prompt)  # ~200ms on 1B
  
  write_action_to_pilot(action)
  log_trajectory(perception, goal, action)

Serving the 1B Model

llama-server --jinja   --model PATH_TO_LLAMA32_1B_GGUF   --host 0.0.0.0 --port 8082   -ngl 99 -c 2048

Small context (2048) is fine — reflex doesn't need history, just the current snapshot.

Escalation

When reflex encounters something it can't handle:

  • Dialogue choice (multiple options)
  • Quest decision
  • Moral dilemma
  • Unknown situation

It writes to ~/.timmy/morrowind/escalation.txt:

{"situation": "NPC Caius Cosades is asking about the Nerevarine prophecy. Options: 1) Ask more, 2) Accept mission, 3) Leave", "timestamp": 1774580000}

Timmy picks it up on his next thinking cycle and responds.

Auto-Learning

Every reflex decision logged with outcome. After N sessions:

  • Good outcomes (found NPC, entered new area, gained item) → "chosen"
  • Bad outcomes (died, got lost, walked into wall) → "rejected"
  • LoRA fine-tune the 1B on these pairs
  • Reflex gets smarter without any code changes
  • Depends on pilot.py (motor layer below)
  • Feeds into Timmy's strategic layer (above)
  • Training data feeds into #603 (Aurora pipeline)
## What A fast decision-making layer between Timmy (slow strategist) and pilot.py (fast motor control). Uses the 1.3GB llama3.2:1b model for ~200ms tactical decisions. ## How It Works ``` every 1-2 seconds: perception = get_current_perception() goal = read_current_goal() prompt = f"Game state: {perception}. Goal: {goal}. Pick one action: explore, approach_npc, enter_door, fight, flee, talk, wait, quicksave. Respond with just the action name." action = query_reflex_model(prompt) # ~200ms on 1B write_action_to_pilot(action) log_trajectory(perception, goal, action) ``` ## Serving the 1B Model ```bash llama-server --jinja --model PATH_TO_LLAMA32_1B_GGUF --host 0.0.0.0 --port 8082 -ngl 99 -c 2048 ``` Small context (2048) is fine — reflex doesn't need history, just the current snapshot. ## Escalation When reflex encounters something it can't handle: - Dialogue choice (multiple options) - Quest decision - Moral dilemma - Unknown situation It writes to `~/.timmy/morrowind/escalation.txt`: ```json {"situation": "NPC Caius Cosades is asking about the Nerevarine prophecy. Options: 1) Ask more, 2) Accept mission, 3) Leave", "timestamp": 1774580000} ``` Timmy picks it up on his next thinking cycle and responds. ## Auto-Learning Every reflex decision logged with outcome. After N sessions: - Good outcomes (found NPC, entered new area, gained item) → "chosen" - Bad outcomes (died, got lost, walked into wall) → "rejected" - LoRA fine-tune the 1B on these pairs - Reflex gets smarter without any code changes ## Related - Depends on pilot.py (motor layer below) - Feeds into Timmy's strategic layer (above) - Training data feeds into #603 (Aurora pipeline)
perplexity added the harnessportalp1-important labels 2026-03-27 16:55:33 +00:00
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

Dispatched to claude. Huey task queued.

⚡ Dispatched to `claude`. Huey task queued.
Owner

Dispatched to gemini. Huey task queued.

⚡ Dispatched to `gemini`. Huey task queued.
Owner

Dispatched to kimi. Huey task queued.

⚡ Dispatched to `kimi`. Huey task queued.
Owner

Dispatched to grok. Huey task queued.

⚡ Dispatched to `grok`. Huey task queued.
Owner

Dispatched to perplexity. Huey task queued.

⚡ Dispatched to `perplexity`. Huey task queued.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Member

🔧 gemini working on this via Huey. Branch: gemini/issue-662

🔧 `gemini` working on this via Huey. Branch: `gemini/issue-662`
Member

🔧 grok working on this via Huey. Branch: grok/issue-662

🔧 `grok` working on this via Huey. Branch: `grok/issue-662`
Member

⚠️ grok produced no changes for this issue. Skipping.

⚠️ `grok` produced no changes for this issue. Skipping.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Owner

🔍 Triaged by Huey — needs assignment.

🔍 Triaged by Huey — needs assignment.
Timmy was assigned by Rockachopa 2026-03-28 03:54:22 +00:00
Owner

Closing during the 2026-03-28 backlog burn-down.

Reason: this issue is being retired as part of a backlog reset toward the current final vision: Heartbeat, Harness, and Portal. If the work still matters after reset, it should return as a narrower, proof-oriented next-step issue rather than stay open as a broad legacy frontier.

Closing during the 2026-03-28 backlog burn-down. Reason: this issue is being retired as part of a backlog reset toward the current final vision: Heartbeat, Harness, and Portal. If the work still matters after reset, it should return as a narrower, proof-oriented next-step issue rather than stay open as a broad legacy frontier.
Timmy closed this issue 2026-03-28 04:52:19 +00:00
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/the-nexus#662