Skip to content

buildworksai/AgentHub

Repository files navigation

AgentHub

BuildWorks.AI License VS Code

Part of the BuildWorks.AI Open Source AI Tooling Ecosystem

Your AI agent command center for VS Code

Website β€’ GitHub β€’ Documentation β€’ Report Issue


Overview

AgentHub is your central command center for AI agent workflows in VS Code. It auto-initializes a complete agent workspace with slash commands, reusable skills, and configurable rules enforcement on first activation.

Built by BuildWorks.AI β€” creators of SARAISE (AI-Enabled ERP) and AISTRALE (LLM Engineering Platform).

Features

πŸš€ Auto-Initialize Agent Workspace

  • One-click setup: Automatically creates .agent/ structure on first activation
  • Example commands: Pre-configured approval, review, and investigation commands
  • Example skills: React best practices, testing patterns, security audit
  • Comprehensive documentation: Auto-generated .agent/README.md explaining structure

⚑ Slash Commands

  • Quick access: Press Cmd+/ (Mac) or Ctrl+/ (Windows/Linux) for command picker
  • Browse commands: Visual menu showing all available .agent/commands/*.md files
  • Instant use: Command content copied to clipboard for pasting in AI chat
  • Edit mode: Quick access to open and customize command files

πŸ“‹ Rule Enforcement

  • Rule source: Reads rules from .agent/rules directory (supports nested folders)
  • Multiple formats: YAML, JSON, Markdown, and plain text rule files
  • Real-time linting: Diagnostics on document open, save, and change (configurable debounce)
  • Quick fixes: Automated fixes where rules define them
  • Save blocking: Block file saves when errors/warnings exist (configurable)
  • Build integration: CLI script for CI/CD pipelines and pre-commit hooks
  • Strict mode: Multiple enforcement levels from passive to draconian
  • Status bar: Shows current enforcement mode at a glance
  • Path filtering: Include/exclude patterns using minimatch globs
  • Language filtering: Target specific programming languages
  • Workspace scanning: Command to scan entire workspace for violations
  • Auto-reload: Watches .agent/rules/** and reloads on changes
  • Fully configurable: All features can be enabled/disabled via settings

Getting Started

1. Install Extension

When you first activate the extension, it automatically creates:

.agent/
β”œβ”€β”€ rules/              # Your linting rules
β”œβ”€β”€ commands/           # Slash commands (approval, review, investigate)
β”‚   β”œβ”€β”€ approval.md
β”‚   β”œβ”€β”€ review.md
β”‚   └── investigate.md
β”œβ”€β”€ skills/             # Reusable agent expertise
β”‚   β”œβ”€β”€ react-best-practices/
β”‚   β”œβ”€β”€ testing-patterns/
β”‚   └── security-audit/
└── README.md          # Complete documentation

2. Use Slash Commands

Press Cmd+/ (or Ctrl+/) to open the command picker. Select a command to copy it to your clipboard, then paste in your AI agent chat (GitHub Copilot, Cursor, Claude, etc.).

Example: Code Review

  1. Press Cmd+/
  2. Select "review"
  3. Paste in chat
  4. Agent performs comprehensive architectural review

3. Define Rules

YAML Format

Create .agent/rules/example.yaml:

version: 1
rules:
  - id: no-console-log
    severity: warn
    message: "Avoid console.log in production code"
    match:
      languages: [javascript, typescript]
      regex: "console\\.log\\("
      pathExclude: ["**/test/**", "**/*.test.ts"]
    fix:
      kind: replace
      replaceWith: "// console.log("

  - id: todo-must-have-ticket
    severity: error
    message: "TODO comments must reference a ticket number"
    match:
      regex: "TODO(?!\\(JIRA-\\d+\\))"
      flags: "gi"

  - id: forbidden-rbac-todo
    severity: error
    message: "RBAC TODOs are not allowed"
    match:
      regex: "TODO\\(RBAC\\)"
      flags: "g"
    fix:
      kind: delete

JSON Format

Create .agent/rules/example.json:

{
  "version": 1,
  "rules": [
    {
      "id": "no-hardcoded-secrets",
      "severity": "error",
      "message": "Hardcoded API keys detected",
      "match": {
        "regex": "(api[_-]?key|secret)[\\s]*=\\s*['\"][^'\"]{20,}['\"]",
        "flags": "i"
      }
    }
  ]
}

Markdown/Text Format

Create .agent/rules/simple-rules.md:

# Simple Rules

error: No debugger statements allowed :: debugger;
warn: Prefer const over let :: \\blet\\b
info: Consider using async/await :: \\.then\\(

Format: SEVERITY: <message> :: <regex>

  • SEVERITY: error, warn, or info (defaults to warn if omitted)
  • :: separator is required
  • Lines starting with # are comments

Rule Schema

Structured Rules (YAML/JSON)

{
  id: string              // Unique identifier
  severity: "error" | "warn" | "info"
  message: string         // Diagnostic message
  match: {
    languages?: string[]   // Filter by language IDs (e.g., ["typescript", "javascript"])
    regex: string          // Regular expression pattern
    flags?: string         // Regex flags (default: "g")
    pathInclude?: string[] // Include paths matching these globs
    pathExclude?: string[] // Exclude paths matching these globs (takes priority)
  }
  fix?: {                  // Optional quick fix
    kind: "replace" | "insert" | "delete"
    replaceWith?: string   // For "replace" kind
    insertText?: string    // For "insert" kind
    position?: "start" | "end"  // For "insert" kind
  }
}

Text Rules (Markdown/Plain Text)

Simple line-based format:

SEVERITY: <message> :: <regex>

Examples:

error: No console.error allowed :: console\\.error\\(
warn: Avoid var keyword :: \\bvar\\b
info: Consider using template literals :: '.*\\+.*'

Commands

Command Description
Agent Rules: Scan Workspace Scan all files in workspace (max 2000 files)
Agent Rules: Open Rules Folder Open/create .agent/rules folder
Agent Rules: Enable Strict Mode Enable save blocking with override + reason required
Agent Rules: Disable Strict Mode Switch to passive mode (diagnostics only)
Agent Rules: Toggle Save Blocking Toggle save blocking on/off
Agent Rules: Temporarily Disable Disable for current session only

Strict Enforcement

Enforcement Modes

Passive Mode (Default)

  • Shows diagnostics only
  • No save blocking
  • User awareness

Active Mode

  • Blocks saves when errors/warnings found
  • Allows override with optional reason
  • Status bar shows warning icon

Strict Mode

  • Blocks saves on errors
  • Requires reason for override
  • Recommended for team enforcement

Draconian Mode

  • Blocks saves on errors
  • No override allowed
  • Must fix before saving

Configuration

Access via Settings UI (Cmd+,) or .vscode/settings.json:

{
  // Master switch
  "agentRules.enabled": true,
  
  // Save blocking
  "agentRules.blockSaveOnErrors": false,      // Block on errors
  "agentRules.blockSaveOnWarnings": false,    // Block on warnings
  "agentRules.allowSaveOverride": true,       // Allow override
  "agentRules.requireOverrideReason": false,  // Require reason
  
  // Build integration
  "agentRules.failBuildOnErrors": false,
  "agentRules.failBuildOnWarnings": false,
  
  // General
  "agentRules.autoFix": false,                // Auto-apply fixes on save
  "agentRules.debounceMs": 250,               // Typing delay
  "agentRules.rulesPath": ".agent/rules",     // Custom rules location
  "agentRules.maxFilesToScan": 2000,          // Workspace scan limit
  "agentRules.showStatusBar": true            // Show mode indicator
}

Build Integration

Use the CLI checker in your build pipeline:

# NPM script
npm run check-rules

# Pre-commit hook
echo "npm run check-rules" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

# GitHub Actions
- name: Check Agent Rules
  run: npm run check-rules

The script exits with code 1 if violations found, failing the build.

Status Bar Indicators

  • πŸ›‘οΈ Agent Rules: Strict - Strict mode (red background)
  • ⚠️ Agent Rules: Active - Save blocking enabled (yellow)
  • ℹ️ Agent Rules: Passive - Diagnostics only
  • 🚫 Agent Rules: Disabled - Temporarily disabled

Default Ignored Folders

The following folders are automatically excluded from scanning:

  • **/node_modules/**
  • **/.git/**
  • **/dist/**
  • **/build/**
  • **/out/**

Override with pathInclude in individual rules.

Path Filtering Examples

# Only TypeScript files in src/
match:
  pathInclude: ["**/src/**/*.ts"]

# Exclude test files
match:
  pathExclude: ["**/*.test.ts", "**/*.spec.ts"]

# Both include and exclude
match:
  pathInclude: ["**/src/**"]
  pathExclude: ["**/src/test/**"]

Quick Fix Examples

# Replace
fix:
  kind: replace
  replaceWith: "// FIXED: "

# Delete
fix:
  kind: delete

# Insert at start
fix:
  kind: insert
  insertText: "// @ts-ignore\n"
  position: start

# Insert at end
fix:
  kind: insert
  insertText: " // TODO: review"
  position: end

Requirements

  • VS Code 1.107.0 or higher
  • Node.js (for development)

Extension Settings

This extension does not contribute any VS Code settings. All configuration is done via .agent/rules files.

Known Issues

  • Workspace scan is capped at 2000 files for performance
  • Very complex regex patterns may impact performance
  • Text-based rules (Markdown/plain text) do not support quick fixes unless a clear mapping exists

Development

Build from Source

npm install
npm run compile

Watch Mode

npm run watch

Package Extension

npm install -g @vscode/vsce
vsce package

About BuildWorks.AI

BuildWorks.AI builds enterprise-grade AI products with a commitment to open source innovation. We believe in democratizing AI for businesses worldwide.

Our Products

  • SARAISE β€” AI-Enabled Enterprise ERP (Apache 2.0)
  • AISTRALE β€” LLM Engineering & Observability Platform (Apache 2.0)
  • AI Agents Org β€” Enterprise Multi-Agent Orchestration (Enterprise)
  • AgentHub β€” AI agent command center for VS Code (Apache 2.0)

Connect With Us


License

Apache 2.0

Copyright Β© 2025 BuildWorks.AI (BuildFlow Consultancy Private Limited)

Licensed under the Apache License, Version 2.0. This is part of BuildWorks.AI's commitment to Open Source First β€” democratizing AI-powered automation for businesses worldwide.


Power your AI agent workflows with AgentHub by BuildWorks.AI!

About

AgentHub is your central command center for AI agent workflows in VS Code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors