You say
"sửa hàm loginHandler"
Tool
impact({target: "loginHandler", depth: 3})
What happens
Shows every symbol that breaks if loginHandler changes. Depth-1: 3 dependents. Depth-2: 8. Depth-3: 14. If depth-1 > 5, Milens warns you before editing.
You say
"xóa oldHelper đi"
Tool
grep({pattern: "oldHelper"})
impact({target: "oldHelper"})
What happens
Finds ALL text references (templates, configs, docs, routes) + all code dependents. Nothing is missed — grep catches what impact can't see.
You say
"đổi tên getUser thành fetchUser"
Tool
grep({pattern: "getUser"})
impact({target: "getUser", direction: "upstream"})
What happens
Combines grep (text search across all files) + impact (code-level dependents). Shows exactly which files need updating before you touch anything.
You say
"commit thôi"
Tool
detect_changes({ref: "HEAD"})
What happens
Scans git diff, returns only the symbols that actually changed + their direct dependents. Know exactly what you're committing before you commit.
You say
"review PR này"
Tool
review_pr({ref: "HEAD"})
What happens
Scores every changed symbol CRITICAL, HIGH, MEDIUM, or LOW based on heat (incoming refs), dependents, and test coverage. Instantly see which files are risky.
You say
"hàm handlePayment risky không?"
Tool
review_symbol({name: "handlePayment"})
What happens
Returns role + heat + full dependent list + test status + risk level + actionable recommendation. One call, complete picture.
You say
"có dead code không?"
Tool
find_dead_code({limit: 30})
What happens
Lists all exported symbols with zero incoming references. Filter by kind (function, class, method) to find unused code instantly.
You say
"check pre-commit"
Tool
pre_commit_check()
What happens
Runs review_pr + find_dead_code + test_coverage_gaps in one call. A complete pre-commit safety gate before you push.
You say
"viết test cho createUser"
Tool
test_plan({name: "createUser"})
What happens
Returns mock strategy (what to stub/spy/fake) + 3+ test scenarios: happy path, edge case, error handling. Know exactly what to test.
You say
"chỗ nào chưa có test?"
Tool
test_coverage_gaps({limit: 20})
What happens
Lists untested exported symbols sorted by risk (CRITICAL first). Prioritize what to test based on actual impact, not guesswork.
You say
"chạy test nào sau khi sửa?"
Tool
test_impact({ref: "HEAD"})
What happens
Maps changed symbols directly to affected test files. Run only the tests that matter — no more running the entire suite.
You say
"generate test cho formatDate"
Tool
test_generate({symbol: "formatDate"})
What happens
Auto-detects test framework (vitest/jest/mocha/pytest) and generates a complete test file with mock strategy and scenarios.
You say
"scan bảo mật toàn bộ project"
Tool
security_scan({scope: "all", severity: "HIGH"})
What happens
190+ rules across 10 categories: secrets, injection, unicode, dangerous patterns, config leaks, data leaks, crypto, auth, file access. One call replaces 10 manual grep searches.
You say
"fix lỗi bảo mật dòng 42 file auth.ts"
Tool
fix_apply({ruleId: "secret-in-code", file: "src/auth.ts", line: 42})
What happens
Applies the security fix automatically and creates a backup in .milens/backups/. Safe, reversible, auditable.
You say
"có secret nào bị leak không?"
Tool
security_scan({scope: "secrets"})
What happens
Detects API keys, access tokens, passwords, private keys, and connection strings embedded in source code. Know before they reach production.
You say
"lỗi ở sendEmail, trace execution path"
Tool
trace({name: "sendEmail", direction: "to"})
What happens
Shows the full call chain from entrypoints down to sendEmail. Understand exactly how this code gets triggered at runtime.
You say
"AuthService và TokenManager liên quan thế nào?"
Tool
explain_relationship({from: "AuthService", to: "TokenManager"})
What happens
Returns the shortest dependency path between any two symbols. AuthService → AuthMiddleware → TokenManager (2 steps).
You say
"tìm hiểu tại sao User model bị lỗi"
Tool
smart_context({name: "User", intent: "debug"})
What happens
Returns execution paths + data flow for the User symbol. See what calls it, what it calls, and where data flows — all in one call.
You say
"tổng quan project này thế nào?"
Tool
codebase_summary()
What happens
~500 token overview: domains, top hub symbols, test coverage %, annotation counts. The fastest way to understand any codebase.
You say
"project này có những module nào?"
Tool
domains()
What happens
Shows logical module clusters based on the dependency graph. See which files form cohesive groups — auth, db, routes, utils, config.
You say
"có những API endpoint nào?"
Tool
routes({framework: "express"})
What happens
Detects framework routes and maps them to handler functions. [GET] /api/users → userController.list. Supports Express, FastAPI, NestJS, Flask, Go, PHP, Rails.
You say
"tìm hàm xử lý authentication"
Tool
query({query: "auth"})
What happens
FTS5 symbol search returns definitions instantly. AuthService [class] src/auth.ts:12 (exported). Use query for code identifiers, grep for display text.
You say
"tìm chữ 'User not found' ở đâu?"
Tool
grep({pattern: "User not found"})
What happens
Searches ALL files — templates, configs, styles, docs, routes. Finds every occurrence, not just code symbols. Perfect for UI labels and error messages.
You say
"có hàm nào giống formatCurrency không?"
Tool
find_similar({name: "formatCurrency"})
What happens
Returns top 10 symbols that share callers or callees. Great for finding patterns to copy, refactor together, or avoid duplicating.
You say
"file src/auth.ts có những symbols gì?"
Tool
get_file_symbols({file: "src/auth.ts"})
What happens
Lists every symbol in the file with kind, line number, and reference/dependency counts. Understand any file at a glance without opening it.
You say
"tìm concept 'payment processing' — không cần biết tên hàm"
Tool
semantic_search({query: "payment processing"})
What happens
Finds relevant symbols by meaning, not name. Discover checkoutFlow even though you searched "payment". Requires --embeddings flag for vector search.
You say
"parse thử đoạn code này xem AST structure"
Tool
ast_explore({code: "const x = 1", language: "typescript"})
What happens
Returns the S-expression AST tree for any code snippet. Supports all 12 milens-indexed languages. Debug parsers, write tree-sitter queries, or understand language grammar.
You say
"PaymentProcessor kế thừa từ những lớp nào?"
Tool
get_type_hierarchy({name: "PaymentProcessor"})
What happens
Shows full inheritance tree: BaseProcessor → PaymentProcessor → CreditCardProcessor, PayPalProcessor. Understand OOP structure instantly.
You say
"index database còn healthy không?"
Tool
status()
What happens
Returns symbols count, links count, files, test coverage %, and staleness. Know instantly if your index is up to date or needs analyze --force.
You say
"có bao nhiêu repo đã được index?"
Tool
repos()
What happens
Lists all indexed repositories with symbol counts, file counts, and last-indexed dates. Essential for monorepo and multi-project setups.
You say
"trước khi sửa resolveLinks, có warning gì không?"
Tool
edit_check({name: "resolveLinks"})
What happens
Returns callers + export status + re-export chains + warnings. "WARNING: exported function — changing signature is a breaking change." Designed specifically for editing intent.
You say
"cho tôi context + impact + grep của Database trong 1 call"
Tool
overview({name: "Database"})
What happens
Combines context, impact, and grep into ONE call. Saves 2-3 round trips. The preferred tool before editing, deleting, or renaming any symbol.
You say
"refactor UserService xong, blast radius tăng hay giảm?"
Tool
compare_impact({name: "UserService", action: "snapshot"})
compare_impact({name: "UserService", action: "compare"})
What happens
Snapshot before, compare after. Detects regressions: new dependents appeared, heat increased, blast radius widened. Your automated regression guard for every refactor.
You say
"vừa sửa 3 files, symbols nào bị ảnh hưởng?"
Tool
hook_onFileChange({files: ["src/auth.ts", "src/models.ts"]})
What happens
Re-analyzes changed files and shows impact on all affected symbols. Hook triggers automatically when files change — no manual re-analysis needed.
You say
"test tree-sitter query trước khi thêm vào parser"
Tool
test_query({query: "(identifier) @name", code: "...", language: "typescript"})
What happens
Runs a tree-sitter query against code and returns all captured matches. Test queries before adding them to a LangSpec. Essential for parser developers.
You say
"phiên làm việc này đã dùng những tools gì?"
Tool
session_context({session_id: "..."})
What happens
Returns full session metadata: tool calls made, annotations recorded, duration, agent name. Complete audit trail for every AI session.
You say
"review cai PR nay, nhung dung flag nhung symbol khong thay doi"
Tool
review_pr({ref: "main"})
What happens
Symbol-level diff via git show — compares old vs new commit symbols, not entire files. Cross-file impact tracks downstream callers. Fixture/test files excluded. Internal implementation details deprioritized. Only actually changed symbols flagged.
You say
"xoa het milens traces trong project nay"
CLI
milens uninstall
milens uninstall --dry-run
What happens
Scans 11 trace categories: injected blocks, generated files, git hooks, cron, Windows tasks, databases, registry, MCP configs, deps, env vars, manual refs. Interactive wizard or auto-remove with --dry-run to preview.