NeuroLoop™ – EXG-aware AI agent (Python edition using aider/litellm)
Project description
neuroloop-py
NeuroLoop™ – EXG-aware AI agent (Python edition)
A Python clone of neuroloop using aider's LLM infrastructure (litellm) instead of the pi coding agent framework.
What it does
neuroloop-py is an EXG-aware conversational AI agent that:
- Reads your brainwaves before every turn via
neuroskill status - Injects your live mental state into the system prompt so the AI can respond with full awareness of how you actually feel — cognitively, emotionally, somatically
- Auto-labels notable moments (awe, grief, deep focus, moral clarity, etc.) as permanent EXG annotations
- Runs guided protocols (breathing, meditation, grounding, somatic scans, etc.) step by step with OS notifications and EXG timestamps
- Searches the web, reads URLs, and maintains persistent memory across sessions
- Pre-warms the compare cache so session comparisons are instant when you ask
Architecture
neuroloop/
├── main.py Entry point — model selection, CLI args, asyncio.run()
├── agent.py NeuroloopAgent — main loop, before_agent_start hook, tool dispatch
├── memory.py ~/.neuroskill/memory.md — read/write persistent memory
├── prompts.py STATUS_PROMPT + build_system_prompt()
├── neuroskill/
│ ├── run.py run_neuroskill() — subprocess executor (npx neuroskill ...)
│ ├── signals.py detect_signals() — 35+ regex-based domain signal detectors
│ └── context.py select_contextual_data() — parallel neuroskill queries
└── tools/
├── web_fetch.py web_fetch tool — URL → plain text
├── web_search.py web_search tool — DuckDuckGo Lite (no API key)
└── protocol.py run_protocol tool — timed step execution + EXG labelling
vs. the TypeScript original
| TypeScript (neuroloop) | Python (neuroloop-py) |
|---|---|
| pi coding agent framework | aider / litellm |
pi ExtensionAPI |
NeuroloopAgent class |
before_agent_start hook |
agent.before_agent_start() async method |
pi registerTool |
ALL_TOOLS list (OpenAI function schema) |
pi InteractiveMode |
asyncio + rich console REPL |
| pi TUI (custom header/footer) | rich Markdown + rule separators |
| WebSocket EXG live panel | Per-turn neuroskill status query |
@sinclair/typebox schemas |
Plain Python dicts (OpenAI schema) |
TypeScript zod |
Python type hints |
Why litellm? Aider uses litellm internally. Using it directly gives us the same multi-provider support (Anthropic, OpenAI, Gemini, Ollama, …) without requiring a full aider installation.
Installation
cd /agent/ns/neuroloop-py
pip install -r requirements.txt
# or: pip install .
Requires Python ≥ 3.12.
Usage
# Interactive mode
python -m neuroloop.main
# With a specific model
python -m neuroloop.main --model claude-3-5-sonnet-20241022
# With an initial message
python -m neuroloop.main "How is my focus today?"
# Via the console script (after pip install)
neuroloop-py
neuroloop-py --model gpt-4o
Model selection (priority order)
--model MODELCLI flagNEUROLOOP_MODELenvironment variable- Auto-detect:
ANTHROPIC_API_KEY→ claude,OPENAI_API_KEY→ gpt-4o,GEMINI_API_KEY→ gemini, local Ollama → first available model - Fallback:
claude-3-5-sonnet-20241022
Commands
| Command | Description |
|---|---|
/exg |
Show live EXG snapshot |
/exg on / /exg off |
Toggle EXG display |
/neuro <cmd> [args] |
Run a neuroskill subcommand |
/memory |
Show agent memory |
/help |
Show all commands |
/quit |
Exit |
Tools available to the AI
| Tool | Description |
|---|---|
web_fetch |
Fetch any URL → plain text |
web_search |
DuckDuckGo Lite search (no API key) |
memory_read |
Read ~/.neuroskill/memory.md |
memory_write |
Write / append to memory |
neuroskill_label |
Create a timestamped EXG annotation |
neuroskill_run |
Run any neuroskill subcommand |
prewarm |
Start background neuroskill compare cache build |
run_protocol |
Execute a timed multi-step guided protocol |
Skills
The skills/ directory contains the same SKILL.md files as the TypeScript version.
They are loaded on-demand based on context signals detected in the user's prompt
(protocols, sleep, HRV, etc.).
Requirements
- Python ≥ 3.12
neuroskillnpm package (npx neuroskill status)- At least one LLM API key (
ANTHROPIC_API_KEY,OPENAI_API_KEY, etc.) or a running Ollama instance
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuroloop_py-0.0.1.tar.gz.
File metadata
- Download URL: neuroloop_py-0.0.1.tar.gz
- Upload date:
- Size: 78.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98dd19a577e0378df7ce8da63a2f99eedee99a72fd7d51a42eb7dff3db683af3
|
|
| MD5 |
260b0b0dfa93f54f7cccc2e4e9901aa3
|
|
| BLAKE2b-256 |
4ab55b704592793252ed64030e342e65ef328bd67bac19bdd882e36692969deb
|
File details
Details for the file neuroloop_py-0.0.1-py3-none-any.whl.
File metadata
- Download URL: neuroloop_py-0.0.1-py3-none-any.whl
- Upload date:
- Size: 52.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b22c5cb8023c2526d6c5c4b656f19fc3bd6276fe77feccc224f19351082f05
|
|
| MD5 |
a86cebc962784ef0181736c5d929843b
|
|
| BLAKE2b-256 |
28f7d4e6a6a72df08c6a6fb4f2f0663766fba84e0e1014df66edebd2b46a114f
|