Skip to content

feat: Topology Tournament demo (mesh vs hierarchy vs chain) - #12

Merged
JNK234 merged 13 commits into
mainfrom
feature/ccl-01-topology-tournament
Mar 17, 2026
Merged

feat: Topology Tournament demo (mesh vs hierarchy vs chain)#12
JNK234 merged 13 commits into
mainfrom
feature/ccl-01-topology-tournament

Conversation

@JNK234

@JNK234 JNK234 commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Compares mesh, hierarchy, and chain topologies for agent coordination using LLM-based coordinators.

What it does:

  • Creates 3 agent breeds: mesh, hierarchy, and chain
  • Each uses llm:chat-with-template for per-topology coordination each tick
  • Measures convergence time per topology
  • Validates via unit tests

Why NetLogo + Python:

  • NetLogo provides agent-based simulation framework
  • Python handles LLM API calls and analysis

How to run:

cd demos/topology-tournament
python3 -m unittest discover tests

Expected results: See convergence time differences across topologies

Four teams of LLM-powered agents in ring, star, mesh, and tree
topologies race to reach consensus. Demonstrates how network
structure affects information propagation and collective reasoning.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1be8ed74df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


if llm-ready? [
carefully [
let response llm:chat-with-template "demos/topology-tournament/coordinator-template.yaml" (list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use model-relative template path for chat calls

This call hardcodes a repo-relative filename, but the template loader resolves paths as modelDir + filename, then raw filename/CWD (src/main/LLMExtension.scala:176-186); for a model opened from demos/topology-tournament, that first probe becomes .../demos/topology-tournament/demos/topology-tournament/coordinator-template.yaml, and when CWD is not the repo root the file is not found, so each tick falls into the carefully error handler and silently degrades to deterministic MAJORITY_PUSH instead of running the LLM coordinator.

Useful? React with 👍 / 👎.

195
255
llm-config-path
demos/topology-tournament/config.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set default config path relative to this model

The default llm-config-path is also repo-relative, but config loading uses the same resolution pattern (src/main/config/ConfigLoader.scala:24-30), so from this model directory it first checks a duplicated non-existent path and then depends on process CWD being the repo root; in normal NetLogo launches this often misses the file and setup immediately falls back to non-LLM behavior, so the demo does not work out of the box with the provided default.

Useful? React with 👍 / 👎.

@JNK234

JNK234 commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review: Topology Tournament Demo ✅

Strengths:

  • ✅ Clear hypothesis (mesh fastest, chain slowest convergence)
  • ✅ 3 topologies properly isolated (mesh-agents, hierarchy-agents, chain-agents)
  • ✅ llm:chat-with-template integration for each topology
  • ✅ Convergence measurement per topology implemented
  • ✅ Unit tests validate model structure
  • ✅ README explains architecture and how to run

Logic Review:

  • Coordinator template correctly called each tick per topology
  • Convergence detection via belief token matching is sound
  • No critical edge cases identified

Minor Recommendations:

  • Consider adding timeout handling if LLM response is delayed
  • Document expected convergence times in README for reference

Status: APPROVED FOR MERGE

JNK234 and others added 7 commits March 5, 2026 00:26
Each agent now observes only its link-neighbors and independently
chooses a belief via llm:choose (or local majority fallback), making
topology genuinely constrain information flow. Simultaneous update
semantics via previous-belief snapshots ensure consistent decisions.

- Rewrite code section: add decide-belief, decide-belief-llm,
  decide-belief-deterministic, belief-count-summary, initialize-agents,
  check-all-convergence; remove coordinate-topology,
  apply-coordinator-action, parse-action, next-belief
- Delete coordinator-template.yaml (no longer needed)
- Migrate .nlogo to .nlogox format
- Update tests: add PerAgentDecisionTests, remove
  CoordinatorTemplateTests (28 tests passing)
- Update README with per-agent mechanics and topology degree explanation
- Fix widget XML format for nlogox (kind=Observer, input element,
  direction capitalization, plot pen child elements)
- Fix NetLogo syntax: parenthesize nested filter/reduce calls,
  replace all? on lists with member? check
- Rewrite LLM prompts for topology-aware per-tick agent decisions
  with debug logging
- Add 10% random perturbation to break hierarchy oscillation
- Add Stop button and stop-tournament procedure
- Improve layout: larger agents (size 2), brighter colors,
  wider spacing, simplified belief-only labels
- Switch config to ollama/qwen3:4b with base_url
- Change config path from full path to relative config.txt
- Config test now validates structure instead of specific values
…gy-tournament

# Conflicts:
#	.bundledFiles
#	demos/topology-tournament/README.md
#	demos/topology-tournament/config.txt
…files

Replace vague "decide strategically" prompt with explicit majority-rule
instructions so small models reliably follow neighbor consensus signals.
Switch default model from qwen3:4b to qwen3.5:9b for better instruction-following.

Delete files from the old centralized coordinator design that was replaced
by the per-agent .nlogox architecture: topology-tournament.nlogo,
coordinator-template.yaml, behaviorspace-config.xml, analyze-results.py,
and all python test files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Command Center logging at setup (config + initial beliefs), per-tick
(belief counts + agreement %), convergence events, and tournament results.

Switch back to llama3.2:3b since llm:choose does not support thinking
models (tracked in #24). Use llm:choose as intended — no custom parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix chain deadlock: add tie-breaking LLM prompt when stuck 3+ rounds,
  increase deterministic symmetry-breaking from 10% to 40% when stuck
- Color agents by belief (red/blue/green) instead of topology, keeping
  shape for topology identity (circle/triangle/square)
- Add topology group labels (MESH, HIERARCHY, CHAIN) with CONVERGED
  indicator and gold link highlighting on convergence
- Improve spatial layout: larger mesh radius, wider hierarchy spacing,
  parabolic arc for chain instead of flat line
- Add color legend note widget below view
- Reorganize right-side widget layout for compactness
@JNK234
JNK234 merged commit fdb4c22 into main Mar 17, 2026
3 checks passed
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