@nockdev/hsa
v2.0.23
Published
HSA - Hierarchical Semantic Analysis MCP Server for AI Code Agents. Token-optimized context engine with BM25+ search, Merkle tree change detection, 84+ built-in library docs, persistent memory, and real-time dashboard.
Maintainers
Readme
DOMYH HSA MCP Server v2.0
Hyper-Fast Code Intelligence Engine với SQLite Knowledge Graph + Oxc Native Parser.
Features
- 18 MCP Tools — Consolidated handlers với Zod schema validation
- Oxc Native Parser — 15-30x nhanh hơn Babel cho TypeScript/JavaScript
- SQLite Knowledge Graph — Recursive CTE cho trace_flow, PageRank, hybrid search
- BM25F Tier-1 — Keyword search không bao giờ evict
- Stateless by Default — MCP v2 compatible, request-level connection ID
- Incremental Indexing — chokidar watcher với debounced batch queue
- Zod-only Schema — Auto-generate JSON Schema, xóa dual validation
- LLM Token Optimization — 3-level LOD skeletonization
Architecture
hsa-engine-v2/
├── src/
│ ├── core/ # Server, workspace, health, connection
│ ├── db/ # SQLite, BM25, graph queries, session store
│ ├── parsers/ # Oxc + tree-sitter + skeleton
│ ├── search/ # Hybrid RRF fusion
│ ├── context/ # Manager, scorer, compactor, budget
│ ├── skills/ # Progressive T1→T2 registry
│ ├── watcher/ # chokidar + index queue
│ └── tools/ # 17 tool handlers
├── tests/ # Unit + integration tests
└── dist/ # Compiled outputQuick Start
# Install dependencies
npm install
# Build
npm run build
# Run in stdio mode (auto-detect project)
node dist/cli.js
# Run with explicit project
node dist/cli.js --project /path/to/project
# Run in HTTP daemon mode
node dist/cli.js --transport http --port 3100
# Development
npm run dev18 Tools
| # | Tool | Sub-actions | Description |
|:--|:-----|:------------|:------------|
| 1 | hsa_guide | — | Static guidance |
| 2 | hsa_search | context, files, skills, docs | Unified search |
| 3 | hsa_detect | stack, environment, shell | Project detection |
| 4 | hsa_check_changes | — | File change detection |
| 5 | hsa_prefetch | — | Context preloading |
| 6 | hsa_report | status, stats, health | System reports |
| 7 | hsa_explore | repo_map, snapshot | Repository exploration |
| 8 | hsa_get_agent_config | bootstrap, rules, commands, skills | Config loader |
| 9 | hsa_research | web, npm, github | Research API |
| 10 | hsa_delegate | cascade, cascade_read, cascade_models | Sub-agent delegation |
| 11 | hsa_trace_flow | — | Blast radius analysis (SQL Recursive CTE) |
| 12 | hsa_feedback | — | Relevance feedback |
| 13 | hsa_memory | store, retrieve, anchor | Memory entries |
| 14 | hsa_session | persist, track, anchor, drift, intent, ask_user, resume | Session management |
| 15 | hsa_design | analyze, health, suggest, review | Design intelligence |
| 16 | hsa_canvas | open, capture, close | Canvas integration |
| 17 | hsa_bridge | list, connect, disconnect | Plugin management |
| 18 | hsa_workspace | get, set, list, resolve, stats | Workspace context binding |
Database
SQLite database stored at .agent/hsa_state.sqlite per workspace:
nodes— KG nodes (symbol, kind, signature, skeleton)edges— KG edges (imports, calls, defines, references)bm25_documents— BM25F inverted indexsessions— Session state (stateless)memory— Memory entries (TTL support)feedback_signals— Relevance feedback weightswatched_files— File change queue
Technology Stack
| Component | Technology | Reason | |:---------|:-----------|:-------| | Parser (TS/JS) | Oxc Native | 15-30x faster than Babel, no WASM | | Parser (Other) | tree-sitter 0.25.10 | WASM ABI pinned to avoid crash | | Database | better-sqlite3 + WAL | ACID, non-blocking reads | | Search | BM25F + RRF | Exact keyword + semantic fusion | | File Watcher | chokidar 4.x | Cross-platform, debounced | | Schema | Zod only | Auto-generate JSON Schema |
Testing
npm run test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportLicense
MIT — DOMYH Agent Kit
