Skip to content

golangast/nlptagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

96 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NLP Tagger - Multi-Orchestrator

An intelligent code generation and project management tool powered by natural language processing. The Multi-Orchestrator understands your intent from natural language commands and generates complete project structures, handlers, databases, and more.

๐Ÿš€ Features

๐Ÿง  Natural Language Understanding

  • Intent Classification: Automatically classifies user commands using MoE (Mixture of Experts) based semantic analysis
  • Named Entity Recognition (NER): Extracts entities like handler names, database names, file paths from natural language
  • Semantic Parsing: Converts natural language into structured semantic output for precise code generation
  • Interactive Clarification: When intent is unclear, the system asks for clarification with helpful options

๐ŸŽจ Custom Intent Creation

Create your own custom intents with reusable code templates:

# Create a new custom intent
> create intent
# or
> new intent

# Follow the interactive prompts:
# 1. Intent name (e.g., 'create_jwt_middleware')
# 2. Description
# 3. Keywords (comma-separated)
# 4. Patterns (comma-separated phrases that trigger this intent)
# 5. Output file path
# 6. Code template (inline or from learning directory)

Template Variables: Use {{.VariableName}} placeholders in your templates for dynamic code generation.

Example Custom Intent:

  • Name: create_jwt_middleware
  • Keywords: jwt, auth, middleware
  • Patterns: add jwt, create jwt middleware
  • Template: Uses Go template syntax with variables like {{.SecretKey}}, {{.TokenExpiry}}

๐Ÿ“š Custom Intent Management

# List all custom intents
> list intents
> show intents

# Remove a custom intent
> remove intent <name>
> delete intent <name>

โช Git-Based Revert System

Every command is automatically committed to Git, enabling powerful revert capabilities:

# Show command history with commit hashes
> show history

# Revert by command ID
> revert 5

# Revert by commit hash
> revert a1b2c3d

# Revert by command text (finds most recent match)
> revert create authentication handler

How it works:

  • Each successful command creates a Git commit
  • Command history is stored in SQLite database with commit hashes
  • Revert uses git reset --hard to restore project state
  • Git history is preserved even when deleting projects

๐Ÿ—๏ธ Intelligent Code Generation

  • Go Web Servers: Generate complete HTTP servers with routing
  • Custom Handlers: Create specific handlers (authentication, user management, etc.)
  • Database Integration: Generate servers with SQLite database support
  • Dockerfile: Automatic Docker containerization
  • README: Auto-generated project documentation

๐Ÿ“– Knowledge Base Learning

The orchestrator learns from your code:

  • Store code templates in the learning/ directory
  • When generating files, the system searches for relevant learned content
  • Interactive selection of learned templates during generation
  • Reuse patterns across projects

๐Ÿ”„ Multi-Agent Architecture

Parallel task execution with specialized agents:

  • Coder Agent: Generates Go server code and handlers
  • DevOps Agent: Creates Dockerfile and deployment configs
  • Documentation Agent: Writes README files
  • QA Agent: Runs tests and builds to validate generated code

๐ŸŽฏ Semantic File Generation

Create complex project structures from natural language:

> create a webserver with authentication handler
> add a database with users table
> create middleware folder with jwt auth

The system understands:

  • File and folder hierarchies
  • Component relationships
  • Code dependencies
  • Project structure conventions

๐Ÿ—„๏ธ Persistent State Management

  • SQLite Database: Stores all commands, generated code, and metadata
  • Git Repository: Tracks all changes with full history
  • Session Continuity: Resume work across sessions
  • Command History: Full audit trail of all operations

๐Ÿ› ๏ธ Usage

Running the Multi-Orchestrator

go run ./cmd/multi_orchestrator

Example Commands

# Create a basic web server
> create a webserver

# Create a server with specific handler
> create a webserver with authentication handler

# Create a server with database
> create a webserver with database users.db

# Delete project (preserves Git history)
> delete project

# View command history
> show history

# Revert to previous state
> revert 3
> revert create authentication

# Create custom intent
> create intent

# List custom intents
> list intents

# Exit
> exit

๐Ÿ“ Project Structure

generated_projects/
โ”œโ”€โ”€ project/                    # Generated project files
โ”‚   โ”œโ”€โ”€ .git/                  # Git repository (preserved on delete)
โ”‚   โ”œโ”€โ”€ server.go              # Generated Go server
โ”‚   โ”œโ”€โ”€ handlers/              # Generated handlers
โ”‚   โ”œโ”€โ”€ database/              # SQLite databases
โ”‚   โ”œโ”€โ”€ Dockerfile             # Docker configuration
โ”‚   โ””โ”€โ”€ README.md              # Project documentation
โ”œโ”€โ”€ orchestrator.db            # Command history and metadata
โ””โ”€โ”€ custom_intents.json        # User-defined custom intents

learning/                       # Knowledge base directory
โ””โ”€โ”€ *.go                       # Learned code templates

cmd/multi_orchestrator/
โ”œโ”€โ”€ main.go                    # Main orchestrator logic
โ”œโ”€โ”€ custom_intents.go          # Custom intent system
โ””โ”€โ”€ knowledge.go               # Knowledge base implementation

๐Ÿงช QA Phase

The orchestrator automatically validates generated code:

  1. Syntax Check: Ensures Go code compiles
  2. Build Test: Attempts to build the project
  3. Error Reporting: Provides detailed error messages
  4. Auto-retry: Prompts for retry on failure

๐Ÿ”ง Advanced Features

Template Variables

Custom intents support Go template syntax:

  • {{.Name}} - Simple variable substitution
  • {{.HandlerName}} - Dynamic handler names
  • {{.DatabasePath}} - File paths
  • Any custom variables you define

Typo Tolerance

Command matching is flexible:

  • Case-insensitive matching
  • Partial phrase matching
  • Keyword-based intent detection

Interactive Workflows

When the system is uncertain:

  1. Shows detected entities
  2. Presents likely intent options
  3. Allows manual intent specification
  4. Supports custom intent creation on-the-fly

๐ŸŽ“ Learning System

Place code templates in the learning/ directory:

learning/
โ”œโ”€โ”€ auth_handler.go
โ”œโ”€โ”€ jwt_middleware.go
โ””โ”€โ”€ database_models.go

When generating similar files, the orchestrator:

  1. Searches for relevant templates
  2. Presents matches to the user
  3. Allows selection of learned content
  4. Applies templates to new files

๐Ÿ” Database Schema

The SQLite database stores:

  • messages: Command history with timestamps
  • commit_hash: Git commit for each command
  • role: User commands vs. generated code
  • content: Full command text or generated code

๐Ÿšฆ Getting Started

  1. Run the orchestrator:

    go run ./cmd/multi_orchestrator
  2. Create your first project:

    > create a webserver with user handler
  3. View what was created:

    ls generated_projects/project/
  4. Create a custom intent:

    > create intent
  5. Experiment with revert:

    > show history
    > revert 1

๐ŸŽฏ Use Cases

  • Rapid Prototyping: Generate project scaffolding in seconds
  • Learning Tool: Understand project structure patterns
  • Template Management: Reuse code patterns across projects
  • Experimentation: Try different approaches with easy revert
  • Custom Workflows: Define your own intents for repeated tasks

๐Ÿ”ฎ Future Enhancements

  • CSV to handler code generation
  • better learning and remembering intent

GPL 3


Built with: Go, SQLite, Git, Neural Networks (MoE), NLP

About

it is package that is changing a lot to do natural language process and guessing intent.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •