Skip to main content

Push your codebase to a graph DB and query it with natural language

Project description

memory-neo/docs/README.md

Path: docs/README.md

Purpose: User-facing documentation โ€” install, usage, deployment

๐Ÿง  memory-neo

Push your codebase to a graph database. Query it with natural language.

pip install memory-neo
cd your-project/
memory-neo push
memory-neo query "show all auth functions"
memory-neo context parse_directory

How it works

  1. Push โ€” memory-neo push scans your project, extracts files and Python functions via AST, and sends the structure to a hosted Memgraph graph database.
  2. Query โ€” memory-neo query "..." converts your question to Cypher via Claude, runs it against your graph, and prints results with code highlighting.
  3. Context โ€” memory-neo context <name> fetches a function or file as prompt-ready code you can paste into any LLM.

Install

pip install memory-neo

Python 3.9+ required.


Authentication

Get an API key at memory-neo.dev, then:

memory-neo login
# Paste your API key when prompted
# Saved to ~/.memoryneo/config.json

Commands

memory-neo push

Scan the current directory and push its structure to Memgraph.

memory-neo push                        # use directory name as project name
memory-neo push my-project             # explicit project name
memory-neo push --dir ./src            # scan a subdirectory
memory-neo push --dry-run              # scan only, don't push

What gets indexed:

  • Files: .py .js .jsx .ts .tsx .html .md .txt
  • Python: full AST extraction โ€” function names, line numbers, args, docstrings, code
  • Other: file name, path, content, line count

Ignored by default (via memIgnore):

  • .venv/, node_modules/, __pycache__/, .git/, *.pyc, .env, and more

Custom ignore: place a memIgnore file in your project root (same syntax as .gitignore).


memory-neo query

Ask a natural language question about your indexed codebase.

memory-neo query "show all auth functions"
memory-neo query "which files import httpx"
memory-neo query "list all Python files"
memory-neo query "how many functions are in each file"
memory-neo query "show the parse_directory function"
memory-neo query --project my-project "show all classes"
memory-neo query --raw "..."           # print raw JSON
memory-neo query --context "..."       # dump results as prompt-ready context block
memory-neo query                       # interactive mode

memory-neo context

Fetch the raw code of a function or file โ€” ready to paste into a prompt.

memory-neo context parse_directory           # fetch function by name
memory-neo context memory_neo/main.py        # fetch file by path
memory-neo context login --type function     # force function lookup
memory-neo context main.py --copy            # copy to clipboard

Ignore patterns (memIgnore)

Place a memIgnore file in your project root to control what gets scanned. Uses the same syntax as .gitignore:

# Folders
.venv/
node_modules/
dist/

# Wildcards
*.log
*.tmp
*.pyc

# Files
.env
secrets.json

If no memIgnore is found in your project, the package default is used (covers most common cases).


Self-hosting

You can run the entire backend yourself.

Requirements

  • Fly.io account
  • Supabase (or any PostgreSQL) account
  • Anthropic API key

Deploy

# 1. Deploy Memgraph
fly deploy --config deploy/fly.memgraph.toml

# 2. Create persistent volume
fly volumes create memgraph_data --size 20 --region cdg --app memory-neo-graph

# 3. Init Memgraph schema
fly ssh console --app memory-neo-graph
# Inside pod:
cat /init.cypher | mgconsole

# 4. Set API secrets
fly secrets set \
  ANTHROPIC_API_KEY=sk-ant-... \
  DATABASE_URL=postgresql://... \
  API_SECRET_SALT=$(openssl rand -base64 32) \
  --app memory-neo-api

# 5. Deploy API
fly deploy --config deploy/fly.api.toml

# 6. Run Prisma migrations
fly ssh console --app memory-neo-api
# Inside pod:
prisma migrate deploy --schema=schema.prisma

Point CLI to your instance

memory-neo login --api-url https://your-api.fly.dev

Project structure

memory-neo/
โ”œโ”€โ”€ memory_neo/              โ† Python package (pip install memory-neo)
โ”‚   โ”œโ”€โ”€ cli/                 โ† push, query, context, login commands
โ”‚   โ”œโ”€โ”€ core/                โ† scanner, AST extractor, ignore patterns
โ”‚   โ”œโ”€โ”€ graph/               โ† HTTP client to backend
โ”‚   โ”œโ”€โ”€ nlp/                 โ† result formatter
โ”‚   โ””โ”€โ”€ utils/               โ† config, display helpers
โ”œโ”€โ”€ api/                     โ† FastAPI backend (Fly.io)
โ”‚   โ”œโ”€โ”€ routes/              โ† push, query, context, auth endpoints
โ”‚   โ”œโ”€โ”€ services/            โ† graph (Memgraph), nlp (Claude), auth
โ”‚   โ””โ”€โ”€ db/                  โ† schema.prisma (PostgreSQL)
โ”œโ”€โ”€ deploy/                  โ† Dockerfiles, fly.toml configs, init.cypher
โ””โ”€โ”€ docs/                    โ† this file

Tech stack

Layer Technology
CLI package Python + Click + Rich
Backend FastAPI on Fly.io
Graph DB Memgraph on Fly.io (Bolt protocol)
Postgres Supabase
NLP engine Claude API (claude-sonnet)
Auth API key (SHA-256 hashed)

License

MIT

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

memory_neo-0.1.3.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

memory_neo-0.1.3-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file memory_neo-0.1.3.tar.gz.

File metadata

  • Download URL: memory_neo-0.1.3.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for memory_neo-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3941e6791b4b00f1a0c56f4a555ae71ad39a44cace75fab4cdabd6ad0a7fc95a
MD5 2a0e6bbb78cfde719587d1f5fed6cfdf
BLAKE2b-256 68b301273bb77b499e9d322aa43929b06cc49128829fc4ad24cd44e4372c3f99

See more details on using hashes here.

File details

Details for the file memory_neo-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: memory_neo-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for memory_neo-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc231275f3a32b544195c8f910a6d1f485bdd54a9fa3ea22dc436b7912a2526
MD5 df8ad6e68306cb2794bbcce43a709194
BLAKE2b-256 e3736745f0fa513c63b8aa3240c48c6fefd26412c50a04fcdc5aab72c7a6ac59

See more details on using hashes here.

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