Skip to main content

A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.

Project description

Athena Code Knowledge

A semantic code analysis tool designed to help Claude Code navigate repositories efficiently while dramatically reducing token consumption.

Motivation

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.

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.

What's the deal with the name?

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.

One of her symbolic animals was the owl.

Installation

NOTE: Athena currently only works in a Python codebase. More supported languages coming soon!

Install with pipx:

pipx install athena-code

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:

pipx install --python python3.12 athena-code

Usage

use athena --help to see up-to-date information about the available features:

╭─ Commands ─────────────────────────────────────────────────────────────────────╮
│ locate          Locate entities (functions, classes, methods, modules,         │
│                 packages) by name.                                             │
│ info            Get detailed information about a code entity or package.       │
│ mcp-server      Start the MCP server for Claude Code integration.              │
│ install-mcp     Install MCP server configuration for Claude Code.              │
│ sync            Update @athena hash tags in docstrings.                        │
│ status          Check docstring hash synchronization status.                   │
│ uninstall-mcp   Remove MCP server configuration from Claude Code.              │
╰────────────────────────────────────────────────────────────────────────────────╯

Generally, you will install athena and then:

  • Run athena sync in your codebase. This will add Athena's hashes to all the docstrings (for functions, classes, methods, modules, and packages) and allow athena to detect code changes that have invalidated the docstrings.
  • After code changes, run athena status to see a table of all the entities that have been updated and may have had their docstrings invalidated.
  • Update the necessary docstrings and then run athena sync again to update all the necessary hashes.

Supported Entity Types

Athena tracks docstrings for:

  • Functions — Standalone functions
  • Classes — Class definitions
  • Methods — Class methods
  • Modules — Individual Python files (module-level docstrings)
  • Packages — Directories with __init__.py (package-level docstrings in __init__.py)

For modules and packages, Athena uses intelligent hashing:

  • Module hashes are based on the complete file AST (excluding docstrings), capturing all semantic changes
  • Package hashes are based on __init__.py content plus the manifest of direct children (files and sub-packages)
  • This means package hashes change when files are added/removed/renamed, but remain stable when only implementation details change within existing modules

If you want to find an entity in the codebase, then just run athena locate <entity> to get details on the file and lines the entity occupies:

> athena locate get_task
 Kind    Path                    Extent  
 method  src/tasktree/parser.py  277-286

Once you know where a thing is, then you can ask for info about it:

> athena info src/tasktree/parser.py:get_task
{
  "method": {
    "name": "Recipe.get_task",
    "path": "src/tasktree/parser.py",
    "extent": {
      "start": 277,
      "end": 286
    },
    "sig": {
      "name": "get_task",
      "args": [
        {
          "name": "self"
        },
        {
          "name": "name",
          "type": "str"
        }
      ],
      "return_type": "Task | None"
    },
    "summary": "Get task by name.\n\n        Args:\n            name: Task name (may be namespaced like 'build.compile')\n\n        Returns:\n            Task if found, None otherwise\n        "
  }
}

Install Claude MCP integrations

Athena includes Model Context Protocol (MCP) integration, exposing code navigation capabilities as first-class tools in Claude Code.

Benefits

  • Native tool discovery — Tools appear in Claude Code's capabilities list
  • Structured I/O — Type-safe parameters and responses

Available Tools

  • ack_locate — Find entity location (file path + line range)
  • ack_info — Get information about an entity (kind, summary, etc.)
  • ack_status — Check whether all docstrings are up-to-date with the code they describe

Installation

athena install-mcp

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.

Uninstalling:

If you don't like using your Anthropic tokens more efficiently to generate better code, for some reason, then:

athena uninstall-mcp

to remove the MCP integration

Usage Workflow

cd /path/to/repository
athena locate validateSession  # Find the locations of entities in the codebase

Contributing

This is an active development project. Early-stage contributions welcome, particularly:

  • Tree-sitter AST extraction improvements
  • Language-specific signature formatting
  • LLM prompt engineering for summary quality
  • Performance benchmarking

License

MIT - See LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

athena_code-0.0.15.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

athena_code-0.0.15-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file athena_code-0.0.15.tar.gz.

File metadata

  • Download URL: athena_code-0.0.15.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for athena_code-0.0.15.tar.gz
Algorithm Hash digest
SHA256 973f78f6e475627f7138be7b8815791386ea9cb7c39a709ea5c2f483f0d90eea
MD5 c3478642ed9d63f46ebbe9a88692cc7d
BLAKE2b-256 26547a1608efec7438ab8db07a61563a2fc0faf34b8d26f15df3a534fe0d604b

See more details on using hashes here.

Provenance

The following attestation bundles were made for athena_code-0.0.15.tar.gz:

Publisher: release.yml on kevinchannon/athena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file athena_code-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: athena_code-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for athena_code-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 81911668bf88e06b351df6e300b6a5c409547bbde492d93baed677223a601215
MD5 98c0e41e2f8bf8d2be062b3ae2f0f2f7
BLAKE2b-256 a0750956000ffd8f97bcdc96b0faeff1f944bc87627bb150d91be3d5c3d4afe5

See more details on using hashes here.

Provenance

The following attestation bundles were made for athena_code-0.0.15-py3-none-any.whl:

Publisher: release.yml on kevinchannon/athena

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page