Skip to content

Add semantic agent search via agent_vec and find_agents.py#9

Merged
AaronGoldsmith merged 4 commits intomainfrom
claude/analyze-mobius-project-u1m6J
Mar 21, 2026
Merged

Add semantic agent search via agent_vec and find_agents.py#9
AaronGoldsmith merged 4 commits intomainfrom
claude/analyze-mobius-project-u1m6J

Conversation

@AaronGoldsmith
Copy link
Copy Markdown
Owner

@AaronGoldsmith AaronGoldsmith commented Mar 16, 2026

Summary

  • Add agent_vec virtual table for embedding agent descriptions via sqlite-vec
  • Embed agent descriptions at creation time in Registry.create_agent()
  • Add find_agents.py script for semantic similarity search across the agent registry
  • Pass vec_available flag through to Registry constructor
  • Update /mobius-seed skill to use semantic search before creating agents (avoid duplicates)

Why

At scale (50-10k+ agents), exact-match dedup isn't enough. Agents with different names but similar descriptions waste competition slots. Semantic search lets skills check "does something like this already exist?" before creating new agents.

Files changed

  • src/mobius/registry.pyvec_available param, _embed_agent() on create
  • src/mobius/db.pyAGENT_VEC_TABLE_SQL, create in init_db
  • src/mobius/cli.py — Pass vec_available to Registry
  • .claude/skills/mobius-seed/scripts/find_agents.py — New semantic search script
  • .claude/skills/mobius-seed/scripts/create_agent.py — Use 3-arg Registry
  • .claude/skills/mobius-seed/SKILL.md — Updated instructions

Test plan

  • pytest tests/ -v
  • python .claude/skills/mobius-seed/scripts/find_agents.py "write python code" --top 5 returns ranked agents
  • Creating an agent embeds its description in agent_vec

🤖 Generated with Claude Code

…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
Copy Markdown

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 thread src/mobius/cli.py Outdated
Comment thread src/mobius/agent_builder.py Outdated
Comment thread src/mobius/cli.py Outdated
Comment thread src/mobius/cli.py Outdated
Copy link
Copy Markdown

@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".

Comment thread src/mobius/cli.py
Comment thread src/mobius/cli.py Outdated
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>
@AaronGoldsmith AaronGoldsmith changed the title Add diverge strategy for parallel agent generation with cognitive stances Add semantic agent search via agent_vec and find_agents.py Mar 21, 2026
…Bash in tools

- Add `diverge` CLI command and `AgentBuilder.diverge()` method for generating
  N diverse agent variants per specialization
- Validate `n >= 1` in both `bootstrap` and `diverge` commands
- Validate `strategy` parameter in `bootstrap` against ("default", "diverge")
- Ensure "Bash" is always present and first in tools list in diverge's _generate_one
- Fix champion assignment in bootstrap diverge flow: track first actually inserted
  agent rather than using index-based assignment that breaks when slugs are skipped

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AaronGoldsmith AaronGoldsmith marked this pull request as ready for review March 21, 2026 17:04
@AaronGoldsmith AaronGoldsmith merged commit 56ba85d into main Mar 21, 2026
2 checks passed
@AaronGoldsmith AaronGoldsmith deleted the claude/analyze-mobius-project-u1m6J branch March 21, 2026 17:05
Copy link
Copy Markdown

@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: 918abde0be

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

Comment thread .claude/skills/mobius-seed/scripts/find_agents.py
Comment thread src/mobius/registry.py
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