milens 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/adapters/SKILL.md +20 -0
- package/.agents/skills/analyzer/SKILL.md +38 -16
- package/.agents/skills/apps/SKILL.md +25 -1
- package/.agents/skills/docs/SKILL.md +33 -5
- package/.agents/skills/milens/SKILL.md +36 -6
- package/.agents/skills/milens-architect/SKILL.md +128 -0
- package/.agents/skills/milens-debugger/SKILL.md +141 -0
- package/.agents/skills/orchestrator/SKILL.md +59 -0
- package/.agents/skills/parser/SKILL.md +35 -14
- package/.agents/skills/root/SKILL.md +39 -17
- package/.agents/skills/scripts/SKILL.md +21 -3
- package/.agents/skills/security/SKILL.md +32 -11
- package/.agents/skills/server/SKILL.md +47 -20
- package/.agents/skills/store/SKILL.md +40 -18
- package/.agents/skills/test/SKILL.md +57 -9
- package/LICENSE +21 -75
- package/README.md +294 -467
- package/adapters/claude-code/CLAUDE.md +36 -15
- package/adapters/codex/.codex/codex.md +38 -23
- package/adapters/copilot/.github/copilot-instructions.md +29 -22
- package/adapters/gemini/.gemini/context.md +33 -10
- package/adapters/opencode/AGENTS.md +36 -15
- package/dist/agents-md.d.ts.map +1 -1
- package/dist/agents-md.js +56 -5
- package/dist/agents-md.js.map +1 -1
- package/dist/analyzer/engine.d.ts +4 -0
- package/dist/analyzer/engine.d.ts.map +1 -1
- package/dist/analyzer/engine.js +378 -14
- package/dist/analyzer/engine.js.map +1 -1
- package/dist/analyzer/resolver.d.ts +2 -0
- package/dist/analyzer/resolver.d.ts.map +1 -1
- package/dist/analyzer/resolver.js +187 -9
- package/dist/analyzer/resolver.js.map +1 -1
- package/dist/analyzer/review.d.ts.map +1 -1
- package/dist/analyzer/review.js +254 -32
- package/dist/analyzer/review.js.map +1 -1
- package/dist/analyzer/scope-resolver.d.ts +42 -0
- package/dist/analyzer/scope-resolver.d.ts.map +1 -0
- package/dist/analyzer/scope-resolver.js +687 -0
- package/dist/analyzer/scope-resolver.js.map +1 -0
- package/dist/cli.js +590 -20
- package/dist/cli.js.map +1 -1
- package/dist/orchestrator/orchestrator.d.ts +65 -0
- package/dist/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator.js +178 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/reporter.d.ts +15 -0
- package/dist/orchestrator/reporter.d.ts.map +1 -0
- package/dist/orchestrator/reporter.js +38 -0
- package/dist/orchestrator/reporter.js.map +1 -0
- package/dist/parser/extract.d.ts +6 -1
- package/dist/parser/extract.d.ts.map +1 -1
- package/dist/parser/extract.js +14 -2
- package/dist/parser/extract.js.map +1 -1
- package/dist/parser/lang-css.d.ts.map +1 -1
- package/dist/parser/lang-css.js +7 -1
- package/dist/parser/lang-css.js.map +1 -1
- package/dist/parser/lang-go.d.ts.map +1 -1
- package/dist/parser/lang-go.js +16 -0
- package/dist/parser/lang-go.js.map +1 -1
- package/dist/parser/lang-html.d.ts +4 -0
- package/dist/parser/lang-html.d.ts.map +1 -1
- package/dist/parser/lang-html.js +40 -1
- package/dist/parser/lang-html.js.map +1 -1
- package/dist/parser/lang-java.d.ts.map +1 -1
- package/dist/parser/lang-java.js +12 -0
- package/dist/parser/lang-java.js.map +1 -1
- package/dist/parser/lang-js.d.ts.map +1 -1
- package/dist/parser/lang-js.js +3 -0
- package/dist/parser/lang-js.js.map +1 -1
- package/dist/parser/lang-php.d.ts.map +1 -1
- package/dist/parser/lang-php.js +11 -0
- package/dist/parser/lang-php.js.map +1 -1
- package/dist/parser/lang-py.d.ts.map +1 -1
- package/dist/parser/lang-py.js +14 -0
- package/dist/parser/lang-py.js.map +1 -1
- package/dist/parser/lang-ruby.d.ts.map +1 -1
- package/dist/parser/lang-ruby.js +20 -0
- package/dist/parser/lang-ruby.js.map +1 -1
- package/dist/parser/lang-rust.d.ts.map +1 -1
- package/dist/parser/lang-rust.js +27 -4
- package/dist/parser/lang-rust.js.map +1 -1
- package/dist/parser/lang-ts.d.ts.map +1 -1
- package/dist/parser/lang-ts.js +3 -0
- package/dist/parser/lang-ts.js.map +1 -1
- package/dist/parser/lang-vue.d.ts +17 -1
- package/dist/parser/lang-vue.d.ts.map +1 -1
- package/dist/parser/lang-vue.js +177 -0
- package/dist/parser/lang-vue.js.map +1 -1
- package/dist/parser/language-provider.d.ts +27 -0
- package/dist/parser/language-provider.d.ts.map +1 -0
- package/dist/parser/language-provider.js +2 -0
- package/dist/parser/language-provider.js.map +1 -0
- package/dist/security/rules.d.ts.map +1 -1
- package/dist/security/rules.js +4 -1
- package/dist/security/rules.js.map +1 -1
- package/dist/server/hooks.d.ts +3 -0
- package/dist/server/hooks.d.ts.map +1 -1
- package/dist/server/hooks.js +79 -0
- package/dist/server/hooks.js.map +1 -1
- package/dist/server/mcp-prompts.d.ts.map +1 -1
- package/dist/server/mcp-prompts.js +1 -1
- package/dist/server/mcp-prompts.js.map +1 -1
- package/dist/server/mcp.d.ts.map +1 -1
- package/dist/server/mcp.js +638 -61
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/watcher.d.ts +47 -0
- package/dist/server/watcher.d.ts.map +1 -0
- package/dist/server/watcher.js +136 -0
- package/dist/server/watcher.js.map +1 -0
- package/dist/skills.js +201 -36
- package/dist/skills.js.map +1 -1
- package/dist/store/annotations.d.ts.map +1 -1
- package/dist/store/annotations.js +18 -15
- package/dist/store/annotations.js.map +1 -1
- package/dist/store/confidence.d.ts +10 -0
- package/dist/store/confidence.d.ts.map +1 -1
- package/dist/store/confidence.js +28 -1
- package/dist/store/confidence.js.map +1 -1
- package/dist/store/db.d.ts +16 -0
- package/dist/store/db.d.ts.map +1 -1
- package/dist/store/db.js +121 -7
- package/dist/store/db.js.map +1 -1
- package/dist/store/schema.sql +25 -10
- package/dist/uninstall.d.ts +54 -0
- package/dist/uninstall.d.ts.map +1 -0
- package/dist/uninstall.js +795 -0
- package/dist/uninstall.js.map +1 -0
- package/docs/README.md +7 -6
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/milens"><img src="https://img.shields.io/npm/v/milens" alt="npm"></a>
|
|
8
8
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node"></a>
|
|
9
9
|
<a href="https://github.com/fuze210699/milens/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="license"></a>
|
|
10
|
-
<img src="https://img.shields.io/badge/tools-
|
|
11
|
-
<img src="https://img.shields.io/badge/
|
|
10
|
+
<img src="https://img.shields.io/badge/tools-41-purple" alt="41 tools">
|
|
11
|
+
<img src="https://img.shields.io/badge/languages-12-blue" alt="12 languages">
|
|
12
|
+
<img src="https://img.shields.io/badge/prompts-7-orange" alt="7 prompts">
|
|
12
13
|
<img src="https://img.shields.io/badge/security-50%2B-red" alt="50+ rules">
|
|
13
14
|
<img src="https://img.shields.io/badge/harnesses-7-lightgrey" alt="7 harnesses">
|
|
14
15
|
</p>
|
|
@@ -19,62 +20,60 @@
|
|
|
19
20
|
<a href="https://github.com/fuze210699/milens">⭐ Star</a> ·
|
|
20
21
|
<a href="https://github.com/sponsors/fuze210699">💖 Sponsor</a> ·
|
|
21
22
|
<a href="https://github.com/fuze210699/milens/discussions">💬 Discussions</a> ·
|
|
22
|
-
<a href="https://github.com/fuze210699/milens/blob/main/docs/pricing.md">Pro $
|
|
23
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/pricing.md">Pro $1/seat</a>
|
|
23
24
|
</p>
|
|
24
25
|
|
|
25
26
|
---
|
|
26
27
|
|
|
27
|
-
##
|
|
28
|
+
## Quick Install
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
1. Agent edits `UserService.validate()`
|
|
34
|
-
2. Doesn't know 47 functions depend on its return type
|
|
35
|
-
3. **Breaking changes ship to production**
|
|
36
|
-
|
|
37
|
-
The deeper issue: agents waste **70% of their context window** just trying to understand the codebase. Reading files one by one. Grep'ing for references. Tracing call chains manually. Every session starts from zero — last session's discoveries are gone.
|
|
38
|
-
|
|
39
|
-
After 10-20 AI sessions, the codebase accumulates dead code, untested hubs, and forgotten security gaps. The agent gets slower, more confused, and more expensive — while the developer burns tokens and patience.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Without Milens vs With Milens
|
|
44
|
-
|
|
45
|
-
| Situation | Without Milens | With Milens |
|
|
46
|
-
|---|---|---|
|
|
47
|
-
| **Understand a new codebase** | Agent reads 15 files blind (~30,000 tokens) | `codebase_summary()` — 500 tokens, complete overview |
|
|
48
|
-
| **Edit a function safely** | No idea what depends on it. Hope it doesn't break. | `impact({target, depth: 3})` — exact blast radius before every edit |
|
|
49
|
-
| **Find all references** | Grep 5 times, read 8 files, miss template usages | `context({name})` — incoming + outgoing, one call |
|
|
50
|
-
| **Review a PR** | Read diff, guess risk, miss hidden dependencies | `review_pr()` — every symbol scored CRITICAL/HIGH/MEDIUM/LOW |
|
|
51
|
-
| **Security audit** | 10 manual greps for secrets, injections, unicode | `security_scan()` — 50 rules, one tool call |
|
|
52
|
-
| **Start a new session** | Zero context. Re-learn everything from scratch. | `recall()` — agent remembers every past bug, caveat, and pattern |
|
|
53
|
-
| **Write tests** | Guess what needs testing. Guess how to mock. | `test_plan()` — mock strategy + 3 scenarios + coverage gaps sorted by risk |
|
|
54
|
-
| **Find dead code** | Manual search. "Is this still used? I'm not sure." | `find_dead_code()` — every exported symbol with zero references |
|
|
55
|
-
|
|
56
|
-
**Average savings: ~70% fewer tokens per session. ~50% faster task completion.**
|
|
30
|
+
```bash
|
|
31
|
+
npx milens init --profile full
|
|
32
|
+
npx milens analyze -p . --force
|
|
33
|
+
```
|
|
57
34
|
|
|
58
35
|
---
|
|
59
36
|
|
|
60
37
|
## What is Milens?
|
|
61
38
|
|
|
62
|
-
Milens
|
|
39
|
+
Milens builds a **knowledge graph** of your codebase — functions, classes, imports, calls, and inheritance chains — then exposes it through 41 MCP tools. AI agents query the graph instead of reading files.
|
|
40
|
+
|
|
41
|
+
- **Parse 12 languages.** Tree-sitter WASM — TS, JS, Python, Java, Go, Rust, PHP, Ruby, Vue, HTML, CSS, Markdown.
|
|
42
|
+
- **Query instantly.** FTS5 + recursive CTE — all in SQLite, no API calls.
|
|
43
|
+
- **Edit safely.** Blast radius before every change. Symbol-level PR review with cross-file impact.
|
|
44
|
+
- **Scan once.** 50+ security rules in one call instead of multiple greps.
|
|
45
|
+
- **Learn continuously.** Annotations persist across sessions. High-confidence patterns can be promoted to rules.
|
|
46
|
+
- **Dual-path resolver.** Legacy proximity + scope-graph compared for parity.
|
|
47
|
+
- **Verify accuracy.** 8 test projects with expected.json validate precision/recall across all languages.
|
|
63
48
|
|
|
64
|
-
|
|
49
|
+
Fully offline. Zero telemetry. MCP server on `127.0.0.1`. Get started with `npx milens init`.
|
|
65
50
|
|
|
66
|
-
|
|
67
|
-
- **Query instantly.** FTS5 search, recursive CTE traversal, vector similarity — all in-database.
|
|
68
|
-
- **Edit safely.** Every tool returns a blast radius before you change anything.
|
|
69
|
-
- **Scan automatically.** 50+ security rules run in one call, not ten greps.
|
|
70
|
-
- **Learn continuously.** Annotations persist across sessions. Patterns auto-promote to rules.
|
|
51
|
+
---
|
|
71
52
|
|
|
72
|
-
|
|
53
|
+
## Architecture
|
|
73
54
|
|
|
74
55
|
```
|
|
75
|
-
|
|
56
|
+
Source files (12 languages)
|
|
57
|
+
│
|
|
58
|
+
▼
|
|
59
|
+
Parser ── tree-sitter WASM → CST
|
|
60
|
+
│
|
|
61
|
+
▼
|
|
62
|
+
Analyzer ── extractFromTree() + dual-path resolver
|
|
63
|
+
│ ├── Legacy: proximity-based (resolveLinksWithStats)
|
|
64
|
+
│ └── Scope: scope-graph-based (resolveWithScopes) → parity check
|
|
65
|
+
│
|
|
66
|
+
▼
|
|
67
|
+
Store ──── SQLite + FTS5 (symbols, links, metadata, embeddings)
|
|
68
|
+
│
|
|
69
|
+
▼
|
|
70
|
+
Server ─── MCP stdio/HTTP (41 tools)
|
|
71
|
+
│
|
|
72
|
+
├── AI Agent (MCP client)
|
|
73
|
+
└── CLI (terminal)
|
|
76
74
|
```
|
|
77
75
|
|
|
76
|
+
|
|
78
77
|
---
|
|
79
78
|
|
|
80
79
|
## Quick Start
|
|
@@ -105,340 +104,260 @@ Then connect your editor:
|
|
|
105
104
|
```bash
|
|
106
105
|
# Claude Code
|
|
107
106
|
claude mcp add milens -- npx -y milens serve -p .
|
|
107
|
+
```
|
|
108
108
|
|
|
109
|
+
<details>
|
|
110
|
+
<summary><b>More editors</b> — Cursor, OpenCode, Codex, Gemini, Zed</summary>
|
|
111
|
+
|
|
112
|
+
```bash
|
|
109
113
|
# Cursor — .cursor/mcp.json
|
|
110
114
|
{ "mcpServers": { "milens": { "command": "npx", "args": ["-y", "milens", "serve", "-p", "."] } } }
|
|
111
115
|
|
|
112
116
|
# OpenCode — .opencode/config.json
|
|
113
117
|
{ "mcp": { "milens": { "command": "npx", "args": ["-y", "milens", "serve"] } } }
|
|
114
|
-
```
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
# Codex — .codex/config.toml
|
|
120
|
+
[mcp_servers.milens]
|
|
121
|
+
command = "npx"
|
|
122
|
+
args = ["-y", "milens", "serve", "-p", "."]
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
# Gemini — .gemini/settings.json
|
|
125
|
+
{ "mcpServers": { "milens": { "command": "npx", "args": ["-y", "milens", "serve", "-p", "."] } } }
|
|
121
126
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
│
|
|
125
|
-
┌────────────────┼────────────────┐
|
|
126
|
-
▼ ▼ ▼
|
|
127
|
-
ANALYZE GENERATE CONFIGURE
|
|
128
|
-
tree-sitter parse AGENTS.md security rules
|
|
129
|
-
resolve imports skill files pre-commit hooks
|
|
130
|
-
build graph adapter packs CI templates
|
|
131
|
-
│ │ │
|
|
132
|
-
└────────────────┼────────────────┘
|
|
133
|
-
▼
|
|
134
|
-
milens serve
|
|
135
|
-
│
|
|
136
|
-
┌────────────────┼────────────────┐
|
|
137
|
-
▼ ▼ ▼
|
|
138
|
-
33 MCP TOOLS 6 SUB-AGENT 50+ SECURITY
|
|
139
|
-
query, impact, PROMPTS RULES
|
|
140
|
-
context, trace, planner, secrets, injection,
|
|
141
|
-
review_pr, ... reviewer, ... unicode, crypto, ...
|
|
142
|
-
│
|
|
143
|
-
▼
|
|
144
|
-
AI CODING AGENT
|
|
145
|
-
┌────────────────┼────────────────┐
|
|
146
|
-
▼ ▼ ▼
|
|
147
|
-
CODE SAFELY REVIEW AUTO LEARN CONTINUOUSLY
|
|
148
|
-
edit_check() review_pr() annotate → recall
|
|
149
|
-
impact() security_scan() evolve → promote
|
|
127
|
+
# Zed — .zed/settings.json
|
|
128
|
+
{ "mcp_servers": { "milens": { "command": "npx", "args": ["-y", "milens", "serve", "-p", "."] } } }
|
|
150
129
|
```
|
|
151
130
|
|
|
152
|
-
|
|
131
|
+
</details>
|
|
153
132
|
|
|
154
|
-
|
|
155
|
-
┌─────────────────────────────────────────────────────────┐
|
|
156
|
-
│ PLATFORM LAYER │
|
|
157
|
-
│ GitHub App · npm · 7 adapter packs · Desktop Dashboard │
|
|
158
|
-
│ Pricing: Free / Pro ($19/seat) / Enterprise │
|
|
159
|
-
├─────────────────────────────────────────────────────────┤
|
|
160
|
-
│ AUTOMATION LAYER │
|
|
161
|
-
│ 6 Hooks (SessionStart, SessionEnd, PreCommit, ...) │
|
|
162
|
-
│ Auto-annotate · Auto-recall · Watch mode │
|
|
163
|
-
│ Scheduled evolve (cron/schtasks) · Pre-commit hooks │
|
|
164
|
-
├─────────────────────────────────────────────────────────┤
|
|
165
|
-
│ WORKFLOW LAYER │
|
|
166
|
-
│ 6 Sub-agent Prompts (planner, reviewer, tester, ...) │
|
|
167
|
-
│ 6 Skill files · AGENTS.md auto-generator │
|
|
168
|
-
│ Selective profiles (minimal/standard/full) │
|
|
169
|
-
├─────────────────────────────────────────────────────────┤
|
|
170
|
-
│ INTELLIGENCE LAYER │
|
|
171
|
-
│ Knowledge Graph (SQLite+FTS5) · 33 MCP Tools │
|
|
172
|
-
│ Memory (annotations+sessions) · Learning (confidence) │
|
|
173
|
-
│ 50+ Security Rules (OWASP) · 7 Metrics (TER, CQI, ...) │
|
|
174
|
-
└─────────────────────────────────────────────────────────┘
|
|
175
|
-
```
|
|
133
|
+
Open your AI agent. It auto-loads `AGENTS.md` with codebase context. You're ready.
|
|
176
134
|
|
|
177
|
-
|
|
135
|
+
---
|
|
178
136
|
|
|
179
|
-
|
|
137
|
+
## Without Milens vs With Milens
|
|
138
|
+
|
|
139
|
+
| Situation | Without Milens | With Milens |
|
|
180
140
|
|---|---|---|
|
|
181
|
-
| **
|
|
182
|
-
| **
|
|
183
|
-
| **
|
|
184
|
-
| **
|
|
185
|
-
| **
|
|
186
|
-
| **
|
|
187
|
-
| **
|
|
188
|
-
| **
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|---|---|
|
|
194
|
-
| **One parse, infinite queries** | Knowledge graph pre-computed at analyze time |
|
|
195
|
-
| **Zero network** | Everything offline. No API calls. No telemetry. |
|
|
196
|
-
| **Token-compact** | `name [kind] file:line` format saves 40-60% tokens |
|
|
197
|
-
| **Incremental** | SHA-256 file hashing. Only changed files re-parsed. |
|
|
198
|
-
| **In-database traversal** | Recursive CTEs for graph queries. No full graph in memory. |
|
|
199
|
-
| **Localhost only** | HTTP binds 127.0.0.1. No network exposure. |
|
|
200
|
-
| **MCP standard** | Works with any MCP-compatible agent. No vendor lock-in. |
|
|
141
|
+
| **Understand a new codebase** | Agent reads many files blind | `codebase_summary()` — compact overview |
|
|
142
|
+
| **Edit a function safely** | No idea what depends on it | `impact({target, depth: 3})` — exact blast radius |
|
|
143
|
+
| **Find all references** | Grep multiple times, read several files | `context({name})` — incoming + outgoing, one call |
|
|
144
|
+
| **Review a PR** | Read diff, guess risk | `review_pr()` — changed symbols scored by blast radius + test coverage |
|
|
145
|
+
| **Review a PR accurately** | Review guesses which functions changed | Symbol-level diff via git show — flags only actually changed symbols |
|
|
146
|
+
| **Clean uninstall** | Manually delete files, hooks, configs | `milens uninstall` — scan 11 categories, interactive or auto |
|
|
147
|
+
| **Security audit** | Multiple manual greps | `security_scan()` — 50+ rules, one tool call |
|
|
148
|
+
| **Start a new session** | Zero context | `recall()` — retrieves past annotations |
|
|
149
|
+
| **Write tests** | Guess what needs testing | `test_plan()` — dependency-aware strategy + scenarios |
|
|
150
|
+
| **Find dead code** | Manual search | `find_dead_code()` — exported symbols with zero references |
|
|
151
|
+
|
|
152
|
+
*And many more — see [real-world scenarios →](docs/scenarios.html)*
|
|
201
153
|
|
|
202
154
|
---
|
|
203
155
|
|
|
204
|
-
##
|
|
205
|
-
|
|
206
|
-
### Search & Navigation
|
|
156
|
+
## Features
|
|
207
157
|
|
|
208
|
-
|
|
|
158
|
+
| Feature | Description |
|
|
209
159
|
|---|---|
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
|
|
|
160
|
+
| **Code Intelligence** | 41 MCP tools — search, impact, context, trace, routes |
|
|
161
|
+
| **Security Scanner** | 50+ rules across 9 categories + dependency audit |
|
|
162
|
+
| **Sub-Agent Prompts** | 7 prompts — plan, review, tdd, security, architect, debug, dead_code_remove |
|
|
163
|
+
| **CLI Workflows** | 7 commands — tdd, review, plan, onboard, security-scan, refactor, handoff |
|
|
164
|
+
| **Uninstall** | Full cleanup — 11 trace categories, interactive or auto |
|
|
165
|
+
| **Metrics** | 7 metrics — TER, LR, CQI, BRR, TCGR, DCER, CTR |
|
|
166
|
+
| **Learning Engine** | Annotate → Recall → Evolve — confidence-based annotations |
|
|
167
|
+
| **12 Languages** | TS, JS, Python, Java, Go, Rust, PHP, Ruby, Vue, HTML, CSS, Markdown |
|
|
168
|
+
| **Cross-Language Linking** | HTML class → CSS selectors, Vue template → script symbols |
|
|
169
|
+
| **Type Bindings & MRO** | Infer types from constructors. C3, first-wins, ruby-mixin strategies |
|
|
170
|
+
| **Accuracy Validation** | 8 test projects with expected.json for precision/recall |
|
|
171
|
+
| **Symbol-Level PR Diff** | `review_pr` diffs actual symbols between commits, not entire files |
|
|
172
|
+
| **7 Editor Adapters** | Claude Code, Cursor, Copilot, OpenCode, Codex, Gemini, Zed |
|
|
215
173
|
|
|
216
|
-
|
|
174
|
+
---
|
|
217
175
|
|
|
218
|
-
|
|
219
|
-
|---|---|
|
|
220
|
-
| `impact` | Blast radius: depth 1-3 traversal showing what breaks |
|
|
221
|
-
| `edit_check` | Pre-edit safety: callers, re-exports, test coverage, warnings |
|
|
222
|
-
| `detect_changes` | Git diff → which symbols changed + their dependents |
|
|
223
|
-
| `find_dead_code` | Exported symbols with zero incoming references |
|
|
224
|
-
| `overview` | context + impact + grep combined in one call |
|
|
176
|
+
## CLI Commands
|
|
225
177
|
|
|
226
|
-
###
|
|
178
|
+
### Core
|
|
227
179
|
|
|
228
|
-
|
|
|
180
|
+
| Command | Description |
|
|
229
181
|
|---|---|
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
| `
|
|
182
|
+
| `init` | Bootstrap milens: index + AGENTS.md + skills + hooks |
|
|
183
|
+
| `analyze` | Index a codebase: parse symbols, resolve dependencies, build search index |
|
|
184
|
+
| `serve` | Start MCP server (stdio/HTTP) |
|
|
185
|
+
| `watch` | Watch files for changes and auto re-index |
|
|
186
|
+
| `status` | Show index status |
|
|
235
187
|
|
|
236
|
-
###
|
|
188
|
+
### Search & Inspect
|
|
237
189
|
|
|
238
|
-
|
|
|
190
|
+
| Command | Description |
|
|
239
191
|
|---|---|
|
|
240
|
-
| `
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `test_plan` | Mock strategy + 3+ test scenarios based on dependencies |
|
|
244
|
-
| `test_coverage_gaps` | Untested symbols sorted by risk |
|
|
245
|
-
| `test_impact` | Maps changed code → which test files to run |
|
|
192
|
+
| `search <query>` | Search symbols by name |
|
|
193
|
+
| `inspect <symbol>` | 360° view: refs, deps, hierarchy |
|
|
194
|
+
| `impact <symbol>` | Blast radius: what breaks if this symbol changes? |
|
|
246
195
|
|
|
247
|
-
###
|
|
196
|
+
### Maintenance
|
|
248
197
|
|
|
249
|
-
|
|
|
198
|
+
| Command | Description |
|
|
250
199
|
|---|---|
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
255
|
-
| `session_end` | Close session, record stats |
|
|
256
|
-
| `handoff` | Transfer all context from one agent session to another |
|
|
200
|
+
| `clean` | Remove index for a repository |
|
|
201
|
+
| `uninstall` | Remove all milens traces: injected blocks, generated files, hooks, cron, database, registry, MCP configs, deps, env vars |
|
|
202
|
+
| `upgrade` | Upgrade milens: clear npx cache, rebuild index while keeping annotations/sessions |
|
|
203
|
+
| `list` | List all indexed repositories |
|
|
257
204
|
|
|
258
205
|
### Security
|
|
259
206
|
|
|
260
|
-
|
|
|
207
|
+
| Command | Description |
|
|
261
208
|
|---|---|
|
|
262
|
-
| `
|
|
209
|
+
| `security scan` | Scan project for vulnerabilities (50+ rules, scope/severity filterable) |
|
|
210
|
+
| `security deps` | Audit dependencies for known vulnerabilities |
|
|
263
211
|
|
|
264
|
-
###
|
|
212
|
+
### Quality & Evolution
|
|
265
213
|
|
|
266
|
-
|
|
|
214
|
+
| Command | Description |
|
|
267
215
|
|---|---|
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `find_similar` | Symbols with shared callers/callees (topological similarity) |
|
|
216
|
+
| `metrics` | Compute code quality and efficiency metrics |
|
|
217
|
+
| `evolve` | Promote high-confidence annotations to rules/skills |
|
|
218
|
+
| `orchestrate` | Full review cycle: detect changes → risk → coverage gaps → dead code |
|
|
272
219
|
|
|
273
|
-
###
|
|
220
|
+
### Workflows
|
|
274
221
|
|
|
275
|
-
|
|
|
222
|
+
| Command | Description |
|
|
276
223
|
|---|---|
|
|
277
|
-
| `
|
|
278
|
-
| `
|
|
224
|
+
| `workflow tdd` | Test coverage gaps + risk-prioritized untested symbols |
|
|
225
|
+
| `workflow review` | PR risk analysis — git diff + heat scoring |
|
|
226
|
+
| `workflow plan` | Codebase summary — domains, top hubs |
|
|
227
|
+
| `workflow onboard` | Onboarding report — structure, entry points |
|
|
228
|
+
| `workflow security-scan` | Full security audit |
|
|
229
|
+
| `workflow refactor` | Dead code detection + candidates |
|
|
230
|
+
| `workflow handoff` | Session knowledge summary |
|
|
279
231
|
|
|
280
|
-
|
|
232
|
+
### Hooks
|
|
281
233
|
|
|
282
|
-
|
|
234
|
+
| Command | Description |
|
|
235
|
+
|---|---|
|
|
236
|
+
| `hooks enable` | Turn on all hooks |
|
|
237
|
+
| `hooks disable` | Turn off hooks |
|
|
238
|
+
| `hooks profile <name>` | Apply hook presets (minimal, standard, full) |
|
|
283
239
|
|
|
284
|
-
###
|
|
240
|
+
### Dashboard
|
|
285
241
|
|
|
286
|
-
|
|
287
|
-
|
|
242
|
+
| Command | Description |
|
|
243
|
+
|---|---|
|
|
244
|
+
| `dashboard` | Open usage analytics dashboard in browser |
|
|
288
245
|
|
|
289
|
-
|
|
290
|
-
role: hub | heat: 0.85
|
|
246
|
+
---
|
|
291
247
|
|
|
292
|
-
|
|
293
|
-
calls: handleLogin [function] src/routes.ts:23
|
|
294
|
-
calls: UserController [class] src/controllers/user.ts:8
|
|
295
|
-
imports: authRouter [variable] src/routes.ts:1
|
|
248
|
+
## MCP Tools
|
|
296
249
|
|
|
297
|
-
|
|
298
|
-
imports: User [class] src/models.ts:5
|
|
299
|
-
calls: hashPassword [function] src/auth.ts:3
|
|
300
|
-
calls: createUser [function] src/models.ts:42
|
|
301
|
-
```
|
|
250
|
+
### Search & Navigation
|
|
302
251
|
|
|
303
|
-
|
|
252
|
+
| Tool | Description |
|
|
253
|
+
|---|---|
|
|
254
|
+
| `query` | Find symbol definitions by name (FTS5) |
|
|
255
|
+
| `grep` | Text search across all files — code, templates, configs, docs |
|
|
256
|
+
| `context` | 360° view: incoming refs + outgoing deps |
|
|
257
|
+
| `get_file_symbols` | All symbols in a file |
|
|
258
|
+
| `get_type_hierarchy` | Inheritance/implementation tree |
|
|
259
|
+
| `semantic_search` | Hybrid FTS5 + vector search (requires `--embeddings`) |
|
|
260
|
+
| `find_similar` | Find symbols topologically similar |
|
|
304
261
|
|
|
305
|
-
|
|
306
|
-
impact({target: "createUser", direction: "upstream", depth: 3})
|
|
262
|
+
### Impact & Safety
|
|
307
263
|
|
|
308
|
-
|
|
264
|
+
| Tool | Description |
|
|
265
|
+
|---|---|
|
|
266
|
+
| `impact` | Blast radius — what breaks if this symbol changes? |
|
|
267
|
+
| `edit_check` | Pre-edit safety: callers, export status, re-export chains, warnings |
|
|
268
|
+
| `overview` | Combined context + impact + grep in one call |
|
|
269
|
+
| `detect_changes` | Git diff → affected symbols + dependents |
|
|
270
|
+
| `find_dead_code` | Exported symbols with zero incoming references |
|
|
271
|
+
| `pre_commit_check` | Pre-commit risk: review_pr + dead code + coverage gaps |
|
|
272
|
+
| `compare_impact` | Compare impact graph before/after edit |
|
|
309
273
|
|
|
310
|
-
|
|
311
|
-
AuthService [class] src/auth.ts:15 (calls)
|
|
312
|
-
UserController [class] src/controllers/user.ts:8 (calls)
|
|
274
|
+
### Review & Testing
|
|
313
275
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
276
|
+
| Tool | Description |
|
|
277
|
+
|---|---|
|
|
278
|
+
| `review_pr` | PR risk assessment: symbol-level diff via git show, cross-file impact |
|
|
279
|
+
| `review_symbol` | Single symbol deep-dive: role, heat, dependents, test status, risk |
|
|
280
|
+
| `codebase_summary` | Compact codebase overview: domains, top hubs, coverage |
|
|
281
|
+
| `test_plan` | Dependency-aware test strategy: mocks, scenarios |
|
|
282
|
+
| `test_generate` | Auto-generate test file with framework detection |
|
|
283
|
+
| `test_coverage_gaps` | Untested exported symbols sorted by risk |
|
|
284
|
+
| `test_impact` | Map code changes to which test files to run |
|
|
317
285
|
|
|
318
|
-
|
|
319
|
-
authRouter [variable] src/routes.ts:1 (imports)
|
|
320
|
-
adminDashboard [function] src/admin.ts:10 (calls)
|
|
286
|
+
### Orchestration
|
|
321
287
|
|
|
322
|
-
|
|
323
|
-
|
|
288
|
+
| Tool | Description |
|
|
289
|
+
|---|---|
|
|
290
|
+
| `orchestrate` | detect_changes → review_pr → impact → coverage gaps → dead code → action plan |
|
|
324
291
|
|
|
325
|
-
###
|
|
292
|
+
### Understanding
|
|
326
293
|
|
|
327
|
-
|
|
328
|
-
|
|
294
|
+
| Tool | Description |
|
|
295
|
+
|---|---|
|
|
296
|
+
| `smart_context` | Intent-aware: understand/edit/debug/test |
|
|
297
|
+
| `trace` | Execution flow: call chains from entrypoints to target |
|
|
298
|
+
| `routes` | Detect framework routes/endpoints (Express, FastAPI, NestJS, etc.) |
|
|
299
|
+
| `explain_relationship` | Shortest dependency path between two symbols |
|
|
300
|
+
| `domains` | Domain clusters: files forming logical modules |
|
|
329
301
|
|
|
330
|
-
|
|
331
|
-
6 changed files, 12 affected symbols
|
|
302
|
+
### Memory & Sessions
|
|
332
303
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
304
|
+
| Tool | Description |
|
|
305
|
+
|---|---|
|
|
306
|
+
| `annotate` | Record a note about a symbol (persists across sessions) |
|
|
307
|
+
| `recall` | Retrieve annotations from past sessions |
|
|
308
|
+
| `session_start` | Register agent session for multi-agent coordination |
|
|
309
|
+
| `session_end` | End session and record stats |
|
|
310
|
+
| `session_context` | Get session metadata + annotations |
|
|
311
|
+
| `handoff` | Transfer context between agent sessions |
|
|
337
312
|
|
|
338
|
-
|
|
339
|
-
```
|
|
313
|
+
### Security
|
|
340
314
|
|
|
341
|
-
|
|
315
|
+
| Tool | Description |
|
|
316
|
+
|---|---|
|
|
317
|
+
| `security_scan` | Scan for vulnerabilities — 50+ rules, 9 categories |
|
|
318
|
+
| `fix_apply` | Apply security fix to a file (creates backup) |
|
|
342
319
|
|
|
343
|
-
|
|
344
|
-
security_scan({scope: "all", severity: "HIGH"})
|
|
320
|
+
### Hooks
|
|
345
321
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
"score": 78
|
|
352
|
-
},
|
|
353
|
-
"findings": [
|
|
354
|
-
{
|
|
355
|
-
"ruleId": "SEC-001",
|
|
356
|
-
"category": "secrets",
|
|
357
|
-
"severity": "CRITICAL",
|
|
358
|
-
"owasp": "A02:2021",
|
|
359
|
-
"file": "src/config.ts",
|
|
360
|
-
"line": 15,
|
|
361
|
-
"match": "password = 'admin123'",
|
|
362
|
-
"fix": "Move to environment variable: process.env.DB_PASSWORD"
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
"ruleId": "SEC-011",
|
|
366
|
-
"category": "injection",
|
|
367
|
-
"severity": "HIGH",
|
|
368
|
-
"owasp": "A03:2021",
|
|
369
|
-
"file": "src/routes/admin.ts",
|
|
370
|
-
"line": 42,
|
|
371
|
-
"match": "eval(userInput)",
|
|
372
|
-
"fix": "Replace eval() with a safe parser or validator"
|
|
373
|
-
}
|
|
374
|
-
]
|
|
375
|
-
}
|
|
376
|
-
```
|
|
322
|
+
| Tool | Description |
|
|
323
|
+
|---|---|
|
|
324
|
+
| `hook_onFileChange` | Trigger when files are modified → impact summary |
|
|
325
|
+
| `hook_preCompact` | Save metrics snapshot before context compaction |
|
|
326
|
+
| `hook_postCompact` | Restore context by recalling annotations after compaction |
|
|
377
327
|
|
|
378
|
-
|
|
328
|
+
### Codebase Overview
|
|
379
329
|
|
|
380
|
-
|
|
330
|
+
| Tool | Description |
|
|
331
|
+
|---|---|
|
|
332
|
+
| `status` | Index stats: symbols, links, files, coverage, staleness |
|
|
333
|
+
| `repos` | List all indexed repositories with summary stats |
|
|
381
334
|
|
|
382
|
-
|
|
335
|
+
### Developer
|
|
383
336
|
|
|
384
|
-
|
|
|
385
|
-
|
|
386
|
-
| `
|
|
387
|
-
| `
|
|
388
|
-
| `milens-tester` | Symbol name | Find Gaps → Generate Plan → Implement → Verify → **Coverage Report** |
|
|
389
|
-
| `milens-architect` | (none) | Overview → Domains → Routes → Hierarchy → Connections → **Architecture Analysis** |
|
|
390
|
-
| `milens-security` | (none) | Scan PR → Secrets → Unicode → Dangerous → Data Leak → **Security Audit** |
|
|
391
|
-
| `milens-debugger` | Target + error | Context → Trace Execution → Impact → Find Relationship → **Root Cause Analysis** |
|
|
337
|
+
| Tool | Description |
|
|
338
|
+
|---|---|
|
|
339
|
+
| `ast_explore` | Parse code snippet to S-expression AST tree |
|
|
340
|
+
| `test_query` | Run tree-sitter query against code snippet |
|
|
392
341
|
|
|
393
342
|
---
|
|
394
343
|
|
|
395
|
-
##
|
|
344
|
+
## Sub-Agent Prompts
|
|
396
345
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
milens
|
|
400
|
-
milens
|
|
401
|
-
milens
|
|
402
|
-
milens
|
|
403
|
-
milens
|
|
404
|
-
milens
|
|
405
|
-
|
|
406
|
-
milens evolve [--schedule install|uninstall|status] Promote learned patterns
|
|
407
|
-
milens metrics TER, CQI, BRR, CTR...
|
|
408
|
-
milens search <query> [--limit 50] Find symbols
|
|
409
|
-
milens inspect <symbol> Incoming + outgoing deps
|
|
410
|
-
milens impact <symbol> [-d downstream] [--depth 2] Blast radius
|
|
411
|
-
milens status [-p .] Index health
|
|
412
|
-
milens list All indexed repos
|
|
413
|
-
milens clean [-p .] [--all] Remove index
|
|
414
|
-
milens dashboard [--port 8080] Usage analytics
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Workflow Examples
|
|
418
|
-
|
|
419
|
-
```bash
|
|
420
|
-
milens workflow tdd # Find test gaps → plan → verify
|
|
421
|
-
milens workflow review # PR review → risk scores → dead code
|
|
422
|
-
milens workflow plan "Add Stripe billing" # Full implementation plan
|
|
423
|
-
milens workflow onboard # Session startup checklist
|
|
424
|
-
milens workflow security-scan # All 50 rules at once
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Profile Selection
|
|
428
|
-
|
|
429
|
-
Control how many tools are active to optimize token overhead:
|
|
430
|
-
|
|
431
|
-
```bash
|
|
432
|
-
MILENS_PROFILE=minimal milens serve # 10 tools — ~500 token overhead
|
|
433
|
-
MILENS_PROFILE=standard milens serve # 25 tools — full daily coding
|
|
434
|
-
milens serve --profile full # 33 tools — everything
|
|
435
|
-
```
|
|
346
|
+
| Prompt | Purpose |
|
|
347
|
+
|---|---|
|
|
348
|
+
| `milens-planner` | Implementation planning with blast radius + test strategy |
|
|
349
|
+
| `milens-reviewer` | PR review — risk scan → deep dive → dead code → security |
|
|
350
|
+
| `milens-tester` | TDD — coverage gaps → test plans → implement → verify |
|
|
351
|
+
| `milens-security` | Security audit — secrets, injection, unicode, crypto, config |
|
|
352
|
+
| `milens-architect` | Architecture analysis — domains, routes, coupling, hierarchy |
|
|
353
|
+
| `milens-debugger` | Root cause analysis — trace → blast radius → hypotheses → fixes |
|
|
354
|
+
| `dead_code_remove` | Safe dead code removal with impact verification |
|
|
436
355
|
|
|
437
356
|
---
|
|
438
357
|
|
|
439
358
|
## Security (50+ Rules)
|
|
440
359
|
|
|
441
|
-
|
|
360
|
+
Rules cover common vulnerability patterns. One `security_scan()` call replaces multiple manual greps.
|
|
442
361
|
|
|
443
362
|
| Category | Rules | Detects |
|
|
444
363
|
|---|---|---|
|
|
@@ -446,107 +365,30 @@ All 50 rules map to **OWASP Top 10 (2021)**. One tool call covers what used to t
|
|
|
446
365
|
| **injection** | 9 | SQL injection, XSS, command injection, `eval()`, `exec()`, dangerous DOM |
|
|
447
366
|
| **unicode** | 4 | Zero-width chars, bidi override, homoglyph attacks |
|
|
448
367
|
| **dangerous** | 7 | `os.system`, `subprocess shell`, unsafe deserialization, `spawn shell` |
|
|
449
|
-
| **config** | 5 | CORS wildcards, insecure cookies, debug mode
|
|
368
|
+
| **config** | 5 | CORS wildcards, insecure cookies, debug mode |
|
|
450
369
|
| **data-leak** | 5 | `console.log` of secrets, hardcoded URLs |
|
|
451
370
|
| **crypto** | 4 | MD5, SHA1, `Math.random()` for crypto, hardcoded salt/IV |
|
|
452
|
-
| **auth** | 4 | String comparison, missing middleware, JWT without expiry
|
|
371
|
+
| **auth** | 4 | String comparison, missing middleware, JWT without expiry |
|
|
453
372
|
| **file-access** | 2 | Path traversal, unsafe file reads |
|
|
454
373
|
|
|
455
374
|
```bash
|
|
456
375
|
milens security scan --scope secrets --severity HIGH --format json
|
|
457
|
-
milens security deps # Offline CVE check
|
|
376
|
+
milens security deps # Offline CVE database check
|
|
458
377
|
```
|
|
459
378
|
|
|
460
379
|
From an AI agent: `security_scan({scope: "all", severity: "HIGH"})`
|
|
461
380
|
|
|
462
381
|
---
|
|
463
382
|
|
|
464
|
-
## Hook System (6 Triggers)
|
|
465
|
-
|
|
466
|
-
Automation so your agent never forgets:
|
|
467
|
-
|
|
468
|
-
| Hook | When | Default Action |
|
|
469
|
-
|---|---|---|
|
|
470
|
-
| `onSessionStart` | Agent begins work | Refresh index + codebase_summary + recall past warnings |
|
|
471
|
-
| `onSessionEnd` | Agent finishes | detect_changes + review_pr + auto-annotate changed symbols |
|
|
472
|
-
| `onPreCommit` | Before `git commit` | detect_changes + review_pr + find_dead_code |
|
|
473
|
-
| `onFileChange` | Files modified | Re-analyze changed files + impact on affected symbols |
|
|
474
|
-
| `onPreCompact` | Before context window compaction | Save codebase_summary snapshot |
|
|
475
|
-
| `onPostCompact` | After compaction | recall annotations to restore lost context |
|
|
476
|
-
|
|
477
|
-
```bash
|
|
478
|
-
milens hooks enable # Turn on all hooks
|
|
479
|
-
milens hooks profile standard # Preset: SessionStart, SessionEnd, PreCommit
|
|
480
|
-
milens hooks disable --hook preCommit # Turn off one hook
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
---
|
|
484
|
-
|
|
485
|
-
## Learning & Evolution
|
|
486
|
-
|
|
487
|
-
The system gets smarter every session:
|
|
488
|
-
|
|
489
|
-
```
|
|
490
|
-
SESSION 1: Agent finds bug in createUser()
|
|
491
|
-
→ annotate({symbol: "createUser", key: "bug", value: "Call createUser() before normalizeEmail()"})
|
|
492
|
-
→ confidence: 0.5
|
|
493
|
-
|
|
494
|
-
SESSION 2: Agent auto-recalls the annotation
|
|
495
|
-
→ "I know createUser() has a known issue. I'll handle the order correctly."
|
|
496
|
-
→ Bug avoided. confidence ↑ 0.7
|
|
497
|
-
|
|
498
|
-
SESSION 5: Confidence reaches 0.9
|
|
499
|
-
→ milens evolve promotes it to .agents/skills/milens-bug/SKILL.md
|
|
500
|
-
→ Now enforced as a rule for every future session
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
```bash
|
|
504
|
-
milens evolve # Promote high-confidence patterns now
|
|
505
|
-
milens evolve --schedule install # Auto-run weekly (cron/schtasks)
|
|
506
|
-
```
|
|
507
|
-
|
|
508
383
|
---
|
|
509
384
|
|
|
510
|
-
##
|
|
511
|
-
|
|
512
|
-
12 languages through tree-sitter:
|
|
513
|
-
|
|
514
|
-
| Language | Files | Imports | Calls | Heritage |
|
|
515
|
-
|---|---|---|---|---|
|
|
516
|
-
| TypeScript | `.ts` `.tsx` | ESM + CJS + decorators | ✓ + decorators | extends / implements |
|
|
517
|
-
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` | ESM + CJS | ✓ | extends |
|
|
518
|
-
| Python | `.py` | import + relative | ✓ + decorators | extends |
|
|
519
|
-
| Java | `.java` | import + static | ✓ + annotations | extends / implements |
|
|
520
|
-
| Go | `.go` | import + go.mod | ✓ | embedding |
|
|
521
|
-
| Rust | `.rs` | use | ✓ + macros | trait impl |
|
|
522
|
-
| PHP | `.php` | use + include | ✓ + static, new | extends + traits |
|
|
523
|
-
| Ruby | `.rb` | require | ✓ | extends |
|
|
524
|
-
| Vue | `.vue` | ESM | ✓ template refs | extends |
|
|
525
|
-
| HTML | `.html` `.htm` | `<script src>` `<link>` | ✓ inline | — |
|
|
526
|
-
| CSS | `.css` | `@import` | — | — |
|
|
527
|
-
| Markdown | `.md` `.mdx` | local `[links]()` | — | headings as sections |
|
|
528
|
-
|
|
529
|
-
**Framework detection** (via `routes()`)**: Express, FastAPI, NestJS, Flask, Django, Go net/http, Gin, PHP Laravel, Rails, Sinatra, Spring.
|
|
530
|
-
|
|
531
|
-
---
|
|
532
|
-
|
|
533
|
-
## Editor & Harness Support
|
|
534
|
-
|
|
535
|
-
Milens works with any MCP-compatible agent. Two ways to use:
|
|
536
|
-
|
|
537
|
-
| | MCP Server | CLI |
|
|
538
|
-
|---|---|---|
|
|
539
|
-
| **What** | Real-time tools for AI agents during coding | Direct commands from terminal |
|
|
540
|
-
| **For** | Daily development with AI agents | Scripts, CI/CD, one-off analysis |
|
|
541
|
-
| **Setup** | Add MCP config to editor | `npm install -g milens` |
|
|
542
|
-
| **Tools** | All 33 tools + 6 prompts | Full CLI command set |
|
|
543
|
-
| **Example** | Agent calls `impact()` before editing | `milens security scan --scope secrets` |
|
|
385
|
+
## Editor Adapters
|
|
544
386
|
|
|
545
|
-
|
|
387
|
+
Milens works with any MCP-compatible agent:
|
|
546
388
|
|
|
547
389
|
| Harness | Config File | Recommended Profile |
|
|
548
390
|
|---|---|---|
|
|
549
|
-
| **Claude Code** | `.claude/mcp.json` | standard
|
|
391
|
+
| **Claude Code** | `.claude/mcp.json` | standard |
|
|
550
392
|
| **OpenCode** | `.opencode/config.json` | standard |
|
|
551
393
|
| **VS Code / Copilot** | `.vscode/mcp.json` | standard |
|
|
552
394
|
| **Cursor** | `.cursorrules` | standard |
|
|
@@ -556,28 +398,20 @@ Milens works with any MCP-compatible agent. Two ways to use:
|
|
|
556
398
|
|
|
557
399
|
Each adapter is in the `adapters/` directory with ready-to-copy config files and agent instructions.
|
|
558
400
|
|
|
401
|
+
### Profile Selection
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
MILENS_PROFILE=minimal milens serve # 10 tools — lighter footprint
|
|
405
|
+
MILENS_PROFILE=standard milens serve # 25 tools — full daily coding
|
|
406
|
+
milens serve --profile full # 41 tools — everything
|
|
407
|
+
```
|
|
408
|
+
|
|
559
409
|
---
|
|
560
410
|
|
|
561
411
|
## Metrics
|
|
562
412
|
|
|
563
413
|
Seven quantified metrics for AI-driven development:
|
|
564
414
|
|
|
565
|
-
```
|
|
566
|
-
$ milens metrics
|
|
567
|
-
|
|
568
|
-
╔══════════════════════════════════════════════╗
|
|
569
|
-
║ Milens Metrics Report ║
|
|
570
|
-
╠══════════════════════════════════════════════╣
|
|
571
|
-
║ TER: Token Efficiency Ratio 0.85 ║
|
|
572
|
-
║ LR: Learning Rate 0.59 ║
|
|
573
|
-
║ CQI: Code Quality Index 7.2/10 ║
|
|
574
|
-
║ BRR: Bug Recurrence Rate 8% ║
|
|
575
|
-
║ TCGR: Test Coverage Growth Rate 5.2%/wk ║
|
|
576
|
-
║ DCER: Dead Code Elimination Rate 3% ║
|
|
577
|
-
║ CTR: Cycle Time Reduction 67% ║
|
|
578
|
-
╚══════════════════════════════════════════════╝
|
|
579
|
-
```
|
|
580
|
-
|
|
581
415
|
| Metric | Full Name | What It Tracks |
|
|
582
416
|
|---|---|---|
|
|
583
417
|
| **TER** | Token Efficiency Ratio | Useful tokens ÷ total tokens |
|
|
@@ -588,98 +422,88 @@ $ milens metrics
|
|
|
588
422
|
| **DCER** | Dead Code Elimination Rate | Dead symbols ÷ total exported |
|
|
589
423
|
| **CTR** | Cycle Time Reduction | Time saved vs manual approach |
|
|
590
424
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
**Zero network. Zero telemetry. Zero data leaving your machine.**
|
|
596
|
-
|
|
597
|
-
| Layer | Guarantee |
|
|
598
|
-
|---|---|
|
|
599
|
-
| **Data** | Index stored in `.milens/` per repo (gitignored). No source code in registry. |
|
|
600
|
-
| **Network** | HTTP binds `127.0.0.1` only. No outbound connections. |
|
|
601
|
-
| **Input** | User regex validated against ReDoS. FTS5 tokens quoted as literals. |
|
|
602
|
-
| **File access** | All paths bounded to repo root. No traversal possible. |
|
|
603
|
-
| **Git** | `execFileSync` with arg arrays. No shell interpolation. |
|
|
604
|
-
| **Embeddings** | Optional. Generated locally via Xenova transformers. No API calls. |
|
|
425
|
+
```bash
|
|
426
|
+
milens metrics
|
|
427
|
+
```
|
|
605
428
|
|
|
606
429
|
---
|
|
607
430
|
|
|
608
|
-
##
|
|
609
|
-
|
|
610
|
-
| Tier | Price | Key Features |
|
|
611
|
-
|---|---|---|
|
|
612
|
-
| **Free** | $0 | All 33 tools, public repos, 50+ security rules, CLI, community support. MIT core. |
|
|
613
|
-
| **Pro** | $19/seat/mo | Private repos, GitHub App, advanced scanning, priority support, custom skills |
|
|
614
|
-
| **Enterprise** | Contact | SSO/SAML, audit logging, on-prem, custom rules, SLAs, rollout consulting |
|
|
615
|
-
|
|
616
|
-
OSS stays free forever. [Full pricing details →](docs/pricing.md)
|
|
431
|
+
## Learning & Evolution
|
|
617
432
|
|
|
618
|
-
|
|
433
|
+
The system gets smarter every session:
|
|
619
434
|
|
|
620
|
-
|
|
435
|
+
```
|
|
436
|
+
SESSION 1: Agent finds bug in createUser()
|
|
437
|
+
→ annotate({symbol: "createUser", key: "bug", value: "Call createUser() before normalizeEmail()"})
|
|
438
|
+
→ confidence: 0.5
|
|
621
439
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
- **`milens init`** — One-command bootstrap: analyze + AGENTS.md + skill files + security rules + pre-commit hooks.
|
|
626
|
-
- **`milens workflow`** — 7 predefined pipelines: tdd, review, plan, security-scan, refactor, onboard, handoff.
|
|
627
|
-
- **Selective Profiles** — `minimal` (10 tools), `standard` (25), `full` (33). Control token overhead.
|
|
628
|
-
- **Watch Mode** — Auto re-index on file changes. `milens watch`.
|
|
629
|
-
- **Scheduled Evolve** — Auto-promote high-confidence patterns to skills. `milens evolve --schedule install`.
|
|
630
|
-
- **7 Harness Adapters** — Claude Code, OpenCode, Codex, Cursor, Copilot, Gemini, Zed.
|
|
631
|
-
- **GitHub App** — Probot-based app for automated PR review and `/milens analyze` on repos.
|
|
632
|
-
- **Desktop Dashboard** — Electron-based desktop app with 6 tabs (Overview, Domains, Learning, Metrics, Security, Settings).
|
|
633
|
-
- **Interactive Installer** — `milens init --interactive` walks through every option step by step.
|
|
440
|
+
SESSION 2: Agent auto-recalls the annotation
|
|
441
|
+
→ "I know createUser() has a known issue. I'll handle the order correctly."
|
|
442
|
+
→ Bug avoided. confidence ↑ 0.7
|
|
634
443
|
|
|
635
|
-
|
|
444
|
+
SESSION 5: Confidence reaches 0.9
|
|
445
|
+
→ milens evolve promotes it to .agents/skills/milens-bug/SKILL.md
|
|
446
|
+
→ Now enforced as a rule for every future session
|
|
447
|
+
```
|
|
636
448
|
|
|
637
449
|
---
|
|
638
450
|
|
|
639
|
-
##
|
|
451
|
+
## Hook System (6 Triggers)
|
|
640
452
|
|
|
641
|
-
|
|
|
453
|
+
| Hook | When | Default Action |
|
|
642
454
|
|---|---|---|
|
|
643
|
-
| `
|
|
644
|
-
| `
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
"mcpServers": {
|
|
650
|
-
"milens": {
|
|
651
|
-
"command": "npx",
|
|
652
|
-
"args": ["-y", "milens", "serve"],
|
|
653
|
-
"env": { "MILENS_PROFILE": "standard" }
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
```
|
|
455
|
+
| `onSessionStart` | Agent begins work | Refresh index + codebase_summary + recall past warnings |
|
|
456
|
+
| `onSessionEnd` | Agent finishes | detect_changes + review_pr + auto-annotate changed symbols |
|
|
457
|
+
| `onPreCommit` | Before `git commit` | detect_changes + review_pr + find_dead_code |
|
|
458
|
+
| `onFileChange` | Files modified | Re-analyze changed files + impact on affected symbols |
|
|
459
|
+
| `onPreCompact` | Before context window compaction | Save codebase_summary snapshot |
|
|
460
|
+
| `onPostCompact` | After compaction | recall annotations to restore lost context |
|
|
658
461
|
|
|
659
|
-
Or from CLI:
|
|
660
462
|
```bash
|
|
661
|
-
|
|
463
|
+
milens hooks enable # Turn on all hooks
|
|
464
|
+
milens hooks profile standard # Preset: SessionStart, SessionEnd, PreCommit
|
|
465
|
+
milens hooks disable --hook preCommit # Turn off one hook
|
|
662
466
|
```
|
|
663
467
|
|
|
664
468
|
---
|
|
665
469
|
|
|
666
|
-
##
|
|
470
|
+
## Security & Privacy
|
|
667
471
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
472
|
+
Milens runs entirely on your machine. **No network calls. No telemetry. No data ever leaves your device.**
|
|
473
|
+
|
|
474
|
+
| What you worry about | How milens protects you |
|
|
475
|
+
|---|---|
|
|
476
|
+
| Source code leaking | Index stored in `.milens/` per repo, gitignored by default. Registry tracks repo paths only — zero source code stored. |
|
|
477
|
+
| Network calls | MCP server binds `127.0.0.1` exclusively. No outbound connections. Works fully offline. |
|
|
478
|
+
| Shell injection | All system calls use `execFileSync` with argument arrays — no string interpolation into shell. |
|
|
479
|
+
| Path traversal | File paths bounded to repo root. Symlinks outside root are rejected. |
|
|
480
|
+
| Dependency CVEs | Optional `security deps` audit against offline CVE database. No external API calls. |
|
|
481
|
+
| Embeddings privacy | Optional. Generated locally via Xenova transformers. No data sent to any service. |
|
|
482
|
+
| Input attacks | Regex validated against ReDoS. FTS5 tokens passed as SQLite literals. |
|
|
678
483
|
|
|
679
|
-
|
|
484
|
+
Everything that touches your code stays on your filesystem. Built for production use with zero trust required.
|
|
680
485
|
|
|
681
486
|
---
|
|
682
487
|
|
|
488
|
+
## Supported Languages
|
|
489
|
+
|
|
490
|
+
<p align="center">
|
|
491
|
+
<img src="https://img.shields.io/badge/TypeScript-.ts%20.tsx-3178C6?logo=typescript&logoColor=white" alt="TS">
|
|
492
|
+
<img src="https://img.shields.io/badge/JavaScript-.js%20.jsx-F7DF1E?logo=javascript&logoColor=black" alt="JS">
|
|
493
|
+
<img src="https://img.shields.io/badge/Python-.py-3776AB?logo=python&logoColor=white" alt="PY">
|
|
494
|
+
<img src="https://img.shields.io/badge/Java-.java-ED8B00?logo=openjdk&logoColor=white" alt="Java">
|
|
495
|
+
<img src="https://img.shields.io/badge/Go-.go-00ADD8?logo=go&logoColor=white" alt="Go">
|
|
496
|
+
<img src="https://img.shields.io/badge/Rust-.rs-000000?logo=rust&logoColor=white" alt="Rust">
|
|
497
|
+
<img src="https://img.shields.io/badge/PHP-.php-777BB4?logo=php&logoColor=white" alt="PHP">
|
|
498
|
+
<img src="https://img.shields.io/badge/Ruby-.rb%20.rake-CC342D?logo=ruby&logoColor=white" alt="Ruby">
|
|
499
|
+
<img src="https://img.shields.io/badge/Vue-.vue-4FC08D?logo=vuedotjs&logoColor=white" alt="Vue">
|
|
500
|
+
<img src="https://img.shields.io/badge/HTML-.html%20.htm-E34F26?logo=html5&logoColor=white" alt="HTML">
|
|
501
|
+
<img src="https://img.shields.io/badge/CSS-.css-1572B6?logo=css3&logoColor=white" alt="CSS">
|
|
502
|
+
<img src="https://img.shields.io/badge/Markdown-.md%20.mdx-000000?logo=markdown&logoColor=white" alt="MD">
|
|
503
|
+
</p>
|
|
504
|
+
|
|
505
|
+
12 languages parsed via tree-sitter WASM. [Full support details →](docs/languages.md)
|
|
506
|
+
|
|
683
507
|
## License
|
|
684
508
|
|
|
685
509
|
Core (analyzer, parser, store, CLI, MCP tools): **MIT License**
|
|
@@ -691,6 +515,9 @@ See [LICENSE](LICENSE) for details.
|
|
|
691
515
|
<p align="center">
|
|
692
516
|
<a href="https://github.com/fuze210699/milens">GitHub</a> ·
|
|
693
517
|
<a href="https://github.com/fuze210699/milens/tree/main/docs">Docs</a> ·
|
|
518
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/cli.md">CLI</a> ·
|
|
519
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/accuracy.md">Accuracy</a> ·
|
|
520
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/languages.md">Languages</a> ·
|
|
694
521
|
<a href="https://github.com/fuze210699/milens/blob/main/docs/pricing.md">Pricing</a> ·
|
|
695
522
|
<a href="https://github.com/fuze210699/milens/blob/main/CONTRIBUTING.md">Contribute</a>
|
|
696
523
|
</p>
|