emdash-ai 0.1.0__tar.gz
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.
- emdash_ai-0.1.0/PKG-INFO +223 -0
- emdash_ai-0.1.0/README.md +186 -0
- emdash_ai-0.1.0/emdash/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/__main__.py +6 -0
- emdash_ai-0.1.0/emdash/agent/__init__.py +14 -0
- emdash_ai-0.1.0/emdash/agent/agent_builder.py +588 -0
- emdash_ai-0.1.0/emdash/agent/agents.py +134 -0
- emdash_ai-0.1.0/emdash/agent/code_reviewer.py +472 -0
- emdash_ai-0.1.0/emdash/agent/coding_agent.py +1294 -0
- emdash_ai-0.1.0/emdash/agent/coding_toolkit.py +330 -0
- emdash_ai-0.1.0/emdash/agent/compaction.py +131 -0
- emdash_ai-0.1.0/emdash/agent/discovery.py +602 -0
- emdash_ai-0.1.0/emdash/agent/enhanced_review.py +960 -0
- emdash_ai-0.1.0/emdash/agent/events.py +277 -0
- emdash_ai-0.1.0/emdash/agent/handlers.py +340 -0
- emdash_ai-0.1.0/emdash/agent/implementation.py +400 -0
- emdash_ai-0.1.0/emdash/agent/mcp/__init__.py +46 -0
- emdash_ai-0.1.0/emdash/agent/mcp/client.py +1177 -0
- emdash_ai-0.1.0/emdash/agent/mcp/config.py +280 -0
- emdash_ai-0.1.0/emdash/agent/mcp/manager.py +472 -0
- emdash_ai-0.1.0/emdash/agent/mcp/tool_factory.py +246 -0
- emdash_ai-0.1.0/emdash/agent/providers/__init__.py +34 -0
- emdash_ai-0.1.0/emdash/agent/providers/base.py +144 -0
- emdash_ai-0.1.0/emdash/agent/providers/factory.py +80 -0
- emdash_ai-0.1.0/emdash/agent/providers/models.py +220 -0
- emdash_ai-0.1.0/emdash/agent/providers/openai_provider.py +449 -0
- emdash_ai-0.1.0/emdash/agent/providers/transformers_provider.py +217 -0
- emdash_ai-0.1.0/emdash/agent/research/__init__.py +82 -0
- emdash_ai-0.1.0/emdash/agent/research/agent.py +296 -0
- emdash_ai-0.1.0/emdash/agent/research/controller.py +408 -0
- emdash_ai-0.1.0/emdash/agent/research/critic.py +715 -0
- emdash_ai-0.1.0/emdash/agent/research/macros.py +865 -0
- emdash_ai-0.1.0/emdash/agent/research/planner.py +450 -0
- emdash_ai-0.1.0/emdash/agent/research/researcher.py +1444 -0
- emdash_ai-0.1.0/emdash/agent/research/state.py +524 -0
- emdash_ai-0.1.0/emdash/agent/research/synthesizer.py +650 -0
- emdash_ai-0.1.0/emdash/agent/review.py +508 -0
- emdash_ai-0.1.0/emdash/agent/reviewer_profile.py +442 -0
- emdash_ai-0.1.0/emdash/agent/rules.py +90 -0
- emdash_ai-0.1.0/emdash/agent/runner.py +925 -0
- emdash_ai-0.1.0/emdash/agent/session.py +295 -0
- emdash_ai-0.1.0/emdash/agent/spec_schema.py +66 -0
- emdash_ai-0.1.0/emdash/agent/specification.py +473 -0
- emdash_ai-0.1.0/emdash/agent/toolkit.py +401 -0
- emdash_ai-0.1.0/emdash/agent/tools/__init__.py +26 -0
- emdash_ai-0.1.0/emdash/agent/tools/analytics.py +500 -0
- emdash_ai-0.1.0/emdash/agent/tools/base.py +131 -0
- emdash_ai-0.1.0/emdash/agent/tools/coding.py +613 -0
- emdash_ai-0.1.0/emdash/agent/tools/github_mcp.py +1214 -0
- emdash_ai-0.1.0/emdash/agent/tools/history.py +15 -0
- emdash_ai-0.1.0/emdash/agent/tools/modes.py +219 -0
- emdash_ai-0.1.0/emdash/agent/tools/plan.py +414 -0
- emdash_ai-0.1.0/emdash/agent/tools/search.py +517 -0
- emdash_ai-0.1.0/emdash/agent/tools/spec.py +257 -0
- emdash_ai-0.1.0/emdash/agent/tools/tasks.py +322 -0
- emdash_ai-0.1.0/emdash/agent/tools/traversal.py +636 -0
- emdash_ai-0.1.0/emdash/agent/tools/web.py +260 -0
- emdash_ai-0.1.0/emdash/analytics/__init__.py +5 -0
- emdash_ai-0.1.0/emdash/analytics/engine.py +1268 -0
- emdash_ai-0.1.0/emdash/auth/__init__.py +17 -0
- emdash_ai-0.1.0/emdash/auth/github.py +389 -0
- emdash_ai-0.1.0/emdash/cli/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/cli/main.py +5386 -0
- emdash_ai-0.1.0/emdash/cli/pretty_output.py +503 -0
- emdash_ai-0.1.0/emdash/cli/prompt.py +1303 -0
- emdash_ai-0.1.0/emdash/context/__init__.py +52 -0
- emdash_ai-0.1.0/emdash/context/models.py +50 -0
- emdash_ai-0.1.0/emdash/context/providers/__init__.py +11 -0
- emdash_ai-0.1.0/emdash/context/providers/base.py +74 -0
- emdash_ai-0.1.0/emdash/context/providers/explored_areas.py +183 -0
- emdash_ai-0.1.0/emdash/context/providers/touched_areas.py +360 -0
- emdash_ai-0.1.0/emdash/context/registry.py +73 -0
- emdash_ai-0.1.0/emdash/context/reranker.py +199 -0
- emdash_ai-0.1.0/emdash/context/service.py +260 -0
- emdash_ai-0.1.0/emdash/context/session.py +352 -0
- emdash_ai-0.1.0/emdash/core/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/core/config.py +413 -0
- emdash_ai-0.1.0/emdash/core/exceptions.py +41 -0
- emdash_ai-0.1.0/emdash/core/models.py +265 -0
- emdash_ai-0.1.0/emdash/core/review_config.py +57 -0
- emdash_ai-0.1.0/emdash/db/__init__.py +67 -0
- emdash_ai-0.1.0/emdash/db/auth.py +134 -0
- emdash_ai-0.1.0/emdash/db/models.py +91 -0
- emdash_ai-0.1.0/emdash/db/provider.py +222 -0
- emdash_ai-0.1.0/emdash/db/providers/__init__.py +5 -0
- emdash_ai-0.1.0/emdash/db/providers/supabase.py +452 -0
- emdash_ai-0.1.0/emdash/embeddings/__init__.py +24 -0
- emdash_ai-0.1.0/emdash/embeddings/indexer.py +406 -0
- emdash_ai-0.1.0/emdash/embeddings/models.py +192 -0
- emdash_ai-0.1.0/emdash/embeddings/providers/__init__.py +7 -0
- emdash_ai-0.1.0/emdash/embeddings/providers/base.py +112 -0
- emdash_ai-0.1.0/emdash/embeddings/providers/fireworks.py +141 -0
- emdash_ai-0.1.0/emdash/embeddings/providers/openai.py +104 -0
- emdash_ai-0.1.0/emdash/embeddings/registry.py +146 -0
- emdash_ai-0.1.0/emdash/embeddings/service.py +215 -0
- emdash_ai-0.1.0/emdash/graph/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/graph/builder.py +134 -0
- emdash_ai-0.1.0/emdash/graph/connection.py +434 -0
- emdash_ai-0.1.0/emdash/graph/schema.py +416 -0
- emdash_ai-0.1.0/emdash/graph/writer.py +667 -0
- emdash_ai-0.1.0/emdash/ingestion/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/ingestion/change_detector.py +150 -0
- emdash_ai-0.1.0/emdash/ingestion/git/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/ingestion/git/commit_analyzer.py +196 -0
- emdash_ai-0.1.0/emdash/ingestion/github/__init__.py +6 -0
- emdash_ai-0.1.0/emdash/ingestion/github/pr_fetcher.py +296 -0
- emdash_ai-0.1.0/emdash/ingestion/github/task_extractor.py +100 -0
- emdash_ai-0.1.0/emdash/ingestion/orchestrator.py +498 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/__init__.py +10 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/base_parser.py +66 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/call_graph_builder.py +121 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/class_extractor.py +154 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/function_extractor.py +202 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/import_analyzer.py +119 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/python_parser.py +123 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/registry.py +72 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/ts_ast_parser.js +313 -0
- emdash_ai-0.1.0/emdash/ingestion/parsers/typescript_parser.py +278 -0
- emdash_ai-0.1.0/emdash/ingestion/repository.py +346 -0
- emdash_ai-0.1.0/emdash/kanban/__init__.py +16 -0
- emdash_ai-0.1.0/emdash/kanban/app.py +644 -0
- emdash_ai-0.1.0/emdash/kanban/auth.py +598 -0
- emdash_ai-0.1.0/emdash/kanban/converters.py +141 -0
- emdash_ai-0.1.0/emdash/kanban/git_utils.py +84 -0
- emdash_ai-0.1.0/emdash/kanban/models.py +249 -0
- emdash_ai-0.1.0/emdash/kanban/store.py +93 -0
- emdash_ai-0.1.0/emdash/kanban/supabase_store.py +238 -0
- emdash_ai-0.1.0/emdash/kanban/themes.py +446 -0
- emdash_ai-0.1.0/emdash/kanban/widgets/__init__.py +7 -0
- emdash_ai-0.1.0/emdash/kanban/widgets/board.py +66 -0
- emdash_ai-0.1.0/emdash/kanban/widgets/card.py +135 -0
- emdash_ai-0.1.0/emdash/kanban/widgets/column.py +99 -0
- emdash_ai-0.1.0/emdash/kanban/widgets/modals.py +1124 -0
- emdash_ai-0.1.0/emdash/planning/__init__.py +7 -0
- emdash_ai-0.1.0/emdash/planning/agent_api.py +413 -0
- emdash_ai-0.1.0/emdash/planning/context_builder.py +265 -0
- emdash_ai-0.1.0/emdash/planning/feature_context.py +232 -0
- emdash_ai-0.1.0/emdash/planning/feature_expander.py +646 -0
- emdash_ai-0.1.0/emdash/planning/llm_explainer.py +198 -0
- emdash_ai-0.1.0/emdash/planning/similarity.py +509 -0
- emdash_ai-0.1.0/emdash/planning/team_focus.py +822 -0
- emdash_ai-0.1.0/emdash/queries/__init__.py +0 -0
- emdash_ai-0.1.0/emdash/swarm/__init__.py +17 -0
- emdash_ai-0.1.0/emdash/swarm/merge_agent.py +371 -0
- emdash_ai-0.1.0/emdash/swarm/session_manager.py +274 -0
- emdash_ai-0.1.0/emdash/swarm/swarm_runner.py +226 -0
- emdash_ai-0.1.0/emdash/swarm/task_definition.py +137 -0
- emdash_ai-0.1.0/emdash/swarm/worker_spawner.py +319 -0
- emdash_ai-0.1.0/emdash/swarm/worktree_manager.py +278 -0
- emdash_ai-0.1.0/emdash/templates/__init__.py +10 -0
- emdash_ai-0.1.0/emdash/templates/defaults/agent-builder.md.template +82 -0
- emdash_ai-0.1.0/emdash/templates/defaults/focus.md.template +115 -0
- emdash_ai-0.1.0/emdash/templates/defaults/pr-review-enhanced.md.template +309 -0
- emdash_ai-0.1.0/emdash/templates/defaults/pr-review.md.template +80 -0
- emdash_ai-0.1.0/emdash/templates/defaults/project.md.template +85 -0
- emdash_ai-0.1.0/emdash/templates/defaults/research_critic.md.template +112 -0
- emdash_ai-0.1.0/emdash/templates/defaults/research_planner.md.template +85 -0
- emdash_ai-0.1.0/emdash/templates/defaults/research_synthesizer.md.template +128 -0
- emdash_ai-0.1.0/emdash/templates/defaults/reviewer.md.template +81 -0
- emdash_ai-0.1.0/emdash/templates/defaults/spec.md.template +41 -0
- emdash_ai-0.1.0/emdash/templates/defaults/tasks.md.template +78 -0
- emdash_ai-0.1.0/emdash/templates/loader.py +296 -0
- emdash_ai-0.1.0/emdash/utils/__init__.py +29 -0
- emdash_ai-0.1.0/emdash/utils/image.py +502 -0
- emdash_ai-0.1.0/emdash/utils/logger.py +51 -0
- emdash_ai-0.1.0/pyproject.toml +93 -0
emdash_ai-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: emdash-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Graph-based coding intelligence system - The 'Senior Engineer' Context Engine
|
|
5
|
+
Author: Em Dash Team
|
|
6
|
+
Requires-Python: >=3.10,<4.0
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Provides-Extra: local
|
|
14
|
+
Requires-Dist: astroid (>=3.0.1,<4.0.0)
|
|
15
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
16
|
+
Requires-Dist: gitpython (>=3.1.40,<4.0.0)
|
|
17
|
+
Requires-Dist: httpx (>=0.25.0)
|
|
18
|
+
Requires-Dist: kuzu (>=0.4.0)
|
|
19
|
+
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
|
20
|
+
Requires-Dist: networkx (>=3.2.1,<4.0.0)
|
|
21
|
+
Requires-Dist: numpy (>=1.26.0)
|
|
22
|
+
Requires-Dist: openai (>=1.0.0)
|
|
23
|
+
Requires-Dist: pillow (>=10.0.0,<11.0.0)
|
|
24
|
+
Requires-Dist: prompt_toolkit (>=3.0.43,<4.0.0)
|
|
25
|
+
Requires-Dist: pydantic (>=2.5.0,<3.0.0)
|
|
26
|
+
Requires-Dist: pygithub (>=2.1.1,<3.0.0)
|
|
27
|
+
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
28
|
+
Requires-Dist: python-louvain (>=0.16,<0.17)
|
|
29
|
+
Requires-Dist: rich (>=13.7.0)
|
|
30
|
+
Requires-Dist: scipy (>=1.11.4,<2.0.0)
|
|
31
|
+
Requires-Dist: sentence-transformers (>=2.2.0)
|
|
32
|
+
Requires-Dist: supabase (>=2.0.0)
|
|
33
|
+
Requires-Dist: textual (>=0.47.0)
|
|
34
|
+
Requires-Dist: tqdm (>=4.66.1,<5.0.0)
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# EmDash - The "Senior Engineer" Context Engine
|
|
38
|
+
|
|
39
|
+
Transform your codebase into a living knowledge graph that combines static analysis (AST), social dynamics (Git history), and graph analytics to provide "senior engineer" level insights.
|
|
40
|
+
|
|
41
|
+
> **Why "EmDash"?** The em dash (—) has become a telltale signature of AI-generated text—appearing frequently in LLM outputs as a stylistic connector. We embraced this quirk as our name: EmDash is an AI-native tool, built for the era of AI-assisted development, where humans and LLMs collaborate on code.
|
|
42
|
+
|
|
43
|
+
## What is EmDash?
|
|
44
|
+
|
|
45
|
+
EmDash moves beyond flat RAG (Retrieval Augmented Generation) by building a multi-layered knowledge graph that captures:
|
|
46
|
+
|
|
47
|
+
- **Layer A: Structural Skeleton** - AST analysis of code structure (classes, functions, calls, inheritance)
|
|
48
|
+
- **Layer B: Social & Historical Fabric** - Git history showing who changed what and why
|
|
49
|
+
- **Layer C: Analytical Overlay** - Graph metrics (PageRank, Betweenness, Clustering) for impact analysis
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
### Install globally
|
|
54
|
+
|
|
55
|
+
Install directly from PyPI without cloning:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install emdash-ai
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This installs the `emdash` and `em` commands globally. You can then run `emdash onboard` in any repository.
|
|
62
|
+
|
|
63
|
+
### Install from source
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git clone <repo_url>
|
|
67
|
+
cd emdash
|
|
68
|
+
|
|
69
|
+
python3 -m venv venv
|
|
70
|
+
source venv/bin/activate
|
|
71
|
+
|
|
72
|
+
pip install -r requirements.txt
|
|
73
|
+
pip install -e .
|
|
74
|
+
npm install
|
|
75
|
+
|
|
76
|
+
cp .env.example .env
|
|
77
|
+
# Edit .env for your some credentials
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Prerequisites:** Python 3.10+, Node.js 14+, Git
|
|
81
|
+
|
|
82
|
+
**Optional:** `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` for LLM features
|
|
83
|
+
|
|
84
|
+
## Quick Start
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
source venv/bin/activate
|
|
88
|
+
|
|
89
|
+
# Start onboarding (recommended for first-time setup)
|
|
90
|
+
emdash onboard
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The `onboard` command walks you through the complete setup:
|
|
94
|
+
1. **Index the repository** - Parses AST and Git history into the knowledge graph
|
|
95
|
+
2. **GitHub authentication** - Sets up PAT for PR fetching (optional)
|
|
96
|
+
3. **Generate PROJECT.md** - Creates comprehensive documentation for LLM context
|
|
97
|
+
|
|
98
|
+
After onboarding, start exploring with:
|
|
99
|
+
```bash
|
|
100
|
+
em # Interactive code exploration
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Manual Setup (Alternative)
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
emdash index https://github.com/user/repo # Index from GitHub
|
|
107
|
+
emdash index /path/to/local/repo # Index local repo
|
|
108
|
+
emdash analyze pagerank --top 20 # Compute analytics
|
|
109
|
+
emdash db stats # View statistics
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## CLI Reference
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `emdash onboard` | Full setup: index + auth + PROJECT.md |
|
|
117
|
+
| `emdash index <repo>` | Index a repository (Python, TS, JS) |
|
|
118
|
+
| `emdash analyze <type>` | Run analytics (pagerank, betweenness, community, areas) |
|
|
119
|
+
| `emdash query <type>` | Query the graph (find-class, find-function, knowledge-silos) |
|
|
120
|
+
| `emdash agent chat` | Interactive LLM chat with graph tools |
|
|
121
|
+
| `emdash projectmd --save` | Generate PROJECT.md documentation |
|
|
122
|
+
| `emdash spec "feature" --save` | Generate feature specification |
|
|
123
|
+
| `emdash implement` | Generate implementation plan from spec |
|
|
124
|
+
| `emdash team focus` | LLM summary of team's recent work |
|
|
125
|
+
| `emdash review <pr>` | Generate PR review |
|
|
126
|
+
| `emdash db stats/clear/test` | Database management |
|
|
127
|
+
|
|
128
|
+
## Chat Commands
|
|
129
|
+
|
|
130
|
+
**In-chat:**
|
|
131
|
+
- `reset` - Clear conversation history
|
|
132
|
+
- `session` - Show session statistics
|
|
133
|
+
- `exit` / `quit` / `q` - Exit
|
|
134
|
+
|
|
135
|
+
**Slash commands** (type `/` to see all):
|
|
136
|
+
|
|
137
|
+
| Command | Description |
|
|
138
|
+
|---------|-------------|
|
|
139
|
+
| `/mcp` | Manage MCP servers - list, add, remove, or describe available servers |
|
|
140
|
+
| `/rules` | View custom rules loaded from `.emdash/rules/*.md` files |
|
|
141
|
+
| `/add-rule` | Add a new rule based on conversation context |
|
|
142
|
+
| `/create-agent` | Create a new custom agent interactively |
|
|
143
|
+
| `/agents` | Switch to a custom agent or list available agents |
|
|
144
|
+
| `/help` | Show all available commands |
|
|
145
|
+
|
|
146
|
+
**Custom Rules:** Create markdown files in `.emdash/rules/` to add instructions to the LLM system prompt.
|
|
147
|
+
|
|
148
|
+
## Features
|
|
149
|
+
|
|
150
|
+
### Graph Analytics
|
|
151
|
+
- **PageRank** - Most called/referenced functions
|
|
152
|
+
- **Betweenness Centrality** - Bridge entities connecting codebase parts
|
|
153
|
+
- **Community Detection** - Natural clusters and modules
|
|
154
|
+
- **Area Importance** - Hot spots with recent activity
|
|
155
|
+
|
|
156
|
+
### Senior Engineer Queries
|
|
157
|
+
- **Knowledge Silos** - Critical code with single owner
|
|
158
|
+
- **Domain Experts** - Who knows each module best
|
|
159
|
+
- **Change Impact** - What will be affected by changes
|
|
160
|
+
- **Dead Code** - Functions never called
|
|
161
|
+
|
|
162
|
+
### LLM-Powered Tools
|
|
163
|
+
- Interactive chat with 15+ graph exploration tools
|
|
164
|
+
- Auto-generated PROJECT.md documentation
|
|
165
|
+
- Feature specs from natural language descriptions
|
|
166
|
+
- Implementation plans with task breakdowns
|
|
167
|
+
- Team focus summaries
|
|
168
|
+
|
|
169
|
+
## Context Frame & Re-ranker
|
|
170
|
+
|
|
171
|
+
EmDash maintains a **Context Frame** - a dynamic window of relevant code entities that follows your exploration session.
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
175
|
+
│ CONTEXT FRAME PIPELINE │
|
|
176
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
177
|
+
|
|
178
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
179
|
+
│ Git Diff │ │ Agent │ │ Session │
|
|
180
|
+
│ (modified) │ │ Exploration │ │ State │
|
|
181
|
+
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
|
|
182
|
+
│ │ │
|
|
183
|
+
▼ ▼ ▼
|
|
184
|
+
┌──────────────────────────────────────────────────────────┐
|
|
185
|
+
│ CONTEXT PROVIDERS │
|
|
186
|
+
│ ┌─────────────────────┐ ┌─────────────────────────┐ │
|
|
187
|
+
│ │ TouchedAreasProvider│ │ ExploredAreasProvider │ │
|
|
188
|
+
│ │ • Modified files │ │ • Tool call results │ │
|
|
189
|
+
│ │ • AST neighbors │ │ • Search hits │ │
|
|
190
|
+
│ │ • 2-hop graph walk │ │ • Relevance scores │ │
|
|
191
|
+
│ └─────────────────────┘ └─────────────────────────┘ │
|
|
192
|
+
└──────────────────────────┬───────────────────────────────┘
|
|
193
|
+
│
|
|
194
|
+
▼
|
|
195
|
+
┌──────────────────────────────────────────────────────────┐
|
|
196
|
+
│ RE-RANKER │
|
|
197
|
+
│ │
|
|
198
|
+
│ Cross-encoder scores items against current query │
|
|
199
|
+
│ Keeps top 20 most relevant → LLM system prompt │
|
|
200
|
+
│ │
|
|
201
|
+
│ Model: mixedbread-ai/mxbai-rerank-xsmall-v1 │
|
|
202
|
+
└──────────────────────────────────────────────────────────┘
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**TouchedAreasProvider** - Tracks modified code via `git diff`, queries AST graph for related entities
|
|
206
|
+
|
|
207
|
+
**ExploredAreasProvider** - Records entities from agent tool calls with relevance scores
|
|
208
|
+
|
|
209
|
+
**Re-ranker** - Filters context to query-relevant items, reducing tokens while improving quality
|
|
210
|
+
|
|
211
|
+
## Development
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pytest # Run tests
|
|
215
|
+
black emdash/ # Format
|
|
216
|
+
mypy emdash/ # Type check
|
|
217
|
+
ruff check emdash/ # Lint
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
MIT
|
|
223
|
+
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# EmDash - The "Senior Engineer" Context Engine
|
|
2
|
+
|
|
3
|
+
Transform your codebase into a living knowledge graph that combines static analysis (AST), social dynamics (Git history), and graph analytics to provide "senior engineer" level insights.
|
|
4
|
+
|
|
5
|
+
> **Why "EmDash"?** The em dash (—) has become a telltale signature of AI-generated text—appearing frequently in LLM outputs as a stylistic connector. We embraced this quirk as our name: EmDash is an AI-native tool, built for the era of AI-assisted development, where humans and LLMs collaborate on code.
|
|
6
|
+
|
|
7
|
+
## What is EmDash?
|
|
8
|
+
|
|
9
|
+
EmDash moves beyond flat RAG (Retrieval Augmented Generation) by building a multi-layered knowledge graph that captures:
|
|
10
|
+
|
|
11
|
+
- **Layer A: Structural Skeleton** - AST analysis of code structure (classes, functions, calls, inheritance)
|
|
12
|
+
- **Layer B: Social & Historical Fabric** - Git history showing who changed what and why
|
|
13
|
+
- **Layer C: Analytical Overlay** - Graph metrics (PageRank, Betweenness, Clustering) for impact analysis
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Install globally
|
|
18
|
+
|
|
19
|
+
Install directly from PyPI without cloning:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install emdash-ai
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This installs the `emdash` and `em` commands globally. You can then run `emdash onboard` in any repository.
|
|
26
|
+
|
|
27
|
+
### Install from source
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone <repo_url>
|
|
31
|
+
cd emdash
|
|
32
|
+
|
|
33
|
+
python3 -m venv venv
|
|
34
|
+
source venv/bin/activate
|
|
35
|
+
|
|
36
|
+
pip install -r requirements.txt
|
|
37
|
+
pip install -e .
|
|
38
|
+
npm install
|
|
39
|
+
|
|
40
|
+
cp .env.example .env
|
|
41
|
+
# Edit .env for your some credentials
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Prerequisites:** Python 3.10+, Node.js 14+, Git
|
|
45
|
+
|
|
46
|
+
**Optional:** `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` for LLM features
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
source venv/bin/activate
|
|
52
|
+
|
|
53
|
+
# Start onboarding (recommended for first-time setup)
|
|
54
|
+
emdash onboard
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The `onboard` command walks you through the complete setup:
|
|
58
|
+
1. **Index the repository** - Parses AST and Git history into the knowledge graph
|
|
59
|
+
2. **GitHub authentication** - Sets up PAT for PR fetching (optional)
|
|
60
|
+
3. **Generate PROJECT.md** - Creates comprehensive documentation for LLM context
|
|
61
|
+
|
|
62
|
+
After onboarding, start exploring with:
|
|
63
|
+
```bash
|
|
64
|
+
em # Interactive code exploration
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Manual Setup (Alternative)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
emdash index https://github.com/user/repo # Index from GitHub
|
|
71
|
+
emdash index /path/to/local/repo # Index local repo
|
|
72
|
+
emdash analyze pagerank --top 20 # Compute analytics
|
|
73
|
+
emdash db stats # View statistics
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## CLI Reference
|
|
77
|
+
|
|
78
|
+
| Command | Description |
|
|
79
|
+
|---------|-------------|
|
|
80
|
+
| `emdash onboard` | Full setup: index + auth + PROJECT.md |
|
|
81
|
+
| `emdash index <repo>` | Index a repository (Python, TS, JS) |
|
|
82
|
+
| `emdash analyze <type>` | Run analytics (pagerank, betweenness, community, areas) |
|
|
83
|
+
| `emdash query <type>` | Query the graph (find-class, find-function, knowledge-silos) |
|
|
84
|
+
| `emdash agent chat` | Interactive LLM chat with graph tools |
|
|
85
|
+
| `emdash projectmd --save` | Generate PROJECT.md documentation |
|
|
86
|
+
| `emdash spec "feature" --save` | Generate feature specification |
|
|
87
|
+
| `emdash implement` | Generate implementation plan from spec |
|
|
88
|
+
| `emdash team focus` | LLM summary of team's recent work |
|
|
89
|
+
| `emdash review <pr>` | Generate PR review |
|
|
90
|
+
| `emdash db stats/clear/test` | Database management |
|
|
91
|
+
|
|
92
|
+
## Chat Commands
|
|
93
|
+
|
|
94
|
+
**In-chat:**
|
|
95
|
+
- `reset` - Clear conversation history
|
|
96
|
+
- `session` - Show session statistics
|
|
97
|
+
- `exit` / `quit` / `q` - Exit
|
|
98
|
+
|
|
99
|
+
**Slash commands** (type `/` to see all):
|
|
100
|
+
|
|
101
|
+
| Command | Description |
|
|
102
|
+
|---------|-------------|
|
|
103
|
+
| `/mcp` | Manage MCP servers - list, add, remove, or describe available servers |
|
|
104
|
+
| `/rules` | View custom rules loaded from `.emdash/rules/*.md` files |
|
|
105
|
+
| `/add-rule` | Add a new rule based on conversation context |
|
|
106
|
+
| `/create-agent` | Create a new custom agent interactively |
|
|
107
|
+
| `/agents` | Switch to a custom agent or list available agents |
|
|
108
|
+
| `/help` | Show all available commands |
|
|
109
|
+
|
|
110
|
+
**Custom Rules:** Create markdown files in `.emdash/rules/` to add instructions to the LLM system prompt.
|
|
111
|
+
|
|
112
|
+
## Features
|
|
113
|
+
|
|
114
|
+
### Graph Analytics
|
|
115
|
+
- **PageRank** - Most called/referenced functions
|
|
116
|
+
- **Betweenness Centrality** - Bridge entities connecting codebase parts
|
|
117
|
+
- **Community Detection** - Natural clusters and modules
|
|
118
|
+
- **Area Importance** - Hot spots with recent activity
|
|
119
|
+
|
|
120
|
+
### Senior Engineer Queries
|
|
121
|
+
- **Knowledge Silos** - Critical code with single owner
|
|
122
|
+
- **Domain Experts** - Who knows each module best
|
|
123
|
+
- **Change Impact** - What will be affected by changes
|
|
124
|
+
- **Dead Code** - Functions never called
|
|
125
|
+
|
|
126
|
+
### LLM-Powered Tools
|
|
127
|
+
- Interactive chat with 15+ graph exploration tools
|
|
128
|
+
- Auto-generated PROJECT.md documentation
|
|
129
|
+
- Feature specs from natural language descriptions
|
|
130
|
+
- Implementation plans with task breakdowns
|
|
131
|
+
- Team focus summaries
|
|
132
|
+
|
|
133
|
+
## Context Frame & Re-ranker
|
|
134
|
+
|
|
135
|
+
EmDash maintains a **Context Frame** - a dynamic window of relevant code entities that follows your exploration session.
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
139
|
+
│ CONTEXT FRAME PIPELINE │
|
|
140
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
141
|
+
|
|
142
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
143
|
+
│ Git Diff │ │ Agent │ │ Session │
|
|
144
|
+
│ (modified) │ │ Exploration │ │ State │
|
|
145
|
+
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
|
|
146
|
+
│ │ │
|
|
147
|
+
▼ ▼ ▼
|
|
148
|
+
┌──────────────────────────────────────────────────────────┐
|
|
149
|
+
│ CONTEXT PROVIDERS │
|
|
150
|
+
│ ┌─────────────────────┐ ┌─────────────────────────┐ │
|
|
151
|
+
│ │ TouchedAreasProvider│ │ ExploredAreasProvider │ │
|
|
152
|
+
│ │ • Modified files │ │ • Tool call results │ │
|
|
153
|
+
│ │ • AST neighbors │ │ • Search hits │ │
|
|
154
|
+
│ │ • 2-hop graph walk │ │ • Relevance scores │ │
|
|
155
|
+
│ └─────────────────────┘ └─────────────────────────┘ │
|
|
156
|
+
└──────────────────────────┬───────────────────────────────┘
|
|
157
|
+
│
|
|
158
|
+
▼
|
|
159
|
+
┌──────────────────────────────────────────────────────────┐
|
|
160
|
+
│ RE-RANKER │
|
|
161
|
+
│ │
|
|
162
|
+
│ Cross-encoder scores items against current query │
|
|
163
|
+
│ Keeps top 20 most relevant → LLM system prompt │
|
|
164
|
+
│ │
|
|
165
|
+
│ Model: mixedbread-ai/mxbai-rerank-xsmall-v1 │
|
|
166
|
+
└──────────────────────────────────────────────────────────┘
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**TouchedAreasProvider** - Tracks modified code via `git diff`, queries AST graph for related entities
|
|
170
|
+
|
|
171
|
+
**ExploredAreasProvider** - Records entities from agent tool calls with relevance scores
|
|
172
|
+
|
|
173
|
+
**Re-ranker** - Filters context to query-relevant items, reducing tokens while improving quality
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pytest # Run tests
|
|
179
|
+
black emdash/ # Format
|
|
180
|
+
mypy emdash/ # Type check
|
|
181
|
+
ruff check emdash/ # Lint
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Agent toolkit for LLM graph exploration."""
|
|
2
|
+
|
|
3
|
+
from emdash.agent.toolkit import AgentToolkit
|
|
4
|
+
from emdash.agent.session import AgentSession
|
|
5
|
+
from emdash.agent.runner import AgentRunner
|
|
6
|
+
from emdash.agent.tools.base import ToolResult, ToolCategory
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"AgentToolkit",
|
|
10
|
+
"AgentSession",
|
|
11
|
+
"AgentRunner",
|
|
12
|
+
"ToolResult",
|
|
13
|
+
"ToolCategory",
|
|
14
|
+
]
|