Skip to content

Latest commit

Β 

History

History
364 lines (279 loc) Β· 8.26 KB

File metadata and controls

364 lines (279 loc) Β· 8.26 KB

Chat Orchestration - Natural Language Commands

🎯 Overview

The chat now intelligently detects your intent and automatically invokes the right functionality - no slash commands required!

✨ What's New

Previously, you HAD to use slash commands:

❌ Old Way (required):
> /scanrepo
> /contextload
> /swarm
> /make

Now, just talk naturally:

βœ… New Way (natural):
> scan this repository
> load context
> enable swarm mode
> analyze this app

🧠 Intent Detection

The chat router detects 8 types of intents:

1. Scan Intent

Triggers: "scan repo", "scan codebase", "scan this", "scan project"

Example:

You: scan this repository
App: πŸ” Scanning repository...
     [Runs /scanrepo automatically]

2. Analyze Intent

Triggers: "analyze app", "analyze code", "code analysis", "review code"

Example:

You: analyze this app
App: πŸ” Analyzing codebase with AI...
     [Scans if needed, then runs AI analysis]

3. Context Intent

Triggers: "load context", "save context", "show context", "list context"

Example:

You: load context
App: πŸ“‚ Loading saved context...
     [Runs /contextload automatically]

You: show context
App: πŸ“‹ Showing context...
     [Displays context state]

4. Swarm Intent

Triggers: "use swarm", "enable swarm", "swarm mode", "activate swarm"

Example:

You: enable swarm mode
App: 🐝 Swarm Mode Configuration
     Current Status: OFF

     To use swarm mode for analysis:
       1. Swarm is now enabled
       2. Add context: run scan or add files
       3. Use /make with your prompt
       4. Swarm will activate for large contexts

     βœ“ Swarm mode enabled!

5. Status Intent

Triggers: "show status", "check status", "current status"

Example:

You: show status
App: πŸ“Š Current Status

     Platform:   termux
     Provider:   gemini
     Model:      2.5-flash
     Repository: AIworkbench
     Swarm:      🐝 ON (auto, 5 workers)

6. Edit Intent

Triggers: "implement", "add", "fix", "update", "modify", "change", "edit"

Example:

You: add a dark mode toggle
App: πŸ€– Detected code change request. Analyzing repository...
     [Routes to smart_edit automatically]

7. Generate Intent

Triggers: "generate", "scaffold", "boilerplate", "build from scratch"

Example:

You: generate a login page
App: πŸ€– Starting code generation workflow...
     [Enters /make mode automatically]

8. Chat Intent (Questions)

Triggers: "how", "what", "why", "explain", questions with "?"

Example:

You: how does swarm mode work?
App: [Provides explanation via AI chat]

πŸš€ Powerful Workflows

Workflow 1: Quick Analysis

You: scan this repo

App: [Scans all files]
     Context saved: 45 source files + analysis

You: analyze this codebase for improvements

App: [Uses swarm if enabled]
     🐝 Swarm Mode Execution
     Processing 5 chunks with 5 parallel workers
     [Complete analysis provided]

Workflow 2: Enable Swarm & Analyze

You: enable swarm mode

App: βœ“ Swarm mode enabled!

You: use swarm to analyze the app

App: πŸ” Analyzing codebase with AI...
     [Scans if needed]
     🐝 Swarm Mode Execution
     [Multi-agent analysis]

Workflow 3: Context Management

You: scan this project

App: [Scans files]
     Context saved: 30 files

You: show context

App: Context: 0 in-memory, 30 saved + scan

You: load context

App: βœ… Loaded 30 files into memory

You: analyze the architecture

App: [Analyzes with loaded context]

🎯 Best Practices

1. Natural Language Works

βœ… "scan this repo"
βœ… "enable swarm"
βœ… "analyze the codebase"
βœ… "load my context"
βœ… "show current status"

2. Still Use Slash Commands When Specific

βœ… /make     (when you want the make menu)
βœ… /tweak    (when you want tweak mode specifically)
βœ… /context  (when you want the context menu)

3. Questions Stay in Chat

βœ… "How does swarm work?"      β†’ AI explanation
βœ… "What is context?"          β†’ AI explanation
βœ… "Why use swarm mode?"       β†’ AI explanation

4. Commands Are Detected

βœ… "scan this"                 β†’ Runs /scanrepo
βœ… "analyze app"               β†’ Runs analysis workflow
βœ… "enable swarm"              β†’ Enables swarm mode

πŸ” How It Works

Detection Order (Priority)

  1. Scan keywords β†’ Repository scan
  2. Context keywords β†’ Context operations
  3. Swarm keywords β†’ Swarm configuration
  4. Status keywords β†’ Status display
  5. Edit keywords β†’ Code editing
  6. Generate keywords β†’ Code generation
  7. Analyze keywords β†’ AI analysis
  8. Question keywords β†’ AI chat
  9. Default β†’ AI chat

Intent Detection Examples

"scan this repo"
β†’ Matches: "scan.*repo"
β†’ Intent: scan
β†’ Action: auto_scan_repo()
β†’ Result: Repository scanned

"load context"
β†’ Matches: "load.*context"
β†’ Intent: context
β†’ Action: auto_handle_context() β†’ cmd_contextload()
β†’ Result: Context loaded

"enable swarm mode"
β†’ Matches: "enable swarm"
β†’ Intent: swarm
β†’ Action: auto_handle_swarm() β†’ Enables swarm
β†’ Result: Swarm enabled

"analyze this app"
β†’ Matches: "analyze.*app"
β†’ Intent: analyze
β†’ Action: auto_analyze_code() β†’ Scans + analyzes
β†’ Result: AI analysis provided

πŸ“‹ Complete Command Reference

Natural Language β†’ Action Mapping

What You Say What Happens Equivalent Slash Command
"scan this repo" Scans repository /scanrepo
"scan repository" Scans repository /scanrepo
"scan codebase" Scans repository /scanrepo
"analyze app" Scans + AI analysis /scanrepo β†’ /make
"analyze code" Scans + AI analysis /scanrepo β†’ /make
"load context" Loads saved context /contextload
"save context" Saves context /contextsave
"show context" Shows context state /contextshow
"clear context" Clears context /contextclear
"enable swarm" Enables swarm mode /swarm β†’ Enable
"use swarm" Enables swarm mode /swarm β†’ Enable
"swarm mode" Shows swarm menu /swarm
"show status" Shows current status /status
"check status" Shows current status /status
"implement X" Code editing (smart_edit)
"add X" Code editing (smart_edit)
"fix X" Code editing (smart_edit)
"generate X" Code generation /make
"create X" Code editing/generation (context-dependent)

πŸŽ“ Pro Tips

1. Combine Operations

You: enable swarm, then scan and analyze this repo

App: [Enables swarm]
     [Scans repository]
     [Runs AI analysis with swarm]

2. Context-Aware Operations

You: scan this

App: [Scans current directory]

You: now analyze it

App: [Uses just-scanned context for analysis]

3. Chained Workflows

You: load context

App: [Loads 30 files]

You: analyze for security issues

App: [Analyzes loaded files for security]

πŸ› Troubleshooting

Intent Not Detected?

If the chat doesn't detect your intent, try:

  1. Use more specific keywords from the triggers list
  2. Use the slash command directly
  3. Rephrase your request

Examples:

❌ "I want to see the repo"
βœ… "scan this repo"

❌ "turn on that swarm thing"
βœ… "enable swarm mode"

❌ "check what's going on"
βœ… "show status"

Still Goes to AI Chat?

If your command went to AI chat instead of routing:

  1. Check if you used a question word (how, what, why)
  2. Try removing question marks
  3. Use imperative form (commands)

Examples:

❌ "Can you scan the repo?"        β†’ Goes to chat
βœ… "scan the repo"                 β†’ Runs scan

❌ "How do I enable swarm?"        β†’ Goes to chat
βœ… "enable swarm"                  β†’ Enables swarm

πŸŽ‰ Summary

You asked: "Why not possible for chat to use all functionality?!"

Answer: It IS now! Just talk naturally:

  • "scan this" β†’ Scans
  • "analyze app" β†’ Analyzes
  • "enable swarm" β†’ Enables swarm
  • "load context" β†’ Loads context
  • "show status" β†’ Shows status

No slash commands needed! The chat is now truly intelligent. πŸš€


For more information, see:

  • docs/SWARM_MODE_GUIDE.md - Swarm mode details
  • docs/CRITICAL_FIXES.md - Recent bug fixes
  • QUICKSTART.md - Getting started guide