milens 0.6.2 → 0.6.4
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 +31 -0
- package/.agents/skills/analyzer/SKILL.md +55 -0
- package/.agents/skills/apps/SKILL.md +42 -0
- package/.agents/skills/docs/SKILL.md +46 -0
- package/.agents/skills/milens/SKILL.md +168 -0
- package/.agents/skills/milens-code-review/SKILL.md +186 -0
- package/.agents/skills/milens-eval/SKILL.md +221 -0
- package/.agents/skills/milens-plan/SKILL.md +227 -0
- package/.agents/skills/milens-refactor-clean/SKILL.md +209 -0
- package/.agents/skills/milens-security-review/SKILL.md +224 -0
- package/.agents/skills/milens-tdd/SKILL.md +156 -0
- package/.agents/skills/parser/SKILL.md +60 -0
- package/.agents/skills/root/SKILL.md +64 -0
- package/.agents/skills/scripts/SKILL.md +27 -0
- package/.agents/skills/security/SKILL.md +44 -0
- package/.agents/skills/server/SKILL.md +46 -0
- package/.agents/skills/store/SKILL.md +53 -0
- package/.agents/skills/test/SKILL.md +73 -0
- package/LICENSE +75 -75
- package/README.md +524 -305
- package/adapters/README.md +107 -0
- package/adapters/claude-code/.claude/mcp.json +9 -0
- package/adapters/claude-code/CLAUDE.md +58 -0
- package/adapters/codex/.codex/codex.md +52 -0
- package/adapters/copilot/.github/copilot-instructions.md +62 -0
- package/adapters/cursor/.cursorrules +9 -0
- package/adapters/gemini/.gemini/context.md +58 -0
- package/adapters/opencode/.opencode/config.json +9 -0
- package/adapters/opencode/AGENTS.md +58 -0
- package/adapters/zed/.zed/settings.json +8 -0
- package/dist/agents-md.d.ts +3 -0
- package/dist/agents-md.d.ts.map +1 -0
- package/dist/agents-md.js +112 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/analyzer/engine.d.ts +1 -0
- package/dist/analyzer/engine.d.ts.map +1 -1
- package/dist/analyzer/engine.js +27 -8
- package/dist/analyzer/engine.js.map +1 -1
- package/dist/analyzer/review.d.ts +23 -0
- package/dist/analyzer/review.d.ts.map +1 -0
- package/dist/analyzer/review.js +143 -0
- package/dist/analyzer/review.js.map +1 -0
- package/dist/analyzer/testplan.d.ts +59 -0
- package/dist/analyzer/testplan.d.ts.map +1 -0
- package/dist/analyzer/testplan.js +218 -0
- package/dist/analyzer/testplan.js.map +1 -0
- package/dist/cli.js +1192 -401
- package/dist/cli.js.map +1 -1
- package/dist/metrics.d.ts +51 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +64 -0
- package/dist/metrics.js.map +1 -0
- package/dist/parser/extract.d.ts +1 -0
- package/dist/parser/extract.d.ts.map +1 -1
- package/dist/parser/extract.js +8 -0
- package/dist/parser/extract.js.map +1 -1
- package/dist/parser/lang-go.d.ts.map +1 -1
- package/dist/parser/lang-go.js +75 -39
- package/dist/parser/lang-go.js.map +1 -1
- package/dist/parser/lang-java.d.ts.map +1 -1
- package/dist/parser/lang-java.js +30 -29
- package/dist/parser/lang-java.js.map +1 -1
- package/dist/parser/lang-js.js +105 -105
- package/dist/parser/lang-php.js +38 -38
- package/dist/parser/lang-py.d.ts.map +1 -1
- package/dist/parser/lang-py.js +53 -31
- 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 +15 -14
- package/dist/parser/lang-ruby.js.map +1 -1
- package/dist/parser/lang-rust.js +30 -30
- package/dist/parser/lang-ts.js +191 -191
- package/dist/security/deps.d.ts +38 -0
- package/dist/security/deps.d.ts.map +1 -0
- package/dist/security/deps.js +685 -0
- package/dist/security/deps.js.map +1 -0
- package/dist/security/rules.d.ts +42 -0
- package/dist/security/rules.d.ts.map +1 -0
- package/dist/security/rules.js +940 -0
- package/dist/security/rules.js.map +1 -0
- package/dist/server/hooks.d.ts +26 -0
- package/dist/server/hooks.d.ts.map +1 -0
- package/dist/server/hooks.js +253 -0
- package/dist/server/hooks.js.map +1 -0
- package/dist/server/mcp-prompts.d.ts +277 -0
- package/dist/server/mcp-prompts.d.ts.map +1 -0
- package/dist/server/mcp-prompts.js +627 -0
- package/dist/server/mcp-prompts.js.map +1 -0
- package/dist/server/mcp.d.ts.map +1 -1
- package/dist/server/mcp.js +520 -36
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/test-plan.d.ts +20 -0
- package/dist/server/test-plan.d.ts.map +1 -0
- package/dist/server/test-plan.js +100 -0
- package/dist/server/test-plan.js.map +1 -0
- package/dist/skills.js +152 -120
- package/dist/skills.js.map +1 -1
- package/dist/store/annotations.d.ts +41 -0
- package/dist/store/annotations.d.ts.map +1 -0
- package/dist/store/annotations.js +192 -0
- package/dist/store/annotations.js.map +1 -0
- package/dist/store/confidence.d.ts +18 -0
- package/dist/store/confidence.d.ts.map +1 -0
- package/dist/store/confidence.js +82 -0
- package/dist/store/confidence.js.map +1 -0
- package/dist/store/db.d.ts +68 -1
- package/dist/store/db.d.ts.map +1 -1
- package/dist/store/db.js +349 -139
- package/dist/store/db.js.map +1 -1
- package/dist/store/schema.sql +128 -83
- package/dist/store/vectors.d.ts +65 -0
- package/dist/store/vectors.d.ts.map +1 -0
- package/dist/store/vectors.js +212 -0
- package/dist/store/vectors.js.map +1 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +9 -0
- package/dist/utils.js.map +1 -0
- package/docs/README.md +24 -0
- package/docs/diagram2.svg +1 -1
- package/package.json +80 -65
package/README.md
CHANGED
|
@@ -1,477 +1,696 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<strong>
|
|
3
|
-
<em>
|
|
2
|
+
<strong>Milens</strong><br>
|
|
3
|
+
<em>AI-DOS — The Operating System for AI-Driven Development</em>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
|
-
<a href="https://www.npmjs.com/package/milens"><img src="https://img.shields.io/npm/v/milens" alt="npm
|
|
8
|
-
<a href="https://
|
|
9
|
-
<a href="https://
|
|
10
|
-
<img src="https://img.shields.io/badge/
|
|
11
|
-
<img src="https://img.shields.io/badge/
|
|
7
|
+
<a href="https://www.npmjs.com/package/milens"><img src="https://img.shields.io/npm/v/milens" alt="npm"></a>
|
|
8
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node"></a>
|
|
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-33-purple" alt="33 tools">
|
|
11
|
+
<img src="https://img.shields.io/badge/prompts-6-orange" alt="6 prompts">
|
|
12
|
+
<img src="https://img.shields.io/badge/security-50%2B-red" alt="50+ rules">
|
|
13
|
+
<img src="https://img.shields.io/badge/harnesses-7-lightgrey" alt="7 harnesses">
|
|
12
14
|
</p>
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
<strong>Index any codebase → Knowledge graph → AI agents that never miss code</strong>
|
|
16
|
-
</p>
|
|
16
|
+
---
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
|
-
<a href="
|
|
20
|
-
<a href="
|
|
21
|
-
<a href="
|
|
22
|
-
<a href="
|
|
23
|
-
<a href="#editor-setup">Editors</a> •
|
|
24
|
-
<a href="#supported-languages">Languages</a>
|
|
19
|
+
<a href="https://github.com/fuze210699/milens">⭐ Star</a> ·
|
|
20
|
+
<a href="https://github.com/sponsors/fuze210699">💖 Sponsor</a> ·
|
|
21
|
+
<a href="https://github.com/fuze210699/milens/discussions">💬 Discussions</a> ·
|
|
22
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/pricing.md">Pro $19/seat</a>
|
|
25
23
|
</p>
|
|
26
24
|
|
|
27
25
|
---
|
|
28
26
|
|
|
29
27
|
## The Problem
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
AI coding agents are powerful — but they don't truly know your codebase.
|
|
32
30
|
|
|
33
|
-
**
|
|
31
|
+
**What happens every session:**
|
|
34
32
|
|
|
35
|
-
|
|
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
36
|
|
|
37
|
-
|
|
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
38
|
|
|
39
|
-
|
|
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
40
|
|
|
41
|
-
|
|
42
|
-
<img src="docs/diagram1.svg" alt="Without milens vs With milens comparison" width="700">
|
|
43
|
-
</p>
|
|
41
|
+
---
|
|
44
42
|
|
|
45
|
-
|
|
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.**
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## What is Milens?
|
|
61
|
+
|
|
62
|
+
Milens gives AI coding agents **instant code intelligence**. Instead of reading 15 files to understand a codebase, your agent calls one tool and gets the full picture in 500 tokens.
|
|
63
|
+
|
|
64
|
+
It builds a **knowledge graph** of your entire project — every function, class, import, call, and inheritance chain — then exposes it through 33 MCP tools. Agents query the graph instead of searching files. The result: **70% fewer tokens** per session, **zero broken dependencies**, and a system that **learns from every session**.
|
|
65
|
+
|
|
66
|
+
- **Analyze once.** Tree-sitter parses 12 languages into a SQLite knowledge graph.
|
|
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.
|
|
71
|
+
|
|
72
|
+
Fully offline. Zero telemetry. Localhost-only MCP server. One command to bootstrap.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
npx milens init --profile full
|
|
76
|
+
```
|
|
46
77
|
|
|
47
78
|
---
|
|
48
79
|
|
|
49
80
|
## Quick Start
|
|
50
81
|
|
|
51
82
|
```bash
|
|
52
|
-
|
|
83
|
+
npm install -g milens # install globally
|
|
84
|
+
cd your-project
|
|
85
|
+
milens init --profile full --interactive # bootstrap everything
|
|
53
86
|
```
|
|
54
87
|
|
|
55
|
-
|
|
88
|
+
That single command analyzes your codebase, builds a knowledge graph, generates `AGENTS.md`, installs skill files, configures security rules, and sets up pre-commit hooks.
|
|
56
89
|
|
|
57
|
-
|
|
90
|
+
Then connect your editor:
|
|
58
91
|
|
|
59
|
-
|
|
92
|
+
```json
|
|
93
|
+
// .vscode/mcp.json — VS Code / Copilot
|
|
94
|
+
{
|
|
95
|
+
"servers": {
|
|
96
|
+
"milens": {
|
|
97
|
+
"type": "stdio",
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["-y", "milens", "serve", "-p", "${workspaceFolder}"]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
60
104
|
|
|
61
|
-
|
|
105
|
+
```bash
|
|
106
|
+
# Claude Code
|
|
107
|
+
claude mcp add milens -- npx -y milens serve -p .
|
|
62
108
|
|
|
63
|
-
|
|
109
|
+
# Cursor — .cursor/mcp.json
|
|
110
|
+
{ "mcpServers": { "milens": { "command": "npx", "args": ["-y", "milens", "serve", "-p", "."] } } }
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
milens
|
|
67
|
-
milens analyze -p /path/to/repo # index a specific repo
|
|
68
|
-
milens analyze -p . --force # full re-index (ignore cache)
|
|
69
|
-
milens analyze -p . --force --verbose # full re-index with detailed progress
|
|
112
|
+
# OpenCode — .opencode/config.json
|
|
113
|
+
{ "mcp": { "milens": { "command": "npx", "args": ["-y", "milens", "serve"] } } }
|
|
70
114
|
```
|
|
71
115
|
|
|
72
|
-
|
|
116
|
+
Open your AI agent. It auto-loads `AGENTS.md` with codebase context. You're ready.
|
|
73
117
|
|
|
74
|
-
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Architecture
|
|
75
121
|
|
|
76
|
-
|
|
122
|
+
```
|
|
123
|
+
npx milens init
|
|
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
|
|
150
|
+
```
|
|
77
151
|
|
|
78
|
-
|
|
152
|
+
### Four-Layer Stack
|
|
79
153
|
|
|
80
|
-
```bash
|
|
81
|
-
milens analyze -p . --skills # generate for all editors
|
|
82
|
-
milens analyze -p . --skills-copilot # GitHub Copilot only
|
|
83
|
-
milens analyze -p . --skills-cursor # Cursor only
|
|
84
|
-
milens analyze -p . --skills-claude # Claude Code only
|
|
85
|
-
milens analyze -p . --skills-agents # AGENTS.md only
|
|
86
|
-
milens analyze -p . --skills-windsurf # Windsurf only
|
|
87
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
|
+
```
|
|
176
|
+
|
|
177
|
+
### Pipeline
|
|
88
178
|
|
|
89
|
-
|
|
|
179
|
+
| Stage | What Happens | Technology |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| **Scan** | Discover source files by extension | Node.js `fs` |
|
|
182
|
+
| **Parse** | Extract symbols, imports, calls, heritage | tree-sitter WASM (12 languages) |
|
|
183
|
+
| **Resolve** | Match imports to files, calls to definitions | Cross-file linker |
|
|
184
|
+
| **Enrich** | Compute roles, heat scores, domain clusters | Union-find + PageRank-like |
|
|
185
|
+
| **Persist** | Store everything in SQLite | better-sqlite3 + FTS5 |
|
|
186
|
+
| **Serve** | Expose via MCP protocol | stdio + StreamableHTTP |
|
|
187
|
+
| **Learn** | Annotate → confidence score → promote → skill | SQLite + evolution log |
|
|
188
|
+
| **Scan** | 50+ regex rules across all files | Built-in security engine |
|
|
189
|
+
|
|
190
|
+
### Design Principles
|
|
191
|
+
|
|
192
|
+
| Principle | Implementation |
|
|
90
193
|
|---|---|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
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. |
|
|
96
201
|
|
|
97
|
-
|
|
202
|
+
---
|
|
98
203
|
|
|
99
|
-
|
|
204
|
+
## MCP Tools (33)
|
|
100
205
|
|
|
101
|
-
|
|
102
|
-
- ✅ **No merge conflicts** - No machine-specific information (username, absolute paths, etc.)
|
|
103
|
-
- ✅ **Consistent AI assistance** - All team members get the same codebase intelligence
|
|
104
|
-
- ⚠️ **Database is gitignored** - `.milens/*.db` files are local; each developer runs `npx milens analyze` after clone
|
|
206
|
+
### Search & Navigation
|
|
105
207
|
|
|
106
|
-
|
|
208
|
+
| Tool | Does |
|
|
209
|
+
|---|---|
|
|
210
|
+
| `query` | FTS5 full-text search for symbol definitions |
|
|
211
|
+
| `grep` | Regex search across ALL project files (code, configs, docs, templates) |
|
|
212
|
+
| `context` | 360° view: who calls this + what this depends on |
|
|
213
|
+
| `get_file_symbols` | Every symbol in a file with ref/dep counts |
|
|
214
|
+
| `get_type_hierarchy` | Full inheritance tree — ancestors + descendants |
|
|
107
215
|
|
|
108
|
-
|
|
216
|
+
### Safety & Impact
|
|
109
217
|
|
|
110
|
-
|
|
218
|
+
| Tool | Does |
|
|
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 |
|
|
111
225
|
|
|
112
|
-
|
|
226
|
+
### Understanding Code
|
|
113
227
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
228
|
+
| Tool | Does |
|
|
229
|
+
|---|---|
|
|
230
|
+
| `smart_context` | Intent-aware context: `edit` / `debug` / `test` / `understand` |
|
|
231
|
+
| `trace` | Full execution path from entrypoints to target (or reverse) |
|
|
232
|
+
| `routes` | Auto-detect API endpoints across 11 frameworks |
|
|
233
|
+
| `explain_relationship` | Shortest dependency chain between any two symbols |
|
|
234
|
+
| `domains` | Module clusters based on cross-file dependency graph |
|
|
119
235
|
|
|
120
|
-
|
|
236
|
+
### Review & Testing
|
|
121
237
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
238
|
+
| Tool | Does |
|
|
239
|
+
|---|---|
|
|
240
|
+
| `review_pr` | Scores every changed symbol CRITICAL/HIGH/MEDIUM/LOW |
|
|
241
|
+
| `review_symbol` | Deep-dive: role, heat, dependents, test status, recommendation |
|
|
242
|
+
| `codebase_summary` | ~500 token overview for session bootstrap |
|
|
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 |
|
|
126
246
|
|
|
127
|
-
|
|
247
|
+
### Memory & Sessions
|
|
128
248
|
|
|
129
|
-
|
|
249
|
+
| Tool | Does |
|
|
250
|
+
|---|---|
|
|
251
|
+
| `annotate` | Save observation about a symbol (persists forever) |
|
|
252
|
+
| `recall` | Retrieve past annotations by symbol, key, agent, or session |
|
|
253
|
+
| `session_start` | Begin new session with agent identity |
|
|
254
|
+
| `session_context` | Session metadata + tool calls + annotations |
|
|
255
|
+
| `session_end` | Close session, record stats |
|
|
256
|
+
| `handoff` | Transfer all context from one agent session to another |
|
|
130
257
|
|
|
131
|
-
|
|
258
|
+
### Security
|
|
132
259
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```
|
|
260
|
+
| Tool | Does |
|
|
261
|
+
|---|---|
|
|
262
|
+
| `security_scan` | **50+ rules in one call.** Scopes: secrets, injection, unicode, dangerous, config, data-leak, crypto, auth, file-access |
|
|
137
263
|
|
|
138
|
-
|
|
264
|
+
### Overview & Similarity
|
|
139
265
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
266
|
+
| Tool | Does |
|
|
267
|
+
|---|---|
|
|
268
|
+
| `status` | Index stats, test coverage %, link accuracy |
|
|
269
|
+
| `repos` | List all indexed repositories |
|
|
270
|
+
| `semantic_search` | Meaning-based symbol search (FTS5 + vector hybrid) |
|
|
271
|
+
| `find_similar` | Symbols with shared callers/callees (topological similarity) |
|
|
272
|
+
|
|
273
|
+
### Developer
|
|
274
|
+
|
|
275
|
+
| Tool | Does |
|
|
276
|
+
|---|---|
|
|
277
|
+
| `ast_explore` | Parse code snippet → S-expression AST tree |
|
|
278
|
+
| `test_query` | Test a tree-sitter query against code |
|
|
150
279
|
|
|
151
280
|
---
|
|
152
281
|
|
|
153
|
-
|
|
282
|
+
## Tool Output Examples
|
|
154
283
|
|
|
155
|
-
|
|
284
|
+
### Context — 360° Symbol View
|
|
156
285
|
|
|
157
|
-
```bash
|
|
158
|
-
milens impact "createUser" # upstream: what breaks if this changes?
|
|
159
|
-
milens impact "UserModel" -d downstream # downstream: what does this depend on?
|
|
160
|
-
milens impact "searchSymbols" --depth 2 # limit traversal depth (default: 3)
|
|
161
286
|
```
|
|
287
|
+
context({name: "AuthService"})
|
|
288
|
+
|
|
289
|
+
AuthService [class] src/auth.ts:15 (exported)
|
|
290
|
+
role: hub | heat: 0.85
|
|
162
291
|
|
|
163
|
-
|
|
292
|
+
incoming (3):
|
|
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
|
|
164
296
|
|
|
297
|
+
outgoing (3):
|
|
298
|
+
imports: User [class] src/models.ts:5
|
|
299
|
+
calls: hashPassword [function] src/auth.ts:3
|
|
300
|
+
calls: createUser [function] src/models.ts:42
|
|
165
301
|
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
[depth 2] handleLogin [function] src/routes.ts:23 (calls)
|
|
302
|
+
|
|
303
|
+
### Impact — Blast Radius
|
|
304
|
+
|
|
170
305
|
```
|
|
306
|
+
impact({target: "createUser", direction: "upstream", depth: 3})
|
|
171
307
|
|
|
172
|
-
|
|
173
|
-
- Depth 1 = **WILL BREAK** — direct callers/dependents
|
|
174
|
-
- Depth 2 = **LIKELY AFFECTED** — indirect dependents
|
|
175
|
-
- Depth 3 = **MAY NEED TESTING** — transitive dependents
|
|
308
|
+
TARGET: createUser [function] src/models.ts:42
|
|
176
309
|
|
|
177
|
-
|
|
310
|
+
[depth 1] WILL BREAK:
|
|
311
|
+
AuthService [class] src/auth.ts:15 (calls)
|
|
312
|
+
UserController [class] src/controllers/user.ts:8 (calls)
|
|
178
313
|
|
|
179
|
-
|
|
314
|
+
[depth 2] LIKELY AFFECTED:
|
|
315
|
+
handleLogin [function] src/routes.ts:23 (calls)
|
|
316
|
+
handleRegister [function] src/routes.ts:45 (calls)
|
|
180
317
|
|
|
181
|
-
|
|
318
|
+
[depth 3] MAY NEED TESTING:
|
|
319
|
+
authRouter [variable] src/routes.ts:1 (imports)
|
|
320
|
+
adminDashboard [function] src/admin.ts:10 (calls)
|
|
182
321
|
|
|
183
|
-
|
|
184
|
-
milens serve # stdio transport (for editors)
|
|
185
|
-
milens serve -p /path/to/repo # serve a specific repo
|
|
186
|
-
milens serve --http # HTTP transport on port 3100
|
|
187
|
-
milens serve --http --port 8080 # HTTP on custom port
|
|
322
|
+
5 dependents across 3 depths
|
|
188
323
|
```
|
|
189
324
|
|
|
190
|
-
|
|
325
|
+
### Review PR — Risk Assessment
|
|
191
326
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
Endpoint: `POST http://localhost:3100/mcp`
|
|
327
|
+
```
|
|
328
|
+
review_pr({})
|
|
195
329
|
|
|
196
|
-
|
|
330
|
+
PR Risk Assessment (vs HEAD):
|
|
331
|
+
6 changed files, 12 affected symbols
|
|
197
332
|
|
|
198
|
-
|
|
333
|
+
handlePayment [function] src/payment.ts:30 — heat:92 deps:15 test:no → CRITICAL(85)
|
|
334
|
+
checkoutRoute [function] src/routes/checkout.ts:5 — heat:78 deps:8 test:yes → HIGH(58)
|
|
335
|
+
UserModel [class] src/models.ts:20 — heat:65 deps:3 test:yes → MEDIUM(35)
|
|
336
|
+
formatCurrency [function] src/utils.ts:45 — heat:10 deps:0 test:no → LOW(15)
|
|
199
337
|
|
|
200
|
-
|
|
201
|
-
milens status # current directory
|
|
202
|
-
milens status -p /path/to/repo # specific repo
|
|
338
|
+
Summary: CRITICAL=1 HIGH=2 MEDIUM=4 LOW=5
|
|
203
339
|
```
|
|
204
340
|
|
|
205
|
-
|
|
341
|
+
### Security Scan — 50 Rules at Once
|
|
206
342
|
|
|
207
343
|
```
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
344
|
+
security_scan({scope: "all", severity: "HIGH"})
|
|
345
|
+
|
|
346
|
+
{
|
|
347
|
+
"summary": {
|
|
348
|
+
"totalScanned": 1240,
|
|
349
|
+
"findings": 8,
|
|
350
|
+
"bySeverity": { "CRITICAL": 1, "HIGH": 3, "MEDIUM": 4 },
|
|
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
|
+
}
|
|
214
376
|
```
|
|
215
377
|
|
|
216
378
|
---
|
|
217
379
|
|
|
218
|
-
|
|
380
|
+
## Sub-agent Prompts (6)
|
|
219
381
|
|
|
220
|
-
|
|
221
|
-
milens list
|
|
222
|
-
```
|
|
382
|
+
Instead of chaining 5-10 tools manually, your agent calls one prompt:
|
|
223
383
|
|
|
224
|
-
|
|
384
|
+
| Prompt | Input | Workflow |
|
|
385
|
+
|---|---|---|
|
|
386
|
+
| `milens-planner` | Feature description | Research → Analyze Target → Predict Impact → Plan Tests → **Implementation Plan** |
|
|
387
|
+
| `milens-reviewer` | Change description | Scan PR → Deep-dive Symbols → Find Dead Code → Text Search → **Review Report** |
|
|
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** |
|
|
225
392
|
|
|
226
|
-
|
|
227
|
-
3 indexed repositories:
|
|
393
|
+
---
|
|
228
394
|
|
|
229
|
-
|
|
230
|
-
DB: /home/user/project-a/.milens/milens.db
|
|
231
|
-
Indexed: 2026-04-11T10:30:00Z
|
|
395
|
+
## CLI Commands
|
|
232
396
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
397
|
+
```
|
|
398
|
+
milens init [--profile minimal|standard|full] [--interactive] Bootstrap a project
|
|
399
|
+
milens analyze [-p .] [--force] [--skills] [--embeddings] Index a codebase
|
|
400
|
+
milens serve [-p .] [--http] [--port 3100] [--profile minimal] Start MCP server
|
|
401
|
+
milens workflow <name> Run predefined pipeline
|
|
402
|
+
milens security scan [--scope secrets] [--severity HIGH] Security audit
|
|
403
|
+
milens security deps Dependency CVE check
|
|
404
|
+
milens hooks enable|disable|list|profile Manage automation
|
|
405
|
+
milens watch [--debounce 2000] Auto re-index on change
|
|
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
|
|
236
415
|
```
|
|
237
416
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
### `milens clean` — Remove index
|
|
417
|
+
### Workflow Examples
|
|
241
418
|
|
|
242
419
|
```bash
|
|
243
|
-
milens
|
|
244
|
-
milens
|
|
245
|
-
milens
|
|
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
|
|
246
425
|
```
|
|
247
426
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
### `milens dashboard` — Usage analytics
|
|
427
|
+
### Profile Selection
|
|
251
428
|
|
|
252
|
-
|
|
429
|
+
Control how many tools are active to optimize token overhead:
|
|
253
430
|
|
|
254
431
|
```bash
|
|
255
|
-
milens
|
|
256
|
-
milens
|
|
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
|
|
257
435
|
```
|
|
258
436
|
|
|
259
437
|
---
|
|
260
438
|
|
|
261
|
-
##
|
|
439
|
+
## Security (50+ Rules)
|
|
262
440
|
|
|
263
|
-
|
|
441
|
+
All 50 rules map to **OWASP Top 10 (2021)**. One tool call covers what used to take 10 manual greps.
|
|
264
442
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
| Tool | What It Does | Example |
|
|
443
|
+
| Category | Rules | Detects |
|
|
268
444
|
|---|---|---|
|
|
269
|
-
|
|
|
270
|
-
|
|
|
271
|
-
|
|
|
272
|
-
|
|
|
273
|
-
|
|
|
445
|
+
| **secrets** | 10 | AWS keys, GitHub tokens, OpenAI keys, private keys, hardcoded passwords |
|
|
446
|
+
| **injection** | 9 | SQL injection, XSS, command injection, `eval()`, `exec()`, dangerous DOM |
|
|
447
|
+
| **unicode** | 4 | Zero-width chars, bidi override, homoglyph attacks |
|
|
448
|
+
| **dangerous** | 7 | `os.system`, `subprocess shell`, unsafe deserialization, `spawn shell` |
|
|
449
|
+
| **config** | 5 | CORS wildcards, insecure cookies, debug mode, `--dangerously-skip-permissions` |
|
|
450
|
+
| **data-leak** | 5 | `console.log` of secrets, hardcoded URLs |
|
|
451
|
+
| **crypto** | 4 | MD5, SHA1, `Math.random()` for crypto, hardcoded salt/IV |
|
|
452
|
+
| **auth** | 4 | String comparison, missing middleware, JWT without expiry, session in URL |
|
|
453
|
+
| **file-access** | 2 | Path traversal, unsafe file reads |
|
|
274
454
|
|
|
275
|
-
|
|
455
|
+
```bash
|
|
456
|
+
milens security scan --scope secrets --severity HIGH --format json
|
|
457
|
+
milens security deps # Offline CVE check (34 known vulns, 5 ecosystems)
|
|
458
|
+
```
|
|
276
459
|
|
|
277
|
-
|
|
278
|
-
|---|---|---|
|
|
279
|
-
| `impact` | Blast radius: what breaks if this changes? | `impact({target: "createUser"})` |
|
|
280
|
-
| `edit_check` | Pre-edit safety: callers + exports + test coverage + ⚠ warnings | `edit_check({name: "resolveLinks"})` |
|
|
281
|
-
| `detect_changes` | Git diff → affected symbols + direct dependents | `detect_changes({})` |
|
|
282
|
-
| `find_dead_code` | Exported symbols with zero references | `find_dead_code({})` |
|
|
460
|
+
From an AI agent: `security_scan({scope: "all", severity: "HIGH"})`
|
|
283
461
|
|
|
284
|
-
|
|
462
|
+
---
|
|
285
463
|
|
|
286
|
-
|
|
287
|
-
|---|---|---|
|
|
288
|
-
| `smart_context` | Intent-aware context: `understand`/`edit`/`debug`/`test` | `smart_context({name: "analyze", intent: "edit"})` |
|
|
289
|
-
| `trace` | Execution flow: call chains to/from entrypoints | `trace({to: "searchSymbols"})` |
|
|
290
|
-
| `routes` | Detect framework routes/endpoints | `routes({})` |
|
|
291
|
-
| `explain_relationship` | Shortest path between two symbols | `explain_relationship({from: "A", to: "B"})` |
|
|
292
|
-
| `overview` | Combined context + impact + grep in ONE call | `overview({name: "Database"})` |
|
|
464
|
+
## Hook System (6 Triggers)
|
|
293
465
|
|
|
294
|
-
|
|
466
|
+
Automation so your agent never forgets:
|
|
295
467
|
|
|
296
|
-
|
|
|
468
|
+
| Hook | When | Default Action |
|
|
297
469
|
|---|---|---|
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
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 |
|
|
301
476
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
| `test_query` | Test tree-sitter query against code snippet | `test_query({query: "(identifier) @name", code: "const x = 1", language: "typescript"})` |
|
|
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
|
+
```
|
|
308
482
|
|
|
309
|
-
|
|
483
|
+
---
|
|
310
484
|
|
|
311
|
-
|
|
485
|
+
## Learning & Evolution
|
|
312
486
|
|
|
313
|
-
|
|
487
|
+
The system gets smarter every session:
|
|
314
488
|
|
|
315
|
-
|
|
489
|
+
```
|
|
490
|
+
SESSION 1: Agent finds bug in createUser()
|
|
491
|
+
→ annotate({symbol: "createUser", key: "bug", value: "Call createUser() before normalizeEmail()"})
|
|
492
|
+
→ confidence: 0.5
|
|
316
493
|
|
|
317
|
-
|
|
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
|
|
318
497
|
|
|
319
|
-
|
|
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
|
+
```
|
|
320
502
|
|
|
321
503
|
```bash
|
|
322
|
-
|
|
504
|
+
milens evolve # Promote high-confidence patterns now
|
|
505
|
+
milens evolve --schedule install # Auto-run weekly (cron/schtasks)
|
|
323
506
|
```
|
|
324
507
|
|
|
325
|
-
|
|
508
|
+
---
|
|
326
509
|
|
|
327
|
-
|
|
328
|
-
{
|
|
329
|
-
"servers": {
|
|
330
|
-
"milens": {
|
|
331
|
-
"type": "stdio",
|
|
332
|
-
"command": "npx",
|
|
333
|
-
"args": ["-y", "milens", "serve", "-p", "${workspaceFolder}"]
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
```
|
|
510
|
+
## Supported Languages
|
|
338
511
|
|
|
339
|
-
|
|
340
|
-
|
|
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.
|
|
341
530
|
|
|
342
|
-
|
|
531
|
+
---
|
|
343
532
|
|
|
344
|
-
|
|
533
|
+
## Editor & Harness Support
|
|
345
534
|
|
|
346
|
-
|
|
347
|
-
{
|
|
348
|
-
"mcpServers": {
|
|
349
|
-
"milens": {
|
|
350
|
-
"command": "npx",
|
|
351
|
-
"args": ["-y", "milens", "serve", "-p", "."]
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
```
|
|
535
|
+
Milens works with any MCP-compatible agent. Two ways to use:
|
|
356
536
|
|
|
357
|
-
|
|
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` |
|
|
358
544
|
|
|
359
|
-
|
|
360
|
-
claude mcp add milens -- npx -y milens serve -p .
|
|
361
|
-
```
|
|
545
|
+
**Harness adapters available for 7 editors:**
|
|
362
546
|
|
|
363
|
-
|
|
547
|
+
| Harness | Config File | Recommended Profile |
|
|
548
|
+
|---|---|---|
|
|
549
|
+
| **Claude Code** | `.claude/mcp.json` | standard (25 tools) |
|
|
550
|
+
| **OpenCode** | `.opencode/config.json` | standard |
|
|
551
|
+
| **VS Code / Copilot** | `.vscode/mcp.json` | standard |
|
|
552
|
+
| **Cursor** | `.cursorrules` | standard |
|
|
553
|
+
| **Codex** | `.codex/codex.md` | standard |
|
|
554
|
+
| **Gemini** | `.gemini/context.md` | minimal (10 tools) |
|
|
555
|
+
| **Zed** | `.zed/settings.json` | minimal |
|
|
364
556
|
|
|
365
|
-
|
|
557
|
+
Each adapter is in the `adapters/` directory with ready-to-copy config files and agent instructions.
|
|
366
558
|
|
|
367
|
-
|
|
368
|
-
{
|
|
369
|
-
"mcpServers": {
|
|
370
|
-
"milens": {
|
|
371
|
-
"command": "npx",
|
|
372
|
-
"args": ["-y", "milens", "serve", "-p", "."]
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
```
|
|
559
|
+
---
|
|
377
560
|
|
|
378
|
-
|
|
561
|
+
## Metrics
|
|
379
562
|
|
|
380
|
-
|
|
563
|
+
Seven quantified metrics for AI-driven development:
|
|
381
564
|
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
+
╚══════════════════════════════════════════════╝
|
|
386
579
|
```
|
|
387
580
|
|
|
388
|
-
|
|
581
|
+
| Metric | Full Name | What It Tracks |
|
|
582
|
+
|---|---|---|
|
|
583
|
+
| **TER** | Token Efficiency Ratio | Useful tokens ÷ total tokens |
|
|
584
|
+
| **LR** | Learning Rate | Savings gained ÷ savings possible |
|
|
585
|
+
| **CQI** | Code Quality Index | Coverage + security + coupling + docs |
|
|
586
|
+
| **BRR** | Bug Recurrence Rate | Bugs repeated ÷ total fixed |
|
|
587
|
+
| **TCGR** | Test Coverage Growth Rate | Weekly coverage improvement |
|
|
588
|
+
| **DCER** | Dead Code Elimination Rate | Dead symbols ÷ total exported |
|
|
589
|
+
| **CTR** | Cycle Time Reduction | Time saved vs manual approach |
|
|
389
590
|
|
|
390
591
|
---
|
|
391
592
|
|
|
392
|
-
##
|
|
593
|
+
## Security & Privacy
|
|
594
|
+
|
|
595
|
+
**Zero network. Zero telemetry. Zero data leaving your machine.**
|
|
393
596
|
|
|
394
|
-
|
|
|
395
|
-
|
|
396
|
-
|
|
|
397
|
-
|
|
|
398
|
-
|
|
|
399
|
-
|
|
|
400
|
-
|
|
|
401
|
-
|
|
|
402
|
-
| PHP | `.php` | ✓ + include | ✓ + static, new | ✓ + traits | Laravel |
|
|
403
|
-
| Ruby | `.rb` | ✓ | ✓ | ✓ | Rails |
|
|
404
|
-
| Vue | `.vue` | ✓ | ✓ template refs | ✓ | Vue 3 SFC |
|
|
405
|
-
| HTML | `.html` `.htm` | ✓ `<script src>` `<link>` | ✓ inline `<script>` | — | — |
|
|
406
|
-
| CSS | `.css` | ✓ `@import` | — | — | Custom properties |
|
|
407
|
-
| Markdown | `.md` `.mdx` | ✓ local `[links]()` | — | — | Headings → section symbols, parent-child hierarchy |
|
|
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. |
|
|
408
605
|
|
|
409
606
|
---
|
|
410
607
|
|
|
411
|
-
##
|
|
608
|
+
## Pricing
|
|
412
609
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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 |
|
|
418
615
|
|
|
419
|
-
|
|
420
|
-
2. **Parse** — tree-sitter extracts symbols (functions, classes, methods, etc.) and raw references (imports, calls, extends)
|
|
421
|
-
3. **Resolve** — cross-file link resolution: match import paths to files, match call names to symbol definitions
|
|
422
|
-
4. **Enrich** — compute roles (entrypoint/hub/utility/leaf), heat scores, domain clusters
|
|
423
|
-
5. **Persist** — store everything in SQLite with FTS5 search and recursive CTEs for graph traversal
|
|
616
|
+
OSS stays free forever. [Full pricing details →](docs/pricing.md)
|
|
424
617
|
|
|
425
|
-
|
|
618
|
+
---
|
|
426
619
|
|
|
427
|
-
|
|
620
|
+
## What's New in v0.7.0
|
|
428
621
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
622
|
+
- **6 Sub-agent MCP Prompts** — planner, reviewer, tester, architect, security-auditor, debugger. One prompt replaces 5-10 chained tool calls.
|
|
623
|
+
- **50+ Built-in Security Rules** — OWASP Top 10 mapped. `security_scan()` replaces 10 manual greps. Dependency audit for 5 ecosystems.
|
|
624
|
+
- **Hook System** — 6 event triggers (SessionStart, SessionEnd, PreCommit, FileChange, PreCompact, PostCompact). Auto-annotate, auto-recall.
|
|
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.
|
|
432
634
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
| Decision | Rationale |
|
|
436
|
-
|---|---|
|
|
437
|
-
| **Declarative LangSpec** | Each language = 1 config object with tree-sitter queries. One universal extractor for all 12 languages |
|
|
438
|
-
| **SQLite + recursive CTE** | Impact analysis runs entirely in the database — no full graph in memory |
|
|
439
|
-
| **Token-compact output** | `name [kind] file:line` format — saves 40-60% tokens for AI |
|
|
440
|
-
| **Incremental by hash** | SHA-256 file hashing — only changed files get re-parsed |
|
|
441
|
-
| **Localhost-only HTTP** | Binds `127.0.0.1` — no network exposure without explicit intent |
|
|
635
|
+
[Full changelog →](https://github.com/fuze210699/milens/releases)
|
|
442
636
|
|
|
443
637
|
---
|
|
444
638
|
|
|
445
|
-
##
|
|
639
|
+
## Environment Variables
|
|
446
640
|
|
|
447
|
-
|
|
641
|
+
| Variable | Default | Effect |
|
|
642
|
+
|---|---|---|
|
|
643
|
+
| `MILENS_PROFILE` | (unset = full) | Tool set: `minimal` (10 tools), `standard` (25), `full` (33) |
|
|
644
|
+
| `MILENS_VERSION` | (from package.json) | Override version reported in MCP server metadata |
|
|
448
645
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
646
|
+
Use in MCP config:
|
|
647
|
+
```json
|
|
648
|
+
{
|
|
649
|
+
"mcpServers": {
|
|
650
|
+
"milens": {
|
|
651
|
+
"command": "npx",
|
|
652
|
+
"args": ["-y", "milens", "serve"],
|
|
653
|
+
"env": { "MILENS_PROFILE": "standard" }
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
Or from CLI:
|
|
660
|
+
```bash
|
|
661
|
+
MILENS_PROFILE=minimal milens serve
|
|
662
|
+
```
|
|
457
663
|
|
|
458
664
|
---
|
|
459
665
|
|
|
460
666
|
## Development
|
|
461
667
|
|
|
462
668
|
```bash
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
npm
|
|
466
|
-
npm run
|
|
467
|
-
npm
|
|
468
|
-
npm run
|
|
669
|
+
git clone https://github.com/fuze210699/milens.git
|
|
670
|
+
cd milens
|
|
671
|
+
npm install
|
|
672
|
+
npm run build # tsc → dist/
|
|
673
|
+
npm test # vitest (136 tests)
|
|
674
|
+
npm run lint # tsc --noEmit
|
|
675
|
+
npm run self-analyze # Index milens with milens
|
|
676
|
+
npm run self-serve # Start MCP on port 3100
|
|
469
677
|
```
|
|
470
678
|
|
|
679
|
+
**Tech Stack:** TypeScript (ESM) · tree-sitter (WASM) · SQLite (better-sqlite3 + FTS5) · MCP SDK · Vitest · Commander
|
|
680
|
+
|
|
471
681
|
---
|
|
472
682
|
|
|
473
683
|
## License
|
|
474
684
|
|
|
475
|
-
|
|
685
|
+
Core (analyzer, parser, store, CLI, MCP tools): **MIT License**
|
|
686
|
+
Advanced features (GitHub App, enterprise): Commercial license
|
|
687
|
+
See [LICENSE](LICENSE) for details.
|
|
688
|
+
|
|
689
|
+
---
|
|
476
690
|
|
|
477
|
-
|
|
691
|
+
<p align="center">
|
|
692
|
+
<a href="https://github.com/fuze210699/milens">GitHub</a> ·
|
|
693
|
+
<a href="https://github.com/fuze210699/milens/tree/main/docs">Docs</a> ·
|
|
694
|
+
<a href="https://github.com/fuze210699/milens/blob/main/docs/pricing.md">Pricing</a> ·
|
|
695
|
+
<a href="https://github.com/fuze210699/milens/blob/main/CONTRIBUTING.md">Contribute</a>
|
|
696
|
+
</p>
|