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.2.tar.gz (19.6 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.2-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memory_neo-0.1.2.tar.gz
  • Upload date:
  • Size: 19.6 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.2.tar.gz
Algorithm Hash digest
SHA256 42d87c5790a2c67f3d633a355a16f9dda4e898b5d637953b6c65af3c7af8b45d
MD5 3677e200c57e2cc7aea372a501f02662
BLAKE2b-256 4d6bb2e47c6e430b87a8a6aa98a4ba62997a9fa4af56b230111e1806b3077a49

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memory_neo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0a02cd5fda5089ae2fc536bab716117617094280a36421e738342999242224a
MD5 35b3165cbe512e8e6dc448402361f9ec
BLAKE2b-256 88db0ad4eba54ec35d34d66ae91ae656727fc48031b5c274d64e9472acd49180

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