Skip to content

Add diverge strategy for parallel agent generation with cognitive stances#9

Draft
AaronGoldsmith wants to merge 3 commits intomainfrom
claude/analyze-mobius-project-u1m6J
Draft

Add diverge strategy for parallel agent generation with cognitive stances#9
AaronGoldsmith wants to merge 3 commits intomainfrom
claude/analyze-mobius-project-u1m6J

Conversation

@AaronGoldsmith
Copy link
Owner

What

Adds a new diverge() method to AgentBuilder that generates N agents in parallel, each approaching the same task through a distinct cognitive stance (minimalist, lateral, systems, naive, adversarial). Includes optional judge-based ranking and a new CLI command to invoke this strategy.

Why

The existing bootstrap() method generates agents sequentially with predefined specializations. This PR enables exploration of solution diversity by spawning multiple agents with different thinking styles in parallel, allowing the system to discover novel approaches and compare their effectiveness. The judge panel can rank candidates by prompt quality, promoting the best to champion status.

How to test

  • pytest tests/ -v passes
  • Manual: mobius diverge "write a Python CLI tool" --n 5 generates 5 agents with different stances
  • Manual: mobius bootstrap --strategy diverge --task "..." --n 3 seeds initial agents via diverge
  • Verify agents are stored with stance field populated in database
  • Verify judge ranking sorts candidates by score when enabled

https://claude.ai/code/session_012PH76ua8FpCuomTWXS1B9W

…e ranking

Introduces a new agent creation method that spawns N parallel Opus calls,
each seeded with a different cognitive stance (minimalist, lateral, systems,
naive, adversarial), then optionally ranks them via the judge panel before
registration. This produces genuinely diverse agents from a single task.

- Add `stance` field to AgentRecord (models.py) + DB migration (db.py)
- Add `AgentBuilder.diverge()` with parallel async generation + judge ranking
- Add `mobius diverge "<task>" --n 5 --no-judge` CLI command
- Add `--strategy diverge --task "<task>"` flag to `mobius bootstrap`

https://claude.ai/code/session_012PH76ua8FpCuomTWXS1B9W
Copilot AI review requested due to automatic review settings March 16, 2026 04:54
@AaronGoldsmith AaronGoldsmith marked this pull request as draft March 16, 2026 04:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “diverge” agent-generation strategy that spawns multiple agents in parallel using different cognitive stances, persists the stance in the DB/model, optionally judge-ranks candidates, and exposes the workflow via CLI.

Changes:

  • Add stance to AgentRecord and persist it in SQLite (including a migration for existing DBs).
  • Implement AgentBuilder.diverge() to generate N agents concurrently across predefined cognitive stances and optionally rank them via JudgePanel.
  • Extend CLI: mobius bootstrap --strategy diverge ... and add a new mobius diverge ... command.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/mobius/models.py Adds stance field to the agent record model.
src/mobius/db.py Adds stance column to schema and a migration for existing DBs.
src/mobius/cli.py Adds bootstrap diverge strategy options and introduces mobius diverge command.
src/mobius/agent_builder.py Implements parallel stance-based generation and optional judge ranking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +352 to +355
task: str = typer.Argument(..., help="Task description to generate diverse agents for"),
n: int = typer.Option(5, "--n", "-n", help="Number of divergent agents to generate"),
no_judge: bool = typer.Option(False, "--no-judge", help="Skip judge ranking — register all candidates"),
verbose: bool = typer.Option(False, "--verbose", "-v"),
Comment on lines +437 to +441
provider=data.get("provider", "anthropic"),
model=data.get("model", "claude-haiku-4-5-20251001"),
tools=data.get("tools", ["Bash", "Read", "Grep", "Glob"]),
specializations=data.get("specializations", []),
stance=stance_name,
Comment on lines +160 to +163
def bootstrap(
strategy: str = typer.Option("default", "--strategy", "-s", help="Strategy: 'default' (sequential specializations) or 'diverge' (parallel stances)"),
task: str = typer.Option(None, "--task", "-t", help="Task description (required for --strategy diverge)"),
n: int = typer.Option(5, "--n", "-n", help="Number of agents for diverge strategy"),
Comment on lines +162 to +163
task: str = typer.Option(None, "--task", "-t", help="Task description (required for --strategy diverge)"),
n: int = typer.Option(5, "--n", "-n", help="Number of agents for diverge strategy"),
Copy link

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

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: 1aecc4bacc

ℹ️ 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".

agent.is_champion = True # First of their kind = champion
registry.create_agent(agent)
console.print(f"[green]Created: {agent.name} ({agent.provider}/{agent.model})[/green]")
if strategy == "diverge":

Choose a reason for hiding this comment

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

P2 Badge Reject unknown bootstrap strategies

The new --strategy flag is documented in the option help as a two-mode switch (default or diverge), but the implementation only checks strategy == "diverge" and silently falls back to default for every other value. A typo like --strategy divergee will run sequential bootstrap instead of failing, which can invalidate experiment setup while still consuming provider calls. Please validate strategy against the supported set and exit with an error on unknown values.

Useful? React with 👍 / 👎.

Comment on lines +186 to +190
if registry.get_agent_by_slug(agent.slug):
console.print(f"[yellow]Skipping {agent.slug} — already exists[/yellow]")
continue
agent.is_champion = (i == 0) # Judge winner is champion
registry.create_agent(agent)

Choose a reason for hiding this comment

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

P2 Badge Promote first inserted diverged agent to champion

In the diverge bootstrap flow, slug conflicts are skipped before champion assignment is applied by index, so if the top-ranked candidate already exists, every newly inserted agent gets is_champion=False. This means a judged bootstrap run can register zero champions even when it successfully generated alternatives, which breaks the command’s stated winner-promotion behavior for reruns or partially seeded registries.

Useful? React with 👍 / 👎.

AaronGoldsmith and others added 2 commits March 15, 2026 22:05
Enables skills (like /mobius-seed) to search the agent registry
semantically before creating new agents, avoiding duplicates at
scale (50-10k+ agents). Embeds agent descriptions at creation
time using sentence-transformers + sqlite-vec.

- Add agent_vec virtual table to db.py schema
- Embed agent descriptions on create in registry.py
- Add find_agents.py script for vec-based agent search
- Update /mobius-seed skill to use semantic search
- Pass vec_available through to Registry constructors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

3 participants