🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

huagent

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

huagent

AI coding agent CLI — 22 LLM providers, 101 models, wiki knowledge engine, OpenCode-inspired TUI, MIT-licensed

Source
npmnpm
Version
6.3.0
Version published
Weekly downloads
68
-9.33%
Maintainers
1
Weekly downloads
 
Created
Source
Huagent v6.0.0

Huagent

The AI Coding Agent That Learns Your Codebase

A production-grade AI coding agent in your terminal — powered by a wiki knowledge engine, OpenCode-inspired TUI, and 22 LLM providers.

npm Downloads Node License Tests Providers Models

Install · Features · Providers · Usage · Contributing · Docs

🖥️ Preview

  ╔════════════════════════════════════════════════════════════════════╗
  ║  huagent v6.0.0                                                     ║
  ║  AI coding agent CLI — 22 providers, 101 models                     ║
  ╚════════════════════════════════════════════════════════════════════╝

  │  Ask, search, or run /help for commands
  │  huagent · claude-sonnet-4   anthropic
  ╰
     ready · ↵ send · alt+↵ newline · ↑↓ history · tab complete · ctrl+c exit
  ~/projects/myapp • 2 LSP  /status
  tokens: 1247  cost: $0.0089  perm: workspace-write  ? help  Ctrl+P/T/E/R pickers

⚡ Install

npm install -g huagent

Option 2: One-liner (from source)

curl -fsSL https://raw.githubusercontent.com/ahmdd4vd/Huagent/main/install.sh | sh

Option 3: From source (manual)

git clone https://github.com/ahmdd4vd/Huagent.git
cd Huagent
npm install
npm run build
node bin/huagent.js

Quick Start

# Set any provider's API key
export ANTHROPIC_API_KEY=sk-ant-***   # or OPENAI_API_KEY, GEMINI_API_KEY, etc.

# Launch the TUI
huagent

Node.js >= 18 required. Huagent auto-detects your provider from environment variables — set one and you're ready.

✨ Features

🧠 Wiki Knowledge Engine🎨 OpenCode-Inspired TUI🔌 22 LLM Providers
5-memory system that learns from your codebaseLeft-border prompt, minimal aesthetic, braille spinnersAnthropic, OpenAI, Gemini, DeepSeek, Groq, +17 more
🔄 Auto-Ingest⌨️ Full Keyboard Control🛡️ Security-First
Watches files & auto-creates wiki pagesEmacs keys, multi-line, history, autocompleteSSRF protection, path-traversal guards, default-deny
📊 Cost Tracking🔍 Smart Search🧪 239 Tests
Real-time token count + cost per requestFuzzy matching with intent-based routingComprehensive test suite covering all subsystems

🧠 WllmConcept — Knowledge That Grows

Huagent ships with a wiki knowledge engine that makes your agent smarter over time.

┌─────────────────────────────────────────────────────────┐
│                  5-Memory System                         │
│                                                         │
│   Semantic ──── Facts, concepts, entities               │
│   Episodic ──── Events, debugging sessions              │
│   Structural ── Architecture, dependencies              │
│   Causal ────── Decisions, tradeoffs, migrations        │
│   Meta ──────── Self-reflection, heuristics             │
│                                                         │
│   Confidence: ASSUMED → INFERRED → VERIFIED             │
│   Freshness:  LOW → MEDIUM → HIGH → STALE               │
└─────────────────────────────────────────────────────────┘
  • Auto-Ingest — File watcher extracts functions, classes, patterns, and relationships automatically
  • Scheduled Lint — 7 quality checks with A–F grading and auto-fix
  • Evolve — Detects contradictions, suggests new pages, refreshes stale knowledge at session end
  • Intent-Based Routing — "what is", "how to", "why", "when", "compare", "pattern", "history"

🎨 Modern TUI (OpenCode-Inspired)

  • Left-border prompt — signature OpenCode look, no boxy borders
  • Braille spinners (⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏) for thinking/writing states
  • Multi-line input — Alt+Enter inserts newline, ↑↓ navigate between lines
  • Emacs editing — Ctrl+A/E (line start/end), Ctrl+U/K (delete to start/end), Ctrl+W (delete word)
  • History navigation — ↑↓ through previous prompts
  • Slash command autocomplete — type /mod → get /model, /models, /modes
  • Global shortcuts — Ctrl+P (provider), Ctrl+T (model), Ctrl+E (scope), Ctrl+R (resume), Ctrl+L (clear), ? (help)
  • Tool call badges — inline status (✓ success, ✗ error, ⠋ running)
  • Footer status bar — directory, LSP/MCP counts, /status hint
  • Responsive layout — adapts to terminal width and height

⌨️ Full Keyboard Control

KeyAction
EnterSubmit prompt
Alt+Enter / Shift+EnterInsert newline (multi-line)
/ Navigate history (single-line) or cursor (multi-line)
/ Move cursor horizontally
Ctrl+A / HomeMove to line start
Ctrl+E / EndMove to line end
Ctrl+UDelete to line start
Ctrl+KDelete to line end
Ctrl+WDelete previous word
TabAccept autocomplete suggestion
EscClose autocomplete / dialog
Ctrl+CExit huagent
Ctrl+POpen provider picker
Ctrl+TOpen model picker
Ctrl+EOpen scope picker
Ctrl+RResume previous session
Ctrl+KCommand palette
Ctrl+LClear messages
?Show help dialog

🛡️ Security-First Design

  • SSRF protectionweb tool blocks private IPs, loopback, cloud metadata (169.254.169.254), link-local
  • Path traversal guards — session ids, /export filenames validated against ^[A-Za-z0-9_-]+$
  • Shell injection preventiongrep and hooks use execFile with arg arrays (no shell interpolation)
  • Default-deny permissions — unknown tools are denied by default in workspace-write mode
  • OAuth secret hardening — Google OAuth secrets support env override (HUAGENT_GOOGLE_*_CLIENT_SECRET)
  • ZIP-bomb protection — bundle reader tracks actual decompressed bytes, not just reported size

🌐 Providers

22 providers, 101 models. Each with a default model, full registry, and capability metadata.

CategoryModels
FlagshipClaude Opus 4.7, Claude Sonnet 4.6, GPT-5.5, Gemini 3 Pro, Grok 4
ReasoningDeepSeek R1, o3, QwQ 32B, Sonar Reasoning, Magistral Medium
FastClaude Haiku 4.5, GPT-5 mini, Llama 3.1 8B, Gemini 3 Flash
CodeQwen 3 Coder 480B, Codestral 25, DeepSeek Coder V2, GPT-5.5 Codex
Local (free)Ollama (Llama 3.2, Qwen 2.5 Coder 32B, DeepSeek R1 32B)
SearchPerplexity Sonar Pro
CloudAWS Bedrock, Google Vertex AI

Browse in the TUI:

/providers              # all 22 providers
/models                 # models for current provider
/models anthropic       # models for a specific provider

Auto-Detect

Set any of these env vars and huagent picks the provider automatically:

Click to expand all 22 environment variables
Env varProvider
ANTHROPIC_API_KEYAnthropic Claude
OPENAI_API_KEYOpenAI
GEMINI_API_KEYGoogle Gemini
MINIMAX_API_KEYMiniMax
TOKENROUTER_API_KEYCustom (TokenRouter)
GROQ_API_KEYGroq
DEEPSEEK_API_KEYDeepSeek
OPENROUTER_API_KEYOpenRouter
GITHUB_TOKENGitHub Copilot
HF_TOKENHuggingFace
PERPLEXITY_API_KEYPerplexity
TOGETHER_API_KEYTogether AI
FIREWORKS_API_KEYFireworks AI
CEREBRAS_API_KEYCerebras
XAI_API_KEYxAI Grok
MISTRAL_API_KEYMistral
NVIDIA_API_KEYNVIDIA NIM
OPENCODE_API_KEYOpenCode Zen
CODEX_API_KEYOpenAI Codex
MIMO_API_KEYXiaomi MiMo
AWS_BEARER_TOKEN_BEDROCKAWS Bedrock
GOOGLE_APPLICATION_CREDENTIALSGoogle Vertex AI

🛠️ Usage

Slash Commands

CommandWhat it does
/model <name>Switch LLM model
/provider <name>Switch provider
/modelsBrowse all 101 models
/providersList all 22 providers
/autonomousToggle autonomous mode
/scope <file>Limit edits to one file
/permissions <mode>Switch permission mode
/memoryInspect knowledge base
/skillsList installed skills
/statusSession status + stats
/costToken usage + cost breakdown
/sessionsList saved sessions
/resume <id>Resume a session
/diffShow git diff
/doctorRun diagnostics
/clearFresh session
/helpShow all commands
/exitExit huagent

CLI Flags

huagent                                              # interactive TUI
huagent "fix the auth bug"                           # one-shot mode
huagent --provider anthropic --model claude-sonnet-4 # pick provider + model
huagent --autonomous                                 # no confirmations
huagent --scope src/auth.ts                          # limit to one file
huagent --permission-mode sandboxed                  # sandboxed edits
huagent --no-tui                                     # simple REPL mode
huagent version                                      # show version
huagent --help                                       # show help

Permission Modes

ModeWhat you can do
read-onlyRead files, no edits
workspace-writeEdit project files (default)
sandboxedEdits go to a temp directory
danger-full-accessNo confirmations at all
allowAuto-approve everything (autonomous)

📊 By the Numbers

MetricValue
LLM Providers22
Models101
Tests239 passing
Source Files130+ TS/TSX
Slash Commands26
Permission Modes5
Memory Systems5
TUI Components20+
Documentation6,000+ lines
Lines of Code25,000+
Security Fixes72 bugs fixed
Keyboard Shortcuts20+

🧪 Testing

npm test              # run all 239 tests
npm run verify        # lint + test + build
SuiteTestsWhat it covers
Provider integrity35022 providers, 101 models, pricing, auto-detect
TUI stress153Visual regression, 40–240 cols, unicode, edge cases
Discipline181Plan → Ground → Observe → Diagnose → Verify
TUI v4119Theme, activity store, status bar, slash commands
CLI commands68All 26 slash commands, option parsing
WllmConcept26WikiMemory, 5-memory routing, lint, evolve
Auto-Ingest25Content analyzer, file watcher, page creation
OpenCode TUI52Theme, borders, MessageList, Prompt, Picker, Dialog
Keyboard16Enter, Esc, Tab, Ctrl+C/U/W, Alt+Enter, arrows
App shortcuts8Ctrl+P/T/E/L, ?, stats, footer
Security25SSRF, path traversal, LRU, dialog reset, limit:0
Render23MessageList, Footer, Dialog, Picker rendering

🏗️ Architecture

src/
├── cli.tsx                   # entry point, bootstrap, arg parsing
│
├── providers/                # 22-provider abstraction layer
│   ├── registry.ts           # provider registry + auto-detect
│   ├── models.ts             # 101-model catalog with pricing
│   ├── client.ts             # unified streaming client
│   ├── capabilities.ts       # model capability metadata
│   ├── pricing.ts            # cost calculation engine
│   └── executors/            # provider-specific executors
│
├── engine/                   # AI engine core
│   ├── core.ts               # main engine loop + WikiStore integration
│   ├── wiki-memory.ts        # backward-compatible wiki memory wrapper
│   └── v4/                   # stream-native actor model
│       ├── discipline/       # Plan → Ground → Observe → Diagnose → Verify
│       ├── stream/           # SSE pipeline + cognitive events
│       ├── actor/            # actor model + supervisor
│       ├── htn/              # hierarchical task network planner
│       └── graph/            # SQLite-backed graph store
│
├── tui/                      # terminal user interface
│   ├── OpenCodeApp.tsx       # production TUI (OpenCode-inspired)
│   └── oc/                   # OpenCode-style components
│       ├── theme.ts          # 12-step grayscale + semantic palette
│       ├── border.ts         # SplitBorder, LeftBorder, TopBorder
│       ├── MessageList.tsx   # chat history with tool call badges
│       ├── Prompt.tsx        # left-border textarea + autocomplete
│       ├── Footer.tsx        # status bar (directory, LSP, MCP)
│       ├── Dialog.tsx        # modal dialogs (confirm, alert, help)
│       └── Picker.tsx        # fuzzy-searchable list dialog
│
├── wllm/                     # wiki knowledge engine
│   ├── graph/                # WikiStore (bi-temporal property graph)
│   ├── ingest/               # content analyzer + auto-ingest
│   ├── lint/                 # quality audit (7 checks, A–F grade)
│   ├── evolve/               # self-reflection engine
│   └── query/                # intent-based search + 5-memory routing
│
├── tools/                    # built-in tools (bash, file ops, search, git)
├── memory/                   # SQLite-backed session memory
├── sessions.ts               # session save/load/resume
└── slash-commands.ts         # 26 runtime commands

📚 Documentation

GuideDescription
User GuideGetting started, configuration, daily usage
ArchitectureSystem design, engine internals, TUI layout
API ReferenceFull API documentation for all modules
WllmConceptWiki knowledge engine deep-dive
Auto-IngestFile watcher + content analysis
ContributingHow to contribute to Huagent
SecurityVulnerability reporting + threat model
ChangelogRelease history

🤝 Contributing

Bug reports and feature requests welcome via issues.

See CONTRIBUTING.md for development setup and guidelines.

Quick Start for Contributors

git clone https://github.com/ahmdd4vd/Huagent.git
cd Huagent
npm install
npm run dev           # watch mode (auto-rebuild on save)
npm test              # run all 239 tests
npm run verify        # lint + test + build (must pass before PR)

Commit Message Format

type(scope): short summary

Body explaining the why. Reference issues with #123.

Types: feat, fix, chore, docs, test, refactor, style, perf.

🔒 Security

See SECURITY.md for the vulnerability reporting policy and threat model.

Don't open a public issue for security bugs. Use GitHub's private vulnerability reporting: https://github.com/ahmdd4vd/Huagent/security/advisories/new

📦 Publishing (Maintainers)

# 1. Update version in package.json
# 2. Update CHANGELOG.md
# 3. Run verify
npm run verify

# 4. Publish to npm
npm publish

# 5. Tag and push
git tag v6.0.0
git push origin v6.0.0

MIT © 2026 Huanime

Built with Ink · Inspired by OpenCode, claw-code, and OpenClaude

The AI coding agent that learns from your codebase.

Keywords

ai

FAQs

Package last updated on 18 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts