athena-code 0.0.11__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.
Files changed (43) hide show
  1. athena_code-0.0.11/LICENSE +21 -0
  2. athena_code-0.0.11/PKG-INFO +96 -0
  3. athena_code-0.0.11/README.md +384 -0
  4. athena_code-0.0.11/pyproject.toml +37 -0
  5. athena_code-0.0.11/setup.cfg +4 -0
  6. athena_code-0.0.11/src/athena/README.md +76 -0
  7. athena_code-0.0.11/src/athena/__init__.py +8 -0
  8. athena_code-0.0.11/src/athena/__main__.py +5 -0
  9. athena_code-0.0.11/src/athena/cli.py +347 -0
  10. athena_code-0.0.11/src/athena/docstring_updater.py +118 -0
  11. athena_code-0.0.11/src/athena/entity_path.py +146 -0
  12. athena_code-0.0.11/src/athena/hashing.py +156 -0
  13. athena_code-0.0.11/src/athena/info.py +84 -0
  14. athena_code-0.0.11/src/athena/locate.py +52 -0
  15. athena_code-0.0.11/src/athena/mcp_config.py +103 -0
  16. athena_code-0.0.11/src/athena/mcp_server.py +135 -0
  17. athena_code-0.0.11/src/athena/models.py +90 -0
  18. athena_code-0.0.11/src/athena/parsers/__init__.py +22 -0
  19. athena_code-0.0.11/src/athena/parsers/base.py +39 -0
  20. athena_code-0.0.11/src/athena/parsers/python_parser.py +633 -0
  21. athena_code-0.0.11/src/athena/repository.py +75 -0
  22. athena_code-0.0.11/src/athena/status.py +88 -0
  23. athena_code-0.0.11/src/athena/sync.py +511 -0
  24. athena_code-0.0.11/src/athena_code.egg-info/PKG-INFO +96 -0
  25. athena_code-0.0.11/src/athena_code.egg-info/SOURCES.txt +41 -0
  26. athena_code-0.0.11/src/athena_code.egg-info/dependency_links.txt +1 -0
  27. athena_code-0.0.11/src/athena_code.egg-info/entry_points.txt +3 -0
  28. athena_code-0.0.11/src/athena_code.egg-info/requires.txt +12 -0
  29. athena_code-0.0.11/src/athena_code.egg-info/top_level.txt +1 -0
  30. athena_code-0.0.11/tests/test_cli.py +375 -0
  31. athena_code-0.0.11/tests/test_docstring_updater.py +301 -0
  32. athena_code-0.0.11/tests/test_entity_path.py +268 -0
  33. athena_code-0.0.11/tests/test_hashing.py +350 -0
  34. athena_code-0.0.11/tests/test_info.py +192 -0
  35. athena_code-0.0.11/tests/test_locate.py +97 -0
  36. athena_code-0.0.11/tests/test_mcp_config.py +171 -0
  37. athena_code-0.0.11/tests/test_mcp_server.py +27 -0
  38. athena_code-0.0.11/tests/test_models.py +346 -0
  39. athena_code-0.0.11/tests/test_repository.py +115 -0
  40. athena_code-0.0.11/tests/test_status.py +254 -0
  41. athena_code-0.0.11/tests/test_status_e2e.py +279 -0
  42. athena_code-0.0.11/tests/test_sync.py +462 -0
  43. athena_code-0.0.11/tests/test_sync_recursive.py +365 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kevinchannon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: athena-code
3
+ Version: 0.0.11
4
+ Summary: A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: typer>=0.12.0
9
+ Requires-Dist: tree-sitter>=0.21.0
10
+ Requires-Dist: tree-sitter-python>=0.21.0
11
+ Requires-Dist: mcp>=1.0.0
12
+ Requires-Dist: rich>=14.2.0
13
+ Provides-Extra: dev
14
+ Requires-Dist: build; extra == "dev"
15
+ Requires-Dist: pytest>=7.0; extra == "dev"
16
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
17
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
18
+ Requires-Dist: tasktree; extra == "dev"
19
+ Dynamic: license-file
20
+
21
+ # Athena Code Knowledge
22
+
23
+ A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.
24
+
25
+ ## Motivation
26
+
27
+ Claude Code currently incurs significant token costs during repository navigation. A typical planning phase involves reading 10-20 files to understand codebase architecture, consuming substantially more tokens than the targeted modifications themselves. This linear scaling with codebase size makes work on large repositories inefficient.
28
+
29
+ Most discovery queries ("What does this file contain?", "Where is function X?") don't require reading entire source files. By building a queryable semantic index, we can answer these questions using structured metadata instead, potentially reducing planning token costs by 15-30x.
30
+
31
+ ## What's the deal with the name?
32
+ Athena was an Ancient Greek goddess associated with strategic wisdom, logic, crafts, architecture and discipline. She is a patron of engineers and planners, not dreamers. Seemed appropriate.
33
+
34
+ One of her symbolic animals was the owl.
35
+
36
+ ## Installation
37
+
38
+ NOTE: Athena currently only works in a Python codebase. More supported languages coming soon!
39
+
40
+ Install with pipx:
41
+ ```bash
42
+ pipx install athena-code
43
+ ```
44
+ Requires at least Python 3.12, so if that's not installed you should do that with your system package manager. It doesn't need to be the default Python, you can leave that at whatever you want and point Pipx at Python 3.12 explicitly:
45
+ ```bash
46
+ pipx install --python python3.12 athena-code
47
+ ```
48
+
49
+ ### Install Claude MCP integrations
50
+
51
+ Athena includes Model Context Protocol (MCP) integration, exposing code navigation capabilities as first-class tools in Claude Code.
52
+
53
+ ### Benefits
54
+
55
+ - **Native tool discovery** — Tools appear in Claude Code's capabilities list
56
+ - **Structured I/O** — Type-safe parameters and responses
57
+
58
+ ### Available Tools
59
+
60
+ - **`ack_locate`** — Find Python entity location (file path + line range)
61
+
62
+ ### Installation
63
+
64
+ ```bash
65
+ athena install-mcp
66
+ ```
67
+
68
+ This automatically configures Claude Code by adding the MCP server entry to your config file. You will need to restart Claude Code for changes to take effect.
69
+
70
+ **Uninstalling:**
71
+
72
+ If you don't like using your Anthropic tokens more efficiently to generate better code, for some reason, then:
73
+ ```bash
74
+ athena uninstall-mcp
75
+ ```
76
+ to remove the MCP integration
77
+
78
+ ## Usage Workflow
79
+
80
+ ```bash
81
+ cd /path/to/repository
82
+ athena locate validateSession # Find the locations of entities in the codebase
83
+ ```
84
+
85
+ ## Contributing
86
+
87
+ This is an active development project. Early-stage contributions welcome, particularly:
88
+
89
+ - Tree-sitter AST extraction improvements
90
+ - Language-specific signature formatting
91
+ - LLM prompt engineering for summary quality
92
+ - Performance benchmarking
93
+
94
+ ## License
95
+
96
+ MIT - See LICENSE
@@ -0,0 +1,384 @@
1
+ Work in Progress!
2
+
3
+ # Athena Code Knowledge
4
+
5
+ A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.
6
+
7
+ ## Motivation
8
+
9
+ Claude Code currently incurs significant token costs during repository navigation. A typical planning phase involves reading 10-20 files to understand codebase architecture, consuming substantially more tokens than the targeted modifications themselves. This linear scaling with codebase size makes work on large repositories inefficient.
10
+
11
+ Most discovery queries ("What does this file contain?", "Where is function X?") don't require reading entire source files. By building a queryable semantic index, we can answer these questions using structured metadata instead, potentially reducing planning token costs by 15-30x.
12
+
13
+ ## What's the deal with the name?
14
+ Athena was an Ancient Greek goddess associated with strategic wisdom, logic, crafts, architecture and discipline. She is a patron of engineers and planners, not dreamers. Seemed appropriate.
15
+
16
+ One of her symbolic animals was the owl.
17
+
18
+ ## Key Design Principles
19
+
20
+ 1. **Rich docstrings** - Use LLMs to generate rich, accurate docstrings that can be reported back quickly by AST-based search
21
+ 2. **Docstring hashes detect staleness** - The docstring contains hashes covering the code and the summary; if either changes the relevant hash is regenerated
22
+ 2. **Always-accurate positions** — Line ranges are computed from AST on every query, ensuring data never becomes stale
23
+ 3. **Unified output format** — All info queries return `{sig, summary}` structure where available
24
+ 4. **AST-based change detection** — Formatting and comment changes don't invalidate summaries
25
+
26
+ ## Architecture Overview
27
+
28
+ The tool comprises two layers:
29
+
30
+ - **CLI interface** — Simple, composable commands outputting JSON
31
+ - **Tree-sitter AST parser** — On-demand extraction of signatures, docstrings, and line ranges
32
+
33
+ ### Supported Languages
34
+
35
+ Current:
36
+ - Python
37
+
38
+ Planned
39
+ - JavaScript
40
+ - TypeScript
41
+
42
+ All three have mature, production-grade tree-sitter support.
43
+
44
+ ## Output Format
45
+
46
+ All entity queries return a consistent three-tier information structure:
47
+
48
+ ```json
49
+ {
50
+ "path": "src/auth/session.ts",
51
+ "extent": { "start": 88, "end": 105 },
52
+ "sig": "validateSession(token: string): Promise<User>",
53
+ "docs": "Verifies JWT signature and expiry, queries database for session status, returns User object or raises AuthError."
54
+ }
55
+ ```
56
+
57
+ Information hierarchy for Claude Code:
58
+ 1. **`summary`** (if present) — Author- or LLM-written docstring
59
+ 2. **`sig`** (fallback) — Structural signature from AST
60
+
61
+ ## Implementation Roadmap
62
+
63
+ ### Stage 1: AST Queries
64
+
65
+ **Goal:** Deliver immediate utility with zero LLM cost.
66
+
67
+ **Features:**
68
+ - `athena locate <entity>` — Find entity and return file path + line range
69
+ - `athena info <entity>` — Return `{sig, summary}`
70
+ - `athena file-info <path>` — File-level overview with entity list
71
+
72
+ **Example:**
73
+ ```bash
74
+ $ athena locate validateSession
75
+ {"path": "src/auth/session.ts", "extent": { "start": 88, "end": 105 }}
76
+
77
+ $ athena info validateSession
78
+ {
79
+ "path": "src/auth/session.ts",
80
+ "extent": { "start": 88, "end": 105 },
81
+ "sig": "validateSession(token: string): Promise<User>",
82
+ "summary": "Validates JWT token and returns user object."
83
+ }
84
+ ```
85
+
86
+ **Deliverable:** Working CLI tool, ~500 lines of code, immediate value for small repositories.
87
+
88
+ ### Stage 2: LLM Semantic Summaries
89
+
90
+ **Goal:** Add rich semantic descriptions for comprehensive code understanding.
91
+
92
+ **Features:**
93
+ - `athena init` - Update existing doc comments with athena hashes
94
+ - `ack summarise` — Generate LLM summaries for all entities (modules, files, function, classes, etc)
95
+ - `ack summarise <entity>` — Generate summary for specific entity
96
+ - Batch processing for LLM efficiency
97
+ - Summary invalidation on semantic (not formatting) changes
98
+
99
+ **Example:**
100
+ ```bash
101
+ $ ack summarise
102
+ Processing 1,842 entities in batches of 50...
103
+ Generated 1,842 LLM summaries
104
+ Total tokens used: 45,000
105
+
106
+ $ ack info validateSession
107
+ {
108
+ "path": "src/auth/session.ts",
109
+ "extent": { "start": 88, "end": 105 },
110
+ "sig": "validateSession(token: string): Promise<User>",
111
+ "summary": "Verifies JWT signature and expiry, queries database for active session status, returns User object or raises AuthError."
112
+ }
113
+ ```
114
+
115
+ **Deliverable:** Complete semantic navigation capability with 20-50x token reduction for discovery workflows.
116
+
117
+ **Summary invalidation strategy:**
118
+ - Formatting changes (whitespace, comments) → no re-summarisation
119
+ - Docstring updates → no re-summarisation (docstrings separate from summaries)
120
+ - Signature or control flow changes → summary marked invalid
121
+ - User runs `athena update` to detect, `athena summarise` to regenerate
122
+
123
+ ## Token Efficiency Analysis
124
+
125
+ **Current Claude Code workflow** (without tool):
126
+ 1. "What files handle authentication?" → scan 10 files (20,000 tokens)
127
+ 2. "What's in session.ts?" → read full file (2,000 tokens)
128
+ 3. "Where's validateSession?" → already in context
129
+ 4. Make modification → include full file context (2,000 tokens)
130
+
131
+ **Total:** ~24,000 tokens
132
+
133
+ **With `athena` (Stage 2):**
134
+ 1. "What files handle authentication?" → `ack file-info` with summaries (300 tokens)
135
+ 2. "What's in session.ts?" → already have summary
136
+ 3. "Where's validateSession?" → `ack info` includes rich summary (100 tokens)
137
+ 4. Extract function → `sed -n '88,105p'` (150 tokens)
138
+
139
+ **Total:** ~550 tokens
140
+ **Reduction:** 44x
141
+
142
+ **Amortisation:**
143
+ - Stage 1 cost: Zero (no LLM, no storage)
144
+ - Stage 2 cost: ~100ms one-time indexing
145
+ - Stage 3 cost: 45,000 tokens one-time (example 1,842-entity repo)
146
+ - Break-even: After 2 complex queries
147
+ - Ongoing cost: Near-zero (summaries rarely invalidate)
148
+
149
+ ## MCP Integration
150
+
151
+ Athena includes Model Context Protocol (MCP) integration, exposing code navigation capabilities as first-class tools in Claude Code.
152
+
153
+ ### Benefits
154
+
155
+ - **Native tool discovery** — Tools appear in Claude Code's capabilities list
156
+ - **Structured I/O** — Type-safe parameters and responses
157
+
158
+ ### Available Tools
159
+
160
+ Currently supported:
161
+
162
+ - **`ack_locate`** — Find Python entity location (file path + line range)
163
+
164
+ ## Sync Command
165
+
166
+ The `athena sync` command updates or inserts `@athena` hash tags in entity docstrings. These hashes are computed from the AST and enable staleness detection without external caches or databases.
167
+
168
+ ### Usage
169
+
170
+ ```bash
171
+ # Sync entire project
172
+ athena sync
173
+
174
+ # Sync specific module (all entities within it)
175
+ athena sync src/module.py --recursive
176
+
177
+ # Sync specific entity
178
+ athena sync src/module.py:MyClass
179
+ athena sync src/module.py:my_function
180
+ athena sync src/module.py:MyClass.method
181
+
182
+ # Force recalculation even if hash is valid
183
+ athena sync src/module.py:MyClass --force
184
+
185
+ # Sync package recursively
186
+ athena sync src/mypackage --recursive
187
+ ```
188
+
189
+ ### How It Works
190
+
191
+ 1. Computes AST-derived hash for each entity (function, class, method)
192
+ 2. Embeds hash in docstring as `@athena: <hash>` tag
193
+ 3. Preserves existing docstring content
194
+ 4. Only updates when code changes (unless `--force` is used)
195
+
196
+ ### Example
197
+
198
+ Before sync:
199
+ ```python
200
+ def calculate(x, y):
201
+ """Add two numbers."""
202
+ return x + y
203
+ ```
204
+
205
+ After sync:
206
+ ```python
207
+ def calculate(x, y):
208
+ """Add two numbers.
209
+ @athena: a1b2c3d4e5f6
210
+ """
211
+ return x + y
212
+ ```
213
+
214
+ ### Exit Codes
215
+
216
+ - **Positive integer**: Number of entities updated
217
+ - **0**: No updates needed
218
+ - **Negative integer**: Error occurred
219
+
220
+ ### Hash Algorithm
221
+
222
+ - **Functions/methods**: Hash of signature + body AST
223
+ - **Classes**: Hash of class declaration + all method signatures + implementations
224
+ - **Modules**: Hash of non-whitespace from entity docstrings
225
+ - **Packages**: Hash of non-whitespace from module docstrings
226
+
227
+ Hashes are 12-character SHA-256 truncations, sufficient for collision avoidance in typical codebases.
228
+
229
+ ### Installation
230
+
231
+ Automatic configuration (recommended):
232
+
233
+ ```bash
234
+ ack install-mcp
235
+ ```
236
+
237
+ This automatically configures Claude Code by adding the MCP server entry to your config file.
238
+
239
+ Manual configuration:
240
+
241
+ Add to your Claude Code config file:
242
+
243
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
244
+ **Linux:** `~/.config/Claude/claude_desktop_config.json`
245
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
246
+
247
+ ```json
248
+ {
249
+ "mcpServers": {
250
+ "ack": {
251
+ "command": "ack",
252
+ "args": ["mcp-server"]
253
+ }
254
+ }
255
+ }
256
+ ```
257
+
258
+ Restart Claude Code for changes to take effect.
259
+
260
+ ### Troubleshooting
261
+
262
+ **Tools not appearing:**
263
+ - Verify `ack` is installed and in your PATH: `which ack`
264
+ - Check Claude Code logs for MCP server errors
265
+ - Ensure config file syntax is valid JSON
266
+
267
+ **Server not starting:**
268
+ - Run `ack mcp-server` manually to check for errors
269
+ - Verify MCP dependency is installed: `pip show mcp`
270
+
271
+ **Uninstalling:**
272
+
273
+ ```bash
274
+ ack uninstall-mcp
275
+ ```
276
+
277
+ ## Future Extensions
278
+
279
+ Beyond current implementation:
280
+
281
+ - **Reverse semantic search** — "Where is feature X implemented?" using embedding-based search
282
+ - **Hierarchical summary trees** — Navigate codebases through semantic relationships
283
+ - **Call graph analysis** — "What calls this function?"
284
+ - **Impact analysis** — "What breaks if I change this?"
285
+
286
+ ## Technical Stack
287
+
288
+ - **Language:** Python 3.10+
289
+ - **AST parsing:** tree-sitter with language-specific bindings
290
+ - **CLI framework:** Typer
291
+ - **MCP integration:** Official MCP Python SDK
292
+ - **Caching layer:** TBD (considering SQLite, LMDB)
293
+ - **LLM client:** Anthropic API (Claude) — Stage 3 only
294
+ - **Distribution:** pipx-installable package
295
+
296
+ ## Installation
297
+
298
+ ```bash
299
+ pipx install athena-code
300
+ ```
301
+
302
+ ## Usage Workflow
303
+
304
+ ```bash
305
+ # Stage 1: Works immediately
306
+ cd /path/to/repository
307
+ ack info validateSession
308
+
309
+ # Stage 2: Create index for speed
310
+ ack init
311
+
312
+ # Stage 3: Generate LLM summaries (optional, costs tokens)
313
+ ack summarise
314
+
315
+ # Daily usage
316
+ ack locate <entity> # Find entity location
317
+ ack info <entity> # Get complete information
318
+ ack file-info <path> # File overview
319
+ ack update # After code changes
320
+ ```
321
+
322
+ ## Design Rationale
323
+
324
+ ### Why not cache signatures and docstrings?
325
+
326
+ AST parsing is cheap (~5ms per file). Caching this data risks staleness—if line numbers shift due to edits elsewhere in the file, cached positions become incorrect. By parsing on-demand, we guarantee accuracy.
327
+
328
+ ### Why cache LLM summaries?
329
+
330
+ LLM API calls are expensive (time and tokens). Summaries describe semantic behaviour, which changes far less frequently than formatting or comments. AST-based hashing lets us invalidate summaries only when code semantics actually change.
331
+
332
+ ### Why separate sig/docs/summary fields?
333
+
334
+ Claude Code needs decision-making flexibility:
335
+ - Quick structural understanding → use `sig`
336
+ - Author's documented intent → use `docs`
337
+ - Rich semantic context → use `summary`
338
+
339
+ Not all code is documented; not all projects want LLM costs. The three-tier system provides graceful degradation.
340
+
341
+ ## Contributing
342
+
343
+ This is an active development project. Early-stage contributions welcome, particularly:
344
+
345
+ - Tree-sitter AST extraction improvements
346
+ - Language-specific signature formatting
347
+ - LLM prompt engineering for summary quality
348
+ - Performance benchmarking
349
+
350
+ ## License
351
+
352
+ MIT - See LICENSE
353
+
354
+ ## Development and Installation
355
+
356
+ ```bash
357
+ uv sync
358
+ ```
359
+
360
+ ## Development
361
+
362
+ Install development dependencies:
363
+
364
+ ```bash
365
+ uv sync --extra dev
366
+ ```
367
+
368
+ Run tests:
369
+
370
+ ```bash
371
+ uv run pytest
372
+ ```
373
+
374
+ ## Usage
375
+
376
+ ```bash
377
+ uv run python -m athena
378
+ ```
379
+
380
+ Or use the shorthand:
381
+
382
+ ```bash
383
+ uv run -m athena
384
+ ```
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "athena-code"
7
+ version = "0.0.11"
8
+ description = "A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption."
9
+ readme = "src/athena/README.md"
10
+ requires-python = ">=3.12"
11
+ dependencies = [
12
+ "typer>=0.12.0",
13
+ "tree-sitter>=0.21.0",
14
+ "tree-sitter-python>=0.21.0",
15
+ "mcp>=1.0.0",
16
+ "rich>=14.2.0",
17
+ ]
18
+
19
+ [project.scripts]
20
+ ack = "athena.cli:app"
21
+ athena = "athena.cli:app"
22
+
23
+ [project.optional-dependencies]
24
+ dev = [
25
+ "build",
26
+ "pytest>=7.0",
27
+ "pytest-cov>=4.0",
28
+ "pytest-asyncio>=0.23.0",
29
+ "tasktree"
30
+ ]
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["src"]
34
+
35
+ [tool.pytest.ini_options]
36
+ testpaths = ["tests"]
37
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,76 @@
1
+ # Athena Code Knowledge
2
+
3
+ A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.
4
+
5
+ ## Motivation
6
+
7
+ Claude Code currently incurs significant token costs during repository navigation. A typical planning phase involves reading 10-20 files to understand codebase architecture, consuming substantially more tokens than the targeted modifications themselves. This linear scaling with codebase size makes work on large repositories inefficient.
8
+
9
+ Most discovery queries ("What does this file contain?", "Where is function X?") don't require reading entire source files. By building a queryable semantic index, we can answer these questions using structured metadata instead, potentially reducing planning token costs by 15-30x.
10
+
11
+ ## What's the deal with the name?
12
+ Athena was an Ancient Greek goddess associated with strategic wisdom, logic, crafts, architecture and discipline. She is a patron of engineers and planners, not dreamers. Seemed appropriate.
13
+
14
+ One of her symbolic animals was the owl.
15
+
16
+ ## Installation
17
+
18
+ NOTE: Athena currently only works in a Python codebase. More supported languages coming soon!
19
+
20
+ Install with pipx:
21
+ ```bash
22
+ pipx install athena-code
23
+ ```
24
+ Requires at least Python 3.12, so if that's not installed you should do that with your system package manager. It doesn't need to be the default Python, you can leave that at whatever you want and point Pipx at Python 3.12 explicitly:
25
+ ```bash
26
+ pipx install --python python3.12 athena-code
27
+ ```
28
+
29
+ ### Install Claude MCP integrations
30
+
31
+ Athena includes Model Context Protocol (MCP) integration, exposing code navigation capabilities as first-class tools in Claude Code.
32
+
33
+ ### Benefits
34
+
35
+ - **Native tool discovery** — Tools appear in Claude Code's capabilities list
36
+ - **Structured I/O** — Type-safe parameters and responses
37
+
38
+ ### Available Tools
39
+
40
+ - **`ack_locate`** — Find Python entity location (file path + line range)
41
+
42
+ ### Installation
43
+
44
+ ```bash
45
+ athena install-mcp
46
+ ```
47
+
48
+ This automatically configures Claude Code by adding the MCP server entry to your config file. You will need to restart Claude Code for changes to take effect.
49
+
50
+ **Uninstalling:**
51
+
52
+ If you don't like using your Anthropic tokens more efficiently to generate better code, for some reason, then:
53
+ ```bash
54
+ athena uninstall-mcp
55
+ ```
56
+ to remove the MCP integration
57
+
58
+ ## Usage Workflow
59
+
60
+ ```bash
61
+ cd /path/to/repository
62
+ athena locate validateSession # Find the locations of entities in the codebase
63
+ ```
64
+
65
+ ## Contributing
66
+
67
+ This is an active development project. Early-stage contributions welcome, particularly:
68
+
69
+ - Tree-sitter AST extraction improvements
70
+ - Language-specific signature formatting
71
+ - LLM prompt engineering for summary quality
72
+ - Performance benchmarking
73
+
74
+ ## License
75
+
76
+ MIT - See LICENSE
@@ -0,0 +1,8 @@
1
+ """Athena - A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption."""
2
+
3
+ try:
4
+ from importlib.metadata import version
5
+
6
+ __version__ = version("athena")
7
+ except Exception:
8
+ __version__ = "0.0.0.dev0+local" # Fallback for development
@@ -0,0 +1,5 @@
1
+ from athena.cli import app
2
+
3
+
4
+ if __name__ == "__main__":
5
+ app()